From: David Howells Date: Fri, 10 Jul 2020 12:10:26 +0000 (+0100) Subject: xg: Add YFS Volume Server operations X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2af6fd406efd2358a7b249feca5620f91e870180;p=users%2Fdhowells%2Fkafs-utils.git xg: Add YFS Volume Server operations Signed-off-by: David Howells --- diff --git a/rpc-api/yfs_volser.xg b/rpc-api/yfs_volser.xg new file mode 100644 index 0000000..bedcf8c --- /dev/null +++ b/rpc-api/yfs_volser.xg @@ -0,0 +1,551 @@ +/* -*- c -*- + * + * Auristor/YFS volume server 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 YFSVOL_ + +/* Bits for flags for DumpV2 */ +const VOLDUMPV2_OMITDIRS = 1; + +struct volser_status64 { + YFSVolumeId volId; /* Volume id--unique over all systems */ + afs_int32 nextUnique; /* Next vnode uniquifier for this vol */ + afs_int32 type; /* readwrite, etc. */ + YFSVolumeId parentId; /* Id of parent, if type==readonly or + backup */ + YFSVolumeId cloneId; /* Latest read-only clone, if + type==readwrite */ + YFSVolumeId backupId; /* Latest backup copy of this read write + volume */ + YFSVolumeId restoredFromId; /* The id in a dump this volume was + restored from--used simply to make + sure that an incremental dump is not + restored on top of something + inappropriate: Note: this field + itself is NEVER dumped!!! */ + afs_uint64 maxQuota; /* Quota maximum, 1K blocks */ + afs_uint64 minQuota; /* Quota minimum, 1K blocks */ + afs_uint64 maxFiles; /* Maximum number of files */ + afs_int64 owner; /* The person responsible for this + volume */ + YFSAbsTime64 creationDate; /* Creation date for a read/write + volume; cloning date for original + copy of a readonly volume + (replicated volumes have the same + creation date) */ + YFSAbsTime64 accessDate; /* Last access time by a user, large + granularity */ + YFSAbsTime64 updateDate; /* Last modification by user */ + YFSAbsTime64 expirationDate; /* 0 if it never expires */ + YFSAbsTime64 backupDate; /* last time a backup clone was taken */ + YFSAbsTime64 copyDate; /* Time that this copy of this volume + was created */ +}; + +struct destServerU { + opr_uuid destHost; + endpoint destEndpoint; /* optional */ +}; + +const YVNAMESIZE = 512; +const VMSGSIZE = 128; +const YPNAMESIZE = 256; +const YDNAMESIZE = 256; + +const VOLINT_INFO64_IN_SERVICE = 0x01; +const VOLINT_INFO64_NEEDS_SALVAGE = 0x02; +const VOLINT_INFO64_DESTROY_ME = 0x04; +const VOLINT_INFO64_BLESSED = 0x08; +const VOLINT_INFO64_ONLINE = 0x10; + +struct volintInfo64 { + YFSVolumeId volId; /* volume's id */ + string name; + afs_int32 type; /* RWVOL, ROVOL, BACKVOL, ... */ + YFSVolumeId backupId; + YFSVolumeId parentId; + YFSVolumeId cloneId; + afs_uint32 status; /* 0 (NOT OK), VOK, VBUSY */ + afs_uint32 flags; /* inService, needsSalvage, destroyMe, blessed */ + string offlineMessage; + afs_int64 owner; + + YFSAbsTime64 creationDate; + YFSAbsTime64 accessDate; + YFSAbsTime64 updateDate; + YFSAbsTime64 expirationDate; + YFSAbsTime64 backupDate; + YFSAbsTime64 copyDate; + + afs_uint64 maxquota; + afs_uint64 minquota; + afs_uint64 maxfiles; + + afs_uint64 diskused; + afs_uint64 filecount; + afs_uint64 volUpdateCounter; + + YFSAbsTime64 dayUseDate; + afs_uint64 dayUse; + afs_uint64 weekUse[7]; +}; + +const SETINFO64_SET_OWNER = 0x001; +const SETINFO64_SET_CDATE = 0x002; +const SETINFO64_SET_UDATE = 0x004; +const SETINFO64_SET_MAXQUOTA = 0x008; +const SETINFO64_SET_MINQUOTA = 0x010; +const SETINFO64_SET_MAXFILES = 0x020; +const SETINFO64_SET_VUPCOUNTER = 0x040; +const SETINFO64_SET_DAYUSEDATE = 0x080; +const SETINFO64_SET_DAYUSE = 0x100; +const SETINFO64_SET_WEEKUSE = 0x200; + +struct volintSetInfo64 { + afs_uint32 mask; + + afs_int64 owner; + + YFSAbsTime64 creationDate; + YFSAbsTime64 updateDate; + + afs_uint64 maxquota; + afs_uint64 minquota; + afs_uint64 maxfiles; + + afs_uint64 volUpdateCounter; + + YFSAbsTime64 dayUseDate; + afs_uint64 dayUse; + afs_uint64 weekUse[7]; +}; + +/* + * Unclear what this limit should be, as the stats are opaque and + * versioned, and may become much larger eventually. + * Use a large value that should be sufficient for the foreseeable + * future. + * + * Set minStatsVersion and maxStatsVersion to the range of stats versions that + * are understood by the client. Set both to 0 if no stats are desired. + * + * data<> holds a volintStats_v1 object if vers == 1. + */ +const STATSMAX = 1048576; + +struct volintStats64 { + YFSVolumeId volId; + afs_int32 vers; + afs_int32 errorCode; + opaque data; +}; + +/* + * Define some values needed for the detailed volume info structure. + */ +const VOLINT_STATS_NUM_RWINFO_FIELDS = 4; + +const VOLINT_STATS_SAME_NET = 0; /*Within same site (total)*/ +const VOLINT_STATS_SAME_NET_AUTH = 1; /*Within same site (authenticated); + (must be 1 more than above)*/ +const VOLINT_STATS_DIFF_NET = 2; /*From external site (total)*/ +const VOLINT_STATS_DIFF_NET_AUTH = 3; /*From external site (authenticated) + (must be 1 more than above)*/ + +const VOLINT_STATS_NUM_TIME_RANGES = 6; + +const VOLINT_STATS_TIME_CAP_0 = 60; /*60 seconds*/ +const VOLINT_STATS_TIME_CAP_1 = 600; /*10 minutes, in seconds*/ +const VOLINT_STATS_TIME_CAP_2 = 3600; /*1 hour, in seconds*/ +const VOLINT_STATS_TIME_CAP_3 = 86400; /*1 day, in seconds*/ +const VOLINT_STATS_TIME_CAP_4 = 604800; /*1 week, in seconds*/ + +const VOLINT_STATS_NUM_TIME_FIELDS = 6; + +const VOLINT_STATS_TIME_IDX_0 = 0; /*0 secs to 60 secs*/ +const VOLINT_STATS_TIME_IDX_1 = 1; /*1 min to 10 mins*/ +const VOLINT_STATS_TIME_IDX_2 = 2; /*10 mins to 60 mins*/ +const VOLINT_STATS_TIME_IDX_3 = 3; /*1 hr to 24 hrs*/ +const VOLINT_STATS_TIME_IDX_4 = 4; /*1 day to 7 days*/ +const VOLINT_STATS_TIME_IDX_5 = 5; /*Greater than 1 week*/ + +/* + * Volume Statistics version 1 + * Equivalent to AFS3 xvolintInfo statistics. + */ +struct volintStats_v1 { + afs_int32 stat_reads[VOLINT_STATS_NUM_RWINFO_FIELDS]; + afs_int32 stat_writes[VOLINT_STATS_NUM_RWINFO_FIELDS]; + afs_int32 stat_fileSameAuthor[VOLINT_STATS_NUM_TIME_FIELDS]; + afs_int32 stat_fileDiffAuthor[VOLINT_STATS_NUM_TIME_FIELDS]; + afs_int32 stat_dirSameAuthor[VOLINT_STATS_NUM_TIME_FIELDS]; + afs_int32 stat_dirDiffAuthor[VOLINT_STATS_NUM_TIME_FIELDS]; +}; + +struct YFSTransactionCall { + endpoint endpoint; + afs_uint64 dataRead; + afs_uint64 dataSent; + YFSAbsTime64 lastSendTime; + YFSAbsTime64 lastReceiveTime; + afs_int32 type; /* 0 is client, 1 is server */ + afs_int32 error; +}; + +const VOLINT_MAXSERVERS = 1024; /* must be >= VLDB_MAXSERVERS */ +typedef YFSTransactionCall YFSTransactionCalls; + +const PROCNAMELEN = 30; +struct YFSTransactionState { + afs_int32 tid; + YFSAbsTime64 time; + YFSAbsTime64 creationTime; + afs_int32 returnCode; + YFSVolumeId volid; + YFSVolumeId parentid; + afs_int32 partition; + afs_uint32 iflags; + afs_uint32 vflags; + afs_uint32 tflags; + string lastProcName; + YFSTransactionCalls calls; +}; + +const TRANSSTATESMAX = 1000; +typedef YFSTransactionState YFSTransactionStates; + +struct diskPartition64v2 { + string name; /* Mounted partition name */ + string devName; + afs_uint32 locked; + afs_uint64 totalUsable; + afs_uint64 free; + afs_uint64 minFree; +}; + +struct restoreCookie64 { + string name; + afs_int32 type; + YFSVolumeId clone; + YFSVolumeId parent; +}; + +struct replicaU { + afs_uint64 trans; + struct destServerU server; +}; + +/* Various size parameters of the volume */ +typedef replicaU manyYDests; +typedef afs_int32 manyResults; + +const VOLINT_MAXVOLUMES = 10485760; +typedef volintInfo64 volEntries64; +typedef volintStats64 volStats64; +typedef YFSVolumeId YFSVolumeIds; + +const ACLMAX = 1024; +typedef opaque VolAcl; + +const MAX_VOL_SEC_LEVELS = 16; +const VOL_SEC_CLASS_RXNULL = 0x00; +const VOL_SEC_LEVEL_RXNULL_CLEAR = 0x00; + +const VOL_SEC_CLASS_RXKAD = 0x01; +const VOL_SEC_LEVEL_RXKAD_CLEAR = 0x00; +const VOL_SEC_LEVEL_RXKAD_AUTH = 0x01; +const VOL_SEC_LEVEL_RXKAD_CRYPT = 0x02; + +const VOL_SEC_CLASS_YFS_RXGK = 0x02; +const VOL_SEC_LEVEL_YFS_RXGK_CLEAR = 0x00; +const VOL_SEC_LEVEL_YFS_RXGK_AUTH = 0x01; +const VOL_SEC_LEVEL_YFS_RXGK_CRYPT = 0x02; + +struct vol_sec_level { + afs_uint32 sec_class; + afs_uint32 level; +}; +typedef struct vol_sec_level vol_sec_levels; + +const VOLINT_CAPABILITIESMAX = 196; +typedef afs_uint32 volserCapabilities; + +/* YFSVol_ capability flags */ +const YFSVOL_CAPABILITY_BUSY_ROVOL_ONLINE = 0x01; + +GetCapabilities ( + OUT volserCapabilities *volserCaps +) multi = 65552; + +/* YFS Only RPCS */ + +/* 65131 deprecated */ + +SetSecLevels( + IN afs_int32 tid, + IN vol_sec_levels *levels +) = 65132; + +GetSecLevels( + IN afs_int32 tid, + OUT vol_sec_levels *levels +) = 65133; + +/* + * 65134 deprecated + * 65135 deprecated + * 65136 deprecated + */ + +SplitVolume ( + IN afs_int32 tid, + IN afs_uint64 vnhi, + IN afs_uint64 vnlo, + IN afs_uint64 newvolid, + IN string name +) = 65137; + +SetMaxAcl( + IN afs_int32 tid, + IN VolAcl *VolMaxAcl +) = 65138; + +GetMaxAcl( + IN afs_int32 tid, + OUT VolAcl *VolMaxAcl +) = 65139; + +CreateVolume64( + IN afs_int32 partition, + IN string name, + IN afs_int32 type, + IN YFSVolumeId parent, + IN YFSVolumeId volid, + OUT afs_uint64 *trans +) = 65140; + +const YFSVOL_RESTORE_INCREMENTAL = 1; + +Restore64( + IN afs_uint64 toTrans, + IN afs_int32 flags, + IN struct restoreCookie64 *cookie +) split = 65141; + +Forward64( + IN afs_uint64 fromTrans, + IN YFSAbsTime64 fromDate, + IN struct destServerU *destination, + IN afs_uint64 destTrans, + IN struct restoreCookie64 *cookie +) = 65142; + +Clone64( + IN afs_uint64 trans, + IN YFSVolumeId purgeVol, + IN afs_int32 newType, + IN string newName, + IN YFSVolumeId newId +) = 65143; + +TransCreate64( + IN YFSVolumeId volume, + IN afs_int32 partition, + IN afs_uint32 flags, + OUT afs_uint64 *trans +) = 65144; + +SetForwardingU( + IN afs_uint64 tid, + IN opr_uuid newsite +) = 65145; + +GetStatus64( + IN afs_uint64 tid, + OUT struct volser_status64 *status +) = 65146; + +FetchVolumeInfo64( + IN afs_int32 partId, + IN YFSVolumeId volId, + IN afs_uint32 minStatsVersion, + IN afs_uint32 maxStatsVersion, + OUT volintInfo64 *resultEntry, + OUT volintStats64 *resultStats +) = 65147; + +ListVolumeIds64( + IN afs_int32 partId, + OUT YFSVolumeIds *resultEntries +) = 65148; + +FetchVolumesInfo64( + IN afs_int32 partId, + IN afs_uint32 minStatsVersion, + IN afs_uint32 maxStatsVersion, + OUT volEntries64 *resultEntries, + OUT volStats64 *resultStats +) = 65149; + +SetIdsTypes64( + IN afs_uint64 tid, + IN string name, + IN afs_int32 type, + IN YFSVolumeId parentId, + IN YFSVolumeId cloneId, + IN YFSVolumeId backupId +) = 65150; + +ReClone64( + IN afs_uint64 tid, + IN YFSVolumeId cloneId +) = 65151; + +NukeVolume64( + IN afs_int32 partId, + IN YFSVolumeId volId +) = 65152; + +SetDate64( + IN afs_uint64 tid, + IN YFSAbsTime64 newDate +) = 65153; + +SetInfo64( + IN afs_uint64 tid, + IN struct volintSetInfo64 *info +) = 65154; + +ForwardMultiple64( + IN afs_uint64 fromTrans, + IN YFSAbsTime64 fromDate, + IN manyYDests *destinations, + IN struct restoreCookie64 *cookie, + OUT manyResults *results +) = 65155; + +ConvertROtoRWvolume64( + IN afs_int32 partId, + IN YFSVolumeId volId +) = 65156; + +GetSize64( + IN afs_uint64 fromTrans, + IN YFSAbsTime64 fromDate, + OUT struct volintSize *size +) = 65157; + +Dump64( + IN afs_uint64 fromTrans, + IN YFSAbsTime64 fromDate, + IN afs_uint32 flags +) split = 65158; + +PartitionInfo64v2( + IN string name, + OUT struct diskPartition64v2 *partition +) = 65159; + +EndTrans64( + IN afs_uint64 trans, + OUT afs_int32 *rcode +) = 65160; + +/* This is a YFS version of Monitor */ +GetTransactionState( + IN YFSVolumeId parentid, + OUT YFSTransactionStates *result +) = 65161; + +SetSecLevels64( + IN afs_uint64 tid, + IN vol_sec_levels *levels +) = 65162; + +GetSecLevels64( + IN afs_uint64 tid, + OUT vol_sec_levels *levels +) = 65163; + +SplitVolume64( + IN afs_uint64 tid, + IN YFSVnode vn, + IN YFSVolumeId newVolId, + IN string name +) = 65164; + +DeleteVolume64( + IN afs_uint64 tid +) = 65165; + +SetMaxAcl64( + IN afs_uint64 tid, + IN AFSOpaque *AclXdr +) = 65166; + +GetMaxAcl64( + IN afs_uint64 tid, + OUT AFSOpaque *AclXdr +) = 65167; + +RemoveMaxAcl64( + IN afs_uint64 tid +) = 65168; + +SetRootAcl64( + IN afs_uint64 tid, + IN AFSOpaque *AclXdr +) = 65169; + +GetRootAcl64( + IN afs_uint64 tid, + OUT AFSOpaque *AclXdr +) = 65170; + +TransClone64( + IN afs_uint64 trans, + IN YFSVolumeId purgeVol, + IN afs_int32 newType, + IN string newName, + IN YFSVolumeId newId, + OUT afs_uint64 *newTrans +) = 65171; + +TransReClone64( + IN afs_uint64 tid, + IN YFSVolumeId cloneId, + OUT afs_uint64 *newTrans +) = 65172; + +SetFlags64( + IN afs_uint64 trans, + IN afs_uint32 flags +) = 65173; + +GetFlags64( + IN afs_uint64 trans, + OUT afs_uint32 *flags +) = 65174; + +GetName64( + IN afs_uint64 tid, + OUT string tname +) = 65175; + +TransFetchVolumeInfo64( + IN afs_uint64 tid, + IN afs_uint32 minStatsVersion, + IN afs_uint32 maxStatsVersion, + OUT volintInfo64 *resultEntry, + OUT volintStats64 *resultStats +) = 65176;