From 9a6f187974a453e863c37f20c1d366812e06670f Mon Sep 17 00:00:00 2001 From: David Howells Date: Mon, 29 Jun 2020 09:57:54 +0100 Subject: [PATCH] xg: Add YFS VL server operations Signed-off-by: David Howells --- rpc-api/yfs.xg | 9 +- rpc-api/yfs_common.h | 26 ++++++ rpc-api/yfs_vldb.xg | 217 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 244 insertions(+), 8 deletions(-) create mode 100644 rpc-api/yfs_common.h create mode 100644 rpc-api/yfs_vldb.xg diff --git a/rpc-api/yfs.xg b/rpc-api/yfs.xg index e10cf1b..d37f9d0 100644 --- a/rpc-api/yfs.xg +++ b/rpc-api/yfs.xg @@ -30,7 +30,6 @@ typedef uint64_t YFSSize; /* in bytes */ typedef uint64_t YFSVolSize; /* in KiB */ typedef int64_t YFSUserId; typedef uint64_t YFSIndex; -typedef uint64_t YFSVolumeId; typedef struct opr_time YFSRelTime64; typedef struct opr_time YFSAbsTime64; @@ -354,16 +353,10 @@ UpdateSymlink( /* 64163 was older revision of RemoveACL */ -#define ENDPOINT_IPV4 0 -#define ENDPOINT_IPV6 1 -struct endpoint { - uint32_t Type; - opaque Data; -}; -typedef endpoint eplist; /* 64164 was an older revision of WhoAmI */ +typedef endpoint eplist; FlushCPS( IN RPCFlags Flags, IN YFSViceIds *IdsArray, diff --git a/rpc-api/yfs_common.h b/rpc-api/yfs_common.h new file mode 100644 index 0000000..6ae4eeb --- /dev/null +++ b/rpc-api/yfs_common.h @@ -0,0 +1,26 @@ +/* -*- 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. + */ + +typedef uint32_t afs_uint32; +typedef int32_t afs_int32; +typedef uint64_t afs_uint64; +typedef int64_t afs_int64; +typedef afs_uint64 YFSVolumeId; + +const ENDPOINT_IPV4 = 0; +const ENDPOINT_IPV6 = 1; +struct endpoint { + uint32_t Type; + opaque Data; /* Address and port */ +}; diff --git a/rpc-api/yfs_vldb.xg b/rpc-api/yfs_vldb.xg new file mode 100644 index 0000000..ff80240 --- /dev/null +++ b/rpc-api/yfs_vldb.xg @@ -0,0 +1,217 @@ +/* -*- c -*- + * + * Auristor/YFS Volume Location 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 YFSVL_ + +const YFSVL_SERVICEID = 2503; +const YVL_MAXNAMELEN = 512; +const YVL_MAXNSERVERS = 128; + +/* + * VL_MINVOLUMEID represents the lowest volume id that can be issued + * by the Location Service. All volume ids smaller than the + * VL_MINVOLUMEID are reserved for allocation and internal use by + * individual volservers. + */ +const VL_MINVOLUMEID = 0x100002; + + +/* + * When vldbentry_location.partition is VLPART_UUID the uuid field is a + * partition uuid instead of a fileserver uuid. + */ +const VLPART_UUID = 0xFFFFFFFF; + +struct vldbentry64_location { + afsUUID uuid; + afs_uint32 unique; + afs_uint32 partition; + afs_uint32 flags; +}; +typedef vldbentry64_location vldbentry64_locations; + +struct vldbentry64 { + string name; + vldbentry64_locations locations; + YFSVolumeId volumeId[MAXTYPES]; + YFSVolumeId cloneId; + afs_uint32 flags; + afs_uint32 matchType; + afs_uint32 matchLocation; +}; + +const NMAXBULKENTRIES64 = 10000000; +typedef vldbentry64 bulkentries64; + +const MAXENDPOINTS = 16; +typedef endpoint endpoints; + +/* Security flags */ +const VLF_SEC_RXNULL = 0x010000; +const VLF_SEC_RXKAD_CLEAR = 0x020000; +const VLF_SEC_RXKAD_AUTH = 0x040000; +const VLF_SEC_RXKAD_CRYPT = 0x080000; +const VLF_SEC_YFS_RXGK_CLEAR = 0x100000; +const VLF_SEC_YFS_RXGK_AUTH = 0x200000; +const VLF_SEC_YFS_RXGK_CRYPT = 0x400000; + +const VLF_SEC_MASK = 0x0fff0000; + +/* RegisterAddrs flags */ +const VLREGADDR_CLASS_RXNULL = 0x01; +const VLREGADDR_CLASS_RXKAD = 0x02; +const VLREGADDR_CLASS_YFS_RXGK = 0x03; + +const VLREGADDR_LEVEL_RXNULL_CLEAR = 0x00; + +const VLREGADDR_LEVEL_RXKAD_CLEAR = 0x01; +const VLREGADDR_LEVEL_RXKAD_AUTH = 0x02; +const VLREGADDR_LEVEL_RXKAD_CRYPT = 0x03; + +const VLREGADDR_LEVEL_YFS_RXGK_CLEAR = 0x01; +const VLREGADDR_LEVEL_YFS_RXGK_AUTH = 0x02; +const VLREGADDR_LEVEL_YFS_RXGK_CRYPT = 0x03; + +const MAX_SEC_LEVELS = 16; +struct sec_level { + afs_uint32 sec_class; + afs_uint32 level; +}; +typedef struct sec_level sec_levels; + + +RegisterAddrs( + IN afsUUID *uuidp, + IN sec_levels *levels, + IN endpoints *addrs +) = 64001; + +const YFS_SERVER_INDEX = 0; +const YFS_SERVER_UUID = 1; +const YFS_SERVER_ENDPOINT = 2; + +union yfsServerAttributes switch (afs_int32 type) { + case YFS_SERVER_INDEX: + afs_int32 index; + case YFS_SERVER_UUID: + opr_uuid uuid; + case YFS_SERVER_ENDPOINT: + endpoint endpoint; +}; + +altonly GetEndpoints( + IN yfsServerAttributes *attr, + OUT opr_uuid *uuid, + OUT afs_int32 *uniquifier, + OUT endpoints *fsEndpoints, + OUT endpoints *volEndpoints +) = 64002; + +CreateEntryU( + IN uvldbentry *newentry +) = 64003; + +ReplaceEntryU( + IN afs_uint32 Volid, + IN afs_int32 voltype, + IN uvldbentry *newentry, + IN afs_int32 ReleaseType +) = 64004; + +ListAttributesU2( + IN VldbListByAttributes *attributes, + IN string volumename, + IN afs_int32 startindex, + OUT afs_int32 *nentries, + OUT ubulkentries *blkentries, + OUT afs_int32 *nextstartindex +) = 64005; + +CreateEntry64( + IN vldbentry64 *newentry +) = 64006; + +ReplaceEntry64( + IN YFSVolumeId volId, + IN afs_int32 voltype, + IN vldbentry64 *newentry, + IN afs_int32 ReleaseType +) = 64007; + +DeleteEntry64( + IN YFSVolumeId volId, + IN afs_int32 voltype +) = 64008; + +GetNewVolumeId64( + IN afs_uint64 bumpcount, + OUT YFSVolumeId *newvolId +) = 64009; + +SetLock64( + IN YFSVolumeId volId, + IN afs_int32 voltype, + IN afs_int32 voloper +) = 64010; + +ReleaseLock64( + IN YFSVolumeId volId, + IN afs_int32 voltype, + IN afs_int32 ReleaseType +) = 64011; + +/* + * If bit one is unset, return FS UUIDs in vldbentry64_location.uuid + */ +const VLGET_FS_UUID = 0x0; +const VLGET_PART_UUID = 0x1; + +GetEntryByName64( + IN string volumename, + IN afs_uint32 flags, /* VLGET flags */ + OUT vldbentry64 *entry +) = 64012; + +GetEntryByID64( + IN YFSVolumeId volId, + IN afs_int32 voltype, + IN afs_uint32 flags, /* VLGET flags */ + OUT vldbentry64 *entry +) = 64013; + +const YVL_MAXCELLNAME = 256; + +GetCellName( + OUT string cellName +) = 64014; + +altonly GetFSSecLevels( + IN afsUUID *fs_uuid, + OUT sec_levels *fs_sec_levels +) = 64015; + +altonly RemoveFS( + IN afsUUID *fs_uuid +) = 64816; + +altonly RegisterEndpoints( + IN afsUUID *uuidp, + IN sec_levels *levels, + IN endpoints *addrs, + OUT string cellName +) = 64817; + +EchoEndpoint( + OUT endpoint ep +) multi = 64818; -- 2.49.0