From c6b6c3bd1d329709f5a49aeaf9fe635ed9cb4203 Mon Sep 17 00:00:00 2001 From: David Howells Date: Mon, 7 Oct 2019 17:01:57 +0100 Subject: [PATCH] xg: Add AuriStor/YFS definitions Add definitions for AuriStor/YFS protocol extensions. --- rpc-api/yfs.xg | 507 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 507 insertions(+) create mode 100644 rpc-api/yfs.xg diff --git a/rpc-api/yfs.xg b/rpc-api/yfs.xg new file mode 100644 index 0000000..7e7b954 --- /dev/null +++ b/rpc-api/yfs.xg @@ -0,0 +1,507 @@ +/* -*- c -*- + * + * Auristor/YFS fileserver and cache manager opcodes. Please do not add or + * modify opcodes here without consulting Auristor, Inc.. + * + * Copyright (c) 2015-2020 AuriStor, Inc. + * 255 W 94th St, New York NY 10025-6985 United States, Earth, Sol, Milky Way + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence + * as published by the Free Software Foundation; either version + * 2 of the Licence, or (at your option) any later version. + */ + +package RXYFS_ + +RXYFS SERVICE ID = 2500 +RXAFSCB SERVICE ID = 2501 + +const LockNone = -1; +const LockRead = 0; +const LockWrite = 1; +const LockExtend = 2; +const LockRelease = 3; +const LockMandatoryRead = 0x100; +const LockMandatoryWrite = 0x101; +const LockMandatoryExtend = 0x102; +const Mask_LockMandatory = 0x100; + +struct opr_time { + afs_int64 time; /* UNIX time in 100ns steps */ +}; + +typedef afs_uint64 YFSSize; /* in bytes */ +typedef afs_uint64 YFSVolSize; /* in KiB */ +typedef afs_int64 YFSUserId; +typedef afs_uint64 YFSIndex; +typedef afs_uint64 YFSVolumeId; +typedef struct opr_time YFSRelTime64; +typedef struct opr_time YFSAbsTime64; + + +struct YFSVnode { + afs_uint64 lo; + afs_uint32 hi; + afs_uint32 uniq; +}; + +struct YFSFid { + YFSVolumeId Volume; + YFSVnode Vnode; +}; + +struct YFSCallBack { + afs_uint32 CallBackVersion; + YFSRelTime64 ExpirationTime; + afs_uint32 CallBackType; +}; + +const YFSCBMAX = 1024; +typedef YFSFid YFSCBFids; +typedef YFSCallBack YFSCBs; + +struct YFSFetchStatus { + afs_uint32 FileType; /* AFSFileType */ + afs_uint32 LinkCount; + YFSSize Length; /* all YFSSize's are in bytes */ + afs_uint64 DataVersion; + YFSUserId Author; + YFSUserId Owner; + YFSUserId Group; + afs_uint32 UnixModeBits; + afs_uint32 CallerAccess; + afs_uint32 AnonymousAccess; + YFSVnode ParentVnode; + afs_uint32 DataAccessProtocol; + YFSAbsTime64 ClientModTime; + YFSAbsTime64 ServerModTime; + afs_uint32 lockCount; + afs_uint32 errorCode; +}; + +struct YFSStoreStatus { + afs_uint32 Mask; + afs_uint32 UnixModeBits; + YFSAbsTime64 ClientModTime; + YFSUserId Owner; + YFSUserId Group; +}; + +struct YFSVolSync { + YFSAbsTime64 volCreationDate; + YFSAbsTime64 volUpdateDate; + YFSVolSize MaxQuota; /* all AFSVolSize's are in KiB */ + YFSVolSize BlocksInUse; + YFSVolSize BlocksAvail; /* min of quota or partition left */ +}; + +const FVSOnline = 0x1; +const FVSInservice = 0x2; +const FVSBlessed = 0x4; +const FVSNeedsSalvage = 0x8; + +const AFSVolumeType_ReadOnly = 0; +const AFSVolumeType_ReadWrite = 1; + +struct YFSFetchVolumeStatus { + YFSVolumeId Vid; + YFSVolumeId ParentId; + afs_uint32 flags; /* includes Online, Inservice, Blessed, NeedsSalvage */ + afs_int32 Type; /* AFSVolumeType */ + YFSVolSize MaxQuota; /* all AFSVolSize's are in KiB */ + YFSVolSize BlocksInUse; + YFSVolSize PartBlocksAvail; + YFSVolSize PartMaxBlocks; + YFSAbsTime64 volCopyDate; + YFSAbsTime64 volBackupDate; +}; + +struct YFSStoreVolumeStatus { + afs_int32 Mask; + YFSVolSize MinQuota; + YFSVolSize MaxQuota; + YFSVolSize FileQuota; +}; + +typedef YFSFetchStatus YFSBulkStats; + +const FLUSHMAX = 10; + +typedef afs_int64 YFSViceIds; + +const AUTHDATAMAX = 1024; +const AUTHPRINTABLEMAX = 1024; +struct FS_AuthName { + afs_int32 kind; + opaque data; + opaque display; +}; + +const FS_MAXNAMES = 4; +typedef struct FS_AuthName FS_AuthNames; + +RXYFS_GiveUpAllCallBacks( +) multi = 65539; + +RXYFS_GetCapabilities( + OUT Capabilities *capabilities +) multi = 65540; + +typedef afs_uint32 RPCFlags; +/* RPC Flags */ +const RPC_FLAG_NOCALLBACK = 0x0001; + +const LockNone = -1; +const LockRead = 0; +const LockWrite = 1; +const LockMandatoryRead = 0x100; +const LockMandatoryWrite = 0x101; +const Mask_LockMandatory = 0x100; + + +RXYFS_StoreData64( + IN RPCFlags Flags, + IN YFSFid *Fid, + IN YFSStoreStatus *InStatus, + IN YFSSize Pos, + IN YFSSize Length, + IN YFSSize FileLength, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync + ) split = 64538; + +/* This uses the same text format in the opaques as RXAFS_FetchACL */ +RXYFS_FetchACL( + IN RPCFlags Flags, + IN YFSFid *Fid, + OUT AFSOpaque *AccessList, + OUT AFSOpaque *VolAccessList, + OUT afs_int32 *InheritFlag, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64131; + +RXYFS_FetchStatus( + IN RPCFlags Flags, + IN YFSFid *Fid, + OUT YFSFetchStatus *OutStatus, + OUT YFSCallBack *CallBack, + OUT YFSVolSync *Sync +) = 64132; + +/* This uses the same text format in the opaque as RXAFS_StoreACL */ +RXYFS_StoreACL( + IN RPCFlags Flags, + IN YFSFid *Fid, + IN AFSOpaque *AccessList, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64134; + +RXYFS_StoreStatus( + IN RPCFlags Flags, + IN YFSFid *Fid, + IN YFSStoreStatus *InStatus, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64135; + +RXYFS_RemoveFile( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64136; + +RXYFS_CreateFile( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + IN YFSStoreStatus *InStatus, + IN ViceLockType Type, + OUT YFSFid *OutFid, + OUT YFSFetchStatus *OutFidStatus, + OUT YFSFetchStatus *OutDirStatus, + OUT YFSCallBack *CallBack, + OUT YFSVolSync *Sync +) = 64137; + +RXYFS_Rename( + IN RPCFlags Flags, + IN YFSFid *OldDirFid, + IN string OldName, + IN YFSFid *NewDirFid, + IN string NewName, + OUT YFSFetchStatus *OutOldDirStatus, + OUT YFSFetchStatus *OutNewDirStatus, + OUT YFSVolSync *Sync +) = 64138; + +RXYFS_Symlink( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + IN string LinkContents, + IN YFSStoreStatus *InStatus, + OUT YFSFid *OutFid, + OUT YFSFetchStatus *OutFidStatus, + OUT YFSFetchStatus *OutDirStatus, + OUT YFSVolSync *Sync +) = 64139; + +RXYFS_Link( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + IN YFSFid *ExistingFid, + OUT YFSFetchStatus *OutFidStatus, + OUT YFSFetchStatus *OutDirStatus, + OUT YFSVolSync *Sync +) = 64140; + +RXYFS_MakeDir( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + IN YFSStoreStatus *InStatus, + OUT YFSFid *OutFid, + OUT YFSFetchStatus *OutFidStatus, + OUT YFSFetchStatus *OutDirStatus, + OUT YFSCallBack *CallBack, + OUT YFSVolSync *Sync +) = 64141; + +RXYFS_RemoveDir( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + OUT YFSFetchStatus *OutDirStatus, + OUT YFSVolSync *Sync +) = 64142; + +RXYFS_GiveUpCallBacks( + IN RPCFlags Flags, + IN YFSCBFids *Fids_Array, + IN YFSCBs *CallBacks_Array +) = 64147; + +RXYFS_GetVolumeStatus( + IN RPCFlags Flags, + IN YFSVolumeId Volumeid, + OUT YFSFetchVolumeStatus *Volumestatus, + OUT string Name, + OUT string OfflineMsg, + OUT string Motd +) = 64149; + +RXYFS_SetVolumeStatus( + IN RPCFlags Flags, + IN YFSVolumeId Volumeid, + IN YFSStoreVolumeStatus *Volumestatus, + IN string Name, + IN string OfflineMsg, + IN string Motd +) = 64150; + +RXYFS_SetLock( + IN RPCFlags Flags, + IN YFSFid *Fid, + IN ViceLockType Type, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64156; + +RXYFS_ExtendLock( + IN RPCFlags Flags, + IN YFSFid *Fid, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64157; + +RXYFS_ReleaseLock( + IN RPCFlags Flags, + IN YFSFid *Fid, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64158; + +RXYFS_Lookup( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + OUT YFSFid *OutFid, + OUT YFSFetchStatus *OutFidStatus, + OUT YFSFetchStatus *OutDirStatus, + OUT YFSCallBack *CallBack, + OUT YFSVolSync *Sync +) = 64161; + +RXYFS_InlineBulkStatus( + IN RPCFlags Flags, + IN YFSCBFids *FidsArray, + OUT YFSBulkStats *StatArray, + OUT YFSCBs *CBArray, + OUT YFSVolSync *Sync +) = 64536; + +RXYFS_FetchData64( + IN RPCFlags Flags, + IN YFSFid *Fid, + IN YFSSize Pos, + IN YFSSize Length, + OUT YFSFetchStatus *OutStatus, + OUT YFSCallBack *CallBack, + OUT YFSVolSync *Sync +) split = 64537; + +/* 64539 was the older UpdateSymlink */ + +RXYFS_UpdateSymlink( + IN RPCFlags Flags, + IN YFSFid *SymlinkFid, + IN string LinkContents, + IN YFSStoreStatus *InStatus, + OUT YFSFetchStatus *OutFidStatus, + OUT YFSVolSync *Sync +) = 64540; + +/* 64163 was older revision of RemoveACL */ + +typedef endpoint eplist; + +/* 64164 was an older revision of WhoAmI */ + +RXYFS_FlushCPS( + IN RPCFlags Flags, + IN YFSViceIds *IdsArray, + IN eplist *endpoints +) multi = 64165; + +/* These are identical but expect the new acls in xdr format in the opaques */ + +/* + * Define the maximum opaque structure to be passed. + */ +const YFSOPAQUEACLMAX = 0x7FFF; +typedef opaque YFSOpaqueACL ; + +/* Was code 64166 with ids in the xdr */ +RXYFS_FetchOpaqueACL( + IN RPCFlags Flags, + IN YFSFid *Fid, + OUT YFSOpaqueACL *AclXdr, + OUT YFSOpaqueACL *VolAclXdr, + OUT afs_int32 *InheritFlag, + OUT afs_int32 *NumCleaned, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64168; + +/* Was code 64167 with ids in the xdr */ +/* DEPRECATED -- replaced with StoreOpaqueACL2 -- CVE-2018-7168 */ +/* RXYFS_StoreOpaqueACL 64169; */ + +RXYFS_WhoAmI ( + IN RPCFlags Flags, + OUT FS_AuthNames *names +) = 64170; + +RXYFS_RemoveACL( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64171; + +/* Was code 64172 without FileFid */ +RXYFS_RemoveFile2( + IN RPCFlags Flags, + IN YFSFid *DirFid, + IN string Name, + OUT YFSFetchStatus *DirStatus, + OUT YFSFid *FileFid, + OUT YFSFetchStatus *FileStatus, /* If deleted, errorCode = VNOVNODE */ + OUT YFSVolSync *Sync +) = 64173; + +/* Was code 64167 with ids in the xdr */ +/* Was code 64169, replaced due to security issue CVE: 2018-7168 */ +RXYFS_StoreOpaqueACL2( + IN RPCFlags Flags, + IN YFSFid *Fid, + IN YFSOpaqueACL *AclXdr, + OUT YFSFetchStatus *OutStatus, + OUT YFSVolSync *Sync +) = 64174; + + +RXYFSCB_Probe( +) multi = 206; + +RXYFSCB_GetLock( + IN afs_int32 index, + OUT AFSDBLock *lock +) = 207; + +RXYFSCB_XStatsVersion( + OUT afs_int32 *versionNumberP +) = 209; + +RXYFSCB_GetXStats( + IN afs_int32 clientVersionNumber, + IN afs_int32 collectionNumber, + OUT afs_int32 *srvVersionNumberP, + OUT afs_int32 *timeP, + OUT AFSCB_CollData *dataP +) = 210; + +RXYFSCB_InitCallBackState3( + IN afsUUID *serverUuid +) = 213; + +RXYFSCB_ProbeUuid( + IN afsUUID *clientUuid +) multi = 214; + +RXYFSCB_GetServerPrefs( + IN afs_int32 serverIndex, + OUT afs_int32 *srvrAddr, + OUT afs_int32 *srvrRank +) = 215; + +RXYFSCB_GetCellServDB( + IN afs_int32 cellIndex, + OUT string cellName, + OUT serverList *cellHosts +) = 216; + +RXYFSCB_GetLocalCell( + OUT string cellName +) = 217; + +RXYFSCB_GetCacheConfig( + IN afs_uint32 callerVersion, + OUT afs_uint32 *serverVersion, + OUT afs_uint32 *configCount, + OUT cacheConfig *config +) = 218; + +RXYFSCB_GetCellByNum( + IN afs_int32 cellNumber, + OUT string cellName, + OUT serverList *cellHosts +) = 65537; + +RXYFSCB_TellMeAboutYourself( + OUT interfaceAddr *addr, + OUT Capabilities *capabilities +) = 65538; + +/* GetDE 65539 is no longer supported */ + +RXYFSCB_CallBack( + IN YFSCBFids *Fids_Array +) multi = 64204; -- 2.50.1