diff --git a/System/ior/build b/System/ior/build index 8b7ce65..3253a73 100755 --- a/System/ior/build +++ b/System/ior/build @@ -6,14 +6,13 @@ pbuild::add_to_group 'System' pbuild::install_docfiles AUTHORS NEWS README_S3 -cd ${SRC_DIR} +export GPFS_VERSION="5.0.2-3" + +export C_INCLUDE_PATH+=":$BUILDBLOCK_DIR/files/gpfs/$GPFS_VERSION/include/" +export LIBRARY_PATH+=":$BUILDBLOCK_DIR/files/gpfs/$GPFS_VERSION/lib/" -# pbuild::compile_in_sourcetree pbuild::pre_configure() { - pbuild::add_configure_args "LIBS=/tmp/libgpfs.so" + cd ${SRC_DIR} ./bootstrap } -pbuild::configure() { - ./configure LIBS=/tmp/libgpfs.so -} diff --git a/System/ior/files/gpfs/5.0.2-3/include/api_event.h b/System/ior/files/gpfs/5.0.2-3/include/api_event.h new file mode 100644 index 0000000..97f60f5 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/api_event.h @@ -0,0 +1,944 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* */ +/* */ +/* Licensed Materials - Property of IBM */ +/* */ +/* Restricted Materials of IBM */ +/* */ +/* (C) COPYRIGHT International Business Machines Corp. 2007,2018 */ +/* All Rights Reserved */ +/* */ +/* US Government Users Restricted Rights - Use, duplication or */ +/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/* @(#)46 1.20 src/avs/fs/mmfs/ts/mmantras/api_event.h, mmfs, avs_rtac502, rtac5021836a 11/17/16 18:55:10 */ + +#ifndef _h_api_event +#define _h_api_event + + + +#include +#include +#include +#include +#include + +/* Define event types */ +enum +{ + /* Internal events */ + MOUNT = 0, + UNMOUNT = 1, + ADDDISK = 2, + DELDISK = 3, + CHDISK = 4, + SGMGR_TAKEOVER = 5, + NODE_FAILURE = 6, + NODE_RECOVERY = 7, + FILESYSTEM_CREATION = 8, + FILESYSTEM_DELETION = 9, + FILESYSTEM_STATE_CHANGE = 10, + NEW_CONNECTION = 11, + EVENT_COLLECTION_BUFFER_OVERFLOW = 12, + TOKEN_MANAGER_STATUS = 13, + HUNG_THREAD = 14, + STGPOOL_UTILIZATION = 15, + SDR_CHANGED = 16, + /* Command events */ + MMADDDISK = 17, + MMDELDISK = 18, + /* Console log events */ + CONSOLE_LOG = 19, + /* Long ioTime warning */ + LONG_IOTIME = 20, + + /* User generated event */ + USER_EVENT = 21, + + /* NSD RAID related events */ + RECOVERYGROUP_TAKEOVER = 22, /* RG server takeover */ + RECOVERYGROUP_RELINQUISH = 23, /* RG server relinquish */ + RECOVERYGROUP_OPEN_FAILED = 24, /* RG open failed */ + RECOVERYGROUP_PANIC = 25, /* RG panic resign */ + PDISK_FAILED = 26, /* pdisk declared dead */ + PDISK_RECOVERED = 27, /* pdisk recovered */ + PDISK_REPLACE_PDISK = 28, /* pdisk disk replacement */ + PDISK_PATH_FAILED = 29, /* pdisk path failed */ + DA_REBUILD_FAILED = 30, /* DA rebuild failed */ + NSD_CKSUM_MISMATCH = 31, /* checksum error on an NSD RPC */ + LOGGROUP_PANIC = 32, + LOGGROUP_OPEN_FAILED = 33, + + /* last event: MAX_EVENT_CLASSES */ + MAX_EVENT_CLASSES = 34 +}; + +#define MAX_EVENT_FIELD 256 // string lengh + +struct EventNameTableEntry +{ + const char *name; + int len; +}; + + +/* Define event names */ +const struct EventNameTableEntry EventNamesP[MAX_EVENT_CLASSES + 1] = +{ + /* 0 */ { "mount", 5 }, + /* 1 */ { "unmount", 7 }, + /* 2 */ { "adddisk", 7 }, + /* 3 */ { "deldisk", 7 }, + /* 4 */ { "chdisk", 6 }, + /* 5 */ { "takeover", 8 }, + /* 6 */ { "failure", 7 }, + /* 7 */ { "recovery", 8 }, + /* 8 */ { "createfs", 8 }, + /* 9 */ { "deletefs", 8 }, + /* 10 */ { "fsstatechange", 13 }, + /* 11 */ { "newconnection", 13 }, + /* 12 */ { "exception", 9 }, + /* 13 */ { "sgStats", 7 }, + /* 14 */ { "hungthread", 10 }, + /* 15 */ { "poolutil", 8 }, + /* 16 */ { "sdrChanged", 10 }, + /* 17 */ { "mmadddisk", 9 }, + /* 18 */ { "mmdeldisk", 9 }, + /* 19 */ { "consoleLog", 10 }, + /* 20 */ { "longIO", 6 }, + /* 21 */ { "userEvent", 9 }, + /* 22 */ { "rgTakeover", 10 }, + /* 23 */ { "rgRelinquish", 12 }, + /* 24 */ { "rgOpenFailed", 12 }, + /* 25 */ { "rgPanic", 7 }, + /* 26 */ { "pdFailed", 8 }, + /* 27 */ { "pdRecovered", 11 }, + /* 28 */ { "pdReplacePdisk", 14 }, + /* 29 */ { "pdPathFailed", 12 }, + /* 30 */ { "daRebuildFailed",15 }, + /* 31 */ { "nsdCksumMismatch",16 }, + /* 32 */ { "lgPanic", 7 }, + /* 33 */ { "lgOpenFailed", 12 }, + { 0, 0 } +}; + + +#if 0 +/* Data for callback for response from each node. */ +typedef struct MyData +{ + char *responseBuffer; + int responseBufferSize; + char *asyncEvents; + int asyncEventsSize; + Mmpmon_Callback_String callback; + FILE *file; + const char *command; +} MyData; +#endif + + +/* Super class of all events classes. */ +class Event +{ + friend class EventsHandler; + + struct timeval creationTime; + char severity[MAX_EVENT_FIELD]; + +public: + Event(); + ~Event(); + + inline struct timeval getCreationTime() { return creationTime; } + inline char *getSeverity() { return severity; } +}; + + +/* Mount, unmount events */ +class MountActionEvent : public Event +{ +private: + char nodeIpAddr[MAX_EVENT_FIELD]; + char fsName[MAX_EVENT_FIELD]; + +public: + MountActionEvent(char *nodeIpAddr, char *fsName); + ~MountActionEvent(); + + inline char *getNodeIpAddr() { return nodeIpAddr; } + inline char *getFsName() { return fsName; } +}; + + +/* Adddisk, deldisk events */ +class DiskActionEvent : public Event +{ +private: + char nodeIpAddr[MAX_EVENT_FIELD]; + char fsName[MAX_EVENT_FIELD]; + char diskName[MAX_EVENT_FIELD]; + +public: + DiskActionEvent(char *nodeIpAddr, char *fsName, char *diskName); + ~DiskActionEvent(); + + inline char *getNodeIpAddr() { return nodeIpAddr; } + inline char *getFsName() { return fsName; } + inline char *getDiskName() { return diskName; } +}; + + +/* Chdisk event */ +class ChdiskEvent : public Event +{ +private: + char nodeIpAddr[MAX_EVENT_FIELD]; + char fsName[MAX_EVENT_FIELD]; + char diskName[MAX_EVENT_FIELD]; + char status[MAX_EVENT_FIELD]; + char availability[MAX_EVENT_FIELD]; + char fgName[MAX_EVENT_FIELD]; + char meta[MAX_EVENT_FIELD]; + char data[MAX_EVENT_FIELD]; + +public: + ChdiskEvent(char *nodeIpAddr, char *fsName, char *diskName, + char *status, char *availability, char *fgName, + char *meta, char *data); + ~ChdiskEvent(); + + inline char *getNodeIpAddr() { return nodeIpAddr; } + inline char *getFsName() { return fsName; } + inline char *getDiskName() { return diskName; } + inline char *getStatus() { return status; } + inline char *getAvailability() { return availability; } + inline char *getFgName() { return fgName; } + inline char *getMeta() { return meta; } + inline char *getData() { return data; } +}; + + +/* Stripe group manager takeover event */ +class SgmgrTakeoverEvent : public Event +{ +private: + char sgmgrIpAddr[MAX_EVENT_FIELD]; + char prevSgmgrIpAddr[MAX_EVENT_FIELD]; + char fsName[MAX_EVENT_FIELD]; + +public: + SgmgrTakeoverEvent(char *sgmgrIpAddr, char *prevSgmgrIpAddr, char *fsName); + ~SgmgrTakeoverEvent(); + + inline char *getSgmgrIpAddr() { return sgmgrIpAddr; } + inline char *getPrevSgmgrIpAddr() { return prevSgmgrIpAddr; } + inline char *getFsName() { return fsName; } +}; + + +/* Node failure, recovery events */ +class NodeStatusEvent : public Event +{ +private: + char nodeIpAddr[MAX_EVENT_FIELD]; + +public: + NodeStatusEvent(char *nodeIpAddr); + ~NodeStatusEvent(); + + inline char *getNodeIpAddr() { return nodeIpAddr; } +}; + + +/* File system creation, deletion events */ +class FilesystemActionEvent : public Event +{ +private: + char sgmgrIpAddr[MAX_EVENT_FIELD]; + char fsName[MAX_EVENT_FIELD]; + +public: + FilesystemActionEvent(char *sgmgrIpAddr, char *fsName); + ~FilesystemActionEvent(); + + inline char *getSgmgrIpAddr() { return sgmgrIpAddr; } + inline char *getFsName() { return fsName; } +}; + + +/* File system state change event */ +class FilesystemStateChangeEvent : public Event +{ +private: + char fsName[MAX_EVENT_FIELD]; + char userUnbalanced[MAX_EVENT_FIELD]; + char metaUnbalanced[MAX_EVENT_FIELD]; + char userIllreplicated[MAX_EVENT_FIELD]; + char metaIllreplicated[MAX_EVENT_FIELD]; + char userExposed[MAX_EVENT_FIELD]; + char metaExposed[MAX_EVENT_FIELD]; + +public: + FilesystemStateChangeEvent(char *fsName, char *userUnbalanced, + char *metaUnbalanced, char *userIllreplicated, + char *metaIllreplicated, char *userExposed, + char *metaExposed); + ~FilesystemStateChangeEvent(); + + inline char *getFsName() { return fsName; } + inline char *getUserUnbalanced() { return userUnbalanced; } + inline char *getMetaUnbalanced() { return metaUnbalanced; } + inline char *getUserIllreplicated() { return userIllreplicated; } + inline char *getMetaIllreplicated() { return metaIllreplicated; } + inline char *getUserExposed() { return userExposed; } + inline char *getMetaExposed() { return metaExposed; } +}; + + +/* Hung thread event */ +class HungThreadEvent : public Event +{ +private: + char nodeIpAddr[MAX_EVENT_FIELD]; + time_t waitTime; + char diagnosis[MAX_EVENT_FIELD]; + +public: + HungThreadEvent(char *nodeAddr, time_t time, char *desc); + ~HungThreadEvent(); + + inline char *getNodeIpAddr() { return nodeIpAddr; } + inline time_t getWaitTime() { return waitTime; } + inline char *getDiagnosis() { return diagnosis; } +}; + + +/* tm stats event */ +class TmStatsEvent: public Event +{ +private: + char nodeIpAddr[MAX_EVENT_FIELD]; + char fsName[MAX_EVENT_FIELD]; + int tmSpace; + int tmRequest; + +public: + TmStatsEvent(char *nodeAddr, char *fsName, int tmSpace, int tmRequest); + ~TmStatsEvent(); + + inline char *getNodeIpAddr() { return nodeIpAddr; } + inline char *getFsName() { return fsName; } + inline int getTmSpace() { return tmSpace; } + inline int getTmRequest() { return tmRequest; } +}; + +#if 0 +/* File system utilization event */ +class FilesystemUtilizationEvent : public Event +{ +private: + char fsName[MAX_EVENT_FIELD]; + int fsUsage; + +public: + FilesystemUtilizationEvent(char *name, int usage); + ~FilesystemUtilizationEvent(); + + inline char *getFsName() { return fsName; } + inline int getFsUsage() { return fsUsage; } +}; +#endif + + +/* Storage pool utilization event */ +class StgPoolUtilizationEvent : public Event +{ +private: + char fsName[MAX_EVENT_FIELD]; + char poolName[MAX_EVENT_FIELD]; + char status[MAX_EVENT_FIELD]; + int poolUsage; + +public: + StgPoolUtilizationEvent(char *fsname, char *poolname, char *status, + int usage); + ~StgPoolUtilizationEvent(); + + inline char *getFsName() { return fsName; } + inline char *getPoolName() { return poolName; } + inline char *getStatus() { return status; } + inline int getPoolUsage() { return poolUsage; } +}; + +class SDRChangedEvent : public Event +{ + private: + char nodeName[MAX_EVENT_FIELD]; + +public: + SDRChangedEvent(char *nodeName); + ~SDRChangedEvent(); + + inline char *getNodeName() { return nodeName; } +}; + +class UserGeneratedEvent : public Event +{ + private: + char nodeName[MAX_EVENT_FIELD]; + char data[MAX_EVENT_FIELD]; + +public: + UserGeneratedEvent(char *nodeName, char *data); + ~UserGeneratedEvent(); + + inline char *getNodeName() { return nodeName; } + inline char *getData() { return data; } +}; + +/* Adddisk, deldisk command events */ +class DiskCmdEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char fsName[MAX_EVENT_FIELD]; + char diskName[MAX_EVENT_FIELD]; + char cmd[MAX_EVENT_FIELD]; + char status[MAX_EVENT_FIELD]; + int result; + +public: + DiskCmdEvent(char *nodeName, char *fsName, char *diskName, char *cmd, + char *status, int result); + ~DiskCmdEvent(); + + inline char *getNodeName() { return nodeName; } + inline char *getFsName() { return fsName; } + inline char *getDiskName() { return diskName; } + inline char *getCmd() { return cmd; } + inline char *getStatus() { return status; } + inline int getResult() { return result; } +}; + + +/* Console message events */ +class ConsoleLogEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char msgTxt[MAX_EVENT_FIELD]; + int msgLevel; + +public: + ConsoleLogEvent(char *nodeName, char *msgTxt, int msgLevel); + ~ConsoleLogEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getMsgTxt() { return msgTxt; } + inline int getMsgLevel() { return msgLevel; } +}; + + +/* Long ioTime warning events */ +class LongIoTimeEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char fsName[MAX_EVENT_FIELD]; + char diskName[MAX_EVENT_FIELD]; + char cmd[MAX_EVENT_FIELD]; + int ioLength; + time_t ioTime; /* in microseconds */ + + +public: + LongIoTimeEvent(char *nodeName, char *fsName, char *diskName, char *cmd, + int ioLength, time_t ioTime_us); + ~LongIoTimeEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getFsName() { return fsName; } + inline char *getDiskName() { return diskName; } + inline char *getCmd() { return cmd; } + inline int getIoLength() { return ioLength; } + inline time_t getIoTime() { return ioTime; } + +}; + +/* NSD RAID related events */ + +/* Recovery Group Takeveover: + RG server has begun serving an RG +*/ +class RgTakeoverEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char rgName[MAX_EVENT_FIELD]; + char reason[MAX_EVENT_FIELD]; + int err; + +public: + RgTakeoverEvent(char *nodeName, char *rgName, char *reason, int err); + ~RgTakeoverEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getRgName() { return rgName; } + inline char *getReason() { return reason; } + inline int getErr() { return err; } + +}; + +/* Recovery Group Relinquish + RG server has stopped serving an RG + */ +class RgRelinquishEvent: public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char rgName[MAX_EVENT_FIELD]; + char reason[MAX_EVENT_FIELD]; + int err; + +public: + RgRelinquishEvent(char *nodeName, char *rgName, char *reason, int err); + ~RgRelinquishEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getRgName() { return rgName; } + inline char *getReason() { return reason; } + inline int getErr() { return err; } +}; + +/* Recovery Group OpenFailed + rgOpenFailed event will always be followed by rgTakeover with an error + code (and the same reason string.) + */ +class RgOpenFailedEvent: public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char rgName[MAX_EVENT_FIELD]; + char reason[MAX_EVENT_FIELD]; + int err; + +public: + RgOpenFailedEvent(char *nodeName, char *rgName, char *reason, int err); + ~RgOpenFailedEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getRgName() { return rgName; } + inline char *getReason() { return reason; } + inline int getErr() { return err; } +}; + +/* Recovery Group Panic + rgPanic + */ +class RgPanicEvent: public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char rgName[MAX_EVENT_FIELD]; + char reason[MAX_EVENT_FIELD]; + int err; + +public: + RgPanicEvent(char *nodeName, char *rgName, char *reason, int err); + ~RgPanicEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getRgName() { return rgName; } + inline char *getReason() { return reason; } + inline int getErr() { return err; } +}; + +/* Log Group OpenFailed (lgOpenFailed) */ +class LgOpenFailedEvent: public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char rgName[MAX_EVENT_FIELD]; + char lgName[MAX_EVENT_FIELD]; + char reason[MAX_EVENT_FIELD]; + int err; + +public: + LgOpenFailedEvent(char *nodeName, char *rgName, char lgName, + char *reason, int err); + ~LgOpenFailedEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getRgName() { return rgName; } + inline char *getLgName() { return lgName; } + inline char *getReason() { return reason; } + inline int getErr() { return err; } +}; + +/* Log Group Panic (lgPanic) */ +class LgPanicEvent: public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char rgName[MAX_EVENT_FIELD]; + char lgName[MAX_EVENT_FIELD]; + char reason[MAX_EVENT_FIELD]; + int err; + +public: + LgPanicEvent(char *nodeName, char *rgName, char *lgName, + char *reason, int err); + ~LgPanicEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getRgName() { return rgName; } + inline char *getLgName() { return lgName; } + inline char *getReason() { return reason; } + inline int getErr() { return err; } +}; + +/* disk array requires disk replacement */ +class PdReplacePdiskEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char location[MAX_EVENT_FIELD]; + char fru[MAX_EVENT_FIELD]; + char wwn[MAX_EVENT_FIELD]; /* SCSI World Wide Name */ + char rgName[MAX_EVENT_FIELD]; + char daName[MAX_EVENT_FIELD]; + char pdName[MAX_EVENT_FIELD]; + char state[MAX_EVENT_FIELD]; + int priority; + +public: + PdReplacePdiskEvent(char *nodeName, char *location, char *fru, + char *wwn, char *rgName, char *daName, + char *pdName, char *state, int priority); + ~PdReplacePdiskEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getLocation() { return location; } + inline char *getFru() { return fru; } + inline char *getWwn() { return wwn; } + inline char *getRgName() { return rgName; } + inline char *getDaName() { return daName; } + inline char *getPdName() { return pdName; } + inline char *getState() { return state; } + inline int getPriority() { return priority; } +}; + +/* + * a pDisk has failed + */ +class PdFailedEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char location[MAX_EVENT_FIELD]; + char fru[MAX_EVENT_FIELD]; + char wwn[MAX_EVENT_FIELD]; /* SCSI World Wide Name */ + char rgName[MAX_EVENT_FIELD]; + char daName[MAX_EVENT_FIELD]; + char pdName[MAX_EVENT_FIELD]; + char state[MAX_EVENT_FIELD]; + +public: + PdFailedEvent(char *nodeName, char *location, char *fru, char *wwn, + char *rgName, char *daName, char *pdName, char *state); + ~PdFailedEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getLocation() { return location; } + inline char *getFru() { return fru; } + inline char *getWwn() { return wwn; } + inline char *getRgName() { return rgName; } + inline char *getDaName() { return daName; } + inline char *getPdName() { return pdName; } + inline char *getState() { return state; } +}; + +/* + * a pDisk has recovered + */ +class PdRecoveredEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char location[MAX_EVENT_FIELD]; + char fru[MAX_EVENT_FIELD]; + char wwn[MAX_EVENT_FIELD]; /* SCSI World Wide Name */ + char rgName[MAX_EVENT_FIELD]; + char daName[MAX_EVENT_FIELD]; + char pdName[MAX_EVENT_FIELD]; + +public: + PdRecoveredEvent(char *nodeName, char *location, char *fru, char *wwn, + char *rgName, char *daName, char *pdName); + ~PdRecoveredEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getLocation() { return location; } + inline char *getFru() { return fru; } + inline char *getWwn() { return wwn; } + inline char *getRgName() { return rgName; } + inline char *getDaName() { return daName; } + inline char *getPdName() { return pdName; } +}; + +/* + * pdPathFailed + */ +class PdPathFailedEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char location[MAX_EVENT_FIELD]; + char fru[MAX_EVENT_FIELD]; + char wwn[MAX_EVENT_FIELD]; /* SCSI World Wide Name */ + char rgName[MAX_EVENT_FIELD]; + char daName[MAX_EVENT_FIELD]; + char pdName[MAX_EVENT_FIELD]; + char deviceName[MAX_EVENT_FIELD]; + +public: + PdPathFailedEvent(char *nodeName, char *location, char *fru, char *wwn, + char *rgName, char *daName, char *pdName, + char *deviceName); + ~PdPathFailedEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getLocation() { return location; } + inline char *getFru() { return fru; } + inline char *getWwn() { return wwn; } + inline char *getRgName() { return rgName; } + inline char *getDaName() { return daName; } + inline char *getPdName() { return pdName; } + inline char *getDeviceName(){ return deviceName; } +}; + + +/* + * daRebuildFailed: Decluster Array rebuild failed + */ +class DaRebuildFailedEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; + char rgName[MAX_EVENT_FIELD]; + char daName[MAX_EVENT_FIELD]; + int remainingRedundancy; + +public: + DaRebuildFailedEvent(char *nodeName, char *rgName, char *daName, + int remainingRedundancy); + ~DaRebuildFailedEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getRgName() { return rgName; } + inline char *getDaName() { return daName; } + inline int getRemainingRedundancy() { return remainingRedundancy; } +}; + +/* + * nsdCksumMismatch: checksum error detected on an NSD RPC transaction + */ + +class NsdCksumMismatchEvent : public Event +{ +private: + char nodeName[MAX_EVENT_FIELD]; /* reporting node */ + char myRole[MAX_EVENT_FIELD]; /* reporting side of the event: + "client" or "server" */ + char ckOtherNode[MAX_EVENT_FIELD]; /* address of the other side involved */ + char ckNSD[MAX_EVENT_FIELD]; /* NSD name of the NSD/Vdisk in question */ + char ckReason[MAX_EVENT_FIELD]; /* reason for checksum error: + "server_detected_error_receiving_for_write" or + "client_detected_error_receiving_on_read" */ + Int64 ckStartSector; /* starting sector of the failing transmission */ + Int32 ckDataLen; /* data length of the failing transmission */ + UInt32 ckErrorCountClient; /* cumulative number of errors for the involved + client since server has begun serving */ + UInt32 ckErrorCountServer; /* cumulative number of errors for the server */ + UInt32 ckErrorCountNSD; /* cumulative number of errors for the involved + NSD since server has begun serving */ + Int32 ckReportingInterval; /* value of the reporting interval at the + time the event was generated */ +public: + NsdCksumMismatchEvent(char *nodeName, char *myRole, char *ckOtherNode, + char *ckNSD, char *ckReason, + Int64 ckStartSector, Int32 ckDataLen, + UInt32 ckErrorCountClient, UInt32 ckErrorCountServer, + UInt32 ckErrorCountNSD, Int32 ckReportingInterval); + ~NsdCksumMismatchEvent() {}; + + inline char *getNodeName() { return nodeName; } + inline char *getMyRole() { return myRole; } + inline char *getCkReason() { return ckReason; } + inline char *getCkNSD() { return ckNSD; } + inline char *getCkOtherNode() { return ckOtherNode; } + inline UInt64 getCkStartSector() { return ckStartSector; } + inline Int32 getCkDataLen() { return ckDataLen; } + inline UInt32 getCkErrorCountClient() { return ckErrorCountClient; } + inline UInt32 getCkErrorCountServer() { return ckErrorCountServer; } + inline UInt32 getCkErrorCountNSD() { return ckErrorCountNSD; } + inline Int32 getCkReportingInterval(){ return ckReportingInterval; } +}; + +/* + * Derived event classes + */ +#define MountEvent MountActionEvent +#define UnmountEvent MountActionEvent +#define AdddiskEvent DiskActionEvent +#define DeldiskEvent DiskActionEvent +#define NodeFailureEvent NodeStatusEvent +#define NodeRecoveryEvent NodeStatusEvent +#define FilesystemCreationEvent FilesystemActionEvent +#define FilesystemDeletionEvent FilesystemActionEvent +#define NewConnectionEvent NodeStatusEvent +#define EventCollectionBufferOverflowEvent NodeStatusEvent +#define MmAdddiskEvent DiskCmdEvent +#define MmDeldiskEvent DiskCmdEvent + + +/* Description of linked list struct for holding an event */ +class EventItem +{ +private: + + /* Ptr to null-terminated string associated with this object */ + char *bufP; + /* Ptr to prev item -or- NULL if front of list */ + EventItem *prevP; + /* Ptr to next item -or- NULL if end of list */ + EventItem *nextP; + +public: + + /* Constructor */ + EventItem(); + + /* Destructor */ + ~EventItem(); + + /* Access member functions */ + void copyBuf(char* _bufP); + inline char* getBufP() const { return bufP; } + inline EventItem* getNextP() const { return nextP; } + + /* Given a string as input, duplicate the string and + create an associated linked list descriptor. */ + static EventItem* strdup(const char *strP); + + /* Append item(s) after this item + which must be current end-of-list. */ + void append(EventItem* _nextP); + + /* Destroy list */ + static void destroyList(EventItem* listP); +}; + + +typedef struct +{ + int (*fn)(Event *event, void *data); + void *data; +} CallbackInfo; + +#ifndef dfprintf +#define dfprintf if (debug) fprintf +#endif + +/* It manages two threads: + 1. receiveHandler: It connects to GPFS daemon and listens to events + genereated in GPFS. When an event occurs, it stores this event to list. + 2. sendHandler: It extracts an event one by one and invokes callback + function registered with each event type. */ +class EventsHandler +{ +private: + + pthread_t sendThread; + pthread_t receiveThread; + + EventItem listAnchor; // nextP points to first in list; prevP always NULL + EventItem* lastInListP; // ptr to last EventItem in list + + CallbackInfo eventCallback[MAX_EVENT_CLASSES]; + MmpmonWrapperUtils *wrapper; + + int debug; + PollingHandler *pollingHandler; // notify polling handler of certain events + + int terminate; + + /* It sleeps until somebody wakes it up. If it is woken up, it checks if there + are events in list. If there are, it extracts an event one by one, + find out event type and invokes callback function of each event. */ + static void *sendHandlerBody(void *arg); + + /* It connects to GPFS daemon and listens to events generated in GPFS. If an + event occurs, it stores this event to list and wakes up sendHandler thread. */ + static void *receiveHandlerBody(void *arg); + + /* Extract an event from list */ + char *getEventFromList(char* bufP, const int bufSize); + + /* Wake up sendHandler thread */ + void wakeSendThread(); + + /* Wait receiveHandler thread */ + void waitReceiveThread(); + + /* Get event type */ + int getEventType(char* response); + + /* Create event object of corresponding type */ + Event *createEventObject(int type, char *response); + +public: + + static MErrno init(PollingHandler *pollH, int debg=0); + + static void term(); + + EventsHandler(MErrno *errP, int debg=0); + + ~EventsHandler(); + + /* Append an event to list */ + void appendEventToList(EventItem* firstItemP, // first item in list to append + EventItem* lastItemP, // last item in list to append + int numItems, // number items being appended + int numBytes); // total bytes being appended + + /* Create threads and wait until they finish */ + void run(); + + /* refresh event registration */ + void refreshEvents(); + + /* External management application registers its callback function by invoking + this function. */ + void registerEventCallback(int type, int (*callback)(Event *event, void *data), void *callbackData); + + MmpmonWrapperUtils *getMmpmonWrapper() { return wrapper; } +}; + + +/* Pointer to EventsHandler object */ +extern EventsHandler *theEventsHandler; + + +/* Callback function which is invoked when we get events. It creates EventItem + object and make it be added to list. */ +static int receiveEvent(char *buf, void *data); + + +#endif /* _h_api_event */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/api_nsdRAID.h b/System/ior/files/gpfs/5.0.2-3/include/api_nsdRAID.h new file mode 100644 index 0000000..ef63939 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/api_nsdRAID.h @@ -0,0 +1,422 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* */ +/* */ +/* Licensed Materials - Property of IBM */ +/* */ +/* Restricted Materials of IBM */ +/* */ +/* (C) COPYRIGHT International Business Machines Corp. 2011,2018 */ +/* All Rights Reserved */ +/* */ +/* US Government Users Restricted Rights - Use, duplication or */ +/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/* @(#)81 1.8 src/avs/fs/mmfs/ts/mmantras/api_nsdRAID.h, mmfs, avs_rtac502, rtac5021836a 5/27/15 08:13:15 */ + +#ifndef _h_api_nsdRAID +#define _h_api_nsdRAID + +/* + * api_nsdRAID.h + * + * classes: + * gpfsRecoveryGroupSdrInfo + * gpfsRecoveryGroup + * gpfsRecoveryGroupDeclusteredArray + * gpfsDeclusteredArrayVdisk + * gpfsDeclusteredArrayPdisk + * gpfsNsdRAIDConfigParms + * gpfsDeclusteredArrayVdiskIoStats + * + * gpfsRecoveryGroupSdrInfo - portion of NSD RAID recovery group + * information stored in GPFS SDR file. + * + * gpfsRecoveryGroup - GPFS recovery group (RG) information + * -- gpfsRecoveryGroupDeclusteredArray - GPFS declustered array (DA) + * information in a Recovery Group + * --- gpfsDeclusteredArrayVdisk - virtual disk (vdisk) information + * in recovery group RG declustered array DA + * --- gpfsDeclusteredArrayPdisk - physical disk (pdisk) information + * in recovery group RG declustered array DA + * + * gpfsNsdRAIDConfigParms - an array of NSD RAID configuration parameters + * -- gpfsNsdRAIDConfigVar - an NSD RAID configuration parameter + * + * gpfsDeclusteredArrayVdiskIoStats + * + * Externals: + * int getNsdRAIDSdrInfo(gpfsRecoveryGroupSdrInfo *rgSdrTableP, + * int *nRgSdrAllocP); + * int getRecoveryGroupSummary(gpfsRecoveryGroup *rgP); + * int getRecoveryGroupDeclusteredArrays(gpfsRecoveryGroup *rgP); + * int getNsdRAIDParameters(gpfsNsdRAIDConfigParms *configTableP, + * int *nAllocP); + * int gpfsRGDefined(); + */ + +#define GNRB_MAX_BASENAME 63 +#define RAID_NAME_LEN (GNRB_MAX_BASENAME + 1) +#define MAX_DA 16 /* RG_MAX_DECLUSTERED_ARRAYS */ + +#define STR8_LEN 8 +#define STR32_LEN 32 +#define STR64_LEN 64 +#define STR128_LEN 128 +#define PDISK_STATE_LEN 160 +#define STATE_STR_LEN STR64_LEN +#define SERVER_LIST_LEN STR128_LEN +#define PATH_LEN STR64_LEN + +#define PVID_MAX_CHARS 20 /* defined in GPFS */ + +/* number of Recovery Group defined in the cluster */ +extern int nRGDefined; /* -1 uninitialized, 0 no RG defined */ + + +/* + * gpfsDeclusteredArrayPdisk - description of a pdisk + */ + +class gpfsDeclusteredArrayPdisk +{ + char gpfsPdiskName[RAID_NAME_LEN]; /* Pdisk Name */ + UInt32 gpfsPdiskReplacementPriority; /* replacementPriority + (daCalcReplacementPriorityLocked) */ + char gpfsPdiskDevicePath[PATH_LEN]; /* path */ + char gpfsPdiskState[PDISK_STATE_LEN];/* State, possible values see: + PdiskState_t::toString() */ + UInt64 gpfsPdiskFreeSpace; /* free space bytes */ + char gpfsPdiskFru[STR32_LEN]; /* Field Replaceable Unit number */ + char gpfsPdiskLocation[STR32_LEN]; /* where the disk is physically located + in the carrier */ + public: + gpfsDeclusteredArrayPdisk(); + ~gpfsDeclusteredArrayPdisk(); + + void init(); + void update(char *pDiskName, int prior, char *path, + char *state, UInt64 freeSpace, char *fru, char *location); + + void print_gpfsDeclusteredArrayPdisk(int verbose = 0); + + char *getPdiskName() { return gpfsPdiskName; } + UInt32 getPdiskReplacementPriority() + { return gpfsPdiskReplacementPriority; } + char *getPdiskDevicePath() { return gpfsPdiskDevicePath; } + char *getPdiskState(){ return gpfsPdiskState; } + UInt64 getPdiskFreeSpace() { return gpfsPdiskFreeSpace; } + char *getPdiskFru() { return gpfsPdiskFru; } + char *getPdiskLocation() { return gpfsPdiskLocation; } +}; + + +/* + * gpfsDeclusteredArrayVdiskIoStats - vdisk IO stats + */ + +class gpfsDeclusteredArrayVdiskIoStats +{ + friend class gpfsDeclusteredArrayVdisk; + + UInt64 gpfsVdiskIoStatRead; + UInt64 gpfsVdiskIoStatShortWrite; + UInt64 gpfsVdiskIoStatMediumWrite; + UInt64 gpfsVdiskIoStatFTW; + UInt64 gpfsVdiskIoStatPromotedFTW; + UInt64 gpfsVdiskIoStatFlushedUpdateWrite; + UInt64 gpfsVdiskIoStatFlushedPromotedFTW; + UInt64 gpfsVdiskIoStatMigrate; + UInt64 gpfsVdiskIoStatScrub; + UInt64 gpfsVdiskIoStatLogWrite; + + public: + gpfsDeclusteredArrayVdiskIoStats(); + ~gpfsDeclusteredArrayVdiskIoStats(); + + void init(); + + UInt64 getVdiskIoStatRead() { return gpfsVdiskIoStatRead; } + UInt64 getVdiskIoStatShortWrite() + { return gpfsVdiskIoStatShortWrite; } + UInt64 getVdiskIoStatMediumWrite() + { return gpfsVdiskIoStatMediumWrite; } + UInt64 getVdiskIoStatFTW() { return gpfsVdiskIoStatFTW; } + UInt64 getVdiskIoStatPromotedFTW() + { return gpfsVdiskIoStatPromotedFTW; } + UInt64 getVdiskIoStatFlushedUpdateWrite() + { return gpfsVdiskIoStatFlushedUpdateWrite; } + UInt64 getVdiskIoStatFlushedPromotedFTW() + { return gpfsVdiskIoStatFlushedPromotedFTW; } + UInt64 getVdiskIoStatMigrate() { return gpfsVdiskIoStatMigrate; } + UInt64 getVdiskIoStatScrub() { return gpfsVdiskIoStatScrub; } + UInt64 getVdiskIoStatLogWrite() { return gpfsVdiskIoStatLogWrite; } +}; + + +/* + * gpfsDeclusteredArrayVdisk - description of a vdisk + */ + +class gpfsDeclusteredArrayVdisk +{ + friend class gpfsDeclusteredArrayVdiskIoStats; + + char gpfsVdiskName[RAID_NAME_LEN]; /* Vdisk name */ + char gpfsVdiskRaidCode[STR32_LEN]; /* RaidCode, see ErasureCodeNames[] + "8WayStriping", + "2WayReplication", + "3WayReplication", + "4WayReplication", + "8+2p", + "8+3p" */ + UInt32 gpfsVdiskBlockSizeInKiB; /* BlockSizeInKiB */ + UInt64 gpfsVdiskSize; /* VdiskSize in bytes */ + char gpfsVdiskState[STATE_STR_LEN];/* State, possible values: + "ok", "critical", "offline", + "%d/%d-degraded" + (faultLevel, faultTolerance)*/ + char gpfsVdiskRemarks[STR32_LEN]; /* Vidsk remarks, possible values: + "log", "" */ + + gpfsDeclusteredArrayVdiskIoStats gpfsVdiskIoStats; + + public: + gpfsDeclusteredArrayVdisk(); + ~gpfsDeclusteredArrayVdisk(); + + void init(); + void update(char *vDiskName, char *vDiskRaidCode, int vDiskBlockSizeInKiB, + UInt64 vDiskSize, char *vDiskState, char *vDiskRemarks); + + void print_gpfsDeclusteredArrayVdisk(int verbose = 0); + + char *getVdiskName() { return gpfsVdiskName; } + char *getVdiskRaidCode() { return gpfsVdiskRaidCode; } + UInt32 getVdiskBlockSizeInKiB() { return gpfsVdiskBlockSizeInKiB; } + UInt64 getVdiskSize() { return gpfsVdiskSize; } + char *getVdiskState() { return gpfsVdiskState; } + char *getVdiskRemarks() { return gpfsVdiskRemarks; } + gpfsDeclusteredArrayVdiskIoStats *getVdiskIoStatsP() + { return &gpfsVdiskIoStats; } +}; + + +/* + * gpfsRecoveryGroupDeclusteredArray - description of a Declustered Array + */ + +class gpfsRecoveryGroupDeclusteredArray +{ + friend class gpfsDeclusteredArrayPdisk; + friend class gpfsDeclusteredArrayVdisk; + + char gpfsDeclusteredArrayName[RAID_NAME_LEN]; /* declustered array name */ + char gpfsDeclusteredArrayNeedsService[STR8_LEN]; /* needs services */ + UInt32 gpfsDeclusteredArrayVdisks; /* number of vDisks */ + UInt32 gpfsDeclusteredArrayPdisks; /* number of pDisks */ + UInt32 gpfsDeclusteredArraySpares; /* Spares */ + UInt32 gpfsDeclusteredArrayReplaceThreshold; /* replace threshold */ + UInt64 gpfsDeclusteredArrayFreeSpace; + UInt32 gpfsDeclusteredArrayScrubDuration; /* scrub duration in days*/ + char gpfsDeclusteredArrayBackgroundTask[STR32_LEN]; /* background task + see: IM_ServiceLevel_tToString() + "inactive" + "rebuild-critical" + "rebuild-1r" + "rebuild-2r" + "rebuild-3r" + "rebuild-offline" + "rebalance" + "scrub1" + "scrub2" + "in-transition" + "metadata" + "error" + "Unknown IM_ServiceLevel_t" */ + UInt32 gpfsDeclusteredArrayTaskPercentComplete; /* task percent complete */ + char gpfsDeclusteredArrayTaskPrioriy[STR32_LEN];/* task prioriy + "high", "low" */ + + gpfsDeclusteredArrayPdisk *daPdiskArrayP;/* pointer to + gpfsDeclusteredArrayPdisk Table */ + + gpfsDeclusteredArrayVdisk *daVdiskArrayP;/* pointer to + gpfsDeclusteredArrayVdisk Table */ + + public: + + gpfsRecoveryGroupDeclusteredArray(); + ~gpfsRecoveryGroupDeclusteredArray(); + + void init(); + void update(char *daName, char *daNeedsService, + int nDaVdisks, int nDaPdisks, int nDaSpares, + int replaceThr, UInt64 freeSpace, int scrubDuration, + char *bgTaskType, int bgTaskPct, char *priority); + + void allocDiskArrays(int nPdisks, int nVdisks); + void deallocDiskArrays(); + + void print_gpfsDeclusterArray(int verbose = 0); + + gpfsDeclusteredArrayPdisk *getDeclusteredArrayPdiskP(int index); + gpfsDeclusteredArrayVdisk *getDeclusteredArrayVdiskP(int index); + + char *getDeclusteredArrayName() + { return gpfsDeclusteredArrayName; } + char *getDeclusteredNeedsService() + { return gpfsDeclusteredArrayNeedsService; } + UInt32 getDeclusteredArrayVdisks () + { return gpfsDeclusteredArrayVdisks; } + UInt32 getDeclusteredArrayPdisks() + { return gpfsDeclusteredArrayPdisks; } + UInt32 getDeclusteredArraySpares() + { return gpfsDeclusteredArraySpares; } + UInt32 getDeclusteredArrayReplaceThreshold() + { return gpfsDeclusteredArrayReplaceThreshold; } + UInt64 getDeclusteredArrayFreeSpace() + { return gpfsDeclusteredArrayFreeSpace; } + UInt32 getDeclusteredArrayScrubDuration() + { return gpfsDeclusteredArrayScrubDuration; } + char *getDeclusteredArrayBackgroundTask() + { return gpfsDeclusteredArrayBackgroundTask; } + UInt32 getDeclusteredArrayTaskPercentComplete() + { return gpfsDeclusteredArrayTaskPercentComplete; } + char *getDeclusteredArrayTaskPrioriy() + { return gpfsDeclusteredArrayTaskPrioriy; } +}; + + +/* + * gpfsRecoveryGroup - description of a recovery group + */ + +class gpfsRecoveryGroup +{ + friend class gpfsRecoveryGroupDeclusteredArray; + + char gpfsRecoveryGroupName[RAID_NAME_LEN]; /* RecoveryGroup Name */ + char gpfsRecoveryGroupActiveServer[STR64_LEN]; /* active server */ + char gpfsRecoveryGroupServers[SERVER_LIST_LEN]; /* primary and backup + servers */ + char gpfsRecoveryGroupId[PVID_MAX_CHARS]; + UInt32 gpfsRecoveryGroupDeclusterArrays; /* DA with vdisks */ + UInt32 gpfsRecoveryGroupVdisks; /* vDdisks */ + UInt32 gpfsRecoveryGroupPdisks; /* pDisks */ + gpfsRecoveryGroupDeclusteredArray gpfsDeclusteredArray[MAX_DA]; + + public: + + gpfsRecoveryGroup(); + ~gpfsRecoveryGroup(); + + void init(); + void updateRgSdrInfo(char *rgName, char *serverList, char *rgId); + void updateRgSummary(int nDas, int nVdisks, int nPdisks); + void updateRgServers(char *activeServerP, char *serversP); + void print_gpfsRecoveryGroup(char *banner); + + char *getRecoveryGroupName() { return gpfsRecoveryGroupName; }; + char *getRecoveryGroupActiveServer() + { return gpfsRecoveryGroupActiveServer; } + char *getRecoveryGroupServers() + { return gpfsRecoveryGroupServers; } + char *getRecoveryGroupId() + { return gpfsRecoveryGroupId; } + UInt32 getRecoveryGroupDeclusterArrays() + { return gpfsRecoveryGroupDeclusterArrays; } + UInt32 getRecoveryGroupVdisks() + { return gpfsRecoveryGroupVdisks; } + UInt32 getRecoveryGroupPdisks() + { return gpfsRecoveryGroupPdisks; } + gpfsRecoveryGroupDeclusteredArray *getRecoveryGroupDeclusterArraysP() + { return gpfsDeclusteredArray; }; + + gpfsRecoveryGroupDeclusteredArray *getDeclusteredArrayP(int index); +}; + + +/* + * gpfsRecoveryGroupSdrInfo - NSD RAID information from GPFS SDR + */ + +class gpfsRecoveryGroupSdrInfo +{ + char gpfsRecoveryGroupName[RAID_NAME_LEN]; + char gpfsRecoveryGroupServerList[SERVER_LIST_LEN]; + char gpfsRecoveryGroupId[PVID_MAX_CHARS]; /* PVID_MAX_CHARS = 20 */ + + public: + + gpfsRecoveryGroupSdrInfo(); + ~gpfsRecoveryGroupSdrInfo(); + + void init(); + void update(char *newName, char *newServerList, char *newId); + void print_gpfsRecoveryGroupSdrInfo(); + + char *getRecoveryGroupName() { return gpfsRecoveryGroupName; }; + char *getRecoveryGroupServerList() { return gpfsRecoveryGroupServerList; }; + char *getRecoveryGroupId() { return gpfsRecoveryGroupId; }; +}; + + +/* + * gpfsNsdRAIDConfigParms - NSD RAID related config parameters/variables + * gpfsNsdRAIDConfigVar - config variable (name and value string) + */ + +class gpfsNsdRAIDConfigVar +{ + friend class gpfsNsdRAIDConfigParms; + + char configVarName[STR64_LEN]; + char configVarValueStr[STR64_LEN]; + + public: + gpfsNsdRAIDConfigVar(); + ~gpfsNsdRAIDConfigVar(); + void init(); + + char *getNsdRaidConfigVar() { return configVarName; }; + char *getNsdRaidConfigValue() { return configVarValueStr; }; +}; + +class gpfsNsdRAIDConfigParms +{ + UInt32 nParms; /* num parameters defined */ + UInt32 nParmsAlloc; /* maximum allocated array */ + gpfsNsdRAIDConfigVar *gpfsNsdRAIDConfigVarTableP; + + public: + gpfsNsdRAIDConfigParms(int maxElem); + ~gpfsNsdRAIDConfigParms(); + + int init(int maxElem); + + UInt32 getNParms() { return nParms; }; + UInt32 getNParmsAlloc() { return nParmsAlloc; }; + void setNParms(int nFound) { nParms = nFound; }; + void setNParmsAlloc(int nAlloc) { nParmsAlloc = nAlloc; }; + int findNsdRAIDConfigParmIndex(char *varName); + void updateNsdRAIDConfigParm(int index, char *varName, char *varValue); + void print_gpfsNsdRAIDConfigParms(); + gpfsNsdRAIDConfigVar *getConfigVarP(int index); +}; + + +extern int getNsdRAIDSdrInfo( + gpfsRecoveryGroupSdrInfo *rgSdrTableP, /* buffer */ + int *nRgSdrAllocP /* in: size of the buffer + out: num of RGs in this cluster */); +extern int getRecoveryGroupSummary(gpfsRecoveryGroup *rgP); +extern int getRecoveryGroupDeclusteredArrays(gpfsRecoveryGroup *rgP); +extern int getNsdRAIDParameters(gpfsNsdRAIDConfigParms *configTableP, + int *nAllocP); + +extern int gpfsRGDefined(); + +#endif /* _h_api_nsdRAID */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/api_poll.h b/System/ior/files/gpfs/5.0.2-3/include/api_poll.h new file mode 100644 index 0000000..e202329 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/api_poll.h @@ -0,0 +1,2912 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* */ +/* */ +/* Licensed Materials - Property of IBM */ +/* */ +/* Restricted Materials of IBM */ +/* */ +/* (C) COPYRIGHT International Business Machines Corp. 2007,2018 */ +/* All Rights Reserved */ +/* */ +/* US Government Users Restricted Rights - Use, duplication or */ +/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/* @(#)49 1.65 src/avs/fs/mmfs/ts/mmantras/api_poll.h, mmfs, avs_rtac502, rtac5021836a 7/9/18 11:44:51 */ + +#ifndef _h_api_poll +#define _h_api_poll + + + +#include +#include +#include +#include +#include +#include + +/* MODS_START */ +#include +/* MODS_END */ + +#include + +/* String length */ +#define NAME_STRING_LEN 256 + +#define PATH_STRING_LEN 1024 + +/* Comma separated string length */ +#define LIST_STRING_LEN 1024 + +/* DJ_MODS_START */ +/* Buf length for Return messages from GPFS */ +#define MMCMD_RET_MSG_BUF_LEN 1024 +/* Number of tokens in a GPFS cmd with small number of parameters */ +#define MAX_NUM_TOKENS_SHORT_CMD 8 + +#define TIME_STAMP_CHARS 25 + +/* DJ_MODS_END */ + +/* Timer thread interval */ +#define TIMER_INTERVAL 300 + +#define ADDRLIST_NODES 64 + +/* rpc objects */ +#define RPC_OBJECTS 7 +#define MAX_NUMBER_BUCKETS 26 +#define MAX_SERVICES 26 +#define MAX_MSG_TYPES 51 +#define MAX_RPC_MAPPED_MSG_TYPES 2 +#define MAX_MSG_RPC MAX_SERVICES * MAX_MSG_TYPES + MAX_RPC_MAPPED_MSG_TYPES + +/* Management application protocol. It is for protocol-specific + functionalities. */ +typedef enum +{ + MGMT_SNMP = 0, + MGMT_CIM = 1 +} MgmtProtocol; + +/* Enable logging */ +#define ENABLE_MMANTRAS_LOG + +/* Maximum log level */ +#define MMANTRAS_LOG_MAX_LEVEL 3 + +/* Supported log levels */ +enum MmantrasLogLevel +{ + INFO = 0, + WARNING = 1, + ERROR = 2, + SEVERE = 3 +}; + +#define LIBMMANTRAS_VERSION 3504 /* version of currently defined MMANTRAS + interface - must update the corresponding + version number at daemon side */ + +extern int libmmantrasVersion(); + +/* Define maximum number of objects */ +#define MAX_NODE 1024 +#define MAX_FS 32 +#define MAX_FILESETV3 10000 +#define MAX_DISK 1024 +#define MAX_POOL 256 +#define MAX_POLICY 32 +#define MAX_RULE 65536 +#define MAX_NSD_SERVER 32 +#define MAX_TASK 1024 +#define MAX_PCACHE_CMD_INFO 39 /* must be >= MAX_PCACHE_CMD */ + +#define CLUSTER_MANAGER 0x1 +#define CLUSTER_STATUS 0x2 +#define CLUSTER_STATE_ALL CLUSTER_MANAGER | CLUSTER_STATUS + +#define AG_STAT_CHANNEL_WAIT 0 +#define AG_STAT_SEND_TIME_TCP 1 +#define AG_STAT_SEND_TIME_VERBS 2 +#define AG_STAT_RECEIVE_TIME_TCP 3 +#define AG_STAT_RPC_LATENCY_TCP 4 +#define AG_STAT_RPC_LATENCY_VERBS 5 +#define AG_STAT_RPC_LATENCY_MIXED 6 + +/* Info structs + The latest data from GPFS is stored in an internal copy of these structs. + The caller has his own copy, which is updated to be consistent with the + internal copy by calling the PollingHandler::update routines. */ + + +/* Asynchronous command execution information */ +class ExecutionTask +{ + friend class PollingHandler; + + char cmd[NAME_STRING_LEN]; + std::vectorargItems; + int (*callbackFn)(void *callbackData); + void *callbackData; + +public: + + ExecutionTask(MErrno *errP); + + ~ExecutionTask(); + + ExecutionTask& operator=(ExecutionTask &t); + + void setCmd(const char *cmdP); + void addArg(char *argP); + + void copyArgs(ExecutionTask *taskP); + + inline char* getCmd() { return cmd; } + inline UInt32 getNumArgItems() { return argItems.size(); } + inline char *getArg(int d) { return argItems.at(d); } +}; + +/* Asynchronous command execution result */ +class ExecutionResult +{ + UInt16 percentComplete; + +public: + ExecutionResult(MErrno *errP); + + ~ExecutionResult(); + + inline UInt16 getPercentComplete() { return percentComplete; } +}; + +/* Disk server information */ +class DiskServerInfo +{ + friend class PollingHandler; + + char name[NAME_STRING_LEN]; + +public: + DiskServerInfo(MErrno *errP); + + ~DiskServerInfo(); + + DiskServerInfo& operator=(DiskServerInfo &d); + + inline char* getName() { return name; } +}; + +/* Disk information */ +class DiskInfo +{ + friend class PollingHandler; + + Boolean_t found; + + /* Indicate whether it is free NSD or not. */ + Boolean_t free; + + char name[NAME_STRING_LEN]; + char nodeName[NAME_STRING_LEN]; // for easy association + + /* Use only when this NSD is free. */ + char poolName[NAME_STRING_LEN]; + + char status[NAME_STRING_LEN]; + char availability[NAME_STRING_LEN]; + char failureGroup[LIST_STRING_LEN]; + + char volumeId[NAME_STRING_LEN]; + + char metadata[NAME_STRING_LEN]; + char data[NAME_STRING_LEN]; + char diskWait[NAME_STRING_LEN]; + UInt64 totalSpace; + UInt64 fullBlockFreeSpace; + UInt64 subBlockFreeSpace; + + double readTime; + double writeTime; + double longestReadTime; + double longestWriteTime; + double shortestReadTime; + double shortestWriteTime; + UInt64 readBytes; + UInt64 writeBytes; + UInt32 readOps; + UInt32 writeOps; + + UInt32 nodePerfCount; // number of nodes that had valid contribution to perf aggregate + + std::vectorserverItems; + std::vectorbackupServerItems; + + void copyServers(DiskInfo *diskP); + int getServerIndex(char *nameP); + void copyBackupServers(DiskInfo *diskP); + int getBackupServerIndex(char *nameP); + +public: + DiskInfo(MErrno *errP); + + ~DiskInfo(); + + DiskInfo& operator=(DiskInfo &d); + void clearStats(); + + inline Boolean_t isFree() { return free; } + + inline char* getName() { return name; } + inline char *getNodeName() { return nodeName; } + + /* Disk stats from EE get fs command */ + inline char *getStatus() { return status; } + inline char *getAvailability() { return availability; } + inline char *getFailureGroupId() { return failureGroup; } + inline char *getVolumeId() { return volumeId; } + inline char *getMetadata() { return metadata; } + inline char *getData() { return data; } + inline char *getDiskWait() { return diskWait; } + inline UInt64 getTotalSpace() { return totalSpace; } + inline UInt64 getFullBlockFreeSpace() { return fullBlockFreeSpace; } + inline UInt64 getSubBlockFreeSpace() { return subBlockFreeSpace; } + + /* Disk performance statistics: see mmpmon ds for details */ + /* Note: getReadTime() and getWriteTime() return the total time of all + operations; divide by the total ops to get average */ + inline double getReadTime() { return readTime; } /* microseconds */ + inline double getWriteTime() { return writeTime; } + inline double getLongestReadTime() { return longestReadTime; } + inline double getLongestWriteTime() { return longestWriteTime; } + inline double getShortestReadTime() { return shortestReadTime; } + inline double getShortestWriteTime() { return shortestWriteTime; } + inline UInt64 getReadBytes() { return readBytes; } + inline UInt64 getWriteBytes() { return writeBytes; } + inline UInt32 getReadOps() { return readOps; } + inline UInt32 getWriteOps() { return writeOps; } + inline UInt32 getNodePerfCount() { return nodePerfCount; } + inline UInt32 getNumServerItems() { return serverItems.size(); } + inline DiskServerInfo *getServer(int d) { return serverItems.at(d); } + inline UInt32 getNumBackupServerItems() { return backupServerItems.size(); } + inline DiskServerInfo *getBackupServer(int d) { return backupServerItems.at(d); } + inline char *getPoolName() { return poolName; } + void updateTotalSpace(UInt64 dSizeInKB) { totalSpace = dSizeInKB; } + void updateDiskInfoStatus(char *dsStatus); +}; + +/* forward decl */ +class FilesystemInfo; + +/* Storage pool information */ +class StoragePoolInfo +{ + friend class PollingHandler; + + char name[NAME_STRING_LEN]; + char status[NAME_STRING_LEN]; + UInt32 numDisks; + UInt64 totalSpace; + UInt64 freeSpace; + + UInt32 parentFS; /* index of parent filesystem */ + Boolean_t found; + + /* Store the list of disk name - primary key */ + std::vectordiskItems; + struct timeval diskRefreshTime; + struct timeval diskPerfRefreshTime; + + void copyDisks(StoragePoolInfo *poolP); + int getDiskInfoIndex(char *nameP); + + UInt64 totalBytesRead; + UInt64 totalBytesWrite; + double totalReadTime; + double totalWriteTime; + void clearStats(); + +public: + StoragePoolInfo(MErrno *errP); + ~StoragePoolInfo(); + StoragePoolInfo& operator=(StoragePoolInfo &sp); + inline char *getName() { return name; } + inline char *getStatus() { return status; } + inline UInt64 getTotalSpace() { return totalSpace; } + inline UInt64 getFreeSpace() { return freeSpace; } + inline UInt32 getParent() { return parentFS; } + inline UInt32 getNumDisks() { return numDisks; } // Use only when file system is mounted + inline UInt32 getNumDiskItems() { return diskItems.size(); } + inline DiskInfo *getDisk(int d) { return diskItems.at(d); } + inline struct timeval getDiskRefreshTime() { return diskRefreshTime; } + inline struct timeval getDiskPerfRefreshTime() { return diskPerfRefreshTime; } + + inline UInt64 getTotalBytesRead() { return totalBytesRead; } + inline UInt64 getTotalBytesWrite() { return totalBytesWrite; } + inline double getTotalReadTime() { return totalReadTime; } + inline double getTotalWriteTime() { return totalWriteTime; } + +}; + +/* Mounted node information */ +class MountedNodeInfo +{ + friend class PollingHandler; + + char name[NAME_STRING_LEN]; + char ipAddr[NAME_STRING_LEN]; + + Boolean_t found; + +public: + MountedNodeInfo(MErrno *errP); + + ~MountedNodeInfo(); + + MountedNodeInfo& operator=(MountedNodeInfo &d); + + inline char* getName() { return name; } + inline char* getIpAddr() { return ipAddr; } +}; + +/* File system policy rule information */ +class RuleInfo +{ + friend class PollingHandler; + + char name[NAME_STRING_LEN]; + char desc[LIST_STRING_LEN]; + +public: + RuleInfo(MErrno *errP); + + ~RuleInfo(); + + RuleInfo& operator=(RuleInfo &d); + + inline char *getName() { return name; } + inline char *getDesc() { return desc; } +}; + +/* File system policy information */ +class PolicyInfo +{ + friend class PollingHandler; + + char name[NAME_STRING_LEN]; + char installUser[NAME_STRING_LEN]; + char installTime[NAME_STRING_LEN]; + + std::vectorruleItems; + + void copyRules(PolicyInfo *piP); + int getRuleInfoIndex(char *nameP); + +public: + PolicyInfo(MErrno *errP); + + ~PolicyInfo(); + + PolicyInfo& operator=(PolicyInfo &d); + + inline char *getName() { return name; } + inline char *getInstallUser() { return installUser; } + inline char *getInstallTime() { return installTime; } + inline UInt32 getNumRules() { return ruleItems.size(); } + inline RuleInfo *getRule(int r) { return ruleItems.at(r); } +}; + +/* File system performance */ +class FilesystemPerf +{ + friend class PollingHandler; + + char fsName[NAME_STRING_LEN]; + char nodeName[NAME_STRING_LEN]; + char nodeIpAddr[NAME_STRING_LEN]; + + UInt64 bytesRead; + UInt64 bytesCache; + UInt64 bytesWritten; + UInt32 reads; + UInt32 caches; + UInt32 writes; + UInt32 openCalls; + UInt32 closeCalls; + UInt32 readCalls; + UInt32 writeCalls; + UInt32 readdirCalls; + UInt64 inodesWritten; + UInt64 inodesRead; + UInt64 inodesDeleted; + UInt64 inodesCreated; + UInt32 statCacheHit; + UInt32 statCacheMiss; + + Boolean_t found; + +public: + FilesystemPerf(MErrno *errP); + + ~FilesystemPerf(); + + FilesystemPerf& operator=(FilesystemPerf &fs); + void clearStats(); + + inline char *getFsName() { return fsName; } + inline char *getNodeName() { return nodeName; } + inline char *getNodeIpAddr() { return nodeIpAddr; } + inline UInt64 getBytesRead() { return bytesRead; } + inline UInt64 getBytesCache() { return bytesCache; } + inline UInt64 getBytesWritten() { return bytesWritten; } + inline UInt32 getReads() { return reads; } + inline UInt32 getCaches() { return caches; } + inline UInt32 getWrites() { return writes; } + inline UInt32 getOpenCalls() { return openCalls; } + inline UInt32 getCloseCalls() { return closeCalls; } + inline UInt32 getReadCalls() { return readCalls; } + inline UInt32 getWriteCalls() { return writeCalls; } + inline UInt32 getReaddirCalls() { return readdirCalls; } + inline UInt64 getInodesWritten() { return inodesWritten; } + inline UInt64 getInodesRead() { return inodesRead; } + inline UInt64 getInodesDeleted() { return inodesDeleted; } + inline UInt64 getInodesCreated() { return inodesCreated; } + inline UInt32 getStatCacheHit() { return statCacheHit; } + inline UInt32 getStatCacheMiss() { return statCacheMiss; } +}; + +/* File system information */ +class FilesystemInfo +{ + friend class PollingHandler; + + char name[NAME_STRING_LEN]; + + /* Manager node name. */ + char manager[NAME_STRING_LEN]; + + char status[NAME_STRING_LEN]; + char xstatus[NAME_STRING_LEN]; + + UInt32 readDuration; + UInt32 writeDuration; + UInt32 numMgmt; + UInt32 numMgrChange; + UInt64 totalSpace; + UInt64 numTotalInodes; + UInt64 freeSpace; + UInt64 numFreeInodes; + UInt64 fullBlockFreeSpace; + UInt64 subBlockFreeSpace; + char threadWait[NAME_STRING_LEN]; + char diskWait[NAME_STRING_LEN]; + + /* Configuration information. */ + UInt64 minFragmentSize; + UInt64 inodeSize; + UInt64 indirectBlockSize; + UInt32 defaultMetadataReplicas; + UInt32 maxMetadataReplicas; + UInt32 defaultDataReplicas; + UInt32 maxDataReplicas; + char blockAllocationType[NAME_STRING_LEN]; + char fileLockingSemantics[NAME_STRING_LEN]; + char aclSemantics[NAME_STRING_LEN]; + UInt64 estimatedAverageFileSize; + UInt64 numNodes; + UInt64 blockSize; + char quotaEnforced[NAME_STRING_LEN]; + char defaultQuotasEnabled[NAME_STRING_LEN]; + UInt64 maxNumInodes; + char filesystemVersion[NAME_STRING_LEN]; + char supportForLargeLuns[NAME_STRING_LEN]; + char dmapiEnabled[NAME_STRING_LEN]; + char exactMtime[NAME_STRING_LEN]; + char suppressAtime[NAME_STRING_LEN]; + char automaticMountOption[NAME_STRING_LEN]; + char additionalMountOptions[NAME_STRING_LEN]; + char defaultMountPoint[NAME_STRING_LEN]; + + UInt64 bytesRead; + UInt64 bytesCache; + UInt64 bytesWritten; + + UInt32 reads; + UInt32 caches; + UInt32 writes; + + UInt32 openCalls; + UInt32 closeCalls; + UInt32 readCalls; + UInt32 writeCalls; + UInt32 readdirCalls; + + UInt64 inodesWritten; + UInt64 inodesRead; + UInt64 inodesDeleted; + UInt64 inodesCreated; + + UInt32 statCacheHit; + UInt32 statCacheMiss; + + UInt32 nodePerfCount; + + /* Store the list of storage pools - primary key */ + std::vectorpoolItems; + struct timeval poolRefreshTime; /* Last data refresh time */ + + /* Store the list of mounted nodes */ + std::vectormountedNodeItems; + + /* Store the list of policies */ + std::vectorpolicyItems; + + /* Store the list of per-node performance */ + std::vectorperfItems; + + /* Workspace indicating this item was found in the SDR file */ + Boolean_t found; + + /* MODS_START */ + bool updated; + /* MODS_END */ + + void copyPools(FilesystemInfo *fsP); + int getStoragePoolInfoIndex(char *nameP); + + void copyMountedNodes(FilesystemInfo *fsP); + int getMountedNodeIndex(char *ipAddrP); + + void copyPolicies(FilesystemInfo *fsP); + int getPolicyInfoIndex(char *nameP); + + void copyPerNodePerfs(FilesystemInfo *fsP); + int getPerNodePerfIndex(char *ipAddrP); + +public: + FilesystemInfo(MErrno *errP); + + ~FilesystemInfo(); + + FilesystemInfo& operator=(FilesystemInfo &fs); + void clearStats(); + + /* Filesystem info from SDR and EE get fs */ + inline char *getName() { return name; } + inline char *getManager() { return manager; } + inline char *getStatus() { return status; } + inline char *getXstatus() { return xstatus; } + + inline UInt32 getReadDuration() { return readDuration; } + inline UInt32 getWriteDuration() { return writeDuration; } + inline UInt32 getNumMgmt() { return numMgmt; } + inline UInt32 getNumMgrChange() { return numMgrChange; } + inline UInt64 getTotalSpace() { return totalSpace; } + inline UInt64 getNumTotalInodes() { return numTotalInodes; } + inline UInt64 getFreeSpace() { return freeSpace; } + inline UInt64 getNumFreeInodes() { return numFreeInodes; } + inline UInt64 getFullBlockFreeSpace() { return fullBlockFreeSpace; } + inline UInt64 getSubBlockFreeSpace() { return subBlockFreeSpace; } + + /* Filesystem performance statistics from mmpmon gfis */ + inline char *getThreadWait() { return threadWait; } + inline char *getDiskWait() { return diskWait; } + + inline UInt64 getMinFragmentSize() { return minFragmentSize; } + inline UInt64 getInodeSize() { return inodeSize; } + inline UInt64 getIndirectBlockSize() { return indirectBlockSize; } + inline UInt64 getEstimatedAverageFileSize() { return estimatedAverageFileSize; } + inline UInt64 getNumNodes() { return numNodes; } + inline UInt64 getBlockSize() { return blockSize; } + inline UInt64 getFSInodeLimit() { return maxNumInodes; } + inline UInt32 getDefaultMetadataReplicas() { return defaultMetadataReplicas; } + inline UInt32 getMaxMetadataReplicas() { return maxMetadataReplicas; } + inline UInt32 getDefaultDataReplicas() { return defaultDataReplicas; } + inline UInt32 getMaxDataReplicas() { return maxDataReplicas; } + inline char *getBlockAllocationType() { return blockAllocationType; } + inline char *getFileLockingSemantics() { return fileLockingSemantics; } + inline char *getAclSemantics() { return aclSemantics; } + inline char *getQuotaEnforced() { return quotaEnforced; } + inline char *getDefaultQuotasEnabled() { return defaultQuotasEnabled; } + inline char *getFilesystemVersion() { return filesystemVersion; } + inline char *getSupportForLargeLuns() { return supportForLargeLuns; } + inline char *getDmapiEnabled() { return dmapiEnabled; } + inline char *getExactMtime() { return exactMtime; } + inline char *getSuppressAtime() { return suppressAtime; } + inline char *getAutomaticMountOption() { return automaticMountOption; } + inline char *getAdditionalMountOptions() { return additionalMountOptions; } + inline char *getDefaultMountPoint() { return defaultMountPoint; } + + inline UInt64 getBytesRead() { return bytesRead; } + inline UInt64 getBytesCache() { return bytesCache; } + inline UInt64 getBytesWritten() { return bytesWritten; } + inline UInt32 getReads() { return reads; } + inline UInt32 getCaches() { return caches; } + inline UInt32 getWrites() { return writes; } + inline UInt32 getOpenCalls() { return openCalls; } + inline UInt32 getCloseCalls() { return closeCalls; } + inline UInt32 getReadCalls() { return readCalls; } + inline UInt32 getWriteCalls() { return writeCalls; } + inline UInt32 getReaddirCalls() { return readdirCalls; } + inline UInt64 getInodesWritten() { return inodesWritten; } + inline UInt64 getInodesRead() { return inodesRead; } + inline UInt64 getInodesDeleted() { return inodesDeleted; } + inline UInt64 getInodesCreated() { return inodesCreated; } + inline UInt32 getStatCacheHit() { return statCacheHit; } + inline UInt32 getStatCacheMiss() { return statCacheMiss; } + + /* Storage pool information from EE get stgpools */ + inline UInt32 getNumStoragePools() { return poolItems.size(); } + inline StoragePoolInfo *getStoragePool(int p) { return poolItems.at(p); } + inline struct timeval getPoolRefreshTime() { return poolRefreshTime; } + + inline UInt32 getNodePerfCount() { return nodePerfCount; } + + inline UInt32 getNumMountedNodes() { return mountedNodeItems.size(); } + inline MountedNodeInfo *getMountedNode(int n) { return mountedNodeItems.at(n); } + + inline UInt32 getNumPolicies() { return policyItems.size(); } + inline PolicyInfo *getPolicy(int n) { return policyItems.at(n); } + + inline UInt32 getNumPerNodePerfs() { return perfItems.size(); } + inline FilesystemPerf *getPerNodePerf(int n) { return perfItems.at(n); } + + /* MODS_START */ + inline bool wasUpdated() { return updated; } + /* MODS_END */ + +}; + +/* Disk access information */ +class DiskAccessInfo +{ + friend class PollingHandler; + + char diskName[NAME_STRING_LEN]; + Boolean_t local; + char deviceName[NAME_STRING_LEN]; + char serverName[NAME_STRING_LEN]; + +public: + DiskAccessInfo(MErrno *errP); + + ~DiskAccessInfo(); + + DiskAccessInfo& operator=(DiskAccessInfo &d); + + inline char *getDiskName() { return diskName; } + inline Boolean_t isLocal() { return local; } + inline char *getDeviceName() { return deviceName; } + inline char *getServerName() { return serverName; } +}; + +/* I/O statistics counted by context + + _response_ begin mmpmon iocs + _mmpmon::iocs_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1262967025 + _tu_ 739667 _other_ 672560 18244 _mb_ 3427 580 _steal_ 5 8 + _cleaner_ 0 910 _sync_ 22 487 _logwrap_ 0 16703 _revoke_ 0 0 + _prefetch_ 9250 0 _logdata_ 9250 0 _nsdworker_ 9250 0 + _response_ end +*/ + +/* Define a version number for ioStatsInfo to allow + future changes in this structure. + */ +#define GPFS_IOCS_VERSION 1 + +class IocStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + char ipAddr[NAME_STRING_LEN]; + + UInt32 iocUnknown_r; + UInt32 iocUnknown_w; + UInt32 iocMBHandler_r; + UInt32 iocMBHandler_w; + UInt32 iocSteal_r; + UInt32 iocSteal_w; + UInt32 iocCleaner_r; + UInt32 iocCleaner_w; + UInt32 iocSync_r; + UInt32 iocSync_w; + UInt32 iocLogwrap_r; + UInt32 iocLogwrap_w; + UInt32 iocRevoke_r; + UInt32 iocRevoke_w; + UInt32 iocPrefetch_r; + UInt32 iocPrefetch_w; + +public: + IocStatsInfo(MErrno *errP); + IocStatsInfo(); + ~IocStatsInfo(); + + IocStatsInfo& operator=(IocStatsInfo &ioc); + + void clearStats(); + + inline UInt32 getIocUnknown_r() { return iocUnknown_r; } + inline UInt32 getIocUnknown_w() { return iocUnknown_w; } + inline UInt32 getIocMBHandler_r() { return iocMBHandler_r; } + inline UInt32 getIocMBHandler_w() { return iocMBHandler_w; } + inline UInt32 getIocSteal_r() { return iocSteal_r; } + inline UInt32 getIocSteal_w() { return iocSteal_w; } + inline UInt32 getIocCleaner_r() { return iocCleaner_r; } + inline UInt32 getIocCleaner_w() { return iocCleaner_w; } + inline UInt32 getIocSync_r() { return iocSync_r; } + inline UInt32 getIocSync_w() { return iocSync_w; } + inline UInt32 getIocLogwrap_r() { return iocLogwrap_r; } + inline UInt32 getIocLogwrap_w() { return iocLogwrap_w; } + inline UInt32 getIocRevoke_r() { return iocRevoke_r; } + inline UInt32 getIocRevoke_w() { return iocRevoke_w; } + inline UInt32 getIocPrefetch_r() { return iocPrefetch_r; } + inline UInt32 getIocPrefetch_w() { return iocPrefetch_w; } + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getIpAddr() { return ipAddr; } +}; + +/* vfs statistics + +_response_ begin mmpmon vfss +_mmpmon::vfss_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1262970919 + _tu_ 253243 _access_ 3106 0.037376 _close_ 218 0.033548 _create_ 0 0.000000 + _fclear_ 0 0.000000 _fsync_ 0 0.000000 _fsync_range_ 0 0.000000 + _ftrunc_ 0 0.000000 _getattr_ 13590 7.612393 _link_ 0 0.000000 + _lockctl_ 0 0.000000 _lookup_ 30154 1.026978 _map_lloff_ 0 0.000000 + _mkdir_ 0 0.000000 _mknod_ 0 0.000000 _open_ 218 0.127916 + _read_ 380 0.081198 _write_ 0 0.000000 _mmapRead_ 0 0.000000 + _mmapWrite_ 0 0.000000 _readdir_ 1131 0.459991 _readlink_ 0 0.000000 + _readpage_ 0 0.000000 _remove_ 3104 45.060595 _rename_ 0 0.000000 + _rmdir_ 0 0.000000 _setacl_ 0 0.000000 _setattr_ 0 0.000000 + _symlink_ 0 0.000000 _unmap_ 0 0.000000 _writepage_ 0 0.000000 + _tsfattr_ 0 0.000000 _tsfsattr_ 0 0.000000 _flock_ 0 0.000000 + _setxattr_ 0 0.000000 _getxattr_ 0 0.000000 _listxattr_ 0 0.000000 + _removexattr_ 0 0.000000 _encode_fh_ 0 0.000000 _decode_fh_ 0 0.000000 + _get_dentry_ 0 0.000000 _get_parent_ 0 0.000000 _mount_ 1 13.515959 + _statfs_ 0 0.000000 _sync_ 2796 5.254986 _vget_ 0 0.000000 +_response_ end + +*/ + +/* Define a version number for VfsStatsInfo to allow + future changes in this structure. + */ +#define GPFS_VFSS_VERSION 1 + +class VfsStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + char ipAddr[NAME_STRING_LEN]; + + /* vfs calls */ + UInt32 accessCalls; + UInt32 closeCalls; + UInt32 createCalls; + UInt32 fclearCalls; + UInt32 fsyncCalls; + UInt32 fsync_rangeCalls; + UInt32 ftruncCalls; + UInt32 getattrCalls; + UInt32 linkCalls; + UInt32 lockctlCalls; + UInt32 lookupCalls; + UInt32 map_lloffCalls; + UInt32 mkdirCalls; + UInt32 mknodCalls; + UInt32 openCalls; + UInt32 readCalls; + UInt32 writeCalls; + UInt32 mmapReadCalls; + UInt32 mmapWriteCalls; + UInt32 readdirCalls; + UInt32 readlinkCalls; + UInt32 readpageCalls; + UInt32 removeCalls; + UInt32 renameCalls; + UInt32 rmdirCalls; + UInt32 setaclCalls; + UInt32 setattrCalls; + UInt32 symlinkCalls; + UInt32 unmapCalls; + UInt32 writepageCalls; + UInt32 tsfattrCalls; + UInt32 tsfsattrCalls; + UInt32 flockCalls; + UInt32 setxattrCalls; + UInt32 getxattrCalls; + UInt32 listxattrCalls; + UInt32 removexattrCalls; + UInt32 encode_fhCalls; + UInt32 decode_fhCalls; + UInt32 get_dentryCalls; + UInt32 get_parentCalls; + UInt32 mountCalls; + UInt32 statfsCalls; + UInt32 syncCalls; + UInt32 vgetCalls; + + /* total time spent on each call */ + float accessT; + float closeT; + float createT; + float fclearT; + float fsyncT; + float fsync_rangeT; + float ftruncT; + float getattrT; + float linkT; + float lockctlT; + float lookupT; + float map_lloffT; + float mkdirT; + float mknodT; + float openT; + float readT; + float writeT; + float mmapReadT; + float mmapWriteT; + float readdirT; + float readlinkT; + float readpageT; + float removeT; + float renameT; + float rmdirT; + float setaclT; + float setattrT; + float symlinkT; + float unmapT; + float writepageT; + float tsfattrT; + float tsfsattrT; + float flockT; + float setxattrT; + float getxattrT; + float listxattrT; + float removexattrT; + float encode_fhT; + float decode_fhT; + float get_dentryT; + float get_parentT; + float mountT; + float statfsT; + float syncT; + float vgetT; + +public: + VfsStatsInfo(MErrno *errP); + VfsStatsInfo(); + ~VfsStatsInfo(); + + VfsStatsInfo& operator=(VfsStatsInfo &v); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getIpAddr() { return ipAddr; } + inline UInt32 getAccessCalls() { return accessCalls; } + inline UInt32 getCloseCalls() { return closeCalls; } + inline UInt32 getCreateCalls() { return createCalls; } + inline UInt32 getFclearCalls() { return fclearCalls; } + inline UInt32 getFsyncCalls() { return fsyncCalls; } + inline UInt32 getFsync_rangeCalls() { return fsync_rangeCalls; } + inline UInt32 getFtruncCalls() { return ftruncCalls; } + inline UInt32 getGetattrCalls() { return getattrCalls; } + inline UInt32 getLinkCalls() { return linkCalls; } + inline UInt32 getLockctlCalls() { return lockctlCalls; } + inline UInt32 getLookupCalls() { return lookupCalls; } + inline UInt32 getMap_lloffCalls() { return map_lloffCalls; } + inline UInt32 getMkdirCalls() { return mkdirCalls; } + inline UInt32 getMknodCalls() { return mknodCalls; } + inline UInt32 getOpenCalls() { return openCalls; } + inline UInt32 getReadCalls() { return readCalls; } + inline UInt32 getWriteCalls() { return writeCalls; } + inline UInt32 getMmapReadCalls() { return mmapReadCalls; } + inline UInt32 getMmapWriteCalls() { return mmapWriteCalls; } + inline UInt32 getReaddirCalls() { return readdirCalls; } + inline UInt32 getReadlinkCalls() { return readlinkCalls; } + inline UInt32 getReadpageCalls() { return readpageCalls; } + inline UInt32 getRemoveCalls() { return removeCalls; } + inline UInt32 getRenameCalls() { return renameCalls ; } + inline UInt32 getRmdirCalls() { return rmdirCalls; } + inline UInt32 getSetaclCalls() { return setaclCalls; } + inline UInt32 getSetattrCalls() { return setattrCalls; } + inline UInt32 getSymlinkCalls() { return symlinkCalls; } + inline UInt32 getUnmapCalls() { return unmapCalls; } + inline UInt32 getWritepageCalls() { return writepageCalls; } + inline UInt32 getTsfattrCalls() { return tsfattrCalls; } + inline UInt32 getTsfsattrCalls() { return tsfsattrCalls; } + inline UInt32 getFlockCalls() { return flockCalls; } + inline UInt32 getSetxattrCalls() { return setxattrCalls; } + inline UInt32 getGetxattrCalls() { return getxattrCalls; } + inline UInt32 getListxattrCalls() { return listxattrCalls ; } + inline UInt32 getRemovexattrCalls() { return removexattrCalls; } + inline UInt32 getEncode_fhCalls() { return encode_fhCalls; } + inline UInt32 getDecode_fhCalls() { return decode_fhCalls; } + inline UInt32 getGet_dentryCalls() { return get_dentryCalls; } + inline UInt32 getGet_parentCalls() { return get_parentCalls; } + inline UInt32 getMountCalls() { return mountCalls; } + inline UInt32 getStatfsCalls() { return statfsCalls; } + inline UInt32 getSyncCalls() { return syncCalls; } + inline UInt32 getVgetCalls() { return vgetCalls; } + + inline float getAccessTime() { return accessT; } + inline float getCloseTime() { return closeT; } + inline float getCreateTime() { return createT; } + inline float getFclearTime() { return fclearT; } + inline float getFsyncTime() { return fsyncT; } + inline float getFsync_rangeTime() { return fsync_rangeT; } + inline float getFtruncTime() { return ftruncT; } + inline float getGetattrTime() { return getattrT; } + inline float getLinkTime() { return linkT; } + inline float getLockctlTime() { return lockctlT; } + inline float getLookupTime() { return lookupT; } + inline float getMap_lloffTime() { return map_lloffT; } + inline float getMkdirTime() { return mkdirT; } + inline float getMknodTime() { return mknodT; } + inline float getOpenTime() { return openT; } + inline float getReadTime() { return readT; } + inline float getWriteTime() { return writeT; } + inline float getMmapReadTime() { return mmapReadT; } + inline float getMmapWriteTime() { return mmapWriteT; } + inline float getReaddirTime() { return readdirT; } + inline float getReadlinkTime() { return readlinkT; } + inline float getReadpageTime() { return readpageT; } + inline float getRemoveTime() { return removeT; } + inline float getRenameTime() { return renameT ; } + inline float getRmdirTime() { return rmdirT; } + inline float getSetaclTime() { return setaclT; } + inline float getSetattrTime() { return setattrT; } + inline float getSymlinkTime() { return symlinkT; } + inline float getUnmapTime() { return unmapT; } + inline float getWritepageTime() { return writepageT; } + inline float getTimesfattrT() { return tsfattrT; } + inline float getTimesfsattrT() { return tsfsattrT; } + inline float getFlockTime() { return flockT; } + inline float getSetxattrTime() { return setxattrT; } + inline float getGetxattrTime() { return getxattrT; } + inline float getListxattrTime() { return listxattrT ; } + inline float getRemovexattrTime() { return removexattrT; } + inline float getEncode_fhTime() { return encode_fhT; } + inline float getDecode_fhTime() { return decode_fhT; } + inline float getGet_dentryTime() { return get_dentryT; } + inline float getGet_parentTime() { return get_parentT; } + inline float getMountTime() { return mountT; } + inline float getStatfsTime() { return statfsT; } + inline float getSyncTime() { return syncT; } + inline float getVgetTime() { return vgetT; } +}; + +/* Per node thread utilization stats + + _response_ begin mmpmon threads + _mmpmon::threads_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1263415922 + _tu_ 317953 _nthreads_ 127 _seq_ 60149 _noncritical_ 13 28 1473 + _daemonstartup_ 14 16 33 _mbhandler_ 29 29 65 _rcvworker_ 10 11 266 + _revokeworker_ 0 0 35 _rangerevoke_ 0 0 20 _reclockrevoke_ 0 0 10 + _prefetch_ 1 1 72 _sgexception_ 0 3 16 _receiver_ 12 12 16 + _pcache_ 0 0 0 _multithreadworker_ 0 0 974 + _response_ end + +*/ + +/* Define a version number for ThreadUtilInfo to allow + future changes in this structure. + */ +#define GPFS_THRDS_VERSION 1 + +class ThreadUtilInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + char ipAddr[NAME_STRING_LEN]; + + UInt32 nThreads; + UInt32 seq; + + /* Thread pool utilization (current/highest/maximum) */ + threadUtil_t noncritical; + threadUtil_t daemonstartup; + threadUtil_t mbhandler; + threadUtil_t rcvworker; + threadUtil_t revokeworker; + threadUtil_t rangerevoke; + threadUtil_t reclockrevoke; + threadUtil_t prefetch; + threadUtil_t sgexception; + threadUtil_t receiver; + threadUtil_t pcache; + threadUtil_t multithreadworker; + +public: + ThreadUtilInfo(MErrno *errP); + ThreadUtilInfo(); + ~ThreadUtilInfo(); + + ThreadUtilInfo& operator=(ThreadUtilInfo &th_u); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getIpAddr() { return ipAddr; } + inline UInt32 getNthreads() { return nThreads; } + inline UInt32 getSeq() { return seq; } + + inline threadUtil_t *getNoncritical() { return &noncritical; } + inline threadUtil_t *getDaemonstartup() { return &daemonstartup; } + inline threadUtil_t *getMbhandler() { return &mbhandler; } + inline threadUtil_t *getRcvworker() { return &rcvworker; } + inline threadUtil_t *getRevokeworker() { return &revokeworker; } + inline threadUtil_t *getRrangerevoke() { return &rangerevoke; } + inline threadUtil_t *getReclockrevoke() { return &reclockrevoke; } + inline threadUtil_t *getPrefetch() { return &prefetch; } + inline threadUtil_t *getSgexception() { return &sgexception; } + inline threadUtil_t *getReceiver() { return &receiver; } + inline threadUtil_t *getPcache() { return &pcache; } + inline Int32 getMultithreadWanted() { return multithreadworker.current; } + inline Int32 getMultithreadRunning() { return multithreadworker.highest; } + inline Int32 getMultithreadLimit() { return multithreadworker.maximum; } + +}; + +/* rpcs stats + * _response_ begin mmpmon rpcs + * _mmpmon::rpcs_ _req_ node _n_ 192.168.56.168 _nn_ node3 _rn_ 192.168.56.167 _rnn_ node2 _rc_ 0 _t_ 1388052336 _tu_ 611492 + * _rpcObj_ _obj_ AG_STAT_CHANNEL_WAIT _nsecs_ 1 _nmins_ 10 _nhours_ 0 _ndays_ 0 + * _stats_ _tmu_ xxxx _av_ x.000, _min_ x.000, _max_ x.000, _cnt_ xxxx + * _stats_ _tmu_ xxxx _av_ x.000, _min_ x.000, _max_ x.000, _cnt_ xxxx + * ......... + * ......... + * _rpcObj_ _obj_ AG_STAT_SEND_TIME_TCP _nsecs_ 1 _nmins_ 10 _nhours_ 0 _ndays_ 0 + * _stats_ _tmu_ xxxx _av_ x.000, _min_ x.000, _max_ x.000, _cnt_ xxxx + * _stats_ _tmu_ xxxx _av_ x.000, _min_ x.000, _max_ x.000, _cnt_ xxxx + * ......... + * ......... + * _response_ end + * + * rpcs ns + * _response_ begin mmpmon rpcs ns + * _mmpmon::rpcs_ _req_ node _n_ 192.168.56.168 _nn_ node3 _rc_ 0 _t_ 1388052336 _tu_ 611492 + * _rpcObj_ _obj_ AG_STAT_CHANNEL_WAIT _nsecs_ 1 _nmins_ 0 _nhours_ 0 _ndays_ 0 + * _stats_ _tmu_ xxxx _av_ x.000, _min_ x.000, _max_ x.000, _cnt_ xxxx + * _rpcObj_ _obj_ AG_STAT_SEND_TIME_TCP _nsecs_ 1 _nmins_ 0 _nhours_ 0 _ndays_ 0 + * _stats_ _tmu_ xxxx _av_ x.000, _min_ x.000, _max_ x.000, _cnt_ xxxx + * _response_ end + * + * rpcs size + * _response_ begin mmpmon rpcs size + * _mmpmon::rpcs_ _req_ size _n_ 192.168.56.167 _nn_ node2 _rc_ 0 _t_ 1388417852 _tu_ 572950 + * _rpcSize_ _size_ 64 _nsecs_ 60 _nmins_ 60 _nhours_ 24 _ndays_ 30 + * _stats_ _tmu_ xxxx _av_ x.000, _min_ x.000, _max_ x.000, _cnt_ xxxx + * ........ + * ........ + * _response_ end + * + * rpcs message + * _response_ begin mmpmon rpcs message + * _mmpmon::rpcs_ _req_ message _n_ 192.168.56.167 _nn_ node2 _rc_ 0 _t_ 13907i61504 _tu_ 332981 + * _rpcObj_ _obj_ xxxx _nsecs_ 60 _nmins_ 60 _nhours_ 24 _ndays_ 30 + * _stats_ _tmu_ xxxx _av_ x.000, _min_ x.000, _max_ x.000, _cnt_ xxxx + * ....... + * ....... + * _response_ end + * + * rpcs raw + * _response_ begin mmpmon rpcs raw + * _mmpmon::rpcs_ _req_ raw _n_ 192.168.56.167 _nn_ node2 _rc_ 0 _t_ xxxx _tu_ xxxx + * _rpcstat_ _rpcstator_ xxxx _rpcstatcnt_ xxxx + * _stat_ _cw_ xxxx _st_ xxxx _rt_ xxxx _rpclt_ xxxx _ds_ xxxx _dr_ xxxx _rdmas_ xxxx _rdmar_ xxxx _ni_ xxxx + * _stat_ _cw_ xxxx _st_ xxxx _rt_ xxxx _rpclt_ xxxx _ds_ xxxx _dr_ xxxx _rdmas_ xxxx _rdmar_ xxxx _ni_ xxxx + * ..... + * _rpcexec_ _rpcexecor_ xxxx _rpcexeccnt_ xxxx + * _stat_ _rpcet_ xxxx _rpcsn_ xxxx _rpcmt_ xxxx + * _stat_ _rpcet_ xxxx _rpcsn_ xxxx _rpcmt_ xxxx + * ..... + * ..... + * _response_ end + * +/* Define a version number for RPCUtilInfo to allow + * future changes in this structure. + */ +#define GPFS_RPC_VERSION 1 + +/* class to mainatain stats for single time unit */ +class PerfSample +{ +public: + double minValue; //min over a single time unit + double maxValue; // max over a single time unit + double sumValue; // average over a single time unit + UInt64 valueCount; // count of stats over a single time unit + + inline PerfSample() + { + clearstats(); + } + inline ~PerfSample(){}; + inline void clearstats() + { + minValue = maxValue = sumValue = valueCount = 0; + } +}; + +/* class to maintain stats for all available secs/mins/hours/days + * for an object */ +class AggregatedRPCPerfStat +{ +public: + UInt32 numSecs; //num of secs maintained for an rpc object + UInt32 numMins; // num of mins maintained for an rpc object + UInt32 numHours; // num of hours maintained for an rpc object + UInt32 numDays; // num of days maintained for an rpc object + PerfSample *secondP; // array of PerfSample for nsecs + PerfSample *minuteP; // array of PerfSample for nmins + PerfSample *hourP; // array of PerfSample for nhours + PerfSample *dayP; //array of PerfSample for ndays + char objName[NAME_STRING_LEN]; //Name of rpc object + AggregatedRPCPerfStat(UInt32 nSeconds, UInt32 nMinutes, UInt32 nHours, UInt32 nDays, char *objectName); + AggregatedRPCPerfStat(); + AggregatedRPCPerfStat(const AggregatedRPCPerfStat& agPerfStat); + ~AggregatedRPCPerfStat(); + AggregatedRPCPerfStat& operator=(AggregatedRPCPerfStat &agPerfStat); + + inline UInt32 getNumSecs() { return numSecs;} + inline UInt32 getNumMins() { return numMins;} + inline UInt32 getNumHours() { return numHours;} + inline UInt32 getNumDays() { return numDays;} + /* return nth sec from secondP array */ + inline PerfSample *getSecs(int n) + { + assert(n < numSecs); + return &(secondP[n]); + } + /* return nth min from minuteP array */ + inline PerfSample *getMins(int n) + { + assert(n < numMins); + return &(minuteP[n]); + } + /* return nth hour from hourP array */ + inline PerfSample *getHours(int n) + { + assert(n < numHours); + return &(hourP[n]); + } + /* return nth day from dayP array */ + inline PerfSample *getDays(int n) + { + assert(n < numDays); + return &(dayP[n]); + } + inline char* getObjectName() + { + return objName; + } +}; + +/* class to maintain rpc stats for every remote node */ +class NodeUtilInfo +{ +public: + char nodeName[NAME_STRING_LEN]; /*Node name*/ + char nodeIpAddr[NAME_STRING_LEN]; /*Node ip address x.x.x.x */ + int numObjects; /*number of rpc objects for which stats is to be maintained */ + AggregatedRPCPerfStat *agRpcPerfStatP[RPC_OBJECTS]; /*array to maintain rpc stats for each rpc object*/ + NodeUtilInfo(MErrno *errP, char *nodeName, char *nodeIpAddr); /*contructor*/ + NodeUtilInfo(); /*constructor*/ + NodeUtilInfo(const NodeUtilInfo& nodeUtilInfo); /*copy constructor*/ + ~NodeUtilInfo(); /*destructor*/ + NodeUtilInfo& operator=(NodeUtilInfo &nodeUtilP); /* = operator overloading */ + inline int getNumObjects() /* returns number of rpc objects for which stats is maintained */ + { + return numObjects; + } + inline AggregatedRPCPerfStat getRPCPerfStatObj(int n) /*returns nth rpc object*/ + { + assert(n < numObjects); + return *(agRpcPerfStatP[n]); + } +}; + +/* class to maintain rpc stats info for all objects */ +class RPCUtilInfo +{ + friend class PollingHandler; + /* array to maintain rpc stats info per node + * node1 to node2, node1 to node3, node1 to node4 */ + NodeUtilInfo *nodeUtilInfo[MAX_NODE]; + UInt32 numNodes; /*number of nodes for which rpc stats is maintained */ +public: + RPCUtilInfo(MErrno *errP); /*constructor*/ + RPCUtilInfo(); /*constructor*/ + RPCUtilInfo(const RPCUtilInfo& rpc_u); /*copy constructor*/ + ~RPCUtilInfo(); /*destructor */ + RPCUtilInfo& operator=(RPCUtilInfo &rpc_u); /* = operator overloading */ + void clearStats(); /* clears the information holded in RPCUtilInfo object */ + + inline NodeUtilInfo getNodeUtilInfo(int n) /* returns rpc state for nth node */ + { + assert(n < numNodes); + return *(nodeUtilInfo[n]); + } + inline UInt32 getNumNodes() /*returns number of nodes */ + { + return numNodes; + } +}; + +class RawRPCStat +{ +public : + UInt64 channelWait; // time waiting to get comm channel (nanoseconds) + UInt64 sendTime; // time to send message (nanoseconds) + UInt64 receiveTime; // time to receive message (nanoseconds) + UInt64 RPCLatency; // round trip time - RPC execution time (nanoseconds) + UInt32 dataSent; // length of payload sent, if any + UInt32 dataReceived; // length of payload received, if any + Boolean_t rdmaSend; // RPC sent via RMDA + Boolean_t rdmaReceive; // RPC received via RMDA + int nodeAddr; // node address + RawRPCStat() + { + channelWait = 0; + sendTime = 0; + receiveTime = 0; + RPCLatency = 0; + dataSent = 0; + dataReceived = 0; + rdmaSend = false; + rdmaReceive = false; + nodeAddr = 0; + } + ~RawRPCStat(){} +}; + +class RawRPCExec +{ +public : + UInt64 RPCExecTime; /* time to execute RPC on target node (nanoseconds)*/ + UInt16 RPCservice_no; /* RPC service number */ + UInt32 RPCmsg_type; /* RPC message type */ + RawRPCExec() + { + RPCExecTime = 0; + RPCservice_no = 0; + RPCmsg_type = 0; + } + ~RawRPCExec(){} +}; + +/* class to maintain network performance stats for raw type */ +class RPCRawUtilInfo +{ + friend class PollingHandler; + RawRPCExec *rpcExecP; /* array to maintain info for rpc exec objects*/ + RawRPCStat *rpcStatP; /*array to maintain info for rpc stat objects*/ + int rpcStatOverRunCount; /*count of buffer overruns for rpc stat*/ + int rpcExecOverRunCount; /*count of buffer overruns for rpc exec*/ + int rpcStatCount; /* rpc stat count*/ + int rpcExecCount; /* rpc exec count*/ +public: + RPCRawUtilInfo(MErrno *errP); + RPCRawUtilInfo(); + ~RPCRawUtilInfo(); + RPCRawUtilInfo& operator=(RPCRawUtilInfo &rpcRaw_u); + void clearStats(); + /* return nth rpc stat object */ + inline RawRPCStat *getRPCStatObj(int n) + { + assert(n < rpcStatCount); + return &rpcStatP[n]; + } + /* return nth rpc exec object */ + inline RawRPCExec *getRPCExecObj(int n) + { + assert(n < rpcExecCount); + return &rpcExecP[n]; + } + inline int getRpcStatOverRunCount() { return rpcStatOverRunCount; } + inline int getRpcExecOverRunCount() { return rpcExecOverRunCount; } + inline int getRpcStatCount() { return rpcStatCount; } + inline int getRpcExecCount() { return rpcExecCount; } +}; + +/* class to maintain network performance stats as per message sizes */ +class RPCSizeUtilInfo +{ + friend class PollingHandler; + /* array to maintain aggregated stat */ + AggregatedRPCPerfStat *agRpcPerfStatP[MAX_NUMBER_BUCKETS]; + int sizePerBucket[MAX_NUMBER_BUCKETS]; /* bucket sizes */ + int numBucketOutput; /* output available for num of buckets */ + + /* Set aggregated rpc performance stat for nth bucket*/ + inline void setRPCPerfStatObj(AggregatedRPCPerfStat *agPerfStat, int n) + { + assert(n < MAX_NUMBER_BUCKETS); + agRpcPerfStatP[n] = agPerfStat; + } +public: + RPCSizeUtilInfo(MErrno *errP); + RPCSizeUtilInfo(); + ~RPCSizeUtilInfo(); + RPCSizeUtilInfo& operator=(RPCSizeUtilInfo &rpc_u); + void clearStats(); + /* get aggregated performance stat for nth bucket */ + inline AggregatedRPCPerfStat getRPCPerfStatObj(int n) + { + assert(n < MAX_NUMBER_BUCKETS && n < numBucketOutput); + return *(agRpcPerfStatP[n]); + } + /* get bucket size for nth bucket */ + inline int getSizePerBucket(int n) + { + assert(n < MAX_NUMBER_BUCKETS && n < numBucketOutput); + return sizePerBucket[n]; + } + /* get total num of buckets available */ + inline int getNumBuckets() + { + return numBucketOutput; + } +}; + +/* class to maintain network performance stats as per message types */ +class RPCMsgUtilInfo +{ + friend class PollingHandler; + /*Aggregated performance stat per message type */ + AggregatedRPCPerfStat *agRpcPerfStatP[MAX_MSG_RPC]; + int numMsgOutput; /*num of message types available */ + + /* set aggaregated stats for nth agRpcPerfStatP */ + inline void setRPCPerfStatObj(AggregatedRPCPerfStat *agPerfStat, int n) + { + assert(n < MAX_MSG_RPC); + agRpcPerfStatP[n] = agPerfStat; + } +public: + RPCMsgUtilInfo(MErrno *errP); + RPCMsgUtilInfo(); + ~RPCMsgUtilInfo(); + RPCMsgUtilInfo& operator=(RPCMsgUtilInfo &rpc_u); + void clearStats(); + + /* get aggaregated stats for nth agRpcPerfStatP */ + inline AggregatedRPCPerfStat *getRPCMsgStatObj(int n) + { + assert(n < MAX_MSG_RPC && n < numMsgOutput); + return agRpcPerfStatP[n]; + } + inline int getNumMsg() + { + return numMsgOutput; + } +}; + +/* class to maintain stats for one secs for an object */ +class AggregatedRPCPerfStatPerSec +{ +public: + PerfSample secondP; /* array of PerfSample for nsecs */ + char objName[NAME_STRING_LEN]; /* Name of rpc object */ + AggregatedRPCPerfStatPerSec(); + ~AggregatedRPCPerfStatPerSec(); + AggregatedRPCPerfStatPerSec(const AggregatedRPCPerfStatPerSec& agPerfStat); /* copy constructor */ +}; + +/* class to maintain aggregated rpc stats info for one sec for all objects */ +class AggregatedRPCUtilInfoPerSec +{ + friend class PollingHandler; + AggregatedRPCPerfStatPerSec * agRpcPerfStatP[RPC_OBJECTS]; + UInt32 numObjects; + /* set the value of AggregatedRPCPerfStat for nth object */ + inline void setRPCPerfStatObj(AggregatedRPCPerfStatPerSec *agPerfStat, int n) + { + assert(n < RPC_OBJECTS); + agRpcPerfStatP[n] = agPerfStat; + } +public: + AggregatedRPCUtilInfoPerSec(); + ~AggregatedRPCUtilInfoPerSec(); + AggregatedRPCUtilInfoPerSec& operator=(AggregatedRPCUtilInfoPerSec &rpc_u); + void clearStats(); + /* return AggregatedRPCPerfStat for nth object */ + inline AggregatedRPCPerfStatPerSec getRPCPerfStatObj(int n) + { + assert(n < numObjects); + return *(agRpcPerfStatP[n]); + } + inline UInt32 getNumObjects() + { + return numObjects; + } +}; + +/* Cache hit miss statistics + + _response_ begin mmpmon chms + _mmpmon::chms_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1263846820 + _tu_ 373341 _dch_ 0 _dcm_ 0 _sch_ 43027 _scm_ 34 + _response_ end + +*/ + +/* Define a version number for CacheStatsInfo to allow + future changes in this structure. + */ +#define GPFS_CHMS_VERSION 1 + +class CacheStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + char ipAddr[NAME_STRING_LEN]; + + UInt32 dataCacheHit; /* _dch_ */ + UInt32 dataCacheMiss; /* _dcm_ */ + UInt32 statCacheHit; /* _sch_ */ + UInt32 statCacheMiss; /* _scm_ */ + +public: + CacheStatsInfo(MErrno *errP); + CacheStatsInfo(); + ~CacheStatsInfo(); + + CacheStatsInfo& operator=(CacheStatsInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getIpAddr() { return ipAddr; } + inline UInt32 getDataCacheHit() { return dataCacheHit; } + inline UInt32 getDataCacheMiss() { return dataCacheMiss; } + inline UInt32 getStatCacheHit() { return statCacheHit; } + inline UInt32 getStatCacheMiss() { return statCacheMiss; } +}; + +/* + * PANACHE statistics + _response_ begin mmpmon pncs + _mmpmon::pncs_ _n_ 192.168.115.156 _nn_ hs21n20 _rc_ 0 _t_ 1263954355 + _tu_ 209718 _fs_ fs1 _fset_ ro + _br_ 0 _bw_ 0 _ws_ 0 _wl_ 0 _wa_ 0 _ne_ 0 _nf_ 0 _ns_ 0 _nr_ 0 + _ncmd_ 20 _q_ 0 _i_ 0 _c_ 0 _e_ 0 _f_ 0 _n_ 0 + _q_ 0 _i_ 0 _c_ 0 _e_ 0 _f_ 0 _n_ 0 + _q_ 0 _i_ 0 _c_ 0 _e_ 0 _f_ 0 _n_ 0 + ... + _q_ 0 _i_ 0 _c_ 0 _e_ 0 _f_ 0 _n_ 0 + _q_ 0 _i_ 0 _c_ 0 _e_ 0 _f_ 0 _n_ 0 + _response_ end + * + */ +/********************************/ +/* Define a version number for verbsServerStatsInfo to allow + future changes in this structure. + */ +#define GPFS_VERBSSERVERSTATS_VERSION 1 + +class VerbsServerStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + + char destination[NAME_STRING_LEN]; + char state[NAME_STRING_LEN]; + UInt64 curRdma; + UInt64 waitRdma; + UInt64 rdmaRead; + UInt64 rdmaWrite; + UInt64 rdmaReadKb; + UInt64 rdmaWriteKb; + UInt32 device; + UInt32 port; + +public: + VerbsServerStatsInfo(MErrno *errP); + ~VerbsServerStatsInfo(); + + VerbsServerStatsInfo& operator=(VerbsServerStatsInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + + inline char *getDestination() { return destination; } + inline char *getState() { return state; } + + inline UInt64 getCurRdma() { return curRdma; } + inline UInt64 getWaitRdma() { return waitRdma; } + inline UInt64 getRdmaRead() { return rdmaRead; } + inline UInt64 getRdmaWrite() { return rdmaWrite; } + inline UInt64 getRdmaReadKb() { return rdmaReadKb; } + inline UInt64 getRdmaWriteKb() { return rdmaWriteKb; } + inline UInt32 getDevice() { return device; } + inline UInt32 getportNum() { return port; } + +}; +/******************************/ + +/******************************/ + +/* Define a version number for verbsClientStatsInfo to allow + future changes in this structure. + */ +#define GPFS_VERBSCLIENTSTATS_VERSION 1 + +class VerbsClientStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + + char destination[NAME_STRING_LEN]; + char state[NAME_STRING_LEN]; + UInt64 curReadWrite; + UInt64 peakReadWrite; + UInt64 fileRead; + UInt64 fileWrite; + UInt64 fileReadKb; + UInt64 fileWriteKb; + UInt32 device; + UInt32 port; + +public: + VerbsClientStatsInfo(MErrno *errP); + ~VerbsClientStatsInfo(); + + VerbsClientStatsInfo& operator=(VerbsClientStatsInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + + inline char *getDestination() { return destination; } + inline char *getState() { return state; } + + inline UInt64 getCurReadWrite() { return curReadWrite; } + inline UInt64 getPeakReadWrite() { return peakReadWrite; } + inline UInt64 getFileRead() { return fileRead; } + inline UInt64 getFileWrite() { return fileWrite; } + inline UInt64 getFileReadKb() { return fileReadKb; } + inline UInt64 getFileWriteKb() { return fileWriteKb; } + inline UInt32 getDevice() { return device; } + inline UInt32 getportNum() { return port; } + +}; + +/****************************/ + +/* Define a version number for tscommCfgInfo to allow + future changes in this structure. + */ +#define GPFS_TSCOMMCFG_VERSION 1 + +class TscommCfgInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + + UInt32 portNum; + UInt32 nodeNum; + char nodeAddr[NAME_STRING_LEN]; + char addrList[ADDRLIST_NODES * NAME_STRING_LEN]; + UInt32 curDaemonVer; + UInt32 comptDmnVer; + UInt32 maxComptVer; + UInt32 maxFeatureLevel; + +public: + TscommCfgInfo(MErrno *errP); + ~TscommCfgInfo(); + + TscommCfgInfo& operator=(TscommCfgInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + + inline char *getNodeAddr() { return nodeAddr; } + inline char *getAddrList() { return addrList; } + + inline UInt32 getportNum() { return portNum; } + inline UInt32 getnodeNum() { return nodeNum; } + inline UInt32 getcurDaemonVer() { return curDaemonVer; } + inline UInt32 getcomptDmnVer() { return comptDmnVer; } + inline UInt32 getmaxComptVer() { return maxComptVer; } + inline UInt32 getmaxFeatureLevel() { return maxFeatureLevel; } + +}; + +/* Define a version number for ClusterCfgInfo to allow + future changes in this structure. + */ +#define GPFS_CLUSTERCFG_VERSION 1 + +class ClusterCfgInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + + char clusterId[NAME_STRING_LEN]; + UInt32 nodeNumber; + char nodeAddr[NAME_STRING_LEN]; + char hostName[NAME_STRING_LEN]; + char ipAddr[NAME_STRING_LEN]; + char admin[NAME_STRING_LEN]; + char gpnTrans[NAME_STRING_LEN]; + char gpnStatus[NAME_STRING_LEN]; + char nodeStatus[NAME_STRING_LEN]; + UInt32 joinSeq; + UInt32 failCnt; + UInt32 fsManaged; + UInt32 cnfsGrp; + UInt32 readChkSum; + UInt32 writeChkSum; + char lastFail[NAME_STRING_LEN]; + +public: + ClusterCfgInfo(MErrno *errP); + ~ClusterCfgInfo(); + + ClusterCfgInfo& operator=(ClusterCfgInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + + inline char *getclusterId() { return clusterId; } + inline UInt32 getnodeNumber() { return nodeNumber; } + inline char *getNodeAddr() { return nodeAddr; } + inline char *getHostName() { return hostName; } + inline char *getIpAddr() { return ipAddr; } + inline char *getAdmin() { return admin; } + inline char *getGpnTrans() { return gpnTrans; } + inline char *getGpnStatus() { return gpnStatus; } + inline char *getNodeStatus() { return nodeStatus; } + + inline UInt32 getjoinSeq() { return joinSeq; } + inline UInt32 getfailCnt() { return failCnt; } + inline UInt32 getfsManaged() { return fsManaged; } + inline UInt32 getcnfsGrp() { return cnfsGrp; } + inline UInt32 getreadChkSum() { return readChkSum; } + inline UInt32 getwriteChkSum() { return writeChkSum; } + inline char *getLastFail() { return lastFail; } + +}; + +/* Define a version number for PCacheStatsInfo to allow + future changes in this structure. + */ +#define GPFS_PNCS_VERSION 1 + +class PCacheStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + char ipAddr[NAME_STRING_LEN]; + + char fsName[NAME_STRING_LEN]; + char fsetName[NAME_STRING_LEN]; + + UInt64 bytesRead; + UInt64 bytesWritten; + UInt32 numExpire; /* msgs exec due to timer */ + UInt32 numForce; /* msgs exec due to Q limit, etc */ + UInt32 numSync; /* msgs exec due to sync cmd */ + UInt32 numRevoke; /* msgs exec due to revoke */ + UInt32 shortest_waitTime; /* in seconds */ + UInt32 longest_waitTime; /* in seconds */ + UInt32 average_waitTime; /* in seconds */ + UInt32 numPcacheCmds; + pCacheCmdInfo_t pCacheCmds[MAX_PCACHE_CMD_INFO]; + UInt64 numMsgExecuted; + UInt32 numHomeConn; + UInt32 numHomeDisc; + UInt32 numFsetExp; + +public: + PCacheStatsInfo(MErrno *errP); + ~PCacheStatsInfo(); + + PCacheStatsInfo& operator=(PCacheStatsInfo &c); + + void clearStats(); + + pCacheCmdInfo_t *getPCacheCmdInfoP(int cmd); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getIpAddr() { return ipAddr; } + inline char *getFsName() { return fsName; } + inline char *getFsetName() { return fsetName; } + + inline UInt64 getBytesRead() { return bytesRead; } + inline UInt64 getBytesWritten() { return bytesWritten; } + inline UInt32 getNumExpire() { return numExpire; } + inline UInt32 getNumForce() { return numForce; } + inline UInt32 getNumSync() { return numSync; } + inline UInt32 getNumRevoke() { return numRevoke; } + inline UInt32 getShortest_waitTime() { return shortest_waitTime; } + inline UInt32 getLongest_waitTime() { return longest_waitTime; } + inline UInt32 getAverage_waitTime() { return average_waitTime; } + inline UInt32 getNumPacheCmds() { return numPcacheCmds; } + inline UInt64 getNumMsgExecuted() { return numMsgExecuted; } + inline UInt32 getNumHomeConn() { return numHomeConn; } + inline UInt32 getNumHomeDisc() { return numHomeDisc; } + inline UInt32 getNumFsetExp() { return numFsetExp; } + +}; + +/* + NSD server statistics + + mmpmon nsd_dst + _response_ begin mmpmon nsd_dst + _mmpmon::nsd_dst_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1336694189 _tu_ 901270 _dev_ /dev/rhdisk6 _d_ gpfs6nsd + _r_ _ops_ 127 _b_ 6645760 _tw_ 0.091637 + _w_ _ops_ 29 _b_ 98304 _tw_ 0.170669 + _mmpmon::nsd_dst_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1336694189 _tu_ 901291 _dev_ /dev/rhdisk7 _d_ gpfs7nsd + _r_ _ops_ 51 _b_ 116224 _tw_ 0.014138 + _w_ _ops_ 22 _b_ 33792 _tw_ 0.008239 + _response_ end + + non-server: + + _response_ begin mmpmon nsd_dst + _mmpmon::nsd_dst_ _n_ 192.168.1.10 _nn_ enterprise _rc_ 1 _t_ 1336693954 _tu_ 173891 _dev_ - + _response_ end + + */ +#define GPFS_NSD_DST_VERSION 1 + +class NsdServerStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + char ipAddr[NAME_STRING_LEN]; + + char devName[NAME_STRING_LEN]; /* device name of the disk */ + char nsdName[NAME_STRING_LEN]; /* NSD name */ + + UInt32 readOps; /* number of disk read operations */ + UInt32 writeOps; /* number of disk write operations */ + + UInt64 bytesRead; /* number of bytes read from disk */ + UInt64 bytesWritten; /* number of bytes written to disk */ + + double readTime; /* total time waiting for disk operations, in seconds */ + double writeTime; /* total time waiting for disk operations, in seconds */ + +public: + NsdServerStatsInfo(MErrno *errP); + ~NsdServerStatsInfo(); + + NsdServerStatsInfo& operator=(NsdServerStatsInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getIpAddr() { return ipAddr; } + inline char *getDevName() { return devName; } + inline char *getNsdName() { return nsdName; } + + inline double getReadTime() { return readTime; } + inline double getWriteTime() { return writeTime; } + inline UInt64 getBytesRead() { return bytesRead; } + inline UInt64 getBytesWritten() { return bytesWritten; } + inline UInt32 getReadOps() { return readOps; } + inline UInt32 getWriteOps() { return writeOps; } +}; + +/* + File system IO stats: list one set of application view stats + for each file system on the node. + + mmpmon fis + _response_ begin mmpmon fis + _mmpmon::fis_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1337051301 _tu_ 718946 _cl_ voyager.gpfs.net _fs_ fs1 _d_ 6 _br_ 33622 _bw_ 0 _oc_ 6 _cc_ 6 _rdc_ 17 _wc_ 0 _dir_ 2 _iu_ 17 + _mmpmon::fis_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1337051301 _tu_ 718946 _cl_ voyager.gpfs.net _fs_ fs3 _d_ 2 _br_ 130881 _bw_ 0 _oc_ 11 _cc_ 11 _rdc_ 47 _wc_ 0 _dir_ 2 _iu_ 7 + _response_ end + + When no file systems are mounted: + + mmpmon fis + _response_ begin mmpmon fis + _mmpmon::fis_ _n_ 192.168.1.8 _nn_ voyager _rc_ 1 _t_ 1337052131 _tu_ 269656 _cl_ - _fs_ - + _response_ end + + */ +#define GPFS_FIOS_VERSION 1 + +class FsIoStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + UInt32 diskCount; /* number of disks in the file system */ + char ipAddr[NAME_STRING_LEN]; + + char fsName[NAME_STRING_LEN]; /* file system */ + + UInt64 bytesRead; /* number of bytes read from disk (disk and cache) */ + UInt64 bytesWritten;/* number of bytes written, to both disk and cache */ + + UInt32 openCalls; /* number of open() call requests serviced by GPFS */ + UInt32 closeCalls; /* number of close() call requests serviced by GPFS */ + UInt32 readCalls; /* number of application read requests serviced by GPFS */ + UInt32 writeCalls; /* number of write requests serviced by GPFS */ + UInt32 readdirCalls;/* number of readdir() call requests serviced by GPFS */ + + UInt64 inodeUpdateCalls; /* number of inode updates to disk */ + +public: + FsIoStatsInfo(MErrno *errP); + ~FsIoStatsInfo(); + + FsIoStatsInfo& operator=(FsIoStatsInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getIpAddr() { return ipAddr; } + inline char *getFsName() { return fsName; } + + inline UInt32 getDiskCount() { return diskCount; } + inline UInt64 getBytesRead() { return bytesRead; } + inline UInt64 getBytesWritten() { return bytesWritten; } + + inline UInt32 getOpenCalls() { return openCalls; } + inline UInt32 getCloseCalls() { return closeCalls; } + inline UInt32 getReadCalls() { return readCalls; } + inline UInt32 getWriteCalls() { return writeCalls; } + inline UInt32 getReaddirCalls() { return readdirCalls; } + inline UInt64 getInodeUpdateCalls() { return inodeUpdateCalls; } +}; + +/* + Storage pool IO stats: lists one set of application-view stats for + each storage pool on the node. + + mmpmon plios + _response_ begin mmpmon plios + _mmpmon::plios_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1337053867 _tu_ 242440 _cl_ voyager.gpfs.net _fs_ fs1 _pl_ system _d_ 2 _br_ 595314176 _bw_ 1624064 + _mmpmon::plios_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1337053867 _tu_ 242440 _cl_ voyager.gpfs.net _fs_ fs1 _pl_ poolA _d_ 3 _br_ 35840 _bw_ 0 + _mmpmon::plios_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1337053867 _tu_ 242440 _cl_ voyager.gpfs.net _fs_ fs3 _pl_ system _d_ 2 _br_ 56961024 _bw_ 18432 + _response_ end + + + When no file systems are mounted: + + mmpmon plios + _response_ begin mmpmon plios + _mmpmon::plios_ _n_ 192.168.1.8 _nn_ voyager _rc_ 1 _t_ 1337053946 _tu_ 596610 _cl_ - _fs_ - + _response_ end + + */ +#define GPFS_PLIOS_VERSION 1 + +class PoolIoStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + char ipAddr[NAME_STRING_LEN]; + + char fsName[NAME_STRING_LEN]; /* file system */ + char poolName[NAME_STRING_LEN]; /* pool name */ + + UInt32 diskCount; /* number of disks in the file system */ + + UInt64 bytesRead; /* number of bytes read */ + UInt64 bytesWritten; /* number of bytes written */ + +public: + PoolIoStatsInfo(MErrno *errP); + ~PoolIoStatsInfo(); + + PoolIoStatsInfo& operator=(PoolIoStatsInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getIpAddr() { return ipAddr; } + inline char *getFsName() { return fsName; } + inline char *getPoolName() { return poolName; } + + inline UInt32 getDiskCount() { return diskCount; } + + inline UInt64 getBytesRead() { return bytesRead; } + inline UInt64 getBytesWritten() { return bytesWritten; } +}; + + +/* + Disk Stats + I/O statistics taken over all mounted file systems as seen by the + node and presented as total values for ecah disk in each file system. + + mmpmon ds + _response_ begin mmpmon ds + _mmpmon::ds_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1339704723 _tu_ 718796 _cl_ voyager.gpfs.net _fs_ fs3 _d_ gpfs8nsd + _r_ _ops_ 13 _b_ 46080 _tw_ 0.002274 _qt_ 0.002274 _stw_ 0.000133 _sqt_ 0.000133 _ltw_ 0.000279 _lqt_ 0.000279 + _w_ _ops_ 2 _b_ 1024 _tw_ 0.000715 _qt_ 0.000715 _stw_ 0.000349 _sqt_ 0.000349 _ltw_ 0.000366 _lqt_ 0.000366 + _mmpmon::ds_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1339704723 _tu_ 718824 _cl_ voyager.gpfs.net _fs_ fs3 _d_ gpfs10nsd + _r_ _ops_ 5 _b_ 2560 _tw_ 0.000809 _qt_ 0.000809 _stw_ 0.000151 _sqt_ 0.000151 _ltw_ 0.000174 _lqt_ 0.000174 + _w_ _ops_ 2 _b_ 1024 _tw_ 0.000736 _qt_ 0.000736 _stw_ 0.000361 _sqt_ 0.000361 _ltw_ 0.000375 _lqt_ 0.000375 + _mmpmon::ds_ _n_ 192.168.1.8 _nn_ voyager _rc_ 0 _t_ 1339704723 _tu_ 718855 _cl_ voyager.gpfs.net _fs_ fs6 _d_ gpfs18nsd + _r_ _ops_ 3 _b_ 17408 _tw_ 0.000645 _qt_ 0.000645 _stw_ 0.000145 _sqt_ 0.000145 _ltw_ 0.000260 _lqt_ 0.000260 + _w_ _ops_ 0 _b_ 0 _tw_ 0.000000 _qt_ 0.000000 _stw_ 0.000000 _sqt_ 0.000000 _ltw_ 0.000000 _lqt_ 0.000000 + _response_ end + + When no file systems are mounted: + + mmpmon ds + _response_ begin mmpmon ds + _mmpmon::ds_ _n_ 192.168.1.8 _nn_ voyager _rc_ 1 _t_ 1339704802 _tu_ 927135 _cl_ - _fs_ - + _response_ end + + */ +#define GPFS_DS_VERSION 1 + +class DiskStatsInfo +{ + friend class PollingHandler; + + Int32 version; /* version of this stat structure */ + Int32 length; /* size of this structure */ + Int32 rc; /* return code from mmpmon */ + char ipAddr[NAME_STRING_LEN]; + + char fsName[NAME_STRING_LEN]; /* file system */ + char diskName[NAME_STRING_LEN]; /* disk name */ + char clusterName[NAME_STRING_LEN]; /* clusterName */ + + UInt32 readOps; /* number of disk read operations */ + UInt32 writeOps; /* number of disk write operations */ + + UInt64 bytesRead; /* number of bytes read from disk */ + UInt64 bytesWritten; /* number of bytes written to disk */ + + /* Times are in seconds. */ + double readTime; /* total time waiting for disk operations, in seconds */ + double writeTime; /* total time waiting for disk operations, in seconds */ + + double queueReadTime; /* total time spent between being queued for a disk + operation and the completion of that operation */ + double queueWriteTime; /* total time spent between being queued for a disk + operation and the completion of that operation */ + + double shortestReadTime; /* shortest time spent waiting for a disk oper */ + double shortestWriteTime; + + double shortestQueueReadTime; /* shortest time between being queued for a disk + operation and the completion of that oper. */ + double shortestQueueWriteTime; + + double longestReadTime; /* longest spent waiting for a disk oper */ + double longestWriteTime; + + double longestQueueReadTime; /* longest time between being queued for a disk + operation and the completion of that oper. */ + double longestQueueWriteTime; + +public: + DiskStatsInfo(MErrno *errP); + ~DiskStatsInfo(); + + DiskStatsInfo& operator=(DiskStatsInfo &c); + + void clearStats(); + + inline Int32 getVersion() { return version; } + inline Int32 getLength() { return length; } + inline Int32 getRc() { return rc; } + inline char *getFsName() { return fsName; } + inline char *getDiskName() { return diskName; } + inline char *getIpAddr() { return ipAddr; } + inline char *getClusterName() { return clusterName; } + + inline UInt32 getReadOps() { return readOps; } + inline UInt32 getWriteOps() { return writeOps; } + inline UInt64 getBytesRead() { return bytesRead; } + inline UInt64 getBytesWritten() { return bytesWritten; } + + inline double getReadTime() { return readTime; } + inline double getWriteTime() { return writeTime; } + inline double getQueueReadTime() { return queueReadTime; } + inline double getQueueWriteTime() { return queueWriteTime; } + inline double getShortestReadTime() { return shortestReadTime; } + inline double getShortestWriteTime() { return shortestWriteTime; } + inline double getShortestQueueReadTime() { return shortestQueueReadTime; } + inline double getShortestQueueWriteTime() { return shortestQueueWriteTime; } + inline double getLongestReadTime() { return longestReadTime; } + inline double getLongestWriteTime() { return longestWriteTime; } + inline double getLongestQueueReadTime() { return longestQueueReadTime; } + inline double getLongestQueueWriteTime() { return longestQueueWriteTime; } +}; + + +/* Node information */ +class NodeInfo +{ + friend class PollingHandler; + + char name[NAME_STRING_LEN]; + char ipAddr[NAME_STRING_LEN]; + char platform[NAME_STRING_LEN]; + char endian[NAME_STRING_LEN]; + char type[NAME_STRING_LEN]; + char osname[NAME_STRING_LEN]; + char admin[NAME_STRING_LEN]; + char status[NAME_STRING_LEN]; + char version[NAME_STRING_LEN]; + UInt32 failureCount; + UInt32 threadWait; + char healthy[NAME_STRING_LEN]; + char diagnosis[NAME_STRING_LEN]; + UInt64 pagePoolSize; + UInt32 prefetchThreads; + UInt32 maxMBPS; + UInt32 maxFilesToCache; + UInt32 maxStatCache; + UInt32 worker1Threads; + UInt32 dmapiEventTimeout; + UInt32 dmapiMountTimeout; + UInt32 dmapiSessFailureTimeout; + UInt32 nsdServerWaitTimeWindowOnMount; + UInt32 nsdServerWaitTimeForMount; + char unmountOnDiskFail[32]; + + double readTime; + double writeTime; + + Boolean_t found; + + std::vectordiskAccessItems; + + void copyDiskAccesses(NodeInfo *nodeP); + int getDiskAccessIndex(char *nameP); + + /* I/O statistics counted by context */ + IocStatsInfo *iocStatsP; + + /* vfs statistics */ + VfsStatsInfo *vfsStatsP; + + /* thread pool utilization */ + ThreadUtilInfo *threadUtilP; + + /* rpc performance stat */ + RPCUtilInfo *rpcUtilP; + + /* rpc raw stats */ + RPCRawUtilInfo *rpcRawUtilP; + + /* rpc performance stats according to size */ + RPCSizeUtilInfo *rpcSizeUtilP; + + /* rpc performance stats according to size */ + RPCMsgUtilInfo *rpcMsgUtilP; + + /* aggregation of rpc performance stats per sec on local node */ + AggregatedRPCUtilInfoPerSec *rpcUtilPerSecP; + + /* cache hit/miss stats */ + CacheStatsInfo *cacheStatsP; + + std::vectorPCacheStatsItems; + + TscommCfgInfo *tscommCfgP; + + VerbsClientStatsInfo *verbsClientP; + VerbsServerStatsInfo *verbsServerP; + +public: + NodeInfo(MErrno *errP); + + ~NodeInfo(); + + NodeInfo& operator=(NodeInfo &n); + void clearStats(); + + /* Node info from SDR */ + inline char *getName() { return name; } + inline char *getIpAddr() { return ipAddr; } + inline char *getType() { return type; } + inline char *getEndian() { return endian; } + inline char *getOsName() { return osname; }; + inline char *getVersion() { return version; } + inline char *getPlatform() { return platform; } + + /* Node info from EE get nodes */ + inline char *getAdmin() { return admin; } + inline char *getStatus() { return status; } + inline UInt32 getFailureCount() { return failureCount; } + inline UInt32 getThreadWait() { return threadWait; } + inline char *getHealthy() { return healthy; } + inline char *getDiagnosis() { return diagnosis; } + + inline UInt64 getPagePoolSize() { return pagePoolSize; } + inline UInt32 getPrefetchThreads() { return prefetchThreads; } + inline UInt32 getMaxMBPS() { return maxMBPS; } + inline UInt32 getMaxFilesToCache() { return maxFilesToCache; } + inline UInt32 getMaxStatCache() { return maxStatCache; } + inline UInt32 getWorker1Threads() { return worker1Threads; } + inline UInt32 getDmapiEventTimeout() { return dmapiEventTimeout; } + inline UInt32 getDmapiMountTimeout() { return dmapiMountTimeout; } + inline UInt32 getDmapiSessFailureTimeout() { return dmapiSessFailureTimeout; } + inline UInt32 getNsdServerWaitTimeWindowOnMount() { return nsdServerWaitTimeWindowOnMount; } + inline UInt32 getNsdServerWaitTimeForMount() { return nsdServerWaitTimeForMount; } + inline char *getUnmountOnDiskFail() { return unmountOnDiskFail; } + + inline UInt32 getNumDiskAccesses() { return diskAccessItems.size(); } + inline DiskAccessInfo *getDiskAccess(int d) { return diskAccessItems.at(d); } + + inline VfsStatsInfo *getVfsStatsInfo() { return vfsStatsP; } + inline IocStatsInfo *getIocStatsInfo() { return iocStatsP; } + inline ThreadUtilInfo *getThreadUtilInfo() { return threadUtilP; } + inline RPCUtilInfo *getRPCUtilInfo() { return rpcUtilP; } + inline RPCRawUtilInfo *getRPCRawUtilInfo() { return rpcRawUtilP; } + inline RPCSizeUtilInfo *getRPCSizeUtilInfo() { return rpcSizeUtilP; } + inline RPCMsgUtilInfo *getRPCMsgUtilInfo() { return rpcMsgUtilP; } + inline AggregatedRPCUtilInfoPerSec *getAggregatedRPCUtilInfoPerSec() { return rpcUtilPerSecP; } + inline CacheStatsInfo *getCacheStatsInfo() { return cacheStatsP; } + + inline UInt32 getNumPcacheFsets() { return PCacheStatsItems.size(); } + inline PCacheStatsInfo *getPcacheFset(int d) { return PCacheStatsItems.at(d); } + + inline TscommCfgInfo *getTscommCfgInfoP() { return tscommCfgP;} + inline VerbsClientStatsInfo *getVerbsClientStatsInfoP() { return verbsClientP;} + inline VerbsServerStatsInfo *getVerbsServerStatsInfoP() { return verbsServerP;} + + /* Currently unused */ + inline double getReadTime() { return readTime; } + inline double getWriteTime() { return writeTime; } +}; + +/* Cluster information */ +class ClusterInfo +{ + friend class PollingHandler; + + /* parsable from mmsdrfs */ + char name[NAME_STRING_LEN]; + char id[NAME_STRING_LEN]; + char type[NAME_STRING_LEN]; + char minReleaseLevel[NAME_STRING_LEN]; + char uidDomain[NAME_STRING_LEN]; + char remoteShellCommand[NAME_STRING_LEN]; + char remoteFileCopyCommand[NAME_STRING_LEN]; + char primaryServer[NAME_STRING_LEN]; + char secondaryServer[NAME_STRING_LEN]; + + UInt32 maxBlockSize; + UInt32 distributedTokenServer; + /*UInt32 useDiskLease;*/ + UInt32 failureDetectionTime; + UInt32 tcpPort; + UInt32 minMissedPingTimeout; + UInt32 maxMissedPingTimeout; + + UInt32 sdrfsGenNumber; + + struct timeval clusterRefreshTime; + + /* Store the list of node name - primary key */ + std::vectornodeItems; + struct timeval nodeRefreshTime; + + /* Store the list of file system name - primary key */ + std::vectorfsItems; + struct timeval FSRefreshTime; + struct timeval FSPerfRefreshTime; + + std::vectorfreeDiskItems; + + /* Store the list of ClusterCfgItems */ + std::listClusterCfgItems; + + void copyNodes(ClusterInfo *clP); + void copyFS(ClusterInfo *clP); + void copyFreeDisks(ClusterInfo *clP); + int getNodeInfoIndex(char *ipAddrP); + int getNodeInfoIndexByName(char *nameP); + int getFilesystemInfoIndex(char *nameP); + int getFreeDiskInfoIndex(char *nameP); + + struct timeval diskSDRRefreshTime; + +public: + ClusterInfo(MErrno *errP); + + ~ClusterInfo(); + + ClusterInfo& operator=(ClusterInfo &cl); + + /* member accessors */ + inline char *getName() { return name; } + inline char *getId() { return id; } + inline char *getType() { return type; } + inline char *getMinReleaseLevel() { return minReleaseLevel; } + inline char *getUidDomain() { return uidDomain; } + inline char *getRemoteShellCommand() { return remoteShellCommand; } + inline char *getRemoteFileCopyCommand() { return remoteFileCopyCommand; } + inline char *getPrimaryServer() { return primaryServer; } + inline char *getSecondaryServer() { return secondaryServer; } + inline UInt32 getMaxBlockSize() { return maxBlockSize; } + inline struct timeval getClusterRefreshTime() { return clusterRefreshTime; } + inline UInt32 getSdrfsGenNumber() { return sdrfsGenNumber; } + + inline UInt32 getNumNodes() { return nodeItems.size(); } + inline NodeInfo *getNode(int n) { return nodeItems.at(n); } + inline struct timeval getNodeRefreshTime() { return nodeRefreshTime; } + inline UInt32 getNumFilesystems() { return fsItems.size(); } + inline FilesystemInfo *getFilesystem(int f) { return fsItems.at(f); } + inline struct timeval getFSRefreshTime() { return FSRefreshTime; } + inline struct timeval getFSPerfRefreshTime() { return FSPerfRefreshTime; } + inline UInt32 getDistributedTokenServer() { return distributedTokenServer; } + inline UInt32 getFailureDetectionTime() { return failureDetectionTime; } + inline UInt32 getTCPPort() { return tcpPort; } + inline UInt32 getMinMissedPingTimeout() { return minMissedPingTimeout; } + inline UInt32 getMaxMissedPingTimeout() { return maxMissedPingTimeout; } + inline UInt32 getNumFreeDisks() { return freeDiskItems.size(); } + inline DiskInfo *getFreeDisk(int d) { return freeDiskItems.at(d); } + + inline UInt32 getNumClusterCfgNodes() { return ClusterCfgItems.size(); } + inline ClusterCfgInfo *getClusterCfgInfoP(int d) + { + int cnt = 0; + std::list::const_iterator iterator; + for (iterator = ClusterCfgItems.begin(); iterator != ClusterCfgItems.end(); + ++iterator, cnt++) { + if (cnt == d) + return *iterator; + } + return (ClusterCfgInfo *) NULL; + } +}; + +/* Cluster status information */ +class ClusterStatus +{ + friend class PollingHandler; + +public: + char managerNode[NAME_STRING_LEN]; + char managerIpAddr[NAME_STRING_LEN]; + UInt32 nLocalNodes; /* number of nodes defined in the cluster */ + UInt32 nLocalJoined; /* number of local nodes active in the cluster */ + UInt32 nRmtJoined; /* number of remote nodes joined in this cluster */ + UInt32 nQNodesInCluster; /* number of quorum nodes defined in the cluster */ + UInt32 nQNodesJoined; /* number of quorum nodes active in the cluster */ + UInt32 cfgMinQuorumNodes;/* minimum no of nodes to reach quorum */ + UInt32 quorumAchieved ; /* Quorum achieved (=1), not achieved (=0)*/ + +public: + ClusterStatus(); + ~ClusterStatus(); + + void init(); + + /* member accessors */ + inline char *getManagerNode() { return managerNode; } + inline char *getManagerIpAddr() { return managerIpAddr; } + inline UInt32 getNLocalNodes() { return nLocalNodes; } + inline UInt32 getNLocalJoined() { return nLocalJoined; } + inline UInt32 getNRmtJoined() { return nRmtJoined; } + inline UInt32 getNQNodesInCluster() { return nQNodesInCluster; } + inline UInt32 getNQNodesJoined() { return nQNodesJoined; } + inline UInt32 getCfgMinQuorumNodes() { return cfgMinQuorumNodes; } + inline UInt32 getQuorumAchieved() { return quorumAchieved; } +}; + +/* MODS_START */ +class FileSet +{ + + friend class PollingHandler; + +public: + + UInt32 gpfsFilesetVersion; + char gpfsFilesetName[NAME_STRING_LEN]; + char gpfsFileSystemName[NAME_STRING_LEN]; + char gpfsFilesetID[NAME_STRING_LEN]; + char gpfsFilesetRootINode[NAME_STRING_LEN]; + char gpfsFilesetStatus[NAME_STRING_LEN]; + char gpfsFilesetPath[PATH_STRING_LEN]; + char gpfsFilesetParentID[NAME_STRING_LEN]; + UInt64 gpfsFilesetINodes; + char gpfsFilesetCreated[TIME_STAMP_CHARS]; + UInt64 gpfsFilesetDataInKB; + char gpfsFilesetComment[NAME_STRING_LEN]; + bool gpfsFilesetIsLinked; + bool gpfsFilesetHasComment; + + // methods + inline char* getName() { return gpfsFilesetName; } + inline char* getId() { return gpfsFilesetID; } + inline char* getRootINode() { return gpfsFilesetRootINode; } + inline char* getParentId() { return gpfsFilesetParentID; } + inline UInt64 getINodes() { return gpfsFilesetINodes; } + inline UInt64 getData() { return gpfsFilesetDataInKB; } + inline char* getComment() { return gpfsFilesetComment; } + inline char* getFSName() { return gpfsFileSystemName; } + inline char* getStatus() { return gpfsFilesetStatus; } + inline char* getPath() { return gpfsFilesetPath; } + inline char* getCreated() { return gpfsFilesetCreated; } + inline UInt32 getVersion() { return gpfsFilesetVersion; } + +private: +}; + +class User +{ + friend class PollingHandler; +public: + + User() + { + hasName = false; + } + + char gpfsUserName[NAME_STRING_LEN]; + char gpfsUserFileSystemName[NAME_STRING_LEN]; + char gpfsUserClusterName[NAME_STRING_LEN]; + char gpfsUserHomePath[NAME_STRING_LEN]; + UInt32 gpfsUserId; + UInt32 gpfsMainGroupId; + + // temporary flag to show that this user has a name + bool hasName; + + inline char* getName() { return gpfsUserName; } + inline char* getFSName() { return gpfsUserFileSystemName; } + inline char* getCSName() { return gpfsUserClusterName; } + inline char* getHomePath() { return gpfsUserHomePath; } + inline UInt32 getUserId() { return gpfsUserId; } + inline UInt32 getMainGroupId() { return gpfsMainGroupId; } + +private: +}; + +class Group +{ + friend class PollingHandler; +public: + + Group() { hasName = false; } + + char gpfsGroupName[NAME_STRING_LEN]; + char gpfsGroupFileSystemName[NAME_STRING_LEN]; + char gpfsGroupClusterName[NAME_STRING_LEN]; + UInt32 gpfsGroupId; + + // temporary flag to show that this group has a name + bool hasName; + + inline char* getName() { return gpfsGroupName; } + inline char* getFSName() { return gpfsGroupFileSystemName; } + inline char* getCSName() { return gpfsGroupClusterName; } + inline UInt32 getGroupId() { return gpfsGroupId; } + +private: +}; + +/* DJ_MODS_START */ +class FileOrDirOwner +{ + + friend class PollingHandler; + +public: + + char osOwnerName[NAME_STRING_LEN]; + char osGroupName[NAME_STRING_LEN]; + char osFileOrDirList[NAME_STRING_LEN]; // ',' separated list..same as chown + Boolean_t dir; + Boolean_t jnxn; + + inline char* getOwnerName() { return osOwnerName; } + inline char* getGroupName() { return osGroupName; } + inline char* getFileOrDirList() { return osFileOrDirList; } + inline Boolean_t isDirectory() { return dir; } + inline Boolean_t isJnxn() { return jnxn; } + +private: +}; +/* DJ_MODS_END*/ + +class Quota +{ + +public: + + Quota() + { + gpfsQuotaHeader = 0; + gpfsQuotaVersion = 0; + gpfsQuotaType = 0; + gpfsQuotaID = 0; + gpfsQuotaBlockUsage = 0; + gpfsQuotaBlockQuota = 0; + gpfsQuotaBlockLimit = 0; + gpfsQuotaBlockInDoubt = 0; + gpfsQuotaFilesUsage = 0; + gpfsQuotaFilesQuota = 0; + gpfsQuotaFilesLimit = 0; + gpfsQuotaFilesInDoubt = 0; + gpfsQuotaFilesInDoubt = 0; + + gpfsQuotaClusterName.clear(); + gpfsQuotaFileSystemName.clear(); + gpfsQuotaEntityName.clear(); + gpfsQuotaBlockGrace.clear(); + gpfsQuotaFilesGrace.clear(); + gpfsQuotaRemarks.clear(); + } + + std::string gpfsQuotaClusterName; + UInt32 gpfsQuotaHeader; + UInt32 gpfsQuotaVersion; + std::string gpfsQuotaFileSystemName; + UInt16 gpfsQuotaType; + UInt32 gpfsQuotaID; + std::string gpfsQuotaEntityName; + UInt64 gpfsQuotaBlockUsage; + UInt64 gpfsQuotaBlockQuota; + UInt64 gpfsQuotaBlockLimit; + UInt32 gpfsQuotaBlockInDoubt; + std::string gpfsQuotaBlockGrace; + UInt64 gpfsQuotaFilesUsage; + UInt64 gpfsQuotaFilesQuota; + UInt64 gpfsQuotaFilesLimit; + UInt32 gpfsQuotaFilesInDoubt; + std::string gpfsQuotaFilesGrace; + std::string gpfsQuotaRemarks; + + inline std::string getClusterName() { return gpfsQuotaClusterName; } + inline UInt32 getHeader() { return gpfsQuotaHeader; } + inline UInt32 getVersion() { return gpfsQuotaVersion; } + inline std::string getFileSystemName() { return gpfsQuotaFileSystemName; } + inline UInt16 getType() { return gpfsQuotaType; } + inline UInt32 getId() { return gpfsQuotaID; } + inline std::string getEntityName() { return gpfsQuotaEntityName; } + inline UInt64 getBlockUsage() { return gpfsQuotaBlockUsage; } + inline UInt64 getBlockQuota() { return gpfsQuotaBlockQuota; } + inline UInt64 getBlockLimit() { return gpfsQuotaBlockLimit; } + inline UInt32 getBlockInDoubt() { return gpfsQuotaBlockInDoubt; } + inline std::string getBlockGrace() { return gpfsQuotaBlockGrace; } + inline UInt64 getFilesUsage() { return gpfsQuotaFilesUsage; } + inline UInt64 getFilesQuota() { return gpfsQuotaFilesQuota; } + inline UInt64 getFilesLimit() { return gpfsQuotaFilesLimit; } + inline UInt32 getFilesInDoubt() { return gpfsQuotaFilesInDoubt; } + inline std::string getFilesGrace() { return gpfsQuotaFilesGrace; } + inline std::string getRemarks() { return gpfsQuotaRemarks; } + +private: + +}; +/* MODS_END */ + +#define dfprintf if (debug) fprintf + +/* forward declaration */ +class MmpmonWrapperUtils; +class CommandWrapperUtils; + +/* flag: polling scope */ +#define POLL_CLUSTER 0x01 /* poll local cluster - default */ +#define POLL_ALL_CLUSTERS 0x02 /* poll local and remote clusters (if any) */ +#define POLL_NODE 0x04 /* poll local node only */ + +/* Provide pull API to external tasks */ +class PollingHandler +{ + friend class ClusterInfo; + friend class NodeInfo; + friend class FilesystemInfo; + friend class DiskInfo; + + MmpmonWrapperUtils *wrapper; + + /* Thread for executing predefined command scripts to cache the results. + Potentially long-time taking command scripts should be added here. */ + pthread_t cmdThread; + + /* Thread for doing things regularly. Currently, it wakes up a command + thread periodically. */ + pthread_t timerThread; + + /* Thread for doing configurations. */ + pthread_t dispatchThread; + + CommandWrapperUtils *cmdWrapper; + + /* Flag that decides whether a command thread should terminate. */ + int terminate; + + /* Flag that decides whether thimer thread should terminate. */ + int timer_terminate; + + /* Flag that decides whether dispatch thread should terminate. */ + int execTerminate; + + ClusterInfo *recipe; + + /* Main routine for command thread. */ + static void *cmdHandlerBody(void *argP); + + /* Main routine for timer thread. */ + static void *timerHandlerBody(void *argP); + + /* Main routine for dispatch thread. */ + static void *dispatchHandlerBody(void *argP); + + MErrno initNodeList(); + + void initClusterRecipe(ClusterInfo *infoP); + MErrno checkFailedNode(); + char *grabValue(char *buf, int index, char *answer); + + pthread_mutex_t mutex; + + /* Execution task list. It is added by external tasks. */ + pthread_mutex_t listMutex; + std::vectorexecTaskItems; + + int debug; + MgmtProtocol protocol; + Int32 pid; /* external process id, to identify this connection */ + + /* Update rule info in PolicyInfo */ + MErrno fillRuleInfo(FilesystemInfo *fsP, PolicyInfo *policyP); + + int pollingScope; + int nNodesInList; + +public: + + Int32 getPid() { return pid; } + + MErrno cleanupNodeList(); + PollingHandler(MErrno *errP, MgmtProtocol proto, int debg = 0, + int scope = POLL_CLUSTER); + ~PollingHandler(); + + static MErrno init(MgmtProtocol proto, int debg = 0, + int scope = POLL_CLUSTER); + static void term(); + + MmpmonWrapperUtils *getMmpmonWrapper() { return wrapper; } + + /* Cluster recipe is ClusterInfo object which contains primary keys of + nodes, file systems and disks. It is parsed from mmsdrfs file. */ + MErrno refreshClusterRecipe(int scope = POLL_CLUSTER); + + MErrno parseClusterFile(ClusterInfo *cl); + + /* Get a copy of the cluster info */ + MErrno getClusterInfo(ClusterInfo *clP); + + /* current status of cluster */ + MErrno getClusterStatus(ClusterStatus *clStatusP, + int flag = CLUSTER_STATE_ALL); + + MErrno updateDiskSDRInfo(int norefresh=0); + + /* The following update calls will update both the internal copy of the + data and the caller's copy, which is pointed to by clP. */ + + MErrno updateClusterInfo(ClusterInfo *clP, int norefresh=0); + + /* Update node list which belongs to the specified cluster */ + MErrno updateNodeInfo(ClusterInfo *clP, int norefresh=0); + + /* MODS_START */ + /* Method used to quickly populate mount point for nodes->file systems */ + MErrno updateFilesystemMountPointInfo(ClusterInfo *clP); + /* MODS_END */ + + /* Update filesystem list which belongs to the specified cluster */ + MErrno updateFilesystemInfo(ClusterInfo *clP, int getPerf=0); + + /* Update storage pool list which belongs to the specified filesystem + (NULL=all filesystems) */ + MErrno updateStoragePoolInfo(ClusterInfo *clP, char *fsName=NULL); + + /* Update disk list which belongs to the specified filesystem/pool + (NULL=all pools in the filesystem) */ + MErrno updateDiskInfo(ClusterInfo *clP, char *fsName, char *poolName=NULL, + int getPerf=0); + + MErrno updateFreeDiskInfo(ClusterInfo *clP); + + /* Update per node ioc statistics */ + MErrno updateIocStatsInfo(ClusterInfo *clP); + + /* Update per node VFS statistics */ + MErrno updateVfsStatsInfo(ClusterInfo *clP); + + /* Update per node thread pool utilization statistics */ + MErrno updateThreadUtilInfo(ClusterInfo *clP); + + /* Update per node cache hit miss statistics */ + MErrno updateCacheStatsInfo(ClusterInfo *clP); + + /* Update per node pcache gateway statistics */ + MErrno updatePCacheStatsInfo(ClusterInfo *clP); + + MErrno updateClusterCfgInfo(ClusterInfo *clP); + + MErrno updateTscommCfgInfo(ClusterInfo *clP); + + MErrno updateVerbsClientInfo(ClusterInfo *clP); + + MErrno updateVerbsServerInfo(ClusterInfo *clP); + + MErrno updateRPCUtilInfo(ClusterInfo *clP, Int16 tmu=0, Int16 time=0); + + MErrno updateRPCRawUtilInfo(ClusterInfo *clP); + + MErrno updateRPCSizeUtilInfo(ClusterInfo *clP, Int16 tmu=0, Int16 time=0); + + MErrno updateRPCMsgUtilInfo(ClusterInfo *clP, Int16 tmu=0, Int16 time=0); + + MErrno updateRPCUtilInfoPerSec(ClusterInfo *clP); + + MErrno processCommand(const char *cmd); + + MErrno copyRecipe(ClusterInfo *clP); + + /* Update mounted node info in FilesystemInfo */ + MErrno updateMountedNodeInfo(ClusterInfo *clP); + + /* Update policy info in FilesystemInfo */ + MErrno updatePolicyInfo(ClusterInfo *clP); + + /* Update file system manager node info in FilesystemInfo */ + MErrno updateFilesystemManagerInfo(ClusterInfo *clP); + + /* Update file system configuration info in FilesystemInfo */ + MErrno updateFilesystemConfigInfo(ClusterInfo *clP); + + /* Update disk access info in NodeInfo */ + MErrno updateDiskAccessInfo(ClusterInfo *clP); + + /* Update NSD server info in DiskInfo */ + MErrno updateDiskServerInfo(DiskInfo *diskP, char *serverListP, + char *backupServerListP); + + /* Update indirect disk access info (through NSD servers) in NodeInfo */ + MErrno updateIndirectDiskAccessInfo(ClusterInfo *clP, DiskInfo *diskP); + + /* MODS_START */ + /* Update the file set list */ + MErrno getFileSet(char *fileSystemName, char *fileSetName, FileSet *fileSet); + MErrno getFileSets(char *fileSystemName, std::vector*fileSetList); + + MErrno getFileSets1(char *fileSystemNameP, + FileSet *fileSetListP, /* caller allocated/freed */ + int *nElemP /* in: size of fileSetListP + out: number of filesets needed */ + ); + /* type: users=1, group=2, fileset=3 */ + MErrno getQuota(int type, const char *fsName, + const char *entityName, Quota *quota ); +#ifdef MMANTRAS_QUOTAS + MErrno getQuotas(int type, const char *fsName, + std::vector *quotas ); +#endif + + MErrno createFileSet(FileSet fileSet, + std::string *gpfsMsg, bool isNull); + + MErrno deleteFileSet(FileSet fileSet, + bool force, std::string *gpfsMs); + + MErrno editQuota(char *cFsName, char *cType, + char *cEntityId, UInt64 *cNewFileSoftLim, + UInt64 *cNewFileHardLim, UInt64 *cNewBlockSoftLim, + UInt64 *cNewBlockHardLim, char *cNaramGracePeriod, + std::string *gpfsMsg); + + MErrno editFileset(char *cFsName, char *cType, + char *cEntityId, char *cNewName, char *cNewComment, + std::string *gpfsMsg); + + /* DJ_MODS_START */ + // Link a fileset + MErrno linkFileSet(FileSet jnxnFileset, std::string *gpfsMsg); + + // Unlink a fileset + MErrno unlinkFileSet(const char *fsetNameOrJnxnPath, + const char *tgt, bool isFsetName, bool force, + std::string *gpfsMsg); + + // Change owner or group of a file + // NOTE: This is not GPFS fucntionality per se .. it is a convenience for VSC + MErrno changeOwnerAndOrGroup(FileOrDirOwner newOwnerGrp); + + // Change owner and group of a file/dir to match that of a template + // source file/dir + MErrno changeFileOrDirOwnership(FileOrDirOwner src, + FileOrDirOwner tgt, std::string *gpfsMsg); + + // Change ACLs of a file/dir to match that of a template source file/dir + MErrno changeFileOrDirACL(FileOrDirOwner src, + FileOrDirOwner tgt, int aclType, + std::string *gpfsMsg); + /* DJ_MODS_END */ + +#ifdef MMANTRAS_QUOTAS + MErrno getUsers(char *fsName, char *fsNameMntPt, + char *csName, std::vector *userList); + + MErrno getGroups(char *fsName, char *fsNameMntPt, + char *csName, std::vector *groupList); +#endif + + MErrno getHomePath(char *user, char *path); + MErrno getPrimaryId(char *user, UInt32 *pid); + + /* MODS_END */ + + + /* Get the SDRFS gen number from the local node */ + UInt32 getSdrfsGenNumber(); + UInt32 getSdrfsGenNumberFromRecipe(); + MErrno updateSdrfsGenNumber(UInt32 sdrGen); + + /* Called by a main thread. Wake up timer thread. */ + void wakeupTimerThread(); + + /* Called by a timer thread. Wait a main thread to wake it up. */ + void waitMainThread(); + + /* Called by a timer thread. Wake up command thread which + executes several command scripts. */ + void wakeupCmdThread(); + + /* Called by a command thread. When command thread starts, + it waits timer thread to wake it up. */ + void waitTimerThread(); + + /* Called by a command thread. When command thread finishes, + wake up any waiter thread. */ + void notifyCmdThreadDone(); + + /* Called by external tasks. Wait until the command thread finishes + its work. */ + void waitCmdThreadDone(); + + /* Called by a main thread. When an execution task is being added, + it is called to wake up dispatch thread. */ + void wakeupDispatchThread(); + + /* Called by a dispatch thread. Wait any execution task to be + arrived. */ + void waitExecutionTask(); + + /* Add asynchronous execution task. */ + MErrno addExecutionTask(const char *cmd, char *argP, int (*callbackFn)(void *), + void *callbackData); + + /* Extract an execution task from list. */ + MErrno getExecTaskFromList(ExecutionTask *taskP); + + /* Initialize buffer. */ + MErrno initBuf(char *buf); + + /* Get GPFS daemon state. */ + MErrno getDaemonState(); + + /* MODS_START */ + char *getTimeStampInMilliseconds(char *timeStamp, char *cdateP); + + std::string buffer2string(char * buffer, int itemsToCopy); + std::vector tokenHelper(char *buf, int expectedTokens ); + + void getPollingLock(); + void releasePollingLock(); + /* MODS_END */ + + int getPollingScope() { return pollingScope; }; + int getNNodesInList() { return nNodesInList; }; + Boolean_t isLocalNodeStats() { return (pollingScope & POLL_NODE) ? + true:false; }; + /* Per node statistics */ + MErrno iocStatsInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno vfsStatsInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno threadUtilInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno cacheStatsInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno pCacheStatsInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno clusterCfgInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno nsdServerStatsInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno fsIoStatsInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno poolIoStatsInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); + MErrno diskStatsInfo(int flags, void *bufferP, int bufferSize, + int *nElemP, int *errP); +}; + +extern PollingHandler *thePollingHandler; + +void ts_log(int level, const char *component, const char* fmtString, ...); +long file_size(char * fname); +void log_update(); + +#endif /* _h_api_poll */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/api_types.h b/System/ior/files/gpfs/5.0.2-3/include/api_types.h new file mode 100644 index 0000000..eee2e2b --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/api_types.h @@ -0,0 +1,66 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* */ +/* */ +/* Licensed Materials - Property of IBM */ +/* */ +/* Restricted Materials of IBM */ +/* */ +/* (C) COPYRIGHT International Business Machines Corp. 2010,2018 */ +/* All Rights Reserved */ +/* */ +/* US Government Users Restricted Rights - Use, duplication or */ +/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/* @(#)18 1.5 src/avs/fs/mmfs/ts/mmantras/api_types.h, mmfs, avs_rtac502, rtac5021836a 12/22/10 14:55:05 */ +#ifndef _h_api_types +#define _h_api_types + +/* + * api_types.h + * type definition used in MMANTRAS library + */ + +typedef enum +{ + M_OK = 0, + M_ERR = 1, + M_RECOVERED = 2 +} MErrno; + +typedef short Int16; +typedef int Int32; +typedef long long Int64; +typedef unsigned short UInt16; +typedef unsigned int UInt32; +typedef unsigned long long UInt64; + +typedef unsigned int Boolean_t; + +struct threadUtil +{ + UInt32 current; + UInt32 highest; + UInt32 maximum; +}; +typedef struct threadUtil threadUtil_t; + +struct pCacheCmdInfo +{ + UInt32 queuedPcacheCmds; + UInt32 inflightPcacheCmds; + UInt32 completedPcacheCmds; + UInt32 errorPcacheCmds; + UInt32 filteredPcacheCmds; + UInt32 enoentPcacheCmds; +}; +typedef struct pCacheCmdInfo pCacheCmdInfo_t; + + +/* mmantras library debug routine */ +extern void ts_print(const char *str); + +#endif /* _h_api_types */ + diff --git a/System/ior/files/gpfs/5.0.2-3/include/dmapi.h b/System/ior/files/gpfs/5.0.2-3/include/dmapi.h new file mode 100644 index 0000000..01a6f61 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/dmapi.h @@ -0,0 +1,647 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* */ +/* */ +/* Licensed Materials - Property of IBM */ +/* */ +/* Restricted Materials of IBM */ +/* */ +/* (C) COPYRIGHT International Business Machines Corp. 1997,2018 */ +/* All Rights Reserved */ +/* */ +/* US Government Users Restricted Rights - Use, duplication or */ +/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/* @(#)05 1.16 src/avs/fs/mmfs/ts/dm/dmapi.h, mmfs, avs_rtac502, rtac5021836a 11/23/09 18:22:10 */ +/* + * + * Define library calls for GPFS DMAPI + * + */ +#ifndef _DMAPI_H +#define _DMAPI_H + +#include "dmapi_types.h" + +/* + * Function declarations for GPFS DMAPI + */ + +#ifdef __cplusplus +extern "C" +{ +#endif + + extern int dm_clear_inherit( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_attrname_t *attrnamep /* IN */ + ); + + extern int dm_create_by_handle( + dm_sessid_t sid, /* IN */ + void *dirhanp, /* IN */ + size_t dirhlen, /* IN */ + dm_token_t token, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + char *cname /* IN */ + ); + + extern int dm_create_session( + dm_sessid_t oldsid, /* IN */ + char *sessinfop, /* IN */ + dm_sessid_t *newsidp /* OUT */ + ); + + extern int dm_create_userevent( + dm_sessid_t sid, /* IN */ + size_t msglen, /* IN */ + void *msgdatap, /* IN */ + dm_token_t *tokenp /* OUT */ + ); + + extern int dm_destroy_session( + dm_sessid_t sid /* IN */ + ); + + extern int dm_downgrade_right( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token /* IN */ + ); + + extern int dm_fd_to_handle( + int fd, /* IN */ + void **hanpp, /* OUT */ + size_t *hlenp /* OUT */ + ); + + extern int dm_find_eventmsg( + dm_sessid_t sid, /* IN */ + dm_token_t token, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_get_allocinfo( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_off_t *offp, /* IN/OUT */ + u_int nelem, /* IN */ + dm_extent_t *extentp, /* OUT */ + u_int *nelemp /* OUT */ + ); + + extern int dm_get_bulkall( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int mask, /* IN */ + dm_attrname_t *attrnamep, /* IN */ + dm_attrloc_t *locp, /* IN/OUT */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_get_bulkattr( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int mask, /* IN */ + dm_attrloc_t *locp, /* IN/OUT */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_get_config( + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_config_t flagname, /* IN */ + dm_size_t *retvalp /* OUT */ + ); + + extern int dm_get_config_events( + void *hanp, /* IN */ + size_t hlen, /* IN */ + u_int nelem, /* IN */ + dm_eventset_t *eventsetp, /* OUT */ + u_int *nelemp /* OUT */ + ); + + extern int dm_get_dirattrs( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int mask, /* IN */ + dm_attrloc_t *locp, /* IN/OUT */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_get_dmattr( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_attrname_t *attrnamep, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_get_eventlist( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int nelem, /* IN */ + dm_eventset_t *eventsetp, /* OUT */ + u_int *nelemp /* OUT */ + ); + + extern int dm_get_events( + dm_sessid_t sid, /* IN */ + u_int maxmsgs, /* IN */ + u_int flags, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_get_fileattr( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int mask, /* IN */ + dm_stat_t *statp /* OUT */ + ); + + extern int dm_get_mountinfo( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_get_region( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int nelem, /* IN */ + dm_region_t *regbufp, /* OUT */ + u_int *nelemp /* OUT */ + ); + + extern int dm_getall_disp( + dm_sessid_t sid, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_getall_dmattr( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_getall_inherit( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int nelem, /* IN */ + dm_inherit_t *inheritbufp, /* OUT */ + u_int *nelemp /* OUT */ + ); + + extern int dm_getall_sessions( + u_int nelem, /* IN */ + dm_sessid_t *sidbufp, /* OUT */ + u_int *nelemp /* OUT */ + ); + + extern int dm_getall_tokens( + dm_sessid_t sid, /* IN */ + u_int nelem, /* IN */ + dm_token_t *tokenbufp, /* OUT */ + u_int *nelemp /* OUT */ + ); + + extern int dm_handle_cmp( + void *hanp1, /* IN */ + size_t hlen1, /* IN */ + void *hanp2, /* IN */ + size_t hlen2 /* IN */ + ); + + extern void dm_handle_free( + void *hanp, /* IN */ + size_t hlen /* IN */ + ); + + extern u_int dm_handle_hash( + void *hanp, /* IN */ + size_t hlen /* IN */ + ); + + extern dm_boolean_t dm_handle_is_valid( + void *hanp, /* IN */ + size_t hlen /* IN */ + ); + + extern int dm_handle_to_fshandle( + void *hanp, /* IN */ + size_t hlen, /* IN */ + void **fshanpp, /* OUT */ + size_t *fslenp /* OUT */ + ); + + extern int dm_handle_to_fsid( + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_fsid_t *fsidp /* OUT */ + ); + + extern int dm_handle_to_igen( + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_igen_t *igenp /* OUT */ + ); + + extern int dm_handle_to_ino( + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_ino_t *inop /* OUT */ + ); + + extern int dm_handle_to_snap( + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_snap_t *isnapp /* OUT */ + ); + + extern int dm_handle_to_path( + void *dirhanp, /* IN */ + size_t dirhlen1, /* IN */ + void *targhanp, /* IN */ + size_t targhlen, /* IN */ + size_t buflen, /* IN */ + char *pathbufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern int dm_init_attrloc( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_attrloc_t *locp /* OUT */ + ); + + extern int dm_init_service( + char **versionstrpp /* OUT */ + ); + + extern int dm_make_fshandle( + dm_fsid_t *fsidp, /* IN */ + void **hanpp, /* OUT */ + size_t *hlenp /* OUT */ + ); + + extern int dm_make_handle( + dm_fsid_t *fsidp, /* IN */ + dm_ino_t *inop, /* IN */ + dm_igen_t *igenp, /* IN */ + void **hanpp, /* OUT */ + size_t *hlenp /* OUT */ + ); + + extern int dm_make_xhandle( + dm_fsid_t *fsidp, /* IN */ + dm_ino_t *inop, /* IN */ + dm_igen_t *igenp, /* IN */ + dm_snap_t *isnapp, /* IN */ + void **hanpp, /* OUT */ + size_t *hlenp /* OUT */ + ); + + extern int dm_mkdir_by_handle( + dm_sessid_t sid, /* IN */ + void *dirhanp, /* IN */ + size_t dirhlen, /* IN */ + dm_token_t token, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + char *cname /* IN */ + ); + + extern int dm_move_event( + dm_sessid_t srcsid, /* IN */ + dm_token_t token, /* IN */ + dm_sessid_t targetsid, /* IN */ + dm_token_t *rtokenp /* OUT */ + ); + + extern int dm_obj_ref_hold( + dm_sessid_t sid, /* IN */ + dm_token_t token, /* IN */ + void *hanp, /* IN */ + size_t hlen /* IN */ + ); + + extern int dm_obj_ref_query( + dm_sessid_t sid, /* IN */ + dm_token_t token, /* IN */ + void *hanp, /* IN */ + size_t hlen /* IN */ + ); + + extern int dm_obj_ref_rele( + dm_sessid_t sid, /* IN */ + dm_token_t token, /* IN */ + void *hanp, /* IN */ + size_t hlen /* IN */ + ); + + extern int dm_path_to_fshandle( + char *path, /* IN */ + void **hanpp, /* OUT */ + size_t *hlenp /* OUT */ + ); + + extern int dm_path_to_handle( + char *path, /* IN */ + void **hanpp, /* OUT */ + size_t *hlenp /* OUT */ + ); + + extern int dm_pending( + dm_sessid_t sid, /* IN */ + dm_token_t token, /* IN */ + dm_timestruct_t *delay /* IN */ + ); + + extern int dm_probe_hole( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_off_t off, /* IN */ + dm_size_t len, /* IN */ + dm_off_t *roffp, /* OUT */ + dm_size_t *rlenp /* OUT */ + ); + + extern int dm_punch_hole( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_off_t off, /* IN */ + dm_size_t len /* IN */ + ); + + extern int dm_query_right( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_right_t *rightp /* OUT */ + ); + + extern int dm_query_session( + dm_sessid_t sid, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp /* OUT */ + ); + + extern dm_ssize_t dm_read_invis( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_off_t off, /* IN */ + dm_size_t len, /* IN */ + void *bufp /* OUT */ + ); + + extern int dm_release_right( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token /* IN */ + ); + + extern int dm_remove_dmattr( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + int setdtime, /* IN */ + dm_attrname_t *attrnamep /* IN */ + ); + + extern int dm_remove_dmattr_nosync( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + int setdtime, /* IN */ + dm_attrname_t *attrnamep /* IN */ + ); + + extern int dm_request_right( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int flags, /* IN */ + dm_right_t right /* IN */ + ); + + extern int dm_respond_event( + dm_sessid_t sid, /* IN */ + dm_token_t token, /* IN */ + dm_response_t response, /* IN */ + int reterror, /* IN */ + size_t buflen, /* IN */ + void *respbufp /* IN */ + ); + + extern int dm_send_msg( + dm_sessid_t targetsid, /* IN */ + dm_msgtype_t msgtype, /* IN */ + size_t buflen, /* IN */ + void *bufp /* IN */ + ); + + extern int dm_set_disp( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_eventset_t *eventsetp, /* IN */ + u_int maxevent /* IN */ + ); + + extern int dm_set_dmattr( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_attrname_t *attrnamep, /* IN */ + int setdtime, /* IN */ + size_t buflen, /* IN */ + void *bufp /* IN */ + ); + + extern int dm_set_dmattr_nosync( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_attrname_t *attrnamep, /* IN */ + int setdtime, /* IN */ + size_t buflen, /* IN */ + void *bufp /* IN */ + ); + + extern int dm_set_eventlist( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_eventset_t *eventsetp, /* IN */ + u_int maxevent /* IN */ + ); + + extern int dm_set_eventlist_nosync( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_eventset_t *eventsetp, /* IN */ + u_int maxevent /* IN */ + ); + + extern int dm_set_fileattr( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int mask, /* IN */ + dm_fileattr_t *attrp /* IN */ + ); + + extern int dm_set_inherit( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_attrname_t *attrnamep, /* IN */ + mode_t mode /* IN */ + ); + + extern int dm_set_region( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int nelem, /* IN */ + dm_region_t *regbufp, /* IN */ + dm_boolean_t *exactflagp /* OUT */ + ); + + extern int dm_set_region_nosync( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + u_int nelem, /* IN */ + dm_region_t *regbufp, /* IN */ + dm_boolean_t *exactflagp /* OUT */ + ); + + extern int dm_set_return_on_destroy( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + dm_attrname_t *attrnamep, /* IN */ + dm_boolean_t enable /* IN */ + ); + + extern int dm_symlink_by_handle( + dm_sessid_t sid, /* IN */ + void *dirhanp, /* IN */ + size_t dirhlen, /* IN */ + dm_token_t token, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + char *cname, /* IN */ + char *path /* IN */ + ); + + extern int dm_sync_by_handle( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token /* IN */ + ); + + extern int dm_sync_dmattr_by_handle( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token /* IN */ + ); + + extern int dm_upgrade_right( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token /* IN */ + ); + + extern dm_ssize_t dm_write_invis( + dm_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + dm_token_t token, /* IN */ + int flags, /* IN */ + dm_off_t off, /* IN */ + dm_size_t len, /* IN */ + void *bufp /* IN */ + ); + +#ifdef __cplusplus +} +#endif + +#endif /* _DMAPI_H */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/dmapi_types.h b/System/ior/files/gpfs/5.0.2-3/include/dmapi_types.h new file mode 100644 index 0000000..a53ddd3 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/dmapi_types.h @@ -0,0 +1,591 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* */ +/* */ +/* Licensed Materials - Property of IBM */ +/* */ +/* Restricted Materials of IBM */ +/* */ +/* (C) COPYRIGHT International Business Machines Corp. 1997,2018 */ +/* All Rights Reserved */ +/* */ +/* US Government Users Restricted Rights - Use, duplication or */ +/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/* @(#)06 1.57 src/avs/fs/mmfs/ts/dm/dmapi_types.h, mmfs, avs_rtac502, rtac5021836a 2/17/17 10:31:56 */ +/* + * + * Define external types for GPFS DMAPI + * + */ +#ifndef _DMAPI_TYPES_H +#define _DMAPI_TYPES_H + +#include + +/* + * Type definitions for GPFS DMAPI external interfaces + */ + +/* Basic scalar types */ + +typedef int dm_signed32; +typedef unsigned int dm_unsigned32; +typedef long long dm_signed64; +typedef unsigned long long dm_unsigned64; + +struct dm_scalar128 +{ + dm_unsigned64 high; + dm_unsigned64 low; +#ifdef __cplusplus + bool operator == (const dm_scalar128& rhs) const + { return high == rhs.high && low == rhs.low; }; + bool operator != (const dm_scalar128& rhs) const + { return high != rhs.high || low != rhs.low; }; + bool operator < (const dm_scalar128& rhs) const + { return high < rhs.high || (high == rhs.high && low < rhs.low); }; + bool operator > (const dm_scalar128& rhs) const + { return high > rhs.high || (high == rhs.high && low > rhs.low); }; + bool operator <= (const dm_scalar128& rhs) const + { return high < rhs.high || (high == rhs.high && low <= rhs.low); }; + bool operator >= (const dm_scalar128& rhs) const + { return high > rhs.high || (high == rhs.high && low >= rhs.low); }; +#endif /* __cplusplus */ +}; +typedef struct dm_scalar128 dm_scalar128; + +#define DM_SCALAR128_EQ(x, y) (((x).high==(y).high) && ((x).low==(y).low)) +#define DM_SCALAR128_NE(x, y) (((x).high!=(y).high) || ((x).low!=(y).low)) +#define DM_SCALAR128_LT(x, y) (((x).high<(y).high) || (((x).high==(y).high) && ((x).low<(y).low))) +#define DM_SCALAR128_GT(x, y) (((x).high>(y).high) || (((x).high==(y).high) && ((x).low>(y).low))) +#define DM_SCALAR128_LE(x, y) (((x).high<(y).high) || (((x).high==(y).high) && ((x).low<=(y).low))) +#define DM_SCALAR128_GE(x, y) (((x).high>(y).high) || (((x).high==(y).high) && ((x).low>=(y).low))) + +typedef dm_signed64 dm_off_t; +typedef dm_unsigned64 dm_size_t; +typedef dm_signed64 dm_ssize_t; + +#ifdef _AIX +typedef ino_t dm_ino_t; +#else +typedef dm_unsigned64 dm_ino_t; +#endif + +typedef dm_unsigned64 dm_fsid_t; +typedef dm_unsigned32 dm_igen_t; + +typedef dm_unsigned64 dm_snap_t; +#define DM_SNAP_ROOT ((dm_snap_t) 0) +#define DM_SNAP_INVALID ((dm_snap_t) -1) + +typedef enum +{ + DM_FALSE = 0, + DM_TRUE = 1 +} dm_boolean_t; + +/* Iterator for a filesystem scan */ +typedef dm_signed64 dm_attrloc_t; + +/* Variable-length data */ +struct dm_vardata +{ + int vd_offset; + unsigned int vd_length; +}; +typedef struct dm_vardata dm_vardata_t; + +/* Interpreters for variable length data */ + +#define DM_GET_LEN(basePtr, vardataFieldName) \ + (((basePtr)->vardataFieldName.vd_offset == 0) ? \ + (size_t)DM_INVALID_HLEN : \ + (((basePtr)->vardataFieldName.vd_offset == 1) ? \ + (size_t)DM_GLOBAL_HLEN : \ + ((basePtr)->vardataFieldName.vd_length) \ + )) + +/* The prtType parameter in the DM_GET_VALUE() macro is pointer type + (for example "int *"). The value of the macro is a pointer of the give type, + or NULL if the data length (as given by the DM_GET_LEN() macro) is zero. */ +#define DM_GET_VALUE(basePtr, vardataFieldName, ptrType) \ + (((basePtr)->vardataFieldName.vd_offset == 0) ? \ + (ptrType)DM_INVALID_HANP : \ + (((basePtr)->vardataFieldName.vd_offset == 1) ? \ + (ptrType)DM_GLOBAL_HANP : \ + (((basePtr)->vardataFieldName.vd_length == 0) ? \ + NULL : \ + (ptrType)((char *)(basePtr)+(basePtr)->vardataFieldName.vd_offset)\ + ))) + +/* Iterator for lists of variable length structures */ + +/* The ptrType parameter in the DM_STEP_TO_NEXT() macro is a pointer type + (for example "dm_attrlist_t *"). The value of the macro is a pointer + of the given type, or NULL if the current element is the last in the list.*/ +#define DM_STEP_TO_NEXT(basePtr, ptrType) \ + (((basePtr)->_link == 0) ? NULL : \ + (ptrType)((char *)(basePtr) + (basePtr)->_link)) + +#define DM_ATTR_NAME_SIZE 8 + +/* Name of an extended attribute */ +struct dm_attrname +{ + u_char an_chars[DM_ATTR_NAME_SIZE]; +}; +typedef struct dm_attrname dm_attrname_t; + +/* Session identifier */ +typedef dm_unsigned64 dm_sessid_t; + +/* Node identifier */ +typedef dm_unsigned32 dm_nodeid_t; /* GPFS Specific - not in XDSM standard */ + +/* List of extended attributes */ +struct dm_attrlist +{ + dm_ssize_t _link; + dm_attrname_t al_name; + dm_vardata_t al_data; +}; +typedef struct dm_attrlist dm_attrlist_t; + +/* Attributes of the GPFS DMAPI implementation */ +typedef enum +{ + DM_CONFIG_INVALID, /* Lower than any attribute */ + DM_CONFIG_BULKALL, + DM_CONFIG_CREATE_BY_HANDLE, + DM_CONFIG_DTIME_OVERLOAD, + DM_CONFIG_LEGACY, + DM_CONFIG_LOCK_UPGRADE, + DM_CONFIG_MAX_ATTR_ON_DESTROY, + DM_CONFIG_MAX_ATTRIBUTE_SIZE, + DM_CONFIG_MAX_HANDLE_SIZE, + DM_CONFIG_MAX_MANAGED_REGIONS, + DM_CONFIG_MAX_MESSAGE_DATA, + DM_CONFIG_OBJ_REF, + DM_CONFIG_PENDING, + DM_CONFIG_PERS_ATTRIBUTES, + DM_CONFIG_PERS_EVENTS, + DM_CONFIG_PERS_INHERIT_ATTRIBS, + DM_CONFIG_PERS_MANAGED_REGIONS, + DM_CONFIG_PUNCH_HOLE, + DM_CONFIG_TOTAL_ATTRIBUTE_SPACE, + DM_CONFIG_WILL_RETRY, + DM_CONFIG_MAX /* GPFS specific - higher than any attribute */ +} dm_config_t; + +#define DM_CONFIG_LOWEST (DM_CONFIG_INVALID + 1) /* GPFS specific - lowest attribute */ +#define DM_CONFIG_HIGHEST (DM_CONFIG_MAX -1) /* GPFS specific - highest attribute */ + +/* Names of events */ +typedef enum +{ + DM_EVENT_INVALID, /* Lower than any event */ + DM_EVENT_CLOSE, + DM_EVENT_MOUNT, + DM_EVENT_PREUNMOUNT, DM_EVENT_UNMOUNT, + DM_EVENT_NOSPACE, + DM_EVENT_DEBUT, + DM_EVENT_CREATE, DM_EVENT_POSTCREATE, + DM_EVENT_REMOVE, DM_EVENT_POSTREMOVE, + DM_EVENT_RENAME, DM_EVENT_POSTRENAME, + DM_EVENT_SYMLINK, DM_EVENT_POSTSYMLINK, + DM_EVENT_LINK, DM_EVENT_POSTLINK, + DM_EVENT_READ, + DM_EVENT_WRITE, + DM_EVENT_TRUNCATE, + DM_EVENT_ATTRIBUTE, + DM_EVENT_CANCEL, + DM_EVENT_DESTROY, + DM_EVENT_USER, + DM_EVENT_PREPERMCHANGE, + DM_EVENT_POSTPERMCHANGE, + DM_EVENT_DIRECT_READ, /* GPFS specific */ + DM_EVENT_MAX /* Higher than any event */ +} dm_eventtype_t; + +#define DM_EVENT_BASE_MAX DM_EVENT_PREPERMCHANGE +#define DM_EVENT_MAX_POSSIBLE 32 +#define DM_EVENT_EXP_COUNT (DM_EVENT_MAX-DM_EVNT_BASE_MAX) + +/* Set of events */ +typedef dm_unsigned32 dm_eventset_t; + +#define DM_EVENT_LOWEST (DM_EVENT_INVALID + 1) /* GPFS specific - lowest event */ +#define DM_EVENT_HIGHEST (DM_EVENT_MAX - 1) /* GPFS specific - highest event */ + +/* Operations on sets of events */ + +#define DMEV_SET(ev, eset) (((((int) (ev)) >= DM_EVENT_LOWEST) \ + && (((int) (ev)) <= DM_EVENT_HIGHEST)) \ + ? (eset) |= (((dm_eventset_t) 1) << (((int) (ev)) - 1)) \ + : (eset)) + +#define DMEV_CLR(ev, eset) (((((int) (ev)) >= DM_EVENT_LOWEST) \ + && (((int) (ev)) <= DM_EVENT_HIGHEST)) \ + ? (eset) &= ~(((dm_eventset_t) 1) << (((int) (ev)) - 1)) \ + : (eset)) + +#define DMEV_ZERO(eset) ((eset) = (dm_eventset_t) DM_EVENT_INVALID) + + +#define DMEV_ISSET(ev, eset) ((((int) (ev)) >= DM_EVENT_LOWEST) \ + && (((int) (ev)) <= DM_EVENT_HIGHEST) \ + && (((dm_eventset_t) (eset)) & (((dm_eventset_t) 1) << (((int) (ev)) - 1)))) + +/* GPFS Specific event set operations - not in XDSM standard */ + +/* Add all events to eset */ +#define DMEV_ALL(eset) ((eset) = ~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST)) + +/* check if eset is empty (contains no events) */ +#define DMEV_ISZERO(eset) ((((dm_eventset_t) (eset)) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST))) == (dm_eventset_t) DM_EVENT_INVALID) + +/* check if eset contains all events */ +#define DMEV_ISALL(eset) ((((dm_eventset_t) (eset)) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST))) == ~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST)) + +/* Add to eset2 all events of eset1 */ +#define DMEV_ADD(eset1, eset2) ((eset2) = ((((dm_eventset_t) (eset1)) | ((dm_eventset_t) (eset2))) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST)))) + +/* Remove from eset2 all events of eset1 */ +#define DMEV_REM(eset1, eset2) ((eset2) = (((dm_eventset_t) (eset2)) & (~((dm_eventset_t) (eset1))))) + +/* Restrict eset2 by eset1 (remove from eset2 any event that is not in eset1) */ +#define DMEV_RES(eset1, eset2) ((eset2) = ((((dm_eventset_t) (eset1)) & ((dm_eventset_t) (eset2))) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST)))) + +/* Check if eset1 and eset2 are equal (have the same events) */ +#define DMEV_ISEQ(eset1, eset2) ((((dm_eventset_t) (eset1)) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST))) == (((dm_eventset_t) (eset2)) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST)))) + +/* Check if eset1 and eset2 are disjoint (have no events in common) */ +#define DMEV_ISDISJ(eset1, eset2) ((((dm_eventset_t) (eset1)) & ((dm_eventset_t) (eset2)) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST))) == (dm_eventset_t) DM_EVENT_INVALID) + +/* Check if eset1 is a subset of eset2 (all events of eset1 are in eset2) */ +#define DMEV_ISSUB(eset1, eset2) ((((dm_eventset_t) (eset1)) & ((dm_eventset_t) (eset2)) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST))) == (((dm_eventset_t) (eset1)) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST)))) + +/* Normalize the contents of eset (unused bits in the mask are cleared). + Useful if eset was not obtained entirely by means of DMEV_XXX() macros*/ +#define DMEV_NORM(eset) ((eset) = (((dm_eventset_t)(eset)) & (~((~((dm_eventset_t) DM_EVENT_INVALID)) << DM_EVENT_HIGHEST)))) + +/* Extent types */ +typedef enum +{ + DM_EXTENT_INVALID, + DM_EXTENT_RES, + DM_EXTENT_HOLE +} dm_extenttype_t; + +struct dm_extent +{ + dm_extenttype_t ex_type; + dm_signed32 ex_pad_to_dword; /* dm_off_t is 64b, need to pad */ + dm_off_t ex_offset; + dm_size_t ex_length; +}; +typedef struct dm_extent dm_extent_t; + +/* Disposition information */ +struct dm_dispinfo +{ + dm_ssize_t _link; + dm_vardata_t di_fshandle; + dm_eventset_t di_eventset; +}; +typedef struct dm_dispinfo dm_dispinfo_t; + +typedef dm_scalar128 dm_token_t; + +/* Comparison macros for tokens - GPFS specific - not in XDSM standard */ +#define DM_TOKEN_EQ(x, y) DM_SCALAR128_EQ(x, y) +#define DM_TOKEN_NE(x, y) DM_SCALAR128_NE(x, y) +#define DM_TOKEN_LT(x, y) DM_SCALAR128_LT(x, y) +#define DM_TOKEN_GT(x, y) DM_SCALAR128_GT(x, y) +#define DM_TOKEN_LE(x, y) DM_SCALAR128_LE(x, y) +#define DM_TOKEN_GE(x, y) DM_SCALAR128_GE(x, y) + +/* Sequence number for event cancellation */ +typedef dm_scalar128 dm_sequence_t; + +/* Comparison macros for sequence numbers - GPFS specific - not in XDSM standard */ +#define DM_SEQUENCE_EQ(x, y) DM_SCALAR128_EQ(x, y) +#define DM_SEQUENCE_NE(x, y) DM_SCALAR128_NE(x, y) +#define DM_SEQUENCE_LT(x, y) DM_SCALAR128_LT(x, y) +#define DM_SEQUENCE_GT(x, y) DM_SCALAR128_GT(x, y) +#define DM_SEQUENCE_LE(x, y) DM_SCALAR128_LE(x, y) +#define DM_SEQUENCE_GE(x, y) DM_SCALAR128_GE(x, y) + +/* Event message header */ +struct dm_eventmsg +{ + dm_ssize_t _link; + dm_eventtype_t ev_type; + dm_token_t ev_token; + dm_sequence_t ev_sequence; + dm_nodeid_t ev_nodeid; /* GPFS specific - not in XDSM standard */ + dm_vardata_t ev_data; +}; +typedef struct dm_eventmsg dm_eventmsg_t; + + +/* Cancel event message */ +struct dm_cancel_event +{ + dm_sequence_t ce_sequence; + dm_token_t ce_token; +}; +typedef struct dm_cancel_event dm_cancel_event_t; + +/* Data event message */ +struct dm_data_event +{ + dm_vardata_t de_handle; + dm_off_t de_offset; + dm_size_t de_length; +}; +typedef struct dm_data_event dm_data_event_t; + +/* Destroy event message */ +struct dm_destroy_event +{ + dm_vardata_t ds_handle; + dm_attrname_t ds_attrname; + dm_vardata_t ds_attrcopy; +}; +typedef struct dm_destroy_event dm_destroy_event_t; + +/* Mount event message */ +struct dm_mount_event +{ + mode_t me_mode; + dm_vardata_t me_handle1; + dm_vardata_t me_handle2; + dm_vardata_t me_name1; + dm_vardata_t me_name2; + dm_vardata_t me_roothandle; +}; +typedef struct dm_mount_event dm_mount_event_t; + +/* Namespace event message */ +struct dm_namesp_event +{ + mode_t ne_mode; + dm_vardata_t ne_handle1; + dm_vardata_t ne_handle2; + dm_vardata_t ne_name1; + dm_vardata_t ne_name2; + int ne_retcode; +}; +typedef struct dm_namesp_event dm_namesp_event_t; + +/* Flags for the mode field of mount, preunmount and unmount event messages */ +#define DM_MOUNT_RDONLY (0x1) +#define DM_UNMOUNT_FORCE (0x2) +#define DM_LOCAL_MOUNT (0x4) /* GPFS specific - not in XDSM standard */ +#define DM_REMOTE_MOUNT (0x8) /* GPFS specific - not in XDSM standard */ + +struct dm_timestruct +{ + time_t dm_tv_sec; + dm_signed32 dm_tv_nsec; +}; +typedef struct dm_timestruct dm_timestruct_t; + +/* DMAPI file attributes */ +struct dm_fileattr +{ + mode_t fa_mode; + uid_t fa_uid; + gid_t fa_gid; + time_t fa_atime; + time_t fa_mtime; + time_t fa_ctime; + time_t fa_dtime; + dm_off_t fa_size; +}; +typedef struct dm_fileattr dm_fileattr_t; + +struct dm_fileattr32 +{ + mode_t fa_mode; + uid_t fa_uid; + gid_t fa_gid; + dm_signed32 fa_atime; + dm_signed32 fa_mtime; + dm_signed32 fa_ctime; + dm_signed32 fa_dtime; + dm_off_t fa_size; +}; +typedef struct dm_fileattr32 dm_fileattr32_t; + +struct dm_fileattr64 +{ + mode_t fa_mode; +#if defined(__sun) + u_int fa_uid; + u_int fa_gid; +#else + uid_t fa_uid; + gid_t fa_gid; +#endif + dm_signed32 fa_pad_to_dword; + dm_signed64 fa_atime; + dm_signed64 fa_mtime; + dm_signed64 fa_ctime; + dm_signed64 fa_dtime; + dm_off_t fa_size; +}; +typedef struct dm_fileattr64 dm_fileattr64_t; + +/* Message types for user events */ +typedef enum +{ + DM_MSGTYPE_INVALID, + DM_MSGTYPE_SYNC, + DM_MSGTYPE_ASYNC +} dm_msgtype_t; + +/* Region descriptor */ +struct dm_region +{ + dm_off_t rg_offset; + dm_size_t rg_size; + u_int rg_flags; + dm_signed32 rg_opaque; /* GPFS specific - not in XDSM standard */ +}; +typedef struct dm_region dm_region_t; + +#define DM_REGION_NOEVENT (0x0) +#define DM_REGION_READ (0x1) +#define DM_REGION_WRITE (0x2) +#define DM_REGION_TRUNCATE (0x4) +#define DM_REGION_DIRECT_READ (0x8) /* GPFS specific - read without recall */ + + +/* Responses for dm_respond_event() */ +typedef enum +{ + DM_RESP_INVALID, + DM_RESP_CONTINUE, + DM_RESP_ABORT, + DM_RESP_DONTCARE +} dm_response_t; + +/* Access rights */ +typedef enum +{ + DM_RIGHT_NULL, + DM_RIGHT_SHARED, + DM_RIGHT_EXCL +} dm_right_t; + +/* Status information */ +struct dm_stat +{ + dm_ssize_t _link; + dm_vardata_t dt_handle; + dm_vardata_t dt_compname; + dm_eventset_t dt_emask; + int dt_nevents; + int dt_pers; + int dt_pmanreg; + time_t dt_dtime; + u_int dt_change; + dev_t dt_dev; + dm_ino_t dt_ino; + mode_t dt_mode; + nlink_t dt_nlink; + uid_t dt_uid; + gid_t dt_gid; + dev_t dt_rdev; + dm_off_t dt_size; + time_t dt_atime; + time_t dt_mtime; + time_t dt_ctime; + u_int dt_blksize; + dm_size_t dt_blocks; + int dt_gpfsqa1; /* GPFS specific - not in XDSM standard */ + int dt_gpfsqa2; /* GPFS specific - not in XDSM standard */ + u_int dt_poolid; /* GPFS specific - not in XDSM standard */ + int dt_fopen; /* GPFS specific - not in XDSM standard */ +}; +typedef struct dm_stat dm_stat_t; + + +/* File attribute masks */ +#define DM_AT_ATIME (0x0001) +#define DM_AT_CFLAG (0x0002) +#define DM_AT_CTIME (0x0004) +#define DM_AT_DTIME (0x0008) +#define DM_AT_EMASK (0x0010) +#define DM_AT_GID (0x0020) +#define DM_AT_HANDLE (0x0040) +#define DM_AT_MODE (0x0080) +#define DM_AT_MTIME (0x0100) +#define DM_AT_PATTR (0x0200) +#define DM_AT_PMANR (0x0400) +#define DM_AT_SIZE (0x0800) +#define DM_AT_STAT (0x1000) +#define DM_AT_UID (0x2000) +#define DM_AT_FOPEN (0x4000) /* Is the file open elsewhere? + Only valid on dm_get_fileattr */ + +struct dm_xstat +{ + dm_ssize_t _link; + dm_stat_t dx_statinfo; + dm_vardata_t dx_attrdata; +}; +typedef struct dm_xstat dm_xstat_t; + + +/* Max size of a session label */ +#define DM_SESSION_INFO_LEN 256 + +/* Special session identifier */ +#define DM_NO_SESSION ((dm_sessid_t) 0) + +/* Flag indicating whether to wait in dm_get_events */ +#define DM_EV_WAIT (0x1) + +/* Flag indicating whether to wait in dm_request_right */ +#define DM_RR_WAIT (0x1) + +/* Flag indicating whether the request right call is from panache eviction */ +#define DM_PCACHE_EVICT (0x10) + +/* Special file handles */ +#define DM_GLOBAL_HANP ((void *)(size_t)0xFFFFFFFD) +#define DM_GLOBAL_HLEN ((size_t)0) + +#define DM_INVALID_HANP ((void *)(size_t)0xFFFFFFFF) +#define DM_INVALID_HLEN ((size_t)0) + +/* Special tokens */ +static const dm_token_t _dmNoToken = { 0, 0 }; +#define DM_NO_TOKEN _dmNoToken + +static const dm_token_t _dmInvalidToken = { 0, 1 }; +#define DM_INVALID_TOKEN _dmInvalidToken + +/* Flag for the dm_write_invis() call */ +#define DM_WRITE_SYNC (0x1) + +/* Version identifier + Warning: Do not change this version number unless coordinated with + external callers, for example TSM, of GPFS dmapi library. + */ +#define DM_VER_STR_CONTENTS "GPFS DMAPI 4.10" + +struct dm_inherit +{ + dm_attrname_t ih_name; + mode_t ih_filetype; +}; +typedef struct dm_inherit dm_inherit_t; + +#endif /* _DMAPI_TYPES_H */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/gpfs.h b/System/ior/files/gpfs/5.0.2-3/include/gpfs.h new file mode 100644 index 0000000..75ed4f3 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/gpfs.h @@ -0,0 +1,4047 @@ +/* */ +/* Copyright (C) 2001 International Business Machines */ +/* All rights reserved. */ +/* */ +/* This file is part of the GPFS user library. */ +/* */ +/* 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. */ +/* */ +/* @(#)42 1.1.2.212 src/avs/fs/mmfs/ts/util/gpfs.h, mmfs, avs_rtac502, rtac5021836a 8/23/18 07:58:19 */ +/* + * Library calls for GPFS interfaces + */ +#ifndef H_GPFS +#define H_GPFS + +#include + +/* Define GPFS_64BIT_INODES to map the default interface definitions + to 64-bit interfaces. Without this define, the 32-bit interface + is the default. Both interfaces are always present, but the + define sets the default. The actual mapping can be found near the + end of this header. */ +/* #define GPFS_64BIT_INODES 1 */ + +#define NFS_IP_SIZE 46 + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(WIN32) && defined(GPFSDLL) + + /* The following errno values either are missing from Windows errno.h or + have a conflicting value. Other errno values (e.g. EPERM) are okay. */ + #define GPFS_EALREADY 37 /* Operation already in progress */ + #define GPFS_EOPNOTSUPP 45 /* Operation not supported */ + #define GPFS_EDQUOT 69 /* Disk quota exceeded */ + #define GPFS_ESTALE 9 /* No file system (mapped to EBADF) */ + #define GPFS_EFORMAT 19 /* Unformatted media (mapped to ENODEV) */ + + /* specify the library calling convention */ + #define GPFS_API __stdcall + + /* On Windows, this is a HANDLE as returned by CreateFile() */ + typedef void* gpfs_file_t; + +#else /* not gpfs.dll on Windows */ + + #define GPFS_API + /* On UNIX systems, this is a file descriptor as returned by open() */ + typedef int gpfs_file_t; + +#endif + + +typedef unsigned int gpfs_uid_t; +typedef long long gpfs_off64_t; +typedef unsigned long long gpfs_uid64_t; + +typedef struct gpfs_timestruc +{ + unsigned int tv_sec; + unsigned int tv_nsec; +} gpfs_timestruc_t; + +typedef struct gpfs_timestruc64 +{ + long long tv_sec; + unsigned int tv_nsec; +} gpfs_timestruc64_t; + +#define GPFS_SLITE_SIZE_BIT 0x00000001 +#define GPFS_SLITE_BLKSIZE_BIT 0x00000002 +#define GPFS_SLITE_BLOCKS_BIT 0x00000004 +#define GPFS_SLITE_ATIME_BIT 0x00000010 +#define GPFS_SLITE_MTIME_BIT 0x00000020 +#define GPFS_SLITE_CTIME_BIT 0x00000040 +#define GPFS_SLITE_EXACT_BITS 0x00000077 + +/* Returns "1" if the attribute is requested to be accurate. + (On output, indicates the value returned in statbufP is accurate). */ +#define GPFS_SLITE(m) (0 == (m)) +#define GPFS_SLITE_SIZET(m) (0 != ((m) & GPFS_SLITE_SIZE_BIT)) +#define GPFS_SLITE_BLKSIZE(m) (0 != ((m) & GPFS_SLITE_BLKSIZE_BIT)) +#define GPFS_SLITE_BLOCKS(m) (0 != ((m) & GPFS_SLITE_BLOCKS_BIT)) +#define GPFS_SLITE_ATIME(m) (0 != ((m) & GPFS_SLITE_ATIME_BIT)) +#define GPFS_SLITE_MTIME(m) (0 != ((m) & GPFS_SLITE_MTIME_BIT)) +#define GPFS_SLITE_CTIME(m) (0 != ((m) & GPFS_SLITE_CTIME_BIT)) +#define GPFS_SLITE_EXACT(m) (GPFS_SLITE_EXACT_BITS == (m)) + +/* Sets the litemask bit indicating that the attribute should be accurate */ +#define GPFS_S_SLITE(m) (m) = 0 +#define GPFS_S_SLITE_SIZET(m) (m) |= GPFS_SLITE_SIZE_BIT +#define GPFS_S_SLITE_BLKSIZE(m) (m) |= GPFS_SLITE_BLKSIZE_BIT +#define GPFS_S_SLITE_BLOCKS(m) (m) |= GPFS_SLITE_BLOCKS_BIT +#define GPFS_S_SLITE_ATIME(m) (m) |= GPFS_SLITE_ATIME_BIT +#define GPFS_S_SLITE_MTIME(m) (m) |= GPFS_SLITE_MTIME_BIT +#define GPFS_S_SLITE_CTIME(m) (m) |= GPFS_SLITE_CTIME_BIT +#define GPFS_S_SLITE_EXACT(m) (m) |= GPFS_SLITE_EXACT_BITS + +#define GPFS_STATLITE 0 +#define GPFS_NOFOLLOW 1 + +/* Mapping of buffer for gpfs_getacl, gpfs_putacl. */ +typedef struct gpfs_opaque_acl +{ + int acl_buffer_len; /* INPUT: Total size of buffer (including this field). + OUTPUT: Actual size of the ACL information. */ + unsigned short acl_version; /* INPUT: Set to zero. + OUTPUT: Current version of the returned ACL. */ + unsigned char acl_type; /* INPUT: Type of ACL: access (1) or default (2). */ + char acl_var_data[1]; /* OUTPUT: Remainder of the ACL information. */ +} gpfs_opaque_acl_t; + +/* ACL types (acl_type field in gpfs_opaque_acl_t or gpfs_acl_t) */ +#define GPFS_ACL_TYPE_ACCESS 1 +#define GPFS_ACL_TYPE_DEFAULT 2 +#define GPFS_ACL_TYPE_NFS4 3 + +/* gpfs_getacl, gpfs_putacl flag indicating structures instead of the + opaque style data normally used. */ +#define GPFS_GETACL_STRUCT 0x00000020 +#define GPFS_PUTACL_STRUCT 0x00000020 + +/* gpfs_getacl, gpfs_putacl flag indicating smbd is the caller */ +#define GPFS_ACL_SAMBA 0x00000040 + +/* Defined values for gpfs_aclVersion_t */ +#define GPFS_ACL_VERSION_POSIX 1 +#define GPFS_ACL_VERSION_NFS4F 3 /* GPFS_ACL_VERSION_NFS4 plus V4FLAGS */ +#define GPFS_ACL_VERSION_NFS4 4 + +/* Values for gpfs_aclLevel_t */ +#define GPFS_ACL_LEVEL_BASE 0 /* compatible with all acl_version values */ +#define GPFS_ACL_LEVEL_V4FLAGS 1 /* requires GPFS_ACL_VERSION_NFS4 */ + +/* Values for gpfs_aceType_t (ACL_VERSION_POSIX) */ +#define GPFS_ACL_USER_OBJ 1 +#define GPFS_ACL_GROUP_OBJ 2 +#define GPFS_ACL_OTHER 3 +#define GPFS_ACL_MASK 4 +#define GPFS_ACL_USER 5 +#define GPFS_ACL_GROUP 6 + +/* Values for gpfs_acePerm_t (ACL_VERSION_POSIX) */ +#define ACL_PERM_EXECUTE 001 +#define ACL_PERM_WRITE 002 +#define ACL_PERM_READ 004 +#define ACL_PERM_CONTROL 010 + +/* Values for gpfs_aceType_t (ACL_VERSION_NFS4) */ +#define ACE4_TYPE_ALLOW 0 +#define ACE4_TYPE_DENY 1 +#define ACE4_TYPE_AUDIT 2 +#define ACE4_TYPE_ALARM 3 + +/* Values for gpfs_aceFlags_t (ACL_VERSION_NFS4) */ +#define ACE4_FLAG_FILE_INHERIT 0x00000001 +#define ACE4_FLAG_DIR_INHERIT 0x00000002 +#define ACE4_FLAG_NO_PROPAGATE 0x00000004 +#define ACE4_FLAG_INHERIT_ONLY 0x00000008 +#define ACE4_FLAG_SUCCESSFUL 0x00000010 +#define ACE4_FLAG_FAILED 0x00000020 +#define ACE4_FLAG_GROUP_ID 0x00000040 +#define ACE4_FLAG_INHERITED 0x00000080 + +/* GPFS-defined flags. Placed in a separate ACL field to avoid + ever running into newly defined NFSv4 flags. */ +#define ACE4_IFLAG_SPECIAL_ID 0x80000000 + +/* Values for gpfs_aceMask_t (ACL_VERSION_NFS4) */ +#define ACE4_MASK_READ 0x00000001 +#define ACE4_MASK_LIST_DIR 0x00000001 +#define ACE4_MASK_WRITE 0x00000002 +#define ACE4_MASK_ADD_FILE 0x00000002 +#define ACE4_MASK_APPEND 0x00000004 +#define ACE4_MASK_ADD_SUBDIR 0x00000004 +#define ACE4_MASK_READ_NAMED 0x00000008 +#define ACE4_MASK_WRITE_NAMED 0x00000010 +#define ACE4_MASK_EXECUTE 0x00000020 + +/* The rfc doesn't provide a mask equivalent to "search" ("x" on a + * directory in posix), but it also doesn't say that its EXECUTE + * is to have this dual use (even though it does so for other dual + * use permissions such as read/list. Going to make the assumption + * here that the EXECUTE bit has this dual meaning... otherwise + * we're left with no control over search. + */ +#define ACE4_MASK_SEARCH 0x00000020 + +#define ACE4_MASK_DELETE_CHILD 0x00000040 +#define ACE4_MASK_READ_ATTR 0x00000080 +#define ACE4_MASK_WRITE_ATTR 0x00000100 +#define ACE4_MASK_DELETE 0x00010000 +#define ACE4_MASK_READ_ACL 0x00020000 +#define ACE4_MASK_WRITE_ACL 0x00040000 +#define ACE4_MASK_WRITE_OWNER 0x00080000 +#define ACE4_MASK_SYNCHRONIZE 0x00100000 +#define ACE4_MASK_ALL 0x001f01ff + +/* Values for gpfs_uid_t (ACL_VERSION_NFS4) */ +#define ACE4_SPECIAL_OWNER 1 +#define ACE4_SPECIAL_GROUP 2 +#define ACE4_SPECIAL_EVERYONE 3 + +/* per-ACL flags imported from a Windows security descriptor object */ +#define ACL4_FLAG_OWNER_DEFAULTED 0x00000100 +#define ACL4_FLAG_GROUP_DEFAULTED 0x00000200 +#define ACL4_FLAG_DACL_PRESENT 0x00000400 +#define ACL4_FLAG_DACL_DEFAULTED 0x00000800 +#define ACL4_FLAG_SACL_PRESENT 0x00001000 +#define ACL4_FLAG_SACL_DEFAULTED 0x00002000 +#define ACL4_FLAG_DACL_UNTRUSTED 0x00004000 +#define ACL4_FLAG_SERVER_SECURITY 0x00008000 +#define ACL4_FLAG_DACL_AUTO_INHERIT_REQ 0x00010000 +#define ACL4_FLAG_SACL_AUTO_INHERIT_REQ 0x00020000 +#define ACL4_FLAG_DACL_AUTO_INHERITED 0x00040000 +#define ACL4_FLAG_SACL_AUTO_INHERITED 0x00080000 +#define ACL4_FLAG_DACL_PROTECTED 0x00100000 +#define ACL4_FLAG_SACL_PROTECTED 0x00200000 +#define ACL4_FLAG_RM_CONTROL_VALID 0x00400000 +#define ACL4_FLAG_NULL_DACL 0x00800000 +#define ACL4_FLAG_NULL_SACL 0x01000000 +#define ACL4_FLAG_VALID_FLAGS 0x01ffff00 + + +/* Externalized ACL defintions */ +typedef unsigned int gpfs_aclType_t; +typedef unsigned int gpfs_aclLen_t; +typedef unsigned int gpfs_aclLevel_t; +typedef unsigned int gpfs_aclVersion_t; +typedef unsigned int gpfs_aclCount_t; +typedef unsigned int gpfs_aclFlag_t; + +typedef unsigned int gpfs_aceType_t; +typedef unsigned int gpfs_aceFlags_t; +typedef unsigned int gpfs_acePerm_t; +typedef unsigned int gpfs_aceMask_t; + +/* A POSIX ACL Entry */ +typedef struct gpfs_ace_v1 +{ + gpfs_aceType_t ace_type; /* POSIX ACE type */ + gpfs_uid_t ace_who; /* uid/gid */ + gpfs_acePerm_t ace_perm; /* POSIX permissions */ +} gpfs_ace_v1_t; + +/* An NFSv4 ACL Entry */ +typedef struct gpfs_ace_v4 +{ + gpfs_aceType_t aceType; /* Allow or Deny */ + gpfs_aceFlags_t aceFlags; /* Inherit specifications, etc. */ + gpfs_aceFlags_t aceIFlags; /* GPFS Internal flags */ + gpfs_aceMask_t aceMask; /* NFSv4 mask specification */ + gpfs_uid_t aceWho; /* User/Group identification */ +} gpfs_ace_v4_t; + +/* when GPFS_ACL_VERSION_NFS4, and GPFS_ACL_LEVEL_V4FLAGS */ +typedef struct v4Level1_ext /* ACL extension */ +{ + gpfs_aclFlag_t acl_flags; /* per-ACL flags */ + gpfs_ace_v4_t ace_v4[1]; +} v4Level1_t; + +/* The GPFS ACL */ +typedef struct gpfs_acl +{ + gpfs_aclLen_t acl_len; /* Total length of this ACL in bytes */ + gpfs_aclLevel_t acl_level; /* Reserved (must be zero) */ + gpfs_aclVersion_t acl_version; /* POSIX or NFS4 ACL */ + gpfs_aclType_t acl_type; /* Access, Default, or NFS4 */ + gpfs_aclCount_t acl_nace; /* Number of Entries that follow */ + union + { + gpfs_ace_v1_t ace_v1[1]; /* when GPFS_ACL_VERSION_POSIX */ + gpfs_ace_v4_t ace_v4[1]; /* when GPFS_ACL_VERSION_NFS4 */ + v4Level1_t v4Level1; /* when GPFS_ACL_LEVEL_V4FLAGS */ + }; +} gpfs_acl_t; + + +/* NAME: gpfs_getacl() + * + * FUNCTION: Retrieves the ACL information for a file. + * + * The aclP parameter must point to a buffer mapped by either: + * - gpfs_opaque_acl_t (when flags are zero). In this case, + * the opaque data that is intended to be used by a backup + * program (restoreed by passing this data back on a subsequent + * call to gpfs_putacl). + * - gpfs_acl_t (when GPFS_GETACL_STRUCT is specified). In this + * case, the data can be interpreted by the calling application + * (and may be modified and applied to the file by passing it + * to gpfs_putacl...along with the GPFS_PUTACL_STRUCT flag). + * + * On input, the first four bytes of the buffer must contain its + * total size. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * ENOSPC buffer too small to return the entire ACL. + * Needed size is returned in the first four + * bytes of the buffer pointed to by aclP. + * EINVAL Invalid arguments + * ENOTDIR Not on directory + * ENOMEM Out of memory + */ +int GPFS_API +gpfs_getacl(const char *pathname, + int flags, + void *acl); + + +/* NAME: gpfs_putacl() + * + * FUNCTION: Sets the ACL information for a file. + * The buffer passed in should contain the ACL data + * that was obtained by a previous call to gpfs_getacl. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Invalid arguments + * ENOTDIR Not on directory + * ENOMEM Out of memory + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_putacl(const char *pathname, + int flags, + void *acl); + + +/* NAME: gpfs_prealloc() + * + * FUNCTION: Preallocate disk storage for a file or directory, starting + * at the specified startOffset and covering at least the number + * of bytes requested by bytesToPrealloc. Allocations are rounded + * to block boundaries (block size can be found in st_blksize + * returned by fstat()), or possibly larger sizes. For files, the + * file descriptor must be open for write, but any existing data + * already present will not be modified. Reading the preallocated + * blocks will return zeros. For directories, the file descriptor + * may be open for read but the caller must have write permission, + * and existing entries are unaffected; startOffset must be zero. + * + * This function implements the behavior of mmchattr when invoked + * with --compact[=minimumEntries]. The minimumEntries value + * specifies both the lower bound on automatic compaction and the + * desired size for pre-allocation. It defaults to zero, meaning + * no pre-allocation and compact the directory as much as + * possible. The mapping between minimumEntries and the + * bytesToPrealloc is given by GPFS_PREALLOC_DIR_SLOT_SIZE, see + * below. + * + * Directory compaction (zero bytesToPrealloc) requires a file + * system supporting V2 directories (format version 1400, v4.1). + * Directories created before upgrading the file system to version + * 4.1, are upgraded from V1 to V2 by this operation even if no + * other change is made. Since v4.2.2, bytesToPrealloc may be + * nonzero effecting pre-allocation by setting a minimum + * compaction size. Prior to v4.2.2 the minimum size of any + * directory is zero. + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS No prealloc service available + * EBADF Bad file descriptor + * EINVAL Not a GPFS file + * EINVAL Not a regular file or directory + * EINVAL Directory pre-allocation not supported + * EINVAL startOffset or bytesToPrealloc < 0 + * EACCES File not opened for writing + * EACCES Caller does not have write access to directory. + * EDQUOT Quota exceeded + * ENOSPC Not enough space on disk + * EPERM File is in a snapshot + */ +int GPFS_API +gpfs_prealloc(gpfs_file_t fileDesc, + gpfs_off64_t startOffset, + gpfs_off64_t bytesToPrealloc); + +/* Directory entries are nominally (assuming compact names of 19 bytes or less) + 32 bytes in size. This conversion factor is used in mapping between a + number of entries (for mmchattr) and a size when calling gpfs_prealloc. */ +#define GPFS_PREALLOC_DIR_SLOT_SIZE 32 /* for size => bytes per entry */ + + +typedef struct gpfs_winattr +{ + gpfs_timestruc_t creationTime; + unsigned int winAttrs; /* values as defined below */ +} gpfs_winattr_t; + +/* winAttrs values */ +#define GPFS_WINATTR_ARCHIVE 0x0001 +#define GPFS_WINATTR_COMPRESSED 0x0002 +#define GPFS_WINATTR_DEVICE 0x0004 +#define GPFS_WINATTR_DIRECTORY 0x0008 +#define GPFS_WINATTR_ENCRYPTED 0x0010 +#define GPFS_WINATTR_HIDDEN 0x0020 +#define GPFS_WINATTR_NORMAL 0x0040 +#define GPFS_WINATTR_NOT_CONTENT_INDEXED 0x0080 +#define GPFS_WINATTR_OFFLINE 0x0100 +#define GPFS_WINATTR_READONLY 0x0200 +#define GPFS_WINATTR_REPARSE_POINT 0x0400 +#define GPFS_WINATTR_SPARSE_FILE 0x0800 +#define GPFS_WINATTR_SYSTEM 0x1000 +#define GPFS_WINATTR_TEMPORARY 0x2000 +#define GPFS_WINATTR_HAS_STREAMS 0x4000 + + +/* NAME: gpfs_get_winattrs() + * gpfs_get_winattrs_path() + * + * FUNCTION: Returns gpfs_winattr_t attributes + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOENT file not found + * EBADF Bad file handle, not a GPFS file + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * EFAULT Bad address provided + * EINVAL Not a regular file + * ENOSYS function not available + */ +int GPFS_API +gpfs_get_winattrs(gpfs_file_t fileDesc, gpfs_winattr_t *attrP); + +int GPFS_API +gpfs_get_winattrs_path(const char *pathname, gpfs_winattr_t *attrP); + + +/* NAME: gpfs_set_winattrs() + * gpfs_set_winattrs_path() + * + * FUNCTION: Sets gpfs_winattr_t attributes (as specified by + * the flags). + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOENT file not found + * EBADF Bad file handle, not a GPFS file + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * EFAULT Bad address provided + * EINVAL Not a regular file + * ENOSYS function not available + */ +int GPFS_API +gpfs_set_winattrs(gpfs_file_t fileDesc, int flags, gpfs_winattr_t *attrP); + +int GPFS_API +gpfs_set_winattrs_path(const char *pathname, int flags, gpfs_winattr_t *attrP); + +/* gpfs_set_winattr flag values */ +#define GPFS_WINATTR_SET_CREATION_TIME 0x08 +#define GPFS_WINATTR_SET_ATTRS 0x10 + +/* + * NAME: gpfs_set_times(), gpfs_set_times_path() + * + * FUNCTION: Sets file access time, modified time, change time, + * and/or creation time (as specified by the flags). + * + * Input: flagsfileDesc : file descriptor of the object to set + * pathname : path to a file or directory + * flag : define time value to set + * GPFS_SET_ATIME - set access time + * GPFS_SET_MTIME - set mod. time + * GPFS_SET_CTIME - set change time + * GPFS_SET_CREATION_TIME - set creation time + * GPFS_SET_TIME_NO_FOLLOW - don't follow links + * times : array to times + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EBADF Not a GPFS File + * EINVAL invalid argument + * EACCES Permission denied + * EROFS Filesystem is read only + * ENOENT No such file or directory + */ +typedef gpfs_timestruc_t gpfs_times_vector_t[4]; + +int GPFS_API +gpfs_set_times(gpfs_file_t fileDesc, int flags, gpfs_times_vector_t times); + +int GPFS_API +gpfs_set_times_path(char *pathname, int flags, gpfs_times_vector_t times); + +/* gpfs_set_times flag values */ +#define GPFS_SET_ATIME 0x01 +#define GPFS_SET_MTIME 0x02 +#define GPFS_SET_CTIME 0x04 +#define GPFS_SET_CREATION_TIME 0x08 +#define GPFS_SET_TIME_NO_FOLLOW 0x10 + + +/* NAME: gpfs_set_share() + * + * FUNCTION: Acquire shares + * + * Input: fileDesc : file descriptor + * allow : share type being requested + * GPFS_SHARE_NONE, GPFS_SHARE_READ, + * GPFS_SHARE_WRITE, GPFS_SHARE_BOTH + * deny : share type to deny to others + * GPFS_DENY_NONE, GPFS_DENY_READ, + * GPFS_DENY_WRITE, GPFS_DENY_BOTH + * + * Returns: 0 Success + * -1 Failure + * + * Errno: EBADF Bad file handle + * EINVAL Bad argument given + * EFAULT Bad address provided + * ENOMEM Memory allocation failed + * EACCES share mode not available + * ENOSYS function not available + */ + +/* allow/deny specifications */ +#define GPFS_SHARE_NONE 0 +#define GPFS_SHARE_READ 1 +#define GPFS_SHARE_WRITE 2 +#define GPFS_SHARE_BOTH 3 +#define GPFS_SHARE_ALL 3 +#define GPFS_DENY_NONE 0 +#define GPFS_DENY_READ 1 +#define GPFS_DENY_WRITE 2 +#define GPFS_DENY_BOTH 3 +#define GPFS_DENY_DELETE 4 +#define GPFS_DENY_ALL 7 + +int GPFS_API +gpfs_set_share(gpfs_file_t fileDesc, + unsigned int share, + unsigned int deny); + + +/* NAME: gpfs_set_lease() + * + * FUNCTION: Acquire leases for Samba + * + * Input: fileDesc : file descriptor + * leaseType : lease type being requested + * GPFS_LEASE_NONE GPFS_LEASE_READ, + * GPFS_LEASE_WRITE + * + * Returns: 0 Success + * -1 Failure + * + * Errno: EBADF Bad file handle + * EINVAL Bad argument given + * EFAULT Bad address provided + * ENOMEM Memory allocation failed + * EAGAIN lease not available + * EACCES permission denied + * EOPNOTSUPP unsupported leaseType + * ESTALE unmounted file system + * ENOSYS function not available + */ + +/* leaseType specifications */ +#define GPFS_LEASE_NONE 0 +#define GPFS_LEASE_READ 1 +#define GPFS_LEASE_WRITE 2 + +int GPFS_API +gpfs_set_lease(gpfs_file_t fileDesc, + unsigned int leaseType); + + +/* NAME: gpfs_get_lease() + * + * FUNCTION: Returns the type of lease currently held + * + * Returns: GPFS_LEASE_READ + * GPFS_LEASE_WRITE + * GPFS_LEASE_NONE + * + * Returns: >= 0 Success + * -1 Failure + * + * Errno: EINVAL + */ +int GPFS_API +gpfs_get_lease(gpfs_file_t fileDesc); + + + /* NAME: gpfs_get_realfilename(), gpfs_get_realfilename_path() + * + * FUNCTION: Interface to get real name of a file. + * + * INPUT: File descriptor, pathname, buffer, bufferlength + * OUTPUT: Real file name stored in file system + * + * Returns: 0 Success + * -1 Failure + * + * Errno: EBADF Bad file handle + * EINVAL Not a regular file + * EFAULT Bad address provided + * ENOSPC buffer too small to return the real file name. + * Needed size is returned in buflen parameter. + * ENOENT File does not exist + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * ENOSYS function not available + */ +int GPFS_API +gpfs_get_realfilename(gpfs_file_t fileDesc, + char *fileNameP, + int *buflen); + +int GPFS_API +gpfs_get_realfilename_path(const char *pathname, + char *fileNameP, + int *buflen); + + /* NAME: gpfs_ftruncate() + * + * FUNCTION: Interface to truncate a file. + * + * INPUT: File descriptor + * length + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EBADF Bad file handle + * EBADF Not a GPFS file + * EINVAL Not a regular file + * ENOENT File does not exist + * ENOMEM Memory allocation failed + * EINVAL length < 0 + * EACCESS Permission denied + */ +int GPFS_API +gpfs_ftruncate(gpfs_file_t fileDesc, gpfs_off64_t length); + +#define GPFS_WIN_CIFS_REGISTERED 0x02000000 +typedef struct cifsThreadData_t +{ + unsigned int dataLength; /* Total buffer length */ + unsigned int share; /* gpfs_set_share declaration */ + unsigned int deny; /* gpfs_set_share specification */ + unsigned int lease; /* gpfs_set_lease lease type */ + unsigned int secInfoFlags; /* Future use. Must be zero */ + gpfs_uid_t sdUID; /* Owning user */ + gpfs_uid_t sdGID; /* Owning group */ + int shareLocked_fd; /* file descriptor with share locks */ + unsigned int aclLength ; /* Length of the following ACL */ + gpfs_acl_t acl; /* The initial ACL for create/mkdir */ +} cifsThreadData_t; + + /* NAME: gpfs_register_cifs_export() + * + * FUNCTION: Register a CIFS export process. + * + * INPUT: implicit use of the process ids + * + * Returns: 0 Successful + * ENOSYS function not available + * EACCES cannot establish credentials + * ENOMEM temporary shortage of memory + * EINVAL prior process/thread registrations exist + * EBADF unable to allocate a file descriptor + */ +int GPFS_API +gpfs_register_cifs_export(void); + + /* NAME: gpfs_unregister_cifs_export() + * + * FUNCTION: remove a registration for a CIFS export + * + * INPUT: implicit use of the process ids + * + * Returns: 0 Successful + * ENOSYS function not available + * EACCES cannot establish credentials + * ENOMEM temporary shortage of memory + */ +int GPFS_API +gpfs_unregister_cifs_export(void); + + /* NAME: gpfs_register_cifs_buffer() + * + * FUNCTION: Register a CIFS thread/buffer combination + * + * INPUT: implicit use of the process and thread ids + * Address of a cifsThreadData_t structure that will include + * a GPFS ACL (GPFS_ACL_VERSION_NFS4/GPFS_ACL_LEVEL_V4FLAGS) + * that can be applied at file/dir creation. + * + * Returns: 0 Successful + * ENOSYS function not available + * EACCES cannot establish credentials + * ENOMEM unable to allocate required memory + * EINVAL no associated process registrion exists + * bad dataLength in buffer. + */ +int GPFS_API +gpfs_register_cifs_buffer(cifsThreadData_t *bufP); + + /* NAME: gpfs_unregister_cifs_buffer() + * + * FUNCTION: remove a CIFS thread/buffer registration + * + * INPUT: implicit use of the process and thread ids + * + * Returns: 0 Successful + * ENOSYS function not available + * EACCES cannot establish credentials + * ENOMEM unable to allocate required memory + * EINVAL no associated process registrion exists + */ +int GPFS_API +gpfs_unregister_cifs_buffer(void); + +/* NAME: gpfs_lib_init() + * + * FUNCTION: Open GPFS main module device file + * + * INPUT: Flags + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + */ +int GPFS_API +gpfs_lib_init(int flags); + +/* NAME: gpfs_lib_term() + * + * FUNCTION: Close GPFS main module device file + * + * INPUT: Flags + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + */ +int GPFS_API +gpfs_lib_term(int flags); + +/* Define maximum length of the name for a GPFS named object, such + as a snapshot, storage pool or fileset. The name is a null-terminated + character string, which is not include in the max length */ +#define GPFS_MAXNAMLEN 255 + +/* Define maximum length of the path to a GPFS named object + such as a snapshot or fileset. If the absolute path name exceeds + this limit, then use a relative path name. The path is a null-terminated + character string, which is not included in the max length */ +#define GPFS_MAXPATHLEN 1023 + +/* ASCII code for "GPFS" in the struct statfs f_type field */ +#define GPFS_SUPER_MAGIC 0x47504653 + +/* GPFS inode attributes + gpfs_uid_t - defined above + gpfs_uid64_t - defined above + gpfs_off64_t - defined above + + gpfs_mode_t may include gpfs specific values including 0x02000000 + To have a gpfs_mode_t be equivalent to a mode_t mask that value out. + */ +typedef unsigned int gpfs_mode_t; +typedef unsigned int gpfs_gid_t; +typedef unsigned long long gpfs_gid64_t; +typedef unsigned int gpfs_ino_t; +typedef unsigned long long gpfs_ino64_t; +typedef unsigned int gpfs_gen_t; +typedef unsigned long long gpfs_gen64_t; +typedef unsigned int gpfs_dev_t; +typedef unsigned int gpfs_mask_t; +typedef unsigned int gpfs_pool_t; +typedef unsigned int gpfs_snapid_t; +typedef unsigned long long gpfs_snapid64_t; +typedef unsigned long long gpfs_fsid64_t[2]; +typedef short gpfs_nlink_t; +typedef long long gpfs_nlink64_t; + + +#if defined(WIN32) || defined(_MS_SUA_) + typedef struct gpfs_stat64 + { + gpfs_dev_t st_dev; /* id of device containing file */ + gpfs_ino64_t st_ino; /* file inode number */ + gpfs_mode_t st_mode; /* access mode */ + gpfs_nlink64_t st_nlink; /* number of links */ + unsigned int st_flags; /* flag word */ + gpfs_uid64_t st_uid; /* owner uid */ + gpfs_gid64_t st_gid; /* owner gid */ + gpfs_dev_t st_rdev; /* device id (if special file) */ + gpfs_off64_t st_size; /* file size in bytes */ + gpfs_timestruc64_t st_atime; /* time of last access */ + gpfs_timestruc64_t st_mtime; /* time of last data modification */ + gpfs_timestruc64_t st_ctime; /* time of last status change */ + int st_blksize; /* preferred block size for io */ + gpfs_off64_t st_blocks; /* 512 byte blocks of disk held by file */ + long long st_fsid; /* file system id */ + unsigned int st_type; /* file type */ + gpfs_gen64_t st_gen; /* inode generation number */ + gpfs_timestruc64_t st_createtime; /* time of creation */ + unsigned int st_attrs; /* Windows flags */ + } gpfs_stat64_t; +#else + typedef struct stat64 gpfs_stat64_t; +#endif + +#if defined(WIN32) || defined(_MS_SUA_) + typedef struct gpfs_statfs64 + { + gpfs_off64_t f_blocks; /* total data blocks in file system */ + gpfs_off64_t f_bfree; /* free block in fs */ + gpfs_off64_t f_bavail; /* free blocks avail to non-superuser */ + int f_bsize; /* optimal file system block size */ + gpfs_ino64_t f_files; /* total file nodes in file system */ + gpfs_ino64_t f_ffree; /* free file nodes in fs */ + gpfs_fsid64_t f_fsid; /* file system id */ + int f_fsize; /* fundamental file system block size */ + int f_sector_size; /* logical disk sector size */ + char f_fname[32]; /* file system name (usually mount pt.) */ + char f_fpack[32]; /* file system pack name */ + int f_name_max; /* maximum component name length for posix */ + } gpfs_statfs64_t; +#else + typedef struct statfs64 gpfs_statfs64_t; +#endif + +/* Declarations for backwards compatibility. */ +typedef gpfs_stat64_t stat64_t; +typedef gpfs_statfs64_t statfs64_t; + + +/* Define a version number for the directory entry data to allow + future changes in this structure. Careful callers should also use + the d_reclen field for the size of the structure rather than sizeof, + to allow some degree of forward compatibility */ +#define GPFS_D_VERSION 1 + +typedef struct gpfs_direntx +{ + int d_version; /* this struct's version */ + unsigned short d_reclen; /* actual size of this struct including + null terminated variable length d_name */ + unsigned short d_type; /* Types are defined below */ + gpfs_ino_t d_ino; /* File inode number */ + gpfs_gen_t d_gen; /* Generation number for the inode */ + char d_name[256]; /* null terminated variable length name */ +} gpfs_direntx_t; + + +#define GPFS_D64_VERSION 2 + +typedef struct gpfs_direntx64 +{ + int d_version; /* this struct's version */ + unsigned short d_reclen; /* actual size of this struct including + null terminated variable length d_name */ + unsigned short d_type; /* Types are defined below */ + gpfs_ino64_t d_ino; /* File inode number */ + gpfs_gen64_t d_gen; /* Generation number for the inode */ + unsigned int d_flags; /* Flags are defined below */ + char d_name[1028]; /* null terminated variable length name */ + /* (1020+null+7 byte pad to double word) */ + /* to handle up to 255 UTF-8 chars */ +} gpfs_direntx64_t; + +/* File types for d_type field in gpfs_direntx_t */ +#define GPFS_DE_OTHER 0 +#define GPFS_DE_FIFO 1 +#define GPFS_DE_CHR 2 +#define GPFS_DE_DIR 4 +#define GPFS_DE_BLK 6 +#define GPFS_DE_REG 8 +#define GPFS_DE_LNK 10 +#define GPFS_DE_SOCK 12 +#define GPFS_DE_DEL 16 + +/* Define flags for gpfs_direntx64_t */ +#define GPFS_DEFLAG_NONE 0x0000 /* Default value, no flags set */ +#define GPFS_DEFLAG_JUNCTION 0x0001 /* DirEnt is a fileset junction */ +#define GPFS_DEFLAG_IJUNCTION 0x0002 /* DirEnt is a inode space junction */ +#define GPFS_DEFLAG_ORPHAN 0x0004 /* DirEnt is an orphan (pcache) */ +#define GPFS_DEFLAG_CLONE 0x0008 /* DirEnt is a clone child */ + +/* Define a version number for the iattr data to allow future changes + in this structure. Careful callers should also use the ia_reclen field + for the size of the structure rather than sizeof, to allow some degree + of forward compatibility */ +#define GPFS_IA_VERSION 1 +#define GPFS_IA64_VERSION 3 /* ver 3 adds ia_repl_xxxx bytes instead of ia_pad2 */ +#define GPFS_IA64_RESERVED 4 +#define GPFS_IA64_UNUSED 8 + +typedef struct gpfs_iattr +{ + int ia_version; /* this struct version */ + int ia_reclen; /* sizeof this structure */ + int ia_checksum; /* validity check on iattr struct */ + gpfs_mode_t ia_mode; /* access mode; see gpfs_mode_t comment */ + gpfs_uid_t ia_uid; /* owner uid */ + gpfs_gid_t ia_gid; /* owner gid */ + gpfs_ino_t ia_inode; /* file inode number */ + gpfs_gen_t ia_gen; /* inode generation number */ + gpfs_nlink_t ia_nlink; /* number of links */ + short ia_flags; /* Flags (defined below) */ + int ia_blocksize; /* preferred block size for io */ + gpfs_mask_t ia_mask; /* Initial attribute mask (not used) */ + unsigned int ia_pad1; /* reserved space */ + gpfs_off64_t ia_size; /* file size in bytes */ + gpfs_off64_t ia_blocks; /* 512 byte blocks of disk held by file */ + gpfs_timestruc_t ia_atime; /* time of last access */ + gpfs_timestruc_t ia_mtime; /* time of last data modification */ + gpfs_timestruc_t ia_ctime; /* time of last status change */ + gpfs_dev_t ia_rdev; /* id of device */ + unsigned int ia_xperm; /* extended attributes (defined below) */ + unsigned int ia_modsnapid; /* snapshot id of last modification */ + unsigned int ia_filesetid; /* fileset ID */ + unsigned int ia_datapoolid; /* storage pool ID for data */ + unsigned int ia_pad2; /* reserved space */ +} gpfs_iattr_t; + + +typedef struct gpfs_iattr64 +{ + int ia_version; /* this struct version */ + int ia_reclen; /* sizeof this structure */ + int ia_checksum; /* validity check on iattr struct */ + gpfs_mode_t ia_mode; /* access mode; see gpfs_mode_t comment */ + gpfs_uid64_t ia_uid; /* owner uid */ + gpfs_gid64_t ia_gid; /* owner gid */ + gpfs_ino64_t ia_inode; /* file inode number */ + gpfs_gen64_t ia_gen; /* inode generation number */ + gpfs_nlink64_t ia_nlink; /* number of links */ + gpfs_off64_t ia_size; /* file size in bytes */ + gpfs_off64_t ia_blocks; /* 512 byte blocks of disk held by file */ + gpfs_timestruc64_t ia_atime; /* time of last access */ + unsigned int ia_winflags; /* windows flags (defined below) */ + unsigned int ia_pad1; /* reserved space */ + gpfs_timestruc64_t ia_mtime; /* time of last data modification */ + unsigned int ia_flags; /* flags (defined below) */ + /* next four bytes were ia_pad2 */ + unsigned char ia_repl_data; /* data replication factor */ + unsigned char ia_repl_data_max; /* data replication max factor */ + unsigned char ia_repl_meta; /* meta data replication factor */ + unsigned char ia_repl_meta_max; /* meta data replication max factor */ + gpfs_timestruc64_t ia_ctime; /* time of last status change */ + int ia_blocksize; /* preferred block size for io */ + unsigned int ia_pad3; /* reserved space */ + gpfs_timestruc64_t ia_createtime; /* creation time */ + gpfs_mask_t ia_mask; /* initial attribute mask (not used) */ + int ia_pad4; /* reserved space */ + unsigned int ia_reserved[GPFS_IA64_RESERVED]; /* reserved space */ + unsigned int ia_xperm; /* extended attributes (defined below) */ + gpfs_dev_t ia_dev; /* id of device containing file */ + gpfs_dev_t ia_rdev; /* device id (if special file) */ + unsigned int ia_pcacheflags; /* pcache inode bits */ + gpfs_snapid64_t ia_modsnapid; /* snapshot id of last modification */ + unsigned int ia_filesetid; /* fileset ID */ + unsigned int ia_datapoolid; /* storage pool ID for data */ + gpfs_ino64_t ia_inode_space_mask; /* inode space mask of this file system */ + /* This value is saved in the iattr structure + during backup and used during restore */ + gpfs_off64_t ia_dirminsize; /* dir pre-allocation size in bytes */ + unsigned int ia_unused[GPFS_IA64_UNUSED]; /* reserved space */ +} gpfs_iattr64_t; + +/* Define flags for inode attributes */ +#define GPFS_IAFLAG_SNAPDIR 0x0001 /* (obsolete) */ +#define GPFS_IAFLAG_USRQUOTA 0x0002 /* inode is a user quota file */ +#define GPFS_IAFLAG_GRPQUOTA 0x0004 /* inode is a group quota file */ +#define GPFS_IAFLAG_ERROR 0x0008 /* error reading inode */ +/* Define flags for inode replication attributes */ +#define GPFS_IAFLAG_FILESET_ROOT 0x0010 /* root dir of a fileset */ +#define GPFS_IAFLAG_NO_SNAP_RESTORE 0x0020 /* don't restore from snapshots */ +#define GPFS_IAFLAG_FILESETQUOTA 0x0040 /* inode is a fileset quota file */ +#define GPFS_IAFLAG_COMANAGED 0x0080 /* file data is co-managed */ +#define GPFS_IAFLAG_ILLPLACED 0x0100 /* may not be properly placed */ +#define GPFS_IAFLAG_REPLMETA 0x0200 /* metadata replication set */ +#define GPFS_IAFLAG_REPLDATA 0x0400 /* data replication set */ +#define GPFS_IAFLAG_EXPOSED 0x0800 /* may have data on suspended disks */ +#define GPFS_IAFLAG_ILLREPLICATED 0x1000 /* may not be properly replicated */ +#define GPFS_IAFLAG_UNBALANCED 0x2000 /* may not be properly balanced */ +#define GPFS_IAFLAG_DATAUPDATEMISS 0x4000 /* has stale data blocks on + unavailable disk */ +#define GPFS_IAFLAG_METAUPDATEMISS 0x8000 /* has stale metadata on + unavailable disk */ + +#define GPFS_IAFLAG_IMMUTABLE 0x00010000 /* Immutability */ +#define GPFS_IAFLAG_INDEFRETENT 0x00020000 /* Indefinite retention */ +#define GPFS_IAFLAG_SECUREDELETE 0x00040000 /* Secure deletion */ + +#define GPFS_IAFLAG_TRUNCMANAGED 0x00080000 /* dmapi truncate event enabled */ +#define GPFS_IAFLAG_READMANAGED 0x00100000 /* dmapi read event enabled */ +#define GPFS_IAFLAG_WRITEMANAGED 0x00200000 /* dmapi write event enabled */ + +#define GPFS_IAFLAG_APPENDONLY 0x00400000 /* AppendOnly only */ +#define GPFS_IAFLAG_DELETED 0x00800000 /* inode has been deleted */ +#ifdef ZIP +#define GPFS_IAFLAG_ILLCOMPRESSED 0x01000000 /* may not be properly compressed */ +#endif +#define GPFS_IAFLAG_FPOILLPLACED 0x02000000 /* may not be properly placed per + FPO attributes (bgf, wad, wadfg) */ + +/* Define flags for window's attributes */ +#define GPFS_IWINFLAG_ARCHIVE 0x0001 /* Archive */ +#define GPFS_IWINFLAG_HIDDEN 0x0002 /* Hidden */ +#define GPFS_IWINFLAG_NOTINDEXED 0x0004 /* Not content indexed */ +#define GPFS_IWINFLAG_OFFLINE 0x0008 /* Off-line */ +#define GPFS_IWINFLAG_READONLY 0x0010 /* Read-only */ +#define GPFS_IWINFLAG_REPARSE 0x0020 /* Reparse point */ +#define GPFS_IWINFLAG_SYSTEM 0x0040 /* System */ +#define GPFS_IWINFLAG_TEMPORARY 0x0080 /* Temporary */ +#define GPFS_IWINFLAG_COMPRESSED 0x0100 /* Compressed */ +#define GPFS_IWINFLAG_ENCRYPTED 0x0200 /* Encrypted */ +#define GPFS_IWINFLAG_SPARSE 0x0400 /* Sparse file */ +#define GPFS_IWINFLAG_HASSTREAMS 0x0800 /* Has streams */ + +/* Define flags for extended attributes */ +#define GPFS_IAXPERM_ACL 0x0001 /* file has acls */ +#define GPFS_IAXPERM_XATTR 0x0002 /* file has extended attributes */ +#define GPFS_IAXPERM_DMATTR 0x0004 /* file has dm attributes */ +#define GPFS_IAXPERM_DOSATTR 0x0008 /* file has non-default dos attrs */ +#define GPFS_IAXPERM_RPATTR 0x0010 /* file has restore policy attrs */ + +/* Define flags for pcache bits defined in the inode */ +#define GPFS_ICAFLAG_CACHED 0x0001 /* "cached complete" */ +#define GPFS_ICAFLAG_CREATE 0x0002 /* "created" */ +#define GPFS_ICAFLAG_DIRTY 0x0004 /* "data dirty" */ +#define GPFS_ICAFLAG_LINK 0x0008 /* "hard linked" */ +#define GPFS_ICAFLAG_SETATTR 0x0010 /* "attr changed" */ +#define GPFS_ICAFLAG_LOCAL 0x0020 /* "local" */ +#define GPFS_ICAFLAG_APPEND 0x0040 /* "append" */ +#define GPFS_ICAFLAG_STATE 0x0080 /* "has remote state" */ + +/* Define pointers to interface types */ +typedef struct gpfs_fssnap_handle gpfs_fssnap_handle_t; +typedef struct gpfs_iscan gpfs_iscan_t; +typedef struct gpfs_ifile gpfs_ifile_t; +typedef struct gpfs_restore gpfs_restore_t; + +typedef struct gpfs_fssnap_id +{ + char opaque[48]; +} gpfs_fssnap_id_t; + + +/* Define extended return codes for gpfs backup & restore + calls without an explicit return code will return the value in errno */ +#define GPFS_NEW_ERRNO_BASE 185 +#define GPFS_E_INVAL_INUM (GPFS_NEW_ERRNO_BASE+0) /* invalid inode number */ + +#define GPFS_ERRNO_BASE 190 +#define GPFS_E_INVAL_FSSNAPID (GPFS_ERRNO_BASE+0) /* invalid fssnap id */ +#define GPFS_E_INVAL_ISCAN (GPFS_ERRNO_BASE+1) /* invalid iscan pointer */ +#define GPFS_E_INVAL_IFILE (GPFS_ERRNO_BASE+2) /* invalid ifile pointer */ +#define GPFS_E_INVAL_IATTR (GPFS_ERRNO_BASE+3) /* invalid iattr structure */ +#define GPFS_E_INVAL_RESTORE (GPFS_ERRNO_BASE+4) /* invalid restore pointer */ +#define GPFS_E_INVAL_FSSNAPHANDLE (GPFS_ERRNO_BASE+5) /* invalid fssnap handle */ +#define GPFS_E_INVAL_SNAPNAME (GPFS_ERRNO_BASE+6) /* invalid snapshot name */ +#define GPFS_E_FS_NOT_RESTORABLE (GPFS_ERRNO_BASE+7) /* FS is not clean */ +#define GPFS_E_RESTORE_NOT_ENABLED (GPFS_ERRNO_BASE+8) /* Restore was not enabled */ +#define GPFS_E_RESTORE_STARTED (GPFS_ERRNO_BASE+9) /* Restore is running */ +#define GPFS_E_INVAL_XATTR (GPFS_ERRNO_BASE+10) /* invalid extended + attribute pointer */ + +/* Define flags parameter for get/put file attributes. + Used by gpfs_fgetattr, gpfs_fputattr, gpfs_fputattrwithpath + gpfs_igetattrsx, gpfs_iputattrsx + and gpfs_lwe_getattrs, gpfs_lwe_putattrs +*/ +#define GPFS_ATTRFLAG_DEFAULT 0x0000 /* default behavior */ +#define GPFS_ATTRFLAG_NO_PLACEMENT 0x0001 /* exclude file placement attributes */ +#define GPFS_ATTRFLAG_IGNORE_POOL 0x0002 /* saved poolid is not valid */ +#define GPFS_ATTRFLAG_USE_POLICY 0x0004 /* use restore policy rules to + determine poolid */ +#define GPFS_ATTRFLAG_INCL_DMAPI 0x0008 /* Include dmapi attributes */ +#define GPFS_ATTRFLAG_FINALIZE_ATTRS 0x0010 /* Finalize immutability attributes */ +#define GPFS_ATTRFLAG_SKIP_IMMUTABLE 0x0020 /* Skip immutable attributes */ +#define GPFS_ATTRFLAG_INCL_ENCR 0x0040 /* Include encryption attributes */ +#define GPFS_ATTRFLAG_SKIP_CLONE 0x0080 /* Skip clone attributes */ +#define GPFS_ATTRFLAG_MODIFY_CLONEPARENT 0x0100 /* Allow modification on clone parent */ +#ifdef ZIP +#define GPFS_ATTRFLAG_NO_COMPRESSED 0x0200 /* exclude "compressed" attribute */ +#endif + +/* Define structure used by gpfs_statfspool */ +typedef struct gpfs_statfspool_s +{ + gpfs_off64_t f_blocks; /* total data blocks in pool */ + gpfs_off64_t f_bfree; /* free blocks in pool */ + gpfs_off64_t f_bavail; /* free blocks avail to non-superuser */ + gpfs_off64_t f_mblocks; /* total metadata blocks in pool */ + gpfs_off64_t 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 */ + gpfs_pool_t 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_replica; /* replica */ + int f_bgf; /* block group factor */ + int f_wad; /* write affinity depth */ + int f_allowWriteAffinity; /* allow write affinity depth. 1 means yes */ + int f_reserved[3];/* Current unused and set to zero */ +} gpfs_statfspool_t; + +#define STATFSPOOL_USAGE_DATA 0x0001 /* Pool stores user data */ +#define STATFSPOOL_USAGE_METADATA 0x0002 /* Pool stores system metadata */ + + +/* NAME: gpfs_fstat(), gpfs_stat() + * + * FUNCTION: Get exact stat information for a file descriptor (or filename). + * Forces all other nodes to flush dirty data and metadata to disk. + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS The gpfs_fstat() (or) gpfs_stat() subroutine is not supported + * under the current file system format + * EBADF The file descriptor is not valid. + * EINVAL The file descriptor does not refer to a GPFS file or a + * regular file. + * ESTALE The cached file system information was not valid. + */ +int GPFS_API +gpfs_fstat(gpfs_file_t fileDesc, + gpfs_stat64_t *buffer); + +int GPFS_API +gpfs_stat(const char *pathname, /* File pathname */ + gpfs_stat64_t *buffer); + +/* NAME: gpfs_fstat_x(), gpfs_stat_x() + * + * FUNCTION: Returns extended stat() information with specified accuracy + * for a file descriptor (or filename) + * + * Input: fileDesc : file descriptor or handle + * pathname : path to a file or directory + * iattrBufLen : length of iattr buffer + * + * In/Out: st_litemaskP: bitmask specification of required accuracy + * iattr : buffer for returned stat information + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * ENOENT invalid pathname + * EBADF Bad file desc + * EINVAL Not a GPFS file + * ESTALE cached fs information was invalid + */ +int GPFS_API +gpfs_fstat_x(gpfs_file_t fileDesc, + unsigned int *st_litemaskP, + gpfs_iattr64_t *iattr, + size_t iattrBufLen); + +int GPFS_API +gpfs_stat_x(const char *pathname, /* File pathname */ + unsigned int *st_litemaskP, + gpfs_iattr64_t *iattr, + size_t iattrBufLen); + +/* NAME: gpfs_statfs64() + * + * FUNCTION: Get information about the file system. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EBADF Bad file desc + * EINVAL Not a GPFS file + * ESTALE cached fs information was invalid + */ +int GPFS_API +gpfs_statfs64(const char *pathname, /* File pathname */ + gpfs_statfs64_t *buffer); + +/* NAME: gpfs_statlite() + * gpfs_lstatlite() - do not follow a symlink at the end of the path + * + * FUNCTION: Returns stat() information with specified accuracy + * + * Input: pathname : path to a file or directory + * + * In/Out: st_litemaskP: bitmask specification of required accuracy + * statbufP : buffer for returned stat information + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: Specific error indication + * EINVAL + * + */ +int GPFS_API +gpfs_statlite(const char *pathname, + unsigned int *st_litemaskP, + gpfs_stat64_t *statbufP); + +int GPFS_API +gpfs_lstatlite(const char *pathname, + unsigned int *st_litemaskP, + gpfs_stat64_t *statbufP); + + +/* NAME: gpfs_fgetattrs() + * + * FUNCTION: Retrieves all extended file attributes in opaque format. + * This function together with gpfs_fputattrs is intended for + * use by a backup program to save (gpfs_fgetattrs) and + * restore (gpfs_fputattrs) all extended file attributes + * (ACLs, user attributes, ...) in one call. + * + * NOTE: This call does not return extended attributes used for + * the Data Storage Management (XDSM) API (aka DMAPI). + * + * Input: flags Define behavior of get attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement + * are not saved, neither is the current storage pool. + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement + * are saved, but the current storage pool is not. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL invalid flags provided + * ENOSPC buffer too small to return all attributes + * *attrSizeP will be set to the size necessary + */ +int GPFS_API +gpfs_fgetattrs(gpfs_file_t fileDesc, + int flags, + void *bufferP, + int bufferSize, + int *attrSizeP); + + +/* NAME: gpfs_fputattrs() + * + * FUNCTION: Sets all extended file attributes of a file + * and sets the file's storage pool and data replication + * to the values saved in the extended attributes. + * + * If the saved storage pool is not valid or if the IGNORE_POOL + * flag is set, then it will select the storage pool by matching + * a PLACEMENT rule using the saved file attributes. + * If it fails to match a placement rule or if there are + * no placement rules installed it will assign the file + * to the "system" storage pool. + * + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_fgetattrs. + * + * Input: flags Define behavior of put attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored + * but the storage pool and data replication are unchanged + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a placement rule + * instead of restoring the saved storage pool. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL the buffer does not contain valid attribute data + * EINVAL invalid flags provided + */ +int GPFS_API +gpfs_fputattrs(gpfs_file_t fileDesc, + int flags, + void *bufferP); + + +/* NAME: gpfs_fputattrswithpathname() + * + * FUNCTION: Sets all extended file attributes of a file and invokes + * the policy engine to match a RESTORE rule using the file's + * attributes saved in the extended attributes to set the + * file's storage pool and data replication. The caller should + * include the full path to the file, including the file name, + * to allow rule selection based on file name or path. + * + * If the file fails to match a RESTORE rule, or if there are + * no RESTORE rules installed, then the storage pool and data + * replication are selected as when calling gpfs_fputattrs(). + * + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_fgetattrs. + * + * pathName is a UTF-8 encoded string. On Windows, applications + * can convert UTF-16 ("Unicode") to UTF-8 using the platforms + * WideCharToMultiByte function. + * + * + * Input: flags Define behavior of put attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored + * but the storage pool and data replication are unchanged + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored + * but if the file fails to match a RESTORE rule, it + * ignore the saved storage pool and select a pool + * by matching the saved attributes to a PLACEMENT rule. + * GPFS_ATTRFLAG_SKIP_IMMUTABLE - Skip immutable/appendOnly flags + * before restoring file data. Then use GPFS_ATTRFLAG_FINALIZE_ATTRS + * to restore immutable/appendOnly flags after data is restored. + * GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored + * after data is retored. If file is immutable/appendOnly + * call without this flag before restoring data + * then call with this flag after restoring data + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL the buffer does not contain valid attribute data + * ENOENT invalid pathname + * EINVAL invalid flags provided + */ +int GPFS_API +gpfs_fputattrswithpathname(gpfs_file_t fileDesc, + int flags, + void *bufferP, + const char *pathName); + + +/* NAME: gpfs_get_fssnaphandle_by_path() + * + * FUNCTION: Get a volatile handle to uniquely identify a file system + * and snapshot by the path to the file system and snapshot + * + * Input: pathName: path to a file or directory in a gpfs file system + * or to one of its snapshots + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * ENOENT invalid pathname + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fssnaphandle_by_path(const char *pathName); + + +/* NAME: gpfs_get_fssnaphandle_by_name() + * + * FUNCTION: Get a volatile handle to uniquely identify a file system + * and snapshot by the file system name and snapshot name. + * + * Input: fsName: unique name for gpfs file system (may be specified + * as fsName or /dev/fsName) + * snapName: name for snapshot within that file system + * or NULL to access the active file system rather + * than a snapshot within the file system. + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOENT invalid file system name + * GPFS_E_INVAL_SNAPNAME invalid snapshot name + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fssnaphandle_by_name(const char *fsName, + const char *snapName); + + +/* NAME: gpfs_get_fssnaphandle_by_fssnapid() + * + * FUNCTION: Get a volatile handle to uniquely identify a file system + * and snapshot by a fssnapId created from a previous handle. + * + * Input: fssnapId: unique id for a file system and snapshot + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPID invalid snapshot id + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fssnaphandle_by_fssnapid(const gpfs_fssnap_id_t *fssnapId); + +/* NAME: gpfs_get_fset_snaphandle_by_path() + * + * FUNCTION: Get a volatile handle to uniquely identify an inode space within a + * filesyetsm and snapshot by the path to the file system and snapshot. + * + * Input: pathName: path to a file or directory in a gpfs file system + * or to one of its snapshots + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * ENOENT invalid pathname + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fset_snaphandle_by_path(const char *pathName); + +/* NAME: gpfs_get_fset_snaphandle_by_name() + * + * FUNCTION: Get a volatile handle to uniquely identify an inode space within a + * file system and snapshot by the independent fileset name, file system + * name and snapshot name. + * + * Input: fsName: unique name for gpfs file system (may be specified + * as fsName or /dev/fsName) + * fsetName name of the independent fileset that owns the inode space + * snapName: name for snapshot within that file system + * or NULL to access the active file system rather + * than a snapshot within the file system. + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOENT invalid file system name + * GPFS_E_INVAL_FSETNAME invalid fset nsmae + * GPFS_E_INVAL_SNAPNAME invalid snapshot name + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fset_snaphandle_by_name(const char *fsName, + const char *fsetName, + const char *snapName); + +/* NAME: gpfs_get_fset_snaphandle_by_fset_snapid() + * + * FUNCTION: Get a volatile handle to uniquely identify a file system + * and snapshot by a fssnapId created from a previous handle. + * + * Input: fssnapId: unique id for a file system and snapshot + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPID invalid snapshot id + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fset_snaphandle_by_fset_snapid(const gpfs_fssnap_id_t *fsetsnapId); + +/* NAME: gpfs_get_pathname_from_fssnaphandle() + * + * FUNCTION: Get the mountpoint and path to a file system + * and snapshot identified by a fssnapHandle + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: ptr to path name to the file system (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + */ +const char * GPFS_API +gpfs_get_pathname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_get_fsname_from_fssnaphandle() + * + * FUNCTION: Get the unique name for the file system + * identified by a fssnapHandle + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: ptr to name of the file system (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + */ +const char * GPFS_API +gpfs_get_fsname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_get_snapname_from_fssnaphandle() + * + * FUNCTION: Get the name for the snapshot + * uniquely identified by a fssnapHandle + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: ptr to name assigned to the snapshot (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * GPFS_E_INVAL_SNAPNAME snapshot has been deleted + * + * Notes: If the snapshot has been deleted from the file system + * the snapId may still be valid, but the call will fail + * with errno set to GPFS_E_INVAL_SNAPNAME. + */ +const char * GPFS_API +gpfs_get_snapname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_get_snapid_from_fssnaphandle() + * + * FUNCTION: Get the numeric id for the snapshot identified + * by a fssnapHandle. The snapshots define an ordered + * sequence of changes to each file. The file's iattr + * structure defines the snapshot id in which the file + * was last modified (ia_modsnapid). This numeric value + * can be compared to the numeric snapid from a fssnaphandle + * to determine if the file changed before or after the + * snapshot identified by the fssnaphandle. + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: Numeric id for the snapshot referred to by the fssnaphandle + * 0 if the fssnaphandle does not refer to a snapshot + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * + * Notes: The snapshot need not be on-line to determine the + * snapshot's numeric id. + */ +gpfs_snapid_t GPFS_API +gpfs_get_snapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + +gpfs_snapid64_t GPFS_API +gpfs_get_snapid_from_fssnaphandle64(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_get_fssnapid_from_fssnaphandle() + * + * FUNCTION: Get a unique, non-volatile file system and snapshot id + * for the file system and snapshot identified by a + * volatile fssnap handle. + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * fssnapId: returned fssnapId uniquely identifying the + * file system and snapshot being scanned + * + * Returns: 0 and fssnapId is set with id (Successful) + * -1 and errno is set (Failure) + * + * Errno: GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * EINVAL null ptr given for returned fssnapId + * EFAULT size mismatch for fssnapId + */ +int GPFS_API +gpfs_get_fssnapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_fssnap_id_t *fssnapId); + + +/* NAME: gpfs_get_restore_fssnapid_from_fssnaphandle() + * + * FUNCTION: Get the unique, non-volatile file system and snapshot id + * used for the last complete restore of a mirrored file + * system. The file system must been a previous restore + * target and ready for additional incremental restore. + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * fssnapId: returned fssnapId uniquely identifying the + * last complete restored file system. + * + * Returns: 0 and fssnapId is set with id (Successful) + * -1 and errno is set (Failure) + * + * Errno: GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * EINVAL null ptr given for returned fssnapId + * EFAULT size mismatch for fssnapId + * EPERM caller must have superuser privilege + * ENOMEM unable to allocate memory for request + * GPFS_E_FS_NOT_RESTORABLE fs is not clean for restore + */ +int GPFS_API +gpfs_get_restore_fssnapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_fssnap_id_t *fssnapId); + +/* NAME: gpfs_free_fssnaphandle() + * + * FUNCTION: Free a fssnapHandle + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: void + * + * Errno: None + */ +void GPFS_API +gpfs_free_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + +/* NAME: gpfs_get_snapdirname() + * + * FUNCTION: Get the name of the directory containing snapshots. + * + * Input: fssnapHandle: handle for the file system + * snapdirName: buffer into which the name of the snapshot + * directory will be copied + * bufLen: the size of the provided buffer + * + * Returns: 0 (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid + * E2BIG buffer too small to return the snapshot directory name + */ +int GPFS_API +gpfs_get_snapdirname(gpfs_fssnap_handle_t *fssnapHandle, + char *snapdirName, + int bufLen); + + +/* NAME: gpfs_open_inodescan() + * + * FUNCTION: Open inode file for inode scan. + * + * Input: fssnapHandle: handle for file system and snapshot + * to be scanned + * prev_fssnapId: + * if NULL, all inodes of existing file will be returned; + * if non-null, only returns inodes of files that have changed + * since the specified previous snapshot; + * if specifies the same snapshot as the one referred by + * fssnapHandle, only the snapshot inodes that have been + * copied into this snap inode file are returned; + * maxIno: if non-null, returns the maximum inode number + * available in the inode file being scanned. + * + * Returns: pointer to gpfs_iscan_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL bad parameters + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid + * GPFS_E_INVAL_FSSNAPID prev_fssnapId is invalid + * EDOM prev_fssnapId is from a different fs + * ERANGE prev_fssnapId is more recent than snapId + * being scanned + * see system calls dup() and malloc() ERRORS + */ +gpfs_iscan_t * GPFS_API +gpfs_open_inodescan(gpfs_fssnap_handle_t *fssnapHandle, + const gpfs_fssnap_id_t *prev_fssnapId, + gpfs_ino_t *maxIno); + +gpfs_iscan_t * GPFS_API +gpfs_open_inodescan64(gpfs_fssnap_handle_t *fssnapHandle, + const gpfs_fssnap_id_t *prev_fssnapId, + gpfs_ino64_t *maxIno); + + +/* NAME: gpfs_open_inodescan_with_xattrs() + * + * FUNCTION: Open inode file and extended attributes for an inode scan + * + * Input: fssnapHandle: handle for file system and snapshot + * to be scanned + * prev_fssnapId: if NULL, all inodes of existing file will + * be returned; if non-null, only returns inodes of files + * that have changed since the specified previous snapshot; + * if specifies the same snapshot as the one referred by + * fssnapHandle, only the snapshot inodes that have been + * copied into this snap inode file are returned; + * nxAttrs: count of extended attributes to be returned. + * if nxAttrs is set to 0, call returns no extended + * attributes, like gpfs_open_inodescan. + * if nxAttrs is set to -1, call returns all extended attributes + * xAttrList: pointer to array of pointers to names of extended + * attribute to be returned. nxAttrList may be null if nxAttrs + * is set to 0 or -1. + * maxIno: if non-null, returns the maximum inode number + * available in the inode file being scanned. + * + * Returns: pointer to gpfs_iscan_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL bad parameters + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid + * GPFS_E_INVAL_FSSNAPID prev_fssnapId is invalid + * EDOM prev_fssnapId is from a different fs + * ERANGE prev_fssnapId is more recent than snapId + * being scanned + * see system calls dup() and malloc() ERRORS + */ +gpfs_iscan_t * GPFS_API +gpfs_open_inodescan_with_xattrs(gpfs_fssnap_handle_t *fssnapHandle, + const gpfs_fssnap_id_t *prev_fssnapId, + int nxAttrs, + const char *xattrsList[], + gpfs_ino_t *maxIno); + +gpfs_iscan_t * GPFS_API +gpfs_open_inodescan_with_xattrs64(gpfs_fssnap_handle_t *fssnapHandle, + const gpfs_fssnap_id_t *prev_fssnapId, + int nxAttrs, + const char *xattrList[], + gpfs_ino64_t *maxIno); + + +/* NAME: gpfs_next_inode() + * + * FUNCTION: Get next inode from inode scan. Scan terminates before + * the last inode specified or the last inode in the + * inode file being scanned. + * + * If the inode scan was opened to expressly look for inodes + * in a snapshot, and not dittos, gets the next inode skipping + * holes, if any. + * + * Input: iscan: ptr to inode scan descriptor + * termIno: scan terminates before this inode number + * caller may specify maxIno from gpfs_open_inodescan() + * or 0 to scan the entire inode file. + * iattr: pointer to returned pointer to file's iattr. + * + * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) + * 0 and *iattr set to NULL for no more inodes before termIno + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM buffer too small + * GPFS_E_INVAL_ISCAN bad parameters + * GPFS_E_INVAL_FSSNAPID the snapshot id provided in the + * gpfs iscan is not valid + * + * Notes: The data returned by gpfs_next_inode() is overwritten by + * subsequent calls to gpfs_next_inode() or gpfs_seek_inode(). + * + * The termIno parameter provides a means to partition an + * inode scan such that it may be executed on more than one node. + */ +int GPFS_API +gpfs_next_inode(gpfs_iscan_t *iscan, + gpfs_ino_t termIno, + const gpfs_iattr_t **iattr); + +int GPFS_API +gpfs_next_inode64(gpfs_iscan_t *iscan, + gpfs_ino64_t termIno, + const gpfs_iattr64_t **iattr); + + +/* NAME: gpfs_next_inode_with_xattrs() + * + * FUNCTION: Get next inode and its extended attributes from the inode scan. + * The set of extended attributes returned were defined when + * the inode scan was opened. The scan terminates before the last + * inode specified or the last inode in the inode file being + * scanned. + * + * If the inode scan was opened to expressly look for inodes + * in a snapshot, and not dittos, gets the next inode skipping + * holes, if any. + * + * Input: iscan: ptr to inode scan descriptor + * termIno: scan terminates before this inode number + * caller may specify maxIno from gpfs_open_inodescan() + * or 0 to scan the entire inode file. + * iattr: pointer to returned pointer to file's iattr. + * xattrBuf: pointer to returned pointer to xattr buffer + * xattrBufLen: returned length of xattr buffer + * + * + * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) + * 0 and *iattr set to NULL for no more inodes before termIno + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * EFAULT buffer data was overwritten + * ENOMEM buffer too small + * GPFS_E_INVAL_ISCAN bad parameters + * GPFS_E_INVAL_XATTR bad parameters + * + * Notes: The data returned by gpfs_next_inode() is overwritten by + * subsequent calls to gpfs_next_inode(), gpfs_seek_inode() + * or gpfs_stat_inode(). + * + * The termIno parameter provides a means to partition an + * inode scan such that it may be executed on more than one node. + * + * The returned values for xattrBuf and xattrBufLen must be + * provided to gpfs_next_xattr() to obtain the extended attribute + * names and values. The buffer used for the extended attributes + * is overwritten by subsequent calls to gpfs_next_inode(), + * gpfs_seek_inode() or gpfs_stat_inode(); + * + * The returned pointers to the extended attribute name and value + * will be aligned to a double-word boundary. + */ +int GPFS_API +gpfs_next_inode_with_xattrs(gpfs_iscan_t *iscan, + gpfs_ino_t termIno, + const gpfs_iattr_t **iattr, + const char **xattrBuf, + unsigned int *xattrBufLen); + +int GPFS_API +gpfs_next_inode_with_xattrs64(gpfs_iscan_t *iscan, + gpfs_ino64_t termIno, + const gpfs_iattr64_t **iattr, + const char **xattrBuf, + unsigned int *xattrBufLen); + + +/* NAME: gpfs_next_xattr() + * + * FUNCTION: Iterate over the extended attributes buffer returned + * by get_next_inode_with_xattrs to return the individual + * attributes and their values. Note that the attribute names + * are null-terminated strings, whereas the atttribute value + * contains binary data. + * + * Input: iscan: ptr to inode scan descriptor + * xattrBufLen: ptr to attribute buffer length + * xattrBuf: ptr to the ptr to the attribute buffer + * + * Returns: 0 and *name set to point attribue name (Successful) + * also sets: *valueLen to length of attribute value + * *value to point to attribute value + * *xattrBufLen to remaining length of buffer + * **xattrBuf to index next attribute in buffer + * 0 and *name set to NULL for no more attributes in buffer + * also sets: *valueLen to 0 + * *value to NULL + * *xattrBufLen to 0 + * **xattrBuf to NULL + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_ISCAN invalid iscan parameter + * GPFS_E_INVAL_XATTR invalid xattr parameters + * + * Notes: The caller is not allowed to modify the returned attribute + * names or values. The data returned by gpfs_next_attribute() + * may be overwritten by subsequent calls to gpfs_next_attribute() + * or other gpfs library calls. + */ +int GPFS_API +gpfs_next_xattr(gpfs_iscan_t *iscan, + const char **xattrBuf, + unsigned int *xattrBufLen, + const char **name, + unsigned int *valueLen, + const char **value); + + + +/* NAME: gpfs_seek_inode() + * + * FUNCTION: Seek to a given inode number. + * + * Input: iscan: ptr to inode scan descriptor + * ino: next inode number to be scanned + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_ISCAN bad parameters + */ +int GPFS_API +gpfs_seek_inode(gpfs_iscan_t *iscan, + gpfs_ino_t ino); + +int GPFS_API +gpfs_seek_inode64(gpfs_iscan_t *iscan, + gpfs_ino64_t ino); + + +#ifdef SNAPSHOT_ILM + +/* define GPFS generated errno */ +#define GPFS_E_HOLE_IN_IFILE 238 /* hole in inode file */ + +#endif +/* NAME: gpfs_stat_inode() + * NAME: gpfs_stat_inode_with_xattrs() + * + * FUNCTION: Seek to the specified inode and get that inode and + * its extended attributes from the inode scan. This is + * simply a combination of gpfs_seek_inode and get_next_inode + * but will only return the specified inode. + * + * Input: iscan: ptr to inode scan descriptor + * ino: inode number to be returned + * termIno: prefetch inodes up to this inode + * caller may specify maxIno from gpfs_open_inodescan() + * or 0 to allow prefetching over the entire inode file. + * iattr: pointer to returned pointer to file's iattr. + * xattrBuf: pointer to returned pointer to xattr buffer + * xattrBufLen: returned length of xattr buffer + * + * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) + * 0 and *iattr set to NULL for no more inodes before termIno + * or if requested inode does not exist. + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM buffer too small + * GPFS_E_INVAL_ISCAN bad parameters + * GPFS_E_HOLE_IN_IFILE if we are expressly looking for inodes in + * the snapshot file and this one has yet not + * been copied into snapshot. + * + * Notes: The data returned by gpfs_next_inode() is overwritten by + * subsequent calls to gpfs_next_inode(), gpfs_seek_inode() + * or gpfs_stat_inode(). + * + * The termIno parameter provides a means to partition an + * inode scan such that it may be executed on more than one node. + * It is only used by this call to control prefetching. + * + * The returned values for xattrBuf and xattrBufLen must be + * provided to gpfs_next_xattr() to obtain the extended attribute + * names and values. The buffer used for the extended attributes + * is overwritten by subsequent calls to gpfs_next_inode(), + * gpfs_seek_inode() or gpfs_stat_inode(); + */ +int GPFS_API +gpfs_stat_inode(gpfs_iscan_t *iscan, + gpfs_ino_t ino, + gpfs_ino_t termIno, + const gpfs_iattr_t **iattr); + +int GPFS_API +gpfs_stat_inode64(gpfs_iscan_t *iscan, + gpfs_ino64_t ino, + gpfs_ino64_t termIno, + const gpfs_iattr64_t **iattr); + +int GPFS_API +gpfs_stat_inode_with_xattrs(gpfs_iscan_t *iscan, + gpfs_ino_t ino, + gpfs_ino_t termIno, + const gpfs_iattr_t **iattr, + const char **xattrBuf, + unsigned int *xattrBufLen); + +int GPFS_API +gpfs_stat_inode_with_xattrs64(gpfs_iscan_t *iscan, + gpfs_ino64_t ino, + gpfs_ino64_t termIno, + const gpfs_iattr64_t **iattr, + const char **xattrBuf, + unsigned int *xattrBufLen); + + +/* NAME: gpfs_close_inodescan() + * + * FUNCTION: Close inode file. + * + * Input: iscan: ptr to inode scan descriptor + * + * Returns: void + * + * Errno: None + */ +void GPFS_API +gpfs_close_inodescan(gpfs_iscan_t *iscan); + + +/* NAME: gpfs_cmp_fssnapid() + * + * FUNCTION: Compare two fssnapIds for the same file system to + * determine the order in which the two snapshots were taken. + * The 'result' variable will be set as follows: + * *result < 0: snapshot 1 was taken before snapshot 2 + * *result == 0: snapshot 1 and 2 are the same + * *result > 0: snapshot 1 was taken after snapshot 2 + * + * Input: fssnapId1: ptr to fssnapId 1 + * fssnapId2: ptr to fssnapId id 2 + * result: ptr to returned results + * + * Returns: 0 and *result is set as described above (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPID fssnapid1 or fssnapid2 is not a + * valid snapshot id + * EDOM the two snapshots cannot be compared because + * they were taken from two different file systems. + */ +int GPFS_API +gpfs_cmp_fssnapid(const gpfs_fssnap_id_t *fssnapId1, + const gpfs_fssnap_id_t *fssnapId2, + int *result); + + +/* NAME: gpfs_iopen() + * + * FUNCTION: Open a file or directory by inode number. + * + * Input: fssnapHandle: handle for file system and snapshot + * being scanned + * ino: inode number + * open_flags: O_RDONLY for gpfs_iread() + * O_WRONLY for gpfs_iwrite() + * O_CREAT create the file if it doesn't exist + * O_TRUNC if the inode already exists delete it + * caller may use GPFS_O_BACKUP to read files for backup + * and GPFS_O_RESTORE to write files for restore + * statxbuf: used only with O_CREAT/GPFS_O_BACKUP + * all other cases set to NULL + * symLink: used only with O_CREAT/GPFS_O_BACKUP for a symbolic link + * all other cases set to NULL + * + * Returns: pointer to gpfs_ifile_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOENT file not existed + * EINVAL missing or bad parameter + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * EFORMAT invalid fs version number + * EIO error reading original inode + * ERANGE error ino is out of range, should use gpfs_iopen64 + * GPFS_E_INVAL_INUM reserved inode is not allowed to open + * GPFS_E_INVAL_IATTR iattr structure was corrupted + * see dup() and malloc() ERRORS + */ +gpfs_ifile_t * GPFS_API +gpfs_iopen(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_ino_t ino, + int open_flags, + const gpfs_iattr_t *statxbuf, + const char *symLink); + +gpfs_ifile_t * GPFS_API +gpfs_iopen64(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_ino64_t ino, + int open_flags, + const gpfs_iattr64_t *statxbuf, + const char *symLink); + + +/* Define gpfs_iopen flags as used by the backup & restore by inode. + The backup code will only read the source files. + The restore code writes the target files & creates them if they + don't already exist. The file length is set by the inode attributes. + Consequently, to restore a user file it is unnecessary to include + the O_TRUNC flag. */ +#define GPFS_O_BACKUP (O_RDONLY) +#define GPFS_O_RESTORE (O_WRONLY | O_CREAT) + + +/* NAME: gpfs_iread() + * + * FUNCTION: Read file opened by gpfs_iopen. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: buffer for data to be read + * bufferSize: size of buffer (ie amount of data to be read) + * In/Out offset: offset of where within the file to read + * if successful, offset will be updated to the + * next byte after the last one that was read + * + * Returns: number of bytes read (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EISDIR file is a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + * see system call read() ERRORS + */ +int GPFS_API +gpfs_iread(gpfs_ifile_t *ifile, + void *buffer, + int bufferSize, + gpfs_off64_t *offset); + + +/* NAME: gpfs_iwrite() + * + * FUNCTION: Write file opened by gpfs_iopen. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: the data to be written + * writeLen: how much to write + * In/Out offset: offset of where within the file to write + * if successful, offset will be updated to the + * next byte after the last one that was written + * + * Returns: number of bytes written (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EISDIR file is a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + * see system call write() ERRORS + */ +int GPFS_API +gpfs_iwrite(gpfs_ifile_t *ifile, + void *buffer, + int writeLen, + gpfs_off64_t *offset); + + +/* NAME: gpfs_ireaddir() + * + * FUNCTION: Get next directory entry. + * + * Input: idir: pointer to gpfs_ifile_t from gpfs_iopen + * dirent: pointer to returned pointer to directory entry + * + * Returns: 0 and pointer to gpfs_direntx set (Successful) + * 0 and pointer to gpfs_direntx set to NULL (End of directory) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOTDIR file is not a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameter + * ENOMEM unable to allocate memory for request + * + * Notes: The data returned by gpfs_ireaddir() is overwritten by + * subsequent calls to gpfs_ireaddir(). + */ +int GPFS_API +gpfs_ireaddir(gpfs_ifile_t *idir, + const gpfs_direntx_t **dirent); + +int GPFS_API +gpfs_ireaddir64(gpfs_ifile_t *idir, + const gpfs_direntx64_t **dirent); + + +int GPFS_API +gpfs_ireaddirx(gpfs_ifile_t *idir, + gpfs_iscan_t *iscan, /* in only */ + const gpfs_direntx_t **dirent); + +int GPFS_API +gpfs_ireaddirx64(gpfs_ifile_t *idir, + gpfs_iscan_t *iscan, /* in only */ + const gpfs_direntx64_t **dirent); + + +/* NAME: gpfs_iwritedir() + * + * FUNCTION: Create a directory entry in a directory opened by gpfs_iopen. + * + * Input: idir: pointer to gpfs_ifile_t from gpfs_iopen + * dirent: directory entry to be written + * + * Returns: 0 (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_IFILE bad file pointer + * ENOTDIR file is not a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * EFORMAT invalid dirent version number + * see system call write() ERRORS + */ +int GPFS_API +gpfs_iwritedir(gpfs_ifile_t *idir, + const gpfs_direntx_t *dirent); + +int GPFS_API +gpfs_iwritedir64(gpfs_ifile_t *idir, + const gpfs_direntx64_t *dirent); + + +/* NAME: gpfs_igetattrs() + * + * FUNCTION: Retrieves all extended file attributes in opaque format. + * This function together with gpfs_iputattrs is intended for + * use by a backup program to save (gpfs_igetattrs) and + * restore (gpfs_iputattrs) all extended file attributes + * (ACLs, user attributes, ...) in one call. + * + * NOTE: This call does not return extended attributes used for + * the Data Storage Management (XDSM) API (aka DMAPI). + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: pointer to buffer for returned attributes + * bufferSize: size of buffer + * attrSize: ptr to returned size of attributes + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOSPC buffer too small to return all attributes + * *attrSizeP will be set to the size necessary + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_igetattrs(gpfs_ifile_t *ifile, + void *buffer, + int bufferSize, + int *attrSize); + +/* NAME: gpfs_igetattrsx() + * + * FUNCTION: Retrieves all extended file attributes in opaque format. + * This function together with gpfs_iputattrsx is intended for + * use by a backup program to save (gpfs_igetattrsx) and + * restore (gpfs_iputattrsx) all extended file attributes + * (ACLs, user attributes, ...) in one call. + * + * NOTE: This call can optionally return extended attributes + * used for the Data Storage Management (XDSM) API + * (aka DMAPI). + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * flags Define behavior of get attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement + * are not saved, neither is the current storage pool. + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement + * are saved, but the current storage pool is not. + * GPFS_ATTRFLAG_INCL_DMAPI - file attributes for dmapi are + * included in the returned buffer + * GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption + * are included in the returned buffer + * + * buffer: pointer to buffer for returned attributes + * bufferSize: size of buffer + * attrSize: ptr to returned size of attributes + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL invalid flags provided + * ENOSPC buffer too small to return all attributes + * *attrSizeP will be set to the size necessary + */ +int GPFS_API +gpfs_igetattrsx(gpfs_ifile_t *ifile, + int flags, + void *buffer, + int bufferSize, + int *attrSize); + + +/* NAME: gpfs_igetxattr() + * + * FUNCTION: Retrieves an extended file attributes from ifile which has been open + * by gpfs_iopen(). + * + * NOTE: This call does not return extended attributes used for + * the Data Storage Management (XDSM) API (aka DMAPI). + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: pointer to buffer for key and returned extended + * attribute value + * bufferSize: size of buffer, should be enough to save attribute value + * attrSize: ptr to key length as input and ptr to the returned + * size of attributes as putput. + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser priviledges + * ESTALE cached fs information was invalid + * ENOSPC buffer too small to return all attributes + * *attrSize will be set to the size necessary + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_igetxattr(gpfs_ifile_t *ifile, + void *buffer, + int bufferSize, + int *attrSize); + + +/* NAME: gpfs_iputattrs() + * + * FUNCTION: Sets all extended file attributes of a file. + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_igetattrs. + * + * NOTE: This call will not restore extended attributes + * used for the Data Storage Management (XDSM) API + * (aka DMAPI). They will be silently ignored. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: pointer to buffer for returned attributes + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EINVAL the buffer does not contain valid attribute data + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_iputattrs(gpfs_ifile_t *ifile, + void *buffer); + + +/* NAME: gpfs_iputattrsx() + * + * FUNCTION: Sets all extended file attributes of a file. + * + * This routine can optionally invoke the policy engine + * to match a RESTORE rule using the file's attributes saved + * in the extended attributes to set the file's storage pool and + * data replication as when calling gpfs_fputattrswithpathname. + * When used with the policy the caller should include the + * full path to the file, including the file name, to allow + * rule selection based on file name or path. + * + * By default, the routine will not use RESTORE policy rules + * for data placement. The pathName parameter will be ignored + * and may be set to NULL. + * + * If the call does not use RESTORE policy rules, or if the + * file fails to match a RESTORE rule, or if there are no + * RESTORE rules installed, then the storage pool and data + * replication are selected as when calling gpfs_fputattrs(). + * + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_fgetattrs. + * + * pathName is a UTF-8 encoded string. On Windows, applications + * can convert UTF-16 ("Unicode") to UTF-8 using the platforms + * WideCharToMultiByte function. + * + * NOTE: This call will restore extended attributes + * used for the Data Storage Management (XDSM) API + * (aka DMAPI) if they are present in the buffer. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * flags Define behavior of put attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored + * but the storage pool and data replication are unchanged + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a placement rule + * instead of restoring the saved storage pool. + * GPFS_ATTRFLAG_USE_POLICY - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a RESTORE rule + * instead of restoring the saved storage pool. + * GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored + * after data is retored. If file is immutable/appendOnly + * call without this flag before restoring data + * then call with this flag after restoring data + * GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption + * are restored. Note that this may result in the file's + * File Encryption Key (FEK) being changed, and in this + * case any prior content in the file is effectively lost. + * This option should only be used when the entire file + * content is restored after the attributes are restored. + * + * buffer: pointer to buffer for returned attributes + * pathName: pointer to file path and file name for file + * May be set to NULL. + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EINVAL the buffer does not contain valid attribute data + * EINVAL invalid flags provided + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_iputattrsx(gpfs_ifile_t *ifile, + int flags, + void *buffer, + const char *pathName); + + +/* NAME: gpfs_igetfilesetname() + * + * FUNCTION: Retrieves the name of the fileset which contains this file. + * The fileset name is a null-terminated string, with a + * a maximum length of GPFS_MAXNAMLEN. + * + * Input: iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() + * filesetId: ia_filesetId returned in an iattr from the iscan + * buffer: pointer to buffer for returned fileset name + * bufferSize: size of buffer + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOSPC buffer too small to return fileset name + * GPFS_E_INVAL_ISCAN bad iscan parameter + */ +int GPFS_API +gpfs_igetfilesetname(gpfs_iscan_t *iscan, + unsigned int filesetId, + void *buffer, + int bufferSize); + + +/* NAME: gpfs_igetstoragepool() + * + * FUNCTION: Retrieves the name of the storage pool assigned for + * this file's data. The storage pool name is a null-terminated + * string, with a maximum length of GPFS_MAXNAMLEN. + * + * Input: iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() + * dataPoolId: ia_dataPoolId returned in an iattr from the iscan + * buffer: pointer to buffer for returned attributes + * bufferSize: size of buffer + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOSPC buffer too small to return all storage pool name + * GPFS_E_INVAL_ISCAN bad iscan parameters + */ +int GPFS_API +gpfs_igetstoragepool(gpfs_iscan_t *iscan, + unsigned int dataPoolId, + void *buffer, + int bufferSize); + + +/* NAME: gpfs_iclose() + * + * FUNCTION: Close file opened by inode and update dates. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * + * Returns: void + */ +void GPFS_API +gpfs_iclose(gpfs_ifile_t *ifile); + + +/* NAME: gpfs_ireadlink() + * + * FUNCTION: Read symbolic link by inode number. + * + * Input: fssnapHandle: handle for file system & snapshot being scanned + * ino: inode number of link file to read + * buffer: pointer to buffer for returned link data + * bufferSize: size of the buffer + * + * Returns: number of bytes read (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnap handle + * see system call readlink() ERRORS + */ +int GPFS_API +gpfs_ireadlink(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_ino_t ino, + char *buffer, + int bufferSize); + +int GPFS_API +gpfs_ireadlink64(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_ino64_t ino, + char *buffer, + int bufferSize); + + +/* NAME: gpfs_sync_fs() + * + * FUNCTION: sync file system. + * + * Input: fssnapHandle: handle for file system being restored + * + * Returns: 0 all data flushed to disk (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOMEM unable to allocate memory for request + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + */ +int GPFS_API +gpfs_sync_fs(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_enable_restore() + * + * FUNCTION: Mark file system as enabled for restore on/off + * + * Input: fssnapHandle: handle for file system to be enabled + * or disabled for restore + * on_off: flag set to 1 to enable restore + * 0 to disable restore + * + * Returns: 0 (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL bad parameters + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * E_FS_NOT_RESTORABLE fs is not clean + * EALREADY fs already marked as requested + * E_RESTORE_STARTED restore in progress + * + * Notes: EALREADY indicates enable/disable restore was already called + * for this fs. The caller must decide if EALREADY represents an + * error condition. + */ +int GPFS_API +gpfs_enable_restore(gpfs_fssnap_handle_t *fssnapHandle, + int on_off); + + +/* NAME: gpfs_start_restore() + * + * FUNCTION: Start a restore session. + * + * Input: fssnapHandle: handle for file system to be restored + * restore_flags: Flag to indicate the restore should be started + * even if a prior restore has not completed. + * old_fssnapId: fssnapId of last restored snapshot + * new_fssnapId: fssnapId of snapshot being restored + * + * Returns: pointer to gpfs_restore_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOMEM unable to allocate memory for request + * EINVAL missing parameter + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * EDOM restore fs does not match existing fs + * ERANGE restore is missing updates + * EFORMAT invalid fs version number + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * GPFS_E_INVAL_FSSNAPID bad fssnapId parameter + * E_FS_NOT_RESTORABLE fs is not clean for restore + * E_RESTORE_NOT_ENABLED fs is not enabled for restore + * EALREADY Restore already in progress + * + * Note: EALREADY indicates start restore was already called for + * this fs. This could be due to a prior restore process that failed + * or it could be due to a concurrent restore process still running. + * The caller must decide if EALREADY represents an error condition. + */ +gpfs_restore_t * GPFS_API +gpfs_start_restore(gpfs_fssnap_handle_t *fssnapHandle, + int restore_flags, + const gpfs_fssnap_id_t *old_fssnapId, + const gpfs_fssnap_id_t *new_fssnapId); + +#define GPFS_RESTORE_NORMAL 0 /* Restore not started if prior restore + has not completed. */ +#define GPFS_RESTORE_FORCED 1 /* Restore starts even if prior restore + has not completed. */ + + +/* NAME: gpfs_end_restore() + * + * FUNCTION: End a restore session. + * + * Input: restoreId: ptr to gpfs_restore_t + * + * Returns: 0 (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL bad parameters + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_RESTORE bad restoreId parameter + * GPFS_E_FS_NOT_RESTORABLE fs is not clean for restore + * GPFS_E_RESTORE_NOT_ENABLED fs is not enabled for restore + * EALREADY Restore already ended + * + * Note: EALREADY indicates end restore was already called for + * this fs. This could be due to a concurrent restore process that + * already completed. The caller must decide if EALREADY represents + * an error condition. + */ +int GPFS_API +gpfs_end_restore(gpfs_restore_t *restoreId); + + +/* NAME: gpfs_ireadx() + * + * FUNCTION: Block level incremental read on a file opened by gpfs_iopen + * with a given incremental scan opened via gpfs_open_inodescan. + * + * Input: ifile: ptr to gpfs_ifile_t returned from gpfs_iopen() + * iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() + * buffer: ptr to buffer for returned data + * bufferSize: size of buffer for returned data + * offset: ptr to offset value + * termOffset: read terminates before reading this offset + * caller may specify ia_size for the file's + * gpfs_iattr_t or 0 to scan the entire file. + * hole: ptr to returned flag to indicate a hole in the file + * + * Returns: number of bytes read and returned in buffer + * or size of hole encountered in the file. (Success) + * -1 and errno is set (Failure) + * + * On input, *offset contains the offset in the file + * at which to begin reading to find a difference same file + * in a previous snapshot specified when the inodescan was opened. + * On return, *offset contains the offset of the first + * difference. + * + * On return, *hole indicates if the change in the file + * was data (*hole == 0) and the data is returned in the + * buffer provided. The function's value is the amount of data + * returned. If the change is a hole in the file, + * *hole != 0 and the size of the changed hole is returned + * as the function value. + * + * A call with a NULL buffer pointer will query the next increment + * to be read from the current offset. The *offset, *hole and + * returned length will be set for the next increment to be read, + * but no data will be returned. The bufferSize parameter is + * ignored, but the termOffset parameter will limit the + * increment returned. + * + * Errno: ENOSYS function not available + * EINVAL missing or bad parameter + * EISDIR file is a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * EDOM fs snapId does match local fs + * ERANGE previous snapId is more recent than scanned snapId + * GPFS_E_INVAL_IFILE bad ifile parameter + * GPFS_E_INVAL_ISCAN bad iscan parameter + * see system call read() ERRORS + * + * Notes: The termOffset parameter provides a means to partition a + * file's data such that it may be read on more than one node. + */ +gpfs_off64_t GPFS_API +gpfs_ireadx(gpfs_ifile_t *ifile, /* in only */ + gpfs_iscan_t *iscan, /* in only */ + void *buffer, /* in only */ + int bufferSize, /* in only */ + gpfs_off64_t *offset, /* in/out */ + gpfs_off64_t termOffset, /* in only */ + int *hole); /* out only */ + + +/* NAME: gpfs_ireadx_ext + * + * FUNCTION: gpfs_ireadx_ext is used to find different blocks between clone + * child and parent files. Input and output are the same as + * gpfs_ireadx. + * + * Returns: See gpfs_ireadx() + */ +gpfs_off64_t GPFS_API +gpfs_ireadx_ext(gpfs_ifile_t *ifile, /* in only */ + gpfs_iscan_t *iscan, /* in only */ + void *buffer, /* in only */ + int bufferSize, /* in only */ + gpfs_off64_t *offset, /* in/out */ + gpfs_off64_t termOffset, /* in only */ + int *hole); + + +/* NAME: gpfs_iwritex() + * + * FUNCTION: Write file opened by gpfs_iopen. + * If parameter hole == 0, then write data + * addressed by buffer to the given offset for the + * given length. If hole != 0, then write + * a hole at the given offset for the given length. + * + * Input: ifile : ptr to gpfs_ifile_t returned from gpfs_iopen() + * buffer: ptr to data buffer + * writeLen: length of data to write + * offset: offset in file to write data + * hole: flag =1 to write a "hole" + * =0 to write data + * + * Returns: number of bytes/size of hole written (Success) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL missing or bad parameter + * EISDIR file is a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameter + * see system call write() ERRORS + */ +gpfs_off64_t GPFS_API +gpfs_iwritex(gpfs_ifile_t *ifile, /* in only */ + void *buffer, /* in only */ + gpfs_off64_t writeLen, /* in only */ + gpfs_off64_t offset, /* in only */ + int hole); /* in only */ + + +/* NAME: gpfs_statfspool() + * + * FUNCTION: Obtain status information about the storage pools + * + * Input: pathname : path to any file in the file system + * poolId : id of first pool to return + * on return set to next poolId or -1 + * to indicate there are no more pools. + * options : option flags (currently not used) + * nPools : number of stat structs requested or 0 + * on return number of stat structs in buffer + * or if nPools was 0 its value is the max number + * of storage pools currently defined + * buffer : ptr to return stat structures + * bufferSize : sizeof stat buffer + * + * The user is expected to issue two or more calls. On the first + * call the user should pass nPools set to 0 and gpfs will + * return in nPools the total number of storage pools currently + * defined for the file system indicated by the pathname + * and it returns in poolId the id of the first storage pool. + * The buffer parameter may be set to NULL for this call. + * + * The user may then allocate a buffer large enough to contain + * a gpfs_statfspool_t structure for each of the pools and issue + * a second call to obtain stat information about each pool. + * Parameter nPools should be set the number of pools requested. + * On return, nPools will be set to the number of stat structs + * contained in the buffer, and poolId will be set to the id + * of the next storage pool or -1 to indicate there are no + * additional storage pools defined. + * + * Alternatively, if the user has a valid poolId from a previous + * call, the user may provide that poolId and a buffer large + * enough for a single gpfs_statfspool_t structure, and the call + * will return the status for a single storage pool. + * + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: Specific error indication + * EINVAL + */ +int GPFS_API +gpfs_statfspool(const char *pathname, /* in only: path to file system*/ + gpfs_pool_t *poolId, /* in out: id of first pool to return + on return set to next poolId + or -1 when there are no more pools */ + unsigned int options, /* in only: option flags */ + int *nPools, /* in out: number of pool stats requested + on return number of stat structs + returned in buffer or if nPools was + set to 0, the return value is the + number of pools currently defined */ + void *buffer, /* ptr to return stat structures */ + int bufferSize); /* sizeof stat buffer or 0 */ + + +/* NAME: gpfs_getpoolname() + * + * FUNCTION: Retrieves the name of the storage pool assigned for + * this file's data. The storage pool name is a null-terminated + * string, with a maximum length of GPFS_MAXNAMLEN. + * + * Input: pathname: path to any file in the file system + * poolId: f_poolid returned in gpfs_statfspool_t + * buffer: pointer to buffer for returned name + * bufferSize: size of buffer + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * ESTALE file system was unmounted + * E_FORMAT_INCOMPAT file system does not support pools + * E2BIG buffer too small to return storage pool name + */ +int GPFS_API +gpfs_getpoolname(const char *pathname, + gpfs_pool_t poolId, + void *buffer, + int bufferSize); + + +/* /usr/src/linux/include/linux/fs.h includes /usr/src/linux/include/linux/quota.h + which has conflicting definitions. */ +#ifdef _LINUX_QUOTA_ + #undef Q_SYNC + #undef Q_GETQUOTA + #undef Q_SETQUOTA + #undef Q_QUOTAON + #undef Q_QUOTAOFF +#endif + + +/* GPFS QUOTACTL */ + +/* + * Command definitions for the 'gpfs_quotactl' system call. + * The commands are broken into a main command defined below + * and a subcommand that is used to convey the type of + * quota that is being manipulated (see above). + */ + +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define GPFS_QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) + +#define Q_QUOTAON 0x0100 /* enable quotas */ +#define Q_QUOTAOFF 0x0200 /* disable quotas */ +#define Q_GETQUOTA 0x0300 /* get limits and usage */ +#ifndef _LINUX_SOURCE_COMPAT + /* Standard AIX definitions of quota commands */ + #define Q_SETQUOTA 0x0400 /* set limits */ + #define Q_SETQLIM Q_SETQUOTA +#else + /* Alternate definitions, for Linux Affinity */ + #define Q_SETQLIM 0x0400 /* set limits */ + #define Q_SETQUOTA 0x0700 /* set limits and usage */ +#endif +#define Q_SETUSE 0x0500 /* set usage */ +#define Q_SYNC 0x0600 /* sync disk copy of a file systems quotas */ +#define Q_SETGRACETIME 0x0900 /* set grace time */ +#define Q_SETGRACETIME_ENHANCE 0x0800 /* set grace time and update all + * quota entries */ +#define Q_GETDQPFSET 0x0A00 /* get default quota per fileset */ +#define Q_SETDQPFSET 0x0B00 /* set default quota per fileset */ +#define Q_SETQUOTA_UPDATE_ET 0x0C00 /* this SETQUOTA needs to update entryType */ +#define Q_GETDQPFSYS 0x0D00 /* get default quota per file system */ +#define Q_SETDQPFSYS 0x0E00 /* set default quota per file system */ + +/* gpfs quota types */ +#define GPFS_USRQUOTA 0 +#define GPFS_GRPQUOTA 1 +#define GPFS_FILESETQUOTA 2 + +/* define GPFS generated errno */ +#define GPFS_E_NO_QUOTA_INST 237 /* file system does not support quotas */ + +typedef struct gpfs_quotaInfo +{ + gpfs_off64_t blockUsage; /* current block count in 1 KB units*/ + gpfs_off64_t blockHardLimit; /* absolute limit on disk blks alloc */ + gpfs_off64_t blockSoftLimit; /* preferred limit on disk blks */ + gpfs_off64_t blockInDoubt; /* distributed shares + "lost" usage for blks */ + int inodeUsage; /* current # allocated inodes */ + int inodeHardLimit; /* absolute limit on allocated inodes */ + int inodeSoftLimit; /* preferred inode limit */ + int inodeInDoubt; /* distributed shares + "lost" usage for inodes */ + gpfs_uid_t quoId; /* uid, gid or fileset id */ + int entryType; /* entry type, not used */ + unsigned int blockGraceTime; /* time limit for excessive disk use */ + unsigned int inodeGraceTime; /* time limit for excessive inode use */ +} gpfs_quotaInfo_t; + + +/* NAME: gpfs_quotactl() + * + * FUNCTION: Manipulate disk quotas + * INPUT: pathname: specifies the pathname of any file within the + * mounted file system to which the command is to + * be applied + * cmd: specifies a quota control command to be applied + * to UID/GID/FILESETID id. The cmd parameter can be + * constructed using GPFS_QCMD(cmd, type) macro defined + * in gpfs.h + * id: UID or GID or FILESETID that command applied to. + * bufferP: points to the address of an optional, command + * specific, data structure that is copied in or out of + * the system. + * + * OUTPUT: bufferP, if applicable. + * + * Returns: 0 success + * -1 failure + * + * Errno: EACCESS + * EFAULT An invalid bufferP parameter is supplied; + * the associated structure could not be copied + * in or out of the kernel + * EINVAL + * ENOENT No such file or directory + * EPERM The quota control command is privileged and + * the caller did not have root user authority + * EOPNOTSUPP + * GPFS_E_NO_QUOTA_INST The file system does not support quotas + */ +int GPFS_API +gpfs_quotactl(const char *pathname, + int cmd, + int id, + void *bufferP); + + +/* NAME: gpfs_getfilesetid() + * + * FUNCTION: Translate FilesetName to FilesetID + * + * INPUT: pathname: specifies the pathname of any file within the + * mounted file system to which the command is to + * be applied + * name: name of the fileset + * + * OUTPUT: idP: points to the address of an integer that receives the ID + * + * Returns: 0 success + * -1 failure + * + * Errno: EACCESS + * EFAULT An invalid pointer is supplied; the associated + * data could not be copied in or out of the kernel + * EINVAL + * ENOENT No such file, directory or fileset + */ +int GPFS_API +gpfs_getfilesetid(const char *pathname, + const char *name, + int *idP); + + +/* NAME: gpfs_clone_snap() + * + * FUNCTION: Create an immutable clone parent from a source file + * + * Input: sourcePathP: path to source file, which will be cloned + * destPathP: path to destination file, to be created + * + * If destPathP is NULL, then the source file will be changed + * in place into an immutable clone parent. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * ENOENT File does not exist + * EACCESS Write access to target or source search permission denied + * EINVAL Not a regular file or not a GPFS file system + * EFAULT Input argument points outside accessible address space + * ENAMETOOLONG Source or destination path name too long + * ENOSPC Not enough space on disk + * EISDIR Destination is a directory + * EXDEV Source and destination aren't in the same file system + * EROFS Destination is read-only + * EPERM Invalid source file + * EEXIST Destination file already exists + * EBUSY Source file is open + * EFORMAT File system does not support clones + * EMEDIUMTYPE File system does not support clones + */ +int GPFS_API +gpfs_clone_snap(const char *sourcePathP, const char *destPathP); + +/* NAME: gpfs_clone_copy() + * + * FUNCTION: Create a clone copy of an immutable clone parent file + * + * Input: sourcePathP: path to immutable source file, to be cloned + * destPathP: path to destination file, to be created + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * ENOENT File does not exist + * EACCESS Write access to target or source search permission denied + * EINVAL Not a regular file or not a GPFS file system + * EFAULT Input argument points outside accessible address space + * ENAMETOOLONG Source or destination path name too long + * ENOSPC Not enough space on disk + * EISDIR Destination is a directory + * EXDEV Source and destination aren't in the same file system + * EROFS Destination is read-only + * EPERM Invalid source or destination file + * EEXIST Destination file already exists + * EFORMAT File system does not support clones + * EMEDIUMTYPE File system does not support clones + */ +int GPFS_API +gpfs_clone_copy(const char *sourcePathP, const char *destPathP); + + +/* NAME: gpfs_declone() + * + * FUNCTION: Copy blocks from clone parent(s) to child so that the + * parent blocks are no longer referenced by the child. + * + * Input: fileDesc: File descriptor for file to be de-cloned + * ancLimit: Ancestor limit (immediate parent only, or all) + * nBlocks: Maximum number of GPFS blocks to copy + * In/Out: offsetP: Pointer to starting offset within file (will be + * updated to offset of next block to process or + * -1 if no more blocks) + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL Invalid argument to function + * EBADF Bad file descriptor or not a GPFS file + * EPERM Not a regular file + * EACCESS Write access to target file not permitted + * EFAULT Input argument points outside accessible address space + * ENOSPC Not enough space on disk + */ + +/* Values for ancLimit */ +#define GPFS_CLONE_ALL 0 +#define GPFS_CLONE_PARENT_ONLY 1 + +int GPFS_API +gpfs_declone(gpfs_file_t fileDesc, int ancLimit, gpfs_off64_t nBlocks, + gpfs_off64_t *offsetP); + +/* NAME: gpfs_clone_split() + * + * FUNCTION: Split a clone child file from its parent. Must call + * gpfs_declone first, to remove all references. + * + * Input: fileDesc: File descriptor for file to be split + * ancLimit: Ancestor limit (immediate parent only, or all) + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL Invalid argument to function + * EBADF Bad file descriptor or not a GPFS file + * EPERM Not a regular file or not a clone child + * EACCESS Write access to target file not permitted + */ +int GPFS_API +gpfs_clone_split(gpfs_file_t fileDesc, int ancLimit); + +/* NAME: gpfs_clone_unsnap() + * + * FUNCTION: Change a clone parent with no children back into a + * normal file. + * + * Input: fileDesc: File descriptor for file to be un-snapped + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL Invalid argument to function + * EBADF Bad file descriptor or not a GPFS file + * EPERM Not a regular file or not a clone parent + * EACCESS Write access to target file not permitted + */ +int GPFS_API +gpfs_clone_unsnap(gpfs_file_t fileDesc); + +/* NAME: gpfs_get_fset_masks() + * + * FUNCTION: return bit masks governing "external" inode and inode-space numbering + * + * Input: fset_snaphandle: ptr to an fset snaphandle + * Output: the bit masks and inodes per block factor. + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + */ +int GPFS_API +gpfs_get_fset_masks(gpfs_fssnap_handle_t* fset_snapHandle, + gpfs_ino64_t* inodeSpaceMask, + gpfs_ino64_t* inodeBlockMask, + int* inodesPerInodeBlock); + + +/* + * API functions for Light Weight Event + */ + +/* + * Define light weight event types + */ +typedef enum +{ + GPFS_LWE_EVENT_UNKNOWN = 0, /* "Uknown event" */ + GPFS_LWE_EVENT_FILEOPEN = 1, /* 'OPEN' - look at getInfo('OPEN_FLAGS') if you care */ + GPFS_LWE_EVENT_FILECLOSE = 2, /* "File Close Event" 'CLOSE' */ + GPFS_LWE_EVENT_FILEREAD = 3, /* "File Read Event" 'READ' */ + GPFS_LWE_EVENT_FILEWRITE = 4, /* "File Write Event" 'WRITE' */ + GPFS_LWE_EVENT_FILEDESTROY = 5, /* File is being destroyed 'DESTROY' */ + GPFS_LWE_EVENT_FILEEVICT = 6, /* OpenFile object is being evicted from memory 'FILE_EVICT' */ + GPFS_LWE_EVENT_BUFFERFLUSH = 7, /* Data buffer is being written to disk 'BUFFER_FLUSH' */ + GPFS_LWE_EVENT_POOLTHRESHOLD = 8, /* Storage pool exceeded defined utilization 'POOL_THRESHOLD' */ + GPFS_LWE_EVENT_FILEDATA = 9, /* "Read/Write/Trunc" event on open file */ + GPFS_LWE_EVENT_FILERENAME = 10, /* Rename event on open file */ + GPFS_LWE_EVENT_FILEUNLINK = 11, /* Unlink file event */ + GPFS_LWE_EVENT_FILERMDIR = 12, /* Remove directory event */ + GPFS_LWE_EVENT_EVALUATE = 13, /* Evaluate And Set Events */ + + GPFS_LWE_EVENT_FILEOPEN_READ = 14, /* Open for Read Only - EVENT 'OPEN_READ' - deprecated, use 'OPEN' */ + GPFS_LWE_EVENT_FILEOPEN_WRITE = 15, /* Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */ + + GPFS_LWE_EVENT_FILEPOOL_CHANGE = 16, /* Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */ + GPFS_LWE_EVENT_XATTR_CHANGE = 17, /* EAs of file are changed */ + GPFS_LWE_EVENT_ACL_CHANGE = 18, /* ACLs (both GPFS ACLs and Posix permissions) of a file are changed */ + GPFS_LWE_EVENT_CREATE = 19, /* create, including mkdir, symlink, special file */ + GPFS_LWE_EVENT_GPFSATTR_CHANGE = 20, /* ts-specific attributes of file are changed */ + GPFS_LWE_EVENT_FILETRUNCATE = 21, /* "File Truncate Event" 'TRUNCATE' */ + + GPFS_LWE_EVENT_MAX = 22, /* 1 greater than any of the above */ +} gpfs_lwe_eventtype_t; + + +/* Define light weight event response types */ +typedef enum +{ + GPFS_LWE_RESP_INVALID = 0, /* "Response Invalid/Unknown" */ + GPFS_LWE_RESP_CONTINUE = 1, /* "Response Continue" */ + GPFS_LWE_RESP_ABORT = 2, /* "Response Abort" */ + GPFS_LWE_RESP_DONTCARE = 3 /* "Response DontCare" */ +} gpfs_lwe_resp_t; + +/* + * Define light weight event inofrmation + */ +#define LWE_DATA_FS_NAME 0x00000001 /* "fsName" */ +#define LWE_DATA_PATH_NAME 0x00000002 /* "pathName" */ +#define LWE_DATA_PATH_NEW_NAME 0x00000004 /* "pathNewName" for reanem */ +#define LWE_DATA_URL 0x00000008 /* "URL" */ +#define LWE_DATA_INODE 0x00000010 /* "inode" */ +#define LWE_DATA_OPEN_FLAGS 0x00000020 /* "openFlags" */ +#define LWE_DATA_POOL_NAME 0x00000040 /* "poolName" */ +#define LWE_DATA_FILE_SIZE 0x00000080 /* "fileSize" */ +#define LWE_DATA_OWNER_UID 0x00000100 /* "ownerUserId" */ +#define LWE_DATA_OWNER_GID 0x00000200 /* "ownerGroupId" */ +#define LWE_DATA_ATIME 0x00000400 /* "atime" */ +#define LWE_DATA_MTIME 0x00000800 /* "mtime" */ +#define LWE_DATA_NOW_TIME 0x00001000 /* "nowTime" */ +#define LWE_DATA_ELAPSED_TIME 0x00002000 /* "elapsedTime" */ +#define LWE_DATA_CLIENT_UID 0x00004000 /* "clientUserId" */ +#define LWE_DATA_CLIENT_GID 0x00008000 /* "clientGroupId" */ +#define LWE_DATA_NFS_IP 0x00010000 /* "clientIp" */ +#define LWE_DATA_PROCESS_ID 0x00020000 /* "processId" */ +#define LWE_DATA_TARGET_POOL_NAME 0x00040000 /* "targetPoolName" */ +#define LWE_DATA_BYTES_READ 0x00080000 /* "bytesRead" */ +#define LWE_DATA_BYTES_WRITTEN 0x00100000 /* "bytesWritten" */ +#define LWE_DATA_CLUSTER_NAME 0x00200000 /* "clusterName" */ +#define LWE_DATA_NODE_NAME 0x00400000 /* "nodeName" */ + +/* + * Define light weight events + */ +#define LWE_EVENT_EVALUATED 0x00000001 /* policy was evaluated */ +#define LWE_EVENT_FILEOPEN 0x00000002 /* "op_open" */ +#define LWE_EVENT_FILECLOSE 0x00000004 /* "op_close" */ +#define LWE_EVENT_FILEREAD 0x00000008 /* "op_read" */ +#define LWE_EVENT_FILEWRITE 0x00000010 /* "op_write" */ +#define LWE_EVENT_FILEDESTROY 0x00000020 /* "op_destroy" */ +#define LWE_EVENT_FILEEVICT 0x00000040 /* "op_evict" OpenFile object is being evicted from memory 'FILE_EVICT' */ +#define LWE_EVENT_BUFFERFLUSH 0x00000080 /* "op_buffer_flush" Data buffer is being written to disk 'BUFFER_FLUSH' */ +#define LWE_EVENT_POOLTHRESHOLD 0x00000100 /* "op_pool_threshhold" Storage pool exceeded defined utilization 'POOL_THRESHOLD' */ +#define LWE_EVENT_FILEDATA 0x00000200 /* "op_data" "Read/Write/Trunc" event on open file */ +#define LWE_EVENT_FILERENAME 0x00000400 /* "op_rename" Rename event on open file */ +#define LWE_EVENT_FILEUNLINK 0x00000800 /* "op_unlink" Unlink file event */ +#define LWE_EVENT_FILERMDIR 0x00001000 /* "op_rmdir" Remove directory event */ +#define LWE_EVENT_FILEOPEN_READ 0x00002000 /* "op_open_read" Open for Read Only - EVENT 'OPEN_READ' - deprecated, use 'OPEN' */ +#define LWE_EVENT_FILEOPEN_WRITE 0x00004000 /* "op_open_write" Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */ +#define LWE_EVENT_FILEPOOL_CHANGE 0x00008000 /* "op_pool_change" Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */ + +/* + * Defines for light weight sessions + */ +typedef unsigned long long gpfs_lwe_sessid_t; +#define GPFS_LWE_NO_SESSION ((gpfs_lwe_sessid_t) 0) +#define GPFS_LWE_SESSION_INFO_LEN 256 + + +/* + * Define light weight token to identify access right + */ +typedef struct gpfs_lwe_token +{ + unsigned long long high; + unsigned long long low; + +#ifdef __cplusplus + bool operator == (const struct gpfs_lwe_token& rhs) const + { return high == rhs.high && low == rhs.low; }; + bool operator != (const struct gpfs_lwe_token& rhs) const + { return high != rhs.high || low != rhs.low; }; +#endif /* __cplusplus */ + +} gpfs_lwe_token_t; + +/* Define special tokens */ +static const gpfs_lwe_token_t _gpfs_lwe_no_token = { 0, 0 }; +#define GPFS_LWE_NO_TOKEN _gpfs_lwe_no_token + +static const gpfs_lwe_token_t _gpfs_lwe_invalid_token = { 0, 1 }; +#define GPFS_LWE_INVALID_TOKEN _gpfs_lwe_invalid_token + +/* + * Note: LWE data managers can set a file's off-line bit + * or any of the managed bits visible to the policy language + * by calling dm_set_region or dm_set_region_nosync + * with a LWE session and LWE exclusive token. To set the bits + * there must be * exactly one managed region with offset = -1 + * and size = 0. Any other values will return EINVAL. + */ + +/* LWE also provides light weight regions + * that are set via policy rules. + */ +#define GPFS_LWE_MAX_REGIONS 2 + +/* LWE data events are generated from user access + * to a LWE managed region. */ +#define GPFS_LWE_DATAEVENT_NONE (0x0) +#define GPFS_LWE_DATAEVENT_READ (0x1) +#define GPFS_LWE_DATAEVENT_WRITE (0x2) +#define GPFS_LWE_DATAEVENT_TRUNCATE (0x4) +#define GPFS_LWE_ATTRCHANGEEVENT_IMMUTABILITY (0x8) +#define GPFS_LWE_ATTRCHANGEEVENT_APPENDONLY (0x10) + + + +/* + * Define light weight event structure + */ +typedef struct gpfs_lwe_event { + int eventLen; /* offset 0 */ + gpfs_lwe_eventtype_t eventType; /* offset 4 */ + gpfs_lwe_token_t eventToken; /* offset 8 <--- Must on DWORD */ + int isSync; /* offset 16 */ + int parmLen; /* offset 20 */ + char* parmP; /* offset 24 <-- Must on DWORD */ +} gpfs_lwe_event_t; + + + +/* + * Define light weight access rights + */ +#define GPFS_LWE_RIGHT_NULL 0 +#define GPFS_LWE_RIGHT_SHARED 1 +#define GPFS_LWE_RIGHT_EXCL 2 + + +/* Flag indicating whether to wait + * when requesting a right or an event + */ +#define GPFS_LWE_FLAG_NONE 0 +#define GPFS_LWE_FLAG_WAIT 1 + + + + + +/* NAME: gpfs_lwe_create_session() + * + * FUNCTION: create a light weight event session + * + * Input: oldsid: existing session id, + * Set to GPFS_LWE_NO_SESSION to start new session + * - If a session with the same name and id already exists + * it is not terminated, nor will outstanding events + * be redelivered. This is typically used if a session + * is shared between multiple processes. + * Set to an existing session's id to resume that session + * - If a session with the same name exists, that session + * will be terminated. All pending/outstanding events + * for the old session will be redelivered on the new one. + * This is typically used to take over a session from a + * failed/hung process. + * sessinfop: session string, unique for each session + * + * Output: newsidp: session id for new session + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL invalid parameters + * ENFILE maximum number of sessions have already been created + * ENOMEM insufficient memory to create new session + * ENOENT session to resume does not exist + * EEXIST session to resume exists with different id + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_create_session(gpfs_lwe_sessid_t oldsid, /* IN */ + char *sessinfop, /* IN */ + gpfs_lwe_sessid_t *newsidp); /* OUT */ + +#define GPFS_MAX_LWE_SESSION_INFO_LEN 100 + + + +/* NAME: gpfs_lwe_destroy_session() + * + * FUNCTION: destroy a light weight event session + * + * Input: sid: id of the session to be destroyed + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL sid invalid + * EBUSY session is busy + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_destroy_session(gpfs_lwe_sessid_t sid); /* IN */ + + + + +/* NAME: gpfs_lwe_getall_sessions() + * + * FUNCTION: fetch all lwe sessions + * + * Input: nelem: max number of elements + * sidbufp: array of session id + * nelemp: number of session returned in sidbufp + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL pass in args invalid + * E2BIG information is too large + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_getall_sessions(unsigned int nelem, /* IN */ + gpfs_lwe_sessid_t *sidbufp, /* OUT */ + unsigned int *nelemp); /* OUT */ + + +/* NAME: gpfs_lw_query_session() + * + * FUNCTION: query session string by id + * + * Input: sid: id of session to be queryed + * buflen: length of buffer + * bufp: buffer to store sessions string + * rlenp: returned length of bufp + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL pass in args invalid + * E2BIG information is too large + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_query_session(gpfs_lwe_sessid_t sid, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenP); /* OUT */ + + +/* NAME: gpfs_lwe_get_events() + * + * FUNCTION: get events from a light weight session + * + * Input: sid: id of the session + * maxmsgs: max number of event to fetch, + * 0 to fetch all possible + * flags: GPFS_LWE_EV_WAIT: waiting for new events if event + * queue is empty + * buflen: length of the buffer + * bufp: buffer to hold events + * rlenp: returned length of bufp + * + * Returns: 0 Success + * E2BIG information is too large + * EINVAL pass in args invalid + */ +int GPFS_API +gpfs_lwe_get_events(gpfs_lwe_sessid_t sid, /* IN */ + unsigned int maxmsgs, /* IN */ + unsigned int flags, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp); /* OUT */ + +/* NAME: gpfs_lwe_respond_event() + * + * FUNCTION: response to a light weight event + * + * Input: sid: id of the session + * token: token of the event + * response: response to the event + * reterror: return error to event callers + * + * Returns: 0 Success + * EINVAL pass in args invalid + * + */ +int GPFS_API +gpfs_lwe_respond_event(gpfs_lwe_sessid_t sid, /* IN */ + gpfs_lwe_token_t token, /* IN */ + gpfs_lwe_resp_t response, /* IN */ + int reterror); /* IN */ + + +/* NAME: gpfs_lwe_request_right + * + * FUNCTION: Request an access right to a file using a dmapi handle + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * right Shared or exclusive access requested + * flags Caller will wait to acquire access if necessary + * + * Output: token Unique identifier for access right + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * ESTALE GPFS not available + * EINVAL Invalid arguments + * EFAULT Invalid pointer provided + * EBADF Bad file + * ENOMEM Uable to allocate memory for request + * EPERM Caller does not hold appropriate privilege + * EAGAIN flags parameter did not include WAIT + * and process would be blocked + * + */ +int GPFS_API +gpfs_lwe_request_right(gpfs_lwe_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + unsigned int right, /* IN */ + unsigned int flags, /* IN */ + gpfs_lwe_token_t *token); /* OUT */ + + +/* NAME: gpfs_lwe_upgrade_right + * + * FUNCTION: Upgrade an access right from shared to exclusive + * + * This is a non-blocking call to upgrade an access right + * from shared to exclusive. If the token already conveys + * exclusive access this call returns imediately with sucess. + * If another process also holds a shared access right + * this call fails with EBUSY to avoid deadlocks. + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * + * Output: None + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * ESTALE GPFS not available + * EINVAL Invalid arguments + * EINVAL The token is invalid + * EFAULT Invalid pointer provided + * EPERM Caller does not hold appropriate privilege + * EPERM Token's right is not shared or exclusive + * EBUSY Process would be blocked + * + */ +int GPFS_API +gpfs_lwe_upgrade_right(gpfs_lwe_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + gpfs_lwe_token_t token); /* IN */ + + +/* NAME: gpfs_lwe_downgrade_right + * + * FUNCTION: Downgrade an access right from exclusive to shared + * + * This reduces an access right from exclusive to shared + * without dropping the exclusive right to acquire the shared. + * The token must convey exclusive right before the call. + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * + * Output: None + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * ESTALE GPFS not available + * EINVAL Invalid arguments + * EINVAL The token is invalid + * EFAULT Invalid pointer provided + * EPERM Caller does not hold appropriate privilege + * EPERM Token's right is not exclusive + * + */ +int GPFS_API +gpfs_lwe_downgrade_right(gpfs_lwe_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + gpfs_lwe_token_t token); /* IN */ + + +/* NAME: gpfs_lwe_release_right + * + * FUNCTION: Release an access right conveyed by a token + * + * This releases the access right held by a token + * and invalidates the token. Once the access right + * is released the token cannot be reused. + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * + * Output: None + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * ESTALE GPFS not available + * EINVAL Invalid arguments + * EINVAL The token is invalid + * EFAULT Invalid pointer provided + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_release_right(gpfs_lwe_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + gpfs_lwe_token_t token); /* IN */ + + +/* NAME: gpfs_lwe_getattrs() + * + * FUNCTION: Retrieves all extended file attributes in opaque format. + * This function together with gpfs_lwe_putattrs is intended for + * use by a backup program to save (gpfs_lwe_getattrs) and + * restore (gpfs_lwe_putattrs) all extended file attributes + * (ACLs, user attributes, ...) in one call. + * + * NOTE: This call is the lwe equivalent of gpfs_igetattrsx + * but uses a file handle to identify the file + * and an existing LWE token for locking it. + * + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * flags Define behavior of get attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement + * are not saved, neither is the current storage pool. + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement + * are saved, but the current storage pool is not. + * GPFS_ATTRFLAG_INCL_DMAPI - file attributes for dmapi are + * included in the returned buffer + * GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption + * are included in the returned buffer + * + * buffer: pointer to buffer for returned attributes + * bufferSize: size of buffer + * attrSize: ptr to returned size of attributes + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL invalid flags provided + * ENOSPC buffer too small to return all attributes + * *attrSizeP will be set to the size necessary + */ +int GPFS_API +gpfs_lwe_getattrs(gpfs_lwe_sessid_t sid, + void *hanp, + size_t hlen, + gpfs_lwe_token_t token, + int flags, + void *buffer, + int bufferSize, + int *attrSize); + + +/* NAME: gpfs_lwe_putattrs() + * + * FUNCTION: Sets all extended file attributes of a file. + * + * This routine can optionally invoke the policy engine + * to match a RESTORE rule using the file's attributes saved + * in the extended attributes to set the file's storage pool and + * data replication as when calling gpfs_fputattrswithpathname. + * When used with the policy the caller should include the + * full path to the file, including the file name, to allow + * rule selection based on file name or path. + * + * By default, the routine will not use RESTORE policy rules + * for data placement. The pathName parameter will be ignored + * and may be set to NULL. + * + * If the call does not use RESTORE policy rules, or if the + * file fails to match a RESTORE rule, or if there are no + * RESTORE rules installed, then the storage pool and data + * replication are selected as when calling gpfs_fputattrs(). + * + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_fgetattrs. + * + * pathName is a UTF-8 encoded string. On Windows, applications + * can convert UTF-16 ("Unicode") to UTF-8 using the platforms + * WideCharToMultiByte function. + * + * NOTE: This call is the lwe equivalent of gpfs_iputaattrsx + * but uses a file handle to identify the file + * and an existing LWE token for locking it. + * + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * flags Define behavior of put attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored + * but the storage pool and data replication are unchanged + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a placement rule + * instead of restoring the saved storage pool. + * GPFS_ATTRFLAG_USE_POLICY - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a RESTORE rule + * instead of restoring the saved storage pool. + * GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored + * after data is retored. If file is immutable/appendOnly + * call without this flag before restoring data + * then call with this flag after restoring data + * GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption + * are restored. Note that this may result in the file's + * File Encryption Key (FEK) being changed, and in this + * case any prior content in the file is effectively lost. + * This option should only be used when the entire file + * content is restored after the attributes are restored. + * + * buffer: pointer to buffer for returned attributes + * pathName: pointer to file path and file name for file + * May be set to NULL. + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EINVAL the buffer does not contain valid attribute data + * EINVAL invalid flags provided + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_lwe_putattrs(gpfs_lwe_sessid_t sid, + void *hanp, + size_t hlen, + gpfs_lwe_token_t token, + int flags, + void *buffer, + const char *pathName); + +const char* GPFS_API +gpfs_get_fspathname_from_fsname(const char* fsname_or_path); +/* Check that fsname_or_path refers to a GPFS file system and find the path to its root + Return a strdup()ed copy of the path -OR- NULL w/errno +*/ + +int GPFS_API +/* experimental */ +gpfs_qos_getstats( + const char *fspathname, /* in only: path to file system*/ + unsigned int options, /* in only: option flags: 0=begin at specified qip, 1=begin after qip */ + unsigned int qosid, /* in only: 0 or a specific qosid at which to start or continue */ + gpfs_pool_t poolid, /* in only: -1 or a specific poolid at which to start or continue */ + unsigned int mqips, /* in only: max number of qip=(qosid,poolid) histories to retrieve */ + unsigned int nslots, /* in only: max number of time slots of history to retrieve */ + void *bufferP, /* ptr to return stat structures */ + unsigned int bufferSize); /* sizeof stat buffer or 0 */ + +int GPFS_API +/* experimental */ +gpfs_qos_control( + const char *fspathname, /* in only: path to file system*/ + void *bufferP, /* in/out control/get/set structs */ + unsigned int bufferSize); + +int GPFS_API +gpfs_qos_set( + const char *fspathname, + const char *classname, /* "gold", "silver", or .. "1" or "2" .. */ + int id, /* process id or pgrp or userid */ + int which, /* process, pgrp or user */ + double* qshareP); /* return the share, percentage or when negative IOP limit */ +/* if id==0 then getpid() or getpgrp() or getuid() + if which==0 or 1 then process, if 2 process then group, if 3 then userid + Return -1 on error, with errno= + ENOSYS if QOS is not available in the currently installed GPFS software. + ENOENT if classname is not recognized. + ENXIO if QOS throttling is not active + (but classname is recognized and *qshareP has configured value) +*/ + +/* For the given process get QOS info */ +int GPFS_API +gpfs_qos_get( + const char *fspathname, + int *classnumP, + char classname[18], /* "gold", "silver", or .. "1" or "2" .. */ + int id, /* process id or pgrp or userid */ + int which, /* process, pgrp or user */ + double* qshareP); /* return the share, percentage or when negative IOP limit */ + +/* given classname, set *classnumP and set *qshareP + Return -1 on error, with errno= + ENOSYS if QOS is not available in the currently installed GPFS software. + ENOENT if classname is not recognized. + ENXIO if QOS throttling is not active + (but classname is recognized, *classnumP and *qshareP have configured values) +*/ +int GPFS_API +gpfs_qos_lkupName( + const char *fspathname, + int *classnumP, + const char *classname, + double* qshareP); + +/* given classnumber, find name and share (similar to above), but start with number instead of name */ +int GPFS_API +gpfs_qos_lkupVal( + const char *fspathname, + int val, + char classname[18], + double* qshareP); + +int GPFS_API +gpfs_ioprio_set(int,int,int); /* do not call directly */ + +int GPFS_API +gpfs_ioprio_get(int,int); /* do not call directly */ + + +/* NAME: gpfs_enc_file_rewrap_key() + * + * FUNCTION: Re-wrap the File Encryption Key (FEK) for the file, + * replacing the usage of the original (second parameter) + * Master Encryption Key (MEK) with the new key provided as + * the third parameter. The content of the file remains intact. + * + * If the FEK is not currently being wrapped with the MEK + * identified by the second parameter then no action is taken. + * + * This function is normally invoked before the original MEK is + * removed. + * + * The file may be opened in read-only mode for this function + * to perform the key rewrap. + * + * Superuser privilege is required to invoke this API. + * + * INPUT: fileDesc: File descriptor for file whose key is to be rewrapped + * orig_key_p: Key ID for the key (MEK) to be replaced + * new_key_p: Key ID for the new key (MEK) to be used + * + * OUTPUT: N/A + * + * Returns: 0 success + * -1 failure + * + * Errno: + * EACCESS Existing or new key cannot be retrieved + * The new key is already being used to wrap the + * file's FEK + * EBADF Bad file descriptor + * EINVAL Arguments are invalid: key format is incorrect + * EFAULT An invalid pointer is supplied; the associated + * data could not be copied in or out of the kernel + * E2BIG Key IDs provided are too long + * ENOSYS Function not available (cluster or file system not + * enabled for encryption) + * EPERM File is in a snapshot + * Caller must have superuser privilege + */ + +/* The Key ID is a string comprised of the key ID and the remote key + server RKM ID, separated by ':' */ +typedef const char *gpfs_enc_key_id_t; /* " : " */ + +int GPFS_API +gpfs_enc_file_rewrap_key(gpfs_file_t fileDesc, + gpfs_enc_key_id_t orig_key_p, + gpfs_enc_key_id_t new_key_p); + + +/* NAME: gpfs_enc_get_algo() + * + * FUNCTION: Retrieve a string describing the encryption algorithm, key + * length, Master Encryption Key(s) ID, and wrapping and combining + * mechanisms used for the file. + * + * INPUT: fileDesc: File descriptor for file whose encryption + * algorithm is being retrieved + * encryption_xattrP: content of the gpfs.Encryption + * extended attribute, retrieved by a call to + * gpfs_fcntl (with structure type GPFS_FCNTL_GET_XATTR) + * xattr_len: length of the data in encryption_xattrP + * algo_txt_size: space reserved by the caller for algo_txtP + * + * OUTPUT: algo_txtP: NULL-terminated string describing the + * encryption for the file + * + * Returns: 0 success + * -1 failure + * + * Errno: + * ENOENT File not found + * EBADF Bad file handle, not a GPFS file + * EACCESS Permission denied + * EFAULT Bad address provided + * EINVAL Not a regular file + * EINVAL Invalid values for xattr_len or algo_txt_size + * EINVAL Invalid content of encryption extended attribute + * ENOSYS Function not available + * E2BIG Output string does not fit in algo_txtP + */ + +int GPFS_API +gpfs_enc_get_algo(gpfs_file_t fileDesc, + const char *encryption_xattrP, + int xattr_len, + char *algo_txtP, + int algo_txt_size); + + +/* NAME: gpfs_init_trace() + * + * FUNCTION: Initialize the GPFS trace facility and start to use it. + * Must be called before calling gpfs_add_trace(). + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOENT file not found + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * ENFILE Too many open files + * ENOSYS Function not available + */ +int GPFS_API +gpfs_init_trace(void); + +/* NAME: gpfs_query_trace() + * + * FUNCTION: Query and cache the latest settings of GPFS trace facility. + * Generally this should be called by the notification handler + * for the "traceConfigChanged" event, which is invoked when + * something changes in the configuration of the trace facility. + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOENT file not found + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * ENFILE Too many open files + * ENOSYS Function not available + */ +int GPFS_API +gpfs_query_trace(void); + +/* NAME: gpfs_add_trace() + * + * FUNCTION: write the logs into GPFS trace driver. When the user specified + * parameter "level" is less than or equal to the GPFS trace level, + * the log message pointed to by parameter "msg" would be written to + * GPFS trace buffer, and user can use mmtracectl command to cut + * the GPFS trace buffer into a file to observe. Must be called after + * the call to gpfs_init_trace(). Also ensure the gpfs_query_trace() + * is called properly to update the gpfs trace level cached in + * application, otherwise, the trace may miss to write down to + * GPFS trace driver. + * + * Input: level: the level for this trace generation. When the level + * is less than or equal to the GPFS trace level, this + * trace record would be written to GPFS trace buffer. + * msg: the message string that would be put into GPFS trace buffer. + * + * Returns: None. + */ +void GPFS_API +gpfs_add_trace(int level, const char *msg); + +/* NAME: gpfs_fini_trace() + * + * FUNCTION: Stop using GPFS trace facility. This should be paired with + * gpfs_init_trace(), and must be called after the last + * gpfs_add_trace(). + * + * Returns: None. + */ + +void gpfs_fini_trace(void); + +/* + * When GPFS_64BIT_INODES is defined, use the 64-bit interface definitions as + * the default. + */ + +#ifdef GPFS_64BIT_INODES + #undef GPFS_D_VERSION + #define GPFS_D_VERSION GPFS_D64_VERSION + #undef GPFS_IA_VERSION + #define GPFS_IA_VERSION GPFS_IA64_VERSION + + #define gpfs_ino_t gpfs_ino64_t + #define gpfs_gen_t gpfs_gen64_t + #define gpfs_uid_t gpfs_uid64_t + #define gpfs_gid_t gpfs_gid64_t + #define gpfs_snapid_t gpfs_snapid64_t + #define gpfs_nlink_t gpfs_nlink64_t + #define gpfs_timestruc_t gpfs_timestruc64_t + #define gpfs_direntx_t gpfs_direntx64_t + #define gpfs_direntx gpfs_direntx64 + #define gpfs_iattr_t gpfs_iattr64_t + + #define gpfs_get_snapid_from_fssnaphandle gpfs_get_snapid_from_fssnaphandle64 + #define gpfs_open_inodescan gpfs_open_inodescan64 + #define gpfs_open_inodescan_with_xattrs gpfs_open_inodescan_with_xattrs64 + #define gpfs_next_inode gpfs_next_inode64 + #define gpfs_next_inode_with_xattrs gpfs_next_inode_with_xattrs64 + #define gpfs_seek_inode gpfs_seek_inode64 + #define gpfs_stat_inode gpfs_stat_inode64 + #define gpfs_stat_inode_with_xattrs gpfs_stat_inode_with_xattrs64 + #define gpfs_iopen gpfs_iopen64 + #define gpfs_ireaddir gpfs_ireaddir64 + #define gpfs_ireaddirx gpfs_ireaddirx64 + #define gpfs_iwritedir gpfs_iwritedir64 + #define gpfs_ireadlink gpfs_ireadlink64 +#endif + +#define gpfs_icreate gpfs_icreate64 + +#ifdef __cplusplus +} +#endif + +#endif /* H_GPFS */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/gpfs_fcntl.h b/System/ior/files/gpfs/5.0.2-3/include/gpfs_fcntl.h new file mode 100644 index 0000000..e9f3840 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/gpfs_fcntl.h @@ -0,0 +1,1137 @@ +/* Copyright (C) 2001 International Business Machines + * All rights reserved. + * + * This file is part of the GPFS user library. + * + * 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. + * + */ +/* @(#)51 1.85 src/avs/fs/mmfs/ts/kernext/gpfs_fcntl.h, mmfs, avs_rtac502, rtac5021836a 7/24/18 07:37:06 */ + +/* + * GPFS interface definitions for supporting I/O hints and directives. + * + * Usage: The argument to gpfs_fcntl is composed of the concatenation of + * structures defined in this file. The first structure must be of type + * gpfsFcntlHeader_t. This is immediately followed by additional + * structures, one for each hint or directive supplied. The totalLength + * field of the header contains the length of all of the structures, + * including the header itself. Each structure is defined to be a multiple + * of 8 bytes in length, and the highest alignment requirement of any of the + * data types is also 8 bytes, so the compiler will not insert padding when + * several structures are declared within an outer structure. This makes + * it easier to build up the necessary area before calling gpfs_fcntl. + * + * For example, the following code fragment first releases all cached data + * held on behalf of a file, then tells GPFS that this node will write + * the portion of the file with file offsets between 2G and 3G-1: + * struct + * { + * gpfsFcntlHeader_t hdr; + * gpfsClearFileCache_t rel; + * gpfsAccessRange_t acc; + * } arg; + * + * arg.hdr.totalLength = sizeof(arg); + * arg.hdr.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + * arg.hdr.fcntlReserved = 0; + * arg.rel.structLen = sizeof(arg.rel); + * arg.rel.structType = GPFS_CLEAR_FILE_CACHE; + * arg.acc.structLen = sizeof(arg.acc); + * arg.acc.structType = GPFS_ACCESS_RANGE; + * arg.acc.start = 2LL * 1024LL * 1024LL * 1024LL; + * arg.acc.length = 1024 * 1024 * 1024; + * arg.acc.isWrite = 1; + * rc = gpfs_fcntl(handle, &arg); + * + * If gpfs_fcntl returns an error (rc -1), errno will contain the error + * reason, and the errorOffset field of the header will contain the offset + * of the offending structure within the argument area. + * + * In general, the structures within the argument are processed in order. + */ + +#ifndef _h_gpfs_fcntl +#define _h_gpfs_fcntl + +/* open source interfaces */ +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Header of the parameter area passed to gpfs_fcntl */ +typedef struct +{ + int totalLength; /* length of this structure plus the sum of + the lengths of all structures in this + gpfs_fcntl argument */ + int fcntlVersion; /* version number: GPFS_FCNTL_CURRENT_VERSION */ + int errorOffset; /* returned value giving offset into parameter + area of the structure to which errno + pertains. Only set if errno is set. */ + int fcntlReserved; /* not used, should be set to 0 */ +} gpfsFcntlHeader_t; + +/* Moved it here from tshints.C, since function tschattr also uses it while + * filling in errReason into argument structure. */ +typedef struct +{ + int structLen; /* length of the entire argument */ + int structType; /* identifier of the hint */ +} genericStruct_t; + + +/* Interface version number (fcntlVersion field of gpfsFcntlHeader_t) */ +#define GPFS_FCNTL_CURRENT_VERSION 1 + +/* Maximum length of argument to gpfs_fcntl */ +#define GPFS_MAX_FCNTL_LENGTH 65536 + +/* Maximum length of a name argument passed to or returned from gpfs_fcntl. + Length of buffer must be a multiple of 8. */ +#define GPFS_FCNTL_MAX_NAME_BUFFER 1024 +#define GPFS_FCNTL_MIN_NAME_BUFFER 8 + + +/* Definitions of structType fields for GPFS hints. Hints can be ignored + by GPFS without affecting correct operation, although performance might + suffer. */ +#define GPFS_ACCESS_RANGE 1001 +#define GPFS_FREE_RANGE 1002 +#define GPFS_MULTIPLE_ACCESS_RANGE 1003 +#define GPFS_CLEAR_FILE_CACHE 1004 + +/* Definitions of structType fields for GPFS directives. GPFS must honor + directives, or return an error saying why a directive could not be + honored. */ +#define GPFS_CANCEL_HINTS 2001 +#define GPFS_FCNTL_SET_REPLICATION 2005 +#define GPFS_FCNTL_SET_STORAGEPOOL 2006 +#define GPFS_FCNTL_RESTRIPE_DATA 2007 +#define GPFS_FCNTL_RESTRIPE_RANGE 2008 + +#define GPFS_FCNTL_FSYNC_RANGE 2009 +#define GPFS_FCNTL_COMPRESSION_ON 2010 +#define GPFS_FCNTL_COMPRESSION_OFF 2011 +#define GPFS_FCNTL_COMPRESSION_LIB 2012 + +/* Definitions of structType fields for GPFS inquiries. Inquiries merely + return GPFS attributes of existing files. */ +#define GPFS_FCNTL_GET_REPLICATION 3001 +#define GPFS_FCNTL_GET_STORAGEPOOL 3002 +#define GPFS_FCNTL_GET_FILESETNAME 3003 +#define GPFS_FCNTL_GET_SNAPSHOTNAME 3004 +#define GPFS_FCNTL_GET_DATABLKDISKIDX 3005 /* obsoleted */ +#define GPFS_FCNTL_GET_DATABLKLOC 3006 +#define GPFS_FCNTL_GET_COMPRESSION 3007 +#define GPFS_FCNTL_GET_COMPRESSION_SUPPORT 3008 +#ifdef SNAPSHOT_ILM +#define GPFS_FCNTL_GET_SNAP_MIGRATION_SUPPORT 3009 +#endif + + +/* Structures for specifying the various gpfs_fcntl hints */ + +/* Access range hint: The application will soon access file offsets within + the given range, and will not access offsets outside the range. Violating + this hint may produce worse performance than if no hint was specified. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* hint identifier: GPFS_ACCESS_RANGE */ + long long start; /* start offset in bytes from beginning of file */ + long long length; /* length of range; 0 indicates to end of file */ + int isWrite; /* 0 - read access, 1 - write access */ + char padding[4]; +} gpfsAccessRange_t; + + +/* Free range hint: the application will no longer access file offsets + within the given range, so GPFS is free to flush those file offsets from + its cache. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* hint identifier: GPFS_FREE_RANGE */ + long long start; /* start offset in bytes from beginning of file */ + long long length; /* length of range; 0 indicates to end of file */ +} gpfsFreeRange_t; + + +/* Format of accRangeArray and relRangeArray entries used by + GPFS_MULTIPLE_ACCESS_RANGE hint */ +typedef struct +{ + long long blockNumber; /* data block number to access */ + int start; /* start of range (from beginning of block) */ + int length; /* number of bytes in the range */ + int isWrite; /* 0 - read access, 1 - write access */ + char padding[4]; +} gpfsRangeArray_t; + +/* Multiple access range hint: This hint is used to drive application-defined + prefetching and writebehind. The application will soon access the + portions of the blocks specified in accRangeArray, and has finished + accessing the ranges listed in relRangeArray. The size of a block is + returned by stat in the st_blksize field, so offset OFF of a file is in + block OFF/st_blksize. Up to GPFS_MAX_RANGE_COUNT blocks may be given in + one multiple access range hint. Depending on the current load, GPFS may + initiate prefetching of some or all of these. Each range named in + accRangeArray that is accepted for prefetching should eventually be + released via relRangeArray, or else GPFS will stop prefetching blocks + for this file. */ +#define GPFS_MAX_RANGE_COUNT 8 +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* hint identifier: GPFS_MULTIPLE_ACCESS_RANGE */ + int accRangeCnt; /* on input, number of ranges in accRangeArray + on output, number of processed ranges (the + first n of the given ranges) */ + int relRangeCnt; /* number of ranges in relRangeArray */ + gpfsRangeArray_t accRangeArray[GPFS_MAX_RANGE_COUNT]; /* requested ranges */ + gpfsRangeArray_t relRangeArray[GPFS_MAX_RANGE_COUNT]; /* ranges to release */ +} gpfsMultipleAccessRange_t; + + +/* Clear file cache hint: the application expects to no longer access any + portion of the file, so GPFS should flush and invalidate any cached + data belonging to this file. This may avoid synchronous cache invalidations + on later uses of the file by other nodes. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* hint identifier: GPFS_CLEAR_FILE_CACHE */ +} gpfsClearFileCache_t; + + + +/* Structures for specifying the various gpfs_fcntl directives */ + +/* Cancel all hints: GPFS removes any hints that may have been issued + against this file. Does not affect the contents of the GPFS file cache. + Note that this directive does not cancel the effects of other directives, + such as GPFS_CANCEL_HINTS. */ +typedef struct /* cancelAccessHints hint */ +{ + int structLen; /* length of this structure */ + int structType; /* hint identifier: GPFS_CANCEL_HINTS */ +} gpfsCancelHints_t; + + +/* This directive is used to set a file's replication factors. + However, the directive does not cause the file data to be restriped + immediately. Instead the caller must append a gpfsRestripeData_t directive + or invoke an mmrestripefs or an mmrestripefile command. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: + GPFS_FCNTL_SET_REPLICATION */ + int metadataReplicas; /* Set the number of copies of the file's + indirect blocks. Valid values are 1-3, + but not greater than the value of + maxMetadataReplicas. A value of 0 indicates + not to change the current value. */ + int maxMetadataReplicas; /* Set the maximum number of copies of a file's + indirect blocks. Space in the file's inode + and indirect blocks is reserved for the + maximum number of copies, regardless of the + current value. Valid values are 1-3. + A value of 0 indicates not to change the + current value. */ + int dataReplicas; /* Set the number of copies of the file's + data blocks. Valid values are 1-3, + but cannot be greater than the value of + maxDataReplicas. A value of 0 indicates + not to change the current value. */ + int maxDataReplicas; /* Set the maximum number of copies of a file's + data blocks. Space in the file's inode + and indirect blocks is reserved for the + maximum number of copies, regardless of the + current value. Valid values are 1-3. + A value of 0 indicates not the change the + current value. */ + int errReason; /* returned reason request failed. + Defined below. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + int reserved; /* unused, but should be set to 0 */ +} gpfsSetReplication_t; + + + +/* Values that may be returned by errReason */ + +/* No reason information was returned. */ +#define GPFS_FCNTL_ERR_NONE 0 + +/* MetadataReplicas is out of range. + errValue1 and errValue2 contain the valid lower and upper range boundaries. */ +#define GPFS_FCNTL_ERR_METADATA_REPLICAS_RANGE 1 + +/* MaxMetadataReplicas is out of range. + errValue1 and errValue2 contain the valid lower and upper range boundaries. */ +#define GPFS_FCNTL_ERR_MAXMETADATA_REPLICAS_RANGE 2 + +/* DataReplicas is out of range. + errValue1 and errValue2 contain the valid lower and upper range boundaries. */ +#define GPFS_FCNTL_ERR_DATA_REPLICAS_RANGE 3 + +/* MaxDataReplicas is out of range. + errValue1 and errValue2 contain the valid lower and upper range boundaries. */ +#define GPFS_FCNTL_ERR_MAXDATA_REPLICAS_RANGE 4 + +/* An attempt to change maxMetadataReplicas or maxDataReplicas or both + was made on a file that is not empty. */ +#define GPFS_FCNTL_ERR_FILE_NOT_EMPTY 5 + +/* MetadataReplicas or dataReplicas or both exceed the number of failure groups. + errValue1 contains the maximum number of metadata failure groups. + errValue2 contains the maximum number of data failure groups. */ +#define GPFS_FCNTL_ERR_REPLICAS_EXCEED_FGMAX 6 + + +/* This directive is used to set a file's assigned storage pool. + However, the directive does not cause the file data to be migrated + immediately. Instead the caller must append a gpfsRestripeData_t + directive or invoke a mmrestripefs or mmrestripefile command. + The caller must have root privileges to change a file's storage pool. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: + GPFS_FCNTL_SET_STORAGEPOOL */ + int errReason; /* returned reason request failed. + Defined below. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + int reserved; /* unused, but should be set to 0 */ + char buffer[GPFS_FCNTL_MAX_NAME_BUFFER]; /* Null-terminated name of + storage pool to be assigned */ +} gpfsSetStoragePool_t; + + +/* Values that may be returned by errReason */ + +/* Invalid storage pool name was given. */ +#define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL 7 + +/* Invalid storage pool. File cannot be assigned to given pool. */ +#define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL_TYPE 8 + +/* Invalid storage pool. Directories cannot be assigned to given pool. */ +#define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL_ISDIR 9 + +/* Invalid storage pool. System files cannot be assigned to given pool. */ +#define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL_ISLNK 10 + +/* Invalid storage pool. System files cannot be assigned to given pool. */ +#define GPFS_FCNTL_ERR_INVALID_STORAGE_POOL_ISSYS 11 + +/* File system has not been upgraded to support storage pools */ +#define GPFS_FCNTL_ERR_STORAGE_POOL_NOTENABLED 12 + +/* User does not have permission to perform the requested operation */ +#define GPFS_FCNTL_ERR_NOPERM 13 + + + + +/* This directive is used to restripe a file's data blocks to update + its replication and/or migrate its data. The data movement is always + done immediately. */ + +typedef struct +{ + long long startOffset; /* start of range to restripe in bytes */ + long long numOfBlks; /* blocks (size st_blksize) to restripe */ +} gpfsByteRange_t; + +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: + GPFS_FCNTL_RESTRIPE_FILE */ + int options; /* options for restripe command. Defined below. + See mmrestripefs command for details. */ + int errReason; /* returned reason request failed. + Defined below. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + int reserved1; /* unused, but should be set to 0 */ + int reserved2; /* unused, but should be set to 0 */ +} gpfsRestripeData_t; + +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: + GPFS_FCNTL_RESTRIPE_RANGE */ + int options; /* options for restripe command. Defined below. + See mmrestripefs command for details. */ + int errReason; /* returned reason request failed. + Defined below. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + gpfsByteRange_t range; /* Should be zero unless + GPFS_FCNTL_RESTRIPE_RANGE_R is set */ + int reserved1; /* unused, but should be set to 0 */ + int reserved2; /* unused, but should be set to 0 */ +} gpfsRestripeRange_t; + +typedef struct { + long long blkNum; + long long diskNum; + long long sector; +} BadBlock; + +/* Maximum length of output buffer in gpfsRestripeRange_t */ +#define MAX_COMP_BUF_LEN (64 * 1024) +/* Maximum count of BadBlock that can be stored in output buffer */ +#define MAX_COMP_BLOCK_NUM ((MAX_COMP_BUF_LEN - sizeof(long long)) / sizeof(BadBlock)) + +typedef struct BadBlockInfo { + long long nBadBlocks; /* number of bad blocks */ + BadBlock badBlocks[0]; /* bad block info array */ +} BadBlockInfo_t; + +/* Difference between gpfsRestripeRange_t and gpfsRestripeRangeV2_t + is that gpfsRestripeRangeV2_t has an outBuf which could be used + to pass information from daemon back to caller. Currently, only + GPFS_FCNTL_RESTRIPE_CM uses the buffer. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: + GPFS_FCNTL_RESTRIPE_RANGE */ + int options; /* options for restripe command. Defined below. + See mmrestripefs command for details. */ + int errReason; /* returned reason request failed. + Defined below. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + gpfsByteRange_t range; /* Should be zero unless + GPFS_FCNTL_RESTRIPE_RANGE_R is set */ + int reserved1; /* unused, but should be set to 0 */ + int reserved2; /* unused, but should be set to 0 */ + + /* Fields above should be kept the same as gpfsRestripeRange_t. */ + + char *outBuf; /* buffer to store daemon returned info + Caller is responsible to allocate + and deallocate the buffer. + Now only GPFS_FCNTL_RESTRIPE_CM use it + to return bad replica info. */ + int bufLen; /* length of the buffer */ + + int reserved3; /* unused, but should be set to 0 */ +} gpfsRestripeRangeV2_t; + +/* Define values for restripe options. + See mmrestripefs command for complete definitions. */ + +/* Migrate critical data off of suspended disks. */ +#define GPFS_FCNTL_RESTRIPE_M 0x0001 + +/* Replicate data against subsequent failure. */ +#define GPFS_FCNTL_RESTRIPE_R 0x0002 + +/* Place file data in assigned storage pool. */ +#define GPFS_FCNTL_RESTRIPE_P 0x0004 + +/* Rebalance file data */ +#define GPFS_FCNTL_RESTRIPE_B 0x0008 + +/* Restripe a range of file data. On input, the start of the range is given by + range.startOffset (in bytes) and the size is given by range.numOfBlks (using + a block size of st_blksize). If range startOffset is beyond EOF (strictly + greater than st_size for files, and inode.fileSize for directories) + gpfs_fcntl() fails and sets errno to ERANGE. Upon success, range.numOfBlks + is updated to be the last block number that was processed. Thus, the next + iteration should set startOffset to (numOfBlks + 1) * st_blksize. */ +#define GPFS_FCNTL_RESTRIPE_RANGE_R 0x0010 + +/* Compress or uncompress a file according to the compression bit of the file */ +#define GPFS_FCNTL_RESTRIPE_C 0x0020 +/* Compress or uncompress a range according to the compression bit of the file */ +#define GPFS_FCNTL_RESTRIPE_RC 0x0040 + +/* Relocate file data */ +#define GPFS_FCNTL_RESTRIPE_L 0x0080 + +/* Compare file data */ +#define GPFS_FCNTL_RESTRIPE_CM 0x0100 + +/* Fast file system rebalance option */ +#define GPFS_FCNTL_RESTRIPE_B_FAST 0x200 + +/* Compare file data but do not fix mismatch */ +#define GPFS_FCNTL_RESTRIPE_CM_RO 0x0400 + +/* Values that may be returned by errReason */ + +/* Not enough replicas could be created because the desired degree + of replication is larger than the number of failure groups. */ +#define GPFS_FCNTL_ERR_NO_REPLICA_GROUP 14 + +/* Not enough replicas could be created because there was not + enough space left in one of the failure groups. */ +#define GPFS_FCNTL_ERR_NO_REPLICA_SPACE 15 + +/* There was not enough space left on one of the disks to properly + balance the file according to the current stripe method. */ +#define GPFS_FCNTL_ERR_NO_BALANCE_SPACE 16 + +/* The file could not be properly balanced because one or more + disks are unavailable. */ +#define GPFS_FCNTL_ERR_NO_BALANCE_AVAILABLE 17 + +/* All replicas were on disks that have since been deleted + from the stripe group. */ +#define GPFS_FCNTL_ERR_ADDR_BROKEN 18 + +/* No immutable attribute can be set on directories */ +#define GPFS_FCNTL_ERR_NO_IMMUTABLE_DIR 19 + +/* No immutable attribute can be set on system files */ +#define GPFS_FCNTL_ERR_NO_IMMUTABLE_SYSFILE 20 + +/* Immutable and indefinite retention flag wrong */ +#define GPFS_FCNTL_ERR_IMMUTABLE_FLAG 21 + +/* Immutable and indefinite retension flag wrong */ +#define GPFS_FCNTL_ERR_IMMUTABLE_PERM 22 + +/* AppendOnly flag should be set separately */ +#define GPFS_FCNTL_ERR_APPENDONLY_CONFLICT 23 + +/* Cannot set immutable or appendOnly on snapshots */ +#define GPFS_FCNTL_ERR_NOIMMUTABLE_ONSNAP 24 + +/* An attempt to change maxDataReplicas or maxMetadataReplicas + was made on a file that has extended attributes. */ +#define GPFS_FCNTL_ERR_FILE_HAS_XATTRS 25 + +/* This file is not part of a GPFS file system */ +#define GPFS_FCNTL_ERR_NOT_GPFS_FILE 26 + + + + + + +/* Values that may be returned by errValue1 */ + +/* Strict replica allocation option set to be yes */ +#define GPFS_FCNTL_STATUS_STRICT_REPLICA_YES 0x0010 + +/* Strict replica allocation option set to be no */ +#define GPFS_FCNTL_STATUS_STRICT_REPLICA_NO 0x0020 + +/* Strict replica allocation option set to be whenpossible */ +#define GPFS_FCNTL_STATUS_STRICT_REPLICA_WHENPOSSIBLE 0x0040 + +/* Structures for specifying the various gpfs_fcntl inquiries. + The inquiry directives may be used to obtain attributes of a file + such as the file's replication factors, storage pool name, + fileset name or snapshot name. */ + +/* This inquiry is used to obtain a file's replication factors. */ +typedef struct + { + int structLen; /* length of this structure */ + int structType; /* inquiry identifier: + GPFS_FCNTL_GET_REPLICATION */ + int metadataReplicas; /* returns the current number of copies + of indirect blocks for the file. */ + int maxMetadataReplicas; /* returns the maximum number of copies + of indirect blocks for the file. */ + int dataReplicas; /* returns the current number of copies + of data blocks for the file. */ + int maxDataReplicas; /* returns the maximum number of copies + of data blocks for the file. */ + int status; /* returns the status of the file. + Status values defined below. */ + int reserved; /* unused, but should be set to 0 */ +} gpfsGetReplication_t; + + +/* Flag definitions */ + +/* If set this file may have some broken data block. */ +#define GPFS_FCNTL_STATUS_BROKEN 0x80000000 + +/* If set this file may have some data where the only replicas are + on suspended disks; implies some data may be lost if suspended + disks are removed. */ +#define GPFS_FCNTL_STATUS_EXPOSED 0x40000000 + +/* If set this file may not be properly replicated, i.e. some data + may have fewer or more than the desired number of replicas, + or some replicas may be on suspended disks. */ +#define GPFS_FCNTL_STATUS_ILLREPLICATED 0x20000000 + +/* If set this file may not be properly balanced. */ +#define GPFS_FCNTL_STATUS_UNBALANCED 0x10000000 + +/* If set this file has stale data blocks on at least one of the disks + that are marked as unavailable or recovering in the stripe group + descriptor. */ +#define GPFS_FCNTL_STATUS_DATAUPDATEMISS 0x08000000 + +/* If set this file has stale indirect blocks on at least one + unavailable or recovering disk. */ +#define GPFS_FCNTL_STATUS_METAUPDATEMISS 0x04000000 + +/* If set this file may not be properly placed, i.e. some data may + be stored in an incorrect storage pool */ +#define GPFS_FCNTL_STATUS_ILLPLACED 0x02000000 +#define GPFS_FCNTL_STATUS_ILLCOMPRESSED 0x01000000 + +#define GPFS_FCNTL_STATUS_FPO_ILLPLACED 0X00800000 + + + +/* This inquiry is used to obtain the name of the storage pool in which + the file's data is stored. The size of the buffer may vary, but it must be + a multiple of 8. Upon successful completion of the call, the buffer + will contain a null-terminated character string for the name of the + file's storage pool. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* inquiry identifier: + GPFS_FCNTL_GET_STORAGEPOOL */ + char buffer[GPFS_FCNTL_MAX_NAME_BUFFER]; /* returns the file's + storage pool name */ +} gpfsGetStoragePool_t; + + +/* This inquiry is used to obtain the name of the fileset to which this + file has been assigned. The size of the buffer may vary, but it must be + a multiple of 8. Upon successful completion of the call, the buffer + will contain a null-terminated character string for the name of the + file's fileset. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* inquiry identifier: + GPFS_FCNTL_GET_FILESETNAME */ + char buffer[GPFS_FCNTL_MAX_NAME_BUFFER]; /* returns with the file's + fileset name */ +} gpfsGetFilesetName_t; + + +/* This inquiry is used to obtain the name of the snapshot that includes + this file. If the file is not part of a snapshot, then a zero-length + string will be returned. The size of the buffer may vary, but it must be + a multiple of 8. Upon successful completion of the call, the buffer + will contain a null-terminated character string for the name of the + snapshot that includes this file. */ +typedef struct { + int structLen; /* length of this structure */ + int structType; /* inquiry identifier: + GPFS_FCNTL_GET_SNAPSHOTNAME */ + char buffer[GPFS_FCNTL_MAX_NAME_BUFFER]; /* returns with the file's + snapshot name */ +} gpfsGetSnapshotName_t; + +/* Allow tschattr to change file immutable attribute */ +#define GPFS_FCNTL_SET_IMMUTABLE 5000 + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_SET_IMMUTABLE */ + int setImmutable; /* value to set the immutable flag */ + int setIndefiniteRetention; /* value to set IndefiniteRetention */ + int errReasonCode; /* reason code */ + int reserved; /* reserved field */ +} gpfsSetImmutable_t; + +#define GPFS_FCNTL_GET_IMMUTABLE 5001 + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_GET_IMMUTABLE */ + int immutable; /* value of the immutable flag */ + int indefiniteRetention; /* value of the indefiniteRetention flag */ + int errReasonCode; /* reason code */ + int reserved; /* reserved field */ +} gpfsGetImmutable_t; + +#define GPFS_FCNTL_SET_EXPIRATION_TIME 5002 + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_SET_IMMUTABLE */ + long long expTime; /* expiration time */ + int errReasonCode; /* reason code */ + int reserved; /* reserved field */ +} gpfsSetExpTime_t; + +#define GPFS_FCNTL_GET_EXPIRATION_TIME 5003 + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_GET_EXPIRATION_TIME */ + long long expTime; /* expiration Time */ + int errReasonCode; /* reason code */ + int reserved; /* reserved field */ +} gpfsGetExpTime_t; + + +#define GPFS_FCNTL_SET_APPENDONLY 5004 + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_SET_APPENDONLY */ + int setAppendOnly; /* value to set the appendOnly flag */ + int setIndefiniteRetention; /* value to set IndefiniteRetention */ + int errReasonCode; /* reason code */ + int reserved; /* reserved field */ +} gpfsSetAppendOnly_t; + +#define GPFS_FCNTL_GET_APPENDONLY 5005 + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_GET_APPENDONLY */ + int appendOnly; /* value of the appendOnly flag */ + int indefiniteRetention; /* value of the indefiniteRetention flag */ + int errReasonCode; /* reason code */ + int reserved; /* reserved field */ +} gpfsGetAppendOnly_t; + + +/* Deprecated in favor of calling gpfs_prealloc(fd, 0, 0). */ +#define GPFS_FCNTL_COMPACT_DIR 5006 + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_COMPACT_DIR */ + int errReasonCode; /* reason code */ + int reserved; /* reserved field */ +} gpfsCompactDir_t; + + + +/* + * Provide access to a file's extended attributes + * + * Extended attributes are persistent name,value pairs assigned to files or + * directories. The name is typically a character string which is terminated + * by a null ('\0') character which is included in the name length. + * Attributes set internally or for dmapi may follow other conventions. + * An attributes's value is a binary string which is not interpreted + * by this api. + * + * Attribute names are typically divided into namespaces, both to avoid + * collisions and to enforce access controls. The namespaces currently + * defined are: + * + * "user." -- requires permission to access file data + * "system." -- used by kernel for access control lists + * "trusted." -- requires admin/root privilege + * "security." -- used by Security Enhanced Linux + * "archive." -- reserved for GPFS + * "dmapi." -- reserved for the X/Open Data Storage Management API (XDSM) + * "gpfs." -- reserved for GPFS + * + * For example, "user.name1" or "system.posix_acl_default". + * Additional namespaces may be defined in future releases. Users should + * restrict the names used to a predefined namespace. + * + * Setting or resetting attributes reserved by GPFS or other middleware + * services may have unintended consequences and is not recommended. + * + * Attributes are created via the SET_XATTR call with a value length of + * zero or more bytes. By default, setting an extended attribute will create + * the attribute if it does not exist or will replace the current value if + * it does. Using the CREATE flag causes a pure create which fails if the + * attribute already exists. Likewise using the REPLACE flag causes a pure + * replace which fails if the attribute does not exist. + * + * Attributes are deleted by calling SET_XATTR with a negative length. Using + * the DELETE flag causes a pure delete which fails if the attribute does + * not exist. + * + * By default, setting or deleting an extended attribute is done + * asynchronously. That is to say, the update is not written to disk until + * some time after the call completes. Using the SYNC option causes the + * update to be committed to disk before the call completes. The update + * to a single attribute is always done atomically. Either the original value + * is retained or the complete new value will be set. + * + * More than one attribute may be set or deleted within a single fcntl call. + * The updates are applied in the order specified in the fcntl vector. + * If the file system fails, there is no guarantee that all updates will + * be applied, even if using the SYNC options. If sync is specified on the + * last update in the vector, then all prior updates to attributes will also + * be written with the final update. + * + * In order to see an attribute via the GET_XATTR or LIST_XATTR call + * the caller must have sufficient privilege to set the attribute. + * + * Errors are returned in the errReturnCode field. + * + * + * Note: Extended attributes are stored as character or binary strings. + * Care should be taken when used on mixed architectures with different + * byte orders or word sizes to insure the attribute values are in an + * architecture independent format. + * + */ +#define GPFS_FCNTL_GET_XATTR 6001 +#define GPFS_FCNTL_SET_XATTR 6002 +#define GPFS_FCNTL_LIST_XATTR 6003 + +#define GPFS_FCNTL_XATTR_MAX_NAMELEN 256 /* includes trailing null char */ +#define GPFS_FCNTL_XATTR_MAX_VALUELEN (16 * 1024) + +#define GPFS_FCNTL_XATTRFLAG_NONE 0x0000 +#define GPFS_FCNTL_XATTRFLAG_SYNC 0x0001 /* synchronous update + All updates are committed + before the call returns */ +#define GPFS_FCNTL_XATTRFLAG_CREATE 0x0002 /* pure create + will fail if already exists */ +#define GPFS_FCNTL_XATTRFLAG_REPLACE 0x0004 /* pure replace + will fail if does not exist */ +#define GPFS_FCNTL_XATTRFLAG_DELETE 0x0008 /* pure delete + will fail if does not exist */ +#define GPFS_FCNTL_XATTRFLAG_NO_CTIME 0x0010 /* Update will not set ctime. + Must have admin authority. */ +#define GPFS_FCNTL_XATTRFLAG_MO_PARENT 0x0020 /* Update clone parent. + Must have admin authority. */ +#define GPFS_FCNTL_XATTRFLAG_RESERVED 0x8000 /* obsolete */ + +/* Define error reason codes for extended attributes */ +#define GPFS_FCNTL_ERR_NO_ATTR 27 +#define GPFS_FCNTL_ERR_ATTR_EXISTS 28 +#define GPFS_FCNTL_ERR_BUFFER_TOO_SMALL 29 +#define GPFS_FCNTL_ERR_NO_ATTR_SPACE 30 +#define GPFS_FCNTL_ERR_INVAL_VALUE 31 + + + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_GET_XATTR + or GPFS_FCNTL_SET_XATTR */ + int nameLen; /* length of attribute name + may include trailing '\0' character */ + int bufferLen; /* + for GPFS_FCNTL_GET_XATTR + INPUT: length of buffer + OUTPUT: length of attribute value + + for GPFS_FCNTL_SET_XATTR + INPUT: length of attribute value + length = -1 to delete attribute */ + unsigned int flags; /* defined above. */ + int errReasonCode; /* reason code */ + char buffer[0]; /* buffer for name and value. + + for GPFS_FCNTL_GET_XATTR + + INPUT: name begins at offset 0 + and must be null terminated. + OUTPUT: name is returned unchanged + value begins at nameLen rounded up + to a multiple of 8. + + for GPFS_FCNTL_SET_XATTR + + INPUT: name begins at offset 0 + and must be null terminated. + value begins at nameLen rounded up + to a multiple of 8. + + actual length of buffer should be + nameLen rounded up to a multiple of 8 + + valueLen rounded up to a multiple of 8 + + Buffer size set by caller. Maximum + size is (GPFS_FCNTL_XATTR_MAX_NAMELEN + + GPFS_FCNTL_XATTR_MAX_VALUELEN) */ +} gpfsGetSetXAttr_t; + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_LIST_XATTR */ + int bufferLen; /* INPUT: length of buffer + OUTPUT: length of returned list of names */ + int errReasonCode; /* reason code */ + char buffer[0]; + /* buffer for returned list of names + Each attribute name is prefixed with + a 1-byte name length. The next attribute name + follows immediately in the buffer (and is + prefixed with its own length). Following + the last name a '\0' is appended to + terminate the list. The returned bufferLen + includes the final '\0'. + + \6abcdef\3ABC\9user.name\0 + + Caution: An attribute name may include embedded + and/or trailing null bytes: + + \13gpfs.DIRECTIO\11dmapi.t\1\0\3\0\0 + + The actual length of the buffer required + depends on the number of attributes set on + the file and the length of each attribute name. + If the buffer provided is too small for all + of the returned names, the errReasonCode + will be set to GPFS_FCNTL_ERR_BUFFER_TOO_SMALL + and bufferLen will be set to the minimum + size buffer required to list all attributes. + An initial buffer length of 0 may be used to + query the attributes and determine the + correct buffer size for this file. */ + +} gpfsListXAttr_t; + + + + + + +typedef struct OffsetLoc { + long long offset; + int diskNum[]; /* array of locations based on number of replicas returned */ +} OffsetLoc; + +typedef struct FilemapIn { + long long startOffset; /* start offset in bytes */ + long long skipfactor; /* number of bytes to skip before next offset read */ + long long length; /* number of bytes (start offset + length / skipfactor = numblks returned */ + int mreplicas; /* number of replicas user wants. 0 - all, + 1 - primary, 2 - primary and 1st replica, 3 - all */ + int reserved; /* for now to align it to the 8byte boundary */ +} FilemapIn; + +typedef struct FilemapOut { + int numReplicasReturned; + int numBlksReturned; + int blockSize; + int blockSizeHigh; /* High 32bits of block size */ + char buffer [GPFS_MAX_FCNTL_LENGTH-1024]; /* packs offset, disklocation1, disklocation2.... */ +} FilemapOut; + +typedef struct GetDataBlkDiskIdx { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_GET_DATABLKDISKIDX */ + FilemapIn filemapIn; /* Input parameters specified by the user */ + FilemapOut filemapOut; /* Output data */ +} GetDataBlkDiskIdx; +typedef struct GetDataBlkDiskIdx gpfsGetDataBlkDiskIdx_t; + +typedef struct { + int structLen; /* length of this structure */ + int structType; /* function identifier: + GPFS_FCNTL_FSYNC_RANGE */ + int how; + long long startOffset; + long long length; +} gpfsFsyncRange_t; + +#define GPFS_FCNTL_ERR_COMPRESS_NOTREGULAR 32 +#define GPFS_FCNTL_ERR_COMPRESS_CLONE 33 +#define GPFS_FCNTL_ERR_COMPRESS_SNAPSHOT 34 +#define GPFS_FCNTL_ERR_COMPRESS_OLD_FILESYSTEM 35 +#define GPFS_FCNTL_ERR_COMPRESS_AFM 36 +#define GPFS_FCNTL_ERR_COMPRESS_HYPERALLOC 37 +#define GPFS_FCNTL_ERR_COMPRESS_NOT_ALLOWED 38 + +#define GPFS_FCNTL_ERR_COMPARE_DATA_IN_INODE 39 +#define GPFS_FCNTL_ERR_COMPRESS_LIB_SELECT 40 +#define GPFS_FCNTL_ERR_COMPRESS_LIB_SUPPORT 41 +#define GPFS_FCNTL_ERR_COMPRESS_LIB_LOAD_FAILED 42 +#define GPFS_FCNTL_ERR_DISK_OFFLINE 43 + +/* Turn on or off compression. Zlib compression library is selected by default when using + this GPFS_FCNTL_COMPRESSION_ON structType/directive. Use gpfsSetCompressionLib_t, + with GPFS_FCNTL_COMPRESSION_LIB directive (defined below) to select any other supported + compression library (lz4 is currently supported). This directive only flags the file to + be compressed or uncompressed (and it turns on the file's illCompressed bit). To actually + compress or uncompressed the file, append a gpfsRestripeData_t structure with + GPFS_FCNTL_RESTRIPE_FILE structType and set the GPFS_FCNTL_RESTRIPE_C bit in its options + field. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: GPFS_FCNTL_COMPRESSION_ON + GPFS_FCNTL_COMPRESSION_OFF */ + int errReason; /* returned reason request failed. + Defined below. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + int reserved; /* unused, but should be set to 0 */ +} gpfsSetCompression_t; + +/* Specify the compression library to be used to compress a file. + Supported compression libraries include "z" and "lz4" (for libz and lz4 compression + libraries). This directive only sets the selected compression library of the file + without actually compressing the file. To unset selected compression library of the + file, use gpfsCsetCompression_t defined above with GPFS_FCNTL_COMPRESSION_OFF as + structType. To actually compress or uncompress the file, append a gpfsRestripeData_t + structure with GPFS_FCNTL_RESTRIPE_FILE as the structType and set the GPFS_FCNTL_RESTRIPE_C + bit in its options field. */ +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: GPFS_FCNTL_COMPRESSION_LIB */ + int errReason; /* returned reason request failed. + Defined below. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + int reserved; /* unused, but should be set to 0 */ + char *libName; /* Null-terminated name of compression lib to be used */ +} gpfsSetCompressionLib_t; + +/* fle compression status bits */ +#define GPFS_FCNTL_COMPRESS_UNSET 0x0 +#define GPFS_FCNTL_COMPRESS_SET 0x1 +#define GPFS_FCNTL_COMPRESS_ILL_COMPRESSED 0x2 + +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: GPFS_FCNTL_GET_COMPRESSION */ + int compressStatus; /* file compression status bits defined above */ + int errReason; /* returned reason request failed. + Defined below. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + int reserved1; /* unused, but should be set to 0 */ + int reserved2; /* unused, but should be set to 0 */ +} gpfsGetCompression_t; + +/* compression non-support bits */ +#define GPFS_FCNTL_CANNOT_COMPRESS_OLD_FILESYSTEM 0x1 +#define GPFS_FCNTL_CANNOT_COMPRESS_SNAPSHOT 0x2 +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: GPFS_FCNTL_GET_COMPRESSION_SUPPORT */ + int compressNonSupport; /* compression support status of this object or directory tree + 0: compression is supported. The non-support bit(s) + defined above indicates the reason for non-support otherwise. */ + int errReason; /* returned reason request failed. */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + int reserved1; /* unused, but should be set to 0 */ + int reserved2; /* unused, but should be set to 0 */ +} gpfsGetCompressionSupport_t; + +#ifdef SNAPSHOT_ILM + +/* reason if snapshot migration is unsupported */ +#define GPFS_FCNTL_CANNOT_MIGRATE_SNAP_OLD_FILESYSTEM 0x1 +#define GPFS_FCNTL_CANNOT_MIGRATE_SNAP_OLD_SNAPSHOT 0x2 +typedef struct +{ + int structLen; /* length of this structure */ + int structType; /* directive identifier: GPFS_FCNTL_GET_SNAP_MIGRATION_SUPPORT */ + int supported; /* migration support status of this snapshot + 1/0 - supported/unsupported + if unsupported, unsupportRC contains the reason */ + int unsupportRC; /* reason why unsupported */ + int errReason; /* returned reason request failed */ + int errValue1; /* returned value depending upon errReason */ + int errValue2; /* returned value depending upon errReason */ + int reserved1; /* unused, but should be set to 0 */ +} gpfsGetSnapMigrationSupport_t; + +#endif + +/* NAME: gpfs_fcntl() + * + * FUNCTION: Pass hints and directives to GPFS on behalf of an open file + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * EBADF Bad file handle + * EINVAL Not a GPFS file + * EINVAL Not a regular file + * EINVAL Ill-formed hint or directive + * E2BIG Argument longer than GPFS_MAX_FCNTL_LENGTH + */ + +int GPFS_API +gpfs_fcntl(gpfs_file_t fileDesc, /* Open file descriptor */ + void* fcntlArgP); /* argument list */ + +/* + * NAME: gpfs_restripe_file() + * + * FUNCTION: Restripes a file by calling gpfs_fcntl for noBlocks + * from start offset. If noBlocks 0 ==> use default increment size + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS No quality of service function available + * ENOENT File not found + * EINVAL Not a GPFS file + * ESTALE cached fs information was invalid + */ + +int GPFS_API +gpfs_restripe_file(gpfs_file_t fileDesc, /* Open file descriptor */ + void* fcntlArgP, /* argument list */ + int noBlocks); /* number of blocks used for each + iteration when restriping a + file */ + +/* similar but by logical part number */ +int GPFS_API +gpfs_restripe_file_by_parts(gpfs_file_t fileDesc, + void* fcntlArgP, + int part_number, /* e.g. part 3 of ... */ + int number_of_parts); /* ... 4 parts */ + +#ifdef __cplusplus +} +#endif + +#endif /* _h_gpfs_fcntl */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/gpfs_gpl.h b/System/ior/files/gpfs/5.0.2-3/include/gpfs_gpl.h new file mode 100644 index 0000000..75ed4f3 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/gpfs_gpl.h @@ -0,0 +1,4047 @@ +/* */ +/* Copyright (C) 2001 International Business Machines */ +/* All rights reserved. */ +/* */ +/* This file is part of the GPFS user library. */ +/* */ +/* 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. */ +/* */ +/* @(#)42 1.1.2.212 src/avs/fs/mmfs/ts/util/gpfs.h, mmfs, avs_rtac502, rtac5021836a 8/23/18 07:58:19 */ +/* + * Library calls for GPFS interfaces + */ +#ifndef H_GPFS +#define H_GPFS + +#include + +/* Define GPFS_64BIT_INODES to map the default interface definitions + to 64-bit interfaces. Without this define, the 32-bit interface + is the default. Both interfaces are always present, but the + define sets the default. The actual mapping can be found near the + end of this header. */ +/* #define GPFS_64BIT_INODES 1 */ + +#define NFS_IP_SIZE 46 + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(WIN32) && defined(GPFSDLL) + + /* The following errno values either are missing from Windows errno.h or + have a conflicting value. Other errno values (e.g. EPERM) are okay. */ + #define GPFS_EALREADY 37 /* Operation already in progress */ + #define GPFS_EOPNOTSUPP 45 /* Operation not supported */ + #define GPFS_EDQUOT 69 /* Disk quota exceeded */ + #define GPFS_ESTALE 9 /* No file system (mapped to EBADF) */ + #define GPFS_EFORMAT 19 /* Unformatted media (mapped to ENODEV) */ + + /* specify the library calling convention */ + #define GPFS_API __stdcall + + /* On Windows, this is a HANDLE as returned by CreateFile() */ + typedef void* gpfs_file_t; + +#else /* not gpfs.dll on Windows */ + + #define GPFS_API + /* On UNIX systems, this is a file descriptor as returned by open() */ + typedef int gpfs_file_t; + +#endif + + +typedef unsigned int gpfs_uid_t; +typedef long long gpfs_off64_t; +typedef unsigned long long gpfs_uid64_t; + +typedef struct gpfs_timestruc +{ + unsigned int tv_sec; + unsigned int tv_nsec; +} gpfs_timestruc_t; + +typedef struct gpfs_timestruc64 +{ + long long tv_sec; + unsigned int tv_nsec; +} gpfs_timestruc64_t; + +#define GPFS_SLITE_SIZE_BIT 0x00000001 +#define GPFS_SLITE_BLKSIZE_BIT 0x00000002 +#define GPFS_SLITE_BLOCKS_BIT 0x00000004 +#define GPFS_SLITE_ATIME_BIT 0x00000010 +#define GPFS_SLITE_MTIME_BIT 0x00000020 +#define GPFS_SLITE_CTIME_BIT 0x00000040 +#define GPFS_SLITE_EXACT_BITS 0x00000077 + +/* Returns "1" if the attribute is requested to be accurate. + (On output, indicates the value returned in statbufP is accurate). */ +#define GPFS_SLITE(m) (0 == (m)) +#define GPFS_SLITE_SIZET(m) (0 != ((m) & GPFS_SLITE_SIZE_BIT)) +#define GPFS_SLITE_BLKSIZE(m) (0 != ((m) & GPFS_SLITE_BLKSIZE_BIT)) +#define GPFS_SLITE_BLOCKS(m) (0 != ((m) & GPFS_SLITE_BLOCKS_BIT)) +#define GPFS_SLITE_ATIME(m) (0 != ((m) & GPFS_SLITE_ATIME_BIT)) +#define GPFS_SLITE_MTIME(m) (0 != ((m) & GPFS_SLITE_MTIME_BIT)) +#define GPFS_SLITE_CTIME(m) (0 != ((m) & GPFS_SLITE_CTIME_BIT)) +#define GPFS_SLITE_EXACT(m) (GPFS_SLITE_EXACT_BITS == (m)) + +/* Sets the litemask bit indicating that the attribute should be accurate */ +#define GPFS_S_SLITE(m) (m) = 0 +#define GPFS_S_SLITE_SIZET(m) (m) |= GPFS_SLITE_SIZE_BIT +#define GPFS_S_SLITE_BLKSIZE(m) (m) |= GPFS_SLITE_BLKSIZE_BIT +#define GPFS_S_SLITE_BLOCKS(m) (m) |= GPFS_SLITE_BLOCKS_BIT +#define GPFS_S_SLITE_ATIME(m) (m) |= GPFS_SLITE_ATIME_BIT +#define GPFS_S_SLITE_MTIME(m) (m) |= GPFS_SLITE_MTIME_BIT +#define GPFS_S_SLITE_CTIME(m) (m) |= GPFS_SLITE_CTIME_BIT +#define GPFS_S_SLITE_EXACT(m) (m) |= GPFS_SLITE_EXACT_BITS + +#define GPFS_STATLITE 0 +#define GPFS_NOFOLLOW 1 + +/* Mapping of buffer for gpfs_getacl, gpfs_putacl. */ +typedef struct gpfs_opaque_acl +{ + int acl_buffer_len; /* INPUT: Total size of buffer (including this field). + OUTPUT: Actual size of the ACL information. */ + unsigned short acl_version; /* INPUT: Set to zero. + OUTPUT: Current version of the returned ACL. */ + unsigned char acl_type; /* INPUT: Type of ACL: access (1) or default (2). */ + char acl_var_data[1]; /* OUTPUT: Remainder of the ACL information. */ +} gpfs_opaque_acl_t; + +/* ACL types (acl_type field in gpfs_opaque_acl_t or gpfs_acl_t) */ +#define GPFS_ACL_TYPE_ACCESS 1 +#define GPFS_ACL_TYPE_DEFAULT 2 +#define GPFS_ACL_TYPE_NFS4 3 + +/* gpfs_getacl, gpfs_putacl flag indicating structures instead of the + opaque style data normally used. */ +#define GPFS_GETACL_STRUCT 0x00000020 +#define GPFS_PUTACL_STRUCT 0x00000020 + +/* gpfs_getacl, gpfs_putacl flag indicating smbd is the caller */ +#define GPFS_ACL_SAMBA 0x00000040 + +/* Defined values for gpfs_aclVersion_t */ +#define GPFS_ACL_VERSION_POSIX 1 +#define GPFS_ACL_VERSION_NFS4F 3 /* GPFS_ACL_VERSION_NFS4 plus V4FLAGS */ +#define GPFS_ACL_VERSION_NFS4 4 + +/* Values for gpfs_aclLevel_t */ +#define GPFS_ACL_LEVEL_BASE 0 /* compatible with all acl_version values */ +#define GPFS_ACL_LEVEL_V4FLAGS 1 /* requires GPFS_ACL_VERSION_NFS4 */ + +/* Values for gpfs_aceType_t (ACL_VERSION_POSIX) */ +#define GPFS_ACL_USER_OBJ 1 +#define GPFS_ACL_GROUP_OBJ 2 +#define GPFS_ACL_OTHER 3 +#define GPFS_ACL_MASK 4 +#define GPFS_ACL_USER 5 +#define GPFS_ACL_GROUP 6 + +/* Values for gpfs_acePerm_t (ACL_VERSION_POSIX) */ +#define ACL_PERM_EXECUTE 001 +#define ACL_PERM_WRITE 002 +#define ACL_PERM_READ 004 +#define ACL_PERM_CONTROL 010 + +/* Values for gpfs_aceType_t (ACL_VERSION_NFS4) */ +#define ACE4_TYPE_ALLOW 0 +#define ACE4_TYPE_DENY 1 +#define ACE4_TYPE_AUDIT 2 +#define ACE4_TYPE_ALARM 3 + +/* Values for gpfs_aceFlags_t (ACL_VERSION_NFS4) */ +#define ACE4_FLAG_FILE_INHERIT 0x00000001 +#define ACE4_FLAG_DIR_INHERIT 0x00000002 +#define ACE4_FLAG_NO_PROPAGATE 0x00000004 +#define ACE4_FLAG_INHERIT_ONLY 0x00000008 +#define ACE4_FLAG_SUCCESSFUL 0x00000010 +#define ACE4_FLAG_FAILED 0x00000020 +#define ACE4_FLAG_GROUP_ID 0x00000040 +#define ACE4_FLAG_INHERITED 0x00000080 + +/* GPFS-defined flags. Placed in a separate ACL field to avoid + ever running into newly defined NFSv4 flags. */ +#define ACE4_IFLAG_SPECIAL_ID 0x80000000 + +/* Values for gpfs_aceMask_t (ACL_VERSION_NFS4) */ +#define ACE4_MASK_READ 0x00000001 +#define ACE4_MASK_LIST_DIR 0x00000001 +#define ACE4_MASK_WRITE 0x00000002 +#define ACE4_MASK_ADD_FILE 0x00000002 +#define ACE4_MASK_APPEND 0x00000004 +#define ACE4_MASK_ADD_SUBDIR 0x00000004 +#define ACE4_MASK_READ_NAMED 0x00000008 +#define ACE4_MASK_WRITE_NAMED 0x00000010 +#define ACE4_MASK_EXECUTE 0x00000020 + +/* The rfc doesn't provide a mask equivalent to "search" ("x" on a + * directory in posix), but it also doesn't say that its EXECUTE + * is to have this dual use (even though it does so for other dual + * use permissions such as read/list. Going to make the assumption + * here that the EXECUTE bit has this dual meaning... otherwise + * we're left with no control over search. + */ +#define ACE4_MASK_SEARCH 0x00000020 + +#define ACE4_MASK_DELETE_CHILD 0x00000040 +#define ACE4_MASK_READ_ATTR 0x00000080 +#define ACE4_MASK_WRITE_ATTR 0x00000100 +#define ACE4_MASK_DELETE 0x00010000 +#define ACE4_MASK_READ_ACL 0x00020000 +#define ACE4_MASK_WRITE_ACL 0x00040000 +#define ACE4_MASK_WRITE_OWNER 0x00080000 +#define ACE4_MASK_SYNCHRONIZE 0x00100000 +#define ACE4_MASK_ALL 0x001f01ff + +/* Values for gpfs_uid_t (ACL_VERSION_NFS4) */ +#define ACE4_SPECIAL_OWNER 1 +#define ACE4_SPECIAL_GROUP 2 +#define ACE4_SPECIAL_EVERYONE 3 + +/* per-ACL flags imported from a Windows security descriptor object */ +#define ACL4_FLAG_OWNER_DEFAULTED 0x00000100 +#define ACL4_FLAG_GROUP_DEFAULTED 0x00000200 +#define ACL4_FLAG_DACL_PRESENT 0x00000400 +#define ACL4_FLAG_DACL_DEFAULTED 0x00000800 +#define ACL4_FLAG_SACL_PRESENT 0x00001000 +#define ACL4_FLAG_SACL_DEFAULTED 0x00002000 +#define ACL4_FLAG_DACL_UNTRUSTED 0x00004000 +#define ACL4_FLAG_SERVER_SECURITY 0x00008000 +#define ACL4_FLAG_DACL_AUTO_INHERIT_REQ 0x00010000 +#define ACL4_FLAG_SACL_AUTO_INHERIT_REQ 0x00020000 +#define ACL4_FLAG_DACL_AUTO_INHERITED 0x00040000 +#define ACL4_FLAG_SACL_AUTO_INHERITED 0x00080000 +#define ACL4_FLAG_DACL_PROTECTED 0x00100000 +#define ACL4_FLAG_SACL_PROTECTED 0x00200000 +#define ACL4_FLAG_RM_CONTROL_VALID 0x00400000 +#define ACL4_FLAG_NULL_DACL 0x00800000 +#define ACL4_FLAG_NULL_SACL 0x01000000 +#define ACL4_FLAG_VALID_FLAGS 0x01ffff00 + + +/* Externalized ACL defintions */ +typedef unsigned int gpfs_aclType_t; +typedef unsigned int gpfs_aclLen_t; +typedef unsigned int gpfs_aclLevel_t; +typedef unsigned int gpfs_aclVersion_t; +typedef unsigned int gpfs_aclCount_t; +typedef unsigned int gpfs_aclFlag_t; + +typedef unsigned int gpfs_aceType_t; +typedef unsigned int gpfs_aceFlags_t; +typedef unsigned int gpfs_acePerm_t; +typedef unsigned int gpfs_aceMask_t; + +/* A POSIX ACL Entry */ +typedef struct gpfs_ace_v1 +{ + gpfs_aceType_t ace_type; /* POSIX ACE type */ + gpfs_uid_t ace_who; /* uid/gid */ + gpfs_acePerm_t ace_perm; /* POSIX permissions */ +} gpfs_ace_v1_t; + +/* An NFSv4 ACL Entry */ +typedef struct gpfs_ace_v4 +{ + gpfs_aceType_t aceType; /* Allow or Deny */ + gpfs_aceFlags_t aceFlags; /* Inherit specifications, etc. */ + gpfs_aceFlags_t aceIFlags; /* GPFS Internal flags */ + gpfs_aceMask_t aceMask; /* NFSv4 mask specification */ + gpfs_uid_t aceWho; /* User/Group identification */ +} gpfs_ace_v4_t; + +/* when GPFS_ACL_VERSION_NFS4, and GPFS_ACL_LEVEL_V4FLAGS */ +typedef struct v4Level1_ext /* ACL extension */ +{ + gpfs_aclFlag_t acl_flags; /* per-ACL flags */ + gpfs_ace_v4_t ace_v4[1]; +} v4Level1_t; + +/* The GPFS ACL */ +typedef struct gpfs_acl +{ + gpfs_aclLen_t acl_len; /* Total length of this ACL in bytes */ + gpfs_aclLevel_t acl_level; /* Reserved (must be zero) */ + gpfs_aclVersion_t acl_version; /* POSIX or NFS4 ACL */ + gpfs_aclType_t acl_type; /* Access, Default, or NFS4 */ + gpfs_aclCount_t acl_nace; /* Number of Entries that follow */ + union + { + gpfs_ace_v1_t ace_v1[1]; /* when GPFS_ACL_VERSION_POSIX */ + gpfs_ace_v4_t ace_v4[1]; /* when GPFS_ACL_VERSION_NFS4 */ + v4Level1_t v4Level1; /* when GPFS_ACL_LEVEL_V4FLAGS */ + }; +} gpfs_acl_t; + + +/* NAME: gpfs_getacl() + * + * FUNCTION: Retrieves the ACL information for a file. + * + * The aclP parameter must point to a buffer mapped by either: + * - gpfs_opaque_acl_t (when flags are zero). In this case, + * the opaque data that is intended to be used by a backup + * program (restoreed by passing this data back on a subsequent + * call to gpfs_putacl). + * - gpfs_acl_t (when GPFS_GETACL_STRUCT is specified). In this + * case, the data can be interpreted by the calling application + * (and may be modified and applied to the file by passing it + * to gpfs_putacl...along with the GPFS_PUTACL_STRUCT flag). + * + * On input, the first four bytes of the buffer must contain its + * total size. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * ENOSPC buffer too small to return the entire ACL. + * Needed size is returned in the first four + * bytes of the buffer pointed to by aclP. + * EINVAL Invalid arguments + * ENOTDIR Not on directory + * ENOMEM Out of memory + */ +int GPFS_API +gpfs_getacl(const char *pathname, + int flags, + void *acl); + + +/* NAME: gpfs_putacl() + * + * FUNCTION: Sets the ACL information for a file. + * The buffer passed in should contain the ACL data + * that was obtained by a previous call to gpfs_getacl. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Invalid arguments + * ENOTDIR Not on directory + * ENOMEM Out of memory + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_putacl(const char *pathname, + int flags, + void *acl); + + +/* NAME: gpfs_prealloc() + * + * FUNCTION: Preallocate disk storage for a file or directory, starting + * at the specified startOffset and covering at least the number + * of bytes requested by bytesToPrealloc. Allocations are rounded + * to block boundaries (block size can be found in st_blksize + * returned by fstat()), or possibly larger sizes. For files, the + * file descriptor must be open for write, but any existing data + * already present will not be modified. Reading the preallocated + * blocks will return zeros. For directories, the file descriptor + * may be open for read but the caller must have write permission, + * and existing entries are unaffected; startOffset must be zero. + * + * This function implements the behavior of mmchattr when invoked + * with --compact[=minimumEntries]. The minimumEntries value + * specifies both the lower bound on automatic compaction and the + * desired size for pre-allocation. It defaults to zero, meaning + * no pre-allocation and compact the directory as much as + * possible. The mapping between minimumEntries and the + * bytesToPrealloc is given by GPFS_PREALLOC_DIR_SLOT_SIZE, see + * below. + * + * Directory compaction (zero bytesToPrealloc) requires a file + * system supporting V2 directories (format version 1400, v4.1). + * Directories created before upgrading the file system to version + * 4.1, are upgraded from V1 to V2 by this operation even if no + * other change is made. Since v4.2.2, bytesToPrealloc may be + * nonzero effecting pre-allocation by setting a minimum + * compaction size. Prior to v4.2.2 the minimum size of any + * directory is zero. + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS No prealloc service available + * EBADF Bad file descriptor + * EINVAL Not a GPFS file + * EINVAL Not a regular file or directory + * EINVAL Directory pre-allocation not supported + * EINVAL startOffset or bytesToPrealloc < 0 + * EACCES File not opened for writing + * EACCES Caller does not have write access to directory. + * EDQUOT Quota exceeded + * ENOSPC Not enough space on disk + * EPERM File is in a snapshot + */ +int GPFS_API +gpfs_prealloc(gpfs_file_t fileDesc, + gpfs_off64_t startOffset, + gpfs_off64_t bytesToPrealloc); + +/* Directory entries are nominally (assuming compact names of 19 bytes or less) + 32 bytes in size. This conversion factor is used in mapping between a + number of entries (for mmchattr) and a size when calling gpfs_prealloc. */ +#define GPFS_PREALLOC_DIR_SLOT_SIZE 32 /* for size => bytes per entry */ + + +typedef struct gpfs_winattr +{ + gpfs_timestruc_t creationTime; + unsigned int winAttrs; /* values as defined below */ +} gpfs_winattr_t; + +/* winAttrs values */ +#define GPFS_WINATTR_ARCHIVE 0x0001 +#define GPFS_WINATTR_COMPRESSED 0x0002 +#define GPFS_WINATTR_DEVICE 0x0004 +#define GPFS_WINATTR_DIRECTORY 0x0008 +#define GPFS_WINATTR_ENCRYPTED 0x0010 +#define GPFS_WINATTR_HIDDEN 0x0020 +#define GPFS_WINATTR_NORMAL 0x0040 +#define GPFS_WINATTR_NOT_CONTENT_INDEXED 0x0080 +#define GPFS_WINATTR_OFFLINE 0x0100 +#define GPFS_WINATTR_READONLY 0x0200 +#define GPFS_WINATTR_REPARSE_POINT 0x0400 +#define GPFS_WINATTR_SPARSE_FILE 0x0800 +#define GPFS_WINATTR_SYSTEM 0x1000 +#define GPFS_WINATTR_TEMPORARY 0x2000 +#define GPFS_WINATTR_HAS_STREAMS 0x4000 + + +/* NAME: gpfs_get_winattrs() + * gpfs_get_winattrs_path() + * + * FUNCTION: Returns gpfs_winattr_t attributes + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOENT file not found + * EBADF Bad file handle, not a GPFS file + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * EFAULT Bad address provided + * EINVAL Not a regular file + * ENOSYS function not available + */ +int GPFS_API +gpfs_get_winattrs(gpfs_file_t fileDesc, gpfs_winattr_t *attrP); + +int GPFS_API +gpfs_get_winattrs_path(const char *pathname, gpfs_winattr_t *attrP); + + +/* NAME: gpfs_set_winattrs() + * gpfs_set_winattrs_path() + * + * FUNCTION: Sets gpfs_winattr_t attributes (as specified by + * the flags). + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOENT file not found + * EBADF Bad file handle, not a GPFS file + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * EFAULT Bad address provided + * EINVAL Not a regular file + * ENOSYS function not available + */ +int GPFS_API +gpfs_set_winattrs(gpfs_file_t fileDesc, int flags, gpfs_winattr_t *attrP); + +int GPFS_API +gpfs_set_winattrs_path(const char *pathname, int flags, gpfs_winattr_t *attrP); + +/* gpfs_set_winattr flag values */ +#define GPFS_WINATTR_SET_CREATION_TIME 0x08 +#define GPFS_WINATTR_SET_ATTRS 0x10 + +/* + * NAME: gpfs_set_times(), gpfs_set_times_path() + * + * FUNCTION: Sets file access time, modified time, change time, + * and/or creation time (as specified by the flags). + * + * Input: flagsfileDesc : file descriptor of the object to set + * pathname : path to a file or directory + * flag : define time value to set + * GPFS_SET_ATIME - set access time + * GPFS_SET_MTIME - set mod. time + * GPFS_SET_CTIME - set change time + * GPFS_SET_CREATION_TIME - set creation time + * GPFS_SET_TIME_NO_FOLLOW - don't follow links + * times : array to times + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EBADF Not a GPFS File + * EINVAL invalid argument + * EACCES Permission denied + * EROFS Filesystem is read only + * ENOENT No such file or directory + */ +typedef gpfs_timestruc_t gpfs_times_vector_t[4]; + +int GPFS_API +gpfs_set_times(gpfs_file_t fileDesc, int flags, gpfs_times_vector_t times); + +int GPFS_API +gpfs_set_times_path(char *pathname, int flags, gpfs_times_vector_t times); + +/* gpfs_set_times flag values */ +#define GPFS_SET_ATIME 0x01 +#define GPFS_SET_MTIME 0x02 +#define GPFS_SET_CTIME 0x04 +#define GPFS_SET_CREATION_TIME 0x08 +#define GPFS_SET_TIME_NO_FOLLOW 0x10 + + +/* NAME: gpfs_set_share() + * + * FUNCTION: Acquire shares + * + * Input: fileDesc : file descriptor + * allow : share type being requested + * GPFS_SHARE_NONE, GPFS_SHARE_READ, + * GPFS_SHARE_WRITE, GPFS_SHARE_BOTH + * deny : share type to deny to others + * GPFS_DENY_NONE, GPFS_DENY_READ, + * GPFS_DENY_WRITE, GPFS_DENY_BOTH + * + * Returns: 0 Success + * -1 Failure + * + * Errno: EBADF Bad file handle + * EINVAL Bad argument given + * EFAULT Bad address provided + * ENOMEM Memory allocation failed + * EACCES share mode not available + * ENOSYS function not available + */ + +/* allow/deny specifications */ +#define GPFS_SHARE_NONE 0 +#define GPFS_SHARE_READ 1 +#define GPFS_SHARE_WRITE 2 +#define GPFS_SHARE_BOTH 3 +#define GPFS_SHARE_ALL 3 +#define GPFS_DENY_NONE 0 +#define GPFS_DENY_READ 1 +#define GPFS_DENY_WRITE 2 +#define GPFS_DENY_BOTH 3 +#define GPFS_DENY_DELETE 4 +#define GPFS_DENY_ALL 7 + +int GPFS_API +gpfs_set_share(gpfs_file_t fileDesc, + unsigned int share, + unsigned int deny); + + +/* NAME: gpfs_set_lease() + * + * FUNCTION: Acquire leases for Samba + * + * Input: fileDesc : file descriptor + * leaseType : lease type being requested + * GPFS_LEASE_NONE GPFS_LEASE_READ, + * GPFS_LEASE_WRITE + * + * Returns: 0 Success + * -1 Failure + * + * Errno: EBADF Bad file handle + * EINVAL Bad argument given + * EFAULT Bad address provided + * ENOMEM Memory allocation failed + * EAGAIN lease not available + * EACCES permission denied + * EOPNOTSUPP unsupported leaseType + * ESTALE unmounted file system + * ENOSYS function not available + */ + +/* leaseType specifications */ +#define GPFS_LEASE_NONE 0 +#define GPFS_LEASE_READ 1 +#define GPFS_LEASE_WRITE 2 + +int GPFS_API +gpfs_set_lease(gpfs_file_t fileDesc, + unsigned int leaseType); + + +/* NAME: gpfs_get_lease() + * + * FUNCTION: Returns the type of lease currently held + * + * Returns: GPFS_LEASE_READ + * GPFS_LEASE_WRITE + * GPFS_LEASE_NONE + * + * Returns: >= 0 Success + * -1 Failure + * + * Errno: EINVAL + */ +int GPFS_API +gpfs_get_lease(gpfs_file_t fileDesc); + + + /* NAME: gpfs_get_realfilename(), gpfs_get_realfilename_path() + * + * FUNCTION: Interface to get real name of a file. + * + * INPUT: File descriptor, pathname, buffer, bufferlength + * OUTPUT: Real file name stored in file system + * + * Returns: 0 Success + * -1 Failure + * + * Errno: EBADF Bad file handle + * EINVAL Not a regular file + * EFAULT Bad address provided + * ENOSPC buffer too small to return the real file name. + * Needed size is returned in buflen parameter. + * ENOENT File does not exist + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * ENOSYS function not available + */ +int GPFS_API +gpfs_get_realfilename(gpfs_file_t fileDesc, + char *fileNameP, + int *buflen); + +int GPFS_API +gpfs_get_realfilename_path(const char *pathname, + char *fileNameP, + int *buflen); + + /* NAME: gpfs_ftruncate() + * + * FUNCTION: Interface to truncate a file. + * + * INPUT: File descriptor + * length + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EBADF Bad file handle + * EBADF Not a GPFS file + * EINVAL Not a regular file + * ENOENT File does not exist + * ENOMEM Memory allocation failed + * EINVAL length < 0 + * EACCESS Permission denied + */ +int GPFS_API +gpfs_ftruncate(gpfs_file_t fileDesc, gpfs_off64_t length); + +#define GPFS_WIN_CIFS_REGISTERED 0x02000000 +typedef struct cifsThreadData_t +{ + unsigned int dataLength; /* Total buffer length */ + unsigned int share; /* gpfs_set_share declaration */ + unsigned int deny; /* gpfs_set_share specification */ + unsigned int lease; /* gpfs_set_lease lease type */ + unsigned int secInfoFlags; /* Future use. Must be zero */ + gpfs_uid_t sdUID; /* Owning user */ + gpfs_uid_t sdGID; /* Owning group */ + int shareLocked_fd; /* file descriptor with share locks */ + unsigned int aclLength ; /* Length of the following ACL */ + gpfs_acl_t acl; /* The initial ACL for create/mkdir */ +} cifsThreadData_t; + + /* NAME: gpfs_register_cifs_export() + * + * FUNCTION: Register a CIFS export process. + * + * INPUT: implicit use of the process ids + * + * Returns: 0 Successful + * ENOSYS function not available + * EACCES cannot establish credentials + * ENOMEM temporary shortage of memory + * EINVAL prior process/thread registrations exist + * EBADF unable to allocate a file descriptor + */ +int GPFS_API +gpfs_register_cifs_export(void); + + /* NAME: gpfs_unregister_cifs_export() + * + * FUNCTION: remove a registration for a CIFS export + * + * INPUT: implicit use of the process ids + * + * Returns: 0 Successful + * ENOSYS function not available + * EACCES cannot establish credentials + * ENOMEM temporary shortage of memory + */ +int GPFS_API +gpfs_unregister_cifs_export(void); + + /* NAME: gpfs_register_cifs_buffer() + * + * FUNCTION: Register a CIFS thread/buffer combination + * + * INPUT: implicit use of the process and thread ids + * Address of a cifsThreadData_t structure that will include + * a GPFS ACL (GPFS_ACL_VERSION_NFS4/GPFS_ACL_LEVEL_V4FLAGS) + * that can be applied at file/dir creation. + * + * Returns: 0 Successful + * ENOSYS function not available + * EACCES cannot establish credentials + * ENOMEM unable to allocate required memory + * EINVAL no associated process registrion exists + * bad dataLength in buffer. + */ +int GPFS_API +gpfs_register_cifs_buffer(cifsThreadData_t *bufP); + + /* NAME: gpfs_unregister_cifs_buffer() + * + * FUNCTION: remove a CIFS thread/buffer registration + * + * INPUT: implicit use of the process and thread ids + * + * Returns: 0 Successful + * ENOSYS function not available + * EACCES cannot establish credentials + * ENOMEM unable to allocate required memory + * EINVAL no associated process registrion exists + */ +int GPFS_API +gpfs_unregister_cifs_buffer(void); + +/* NAME: gpfs_lib_init() + * + * FUNCTION: Open GPFS main module device file + * + * INPUT: Flags + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + */ +int GPFS_API +gpfs_lib_init(int flags); + +/* NAME: gpfs_lib_term() + * + * FUNCTION: Close GPFS main module device file + * + * INPUT: Flags + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + */ +int GPFS_API +gpfs_lib_term(int flags); + +/* Define maximum length of the name for a GPFS named object, such + as a snapshot, storage pool or fileset. The name is a null-terminated + character string, which is not include in the max length */ +#define GPFS_MAXNAMLEN 255 + +/* Define maximum length of the path to a GPFS named object + such as a snapshot or fileset. If the absolute path name exceeds + this limit, then use a relative path name. The path is a null-terminated + character string, which is not included in the max length */ +#define GPFS_MAXPATHLEN 1023 + +/* ASCII code for "GPFS" in the struct statfs f_type field */ +#define GPFS_SUPER_MAGIC 0x47504653 + +/* GPFS inode attributes + gpfs_uid_t - defined above + gpfs_uid64_t - defined above + gpfs_off64_t - defined above + + gpfs_mode_t may include gpfs specific values including 0x02000000 + To have a gpfs_mode_t be equivalent to a mode_t mask that value out. + */ +typedef unsigned int gpfs_mode_t; +typedef unsigned int gpfs_gid_t; +typedef unsigned long long gpfs_gid64_t; +typedef unsigned int gpfs_ino_t; +typedef unsigned long long gpfs_ino64_t; +typedef unsigned int gpfs_gen_t; +typedef unsigned long long gpfs_gen64_t; +typedef unsigned int gpfs_dev_t; +typedef unsigned int gpfs_mask_t; +typedef unsigned int gpfs_pool_t; +typedef unsigned int gpfs_snapid_t; +typedef unsigned long long gpfs_snapid64_t; +typedef unsigned long long gpfs_fsid64_t[2]; +typedef short gpfs_nlink_t; +typedef long long gpfs_nlink64_t; + + +#if defined(WIN32) || defined(_MS_SUA_) + typedef struct gpfs_stat64 + { + gpfs_dev_t st_dev; /* id of device containing file */ + gpfs_ino64_t st_ino; /* file inode number */ + gpfs_mode_t st_mode; /* access mode */ + gpfs_nlink64_t st_nlink; /* number of links */ + unsigned int st_flags; /* flag word */ + gpfs_uid64_t st_uid; /* owner uid */ + gpfs_gid64_t st_gid; /* owner gid */ + gpfs_dev_t st_rdev; /* device id (if special file) */ + gpfs_off64_t st_size; /* file size in bytes */ + gpfs_timestruc64_t st_atime; /* time of last access */ + gpfs_timestruc64_t st_mtime; /* time of last data modification */ + gpfs_timestruc64_t st_ctime; /* time of last status change */ + int st_blksize; /* preferred block size for io */ + gpfs_off64_t st_blocks; /* 512 byte blocks of disk held by file */ + long long st_fsid; /* file system id */ + unsigned int st_type; /* file type */ + gpfs_gen64_t st_gen; /* inode generation number */ + gpfs_timestruc64_t st_createtime; /* time of creation */ + unsigned int st_attrs; /* Windows flags */ + } gpfs_stat64_t; +#else + typedef struct stat64 gpfs_stat64_t; +#endif + +#if defined(WIN32) || defined(_MS_SUA_) + typedef struct gpfs_statfs64 + { + gpfs_off64_t f_blocks; /* total data blocks in file system */ + gpfs_off64_t f_bfree; /* free block in fs */ + gpfs_off64_t f_bavail; /* free blocks avail to non-superuser */ + int f_bsize; /* optimal file system block size */ + gpfs_ino64_t f_files; /* total file nodes in file system */ + gpfs_ino64_t f_ffree; /* free file nodes in fs */ + gpfs_fsid64_t f_fsid; /* file system id */ + int f_fsize; /* fundamental file system block size */ + int f_sector_size; /* logical disk sector size */ + char f_fname[32]; /* file system name (usually mount pt.) */ + char f_fpack[32]; /* file system pack name */ + int f_name_max; /* maximum component name length for posix */ + } gpfs_statfs64_t; +#else + typedef struct statfs64 gpfs_statfs64_t; +#endif + +/* Declarations for backwards compatibility. */ +typedef gpfs_stat64_t stat64_t; +typedef gpfs_statfs64_t statfs64_t; + + +/* Define a version number for the directory entry data to allow + future changes in this structure. Careful callers should also use + the d_reclen field for the size of the structure rather than sizeof, + to allow some degree of forward compatibility */ +#define GPFS_D_VERSION 1 + +typedef struct gpfs_direntx +{ + int d_version; /* this struct's version */ + unsigned short d_reclen; /* actual size of this struct including + null terminated variable length d_name */ + unsigned short d_type; /* Types are defined below */ + gpfs_ino_t d_ino; /* File inode number */ + gpfs_gen_t d_gen; /* Generation number for the inode */ + char d_name[256]; /* null terminated variable length name */ +} gpfs_direntx_t; + + +#define GPFS_D64_VERSION 2 + +typedef struct gpfs_direntx64 +{ + int d_version; /* this struct's version */ + unsigned short d_reclen; /* actual size of this struct including + null terminated variable length d_name */ + unsigned short d_type; /* Types are defined below */ + gpfs_ino64_t d_ino; /* File inode number */ + gpfs_gen64_t d_gen; /* Generation number for the inode */ + unsigned int d_flags; /* Flags are defined below */ + char d_name[1028]; /* null terminated variable length name */ + /* (1020+null+7 byte pad to double word) */ + /* to handle up to 255 UTF-8 chars */ +} gpfs_direntx64_t; + +/* File types for d_type field in gpfs_direntx_t */ +#define GPFS_DE_OTHER 0 +#define GPFS_DE_FIFO 1 +#define GPFS_DE_CHR 2 +#define GPFS_DE_DIR 4 +#define GPFS_DE_BLK 6 +#define GPFS_DE_REG 8 +#define GPFS_DE_LNK 10 +#define GPFS_DE_SOCK 12 +#define GPFS_DE_DEL 16 + +/* Define flags for gpfs_direntx64_t */ +#define GPFS_DEFLAG_NONE 0x0000 /* Default value, no flags set */ +#define GPFS_DEFLAG_JUNCTION 0x0001 /* DirEnt is a fileset junction */ +#define GPFS_DEFLAG_IJUNCTION 0x0002 /* DirEnt is a inode space junction */ +#define GPFS_DEFLAG_ORPHAN 0x0004 /* DirEnt is an orphan (pcache) */ +#define GPFS_DEFLAG_CLONE 0x0008 /* DirEnt is a clone child */ + +/* Define a version number for the iattr data to allow future changes + in this structure. Careful callers should also use the ia_reclen field + for the size of the structure rather than sizeof, to allow some degree + of forward compatibility */ +#define GPFS_IA_VERSION 1 +#define GPFS_IA64_VERSION 3 /* ver 3 adds ia_repl_xxxx bytes instead of ia_pad2 */ +#define GPFS_IA64_RESERVED 4 +#define GPFS_IA64_UNUSED 8 + +typedef struct gpfs_iattr +{ + int ia_version; /* this struct version */ + int ia_reclen; /* sizeof this structure */ + int ia_checksum; /* validity check on iattr struct */ + gpfs_mode_t ia_mode; /* access mode; see gpfs_mode_t comment */ + gpfs_uid_t ia_uid; /* owner uid */ + gpfs_gid_t ia_gid; /* owner gid */ + gpfs_ino_t ia_inode; /* file inode number */ + gpfs_gen_t ia_gen; /* inode generation number */ + gpfs_nlink_t ia_nlink; /* number of links */ + short ia_flags; /* Flags (defined below) */ + int ia_blocksize; /* preferred block size for io */ + gpfs_mask_t ia_mask; /* Initial attribute mask (not used) */ + unsigned int ia_pad1; /* reserved space */ + gpfs_off64_t ia_size; /* file size in bytes */ + gpfs_off64_t ia_blocks; /* 512 byte blocks of disk held by file */ + gpfs_timestruc_t ia_atime; /* time of last access */ + gpfs_timestruc_t ia_mtime; /* time of last data modification */ + gpfs_timestruc_t ia_ctime; /* time of last status change */ + gpfs_dev_t ia_rdev; /* id of device */ + unsigned int ia_xperm; /* extended attributes (defined below) */ + unsigned int ia_modsnapid; /* snapshot id of last modification */ + unsigned int ia_filesetid; /* fileset ID */ + unsigned int ia_datapoolid; /* storage pool ID for data */ + unsigned int ia_pad2; /* reserved space */ +} gpfs_iattr_t; + + +typedef struct gpfs_iattr64 +{ + int ia_version; /* this struct version */ + int ia_reclen; /* sizeof this structure */ + int ia_checksum; /* validity check on iattr struct */ + gpfs_mode_t ia_mode; /* access mode; see gpfs_mode_t comment */ + gpfs_uid64_t ia_uid; /* owner uid */ + gpfs_gid64_t ia_gid; /* owner gid */ + gpfs_ino64_t ia_inode; /* file inode number */ + gpfs_gen64_t ia_gen; /* inode generation number */ + gpfs_nlink64_t ia_nlink; /* number of links */ + gpfs_off64_t ia_size; /* file size in bytes */ + gpfs_off64_t ia_blocks; /* 512 byte blocks of disk held by file */ + gpfs_timestruc64_t ia_atime; /* time of last access */ + unsigned int ia_winflags; /* windows flags (defined below) */ + unsigned int ia_pad1; /* reserved space */ + gpfs_timestruc64_t ia_mtime; /* time of last data modification */ + unsigned int ia_flags; /* flags (defined below) */ + /* next four bytes were ia_pad2 */ + unsigned char ia_repl_data; /* data replication factor */ + unsigned char ia_repl_data_max; /* data replication max factor */ + unsigned char ia_repl_meta; /* meta data replication factor */ + unsigned char ia_repl_meta_max; /* meta data replication max factor */ + gpfs_timestruc64_t ia_ctime; /* time of last status change */ + int ia_blocksize; /* preferred block size for io */ + unsigned int ia_pad3; /* reserved space */ + gpfs_timestruc64_t ia_createtime; /* creation time */ + gpfs_mask_t ia_mask; /* initial attribute mask (not used) */ + int ia_pad4; /* reserved space */ + unsigned int ia_reserved[GPFS_IA64_RESERVED]; /* reserved space */ + unsigned int ia_xperm; /* extended attributes (defined below) */ + gpfs_dev_t ia_dev; /* id of device containing file */ + gpfs_dev_t ia_rdev; /* device id (if special file) */ + unsigned int ia_pcacheflags; /* pcache inode bits */ + gpfs_snapid64_t ia_modsnapid; /* snapshot id of last modification */ + unsigned int ia_filesetid; /* fileset ID */ + unsigned int ia_datapoolid; /* storage pool ID for data */ + gpfs_ino64_t ia_inode_space_mask; /* inode space mask of this file system */ + /* This value is saved in the iattr structure + during backup and used during restore */ + gpfs_off64_t ia_dirminsize; /* dir pre-allocation size in bytes */ + unsigned int ia_unused[GPFS_IA64_UNUSED]; /* reserved space */ +} gpfs_iattr64_t; + +/* Define flags for inode attributes */ +#define GPFS_IAFLAG_SNAPDIR 0x0001 /* (obsolete) */ +#define GPFS_IAFLAG_USRQUOTA 0x0002 /* inode is a user quota file */ +#define GPFS_IAFLAG_GRPQUOTA 0x0004 /* inode is a group quota file */ +#define GPFS_IAFLAG_ERROR 0x0008 /* error reading inode */ +/* Define flags for inode replication attributes */ +#define GPFS_IAFLAG_FILESET_ROOT 0x0010 /* root dir of a fileset */ +#define GPFS_IAFLAG_NO_SNAP_RESTORE 0x0020 /* don't restore from snapshots */ +#define GPFS_IAFLAG_FILESETQUOTA 0x0040 /* inode is a fileset quota file */ +#define GPFS_IAFLAG_COMANAGED 0x0080 /* file data is co-managed */ +#define GPFS_IAFLAG_ILLPLACED 0x0100 /* may not be properly placed */ +#define GPFS_IAFLAG_REPLMETA 0x0200 /* metadata replication set */ +#define GPFS_IAFLAG_REPLDATA 0x0400 /* data replication set */ +#define GPFS_IAFLAG_EXPOSED 0x0800 /* may have data on suspended disks */ +#define GPFS_IAFLAG_ILLREPLICATED 0x1000 /* may not be properly replicated */ +#define GPFS_IAFLAG_UNBALANCED 0x2000 /* may not be properly balanced */ +#define GPFS_IAFLAG_DATAUPDATEMISS 0x4000 /* has stale data blocks on + unavailable disk */ +#define GPFS_IAFLAG_METAUPDATEMISS 0x8000 /* has stale metadata on + unavailable disk */ + +#define GPFS_IAFLAG_IMMUTABLE 0x00010000 /* Immutability */ +#define GPFS_IAFLAG_INDEFRETENT 0x00020000 /* Indefinite retention */ +#define GPFS_IAFLAG_SECUREDELETE 0x00040000 /* Secure deletion */ + +#define GPFS_IAFLAG_TRUNCMANAGED 0x00080000 /* dmapi truncate event enabled */ +#define GPFS_IAFLAG_READMANAGED 0x00100000 /* dmapi read event enabled */ +#define GPFS_IAFLAG_WRITEMANAGED 0x00200000 /* dmapi write event enabled */ + +#define GPFS_IAFLAG_APPENDONLY 0x00400000 /* AppendOnly only */ +#define GPFS_IAFLAG_DELETED 0x00800000 /* inode has been deleted */ +#ifdef ZIP +#define GPFS_IAFLAG_ILLCOMPRESSED 0x01000000 /* may not be properly compressed */ +#endif +#define GPFS_IAFLAG_FPOILLPLACED 0x02000000 /* may not be properly placed per + FPO attributes (bgf, wad, wadfg) */ + +/* Define flags for window's attributes */ +#define GPFS_IWINFLAG_ARCHIVE 0x0001 /* Archive */ +#define GPFS_IWINFLAG_HIDDEN 0x0002 /* Hidden */ +#define GPFS_IWINFLAG_NOTINDEXED 0x0004 /* Not content indexed */ +#define GPFS_IWINFLAG_OFFLINE 0x0008 /* Off-line */ +#define GPFS_IWINFLAG_READONLY 0x0010 /* Read-only */ +#define GPFS_IWINFLAG_REPARSE 0x0020 /* Reparse point */ +#define GPFS_IWINFLAG_SYSTEM 0x0040 /* System */ +#define GPFS_IWINFLAG_TEMPORARY 0x0080 /* Temporary */ +#define GPFS_IWINFLAG_COMPRESSED 0x0100 /* Compressed */ +#define GPFS_IWINFLAG_ENCRYPTED 0x0200 /* Encrypted */ +#define GPFS_IWINFLAG_SPARSE 0x0400 /* Sparse file */ +#define GPFS_IWINFLAG_HASSTREAMS 0x0800 /* Has streams */ + +/* Define flags for extended attributes */ +#define GPFS_IAXPERM_ACL 0x0001 /* file has acls */ +#define GPFS_IAXPERM_XATTR 0x0002 /* file has extended attributes */ +#define GPFS_IAXPERM_DMATTR 0x0004 /* file has dm attributes */ +#define GPFS_IAXPERM_DOSATTR 0x0008 /* file has non-default dos attrs */ +#define GPFS_IAXPERM_RPATTR 0x0010 /* file has restore policy attrs */ + +/* Define flags for pcache bits defined in the inode */ +#define GPFS_ICAFLAG_CACHED 0x0001 /* "cached complete" */ +#define GPFS_ICAFLAG_CREATE 0x0002 /* "created" */ +#define GPFS_ICAFLAG_DIRTY 0x0004 /* "data dirty" */ +#define GPFS_ICAFLAG_LINK 0x0008 /* "hard linked" */ +#define GPFS_ICAFLAG_SETATTR 0x0010 /* "attr changed" */ +#define GPFS_ICAFLAG_LOCAL 0x0020 /* "local" */ +#define GPFS_ICAFLAG_APPEND 0x0040 /* "append" */ +#define GPFS_ICAFLAG_STATE 0x0080 /* "has remote state" */ + +/* Define pointers to interface types */ +typedef struct gpfs_fssnap_handle gpfs_fssnap_handle_t; +typedef struct gpfs_iscan gpfs_iscan_t; +typedef struct gpfs_ifile gpfs_ifile_t; +typedef struct gpfs_restore gpfs_restore_t; + +typedef struct gpfs_fssnap_id +{ + char opaque[48]; +} gpfs_fssnap_id_t; + + +/* Define extended return codes for gpfs backup & restore + calls without an explicit return code will return the value in errno */ +#define GPFS_NEW_ERRNO_BASE 185 +#define GPFS_E_INVAL_INUM (GPFS_NEW_ERRNO_BASE+0) /* invalid inode number */ + +#define GPFS_ERRNO_BASE 190 +#define GPFS_E_INVAL_FSSNAPID (GPFS_ERRNO_BASE+0) /* invalid fssnap id */ +#define GPFS_E_INVAL_ISCAN (GPFS_ERRNO_BASE+1) /* invalid iscan pointer */ +#define GPFS_E_INVAL_IFILE (GPFS_ERRNO_BASE+2) /* invalid ifile pointer */ +#define GPFS_E_INVAL_IATTR (GPFS_ERRNO_BASE+3) /* invalid iattr structure */ +#define GPFS_E_INVAL_RESTORE (GPFS_ERRNO_BASE+4) /* invalid restore pointer */ +#define GPFS_E_INVAL_FSSNAPHANDLE (GPFS_ERRNO_BASE+5) /* invalid fssnap handle */ +#define GPFS_E_INVAL_SNAPNAME (GPFS_ERRNO_BASE+6) /* invalid snapshot name */ +#define GPFS_E_FS_NOT_RESTORABLE (GPFS_ERRNO_BASE+7) /* FS is not clean */ +#define GPFS_E_RESTORE_NOT_ENABLED (GPFS_ERRNO_BASE+8) /* Restore was not enabled */ +#define GPFS_E_RESTORE_STARTED (GPFS_ERRNO_BASE+9) /* Restore is running */ +#define GPFS_E_INVAL_XATTR (GPFS_ERRNO_BASE+10) /* invalid extended + attribute pointer */ + +/* Define flags parameter for get/put file attributes. + Used by gpfs_fgetattr, gpfs_fputattr, gpfs_fputattrwithpath + gpfs_igetattrsx, gpfs_iputattrsx + and gpfs_lwe_getattrs, gpfs_lwe_putattrs +*/ +#define GPFS_ATTRFLAG_DEFAULT 0x0000 /* default behavior */ +#define GPFS_ATTRFLAG_NO_PLACEMENT 0x0001 /* exclude file placement attributes */ +#define GPFS_ATTRFLAG_IGNORE_POOL 0x0002 /* saved poolid is not valid */ +#define GPFS_ATTRFLAG_USE_POLICY 0x0004 /* use restore policy rules to + determine poolid */ +#define GPFS_ATTRFLAG_INCL_DMAPI 0x0008 /* Include dmapi attributes */ +#define GPFS_ATTRFLAG_FINALIZE_ATTRS 0x0010 /* Finalize immutability attributes */ +#define GPFS_ATTRFLAG_SKIP_IMMUTABLE 0x0020 /* Skip immutable attributes */ +#define GPFS_ATTRFLAG_INCL_ENCR 0x0040 /* Include encryption attributes */ +#define GPFS_ATTRFLAG_SKIP_CLONE 0x0080 /* Skip clone attributes */ +#define GPFS_ATTRFLAG_MODIFY_CLONEPARENT 0x0100 /* Allow modification on clone parent */ +#ifdef ZIP +#define GPFS_ATTRFLAG_NO_COMPRESSED 0x0200 /* exclude "compressed" attribute */ +#endif + +/* Define structure used by gpfs_statfspool */ +typedef struct gpfs_statfspool_s +{ + gpfs_off64_t f_blocks; /* total data blocks in pool */ + gpfs_off64_t f_bfree; /* free blocks in pool */ + gpfs_off64_t f_bavail; /* free blocks avail to non-superuser */ + gpfs_off64_t f_mblocks; /* total metadata blocks in pool */ + gpfs_off64_t 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 */ + gpfs_pool_t 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_replica; /* replica */ + int f_bgf; /* block group factor */ + int f_wad; /* write affinity depth */ + int f_allowWriteAffinity; /* allow write affinity depth. 1 means yes */ + int f_reserved[3];/* Current unused and set to zero */ +} gpfs_statfspool_t; + +#define STATFSPOOL_USAGE_DATA 0x0001 /* Pool stores user data */ +#define STATFSPOOL_USAGE_METADATA 0x0002 /* Pool stores system metadata */ + + +/* NAME: gpfs_fstat(), gpfs_stat() + * + * FUNCTION: Get exact stat information for a file descriptor (or filename). + * Forces all other nodes to flush dirty data and metadata to disk. + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS The gpfs_fstat() (or) gpfs_stat() subroutine is not supported + * under the current file system format + * EBADF The file descriptor is not valid. + * EINVAL The file descriptor does not refer to a GPFS file or a + * regular file. + * ESTALE The cached file system information was not valid. + */ +int GPFS_API +gpfs_fstat(gpfs_file_t fileDesc, + gpfs_stat64_t *buffer); + +int GPFS_API +gpfs_stat(const char *pathname, /* File pathname */ + gpfs_stat64_t *buffer); + +/* NAME: gpfs_fstat_x(), gpfs_stat_x() + * + * FUNCTION: Returns extended stat() information with specified accuracy + * for a file descriptor (or filename) + * + * Input: fileDesc : file descriptor or handle + * pathname : path to a file or directory + * iattrBufLen : length of iattr buffer + * + * In/Out: st_litemaskP: bitmask specification of required accuracy + * iattr : buffer for returned stat information + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * ENOENT invalid pathname + * EBADF Bad file desc + * EINVAL Not a GPFS file + * ESTALE cached fs information was invalid + */ +int GPFS_API +gpfs_fstat_x(gpfs_file_t fileDesc, + unsigned int *st_litemaskP, + gpfs_iattr64_t *iattr, + size_t iattrBufLen); + +int GPFS_API +gpfs_stat_x(const char *pathname, /* File pathname */ + unsigned int *st_litemaskP, + gpfs_iattr64_t *iattr, + size_t iattrBufLen); + +/* NAME: gpfs_statfs64() + * + * FUNCTION: Get information about the file system. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EBADF Bad file desc + * EINVAL Not a GPFS file + * ESTALE cached fs information was invalid + */ +int GPFS_API +gpfs_statfs64(const char *pathname, /* File pathname */ + gpfs_statfs64_t *buffer); + +/* NAME: gpfs_statlite() + * gpfs_lstatlite() - do not follow a symlink at the end of the path + * + * FUNCTION: Returns stat() information with specified accuracy + * + * Input: pathname : path to a file or directory + * + * In/Out: st_litemaskP: bitmask specification of required accuracy + * statbufP : buffer for returned stat information + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: Specific error indication + * EINVAL + * + */ +int GPFS_API +gpfs_statlite(const char *pathname, + unsigned int *st_litemaskP, + gpfs_stat64_t *statbufP); + +int GPFS_API +gpfs_lstatlite(const char *pathname, + unsigned int *st_litemaskP, + gpfs_stat64_t *statbufP); + + +/* NAME: gpfs_fgetattrs() + * + * FUNCTION: Retrieves all extended file attributes in opaque format. + * This function together with gpfs_fputattrs is intended for + * use by a backup program to save (gpfs_fgetattrs) and + * restore (gpfs_fputattrs) all extended file attributes + * (ACLs, user attributes, ...) in one call. + * + * NOTE: This call does not return extended attributes used for + * the Data Storage Management (XDSM) API (aka DMAPI). + * + * Input: flags Define behavior of get attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement + * are not saved, neither is the current storage pool. + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement + * are saved, but the current storage pool is not. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL invalid flags provided + * ENOSPC buffer too small to return all attributes + * *attrSizeP will be set to the size necessary + */ +int GPFS_API +gpfs_fgetattrs(gpfs_file_t fileDesc, + int flags, + void *bufferP, + int bufferSize, + int *attrSizeP); + + +/* NAME: gpfs_fputattrs() + * + * FUNCTION: Sets all extended file attributes of a file + * and sets the file's storage pool and data replication + * to the values saved in the extended attributes. + * + * If the saved storage pool is not valid or if the IGNORE_POOL + * flag is set, then it will select the storage pool by matching + * a PLACEMENT rule using the saved file attributes. + * If it fails to match a placement rule or if there are + * no placement rules installed it will assign the file + * to the "system" storage pool. + * + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_fgetattrs. + * + * Input: flags Define behavior of put attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored + * but the storage pool and data replication are unchanged + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a placement rule + * instead of restoring the saved storage pool. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL the buffer does not contain valid attribute data + * EINVAL invalid flags provided + */ +int GPFS_API +gpfs_fputattrs(gpfs_file_t fileDesc, + int flags, + void *bufferP); + + +/* NAME: gpfs_fputattrswithpathname() + * + * FUNCTION: Sets all extended file attributes of a file and invokes + * the policy engine to match a RESTORE rule using the file's + * attributes saved in the extended attributes to set the + * file's storage pool and data replication. The caller should + * include the full path to the file, including the file name, + * to allow rule selection based on file name or path. + * + * If the file fails to match a RESTORE rule, or if there are + * no RESTORE rules installed, then the storage pool and data + * replication are selected as when calling gpfs_fputattrs(). + * + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_fgetattrs. + * + * pathName is a UTF-8 encoded string. On Windows, applications + * can convert UTF-16 ("Unicode") to UTF-8 using the platforms + * WideCharToMultiByte function. + * + * + * Input: flags Define behavior of put attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored + * but the storage pool and data replication are unchanged + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored + * but if the file fails to match a RESTORE rule, it + * ignore the saved storage pool and select a pool + * by matching the saved attributes to a PLACEMENT rule. + * GPFS_ATTRFLAG_SKIP_IMMUTABLE - Skip immutable/appendOnly flags + * before restoring file data. Then use GPFS_ATTRFLAG_FINALIZE_ATTRS + * to restore immutable/appendOnly flags after data is restored. + * GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored + * after data is retored. If file is immutable/appendOnly + * call without this flag before restoring data + * then call with this flag after restoring data + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL the buffer does not contain valid attribute data + * ENOENT invalid pathname + * EINVAL invalid flags provided + */ +int GPFS_API +gpfs_fputattrswithpathname(gpfs_file_t fileDesc, + int flags, + void *bufferP, + const char *pathName); + + +/* NAME: gpfs_get_fssnaphandle_by_path() + * + * FUNCTION: Get a volatile handle to uniquely identify a file system + * and snapshot by the path to the file system and snapshot + * + * Input: pathName: path to a file or directory in a gpfs file system + * or to one of its snapshots + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * ENOENT invalid pathname + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fssnaphandle_by_path(const char *pathName); + + +/* NAME: gpfs_get_fssnaphandle_by_name() + * + * FUNCTION: Get a volatile handle to uniquely identify a file system + * and snapshot by the file system name and snapshot name. + * + * Input: fsName: unique name for gpfs file system (may be specified + * as fsName or /dev/fsName) + * snapName: name for snapshot within that file system + * or NULL to access the active file system rather + * than a snapshot within the file system. + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOENT invalid file system name + * GPFS_E_INVAL_SNAPNAME invalid snapshot name + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fssnaphandle_by_name(const char *fsName, + const char *snapName); + + +/* NAME: gpfs_get_fssnaphandle_by_fssnapid() + * + * FUNCTION: Get a volatile handle to uniquely identify a file system + * and snapshot by a fssnapId created from a previous handle. + * + * Input: fssnapId: unique id for a file system and snapshot + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPID invalid snapshot id + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fssnaphandle_by_fssnapid(const gpfs_fssnap_id_t *fssnapId); + +/* NAME: gpfs_get_fset_snaphandle_by_path() + * + * FUNCTION: Get a volatile handle to uniquely identify an inode space within a + * filesyetsm and snapshot by the path to the file system and snapshot. + * + * Input: pathName: path to a file or directory in a gpfs file system + * or to one of its snapshots + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * ENOENT invalid pathname + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fset_snaphandle_by_path(const char *pathName); + +/* NAME: gpfs_get_fset_snaphandle_by_name() + * + * FUNCTION: Get a volatile handle to uniquely identify an inode space within a + * file system and snapshot by the independent fileset name, file system + * name and snapshot name. + * + * Input: fsName: unique name for gpfs file system (may be specified + * as fsName or /dev/fsName) + * fsetName name of the independent fileset that owns the inode space + * snapName: name for snapshot within that file system + * or NULL to access the active file system rather + * than a snapshot within the file system. + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOENT invalid file system name + * GPFS_E_INVAL_FSETNAME invalid fset nsmae + * GPFS_E_INVAL_SNAPNAME invalid snapshot name + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fset_snaphandle_by_name(const char *fsName, + const char *fsetName, + const char *snapName); + +/* NAME: gpfs_get_fset_snaphandle_by_fset_snapid() + * + * FUNCTION: Get a volatile handle to uniquely identify a file system + * and snapshot by a fssnapId created from a previous handle. + * + * Input: fssnapId: unique id for a file system and snapshot + * + * Returns: pointer to gpfs_fssnap_handle_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPID invalid snapshot id + * see system calls open(), fstatfs(), and malloc() ERRORS + */ +gpfs_fssnap_handle_t * GPFS_API +gpfs_get_fset_snaphandle_by_fset_snapid(const gpfs_fssnap_id_t *fsetsnapId); + +/* NAME: gpfs_get_pathname_from_fssnaphandle() + * + * FUNCTION: Get the mountpoint and path to a file system + * and snapshot identified by a fssnapHandle + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: ptr to path name to the file system (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + */ +const char * GPFS_API +gpfs_get_pathname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_get_fsname_from_fssnaphandle() + * + * FUNCTION: Get the unique name for the file system + * identified by a fssnapHandle + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: ptr to name of the file system (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + */ +const char * GPFS_API +gpfs_get_fsname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_get_snapname_from_fssnaphandle() + * + * FUNCTION: Get the name for the snapshot + * uniquely identified by a fssnapHandle + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: ptr to name assigned to the snapshot (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * GPFS_E_INVAL_SNAPNAME snapshot has been deleted + * + * Notes: If the snapshot has been deleted from the file system + * the snapId may still be valid, but the call will fail + * with errno set to GPFS_E_INVAL_SNAPNAME. + */ +const char * GPFS_API +gpfs_get_snapname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_get_snapid_from_fssnaphandle() + * + * FUNCTION: Get the numeric id for the snapshot identified + * by a fssnapHandle. The snapshots define an ordered + * sequence of changes to each file. The file's iattr + * structure defines the snapshot id in which the file + * was last modified (ia_modsnapid). This numeric value + * can be compared to the numeric snapid from a fssnaphandle + * to determine if the file changed before or after the + * snapshot identified by the fssnaphandle. + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: Numeric id for the snapshot referred to by the fssnaphandle + * 0 if the fssnaphandle does not refer to a snapshot + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * + * Notes: The snapshot need not be on-line to determine the + * snapshot's numeric id. + */ +gpfs_snapid_t GPFS_API +gpfs_get_snapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + +gpfs_snapid64_t GPFS_API +gpfs_get_snapid_from_fssnaphandle64(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_get_fssnapid_from_fssnaphandle() + * + * FUNCTION: Get a unique, non-volatile file system and snapshot id + * for the file system and snapshot identified by a + * volatile fssnap handle. + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * fssnapId: returned fssnapId uniquely identifying the + * file system and snapshot being scanned + * + * Returns: 0 and fssnapId is set with id (Successful) + * -1 and errno is set (Failure) + * + * Errno: GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * EINVAL null ptr given for returned fssnapId + * EFAULT size mismatch for fssnapId + */ +int GPFS_API +gpfs_get_fssnapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_fssnap_id_t *fssnapId); + + +/* NAME: gpfs_get_restore_fssnapid_from_fssnaphandle() + * + * FUNCTION: Get the unique, non-volatile file system and snapshot id + * used for the last complete restore of a mirrored file + * system. The file system must been a previous restore + * target and ready for additional incremental restore. + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * fssnapId: returned fssnapId uniquely identifying the + * last complete restored file system. + * + * Returns: 0 and fssnapId is set with id (Successful) + * -1 and errno is set (Failure) + * + * Errno: GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * EINVAL null ptr given for returned fssnapId + * EFAULT size mismatch for fssnapId + * EPERM caller must have superuser privilege + * ENOMEM unable to allocate memory for request + * GPFS_E_FS_NOT_RESTORABLE fs is not clean for restore + */ +int GPFS_API +gpfs_get_restore_fssnapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_fssnap_id_t *fssnapId); + +/* NAME: gpfs_free_fssnaphandle() + * + * FUNCTION: Free a fssnapHandle + * + * Input: fssnapHandle: ptr to file system & snapshot handle + * + * Returns: void + * + * Errno: None + */ +void GPFS_API +gpfs_free_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); + +/* NAME: gpfs_get_snapdirname() + * + * FUNCTION: Get the name of the directory containing snapshots. + * + * Input: fssnapHandle: handle for the file system + * snapdirName: buffer into which the name of the snapshot + * directory will be copied + * bufLen: the size of the provided buffer + * + * Returns: 0 (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid + * E2BIG buffer too small to return the snapshot directory name + */ +int GPFS_API +gpfs_get_snapdirname(gpfs_fssnap_handle_t *fssnapHandle, + char *snapdirName, + int bufLen); + + +/* NAME: gpfs_open_inodescan() + * + * FUNCTION: Open inode file for inode scan. + * + * Input: fssnapHandle: handle for file system and snapshot + * to be scanned + * prev_fssnapId: + * if NULL, all inodes of existing file will be returned; + * if non-null, only returns inodes of files that have changed + * since the specified previous snapshot; + * if specifies the same snapshot as the one referred by + * fssnapHandle, only the snapshot inodes that have been + * copied into this snap inode file are returned; + * maxIno: if non-null, returns the maximum inode number + * available in the inode file being scanned. + * + * Returns: pointer to gpfs_iscan_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL bad parameters + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid + * GPFS_E_INVAL_FSSNAPID prev_fssnapId is invalid + * EDOM prev_fssnapId is from a different fs + * ERANGE prev_fssnapId is more recent than snapId + * being scanned + * see system calls dup() and malloc() ERRORS + */ +gpfs_iscan_t * GPFS_API +gpfs_open_inodescan(gpfs_fssnap_handle_t *fssnapHandle, + const gpfs_fssnap_id_t *prev_fssnapId, + gpfs_ino_t *maxIno); + +gpfs_iscan_t * GPFS_API +gpfs_open_inodescan64(gpfs_fssnap_handle_t *fssnapHandle, + const gpfs_fssnap_id_t *prev_fssnapId, + gpfs_ino64_t *maxIno); + + +/* NAME: gpfs_open_inodescan_with_xattrs() + * + * FUNCTION: Open inode file and extended attributes for an inode scan + * + * Input: fssnapHandle: handle for file system and snapshot + * to be scanned + * prev_fssnapId: if NULL, all inodes of existing file will + * be returned; if non-null, only returns inodes of files + * that have changed since the specified previous snapshot; + * if specifies the same snapshot as the one referred by + * fssnapHandle, only the snapshot inodes that have been + * copied into this snap inode file are returned; + * nxAttrs: count of extended attributes to be returned. + * if nxAttrs is set to 0, call returns no extended + * attributes, like gpfs_open_inodescan. + * if nxAttrs is set to -1, call returns all extended attributes + * xAttrList: pointer to array of pointers to names of extended + * attribute to be returned. nxAttrList may be null if nxAttrs + * is set to 0 or -1. + * maxIno: if non-null, returns the maximum inode number + * available in the inode file being scanned. + * + * Returns: pointer to gpfs_iscan_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL bad parameters + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid + * GPFS_E_INVAL_FSSNAPID prev_fssnapId is invalid + * EDOM prev_fssnapId is from a different fs + * ERANGE prev_fssnapId is more recent than snapId + * being scanned + * see system calls dup() and malloc() ERRORS + */ +gpfs_iscan_t * GPFS_API +gpfs_open_inodescan_with_xattrs(gpfs_fssnap_handle_t *fssnapHandle, + const gpfs_fssnap_id_t *prev_fssnapId, + int nxAttrs, + const char *xattrsList[], + gpfs_ino_t *maxIno); + +gpfs_iscan_t * GPFS_API +gpfs_open_inodescan_with_xattrs64(gpfs_fssnap_handle_t *fssnapHandle, + const gpfs_fssnap_id_t *prev_fssnapId, + int nxAttrs, + const char *xattrList[], + gpfs_ino64_t *maxIno); + + +/* NAME: gpfs_next_inode() + * + * FUNCTION: Get next inode from inode scan. Scan terminates before + * the last inode specified or the last inode in the + * inode file being scanned. + * + * If the inode scan was opened to expressly look for inodes + * in a snapshot, and not dittos, gets the next inode skipping + * holes, if any. + * + * Input: iscan: ptr to inode scan descriptor + * termIno: scan terminates before this inode number + * caller may specify maxIno from gpfs_open_inodescan() + * or 0 to scan the entire inode file. + * iattr: pointer to returned pointer to file's iattr. + * + * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) + * 0 and *iattr set to NULL for no more inodes before termIno + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM buffer too small + * GPFS_E_INVAL_ISCAN bad parameters + * GPFS_E_INVAL_FSSNAPID the snapshot id provided in the + * gpfs iscan is not valid + * + * Notes: The data returned by gpfs_next_inode() is overwritten by + * subsequent calls to gpfs_next_inode() or gpfs_seek_inode(). + * + * The termIno parameter provides a means to partition an + * inode scan such that it may be executed on more than one node. + */ +int GPFS_API +gpfs_next_inode(gpfs_iscan_t *iscan, + gpfs_ino_t termIno, + const gpfs_iattr_t **iattr); + +int GPFS_API +gpfs_next_inode64(gpfs_iscan_t *iscan, + gpfs_ino64_t termIno, + const gpfs_iattr64_t **iattr); + + +/* NAME: gpfs_next_inode_with_xattrs() + * + * FUNCTION: Get next inode and its extended attributes from the inode scan. + * The set of extended attributes returned were defined when + * the inode scan was opened. The scan terminates before the last + * inode specified or the last inode in the inode file being + * scanned. + * + * If the inode scan was opened to expressly look for inodes + * in a snapshot, and not dittos, gets the next inode skipping + * holes, if any. + * + * Input: iscan: ptr to inode scan descriptor + * termIno: scan terminates before this inode number + * caller may specify maxIno from gpfs_open_inodescan() + * or 0 to scan the entire inode file. + * iattr: pointer to returned pointer to file's iattr. + * xattrBuf: pointer to returned pointer to xattr buffer + * xattrBufLen: returned length of xattr buffer + * + * + * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) + * 0 and *iattr set to NULL for no more inodes before termIno + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * EFAULT buffer data was overwritten + * ENOMEM buffer too small + * GPFS_E_INVAL_ISCAN bad parameters + * GPFS_E_INVAL_XATTR bad parameters + * + * Notes: The data returned by gpfs_next_inode() is overwritten by + * subsequent calls to gpfs_next_inode(), gpfs_seek_inode() + * or gpfs_stat_inode(). + * + * The termIno parameter provides a means to partition an + * inode scan such that it may be executed on more than one node. + * + * The returned values for xattrBuf and xattrBufLen must be + * provided to gpfs_next_xattr() to obtain the extended attribute + * names and values. The buffer used for the extended attributes + * is overwritten by subsequent calls to gpfs_next_inode(), + * gpfs_seek_inode() or gpfs_stat_inode(); + * + * The returned pointers to the extended attribute name and value + * will be aligned to a double-word boundary. + */ +int GPFS_API +gpfs_next_inode_with_xattrs(gpfs_iscan_t *iscan, + gpfs_ino_t termIno, + const gpfs_iattr_t **iattr, + const char **xattrBuf, + unsigned int *xattrBufLen); + +int GPFS_API +gpfs_next_inode_with_xattrs64(gpfs_iscan_t *iscan, + gpfs_ino64_t termIno, + const gpfs_iattr64_t **iattr, + const char **xattrBuf, + unsigned int *xattrBufLen); + + +/* NAME: gpfs_next_xattr() + * + * FUNCTION: Iterate over the extended attributes buffer returned + * by get_next_inode_with_xattrs to return the individual + * attributes and their values. Note that the attribute names + * are null-terminated strings, whereas the atttribute value + * contains binary data. + * + * Input: iscan: ptr to inode scan descriptor + * xattrBufLen: ptr to attribute buffer length + * xattrBuf: ptr to the ptr to the attribute buffer + * + * Returns: 0 and *name set to point attribue name (Successful) + * also sets: *valueLen to length of attribute value + * *value to point to attribute value + * *xattrBufLen to remaining length of buffer + * **xattrBuf to index next attribute in buffer + * 0 and *name set to NULL for no more attributes in buffer + * also sets: *valueLen to 0 + * *value to NULL + * *xattrBufLen to 0 + * **xattrBuf to NULL + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_ISCAN invalid iscan parameter + * GPFS_E_INVAL_XATTR invalid xattr parameters + * + * Notes: The caller is not allowed to modify the returned attribute + * names or values. The data returned by gpfs_next_attribute() + * may be overwritten by subsequent calls to gpfs_next_attribute() + * or other gpfs library calls. + */ +int GPFS_API +gpfs_next_xattr(gpfs_iscan_t *iscan, + const char **xattrBuf, + unsigned int *xattrBufLen, + const char **name, + unsigned int *valueLen, + const char **value); + + + +/* NAME: gpfs_seek_inode() + * + * FUNCTION: Seek to a given inode number. + * + * Input: iscan: ptr to inode scan descriptor + * ino: next inode number to be scanned + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_ISCAN bad parameters + */ +int GPFS_API +gpfs_seek_inode(gpfs_iscan_t *iscan, + gpfs_ino_t ino); + +int GPFS_API +gpfs_seek_inode64(gpfs_iscan_t *iscan, + gpfs_ino64_t ino); + + +#ifdef SNAPSHOT_ILM + +/* define GPFS generated errno */ +#define GPFS_E_HOLE_IN_IFILE 238 /* hole in inode file */ + +#endif +/* NAME: gpfs_stat_inode() + * NAME: gpfs_stat_inode_with_xattrs() + * + * FUNCTION: Seek to the specified inode and get that inode and + * its extended attributes from the inode scan. This is + * simply a combination of gpfs_seek_inode and get_next_inode + * but will only return the specified inode. + * + * Input: iscan: ptr to inode scan descriptor + * ino: inode number to be returned + * termIno: prefetch inodes up to this inode + * caller may specify maxIno from gpfs_open_inodescan() + * or 0 to allow prefetching over the entire inode file. + * iattr: pointer to returned pointer to file's iattr. + * xattrBuf: pointer to returned pointer to xattr buffer + * xattrBufLen: returned length of xattr buffer + * + * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) + * 0 and *iattr set to NULL for no more inodes before termIno + * or if requested inode does not exist. + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM buffer too small + * GPFS_E_INVAL_ISCAN bad parameters + * GPFS_E_HOLE_IN_IFILE if we are expressly looking for inodes in + * the snapshot file and this one has yet not + * been copied into snapshot. + * + * Notes: The data returned by gpfs_next_inode() is overwritten by + * subsequent calls to gpfs_next_inode(), gpfs_seek_inode() + * or gpfs_stat_inode(). + * + * The termIno parameter provides a means to partition an + * inode scan such that it may be executed on more than one node. + * It is only used by this call to control prefetching. + * + * The returned values for xattrBuf and xattrBufLen must be + * provided to gpfs_next_xattr() to obtain the extended attribute + * names and values. The buffer used for the extended attributes + * is overwritten by subsequent calls to gpfs_next_inode(), + * gpfs_seek_inode() or gpfs_stat_inode(); + */ +int GPFS_API +gpfs_stat_inode(gpfs_iscan_t *iscan, + gpfs_ino_t ino, + gpfs_ino_t termIno, + const gpfs_iattr_t **iattr); + +int GPFS_API +gpfs_stat_inode64(gpfs_iscan_t *iscan, + gpfs_ino64_t ino, + gpfs_ino64_t termIno, + const gpfs_iattr64_t **iattr); + +int GPFS_API +gpfs_stat_inode_with_xattrs(gpfs_iscan_t *iscan, + gpfs_ino_t ino, + gpfs_ino_t termIno, + const gpfs_iattr_t **iattr, + const char **xattrBuf, + unsigned int *xattrBufLen); + +int GPFS_API +gpfs_stat_inode_with_xattrs64(gpfs_iscan_t *iscan, + gpfs_ino64_t ino, + gpfs_ino64_t termIno, + const gpfs_iattr64_t **iattr, + const char **xattrBuf, + unsigned int *xattrBufLen); + + +/* NAME: gpfs_close_inodescan() + * + * FUNCTION: Close inode file. + * + * Input: iscan: ptr to inode scan descriptor + * + * Returns: void + * + * Errno: None + */ +void GPFS_API +gpfs_close_inodescan(gpfs_iscan_t *iscan); + + +/* NAME: gpfs_cmp_fssnapid() + * + * FUNCTION: Compare two fssnapIds for the same file system to + * determine the order in which the two snapshots were taken. + * The 'result' variable will be set as follows: + * *result < 0: snapshot 1 was taken before snapshot 2 + * *result == 0: snapshot 1 and 2 are the same + * *result > 0: snapshot 1 was taken after snapshot 2 + * + * Input: fssnapId1: ptr to fssnapId 1 + * fssnapId2: ptr to fssnapId id 2 + * result: ptr to returned results + * + * Returns: 0 and *result is set as described above (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPID fssnapid1 or fssnapid2 is not a + * valid snapshot id + * EDOM the two snapshots cannot be compared because + * they were taken from two different file systems. + */ +int GPFS_API +gpfs_cmp_fssnapid(const gpfs_fssnap_id_t *fssnapId1, + const gpfs_fssnap_id_t *fssnapId2, + int *result); + + +/* NAME: gpfs_iopen() + * + * FUNCTION: Open a file or directory by inode number. + * + * Input: fssnapHandle: handle for file system and snapshot + * being scanned + * ino: inode number + * open_flags: O_RDONLY for gpfs_iread() + * O_WRONLY for gpfs_iwrite() + * O_CREAT create the file if it doesn't exist + * O_TRUNC if the inode already exists delete it + * caller may use GPFS_O_BACKUP to read files for backup + * and GPFS_O_RESTORE to write files for restore + * statxbuf: used only with O_CREAT/GPFS_O_BACKUP + * all other cases set to NULL + * symLink: used only with O_CREAT/GPFS_O_BACKUP for a symbolic link + * all other cases set to NULL + * + * Returns: pointer to gpfs_ifile_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOENT file not existed + * EINVAL missing or bad parameter + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * EFORMAT invalid fs version number + * EIO error reading original inode + * ERANGE error ino is out of range, should use gpfs_iopen64 + * GPFS_E_INVAL_INUM reserved inode is not allowed to open + * GPFS_E_INVAL_IATTR iattr structure was corrupted + * see dup() and malloc() ERRORS + */ +gpfs_ifile_t * GPFS_API +gpfs_iopen(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_ino_t ino, + int open_flags, + const gpfs_iattr_t *statxbuf, + const char *symLink); + +gpfs_ifile_t * GPFS_API +gpfs_iopen64(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_ino64_t ino, + int open_flags, + const gpfs_iattr64_t *statxbuf, + const char *symLink); + + +/* Define gpfs_iopen flags as used by the backup & restore by inode. + The backup code will only read the source files. + The restore code writes the target files & creates them if they + don't already exist. The file length is set by the inode attributes. + Consequently, to restore a user file it is unnecessary to include + the O_TRUNC flag. */ +#define GPFS_O_BACKUP (O_RDONLY) +#define GPFS_O_RESTORE (O_WRONLY | O_CREAT) + + +/* NAME: gpfs_iread() + * + * FUNCTION: Read file opened by gpfs_iopen. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: buffer for data to be read + * bufferSize: size of buffer (ie amount of data to be read) + * In/Out offset: offset of where within the file to read + * if successful, offset will be updated to the + * next byte after the last one that was read + * + * Returns: number of bytes read (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EISDIR file is a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + * see system call read() ERRORS + */ +int GPFS_API +gpfs_iread(gpfs_ifile_t *ifile, + void *buffer, + int bufferSize, + gpfs_off64_t *offset); + + +/* NAME: gpfs_iwrite() + * + * FUNCTION: Write file opened by gpfs_iopen. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: the data to be written + * writeLen: how much to write + * In/Out offset: offset of where within the file to write + * if successful, offset will be updated to the + * next byte after the last one that was written + * + * Returns: number of bytes written (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EISDIR file is a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + * see system call write() ERRORS + */ +int GPFS_API +gpfs_iwrite(gpfs_ifile_t *ifile, + void *buffer, + int writeLen, + gpfs_off64_t *offset); + + +/* NAME: gpfs_ireaddir() + * + * FUNCTION: Get next directory entry. + * + * Input: idir: pointer to gpfs_ifile_t from gpfs_iopen + * dirent: pointer to returned pointer to directory entry + * + * Returns: 0 and pointer to gpfs_direntx set (Successful) + * 0 and pointer to gpfs_direntx set to NULL (End of directory) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOTDIR file is not a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameter + * ENOMEM unable to allocate memory for request + * + * Notes: The data returned by gpfs_ireaddir() is overwritten by + * subsequent calls to gpfs_ireaddir(). + */ +int GPFS_API +gpfs_ireaddir(gpfs_ifile_t *idir, + const gpfs_direntx_t **dirent); + +int GPFS_API +gpfs_ireaddir64(gpfs_ifile_t *idir, + const gpfs_direntx64_t **dirent); + + +int GPFS_API +gpfs_ireaddirx(gpfs_ifile_t *idir, + gpfs_iscan_t *iscan, /* in only */ + const gpfs_direntx_t **dirent); + +int GPFS_API +gpfs_ireaddirx64(gpfs_ifile_t *idir, + gpfs_iscan_t *iscan, /* in only */ + const gpfs_direntx64_t **dirent); + + +/* NAME: gpfs_iwritedir() + * + * FUNCTION: Create a directory entry in a directory opened by gpfs_iopen. + * + * Input: idir: pointer to gpfs_ifile_t from gpfs_iopen + * dirent: directory entry to be written + * + * Returns: 0 (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_IFILE bad file pointer + * ENOTDIR file is not a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * EFORMAT invalid dirent version number + * see system call write() ERRORS + */ +int GPFS_API +gpfs_iwritedir(gpfs_ifile_t *idir, + const gpfs_direntx_t *dirent); + +int GPFS_API +gpfs_iwritedir64(gpfs_ifile_t *idir, + const gpfs_direntx64_t *dirent); + + +/* NAME: gpfs_igetattrs() + * + * FUNCTION: Retrieves all extended file attributes in opaque format. + * This function together with gpfs_iputattrs is intended for + * use by a backup program to save (gpfs_igetattrs) and + * restore (gpfs_iputattrs) all extended file attributes + * (ACLs, user attributes, ...) in one call. + * + * NOTE: This call does not return extended attributes used for + * the Data Storage Management (XDSM) API (aka DMAPI). + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: pointer to buffer for returned attributes + * bufferSize: size of buffer + * attrSize: ptr to returned size of attributes + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOSPC buffer too small to return all attributes + * *attrSizeP will be set to the size necessary + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_igetattrs(gpfs_ifile_t *ifile, + void *buffer, + int bufferSize, + int *attrSize); + +/* NAME: gpfs_igetattrsx() + * + * FUNCTION: Retrieves all extended file attributes in opaque format. + * This function together with gpfs_iputattrsx is intended for + * use by a backup program to save (gpfs_igetattrsx) and + * restore (gpfs_iputattrsx) all extended file attributes + * (ACLs, user attributes, ...) in one call. + * + * NOTE: This call can optionally return extended attributes + * used for the Data Storage Management (XDSM) API + * (aka DMAPI). + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * flags Define behavior of get attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement + * are not saved, neither is the current storage pool. + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement + * are saved, but the current storage pool is not. + * GPFS_ATTRFLAG_INCL_DMAPI - file attributes for dmapi are + * included in the returned buffer + * GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption + * are included in the returned buffer + * + * buffer: pointer to buffer for returned attributes + * bufferSize: size of buffer + * attrSize: ptr to returned size of attributes + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL invalid flags provided + * ENOSPC buffer too small to return all attributes + * *attrSizeP will be set to the size necessary + */ +int GPFS_API +gpfs_igetattrsx(gpfs_ifile_t *ifile, + int flags, + void *buffer, + int bufferSize, + int *attrSize); + + +/* NAME: gpfs_igetxattr() + * + * FUNCTION: Retrieves an extended file attributes from ifile which has been open + * by gpfs_iopen(). + * + * NOTE: This call does not return extended attributes used for + * the Data Storage Management (XDSM) API (aka DMAPI). + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: pointer to buffer for key and returned extended + * attribute value + * bufferSize: size of buffer, should be enough to save attribute value + * attrSize: ptr to key length as input and ptr to the returned + * size of attributes as putput. + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser priviledges + * ESTALE cached fs information was invalid + * ENOSPC buffer too small to return all attributes + * *attrSize will be set to the size necessary + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_igetxattr(gpfs_ifile_t *ifile, + void *buffer, + int bufferSize, + int *attrSize); + + +/* NAME: gpfs_iputattrs() + * + * FUNCTION: Sets all extended file attributes of a file. + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_igetattrs. + * + * NOTE: This call will not restore extended attributes + * used for the Data Storage Management (XDSM) API + * (aka DMAPI). They will be silently ignored. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * buffer: pointer to buffer for returned attributes + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EINVAL the buffer does not contain valid attribute data + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_iputattrs(gpfs_ifile_t *ifile, + void *buffer); + + +/* NAME: gpfs_iputattrsx() + * + * FUNCTION: Sets all extended file attributes of a file. + * + * This routine can optionally invoke the policy engine + * to match a RESTORE rule using the file's attributes saved + * in the extended attributes to set the file's storage pool and + * data replication as when calling gpfs_fputattrswithpathname. + * When used with the policy the caller should include the + * full path to the file, including the file name, to allow + * rule selection based on file name or path. + * + * By default, the routine will not use RESTORE policy rules + * for data placement. The pathName parameter will be ignored + * and may be set to NULL. + * + * If the call does not use RESTORE policy rules, or if the + * file fails to match a RESTORE rule, or if there are no + * RESTORE rules installed, then the storage pool and data + * replication are selected as when calling gpfs_fputattrs(). + * + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_fgetattrs. + * + * pathName is a UTF-8 encoded string. On Windows, applications + * can convert UTF-16 ("Unicode") to UTF-8 using the platforms + * WideCharToMultiByte function. + * + * NOTE: This call will restore extended attributes + * used for the Data Storage Management (XDSM) API + * (aka DMAPI) if they are present in the buffer. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * flags Define behavior of put attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored + * but the storage pool and data replication are unchanged + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a placement rule + * instead of restoring the saved storage pool. + * GPFS_ATTRFLAG_USE_POLICY - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a RESTORE rule + * instead of restoring the saved storage pool. + * GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored + * after data is retored. If file is immutable/appendOnly + * call without this flag before restoring data + * then call with this flag after restoring data + * GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption + * are restored. Note that this may result in the file's + * File Encryption Key (FEK) being changed, and in this + * case any prior content in the file is effectively lost. + * This option should only be used when the entire file + * content is restored after the attributes are restored. + * + * buffer: pointer to buffer for returned attributes + * pathName: pointer to file path and file name for file + * May be set to NULL. + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EINVAL the buffer does not contain valid attribute data + * EINVAL invalid flags provided + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_iputattrsx(gpfs_ifile_t *ifile, + int flags, + void *buffer, + const char *pathName); + + +/* NAME: gpfs_igetfilesetname() + * + * FUNCTION: Retrieves the name of the fileset which contains this file. + * The fileset name is a null-terminated string, with a + * a maximum length of GPFS_MAXNAMLEN. + * + * Input: iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() + * filesetId: ia_filesetId returned in an iattr from the iscan + * buffer: pointer to buffer for returned fileset name + * bufferSize: size of buffer + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOSPC buffer too small to return fileset name + * GPFS_E_INVAL_ISCAN bad iscan parameter + */ +int GPFS_API +gpfs_igetfilesetname(gpfs_iscan_t *iscan, + unsigned int filesetId, + void *buffer, + int bufferSize); + + +/* NAME: gpfs_igetstoragepool() + * + * FUNCTION: Retrieves the name of the storage pool assigned for + * this file's data. The storage pool name is a null-terminated + * string, with a maximum length of GPFS_MAXNAMLEN. + * + * Input: iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() + * dataPoolId: ia_dataPoolId returned in an iattr from the iscan + * buffer: pointer to buffer for returned attributes + * bufferSize: size of buffer + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOSPC buffer too small to return all storage pool name + * GPFS_E_INVAL_ISCAN bad iscan parameters + */ +int GPFS_API +gpfs_igetstoragepool(gpfs_iscan_t *iscan, + unsigned int dataPoolId, + void *buffer, + int bufferSize); + + +/* NAME: gpfs_iclose() + * + * FUNCTION: Close file opened by inode and update dates. + * + * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen + * + * Returns: void + */ +void GPFS_API +gpfs_iclose(gpfs_ifile_t *ifile); + + +/* NAME: gpfs_ireadlink() + * + * FUNCTION: Read symbolic link by inode number. + * + * Input: fssnapHandle: handle for file system & snapshot being scanned + * ino: inode number of link file to read + * buffer: pointer to buffer for returned link data + * bufferSize: size of the buffer + * + * Returns: number of bytes read (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnap handle + * see system call readlink() ERRORS + */ +int GPFS_API +gpfs_ireadlink(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_ino_t ino, + char *buffer, + int bufferSize); + +int GPFS_API +gpfs_ireadlink64(gpfs_fssnap_handle_t *fssnapHandle, + gpfs_ino64_t ino, + char *buffer, + int bufferSize); + + +/* NAME: gpfs_sync_fs() + * + * FUNCTION: sync file system. + * + * Input: fssnapHandle: handle for file system being restored + * + * Returns: 0 all data flushed to disk (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOMEM unable to allocate memory for request + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + */ +int GPFS_API +gpfs_sync_fs(gpfs_fssnap_handle_t *fssnapHandle); + + +/* NAME: gpfs_enable_restore() + * + * FUNCTION: Mark file system as enabled for restore on/off + * + * Input: fssnapHandle: handle for file system to be enabled + * or disabled for restore + * on_off: flag set to 1 to enable restore + * 0 to disable restore + * + * Returns: 0 (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL bad parameters + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * E_FS_NOT_RESTORABLE fs is not clean + * EALREADY fs already marked as requested + * E_RESTORE_STARTED restore in progress + * + * Notes: EALREADY indicates enable/disable restore was already called + * for this fs. The caller must decide if EALREADY represents an + * error condition. + */ +int GPFS_API +gpfs_enable_restore(gpfs_fssnap_handle_t *fssnapHandle, + int on_off); + + +/* NAME: gpfs_start_restore() + * + * FUNCTION: Start a restore session. + * + * Input: fssnapHandle: handle for file system to be restored + * restore_flags: Flag to indicate the restore should be started + * even if a prior restore has not completed. + * old_fssnapId: fssnapId of last restored snapshot + * new_fssnapId: fssnapId of snapshot being restored + * + * Returns: pointer to gpfs_restore_t (Successful) + * NULL and errno is set (Failure) + * + * Errno: ENOSYS function not available + * ENOMEM unable to allocate memory for request + * EINVAL missing parameter + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * EDOM restore fs does not match existing fs + * ERANGE restore is missing updates + * EFORMAT invalid fs version number + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle + * GPFS_E_INVAL_FSSNAPID bad fssnapId parameter + * E_FS_NOT_RESTORABLE fs is not clean for restore + * E_RESTORE_NOT_ENABLED fs is not enabled for restore + * EALREADY Restore already in progress + * + * Note: EALREADY indicates start restore was already called for + * this fs. This could be due to a prior restore process that failed + * or it could be due to a concurrent restore process still running. + * The caller must decide if EALREADY represents an error condition. + */ +gpfs_restore_t * GPFS_API +gpfs_start_restore(gpfs_fssnap_handle_t *fssnapHandle, + int restore_flags, + const gpfs_fssnap_id_t *old_fssnapId, + const gpfs_fssnap_id_t *new_fssnapId); + +#define GPFS_RESTORE_NORMAL 0 /* Restore not started if prior restore + has not completed. */ +#define GPFS_RESTORE_FORCED 1 /* Restore starts even if prior restore + has not completed. */ + + +/* NAME: gpfs_end_restore() + * + * FUNCTION: End a restore session. + * + * Input: restoreId: ptr to gpfs_restore_t + * + * Returns: 0 (Successful) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL bad parameters + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_RESTORE bad restoreId parameter + * GPFS_E_FS_NOT_RESTORABLE fs is not clean for restore + * GPFS_E_RESTORE_NOT_ENABLED fs is not enabled for restore + * EALREADY Restore already ended + * + * Note: EALREADY indicates end restore was already called for + * this fs. This could be due to a concurrent restore process that + * already completed. The caller must decide if EALREADY represents + * an error condition. + */ +int GPFS_API +gpfs_end_restore(gpfs_restore_t *restoreId); + + +/* NAME: gpfs_ireadx() + * + * FUNCTION: Block level incremental read on a file opened by gpfs_iopen + * with a given incremental scan opened via gpfs_open_inodescan. + * + * Input: ifile: ptr to gpfs_ifile_t returned from gpfs_iopen() + * iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() + * buffer: ptr to buffer for returned data + * bufferSize: size of buffer for returned data + * offset: ptr to offset value + * termOffset: read terminates before reading this offset + * caller may specify ia_size for the file's + * gpfs_iattr_t or 0 to scan the entire file. + * hole: ptr to returned flag to indicate a hole in the file + * + * Returns: number of bytes read and returned in buffer + * or size of hole encountered in the file. (Success) + * -1 and errno is set (Failure) + * + * On input, *offset contains the offset in the file + * at which to begin reading to find a difference same file + * in a previous snapshot specified when the inodescan was opened. + * On return, *offset contains the offset of the first + * difference. + * + * On return, *hole indicates if the change in the file + * was data (*hole == 0) and the data is returned in the + * buffer provided. The function's value is the amount of data + * returned. If the change is a hole in the file, + * *hole != 0 and the size of the changed hole is returned + * as the function value. + * + * A call with a NULL buffer pointer will query the next increment + * to be read from the current offset. The *offset, *hole and + * returned length will be set for the next increment to be read, + * but no data will be returned. The bufferSize parameter is + * ignored, but the termOffset parameter will limit the + * increment returned. + * + * Errno: ENOSYS function not available + * EINVAL missing or bad parameter + * EISDIR file is a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * ENOMEM unable to allocate memory for request + * EDOM fs snapId does match local fs + * ERANGE previous snapId is more recent than scanned snapId + * GPFS_E_INVAL_IFILE bad ifile parameter + * GPFS_E_INVAL_ISCAN bad iscan parameter + * see system call read() ERRORS + * + * Notes: The termOffset parameter provides a means to partition a + * file's data such that it may be read on more than one node. + */ +gpfs_off64_t GPFS_API +gpfs_ireadx(gpfs_ifile_t *ifile, /* in only */ + gpfs_iscan_t *iscan, /* in only */ + void *buffer, /* in only */ + int bufferSize, /* in only */ + gpfs_off64_t *offset, /* in/out */ + gpfs_off64_t termOffset, /* in only */ + int *hole); /* out only */ + + +/* NAME: gpfs_ireadx_ext + * + * FUNCTION: gpfs_ireadx_ext is used to find different blocks between clone + * child and parent files. Input and output are the same as + * gpfs_ireadx. + * + * Returns: See gpfs_ireadx() + */ +gpfs_off64_t GPFS_API +gpfs_ireadx_ext(gpfs_ifile_t *ifile, /* in only */ + gpfs_iscan_t *iscan, /* in only */ + void *buffer, /* in only */ + int bufferSize, /* in only */ + gpfs_off64_t *offset, /* in/out */ + gpfs_off64_t termOffset, /* in only */ + int *hole); + + +/* NAME: gpfs_iwritex() + * + * FUNCTION: Write file opened by gpfs_iopen. + * If parameter hole == 0, then write data + * addressed by buffer to the given offset for the + * given length. If hole != 0, then write + * a hole at the given offset for the given length. + * + * Input: ifile : ptr to gpfs_ifile_t returned from gpfs_iopen() + * buffer: ptr to data buffer + * writeLen: length of data to write + * offset: offset in file to write data + * hole: flag =1 to write a "hole" + * =0 to write data + * + * Returns: number of bytes/size of hole written (Success) + * -1 and errno is set (Failure) + * + * Errno: ENOSYS function not available + * EINVAL missing or bad parameter + * EISDIR file is a directory + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameter + * see system call write() ERRORS + */ +gpfs_off64_t GPFS_API +gpfs_iwritex(gpfs_ifile_t *ifile, /* in only */ + void *buffer, /* in only */ + gpfs_off64_t writeLen, /* in only */ + gpfs_off64_t offset, /* in only */ + int hole); /* in only */ + + +/* NAME: gpfs_statfspool() + * + * FUNCTION: Obtain status information about the storage pools + * + * Input: pathname : path to any file in the file system + * poolId : id of first pool to return + * on return set to next poolId or -1 + * to indicate there are no more pools. + * options : option flags (currently not used) + * nPools : number of stat structs requested or 0 + * on return number of stat structs in buffer + * or if nPools was 0 its value is the max number + * of storage pools currently defined + * buffer : ptr to return stat structures + * bufferSize : sizeof stat buffer + * + * The user is expected to issue two or more calls. On the first + * call the user should pass nPools set to 0 and gpfs will + * return in nPools the total number of storage pools currently + * defined for the file system indicated by the pathname + * and it returns in poolId the id of the first storage pool. + * The buffer parameter may be set to NULL for this call. + * + * The user may then allocate a buffer large enough to contain + * a gpfs_statfspool_t structure for each of the pools and issue + * a second call to obtain stat information about each pool. + * Parameter nPools should be set the number of pools requested. + * On return, nPools will be set to the number of stat structs + * contained in the buffer, and poolId will be set to the id + * of the next storage pool or -1 to indicate there are no + * additional storage pools defined. + * + * Alternatively, if the user has a valid poolId from a previous + * call, the user may provide that poolId and a buffer large + * enough for a single gpfs_statfspool_t structure, and the call + * will return the status for a single storage pool. + * + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: Specific error indication + * EINVAL + */ +int GPFS_API +gpfs_statfspool(const char *pathname, /* in only: path to file system*/ + gpfs_pool_t *poolId, /* in out: id of first pool to return + on return set to next poolId + or -1 when there are no more pools */ + unsigned int options, /* in only: option flags */ + int *nPools, /* in out: number of pool stats requested + on return number of stat structs + returned in buffer or if nPools was + set to 0, the return value is the + number of pools currently defined */ + void *buffer, /* ptr to return stat structures */ + int bufferSize); /* sizeof stat buffer or 0 */ + + +/* NAME: gpfs_getpoolname() + * + * FUNCTION: Retrieves the name of the storage pool assigned for + * this file's data. The storage pool name is a null-terminated + * string, with a maximum length of GPFS_MAXNAMLEN. + * + * Input: pathname: path to any file in the file system + * poolId: f_poolid returned in gpfs_statfspool_t + * buffer: pointer to buffer for returned name + * bufferSize: size of buffer + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * ESTALE file system was unmounted + * E_FORMAT_INCOMPAT file system does not support pools + * E2BIG buffer too small to return storage pool name + */ +int GPFS_API +gpfs_getpoolname(const char *pathname, + gpfs_pool_t poolId, + void *buffer, + int bufferSize); + + +/* /usr/src/linux/include/linux/fs.h includes /usr/src/linux/include/linux/quota.h + which has conflicting definitions. */ +#ifdef _LINUX_QUOTA_ + #undef Q_SYNC + #undef Q_GETQUOTA + #undef Q_SETQUOTA + #undef Q_QUOTAON + #undef Q_QUOTAOFF +#endif + + +/* GPFS QUOTACTL */ + +/* + * Command definitions for the 'gpfs_quotactl' system call. + * The commands are broken into a main command defined below + * and a subcommand that is used to convey the type of + * quota that is being manipulated (see above). + */ + +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define GPFS_QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) + +#define Q_QUOTAON 0x0100 /* enable quotas */ +#define Q_QUOTAOFF 0x0200 /* disable quotas */ +#define Q_GETQUOTA 0x0300 /* get limits and usage */ +#ifndef _LINUX_SOURCE_COMPAT + /* Standard AIX definitions of quota commands */ + #define Q_SETQUOTA 0x0400 /* set limits */ + #define Q_SETQLIM Q_SETQUOTA +#else + /* Alternate definitions, for Linux Affinity */ + #define Q_SETQLIM 0x0400 /* set limits */ + #define Q_SETQUOTA 0x0700 /* set limits and usage */ +#endif +#define Q_SETUSE 0x0500 /* set usage */ +#define Q_SYNC 0x0600 /* sync disk copy of a file systems quotas */ +#define Q_SETGRACETIME 0x0900 /* set grace time */ +#define Q_SETGRACETIME_ENHANCE 0x0800 /* set grace time and update all + * quota entries */ +#define Q_GETDQPFSET 0x0A00 /* get default quota per fileset */ +#define Q_SETDQPFSET 0x0B00 /* set default quota per fileset */ +#define Q_SETQUOTA_UPDATE_ET 0x0C00 /* this SETQUOTA needs to update entryType */ +#define Q_GETDQPFSYS 0x0D00 /* get default quota per file system */ +#define Q_SETDQPFSYS 0x0E00 /* set default quota per file system */ + +/* gpfs quota types */ +#define GPFS_USRQUOTA 0 +#define GPFS_GRPQUOTA 1 +#define GPFS_FILESETQUOTA 2 + +/* define GPFS generated errno */ +#define GPFS_E_NO_QUOTA_INST 237 /* file system does not support quotas */ + +typedef struct gpfs_quotaInfo +{ + gpfs_off64_t blockUsage; /* current block count in 1 KB units*/ + gpfs_off64_t blockHardLimit; /* absolute limit on disk blks alloc */ + gpfs_off64_t blockSoftLimit; /* preferred limit on disk blks */ + gpfs_off64_t blockInDoubt; /* distributed shares + "lost" usage for blks */ + int inodeUsage; /* current # allocated inodes */ + int inodeHardLimit; /* absolute limit on allocated inodes */ + int inodeSoftLimit; /* preferred inode limit */ + int inodeInDoubt; /* distributed shares + "lost" usage for inodes */ + gpfs_uid_t quoId; /* uid, gid or fileset id */ + int entryType; /* entry type, not used */ + unsigned int blockGraceTime; /* time limit for excessive disk use */ + unsigned int inodeGraceTime; /* time limit for excessive inode use */ +} gpfs_quotaInfo_t; + + +/* NAME: gpfs_quotactl() + * + * FUNCTION: Manipulate disk quotas + * INPUT: pathname: specifies the pathname of any file within the + * mounted file system to which the command is to + * be applied + * cmd: specifies a quota control command to be applied + * to UID/GID/FILESETID id. The cmd parameter can be + * constructed using GPFS_QCMD(cmd, type) macro defined + * in gpfs.h + * id: UID or GID or FILESETID that command applied to. + * bufferP: points to the address of an optional, command + * specific, data structure that is copied in or out of + * the system. + * + * OUTPUT: bufferP, if applicable. + * + * Returns: 0 success + * -1 failure + * + * Errno: EACCESS + * EFAULT An invalid bufferP parameter is supplied; + * the associated structure could not be copied + * in or out of the kernel + * EINVAL + * ENOENT No such file or directory + * EPERM The quota control command is privileged and + * the caller did not have root user authority + * EOPNOTSUPP + * GPFS_E_NO_QUOTA_INST The file system does not support quotas + */ +int GPFS_API +gpfs_quotactl(const char *pathname, + int cmd, + int id, + void *bufferP); + + +/* NAME: gpfs_getfilesetid() + * + * FUNCTION: Translate FilesetName to FilesetID + * + * INPUT: pathname: specifies the pathname of any file within the + * mounted file system to which the command is to + * be applied + * name: name of the fileset + * + * OUTPUT: idP: points to the address of an integer that receives the ID + * + * Returns: 0 success + * -1 failure + * + * Errno: EACCESS + * EFAULT An invalid pointer is supplied; the associated + * data could not be copied in or out of the kernel + * EINVAL + * ENOENT No such file, directory or fileset + */ +int GPFS_API +gpfs_getfilesetid(const char *pathname, + const char *name, + int *idP); + + +/* NAME: gpfs_clone_snap() + * + * FUNCTION: Create an immutable clone parent from a source file + * + * Input: sourcePathP: path to source file, which will be cloned + * destPathP: path to destination file, to be created + * + * If destPathP is NULL, then the source file will be changed + * in place into an immutable clone parent. + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * ENOENT File does not exist + * EACCESS Write access to target or source search permission denied + * EINVAL Not a regular file or not a GPFS file system + * EFAULT Input argument points outside accessible address space + * ENAMETOOLONG Source or destination path name too long + * ENOSPC Not enough space on disk + * EISDIR Destination is a directory + * EXDEV Source and destination aren't in the same file system + * EROFS Destination is read-only + * EPERM Invalid source file + * EEXIST Destination file already exists + * EBUSY Source file is open + * EFORMAT File system does not support clones + * EMEDIUMTYPE File system does not support clones + */ +int GPFS_API +gpfs_clone_snap(const char *sourcePathP, const char *destPathP); + +/* NAME: gpfs_clone_copy() + * + * FUNCTION: Create a clone copy of an immutable clone parent file + * + * Input: sourcePathP: path to immutable source file, to be cloned + * destPathP: path to destination file, to be created + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * ENOENT File does not exist + * EACCESS Write access to target or source search permission denied + * EINVAL Not a regular file or not a GPFS file system + * EFAULT Input argument points outside accessible address space + * ENAMETOOLONG Source or destination path name too long + * ENOSPC Not enough space on disk + * EISDIR Destination is a directory + * EXDEV Source and destination aren't in the same file system + * EROFS Destination is read-only + * EPERM Invalid source or destination file + * EEXIST Destination file already exists + * EFORMAT File system does not support clones + * EMEDIUMTYPE File system does not support clones + */ +int GPFS_API +gpfs_clone_copy(const char *sourcePathP, const char *destPathP); + + +/* NAME: gpfs_declone() + * + * FUNCTION: Copy blocks from clone parent(s) to child so that the + * parent blocks are no longer referenced by the child. + * + * Input: fileDesc: File descriptor for file to be de-cloned + * ancLimit: Ancestor limit (immediate parent only, or all) + * nBlocks: Maximum number of GPFS blocks to copy + * In/Out: offsetP: Pointer to starting offset within file (will be + * updated to offset of next block to process or + * -1 if no more blocks) + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL Invalid argument to function + * EBADF Bad file descriptor or not a GPFS file + * EPERM Not a regular file + * EACCESS Write access to target file not permitted + * EFAULT Input argument points outside accessible address space + * ENOSPC Not enough space on disk + */ + +/* Values for ancLimit */ +#define GPFS_CLONE_ALL 0 +#define GPFS_CLONE_PARENT_ONLY 1 + +int GPFS_API +gpfs_declone(gpfs_file_t fileDesc, int ancLimit, gpfs_off64_t nBlocks, + gpfs_off64_t *offsetP); + +/* NAME: gpfs_clone_split() + * + * FUNCTION: Split a clone child file from its parent. Must call + * gpfs_declone first, to remove all references. + * + * Input: fileDesc: File descriptor for file to be split + * ancLimit: Ancestor limit (immediate parent only, or all) + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL Invalid argument to function + * EBADF Bad file descriptor or not a GPFS file + * EPERM Not a regular file or not a clone child + * EACCESS Write access to target file not permitted + */ +int GPFS_API +gpfs_clone_split(gpfs_file_t fileDesc, int ancLimit); + +/* NAME: gpfs_clone_unsnap() + * + * FUNCTION: Change a clone parent with no children back into a + * normal file. + * + * Input: fileDesc: File descriptor for file to be un-snapped + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL Invalid argument to function + * EBADF Bad file descriptor or not a GPFS file + * EPERM Not a regular file or not a clone parent + * EACCESS Write access to target file not permitted + */ +int GPFS_API +gpfs_clone_unsnap(gpfs_file_t fileDesc); + +/* NAME: gpfs_get_fset_masks() + * + * FUNCTION: return bit masks governing "external" inode and inode-space numbering + * + * Input: fset_snaphandle: ptr to an fset snaphandle + * Output: the bit masks and inodes per block factor. + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS function not available + * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle + */ +int GPFS_API +gpfs_get_fset_masks(gpfs_fssnap_handle_t* fset_snapHandle, + gpfs_ino64_t* inodeSpaceMask, + gpfs_ino64_t* inodeBlockMask, + int* inodesPerInodeBlock); + + +/* + * API functions for Light Weight Event + */ + +/* + * Define light weight event types + */ +typedef enum +{ + GPFS_LWE_EVENT_UNKNOWN = 0, /* "Uknown event" */ + GPFS_LWE_EVENT_FILEOPEN = 1, /* 'OPEN' - look at getInfo('OPEN_FLAGS') if you care */ + GPFS_LWE_EVENT_FILECLOSE = 2, /* "File Close Event" 'CLOSE' */ + GPFS_LWE_EVENT_FILEREAD = 3, /* "File Read Event" 'READ' */ + GPFS_LWE_EVENT_FILEWRITE = 4, /* "File Write Event" 'WRITE' */ + GPFS_LWE_EVENT_FILEDESTROY = 5, /* File is being destroyed 'DESTROY' */ + GPFS_LWE_EVENT_FILEEVICT = 6, /* OpenFile object is being evicted from memory 'FILE_EVICT' */ + GPFS_LWE_EVENT_BUFFERFLUSH = 7, /* Data buffer is being written to disk 'BUFFER_FLUSH' */ + GPFS_LWE_EVENT_POOLTHRESHOLD = 8, /* Storage pool exceeded defined utilization 'POOL_THRESHOLD' */ + GPFS_LWE_EVENT_FILEDATA = 9, /* "Read/Write/Trunc" event on open file */ + GPFS_LWE_EVENT_FILERENAME = 10, /* Rename event on open file */ + GPFS_LWE_EVENT_FILEUNLINK = 11, /* Unlink file event */ + GPFS_LWE_EVENT_FILERMDIR = 12, /* Remove directory event */ + GPFS_LWE_EVENT_EVALUATE = 13, /* Evaluate And Set Events */ + + GPFS_LWE_EVENT_FILEOPEN_READ = 14, /* Open for Read Only - EVENT 'OPEN_READ' - deprecated, use 'OPEN' */ + GPFS_LWE_EVENT_FILEOPEN_WRITE = 15, /* Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */ + + GPFS_LWE_EVENT_FILEPOOL_CHANGE = 16, /* Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */ + GPFS_LWE_EVENT_XATTR_CHANGE = 17, /* EAs of file are changed */ + GPFS_LWE_EVENT_ACL_CHANGE = 18, /* ACLs (both GPFS ACLs and Posix permissions) of a file are changed */ + GPFS_LWE_EVENT_CREATE = 19, /* create, including mkdir, symlink, special file */ + GPFS_LWE_EVENT_GPFSATTR_CHANGE = 20, /* ts-specific attributes of file are changed */ + GPFS_LWE_EVENT_FILETRUNCATE = 21, /* "File Truncate Event" 'TRUNCATE' */ + + GPFS_LWE_EVENT_MAX = 22, /* 1 greater than any of the above */ +} gpfs_lwe_eventtype_t; + + +/* Define light weight event response types */ +typedef enum +{ + GPFS_LWE_RESP_INVALID = 0, /* "Response Invalid/Unknown" */ + GPFS_LWE_RESP_CONTINUE = 1, /* "Response Continue" */ + GPFS_LWE_RESP_ABORT = 2, /* "Response Abort" */ + GPFS_LWE_RESP_DONTCARE = 3 /* "Response DontCare" */ +} gpfs_lwe_resp_t; + +/* + * Define light weight event inofrmation + */ +#define LWE_DATA_FS_NAME 0x00000001 /* "fsName" */ +#define LWE_DATA_PATH_NAME 0x00000002 /* "pathName" */ +#define LWE_DATA_PATH_NEW_NAME 0x00000004 /* "pathNewName" for reanem */ +#define LWE_DATA_URL 0x00000008 /* "URL" */ +#define LWE_DATA_INODE 0x00000010 /* "inode" */ +#define LWE_DATA_OPEN_FLAGS 0x00000020 /* "openFlags" */ +#define LWE_DATA_POOL_NAME 0x00000040 /* "poolName" */ +#define LWE_DATA_FILE_SIZE 0x00000080 /* "fileSize" */ +#define LWE_DATA_OWNER_UID 0x00000100 /* "ownerUserId" */ +#define LWE_DATA_OWNER_GID 0x00000200 /* "ownerGroupId" */ +#define LWE_DATA_ATIME 0x00000400 /* "atime" */ +#define LWE_DATA_MTIME 0x00000800 /* "mtime" */ +#define LWE_DATA_NOW_TIME 0x00001000 /* "nowTime" */ +#define LWE_DATA_ELAPSED_TIME 0x00002000 /* "elapsedTime" */ +#define LWE_DATA_CLIENT_UID 0x00004000 /* "clientUserId" */ +#define LWE_DATA_CLIENT_GID 0x00008000 /* "clientGroupId" */ +#define LWE_DATA_NFS_IP 0x00010000 /* "clientIp" */ +#define LWE_DATA_PROCESS_ID 0x00020000 /* "processId" */ +#define LWE_DATA_TARGET_POOL_NAME 0x00040000 /* "targetPoolName" */ +#define LWE_DATA_BYTES_READ 0x00080000 /* "bytesRead" */ +#define LWE_DATA_BYTES_WRITTEN 0x00100000 /* "bytesWritten" */ +#define LWE_DATA_CLUSTER_NAME 0x00200000 /* "clusterName" */ +#define LWE_DATA_NODE_NAME 0x00400000 /* "nodeName" */ + +/* + * Define light weight events + */ +#define LWE_EVENT_EVALUATED 0x00000001 /* policy was evaluated */ +#define LWE_EVENT_FILEOPEN 0x00000002 /* "op_open" */ +#define LWE_EVENT_FILECLOSE 0x00000004 /* "op_close" */ +#define LWE_EVENT_FILEREAD 0x00000008 /* "op_read" */ +#define LWE_EVENT_FILEWRITE 0x00000010 /* "op_write" */ +#define LWE_EVENT_FILEDESTROY 0x00000020 /* "op_destroy" */ +#define LWE_EVENT_FILEEVICT 0x00000040 /* "op_evict" OpenFile object is being evicted from memory 'FILE_EVICT' */ +#define LWE_EVENT_BUFFERFLUSH 0x00000080 /* "op_buffer_flush" Data buffer is being written to disk 'BUFFER_FLUSH' */ +#define LWE_EVENT_POOLTHRESHOLD 0x00000100 /* "op_pool_threshhold" Storage pool exceeded defined utilization 'POOL_THRESHOLD' */ +#define LWE_EVENT_FILEDATA 0x00000200 /* "op_data" "Read/Write/Trunc" event on open file */ +#define LWE_EVENT_FILERENAME 0x00000400 /* "op_rename" Rename event on open file */ +#define LWE_EVENT_FILEUNLINK 0x00000800 /* "op_unlink" Unlink file event */ +#define LWE_EVENT_FILERMDIR 0x00001000 /* "op_rmdir" Remove directory event */ +#define LWE_EVENT_FILEOPEN_READ 0x00002000 /* "op_open_read" Open for Read Only - EVENT 'OPEN_READ' - deprecated, use 'OPEN' */ +#define LWE_EVENT_FILEOPEN_WRITE 0x00004000 /* "op_open_write" Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */ +#define LWE_EVENT_FILEPOOL_CHANGE 0x00008000 /* "op_pool_change" Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */ + +/* + * Defines for light weight sessions + */ +typedef unsigned long long gpfs_lwe_sessid_t; +#define GPFS_LWE_NO_SESSION ((gpfs_lwe_sessid_t) 0) +#define GPFS_LWE_SESSION_INFO_LEN 256 + + +/* + * Define light weight token to identify access right + */ +typedef struct gpfs_lwe_token +{ + unsigned long long high; + unsigned long long low; + +#ifdef __cplusplus + bool operator == (const struct gpfs_lwe_token& rhs) const + { return high == rhs.high && low == rhs.low; }; + bool operator != (const struct gpfs_lwe_token& rhs) const + { return high != rhs.high || low != rhs.low; }; +#endif /* __cplusplus */ + +} gpfs_lwe_token_t; + +/* Define special tokens */ +static const gpfs_lwe_token_t _gpfs_lwe_no_token = { 0, 0 }; +#define GPFS_LWE_NO_TOKEN _gpfs_lwe_no_token + +static const gpfs_lwe_token_t _gpfs_lwe_invalid_token = { 0, 1 }; +#define GPFS_LWE_INVALID_TOKEN _gpfs_lwe_invalid_token + +/* + * Note: LWE data managers can set a file's off-line bit + * or any of the managed bits visible to the policy language + * by calling dm_set_region or dm_set_region_nosync + * with a LWE session and LWE exclusive token. To set the bits + * there must be * exactly one managed region with offset = -1 + * and size = 0. Any other values will return EINVAL. + */ + +/* LWE also provides light weight regions + * that are set via policy rules. + */ +#define GPFS_LWE_MAX_REGIONS 2 + +/* LWE data events are generated from user access + * to a LWE managed region. */ +#define GPFS_LWE_DATAEVENT_NONE (0x0) +#define GPFS_LWE_DATAEVENT_READ (0x1) +#define GPFS_LWE_DATAEVENT_WRITE (0x2) +#define GPFS_LWE_DATAEVENT_TRUNCATE (0x4) +#define GPFS_LWE_ATTRCHANGEEVENT_IMMUTABILITY (0x8) +#define GPFS_LWE_ATTRCHANGEEVENT_APPENDONLY (0x10) + + + +/* + * Define light weight event structure + */ +typedef struct gpfs_lwe_event { + int eventLen; /* offset 0 */ + gpfs_lwe_eventtype_t eventType; /* offset 4 */ + gpfs_lwe_token_t eventToken; /* offset 8 <--- Must on DWORD */ + int isSync; /* offset 16 */ + int parmLen; /* offset 20 */ + char* parmP; /* offset 24 <-- Must on DWORD */ +} gpfs_lwe_event_t; + + + +/* + * Define light weight access rights + */ +#define GPFS_LWE_RIGHT_NULL 0 +#define GPFS_LWE_RIGHT_SHARED 1 +#define GPFS_LWE_RIGHT_EXCL 2 + + +/* Flag indicating whether to wait + * when requesting a right or an event + */ +#define GPFS_LWE_FLAG_NONE 0 +#define GPFS_LWE_FLAG_WAIT 1 + + + + + +/* NAME: gpfs_lwe_create_session() + * + * FUNCTION: create a light weight event session + * + * Input: oldsid: existing session id, + * Set to GPFS_LWE_NO_SESSION to start new session + * - If a session with the same name and id already exists + * it is not terminated, nor will outstanding events + * be redelivered. This is typically used if a session + * is shared between multiple processes. + * Set to an existing session's id to resume that session + * - If a session with the same name exists, that session + * will be terminated. All pending/outstanding events + * for the old session will be redelivered on the new one. + * This is typically used to take over a session from a + * failed/hung process. + * sessinfop: session string, unique for each session + * + * Output: newsidp: session id for new session + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL invalid parameters + * ENFILE maximum number of sessions have already been created + * ENOMEM insufficient memory to create new session + * ENOENT session to resume does not exist + * EEXIST session to resume exists with different id + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_create_session(gpfs_lwe_sessid_t oldsid, /* IN */ + char *sessinfop, /* IN */ + gpfs_lwe_sessid_t *newsidp); /* OUT */ + +#define GPFS_MAX_LWE_SESSION_INFO_LEN 100 + + + +/* NAME: gpfs_lwe_destroy_session() + * + * FUNCTION: destroy a light weight event session + * + * Input: sid: id of the session to be destroyed + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL sid invalid + * EBUSY session is busy + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_destroy_session(gpfs_lwe_sessid_t sid); /* IN */ + + + + +/* NAME: gpfs_lwe_getall_sessions() + * + * FUNCTION: fetch all lwe sessions + * + * Input: nelem: max number of elements + * sidbufp: array of session id + * nelemp: number of session returned in sidbufp + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL pass in args invalid + * E2BIG information is too large + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_getall_sessions(unsigned int nelem, /* IN */ + gpfs_lwe_sessid_t *sidbufp, /* OUT */ + unsigned int *nelemp); /* OUT */ + + +/* NAME: gpfs_lw_query_session() + * + * FUNCTION: query session string by id + * + * Input: sid: id of session to be queryed + * buflen: length of buffer + * bufp: buffer to store sessions string + * rlenp: returned length of bufp + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * EINVAL pass in args invalid + * E2BIG information is too large + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_query_session(gpfs_lwe_sessid_t sid, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenP); /* OUT */ + + +/* NAME: gpfs_lwe_get_events() + * + * FUNCTION: get events from a light weight session + * + * Input: sid: id of the session + * maxmsgs: max number of event to fetch, + * 0 to fetch all possible + * flags: GPFS_LWE_EV_WAIT: waiting for new events if event + * queue is empty + * buflen: length of the buffer + * bufp: buffer to hold events + * rlenp: returned length of bufp + * + * Returns: 0 Success + * E2BIG information is too large + * EINVAL pass in args invalid + */ +int GPFS_API +gpfs_lwe_get_events(gpfs_lwe_sessid_t sid, /* IN */ + unsigned int maxmsgs, /* IN */ + unsigned int flags, /* IN */ + size_t buflen, /* IN */ + void *bufp, /* OUT */ + size_t *rlenp); /* OUT */ + +/* NAME: gpfs_lwe_respond_event() + * + * FUNCTION: response to a light weight event + * + * Input: sid: id of the session + * token: token of the event + * response: response to the event + * reterror: return error to event callers + * + * Returns: 0 Success + * EINVAL pass in args invalid + * + */ +int GPFS_API +gpfs_lwe_respond_event(gpfs_lwe_sessid_t sid, /* IN */ + gpfs_lwe_token_t token, /* IN */ + gpfs_lwe_resp_t response, /* IN */ + int reterror); /* IN */ + + +/* NAME: gpfs_lwe_request_right + * + * FUNCTION: Request an access right to a file using a dmapi handle + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * right Shared or exclusive access requested + * flags Caller will wait to acquire access if necessary + * + * Output: token Unique identifier for access right + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * ESTALE GPFS not available + * EINVAL Invalid arguments + * EFAULT Invalid pointer provided + * EBADF Bad file + * ENOMEM Uable to allocate memory for request + * EPERM Caller does not hold appropriate privilege + * EAGAIN flags parameter did not include WAIT + * and process would be blocked + * + */ +int GPFS_API +gpfs_lwe_request_right(gpfs_lwe_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + unsigned int right, /* IN */ + unsigned int flags, /* IN */ + gpfs_lwe_token_t *token); /* OUT */ + + +/* NAME: gpfs_lwe_upgrade_right + * + * FUNCTION: Upgrade an access right from shared to exclusive + * + * This is a non-blocking call to upgrade an access right + * from shared to exclusive. If the token already conveys + * exclusive access this call returns imediately with sucess. + * If another process also holds a shared access right + * this call fails with EBUSY to avoid deadlocks. + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * + * Output: None + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * ESTALE GPFS not available + * EINVAL Invalid arguments + * EINVAL The token is invalid + * EFAULT Invalid pointer provided + * EPERM Caller does not hold appropriate privilege + * EPERM Token's right is not shared or exclusive + * EBUSY Process would be blocked + * + */ +int GPFS_API +gpfs_lwe_upgrade_right(gpfs_lwe_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + gpfs_lwe_token_t token); /* IN */ + + +/* NAME: gpfs_lwe_downgrade_right + * + * FUNCTION: Downgrade an access right from exclusive to shared + * + * This reduces an access right from exclusive to shared + * without dropping the exclusive right to acquire the shared. + * The token must convey exclusive right before the call. + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * + * Output: None + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * ESTALE GPFS not available + * EINVAL Invalid arguments + * EINVAL The token is invalid + * EFAULT Invalid pointer provided + * EPERM Caller does not hold appropriate privilege + * EPERM Token's right is not exclusive + * + */ +int GPFS_API +gpfs_lwe_downgrade_right(gpfs_lwe_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + gpfs_lwe_token_t token); /* IN */ + + +/* NAME: gpfs_lwe_release_right + * + * FUNCTION: Release an access right conveyed by a token + * + * This releases the access right held by a token + * and invalidates the token. Once the access right + * is released the token cannot be reused. + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * + * Output: None + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOSYS Function not available + * ESTALE GPFS not available + * EINVAL Invalid arguments + * EINVAL The token is invalid + * EFAULT Invalid pointer provided + * EPERM Caller does not hold appropriate privilege + */ +int GPFS_API +gpfs_lwe_release_right(gpfs_lwe_sessid_t sid, /* IN */ + void *hanp, /* IN */ + size_t hlen, /* IN */ + gpfs_lwe_token_t token); /* IN */ + + +/* NAME: gpfs_lwe_getattrs() + * + * FUNCTION: Retrieves all extended file attributes in opaque format. + * This function together with gpfs_lwe_putattrs is intended for + * use by a backup program to save (gpfs_lwe_getattrs) and + * restore (gpfs_lwe_putattrs) all extended file attributes + * (ACLs, user attributes, ...) in one call. + * + * NOTE: This call is the lwe equivalent of gpfs_igetattrsx + * but uses a file handle to identify the file + * and an existing LWE token for locking it. + * + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * flags Define behavior of get attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement + * are not saved, neither is the current storage pool. + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement + * are saved, but the current storage pool is not. + * GPFS_ATTRFLAG_INCL_DMAPI - file attributes for dmapi are + * included in the returned buffer + * GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption + * are included in the returned buffer + * + * buffer: pointer to buffer for returned attributes + * bufferSize: size of buffer + * attrSize: ptr to returned size of attributes + * + * Returns: 0 Successful + * -1 Failure + * + * Errno: ENOSYS function not available + * EINVAL Not a GPFS file + * EINVAL invalid flags provided + * ENOSPC buffer too small to return all attributes + * *attrSizeP will be set to the size necessary + */ +int GPFS_API +gpfs_lwe_getattrs(gpfs_lwe_sessid_t sid, + void *hanp, + size_t hlen, + gpfs_lwe_token_t token, + int flags, + void *buffer, + int bufferSize, + int *attrSize); + + +/* NAME: gpfs_lwe_putattrs() + * + * FUNCTION: Sets all extended file attributes of a file. + * + * This routine can optionally invoke the policy engine + * to match a RESTORE rule using the file's attributes saved + * in the extended attributes to set the file's storage pool and + * data replication as when calling gpfs_fputattrswithpathname. + * When used with the policy the caller should include the + * full path to the file, including the file name, to allow + * rule selection based on file name or path. + * + * By default, the routine will not use RESTORE policy rules + * for data placement. The pathName parameter will be ignored + * and may be set to NULL. + * + * If the call does not use RESTORE policy rules, or if the + * file fails to match a RESTORE rule, or if there are no + * RESTORE rules installed, then the storage pool and data + * replication are selected as when calling gpfs_fputattrs(). + * + * The buffer passed in should contain extended attribute data + * that was obtained by a previous call to gpfs_fgetattrs. + * + * pathName is a UTF-8 encoded string. On Windows, applications + * can convert UTF-16 ("Unicode") to UTF-8 using the platforms + * WideCharToMultiByte function. + * + * NOTE: This call is the lwe equivalent of gpfs_iputaattrsx + * but uses a file handle to identify the file + * and an existing LWE token for locking it. + * + * + * Input: sid Id of lw session + * hanp Pointer to dmapi handle + * hlen Length of dmapi handle + * token Unique identifier for access right + * flags Define behavior of put attributes + * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored + * but the storage pool and data replication are unchanged + * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a placement rule + * instead of restoring the saved storage pool. + * GPFS_ATTRFLAG_USE_POLICY - file attributes are restored + * but the storage pool and data replication are selected + * by matching the saved attributes to a RESTORE rule + * instead of restoring the saved storage pool. + * GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored + * after data is retored. If file is immutable/appendOnly + * call without this flag before restoring data + * then call with this flag after restoring data + * GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption + * are restored. Note that this may result in the file's + * File Encryption Key (FEK) being changed, and in this + * case any prior content in the file is effectively lost. + * This option should only be used when the entire file + * content is restored after the attributes are restored. + * + * buffer: pointer to buffer for returned attributes + * pathName: pointer to file path and file name for file + * May be set to NULL. + * + * Returns: 0 Successful + * -1 Failure and errno is set + * + * Errno: ENOSYS function not available + * EINVAL the buffer does not contain valid attribute data + * EINVAL invalid flags provided + * EPERM caller must have superuser privilege + * ESTALE cached fs information was invalid + * GPFS_E_INVAL_IFILE bad ifile parameters + */ +int GPFS_API +gpfs_lwe_putattrs(gpfs_lwe_sessid_t sid, + void *hanp, + size_t hlen, + gpfs_lwe_token_t token, + int flags, + void *buffer, + const char *pathName); + +const char* GPFS_API +gpfs_get_fspathname_from_fsname(const char* fsname_or_path); +/* Check that fsname_or_path refers to a GPFS file system and find the path to its root + Return a strdup()ed copy of the path -OR- NULL w/errno +*/ + +int GPFS_API +/* experimental */ +gpfs_qos_getstats( + const char *fspathname, /* in only: path to file system*/ + unsigned int options, /* in only: option flags: 0=begin at specified qip, 1=begin after qip */ + unsigned int qosid, /* in only: 0 or a specific qosid at which to start or continue */ + gpfs_pool_t poolid, /* in only: -1 or a specific poolid at which to start or continue */ + unsigned int mqips, /* in only: max number of qip=(qosid,poolid) histories to retrieve */ + unsigned int nslots, /* in only: max number of time slots of history to retrieve */ + void *bufferP, /* ptr to return stat structures */ + unsigned int bufferSize); /* sizeof stat buffer or 0 */ + +int GPFS_API +/* experimental */ +gpfs_qos_control( + const char *fspathname, /* in only: path to file system*/ + void *bufferP, /* in/out control/get/set structs */ + unsigned int bufferSize); + +int GPFS_API +gpfs_qos_set( + const char *fspathname, + const char *classname, /* "gold", "silver", or .. "1" or "2" .. */ + int id, /* process id or pgrp or userid */ + int which, /* process, pgrp or user */ + double* qshareP); /* return the share, percentage or when negative IOP limit */ +/* if id==0 then getpid() or getpgrp() or getuid() + if which==0 or 1 then process, if 2 process then group, if 3 then userid + Return -1 on error, with errno= + ENOSYS if QOS is not available in the currently installed GPFS software. + ENOENT if classname is not recognized. + ENXIO if QOS throttling is not active + (but classname is recognized and *qshareP has configured value) +*/ + +/* For the given process get QOS info */ +int GPFS_API +gpfs_qos_get( + const char *fspathname, + int *classnumP, + char classname[18], /* "gold", "silver", or .. "1" or "2" .. */ + int id, /* process id or pgrp or userid */ + int which, /* process, pgrp or user */ + double* qshareP); /* return the share, percentage or when negative IOP limit */ + +/* given classname, set *classnumP and set *qshareP + Return -1 on error, with errno= + ENOSYS if QOS is not available in the currently installed GPFS software. + ENOENT if classname is not recognized. + ENXIO if QOS throttling is not active + (but classname is recognized, *classnumP and *qshareP have configured values) +*/ +int GPFS_API +gpfs_qos_lkupName( + const char *fspathname, + int *classnumP, + const char *classname, + double* qshareP); + +/* given classnumber, find name and share (similar to above), but start with number instead of name */ +int GPFS_API +gpfs_qos_lkupVal( + const char *fspathname, + int val, + char classname[18], + double* qshareP); + +int GPFS_API +gpfs_ioprio_set(int,int,int); /* do not call directly */ + +int GPFS_API +gpfs_ioprio_get(int,int); /* do not call directly */ + + +/* NAME: gpfs_enc_file_rewrap_key() + * + * FUNCTION: Re-wrap the File Encryption Key (FEK) for the file, + * replacing the usage of the original (second parameter) + * Master Encryption Key (MEK) with the new key provided as + * the third parameter. The content of the file remains intact. + * + * If the FEK is not currently being wrapped with the MEK + * identified by the second parameter then no action is taken. + * + * This function is normally invoked before the original MEK is + * removed. + * + * The file may be opened in read-only mode for this function + * to perform the key rewrap. + * + * Superuser privilege is required to invoke this API. + * + * INPUT: fileDesc: File descriptor for file whose key is to be rewrapped + * orig_key_p: Key ID for the key (MEK) to be replaced + * new_key_p: Key ID for the new key (MEK) to be used + * + * OUTPUT: N/A + * + * Returns: 0 success + * -1 failure + * + * Errno: + * EACCESS Existing or new key cannot be retrieved + * The new key is already being used to wrap the + * file's FEK + * EBADF Bad file descriptor + * EINVAL Arguments are invalid: key format is incorrect + * EFAULT An invalid pointer is supplied; the associated + * data could not be copied in or out of the kernel + * E2BIG Key IDs provided are too long + * ENOSYS Function not available (cluster or file system not + * enabled for encryption) + * EPERM File is in a snapshot + * Caller must have superuser privilege + */ + +/* The Key ID is a string comprised of the key ID and the remote key + server RKM ID, separated by ':' */ +typedef const char *gpfs_enc_key_id_t; /* " : " */ + +int GPFS_API +gpfs_enc_file_rewrap_key(gpfs_file_t fileDesc, + gpfs_enc_key_id_t orig_key_p, + gpfs_enc_key_id_t new_key_p); + + +/* NAME: gpfs_enc_get_algo() + * + * FUNCTION: Retrieve a string describing the encryption algorithm, key + * length, Master Encryption Key(s) ID, and wrapping and combining + * mechanisms used for the file. + * + * INPUT: fileDesc: File descriptor for file whose encryption + * algorithm is being retrieved + * encryption_xattrP: content of the gpfs.Encryption + * extended attribute, retrieved by a call to + * gpfs_fcntl (with structure type GPFS_FCNTL_GET_XATTR) + * xattr_len: length of the data in encryption_xattrP + * algo_txt_size: space reserved by the caller for algo_txtP + * + * OUTPUT: algo_txtP: NULL-terminated string describing the + * encryption for the file + * + * Returns: 0 success + * -1 failure + * + * Errno: + * ENOENT File not found + * EBADF Bad file handle, not a GPFS file + * EACCESS Permission denied + * EFAULT Bad address provided + * EINVAL Not a regular file + * EINVAL Invalid values for xattr_len or algo_txt_size + * EINVAL Invalid content of encryption extended attribute + * ENOSYS Function not available + * E2BIG Output string does not fit in algo_txtP + */ + +int GPFS_API +gpfs_enc_get_algo(gpfs_file_t fileDesc, + const char *encryption_xattrP, + int xattr_len, + char *algo_txtP, + int algo_txt_size); + + +/* NAME: gpfs_init_trace() + * + * FUNCTION: Initialize the GPFS trace facility and start to use it. + * Must be called before calling gpfs_add_trace(). + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOENT file not found + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * ENFILE Too many open files + * ENOSYS Function not available + */ +int GPFS_API +gpfs_init_trace(void); + +/* NAME: gpfs_query_trace() + * + * FUNCTION: Query and cache the latest settings of GPFS trace facility. + * Generally this should be called by the notification handler + * for the "traceConfigChanged" event, which is invoked when + * something changes in the configuration of the trace facility. + * + * Returns: 0 Success + * -1 Failure + * + * Errno: ENOENT file not found + * ENOMEM Memory allocation failed + * EACCESS Permission denied + * ENFILE Too many open files + * ENOSYS Function not available + */ +int GPFS_API +gpfs_query_trace(void); + +/* NAME: gpfs_add_trace() + * + * FUNCTION: write the logs into GPFS trace driver. When the user specified + * parameter "level" is less than or equal to the GPFS trace level, + * the log message pointed to by parameter "msg" would be written to + * GPFS trace buffer, and user can use mmtracectl command to cut + * the GPFS trace buffer into a file to observe. Must be called after + * the call to gpfs_init_trace(). Also ensure the gpfs_query_trace() + * is called properly to update the gpfs trace level cached in + * application, otherwise, the trace may miss to write down to + * GPFS trace driver. + * + * Input: level: the level for this trace generation. When the level + * is less than or equal to the GPFS trace level, this + * trace record would be written to GPFS trace buffer. + * msg: the message string that would be put into GPFS trace buffer. + * + * Returns: None. + */ +void GPFS_API +gpfs_add_trace(int level, const char *msg); + +/* NAME: gpfs_fini_trace() + * + * FUNCTION: Stop using GPFS trace facility. This should be paired with + * gpfs_init_trace(), and must be called after the last + * gpfs_add_trace(). + * + * Returns: None. + */ + +void gpfs_fini_trace(void); + +/* + * When GPFS_64BIT_INODES is defined, use the 64-bit interface definitions as + * the default. + */ + +#ifdef GPFS_64BIT_INODES + #undef GPFS_D_VERSION + #define GPFS_D_VERSION GPFS_D64_VERSION + #undef GPFS_IA_VERSION + #define GPFS_IA_VERSION GPFS_IA64_VERSION + + #define gpfs_ino_t gpfs_ino64_t + #define gpfs_gen_t gpfs_gen64_t + #define gpfs_uid_t gpfs_uid64_t + #define gpfs_gid_t gpfs_gid64_t + #define gpfs_snapid_t gpfs_snapid64_t + #define gpfs_nlink_t gpfs_nlink64_t + #define gpfs_timestruc_t gpfs_timestruc64_t + #define gpfs_direntx_t gpfs_direntx64_t + #define gpfs_direntx gpfs_direntx64 + #define gpfs_iattr_t gpfs_iattr64_t + + #define gpfs_get_snapid_from_fssnaphandle gpfs_get_snapid_from_fssnaphandle64 + #define gpfs_open_inodescan gpfs_open_inodescan64 + #define gpfs_open_inodescan_with_xattrs gpfs_open_inodescan_with_xattrs64 + #define gpfs_next_inode gpfs_next_inode64 + #define gpfs_next_inode_with_xattrs gpfs_next_inode_with_xattrs64 + #define gpfs_seek_inode gpfs_seek_inode64 + #define gpfs_stat_inode gpfs_stat_inode64 + #define gpfs_stat_inode_with_xattrs gpfs_stat_inode_with_xattrs64 + #define gpfs_iopen gpfs_iopen64 + #define gpfs_ireaddir gpfs_ireaddir64 + #define gpfs_ireaddirx gpfs_ireaddirx64 + #define gpfs_iwritedir gpfs_iwritedir64 + #define gpfs_ireadlink gpfs_ireadlink64 +#endif + +#define gpfs_icreate gpfs_icreate64 + +#ifdef __cplusplus +} +#endif + +#endif /* H_GPFS */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/gpfs_lwe.h b/System/ior/files/gpfs/5.0.2-3/include/gpfs_lwe.h new file mode 100644 index 0000000..fc30416 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/gpfs_lwe.h @@ -0,0 +1,131 @@ +/* */ +/* Copyright (C) 2001 International Business Machines */ +/* All rights reserved. */ +/* */ +/* This file is part of the GPFS user library. */ +/* */ +/* 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. */ +/* */ +/* @(#)69 1.9 src/avs/fs/mmfs/ts/util/gpfs_lwe.h, mmfs, avs_rtac502, rtac5021836a 1/18/17 17:22:53 */ +/* + * Library calls for GPFS interfaces + */ +#ifndef H_GPFS_LWE +#define H_GPFS_LWE + +#ifdef __cplusplus +extern "C" { +#endif + +static const char LWE_JSON[] = +"{\"type\":\"record\",\ + \"name\":\"LWE\",\ + \"fields\":[\ + {\"name\": \"fsName\", \"type\": \"string\"},\ + {\"name\": \"event\", \"type\": \"string\"},\ + {\"name\": \"pathName\", \"type\": \"string\"},\ + {\"name\": \"pathNewName\", \"type\": \"string\"},\ + {\"name\": \"URL\", \"type\": \"string\"},\ + {\"name\": \"inode\", \"type\": \"long\"},\ + {\"name\": \"openFlags\", \"type\": \"string\"},\ + {\"name\": \"poolName\", \"type\": \"string\"},\ + {\"name\": \"fileSize\", \"type\": \"long\"},\ + {\"name\": \"ownerUserId\", \"type\": \"int\"},\ + {\"name\": \"ownerGroupId\", \"type\": \"int\"},\ + {\"name\": \"atime\", \"type\": \"string\"},\ + {\"name\": \"mtime\", \"type\": \"string\"},\ + {\"name\": \"nowTime\", \"type\": \"string\"},\ + {\"name\": \"elapsedTime\", \"type\": \"string\"},\ + {\"name\": \"clientUserId\", \"type\": \"string\"},\ + {\"name\": \"clientGroupId\", \"type\": \"string\"},\ + {\"name\": \"clientIp\", \"type\": \"string\"},\ + {\"name\": \"processId\", \"type\": \"int\"}\ + {\"name\": \"targetPoolName\", \"type\": \"string\"},\ + {\"name\": \"bytesRead\", \"type\": \"long\"},\ + {\"name\": \"bytesWritten\", \"type\": \"long\"},\ + {\"name\": \"clusterName\", \"type\": \"string\"},\ + {\"name\": \"nodeName\", \"type\": \"string\"},\ + ]}"; + +#define GPFS_DEVNAMEX "/dev/ss0" /* Must be the same as GPFS_DEVNAME */ +#define kLWEvent 169 /* Must be the same as LWEvent in enum kxOps */ +#define LWE_MAX_FIELD 256 +#define LWE_UPDATE 201 +typedef long long Int64_t; + +struct lweHeader +{ + int lwe_version; /* in/out */ + int lwe_fd; /* in */ + int lwe_sync; /* in: sync request */ + int lwe_event; /* in: events requeste */ + /* out: event returned */ + int lwe_data; /* in: data requested */ + /* out: data returned */ + int lwe_rc; /* out for all the rest */ + int lwe_seq; /* Event sequence number */ +}; + +struct lweAttr +{ + struct lweHeader lweHdr; + Int64_t lwe_inode; + int lwe_oiOpenFlags; /* Original value of open flags */ + + /* Original credentials when the file was opened */ + int lwe_userId; + int lwe_groupId; + int lwe_processId; + int lwe_ownerUserId; + int lwe_ownerGroupId; + + Int64_t lwe_fileSize; + Int64_t lwe_bytesRead; + Int64_t lwe_bytesWritten; + Int64_t lwe_elapsedTime; + struct timespec lwe_atime; + struct timespec lwe_mtime; + struct timespec lwe_nowTime; + int lwe_plen; + int lwe_plen2; + char lwe_fsName[LWE_MAX_FIELD+1]; + char lwe_NFS_IP[NFS_IP_SIZE+1]; + char lwe_poolName[LWE_MAX_FIELD+1]; + char lwe_targetPoolName[LWE_MAX_FIELD+1]; + char lwe_clusterName[LWE_MAX_FIELD+1]; + char lwe_nodeName[LWE_MAX_FIELD+1]; + /* keep path at the end */ + char lwe_path[PATH_MAX+1]; + char lwe_path2[PATH_MAX+1]; +}; + +#define LWE_ONE_PATH (sizeof(struct lweAttr)-PATH_MAX) +#define LWE_NO_PATH (sizeof(struct lweAttr)-(PATH_MAX*2)) + +#ifdef __cplusplus +} +#endif + +#endif /* H_GPFS_LWE */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/gpfs_lweTypes.h b/System/ior/files/gpfs/5.0.2-3/include/gpfs_lweTypes.h new file mode 100644 index 0000000..8d84c51 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/gpfs_lweTypes.h @@ -0,0 +1,60 @@ +/* */ +/* Copyright (C) 2001 International Business Machines */ +/* All rights reserved. */ +/* */ +/* This file is part of the GPFS user library. */ +/* */ +/* 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. */ +/* */ +/* @(#)39 1.11 src/avs/fs/mmfs/ts/util/gpfs_lweTypes.h, mmfs, avs_rtac502, rtac5021836a 2/14/17 13:21:48 */ + +#ifndef _h_lwe_types +#define _h_lwe_types + +/* + * + * The content of this file has been moved to /usr/lpp/mmfs/include/gpfs.h + * with new naming convention as list below + * and the use of this file is deprected. +/* + * lwe_eventtype_t -> gpfs_lwe_eventtype_t + * lwe_resp_t -> gpfs_lwe_resp_t + * lwe_sessid_t -> gpfs_lwe_sessid_t + * lwe_token_t -> gpfs_lwe_token_t + * lwe_event_t -> gpfs_lwe_event_t + * _gpfsLweNoToken -> gpfs_lwe_no_token + * LWE_NO_TOKEN -> GPFS_LWE_NO_TOKEN + * _gpfsLweInvalidToken -> _gpfs_lwe_invalid_token + * LWE_INVALID_TOKEN -> GPFS_LWE_INVALID_TOKEN + */ + +#define MAX_LWESESSION_INFO_LEN 100 + +#define LWE_NO_SESSION 0 +#define LWE_EV_WAIT 0 +#define LWE_EV_NOWAIT 1 + + +#endif /* _h_lwe_types */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/gpfs_nfs.h b/System/ior/files/gpfs/5.0.2-3/include/gpfs_nfs.h new file mode 100644 index 0000000..1c50432 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/gpfs_nfs.h @@ -0,0 +1,746 @@ +/* */ +/* Copyright (C) 2001 International Business Machines */ +/* All rights reserved. */ +/* */ +/* This file is part of the GPFS user library. */ +/* */ +/* 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. */ +/* */ +/* @(#)83 1.75 src/avs/fs/mmfs/ts/util/gpfs_nfs.h, mmfs, avs_rtac502, rtac5021836a 1/6/17 08:59:35 */ +/* + * Library calls for GPFS interfaces + */ +#ifndef H_GPFS_NFS +#define H_GPFS_NFS + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef WIN32 +struct flock +{}; +#endif + +/* GANESHA common information */ + +#define GPFS_DEVNAMEX "/dev/ss0" /* Must be the same as GPFS_DEVNAME */ +#define kGanesha 140 /* Must be the same as Ganesha in enum kxOps */ + +#define OPENHANDLE_GET_VERSION 100 +#define OPENHANDLE_GET_VERSION2 1002 +#define OPENHANDLE_NAME_TO_HANDLE 101 +#define OPENHANDLE_OPEN_BY_HANDLE 102 +#define OPENHANDLE_LAYOUT_TYPE 106 +#define OPENHANDLE_GET_DEVICEINFO 107 +#define OPENHANDLE_GET_DEVICELIST 108 +#define OPENHANDLE_LAYOUT_GET 109 +#define OPENHANDLE_LAYOUT_RETURN 110 +#define OPENHANDLE_INODE_UPDATE 111 +#define OPENHANDLE_GET_XSTAT 112 +#define OPENHANDLE_SET_XSTAT 113 +#define OPENHANDLE_CHECK_ACCESS 114 +#define OPENHANDLE_OPEN_SHARE_BY_HANDLE 115 +#define OPENHANDLE_GET_LOCK 116 +#define OPENHANDLE_SET_LOCK 117 +#define OPENHANDLE_THREAD_UPDATE 118 +#define OPENHANDLE_LAYOUT_COMMIT 119 +#define OPENHANDLE_DS_READ 120 +#define OPENHANDLE_DS_WRITE 121 +#define OPENHANDLE_GET_VERIFIER 122 +#define OPENHANDLE_FSYNC 123 +#define OPENHANDLE_SHARE_RESERVE 124 +#define OPENHANDLE_GET_NODEID 125 +#define OPENHANDLE_SET_DELEGATION 126 +#define OPENHANDLE_CLOSE_FILE 127 +#define OPENHANDLE_LINK_BY_FH 128 +#define OPENHANDLE_RENAME_BY_FH 129 +#define OPENHANDLE_STAT_BY_NAME 130 +#define OPENHANDLE_GET_HANDLE 131 +#define OPENHANDLE_READLINK_BY_FH 132 +#define OPENHANDLE_UNLINK_BY_NAME 133 +#define OPENHANDLE_CREATE_BY_NAME 134 +#define OPENHANDLE_READ_BY_FD 135 +#define OPENHANDLE_WRITE_BY_FD 136 +#define OPENHANDLE_CREATE_BY_NAME_ATTR 137 +#define OPENHANDLE_GRACE_PERIOD 138 +#define OPENHANDLE_ALLOCATE_BY_FD 139 +#define OPENHANDLE_REOPEN_BY_FD 140 +#define OPENHANDLE_FADVISE_BY_FD 141 +#define OPENHANDLE_SEEK_BY_FD 142 +#define OPENHANDLE_STATFS_BY_FH 143 +#define OPENHANDLE_GETXATTRS 144 +#define OPENHANDLE_SETXATTRS 145 +#define OPENHANDLE_REMOVEXATTRS 146 +#define OPENHANDLE_LISTXATTRS 147 +#define OPENHANDLE_MKNODE_BY_NAME 148 +#define OPENHANDLE_reserved 149 +#define OPENHANDLE_TRACE_ME 150 +#define OPENHANDLE_QUOTA 151 +#define OPENHANDLE_FS_LOCATIONS 152 + +struct trace_arg +{ + uint32_t level; + uint32_t len; + char *str; +}; + +#define ganesha_v1 1 +#define ganesha_v2 2 + +int gpfs_ganesha(int op, void *oarg); + +#define OPENHANDLE_HANDLE_LEN 40 +#define OPENHANDLE_KEY_LEN 28 +#define OPENHANDLE_VERSION 2 + +struct xstat_cred_t +{ + uint32_t principal; /* user id */ + uint32_t group; /* primary group id */ + uint16_t num_groups; /* number secondary groups for this user */ +#define XSTAT_CRED_NGROUPS 32 + uint32_t eGroups[XSTAT_CRED_NGROUPS];/* array of secondary groups */ +}; + +struct gpfs_time_t +{ + uint32_t t_sec; + uint32_t t_nsec; +}; + +struct gpfs_file_handle +{ + uint16_t handle_size; + uint16_t handle_type; + uint16_t handle_version; + uint16_t handle_key_size; + uint32_t handle_fsid[2]; + /* file identifier */ + unsigned char f_handle[OPENHANDLE_HANDLE_LEN]; +}; + +struct name_handle_arg +{ + int dfd; + int flag; + const char *name; + struct gpfs_file_handle *handle; + int expfd; +}; + +struct get_handle_arg +{ + int mountdirfd; + int len; + const char *name; + struct gpfs_file_handle *dir_fh; + struct gpfs_file_handle *out_fh; +}; + +struct open_arg +{ + int mountdirfd; + int flags; + int openfd; + struct gpfs_file_handle *handle; + const char *cli_ip; +}; + +struct link_fh_arg +{ + int mountdirfd; + int len; + const char *name; + struct gpfs_file_handle *dir_fh; + struct gpfs_file_handle *dst_fh; +}; + +struct rename_fh_arg +{ + int mountdirfd; + int old_len; + const char *old_name; + int new_len; + const char *new_name; + struct gpfs_file_handle *old_fh; + struct gpfs_file_handle *new_fh; +}; + +struct glock +{ + int cmd; + int lfd; + void *lock_owner; + struct flock flock; +}; +#define GPFS_F_CANCELLK (1024 + 5) /* Maps to Linux F_CANCELLK */ +#define FL_RECLAIM 4 +#define EGRACE 140 + +struct set_get_lock_arg +{ + int mountdirfd; + struct glock *lock; + int reclaim; +}; + +struct open_share_arg +{ + int mountdirfd; + int flags; + int openfd; + struct gpfs_file_handle *handle; + int share_access; + int share_deny; + int reclaim; +}; + +struct share_reserve_arg +{ + int mountdirfd; + int openfd; + int share_access; + int share_deny; +}; + +struct fadvise_arg +{ + int mountdirfd; + int openfd; + uint64_t offset; + uint64_t length; + uint32_t *hints; +}; + +struct gpfs_io_info { + uint32_t io_what; + uint64_t io_offset; + uint64_t io_len; + uint32_t io_eof; + uint32_t io_alloc; +}; + +struct fseek_arg +{ + int mountdirfd; + int openfd; + struct gpfs_io_info *info; +}; + +struct close_file_arg +{ + int mountdirfd; + int close_fd; + int close_flags; + void *close_owner; +}; + +struct link_arg +{ + int file_fd; + int dir_fd; + const char *name; +}; + +struct readlink_arg +{ + int fd; + char *buffer; + int size; +}; + +struct readlink_fh_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + char *buffer; + int size; +}; + +struct nfsd4_pnfs_deviceid { + /** FSAL_ID - to dispatch getdeviceinfo based on */ + uint8_t fsal_id; + /** Break up the remainder into useful chunks */ + uint8_t device_id1; + uint16_t device_id2; + uint32_t device_id4; + uint64_t devid; +}; + +struct gpfs_exp_xdr_stream { + int *p; + int *end; +}; + +enum x_nfsd_fsid { + x_FSID_DEV = 0, + x_FSID_NUM, + x_FSID_MAJOR_MINOR, + x_FSID_ENCODE_DEV, + x_FSID_UUID4_INUM, + x_FSID_UUID8, + x_FSID_UUID16, + x_FSID_UUID16_INUM, + x_FSID_MAX +}; + +enum x_pnfs_layouttype { + x_LAYOUT_NFSV4_1_FILES = 1, + x_LAYOUT_OSD2_OBJECTS = 2, + x_LAYOUT_BLOCK_VOLUME = 3, + + x_NFS4_PNFS_PRIVATE_LAYOUT = 0x80000000 +}; + +/* used for both layout return and recall */ +enum x_pnfs_layoutreturn_type { + x_RETURN_FILE = 1, + x_RETURN_FSID = 2, + x_RETURN_ALL = 3 +}; + +enum x_pnfs_iomode { + x_IOMODE_READ = 1, + x_IOMODE_RW = 2, + x_IOMODE_ANY = 3, +}; + +enum stable_nfs +{ + x_UNSTABLE4 = 0, + x_DATA_SYNC4 = 1, + x_FILE_SYNC4 = 2 +}; + +struct pnfstime4 { + uint64_t seconds; + uint32_t nseconds; +}; + +struct nfsd4_pnfs_dev_iter_res { + uint64_t gd_cookie; /* request/repsonse */ + uint64_t gd_verf; /* request/repsonse */ + uint64_t gd_devid; /* response */ + uint32_t gd_eof; /* response */ +}; + +/* Arguments for set_device_notify */ +struct pnfs_devnotify_arg { + struct nfsd4_pnfs_deviceid dn_devid; /* request */ + uint32_t dn_layout_type; /* request */ + uint32_t dn_notify_types; /* request/response */ +}; + +struct nfsd4_layout_seg { + uint64_t clientid; + uint32_t layout_type; + uint32_t iomode; + uint64_t offset; + uint64_t length; +}; + +struct nfsd4_pnfs_layoutget_arg { + uint64_t lg_minlength; + uint64_t lg_sbid; + struct gpfs_file_handle *lg_fh; + uint32_t lg_iomode; +}; + +struct nfsd4_pnfs_layoutget_res { + struct nfsd4_layout_seg lg_seg; /* request/resopnse */ + uint32_t lg_return_on_close; +}; + +struct nfsd4_pnfs_layoutcommit_arg { + struct nfsd4_layout_seg lc_seg; /* request */ + uint32_t lc_reclaim; /* request */ + uint32_t lc_newoffset; /* request */ + uint64_t lc_last_wr; /* request */ + struct pnfstime4 lc_mtime; /* request */ + uint32_t lc_up_len; /* layout length */ + void *lc_up_layout; /* decoded by callback */ +}; + +struct nfsd4_pnfs_layoutcommit_res { + uint32_t lc_size_chg; /* boolean for response */ + uint64_t lc_newsize; /* response */ +}; + +struct nfsd4_pnfs_layoutreturn_arg { + uint32_t lr_return_type; /* request */ + struct nfsd4_layout_seg lr_seg; /* request */ + uint32_t lr_reclaim; /* request */ + uint32_t lrf_body_len; /* request */ + void *lrf_body; /* request */ + void *lr_cookie; /* fs private */ +}; + +struct x_xdr_netobj { + unsigned int len; + unsigned char *data; +}; +struct pnfs_filelayout_devaddr { + struct x_xdr_netobj r_netid; + struct x_xdr_netobj r_addr; +}; + +/* list of multipath servers */ +struct pnfs_filelayout_multipath { + uint32_t fl_multipath_length; + struct pnfs_filelayout_devaddr *fl_multipath_list; +}; + +struct pnfs_filelayout_device { + uint32_t fl_stripeindices_length; + uint32_t *fl_stripeindices_list; + uint32_t fl_device_length; + struct pnfs_filelayout_multipath *fl_device_list; +}; + +struct pnfs_filelayout_layout { + uint32_t lg_layout_type; /* response */ + uint32_t lg_stripe_type; /* response */ + uint32_t lg_commit_through_mds; /* response */ + uint64_t lg_stripe_unit; /* response */ + uint64_t lg_pattern_offset; /* response */ + uint32_t lg_first_stripe_index; /* response */ + struct nfsd4_pnfs_deviceid device_id; /* response */ + uint32_t lg_fh_length; /* response */ + struct gpfs_file_handle *lg_fh_list; /* response */ +}; + +enum stripetype4 { + STRIPE_SPARSE = 1, + STRIPE_DENSE = 2 +}; + +struct deviceinfo_arg +{ + int mountdirfd; + int type; + struct nfsd4_pnfs_deviceid devid; + struct gpfs_exp_xdr_stream xdr; +}; + +struct layoutget_arg +{ + int fd; + struct gpfs_file_handle *handle; + struct nfsd4_pnfs_layoutget_arg args; + struct pnfs_filelayout_layout *file_layout; + struct gpfs_exp_xdr_stream *xdr; +}; + +struct layoutreturn_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + struct nfsd4_pnfs_layoutreturn_arg args; +}; + +struct dsread_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + char *bufP; + uint64_t offset; + uint64_t length; + uint64_t *filesize; + int options; +}; + +/* define flags for options */ +#define IO_SKIP_HOLE (1 << 0) /* 01 */ +#define IO_SKIP_DATA (1 << 1) /* 02 */ +#define IO_ALLOCATE (1 << 2) /* 04 */ +#define IO_DEALLOCATE (1 << 3) /* 08 */ + +struct dswrite_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + char *bufP; + uint64_t offset; + uint64_t length; + uint32_t stability_wanted; + uint32_t *stability_got; + uint32_t *verifier4; + int options; +}; + +struct read_arg +{ + int mountdirfd; + int fd; + char *bufP; + uint64_t offset; + uint64_t length; + uint32_t stability_wanted; + uint32_t *stability_got; + uint32_t *verifier4; + int options; +}; + +struct write_arg +{ + int mountdirfd; + int fd; + char *bufP; + uint64_t offset; + uint64_t length; + uint32_t stability_wanted; + uint32_t *stability_got; + uint32_t *verifier4; + int options; +}; + +struct alloc_arg +{ + int fd; + uint64_t offset; + uint64_t length; + int options; +}; + +struct layoutcommit_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + uint64_t offset; + uint64_t length; + uint32_t reclaim; /* True if this is a reclaim commit */ + uint32_t new_offset; /* True if the client has suggested a new offset */ + uint64_t last_write; /* The offset of the last byte written, if + new_offset if set, otherwise undefined. */ + uint32_t time_changed; /* True if the client provided a new value for mtime */ + struct gpfs_time_t new_time; /* If time_changed is true, the client-supplied + modification tiem for the file. otherwise, undefined. */ + struct gpfs_exp_xdr_stream *xdr; +}; + +struct fsync_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + uint64_t offset; + uint64_t length; + uint32_t *verifier4; +}; + +struct statfs_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + struct statfs *buf; +}; + +struct stat_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + struct stat *buf; +}; + +struct grace_period_arg +{ + int mountdirfd; + int grace_sec; +}; + +struct create_name_arg +{ + int mountdirfd; /* in */ + struct gpfs_file_handle *dir_fh;/* in */ + uint32_t dev; /* in dev or posix flags */ + int mode; /* in */ + int len; /* in */ + const char *name; /* in */ + struct gpfs_file_handle *new_fh;/* out */ + struct stat *buf; /* in/out */ + int attr_valid; /* in */ + int attr_changed; /* in */ + struct gpfs_acl *acl; /* in/out */ +}; + +struct stat_name_arg +{ + int mountdirfd; + int len; + const char *name; + struct gpfs_file_handle *handle; + struct stat *buf; +}; + +struct callback_arg +{ + int interface_version; + int mountdirfd; + int *reason; + struct gpfs_file_handle *handle; + struct glock *fl; + int *flags; + struct stat *buf; + struct pnfs_deviceid *dev_id; + uint32_t *expire_attr; +}; +#define GPFS_INTERFACE_VERSION 10000 +#define GPFS_INTERFACE_SUB_VER 1 + +/* Defines for the flags in callback_arg, keep up to date with CXIUP_xxx */ +#define UP_NLINK 0x00000001 /* update nlink */ +#define UP_MODE 0x00000002 /* update mode and ctime */ +#define UP_OWN 0x00000004 /* update mode,uid,gid and ctime */ +#define UP_SIZE 0x00000008 /* update fsize */ +#define UP_SIZE_BIG 0x00000010 /* update fsize if bigger */ +#define UP_TIMES 0x00000020 /* update all times */ +#define UP_ATIME 0x00000040 /* update atime only */ +#define UP_PERM 0x00000080 /* update fields needed for permission checking*/ +#define UP_RENAME 0x00000100 /* this is a rename op */ +#define UP_DESTROY_FLAG 0x00000200 /* clear destroyIfDelInode flag */ +#define UP_GANESHA 0x00000400 /* this is a ganesha op */ + +/* reason list for reason in callback_arg */ +#define INODE_INVALIDATE 1 +#define INODE_UPDATE 2 +#define INODE_LOCK_GRANTED 3 +#define INODE_LOCK_AGAIN 4 +#define THREAD_STOP 5 +#define THREAD_PAUSE 6 +#define BREAK_DELEGATION 7 +#define LAYOUT_FILE_RECALL 8 +#define LAYOUT_RECALL_ANY 9 +#define LAYOUT_NOTIFY_DEVICEID 10 + +/* define flags for attr_valid */ +#define XATTR_STAT (1 << 0) +#define XATTR_ACL (1 << 1) +#define XATTR_NO_CACHE (1 << 2) +#define XATTR_EXPIRE (1 << 3) +#define XATTR_FSID (1 << 4) + +/* define flags for attr_chaged */ +#define XATTR_MODE (1 << 0) // 01 +#define XATTR_UID (1 << 1) // 02 +#define XATTR_GID (1 << 2) // 04 +#define XATTR_SIZE (1 << 3) // 08 +#define XATTR_ATIME (1 << 4) // 10 +#define XATTR_MTIME (1 << 5) // 20 +#define XATTR_CTIME (1 << 6) // 40 +#define XATTR_ATIME_SET (1 << 7) // 80 +#define XATTR_MTIME_SET (1 << 8) // 100 +#define XATTR_ATIME_NOW (1 << 9) // 200 +#define XATTR_MTIME_NOW (1 << 10)// 400 +#define XATTR_SPACE_RESERVED (1 << 11)// 800 + +struct fsal_fsid { + uint64_t major; + uint64_t minor; +}; + +struct xstat_arg +{ + int attr_valid; + int mountdirfd; + struct gpfs_file_handle *handle; + struct gpfs_acl *acl; + int attr_changed; + struct stat *buf; + struct fsal_fsid *fsid; + uint32_t *expire_attr; +}; + +struct getxattr_arg { + int mountdirfd; + struct gpfs_file_handle *handle; + uint32_t name_len; + char *name; + uint32_t value_len; + void *value; +}; + +struct setxattr_arg { + int mountdirfd; + struct gpfs_file_handle *handle; + int type; + uint32_t name_len; + char *name; + uint32_t value_len; + void *value; +}; + +struct removexattr_arg { + int mountdirfd; + struct gpfs_file_handle *handle; + uint32_t name_len; + char *name; +}; + +struct listxattr_arg { + int mountdirfd; + struct gpfs_file_handle *handle; + uint64_t cookie; + uint64_t verifier; + uint32_t eof; + uint32_t name_len; + void *names; +}; + +struct fs_loc_arg { + int mountdirfd; + struct gpfs_file_handle *handle; + int fs_root_len; + char *fs_root; + int fs_path_len; + char *fs_path; + int fs_server_len; + char *fs_server; +}; + +struct xstat_access_arg +{ + int mountdirfd; + struct gpfs_file_handle *handle; + struct gpfs_acl *acl; + struct xstat_cred_t *cred; + unsigned int posix_mode; + unsigned int access; /* v4maske */ + unsigned int *supported; +}; + +struct quotactl_arg +{ + const char *pathname; + int cmd; + int qid; + void *bufferP; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* H_GPFS_NFS */ diff --git a/System/ior/files/gpfs/5.0.2-3/include/gpfs_watch.h b/System/ior/files/gpfs/5.0.2-3/include/gpfs_watch.h new file mode 100644 index 0000000..c850772 --- /dev/null +++ b/System/ior/files/gpfs/5.0.2-3/include/gpfs_watch.h @@ -0,0 +1,397 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* */ +/* */ +/* Licensed Materials - Property of IBM */ +/* */ +/* Restricted Materials of IBM */ +/* */ +/* (C) COPYRIGHT International Business Machines Corp. 2018 */ +/* All Rights Reserved */ +/* */ +/* US Government Users Restricted Rights - Use, duplication or */ +/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/* */ +/* Copyright (C) 2018 International Business Machines */ +/* All rights reserved. */ +/* */ +/* This file is part of the GPFS user library. */ +/* */ +/* 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. */ +/* */ +/* @(#)71 1.5.1.3 src/avs/fs/mmfs/ts/util/gpfs_watch.h, mmfs, avs_rtac502, rtac502s001a 10/1/18 14:10:41 */ +/* + * Library calls for GPFS WATCH FOLDER interfaces + */ +#ifndef _h_gpfs_watch +#define _h_gpfs_watch +/* inotify emulation for GPFS - using LWE/policy, Kafka, and so forth */ +#include +#include +#include + +/* gpfs_diag_watch flags. Log messages written to /var/adm/ras/mmwf.log */ +#define GPFS_WATCH_NODEBUG (0x0) //default +#define GPFS_WATCH_DEBUG (0x1) + +/* public API methods - mimicking the Linux inotify API */ + +/* :notyet: integration of our inotify fd with standard unix fd for poll()ing */ +# ifdef __cplusplus +extern "C" { +# endif +/* NAME: gpfs_init_watch + * + * FUNCTION: The gpfs_init_watch subroutine initializes a watch and returns a + * parent watch descriptor (pwd). The gpfs_init_watch subroutine + * checks if you have enabled watch folder. It also checks if you + * will exceed the maximum number of watches per file system (25). + * + * If you have not enabled watch folder functionality, gpfs_init_watch + * will fail. If you already have 100 watches on your cluster for all + * file systems combined, gpfs_init_watch will fail. + * + * Note: The parent watch descriptor and the child watch descriptors + * are not Linux file descriptors. For example, one cannot poll the + * descriptors. + * + * PARAMETERS: void + * + * RETURNS: The gpfs_init_watch subroutine returns the pwd on success or -1 on + * failure. + * + * Errno: Errno is set if -1 is returned. + * ENOKEY + * Watch folder is not enabled. Check with IBM Spectrum Scale™ + * support to enable it. + * EINTR + * Maximum number of watches were exceeded on this cluster. The + * maximum number of watches allowed per cluster is 100. + * Note: Further errnos might be reported depending on the inner + * instrumentation of the API. Use gpfs_watch_strerror to learn + * more about an error. + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + */ + int gpfs_init_watch(); /* returning an inotify fd */ + +/* NAME: gpfs_add_watch + * + * FUNCTION: The gpfs_add_watch subroutine watches files in the folder + * specified by pathname. The watch is non-recursive like + * Linux inotify. This means that the contents in subdirectories + * under the watched directory are not watched. The gpfs_add_watch + * subroutine registers your intention to watch said folder. In + * addition, it also verifies if the file system that you want to + * watch is owned by the local cluster. Currently, watches over + * file systems mounted on an accessing cluster are not supported. + * + * PARAMETERS: + * pwd + * The parent watch descriptor that is returned by gpfs_init_watch. + * You can set up multiple child watches (directory, fileset, or + * inode space) under the same parent watch as long as they are + * watching the same file system. + * pathname + * The path of the directory that is being watched. + * event_mask + * One or more of the events {IN_ACCESS,IN_ATTRIB,IN_CLOSE_NOWRITE, + * IN_CLOSE_WRITE,IN_CREATE,IN_DELETE, + * IN_DELETE_SELF,IN_MODIFY,IN_MOVED_FROM, + * IN_MOVE_SELF} + * + * RETURNS: The gpfs_add_watch subroutine returns the child watch descriptor (cwd) + * on success or -1 on failure. + * + * Errno: Errno is set if -1 is returned. + * EBADF + * Invalid pwd was passed. + * ENODEV + * The path is not a mounted IBM Spectrum Scale™ file system. + * EXDEV + * The path belongs to a different file system. + * ENOSYS + * This cluster is not the owning cluster for this file system. + * EINTR + * Exceeded the number of watches allowed for a file system (25). + * EDOM + * The file system level needs to be upgraded. Watch folder is + * not supported. + * EDESTADDRREQ + * The message queue for this cluster is not ready. Enable the + * message queue before starting a watch. + * ENODATA + * Message queue error. + * EHOSTUNREACH + * Could not find the node name. + * Note: Further errnos might be reported depending on the inner + * instrumentation of the API. Use gpfs_watch_strerror to learn + * more about an error. + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + */ + /* gpfs_add_watch restriction -- all watches added to a + given inotify fd must be for the same file system */ + int gpfs_add_watch(int fd, const char* pathname, int mask); /* returning an inotify wd */ + +/* NAME: gpfs_add_fset_watch + * + * FUNCTION: The gpfs_add_fset_watch subroutine watches all files and directories + * in the fileset specified by pathname. The watch is recursive in that + * subdirectories in the fileset and their contents are watched. You do + * not have to set up additional watches to watch the subdirectories. + * However, nested dependent or independent filesets under the fileset + * at pathname are not watched. + * + * PARAMETERS: + * pwd + * The parent watch descriptor that is returned by gpfs_init_watch. + * You can set up multiple child watches (directory, fileset, or + * inode space) under the same parent watch as long as they are + * watching the same file system. + * pathname + * The root of the fileset that is being watched. + * event_mask + * One or more of the events {IN_ACCESS,IN_ATTRIB,IN_CLOSE_NOWRITE, + * IN_CLOSE_WRITE,IN_CREATE,IN_DELETE, + * IN_DELETE_SELF,IN_MODIFY,IN_MOVED_FROM, + * IN_MOVE_SELF} + * + * RETURNS: The gpfs_add_fset_watch subroutine returns the child watch descriptor + * (cwd) on success or -1 on failure. + * The gpfs_add_fset_watch subroutine fails if pathname does not point + * to the root of a fileset. + * + * Errno: Errno is set if -1 is returned. + * EBADF + * Invalid pwd was passed. + * ENODEV + * The path is not a mounted IBM Spectrum Scale™ file system. + * EXDEV + * The pathname is not the root of a fileset. + * ENOSYS + * This cluster is not the owning cluster for this file system. + * EINTR + * Exceeded the number of watches allowed for a file system (25). + * EDOM + * The file system level needs to be upgraded. Watch folder is + * not supported. + * EDESTADDRREQ + * The message queue for this cluster is not ready. Enable the + * message queue before starting a watch. + * ENODATA + * Message queue error. + * EHOSTUNREACH + * Could not find the node name. + * Note: Further errnos might be reported depending on the inner + * instrumentation of the API. Use gpfs_watch_strerror to learn + * more about an error. + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + */ + int gpfs_add_fset_watch(int fd, const char* pathname, int mask); + +/* NAME: gpfs_add_inodespace_watch + * + * FUNCTION: The gpfs_add_inodespace_watch subroutine watches all files and + * directories in the inode space specified by pathname. This is a + * recursive watch, so subdirectories and their contents in the inode + * space are also watched. Nested dependent filesets are watched; + * however, nested independent filesets are not watched. + * + * PARAMETERS: + * pwd + * The parent watch descriptor that is returned by gpfs_init_watch. + * You can set up multiple child watches (directory, fileset, or + * inode space) under the same parent watch as long as they are + * watching the same file system. + * pathname + * The root of the fileset of the corresponding inode space that + * is being watched. The pathname is expected to point to the root + * of an independent fileset. + * event_mask + * One or more of the events {IN_ACCESS,IN_ATTRIB,IN_CLOSE_NOWRITE, + * IN_CLOSE_WRITE,IN_CREATE,IN_DELETE, + * IN_DELETE_SELF,IN_MODIFY,IN_MOVED_FROM, + * IN_MOVE_SELF} + * + * RETURNS: The gpfs_add_inodespace_watch subroutine returns the child watch + * descriptor (cwd) on success or -1 on failure. + * + * Errno: Errno is set if -1 is returned. + * EBADF + * Invalid pwd was passed. + * ENODEV + * The path is not a mounted IBM Spectrum Scale™ file system. + * EXDEV + * The pathname is not the root of an independent fileset. + * ENOSYS + * This cluster is not the owning cluster for this file system. + * EINTR + * Exceeded the number of watches allowed for a file system (25). + * EDOM + * The file system level needs to be upgraded. Watch folder is + * not supported. + * EDESTADDRREQ + * The message queue for this cluster is not ready. Enable the + * message queue before starting a watch. + * ENODATA + * Message queue error. + * EHOSTUNREACH + * Could not find the node name. + * Note: Further errnos might be reported depending on the inner + * instrumentation of the API. Use gpfs_watch_strerror to learn + * more about an error. + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + * + */ + int gpfs_add_inodespace_watch(int fd, const char* pathname, int mask); + +/* NAME: gpfs_read_watch + * + * FUNCTION: The gpfs_read_watch subroutine reads a file access event. + * The metadata for the event is populated in buf in the inotify_struct + * format: + * + * struct inotify_event { + * int cwd; // Child watch descriptor + * uint32_t mask; // Mask describing event + * uint32_t cookie; // Unique cookie associating related + * // events such as rename + * uint32_t len; // Size of file path + * char name[]; // Optional null-terminated file path + * }; + * + * The gpfs_read_watch subroutine tries to fill up buf with as + * many events as it can. + * + * PARAMETERS: + * pwd + * The parent watch descriptor that is returned by gpfs_init_watch. + * buf + * Pointer to a preallocated buffer. + * count + * Number of bytes in buf. + * + * RETURNS: The gpfs_read_watch subroutine returns -1 on failure. + * + * Errno: Errno is set if -1 is returned. + * Note: Further errnos might be reported depending on the inner + * instrumentation of the API. Use gpfs_watch_strerror to learn + * more about an error. + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + * + */ + + ssize_t gpfs_read_watch(int fd, void* buf, size_t count); /* read one or more inotify structs (layed end-to-end) */ + +/* NAME: gpfs_rm_watch + * + * FUNCTION: The gpfs_rm_watch subroutine stops the watch for the specified cwd. + * + * PARAMETERS: + * pwd + * The parent watch descriptor that is returned by gpfs_init_watch. + * cwd + * The child watch descriptor that is returned by gpfs_add_*_watch. + * + * RETURNS: The gpfs_rm_watch subroutine returns 0 on success or -1 on error. + * + * Errno: Errno is set if -1 is returned. + * Note: Further errnos might be reported depending on the inner + * instrumentation of the API. Use gpfs_watch_strerror to learn + * more about an error. + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + * + */ + int gpfs_rm_watch(int fd, int wd); /*removing the wd from the inotify fd */ + +/* NAME: gpfs_watch_strerror + * + * FUNCTION: The gpfs_watch_strerror subroutine provides some additional + * information for the last error encountered. + * + * PARAMETERS: + * pwd + * The parent watch descriptor that is returned by gpfs_init_watch. + * + * RETURNS: The gpfs_watch_strerror subroutine returns the character string with + * the error message or NULL if there is no descriptive error. + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + * + */ + const char* gpfs_watch_strerror(int fd); /* C-string describing last error */ + +/* NAME: gpfs_close_watch + * + * FUNCTION: The gpfs_close_watch subroutine destroys resources that are + * associated with a parent watch descriptor (pwd). + * + * PARAMETERS: + * pwd + * The parent watch descriptor that is returned by gpfs_init_watch. + * + * RETURNS: The gpfs_close_watch subroutine returns 0 on success or -1 on failure. + * + * Errno: Errno is set if -1 is returned. + * Note: Further errnos might be reported depending on the inner + * instrumentation of the API. Use gpfs_watch_strerror to learn + * more about an error. + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + * + */ + int gpfs_close_watch(int fd); /* destroying the inotify fd and all associated wds and any other resources */ + +/* NAME: gpfs_diag_watch + * + * FUNCTION: The gpfs_diag_watch subroutine provides some additional diagnostics + * + * RETURNS: + * + * EXAMPLES: For an example using gpfs_*_watch, + * see /usr/lpp/mmfs/samples/util/tswf.C. + */ + int gpfs_diag_watch(int fd, int dflags); /* set diagnostics */ + +# ifdef __cplusplus +} +# endif +#endif /* _h_gpfs_watch */ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libGpfsProvider.so b/System/ior/files/gpfs/5.0.2-3/lib/libGpfsProvider.so new file mode 100755 index 0000000..910a1a8 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libGpfsProvider.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libdmapi.so b/System/ior/files/gpfs/5.0.2-3/lib/libdmapi.so new file mode 100755 index 0000000..6ed092e Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libdmapi.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libextlum.so b/System/ior/files/gpfs/5.0.2-3/lib/libextlum.so new file mode 100755 index 0000000..ca77f97 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libextlum.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libgpfs.so b/System/ior/files/gpfs/5.0.2-3/lib/libgpfs.so new file mode 100755 index 0000000..ae61f57 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libgpfs.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libgpfs_crypto.so b/System/ior/files/gpfs/5.0.2-3/lib/libgpfs_crypto.so new file mode 100755 index 0000000..358a1b6 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libgpfs_crypto.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libgpfsextlum.so b/System/ior/files/gpfs/5.0.2-3/lib/libgpfsextlum.so new file mode 100755 index 0000000..ca77f97 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libgpfsextlum.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libgpfslum.so b/System/ior/files/gpfs/5.0.2-3/lib/libgpfslum.so new file mode 100755 index 0000000..409dd71 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libgpfslum.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libgpfswatch.so b/System/ior/files/gpfs/5.0.2-3/lib/libgpfswatch.so new file mode 100755 index 0000000..17ab724 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libgpfswatch.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/liblum.so b/System/ior/files/gpfs/5.0.2-3/lib/liblum.so new file mode 100755 index 0000000..409dd71 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/liblum.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libmmantras.so b/System/ior/files/gpfs/5.0.2-3/lib/libmmantras.so new file mode 100755 index 0000000..eb7daac Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libmmantras.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/libmmsdrcli.so b/System/ior/files/gpfs/5.0.2-3/lib/libmmsdrcli.so new file mode 100755 index 0000000..5164fe6 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/libmmsdrcli.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/tssbrback.so b/System/ior/files/gpfs/5.0.2-3/lib/tssbrback.so new file mode 100755 index 0000000..e30231e Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/tssbrback.so differ diff --git a/System/ior/files/gpfs/5.0.2-3/lib/tssbrrestore.so b/System/ior/files/gpfs/5.0.2-3/lib/tssbrrestore.so new file mode 100755 index 0000000..df40941 Binary files /dev/null and b/System/ior/files/gpfs/5.0.2-3/lib/tssbrrestore.so differ