Set Auditfid

Purpose

An aggregate operation that sets the current value of the auditfid. The aggregate whose auditfid is to be changed must be attached.

Format

Start of change
syscall_parmlist
   opcode          int          149       AGOP_SETAUDITFID_PARMDATA
   parms[0]        int          offset to AGGR_ID
   parms[1]        int          0=set new auditfid if current auditfid is 0
                                1=set new auditfid regardless of current value 
                                  (force)
                                2=set new auditfid to 0 (old)
   parms[2]        int          0
   parms[3]        int          0
   parms[4]        int          0
   parms[5]        int          0
   parms[6]        int          0
AGGR_ID
   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

Return_value    0 if request is successful, -1 if it is not successful

Return_code
  EBUSY         auditfid could not be set
  EINTR         ZFS is shutting down
  EMVSERR       Internal error using an osi service
  ENOENT        Aggregate is not attached
  EPERM         Permission denied to perform request

Reason_code
  0xEFnnxxxx    See z/OS Distributed File Service Messages and Codes
End of change

Usage notes

  • Reserved fields and undefined flags must be set to binary zeros.

Privilege required

The issuer must be UID=0 or have READ authority to the SUPERUSER.FILESYS.PFSCTL resource in the z/OS® UNIXPRIV class.

Related services

  • List Aggregate Status (Version 2)

Restrictions

The aggregate cannot be attached as read-only. The aggregate cannot be quiesced. The aggregate cannot be in the process of being moved by zFS.

Examples

Start of change
#pragma linkage(BPX1PCT, OS)
#pragma LANGLVL(EXTENDED)

extern void BPX1PCT(char *, int, int, char *, int *, int *, int *);

#include <stdio.h>

#define ZFSCALL_AGGR 0x40000005
#define AGOP_SETAUDITFID_PARMDATA 149  /* Set or reset auditfid */

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]; /* Name, null terminated */
    char aid_reserved[33];             /* Reserved for the future */
} AGGR_ID;

struct parmstruct {
    syscall_parmlist myparms;
    AGGR_ID          aggr_id;
};

int main(int argc, char **argv) 
{
    int               bpxrv;
    int               bpxrc;
    int               bpxrs;
    struct parmstruct myparmstruct;
    
    char aggrname[45] = "PLEX.DCEIMGQX.FS"; /* aggregate name to set auditfid*/
    AGGR_ID *idp      = &(myparmstruct.aggr_id);

    myparmstruct.myparms.opcode = AGOP_SETAUDITFID_PARMDATA;
    myparmstruct.myparms.parms[0] = sizeof(syscall_parmlist);

    /* Configure options by setting myparmstruct.myparms.parms[1] to:   */
    /* 0 = set new auditfid if current auditfid is 0                    */
    /* 1 = set new auditfid regardless of current value (force)         */
    /* 2 = set new auditfid to 0 (pre-z/OS V1R9)                        */
    myparmstruct.myparms.parms[1] = 1; 
                                       
    myparmstruct.myparms.parms[2] = 0;
    myparmstruct.myparms.parms[3] = 0;
    myparmstruct.myparms.parms[4] = 0;
    myparmstruct.myparms.parms[5] = 0;
    myparmstruct.myparms.parms[6] = 0;
    
    /* Ensure reserved fields are 0 */
    memset(&myparmstruct.aggr_id, 0, sizeof(AGGR_ID)); 
    memcpy(&myparmstruct.aggr_id, AID_EYE, 4);
    myparmstruct.aggr_id.aid_len = sizeof(AGGR_ID);
    myparmstruct.aggr_id.aid_ver = AID_VER_INITIAL;
    strcpy(myparmstruct.aggr_id.aid_name, aggrname);

    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) 
    {
        printf("Error setting auditfid for aggregate %s\n", aggrname);
        printf("BPXRV = %d BPXRC = %d BPXRS = %x\n", bpxrv, bpxrc, bpxrs);
        return bpxrc;
    } 
    else /* Return from set auditfid was successful */
        printf("Aggregate %s set auditfid successfully\n", aggrname);
    return 0;
}
End of change