Purpose
This subcommand call is an aggregate
operation that returns a list of the names of all attached aggregates
on a system.
Format
syscall_parmlist
opcode 135 AGOP_LISTAGGRNAMES_PARMDATA
parms[0] buffer length or 0
parms[1] offset to AGGR_ID or 0
parms[2] offset to size
parms[3] offset to system name (optional)
parms[4] 0
parms[5] 0
parms[6] 0
AGGR_ID[2] Array of AGGR_IDs (n can be 0)
aid_eye char[4] "AGID"
aid_len char sizeof(AGGR_ID)
aid_ver char 1
aid_name char[45] "OMVS.PRV.AGGR001.LDS0001"
aid_reserved char[33] 0
size needed long 0
systemname char[9]
Return_value 0 if request is successful, -1 if it is not successful
Return_code
EINTR ZFS is shutting down
EINVAL Invalid parameter list
EMVSERR Internal error using an osi service
ENOENT Aggregate is not attached
E2BIG List is too big for buffer supplied
Reason_code
0xEFnnxxxx See z/OS Distributed File Service Messages and Codes
Usage notes
- This call returns an array of AGGR_IDs, one for each attached
aggregate on the system. Each AGGR_ID structure is 84 bytes. You can
specify a buffer that you think might hold all of them or you can
specify a buffer length and offset of zero. If you get a return code
of E2BIG, the required size for the buffer is contained in the size
field.
- Reserved fields and undefined flags must be set to binary zeros.
Related services
- List Aggregate Status
- List File System Names
Examples
#pragma linkage(BPX1PCT, OS)
extern void BPX1PCT(char *, int, int, char *, int *, int *, int *);
#include <stdio.h>
#define ZFSCALL_AGGR 0x40000005
#define AGOP_LISTAGGRNAMES_PARMDATA 135
#define E2BIG 145
typedef struct syscall_parmlist_t {
int opcode; /* Operation code to perform */
int parms[7]; /* Specific to type of operation, */
/* provides access to the parms */
/* parms[4]-parms[6] are currently unused*/
} syscall_parmlist;
#define ZFS_MAX_AGGRNAME 44
typedef struct aggr_id_t {
char aid_eye[4]; /* Eye Catcher */
#define AID_EYE "AGID"
char aid_len; /* Length of this structure */
char aid_ver; /* Version */
#define AID_VER_INITIAL 1 /* Initial version */
char aid_name[ZFS_MAX_AGGRNAME+1]; /* aggr name, null terminated */
char aid_reserved[33]; /* Reserved for the future */
} AGGR_ID;
struct parmstruct
{
syscall_parmlist myparms;
/* Real malloc'd structure will have an array of AGGR_IDs here */
long size;
char systemname[9];
} ;
int main(int argc, char **argv)
{
int bpxrv;
int bpxrc;
int bpxrs;
struct parmstruct myparmstruct;
AGGR_ID *aggPtr;
int aggSize = sizeof(AGGR_ID);
int buflen = sizeof(AGGR_ID);
struct parmstruct *myp = &myparmstruct;
int mypsize;
char *systemp;
int count_aggrs, total_aggrs;
myparmstruct.myparms.opcode = AGOP_LISTAGGRNAMES_PARMDATA;
myparmstruct.myparms.parms[0] = 0;
myparmstruct.myparms.parms[1] = 0;
myparmstruct.myparms.parms[2] = sizeof(syscall_parmlist);
myparmstruct.myparms.parms[3] = 0;
myparmstruct.myparms.parms[4] = 0;
myparmstruct.myparms.parms[5] = 0;
myparmstruct.myparms.parms[6] = 0;
BPX1PCT("ZFS ",
ZFSCALL_AGGR, /* Aggregate operation */
sizeof(myparmstruct), /* Length of Argument */
(char *) &myparmstruct, /* Pointer to Argument */
&bpxrv, /* Pointer to Return_value */
&bpxrc, /* Pointer to Return_code */
&bpxrs); /* Pointer to Reason_code */
if (bpxrv < 0)
{
if (bpxrc == E2BIG)
{
buflen = myp->size; /* Get buffer size needed */
mypsize = buflen + sizeof(syscall_parmlist) + sizeof(long) + 9;
myp = (struct parmstruct *) malloc ((long) mypsize);
memset(myp, 0, mypsize);
/* This next field should only be set if parms[3] is non-zero */
/* systemp = (char *)myp + buflen + sizeof(syscall_parmlist) + sizeof(long); */
/* strcpy(systemp,"DCEIMGVN"); */ /* set system to get lsaggr info from */
myp->myparms.opcode = AGOP_LISTAGGRNAMES_PARMDATA;
myp->myparms.parms[0] = buflen;
myp->myparms.parms[1] = sizeof(syscall_parmlist);
myp->myparms.parms[2] = sizeof(syscall_parmlist) + buflen;
myp->myparms.parms[3] = 0;
/* Only specify a non-zero offset for the next field (parms[3]) if */
/* you are running z/OS 1.7 and above, and */
/* you want lsaggr aggregates owned on a single system */
/* myp->myparms.parms[3] = sizeof(syscall_parmlist) + buflen + sizeof(long); */
myp->myparms.parms[4] = 0;
myp->myparms.parms[5] = 0;
myp->myparms.parms[6] = 0;
BPX1PCT("ZFS ",
ZFSCALL_AGGR, /* Aggregate operation */
mypsize, /* Length of Argument */
(char *) myp, /* Pointer to Argument */
&bpxrv, /* Pointer to Return_value */
&bpxrc, /* Pointer to Return_code */
&bpxrs); /* Pointer to Reason_code */
if (bpxrv == 0)
{
total_aggrs = buflen/aggSize;
count_aggrs = 1;
for(aggPtr = (AGGR_ID *) &(myp->size) ; count_aggrs <= total_aggrs ;
aggPtr++, count_aggrs++)
{
if (strlen(aggPtr->aid_name) != 0)
printf("%-64.64s\n",aggPtr->aid_name);
}
free(myp);
}
else /* lsaggr names failed with large enough buffer */
{
printf("Error on ls aggr with large enough buffer\n");
printf("BPXRV = %d BPXRC = %d BPXRS = %x\n",bpxrv,bpxrc,bpxrs);
free(myp);
return bpxrc;
}
}
else /* error was not E2BIG */
{
printf("Error on ls aggr trying to get required size\n");
printf("BPXRV = %d BPXRC = %d BPXRS = %x\n",bpxrv,bpxrc,bpxrs);
free(myp);
return bpxrc;
}
}
else /* asking for buffer size gave rv = 0; maybe there are no aggregates */
{
if (myparmstruct.size == 0)
{
printf("No attached aggregates\n");
}
else /* No, there was some other problem with getting the size needed */
{
printf("Error getting size required\n");
}
}
return 0;
}