/*************************************************************************** * * Copyright (C) 2001 International Business Machines * All rights reserved. * * This file is part of the GPFS mmfslinux kernel module. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *************************************************************************** */ /* @(#)68 1.51 src/avs/fs/mmfs/ts/kernext/ibm-kxi/cxiTSFattr.h, mmfs, avs_rgpfs24, rgpfs24s003a 5/8/06 15:23:39 */ #ifndef _h_cxitsfattr #define _h_cxitsfattr #include /* defines for command parameter in tsfattr() */ #define SET_BUFFERING 10 #define GET_BUFFERING 11 #define LIST_XATTR 12 #define GET_XATTR 13 #define SET_XATTR 14 #define GPFS_STATFSPOOL 15 #define GPFS_GETPOOLNAME 16 /* #define GET_REPL_FACTORS 20 deprecated -- use gpfs_fcntl */ /* #define SET_REPL_FACTORS 21 deprecated -- use gpfs_fcntl */ #define REMOTE_STAT 22 #define IO_HINTS 24 #define PREALLOCATE_FILE 25 #define GET_ALL_ATTRS 27 #define PUT_ALL_ATTRS 28 #define PUT_ALL_ATTRS_WITH_NAME 29 #define PRIVILEGED_OPERATIONS 31 /* must be privileged user for operations bigger than PRIVILEGED_OPERATIONS */ #define GET_INODE_BLOCK 32 #define GET_DIR_BLOCK 33 #define SET_DIR_ENTRY 34 #define GPFS_IOPEN 35 #define GPFS_ICLOSE 36 #define GPFS_IREAD 37 #define GPFS_IWRITE 38 #define GPFS_IREAD_SYMLINK 39 #define GPFS_IGET_ATTRS 40 #define GPFS_IPUT_ATTRS 41 /* #define UNUSED 42 */ #define GPFS_SYNC_FS 43 #define GPFS_START_RESTORE 44 #define GPFS_END_RESTORE 45 #define GPFS_FS_RESTORABLE 46 #define GPFS_IGET_FILESET 47 #define GPFS_IGET_STORAGEPOOL 48 #define GPFS_IREADX 49 #define GPFS_IWRITEX 50 #define GPFS_OPEN_FSSNAPHANDLE 51 /* define KERNEL_LOGGENERIC 97 Defined in tsfattrx.h */ /* define KERNEL_LOGSPECIFIC 98 Defined in tsfattrx.h */ /* define TEST_LOCK_PERF 99 Defined in tsfattrx.h */ /* If you add a new tsfattr command, also update trcfmt.common */ #define tsfattrcmd_id2name(s) ((int)(s)) /* defines for command parameter in tsfsattr() */ /*define PRIVILEGED_OPERATIONS 30 must be privileged user for operations bigger than PRIVILEGED_OPERATIONS */ #define GPFS_FSATTR_HANDLE_VIA_NAME 30 #define GPFS_FSATTR_HANDLE_VIA_ID 31 #define GPFS_FSATTR_PATH_VIA_HANDLE 32 #define GPFS_FSATTR_FSNAME_VIA_HANDLE 33 #define GPFS_FSATTR_SNAPNAME_VIA_HANDLE 34 #define GPFS_FSATTR_RESTORE_FSSNAPID_VIA_HANDLE 35 #define GPFS_FSATTR_GET_SNAPDIRNAME 36 /* If you add a new tsfsattr command, also update trcfmt.common */ #define tsfsattrcmd_id2name(s) ((int)(s)) /* Structure used to receive additional information regarding operation failures. */ typedef struct { int reason; /* reason request failed */ int value1; /* optional value depending upon reason */ int value2; /* optional value depending upon reason */ } tsfattrReasonCodeInfo; /* Structure used to pass FILE_PREALLOCATION information */ struct filePreallocation { long long offset; /* in - offset to start preallocation from */ long long size; /* in - size of preallocation */ int flags; /* in - write flags */ }; /* Structure used to pass parameters for GET_ALL_ATTRS and PUT_ALL_ATTRS functions. For PUT_ALL_ATTRS_WITH_NAME, the attrSizeP points to the pathName or NULL. */ struct xattrsparms { int flags; /* in - flags (must be zero, reserved for future use) */ void *bufferP; /* in - address of buffer containing or receiving attribute data */ int bufferSize; /* in - size of the buffer (not used by PUT_ALL_ATTRS) */ int *attrSizeP; /* in - address where to return actual size of the data (not used by PUT_ALL_ATTRS) */ }; /* Interface structures for gpfsStatFsPool() */ typedef struct { UInt64 f_blocks; /* total data blocks in pool */ UInt64 f_bfree; /* free blocks in pool */ UInt64 f_bavail; /* free blocks avail to non-superuser */ UInt64 f_mblocks; /* total metadata blocks in pool */ UInt64 f_mfree; /* free blocks avail for system metadata */ int f_bsize; /* optimal storage pool block size */ int f_files; /* total file nodes assigned to pool */ UInt32 f_poolid; /* storage pool id */ int f_fsize; /* fundamental file system block size */ unsigned int f_usage; /* data and/or metadata stored in pool */ int f_reserved[7];/* currently unused and set to zero */ } cxiStatFsPool_t; typedef struct { UInt32 poolId; UInt32 options; int nPools; int bufferSize; char *bufferP; } cxiStatFsPoolArgs_t; /* Definitions for GPFS file attribute function */ #ifdef __cplusplus extern "C" { #endif extern int tsfattr(int fileDesc, /* Open file descriptor */ int command, /* Control function to be performed */ void *argP, /* Additional info required by function */ tsfattrReasonCodeInfo *rCodeP); /* More returned info*/ extern int tsfsattr(int command, /* Control function to be performed */ void *argP); /* Additional info required by function */ /* The tsattr call only supports the following commands: GET_REPL_FACTORS */ extern int tsattr(char *pathname, /* File pathname */ int command, /* Control function to be performed */ void *argP, /* Additional info required by function */ tsfattrReasonCodeInfo *rCodeP); /* More returned info*/ /* Define type used to identify a file system. Internally, this is actually a DiskUID. Assignments to and from this id must be cast as DiskUIDs to generate the correct byte-swapping code. */ typedef struct _gpfs_fs_id { BigEndUInt32 word0; BigEndUInt32 word1; } _gpfs_fs_id_t; /* Structure used to hold snapshot id max size is 48 see gpfs_snap_id_t in gpfs.h. Note that the "_gpfs" prefix is used for an internal definition of an externally defined structure. */ #define FSSNAPID_MAGIC 0xD00FF009 #define ISCAN_VERSION 1 typedef struct _gpfs_fssnap_id { BigEndInt32 magic; /* magic number */ BigEndInt32 fmtVersion; /* version from curFmtVersion */ BigEndInt64 snapId; /* snapshot id */ BigEndInt64 baseSnapId; /* base id for snapshot */ _gpfs_fs_id_t stripeId; /* FS id assigned at format time */ _gpfs_fs_id_t baseStripeId; /* base FS id for snapshot */ BigEndInt64 time; /* time stamp (just second) */ } _gpfs_fssnap_id_t; /* Structure used to identify file system and snapshot Note "_gpfs" is used for the internal version of an externally defined type. */ #define FSSNAPHANDLE_MAGIC 0xD00FF013 typedef struct _gpfs_fssnap_handle { int magic; /* magic number */ int fd; /* file descriptor */ _gpfs_fssnap_id_t fssnapId; /* unique fs/snapshot id */ cxiIno_t maxIno; /* maximum inode number */ int blockSize; /* block size used by fs */ int pathNameSize; /* size of path buffer */ char *pathNameP; /* path buffer */ int fsNameSize; /* size of fsName buffer */ char *fsNameP; /* fsName buffer */ int snapNameSize; /* size of snapName buffer */ char *snapNameP; /* snapName buffer */ } _gpfs_fssnap_handle_t; /* Structure used to keep restore session information. */ #define RESTORE_MAGIC 0xD00FF015 typedef struct _gpfs_restore { int magic; /* magic number */ int fd; /* file descriptor */ _gpfs_fssnap_id_t old_fssnapId; /* id for last snapshot */ _gpfs_fssnap_id_t new_fssnapId; /* id for new snapshot */ } _gpfs_restore_t; /* Define a structure used to pass control information for the restore start/end code. This structure is internal to gpfs and not returned to the users. */ typedef struct gpfs_rcontrol { int flags; /* restore flags */ #define RESTORE_START 0x00000001 #define RESTORE_END 0x00000002 #define RESTORE_ENABLE 0x00000010 #define RESTORE_DISABLE 0x10000000 Int32 fmtVersion; /* version from curFmtVersion */ Int64 snapId; /* snapshot id */ _gpfs_fs_id_t stripeId;/* FS id assigned at format time */ Int64 time; /* time stamp (just second) */ } gpfs_rcontrol_t; /* Structure used to read a block of gpfs_iattr_t with the tsfattr commmand GET_INODE_BLOCK */ #define ISCAN_MAGIC 0xD00FF005 typedef struct _gpfs_iscan { int magic; /* magic number */ int fd; /* file descriptor */ Int64 instanceID; /* instance identifier */ long nextInode; /* next Inode to read */ long termInode; /* terminate before this ino */ long bufferSize; /* size of buffer */ char *bufferP; /* block of gpfs_iattr_t */ long lastOffset; /* offset of last item */ long offset; /* used by caller only */ _gpfs_fssnap_id_t old_fssnapId; /* snapId for last snapshot */ _gpfs_fssnap_id_t new_fssnapId; /* snapId for new snapshot */ UInt32 cachedFilesetId; /* id of cached fileset name */ int cachedFilesetNameLen; /* length of cached fileset name */ char *cachedFilesetNameP; /* pointer to cached fileset name */ UInt32 cachedDataPoolId; /* id of cached storage pool name */ int cachedDataPoolNameLen; /* length of cached storage pool name */ char *cachedDataPoolNameP; /* pointer to cached storage pool name */ } _gpfs_iscan_t; #define CXI_INVALID_FILESET_ID ((UInt32) -1) /* cached value */ #define CXI_INVALID_STORAGEPOOL_ID ((UInt32) -1) /* is invalid */ /* Define internal structure used for block level incremental reads. Each call to gpfs_ireadx() returns an array of changes between the scanned file and its previous snapshot version. */ typedef struct gpfs_idelta { int hole; /* =0 if data changed in the following range =1 if a hole was created in that range */ Int64 startOffset; /* byte offset to start of change */ Int64 endOffset; /* offset at end of changed region */ } gpfs_idelta_t; /* Structure used to pass extended attribute information for GET_XATTR and SET_XATTR */ struct tsxattrs { int appId; /* application id */ int nattrs; /* no of attributes to get or set */ struct tsxattr *attrs; /* attributes to get or set */ }; /* If this is modified, also make corresponding changes to tsxattrMB, which is used in mailbox communication */ struct tsxattr { char *keyP; /* attribute key */ int keyLen; /* key length */ char *valueP; /* attribute value */ int valueLen; /* length of attribute value */ }; /* Structure used to read/write by inode number. */ #define IFILE_MAGIC 0xD00FF011 #define DIRX_BUFFER_SIZE (16*1024) #define DELTA_BUFFER_SIZE (sizeof(gpfs_idelta_t) * 128) #define MAX_FILE_OFFSET MAX_INT64 typedef struct _gpfs_ifile { int magic; /* magic number */ int fd; /* file descriptor for root */ long ino; /* inode number */ int genNo; /* inode generation number */ Int64 snapId; /* snapshot ID */ int open_flags; /* open flags */ cxiMode_t mode; /* mode of file being read */ const char *symlinkP; /* optional symlink */ char *bufferP; /* buffer for read/write */ long bufferSize; /* size of buffer */ Int64 offset; /* offset to read/write from */ Int64 count; /* length to read/write */ int dirCount; /* number of directory entries*/ char *dirBufferP; /* buffer for directory read */ long dirBufferSize; /* size of dir buffer */ offset_t dirOffset; /* offset in directory buffer */ offset_t lastOffset; /* offset of last item */ struct gpfs_iattr *statxP; /* optional for open/create */ void *vP; /* inode/vnode (OS dependent) NOTE: This value cannot be trusted between calls to the kernel. */ int *attrSizeP; /* ptr to rtnd value for iget_attrs */ /* Define fields for block-level incremental read/write */ Int64 prevSnapId; /* prev snapId */ _gpfs_fs_id_t prevStripeId; /* prev stripeId */ int hole; /* read/write a hole */ int callBlockLevel; /* if >=0 then call ireadx if < 0 then call iread */ Int64 fileSize; /* size of file when reading deltas */ Int64 firstOffset; /* start of range covered by deltas */ Int64 nextOffset; /* in: limit on single ireadx out: next offset to read */ } _gpfs_ifile_t; #ifdef __cplusplus } #endif int myFillDir(void *fillDirArgP, const char *nameP, int namlen, offset_t offset, ino_t ino, cxiMode_t mode, int generation); #endif /* _h_cxitsfattr */