From: David Howells Date: Wed, 25 Sep 2019 15:31:08 +0000 (+0100) Subject: Import the Arla XG files X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e44071115972d01a9dc0d39a68c92405b51ee52e;p=users%2Fdhowells%2Fkafs-utils.git Import the Arla XG files Import the Arla XG files. These are RxRPC RPC API definitions for rxgen to turn into compilables. They are licensed under the 3-clause BSD licence from Royal Institute of Technology, Stockholm, Sweden, which is GPL-compatible. Signed-off-by: David Howells --- diff --git a/rpc-api/afsuuid.h b/rpc-api/afsuuid.h new file mode 100644 index 0000000..8344b7f --- /dev/null +++ b/rpc-api/afsuuid.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + +%#ifndef _AFSUUID_COMMON_ +%#define _AFSUUID_COMMON_ + +/* $Id: afsuuid.h,v 1.2 2004/08/27 11:14:44 lha Exp $ */ + +#ifndef AFSUUID_GENERATE +#define AFSUUID_GENERATE __attribute__((__nogenerate__)) +#endif + +struct afsUUID { + u_long time_low; + u_short time_mid; + u_short time_hi_and_version; + char clock_seq_hi_and_reserved; + char clock_seq_low; + char node[6]; +} AFSUUID_GENERATE; + +%#endif /* _AFSUUID_COMMON_ */ diff --git a/rpc-api/bos.xg b/rpc-api/bos.xg new file mode 100644 index 0000000..d2ee7c6 --- /dev/null +++ b/rpc-api/bos.xg @@ -0,0 +1,267 @@ +/* This is -*-c-*- */ + +/* + * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + +/* $Id: bos.xg,v 1.9 2004/08/27 11:14:44 lha Exp $ */ + +/* + * Interface to BOS server + */ + +package BOZO_ + +%#include + +error-function conv_to_arla_errno + +const BZNOTACTIVE = 39424; +const BZNOENT = 39425; +const BZBUSY = 39426; +const BZEXISTS = 39427; +const BZNOCREATE = 39428; +const BZDOM = 39429; +const BZACCESS = 39430; +const BZSYNTAX = 39431; +const BZIO = 39432; +const BZNET = 39433; +const BZBADTYPE = 39434; + +const BOZO_BSSIZE = 256; + +/* + * + */ + +const BSTAT_SHUTDOWN = 0; +const BSTAT_NORMAL = 1; +const BSTAT_SHUTTINGDOWN = 2; +const BSTAT_STARTINGUP = 3; + +const BOZO_PRUNEOLD = 1; +const BOZO_PRUNEBAK = 2; +const BOZO_PRUNECORE = 4; + +const BPROC_STARTED = 1; +const BPROC_EXITED = 2; + +const BOZO_HASCORE = 1; +const BOZO_ERRORSTOP = 2; +const BOZO_BADDIRACCESS = 4; + +const BNODE_NEEDTIMEOUT = 0x01; +const BNODE_ACTIVE = 0x02; +const BNODE_WAIT = 0x04; +const BNODE_DELETE = 0x08; +const BNODE_ERRORSTOP = 0x10; + +const KTIME_HOUR = 0x01; +const KTIME_MIN = 0x02; +const KTIME_SEC = 0x04; /* XXX check me */ +const KTIME_DAY = 0x08; +const KTIME_TIME = 0x07; +const KTIME_NEVER = 0x10; +const KTIME_NOW = 0x20; + +/* GetRestartTime */ + +const BOZO_RESTARTTIME_GENERAL = 0x1; /* general reboot time */ +const BOZO_RESTARTTIME_NEWBIN = 0x2; /* new binary */ + +#if 0 +const GETSTATUS_FSRUN = "file server running"; +const GETSTATUS_RSRUNVOLDOWN = "file server running; volser down"; +const GETSTATUS_SALVAGE = "salvaging file system"; +const GETSTATUS_FSSTART = "starting file server"; +const GETSTATUS_FSDOWN = "file server shutting down"; +const GETSTATUS_SALVAGERDOWN = "salvager shutting down"; +const GETSTATUS_FSSTOP = "salvager shut down"; +#endif + +struct bozo_status { + long goal; + long fileGoal; + long porcStartTime; + long procStarts; + long lastAnyExit; + long lastErrorExit; + long errorCode; + long errorSignal; + long flags; + long spare[8]; +}; + +struct bozo_netKTime { + long mask; + short hour; + short min; + short sec; + short day; +}; + +struct bozo_key { + char data[8]; +}; + +struct bozo_keyInfo { + long mod_sec; + long mod_usec; + unsigned long keyCheckSum; + long spare2; +}; + +#if 0 +struct bnode_ops { + struct bnode *(*create)(); + long (*timeout)(); + long (*getstat)(); + long (*setstat)(); + long (*delete)(); + long (*procexit)(); + long (*getstring)(); + long (*getparm)(); + long (*restartp)(); + long (*hascore)(); +}; +#endif + + +CreateBnode (IN string type, + IN string instance, + IN string p1, + IN string p2, + IN string p3, + IN string p4, + IN string p5, + IN string p6) = 80; + +DeleteBnode (IN string instance) = 81; + +SetStatus (IN string instance, + IN long status) = 82; + + +GetStatus (IN string instance, + OUT long *inStat, + OUT string statdescr) = 83; + + +EnumerateInstance (IN long instance, + OUT string iname) = 84; + +GetInstanceInfo (IN string instance, + OUT string type, + OUT struct bozo_status *status) = 85; + +GetInstanceParm (IN string instance, + IN long num, + OUT string parm) = 86; + +AddSUser (IN string name) = 87; + +DeleteSUser (IN string name) = 88; + +ListSUsers (IN long an, + OUT string name) = 89; + +ListKeys (IN long an, + OUT long *kvno, + OUT struct bozo_key *key, + OUT struct bozo_keyInfo *keinfo) = 90; + +AddKey (IN long an, + IN struct bozo_key *key) = 91; + +DeleteKey (IN long an) = 92; + +SetCellName (IN string name) = 93; + +GetCellName (OUT string name) = 94; + +GetCellHost (IN long awhich, + OUT string name) = 95; + +AddCellHost (IN string name) = 96; + +DeleteCellHost (IN string name) = 97; + +SetTStatus (IN string instance, + IN long status) = 98; + +ShutdownAll () = 99; + +RestartAll () = 100; + +StartupAll () = 101; + +SetNoAuthFlag (IN long flag) = 102; + +ReBozo () = 103; + +Restart (IN string instance) = 104; + +Install (IN string path, + IN long size, + IN long flags, + IN long date) split = 105; + +UnInstall (IN string path) = 106; + +GetDates (IN string path, + OUT long *newtime, + OUT long *baktime, + OUT long *oldtime) = 107; + + +Exec (IN string cmd) = 108; + +Prune (IN long flags) = 109; + +SetRestartTime (IN long type, + IN struct bozo_netKTime *restartTime) = 110; + + + +GetRestartTime (IN long type, + OUT struct bozo_netKTime *restartTime) = 111; + +GetLog(IN string name) split = 112; + +WaitAll () = 113; + +GetInstanceStrings (IN string instance, + OUT string errorname, + OUT string spare1, + OUT string spare2, + OUT string spare3) = 114; + diff --git a/rpc-api/cb.xg b/rpc-api/cb.xg new file mode 100644 index 0000000..2bfb737 --- /dev/null +++ b/rpc-api/cb.xg @@ -0,0 +1,162 @@ +/* This is -*-c-*- */ + +/* + * Copyright (c) 1997 - 2003 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + +/* + * Interface to CM + */ + +package RXAFSCB_ + +%#include +%#include + +error-function conv_to_arla_errno + +/* + * Interface + */ + +#include "common.h" + +struct AFSDBLockDesc { + char waitStates; + char exclLocked; + short readersReading; + short numWaiting; + short spare; + int pid_last_reader; + int pid_writer; + int src_indicator; +}; + +struct AFSDBLock { + char name[16]; + struct AFSDBLockDesc lock; +}; + +struct AFSDBCacheEntry { + int32_t addr; + int32_t cell; /*Cell part of the fid*/ + AFSFid netFid; /*Network part of the fid*/ + int32_t Length; + int32_t DataVersion; + struct AFSDBLockDesc lock; + int32_t callback; + int32_t cbExpires; + short refCount; + short opens; + short writers; + char mvstat; + char states; +}; + +const AFSCB_MAX_XSTAT_LONGS = 2048; +typedef int32_t AFSCB_CollData; +const AFSCB_XSTATSCOLL_CALL_INFO = 0; /*CM call counting & info*/ +const AFSCB_XSTATSCOLL_PERF_INFO = 1; /*CM performance info*/ +const AFSCB_XSTATSCOLL_FULL_PERF_INFO = 2; /*CM performance info*/ + +const AFS_MAX_INTERFACE_ADDR = 32; +struct interfaceAddr { /* for multihomed clients */ + int numberOfInterfaces; + afsUUID uuid; + ASIS int32_t addr_in[AFS_MAX_INTERFACE_ADDR]; /* interface addresses */ + ASIS int32_t subnetmask[AFS_MAX_INTERFACE_ADDR]; /* subnet masks in net ord */ + int32_t mtu[AFS_MAX_INTERFACE_ADDR]; /* MTU */ +}; + +const AFSMAXCELLHOSTS = 8; /*Max VLDB servers per cell*/ + +typedef int32_t serverList[AFSMAXCELLHOSTS]; + +typedef afs_uint32 cacheConfig<>; + + +CallBack (IN AFSCBFids *a_fidArrayP, + IN AFSCBs *a_callBackArrayP) = 204; + +InitCallBackState () = 205; + +Probe () = 206; + +/* return 0 if ok, 1 if bad index, lock == lock number index */ + +GetLock(IN int32_t index, OUT AFSDBLock *lock) = 207; + +/* return 0 if ok, 1 if bad index, cbentry == cbentry number index */ + +GetCE(IN int32_t index, OUT AFSDBCacheEntry *cbentry) = 208; + +/* AFSCB_XSTAT_VERSION */ + +XStatsVersion(OUT int32_t *version) = 209; + +GetXStats(IN int32_t client_version_num, + IN int32_t collection_number, + OUT int32_t *server_version_number, /* AFSCB_XSTAT_VERSION */ + OUT int32_t *time, + OUT AFSCB_CollData *stats) = 210; + +InitCallBackState2(OUT interfaceAddr *addr) = 211; + +/* fill in interfaces et al in `addr' */ + +WhoAreYou(OUT interfaceAddr *addr) = 212; + +/* to be done */ + +InitCallBackState3(IN afsUUID *serverUuid) = 213; + +/* still there? 0 if match, !0 otherwise */ + +ProbeUUID(IN afsUUID *uuid) = 214; + +GetCellServDB(IN afs_int32 cellIndex, + OUT string cellName, + OUT serverList *cellHosts) = 216; + +GetLocalCell(OUT string cellName) = 217; + +GetCacheConfig(IN afs_uint32 callerVersion, + OUT afs_uint32 *serverVersion, + OUT afs_uint32 *configCount, + OUT cacheConfig *config) = 218; + +GetCellByNum(IN int32_t cellNumber, + OUT string cellName, + OUT serverList *cellHosts) = 65537; + +TellMeAboutYourself(OUT struct interfaceAddr *addr, + OUT Capabilities *capabilities) = 65538; diff --git a/rpc-api/common.h b/rpc-api/common.h new file mode 100644 index 0000000..cd9396b --- /dev/null +++ b/rpc-api/common.h @@ -0,0 +1,212 @@ +/* + * Copyright (c) 1995 - 2004 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + +/* + * Common definition used by several *.xg files + */ + +/* $Id: common.h,v 1.22 2005/10/20 19:41:16 lha Exp $ */ + +%#ifndef _COMMON_ +%#define _COMMON_ + +const LockRead = 0; +const LockWrite = 1; +const LockExtend = 2; +const LockRelease = 3; + +const AFSNAMEMAX = 256; + +const RWVOL = 0; +const ROVOL = 1; +const BACKVOL = 2; + +struct AFSFid { + uint32_t Volume; + uint32_t Vnode; + uint32_t Unique; +}; + +struct VenusFid { + int32_t Cell; + AFSFid fid; +}; + +struct AFSCallBack { + uint32_t CallBackVersion; + uint32_t ExpirationTime; + uint32_t CallBackType; +}; + +enum CallBackType { CBEXCLUSIVE = 1, CBSHARED = 2, CBDROPPED = 3}; + +const CALLBACK_VERSION = 1; + +struct AFSVolSync { + uint32_t spare1; + uint32_t spare2; + uint32_t spare3; + uint32_t spare4; + uint32_t spare5; + uint32_t spare6; +}; + +const TYPE_FILE = 1; +const TYPE_DIR = 2; +const TYPE_LINK = 3; + +struct AFSFetchStatus { + uint32_t InterfaceVersion; + uint32_t FileType; + uint32_t LinkCount; + uint32_t Length; + uint32_t DataVersion; + uint32_t Author; + uint32_t Owner; + uint32_t CallerAccess; + uint32_t AnonymousAccess; + uint32_t UnixModeBits; + uint32_t ParentVnode; + uint32_t ParentUnique; + uint32_t ResidencyMask; + uint32_t ClientModTime; + uint32_t ServerModTime; + uint32_t Group; + uint32_t SyncCounter; + uint32_t DataVersionHigh; /* For AFS/DFS translator */ + uint32_t LockCount; + uint32_t LengthHigh; + uint32_t ErrorCode; +}; + +/* + * Things in AFSStoreStatus.mask + */ + +const SS_MODTIME = 0x01 ; +const SS_OWNER = 0x02 ; +const SS_GROUP = 0x04 ; +const SS_MODEBITS = 0x08 ; +const SS_SEGSIZE = 0x10 ; +const SS_FSYNC = 0x400; /* 1024 */ + + +struct AFSStoreStatus { + uint32_t Mask; + uint32_t ClientModTime; + uint32_t Owner; + uint32_t Group; + uint32_t UnixModeBits; + uint32_t SegSize; +}; + +struct AFSFetchVolumeStatus { + int32_t Vid; + int32_t ParentId; + char Online; + char InService; + char Blessed; + char NeedsSalvage; + int32_t Type; + int32_t MinQuota; + int32_t MaxQuota; + int32_t BlocksInUse; + int32_t PartBlocksAvail; + int32_t PartMaxBlocks; +}; + +struct AFSStoreVolumeStatus { + int32_t Mask; + int32_t MinQuota; + int32_t MaxQuota; +}; + +const AFS_SETMINQUOTA = 1; +const AFS_SETMAXQUOTA = 2; + +const AFSOPAQUEMAX = 1024; + +typedef opaque AFSOpaque; + +typedef int32_t ViceLockType; + +const AFSCBMAX = 50; + +typedef AFSCallBack AFSCBs; +typedef AFSFetchStatus AFSBulkStats; +typedef AFSFid AFSCBFids; + +/* Definitions for ACLs */ + +const PRSFS_READ = 1 ; /* Read files */ +const PRSFS_WRITE = 2 ; /* Write files & write-lock existing files */ +const PRSFS_INSERT = 4 ; /* Insert & write-lock new files */ +const PRSFS_LOOKUP = 8 ; /* Enumerate files and examine ACL */ +const PRSFS_DELETE = 16 ; /* Remove files */ +const PRSFS_LOCK = 32 ; /* Read-lock files */ +const PRSFS_ADMINISTER = 64 ; /* Set access list of directory */ + +struct AFSVolumeInfo { + uint32_t Vid; + int32_t Type; + uint32_t Type0; + uint32_t Type1; + uint32_t Type2; + uint32_t Type3; + uint32_t Type4; + uint32_t ServerCount; + uint32_t Server0; + uint32_t Server1; + uint32_t Server2; + uint32_t Server3; + uint32_t Server4; + uint32_t Server5; + uint32_t Server6; + uint32_t Server7; + uint16_t Port0; + uint16_t Port1; + uint16_t Port2; + uint16_t Port3; + uint16_t Port4; + uint16_t Port5; + uint16_t Port6; + uint16_t Port7; +}; + +#include "afsuuid.h" + +const AFSCAPABILITIESMAX = 196; + +typedef int32_t Capabilities; + +%#endif /* _COMMON_ */ diff --git a/rpc-api/fs.xg b/rpc-api/fs.xg new file mode 100644 index 0000000..9d85585 --- /dev/null +++ b/rpc-api/fs.xg @@ -0,0 +1,216 @@ +/* This is -*-c-*- */ + +/* + * Copyright (c) 1995 - 2002, 2004 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + +/* $Id: fs.xg,v 1.21 2004/12/19 20:00:59 lha Exp $ */ + +/* + * Interface to FS + */ + +package RXAFS_ + +%#include + +error-function conv_to_arla_errno + +#define AFSUUID_GENERATE + +#include "common.h" + +const FLUSHMAX = 10; +typedef int32_t ViceIds; +typedef int32_t IPAddrs; + +/* + * Interface + */ + +FetchData (IN AFSFid *a_fidToFetchP, + IN long a_offset, + IN long a_lenInBytes, + OUT AFSFetchStatus *a_fidStatP, + OUT AFSCallBack *a_callBackP, + OUT AFSVolSync *a_volSyncP) split = 130; + +FetchACL (IN AFSFid *a_dirFidP, + OUT AFSOpaque *a_ACLP, + OUT AFSFetchStatus *a_dirNewStatP, + OUT AFSVolSync *a_volSyncP) = 131; + +FetchStatus (IN AFSFid *a_fidToStatP, + OUT AFSFetchStatus *a_currStatP, + OUT AFSCallBack *a_callBackP, + OUT AFSVolSync *a_volSyncP) = 132; + +StoreData (IN AFSFid *a_fidToStoreP, + IN AFSStoreStatus *a_fidStatusP, + IN long a_offset, + IN long a_lenInBytes, + IN long a_fileLenInBytes, + OUT AFSFetchStatus *a_fidStatP, + OUT AFSVolSync *a_volSyncP) split = 133; + +/* + * Correct documentation wouldn't make this fun enough. Gaah. + */ +StoreACL (IN AFSFid *a_dirFidP, + IN AFSOpaque *a_ACLToStoreP, + OUT AFSFetchStatus *a_dirNewStatP, + OUT AFSVolSync *a_volSyncP) = 134; + +StoreStatus (IN AFSFid *a_fidP, + IN AFSStoreStatus *a_currStatusP, + OUT AFSFetchStatus *a_srStatusP, + OUT AFSVolSync *a_volSyncP) = 135; + +RemoveFile (IN AFSFid *a_dirFidP, + IN string a_name, + OUT AFSFetchStatus *a_srvStatusP, + OUT AFSVolSync *a_volSyncP) = 136; + +CreateFile (IN AFSFid *DirFid, + IN string Name, + IN AFSStoreStatus *InStatus, + OUT AFSFid *OutFid, + OUT AFSFetchStatus *OutFidStatus, + OUT AFSFetchStatus *OutDirStatus, + OUT AFSCallBack *CallBack, + OUT AFSVolSync *a_volSyncP) = 137; + +Rename (IN AFSFid *a_origDirFidP, + IN string a_origNameP, + IN AFSFid *a_newDirFidP, + IN string a_newNameP, + OUT AFSFetchStatus *a_origDirStatusP, + OUT AFSFetchStatus *a_newDirStatusP, + OUT AFSVolSync *a_volSyncP) = 138; + +Symlink (IN AFSFid *a_dirFidP, + IN string a_nameP, + IN string a_linkContentsP, + IN AFSStoreStatus *a_origDirStatP, + OUT AFSFid *a_newFidP, + OUT AFSFetchStatus *a_newFidStatP, + OUT AFSFetchStatus *a_newDirStatP, + OUT AFSVolSync *a_volSyncP) = 139; + +Link (IN AFSFid *a_dirFidP, + IN string a_nameP, + IN AFSFid *a_existingFidP, + OUT AFSFetchStatus *a_newFidStatP, + OUT AFSFetchStatus *a_newDirStatP, + OUT AFSVolSync *a_volSyncP) = 140; + +MakeDir (IN AFSFid *a_parentDirFidP, + IN string a_newDirNameP, + IN AFSStoreStatus *a_currStatP, + OUT AFSFid *a_newDirFidP, + OUT AFSFetchStatus *a_dirFidStatP, + OUT AFSFetchStatus *a_parentDirStatP, + OUT AFSCallBack *a_newDirCallBackP, + OUT AFSVolSync *a_volSyncP) = 141; + +RemoveDir (IN AFSFid *a_parentDirStatP, + IN string a_dirNameP, + OUT AFSFetchStatus *a_newParentDirStatP, + OUT AFSVolSync *a_volSyncP) = 142; + +GiveUpCallBacks (IN AFSCBFids *a_fidArrayP, + IN AFSCBs *a_callBackArrayP) = 147; + +/* + * fetch the status of volume `a_volIDP' into `a_volFetchStatP'. + * a_volNameP is not filled in. + */ + +GetVolumeStatus (IN long a_volIDP, + OUT AFSFetchVolumeStatus *a_volFetchStatP, + OUT string a_volNameP, + OUT string a_offLineMsgP, + OUT string a_motdP) = 149; + +SetVolumeStatus (IN long a_volIDP, + IN AFSStoreVolumeStatus *a_volStoreStatP, + IN string a_volNameP, + IN string a_offLineMsgP, + IN string a_motdP) = 150; + +GetRootVolume (OUT string a_rootVolNameP) = 151; + +GetTime (OUT unsigned long *a_secondsP, + OUT unsigned long *a_uSecondsP) = 153; + +NGetVolumeInfo (IN string VolumeName, + OUT AFSVolumeInfo *stuff) = 154; + +BulkStatus (IN AFSCBFids *FidsArray, + OUT AFSBulkStats *StatArray, + OUT AFSCBs *CBArray, + OUT AFSVolSync *Sync) = 155; + +SetLock (IN AFSFid *Fid, + IN ViceLockType Type, + OUT AFSVolSync *Sync) = 156; + +ExtendLock (IN AFSFid *Fid, + OUT AFSVolSync *Sync) = 157; + +ReleaseLock (IN AFSFid *Fid, + OUT AFSVolSync *Sync) = 158; + +FlushCPS (IN ViceIds *IdsArray, + IN IPAddrs *AddrsArray, + IN int32_t spare1, + OUT int32_t *spare2, + OUT int32_t *spare3) = 162; + +FetchData64 (IN AFSFid *Fid, + IN int64_t Pos, + IN int64_t Length, + OUT AFSFetchStatus *OutStatus, + OUT AFSCallBack *CallBack, + OUT AFSVolSync *Sync) split = 65537; + +StoreData64 (IN AFSFid *Fid, + IN AFSStoreStatus *InStatus, + IN uint64_t Pos, + IN uint64_t Length, + IN uint64_t FileLength, + OUT AFSFetchStatus *OutStatus, + OUT AFSVolSync *Sync) split = 65538; + +GiveUpAllCallBacks () = 65539 ; + +GetCapabilities(OUT Capabilities *capabilities) = 65540; diff --git a/rpc-api/ka.xg b/rpc-api/ka.xg new file mode 100644 index 0000000..671f2aa --- /dev/null +++ b/rpc-api/ka.xg @@ -0,0 +1,236 @@ +/* This is -*-c-*- */ + +/* + * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + + +/* + * Interface to KAS + */ + +const AUTHENTICATE_OLD = 1; +const CHANGEPASSWORD = 2; +const GETTICKET_OLD = 3; +const SETPASSWORD = 4; +const SETFIELDS = 5; +const CREATEUSER = 6; +const DELETEUSER = 7; +const GETENTRY = 8; +const LISTENTRY = 9; +const GETSTATS = 10; +const DEBUG = 11; +const GETPASSWORD = 12; +const GETRANDOMKEY = 13; +const AUTHENTICATE = 21; +const GETTICKET = 23; + +const MAXKAKVNO = 127; + +/* Flags (note 0 is illegal) */ + +const KAFNORMAL = 0x1; +/* For the two following the KAFNORMAL MUST not be set */ +const KAFREE = 0x2; /* on freelist */ +const KAOLDKEYS = 0x10; /* used to store old keys */ +/* misc flags */ +const KASPECIAL = 0x100; /* special authserver principal */ +const KAFASSOCROOT = 0x200; /* root of associate tree */ +const KAFASSOC = 0x300; /* associate entry */ + +/* The following flags are used on KAA_SetFields() */ +const KAFADMIN = 0x004; /* administrator */ +const KAFNOTGS = 0x008; /* can't get or use TGT */ +const KAFNOSEAL = 0x020; /* can't be used as server */ +const KAFNOCPW = 0x040; /* can't change password */ +const KAFNEWASSOC = 0x080; /* can create associates */ + +/* MISC stuff */ + +const KAMAJORVERSION = 5; +const KAMINORVERSION = 1; +const NEVERDATE = 037777777777; +const KADEBUGKCINFOSIZE = 25; + +#define Date uint32_t + +/* Errors */ + +const KADATABASEINCONSISTENT = 180480; +const KAEXIST = 180481; +const KAIO = 180482; +const KACREATEFAIL = 180483; +const KANOENT = 180484; +const KAEMPTY = 180485; +const KABADNAME = 180486; +const KABADINDEX = 180487; +const KANOAUTH = 180488; +const KAANSWERTOOLONG = 180489; +const KABADREQUEST = 180490; +const KAOLDINTERFACE = 180491; +const KABADARGUMENT = 180492; +const KABADCMD = 180493; +const KANOKEYS = 180494; +const KAREADPW = 180495; +const KABADKEY = 180496; +const KAUBIKINIT = 180497; +const KAUBIKCALL = 180498; +const KABADPROTOCOL = 180499; +const KANOCELLS = 180500; +const KANOCELL = 180501; +const KATOOMANYUBIKS = 180502; +const KATOOMANYKEYS = 180503; +const KABADTICKET = 180504; +const KAUNKNOWNKEY = 180505; +const KAKEYCACHEINVALID = 180506; +const KABADSERVER = 180507; +const KABADUSER = 180508; +const KABADCPW = 180509; +const KABADCREATE = 180510; +const KANOTICKET = 180511; +const KAASSOCUSER = 180512; +const KANOTSPECIAL = 180513; +const KACLOCKSKEW = 180514; +const KANORECURSE = 180515; +const KARXFAIL = 180516; +const KANULLPASSWORD = 180517; +const KAINTERNALERROR = 180518; +const KAPWEXPIRED = 180519; +const KAREUSED = 180520; +const KATOOSOON = 180521; +const KALOCKED = 180522; + + + +struct ka_CBS { + opaque Seq<>; +}; + +struct ka_BBS { + int32_t MaxSeqLen; + opaque Seq<>; +}; + +struct EncryptionKey { + char key[8]; +}; + +const MAXKANAMELEN = 64; +#define MAXKANAMELEN 64 +const KA_LABELSIZE = 4; + +%#ifndef MAXKTCTICKETLEN +const MAXKTCTICKETLEN = 344; +%#endif + +typedef string kaname; + +struct kaident { + char name[MAXKANAMELEN]; + char instance[MAXKANAMELEN]; +}; + +struct kaentryinfo { + int32_t minor_version; + int32_t flags; + uint32_t user_expiration; + Date modification_time; + kaident modification_user; + Date change_password_time; + long max_ticket_lifetime; + long key_version; + EncryptionKey key; + uint32_t keyCheckSym; + int32_t reserved2; + int32_t reserved3; + int32_t reserved4; +}; + + +package KAA_ + +Authenticate (IN kaname name, + IN kaname instance, + IN Date start_time, + IN Date end_time, + IN ka_CBS *request, + INOUT ka_BBS *answer) = 21; + +ChangePassword (IN kaname name, + IN kaname instance, + IN ka_CBS arequest, + INOUT ka_BBS *oanswer) = 2; + +package KAM_ + +SetPassword (IN kaname name, + IN kaname instance, + IN int32_t kvno, + IN EncryptionKey password) = 4; + +SetFields (IN kaname name, + IN kaname instance, + IN int32_t flags, + IN Date user_expiration, + IN int32_t max_ticket_lifetime, + IN int32_t maxAssociates, + IN int32_t spare1, + IN int32_t spare2) = 5; + +CreateUser (IN kaname name, + IN kaname instance, + IN EncryptionKey password) = 6; + +GetEntry (IN kaname name, + IN kaname instance, + IN long major_version, + OUT kaentryinfo *entry) = 8; + + +package KAT_ + +GetTicket_old (IN int32_t kvno, + IN kaname auth_domain, + IN struct ka_CBS *aticket, + IN kaname name, + IN kaname instance, + IN struct ka_CBS *atimes, + INOUT struct ka_BBS *oanswer) = 3; + +GetTicket (IN int32_t kvno, + IN kaname auth_domain, + IN struct ka_CBS *aticket, + IN kaname name, + IN kaname instance, + IN struct ka_CBS *atimes, + INOUT struct ka_BBS *oanswer) = 23; + diff --git a/rpc-api/pts.xg b/rpc-api/pts.xg new file mode 100644 index 0000000..579d7b1 --- /dev/null +++ b/rpc-api/pts.xg @@ -0,0 +1,345 @@ +/* This is -*-c-*- */ + +/* + * Copyright (c) 1998 - 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + +/* + * Interface to PTS + */ + +package PR_ + +%#include + +error-function conv_to_arla_errno + +/* + * Interface + */ + + +/* Opcodes */ + +const PRINEWUSER = 500; +const PRWHEREISIT = 501; +const PRDUMPENTRY = 502; +const PRADDTOGROUP = 503; +const PRNAMETOUID = 504; +const PRIDTONAME = 505; +const PRDELETE = 506; +const PRREMOVEFROMGROUP = 507; +const PRGETCPS = 508; +const PRNEWENTRY = 509; +const PRLISTMAX = 510; +const PRSETMAX = 511; +const PRLISTENTRY = 512; +const PRCHANGEENTRY = 513; +const PRLISTELEMENTS = 514; +const PROSAMEMBEROF = 515; +const PRSETFIELDSENTRY = 516; +const PRLISTOWNED = 517; +const PRGETCPS2 = 518; +const PRGETHOSTCPS = 519; + +/* Constants */ + +const PR_MAXNAMELEN = 64; +const PR_MAXGROUPS = 5000; +const PR_MAXLIST = 5000; +const PRSIZE = 10; +const COSIZE = 39; +const PRSRV = 73; +const ENTRYSIZE = 192; +const HASHSIZE = 8191; + +const PRDBVERSION = 0; + +/* Bits for PR_SetFieldsEntry() */ + +const PR_SF_NGROUPS = 0x80000000; +const PR_SF_NUSERS = 0x40000000; +const PR_SF_ALLBITS = 0xff; + +/* Reserved IDs */ +const PR_SYSADMINID = -204; +const PR_ANYUSERID = -101; +const PR_AUTHUSERID = -102; +const PR_ANONYMOUSID = 32766; +const PR_BADID = 0x80000000; + +/* Bits for struct prentry flags */ +const PRTYPE = 0x3f; +const PRFREE = 1; +const PRGRP = 2; +const PRCONT = 4; +const PRCELL = 8; +const PRFOREIGN = 16; +const PRINST = 32; +const PRUSER = 0; + +const PRACCESS = 0x40; +const PRQUOTA = 0x80; + +/* Privacy Bits */ + +const PRP_REMOVE_MEM = 0x010000; +const PRP_ADD_MEM = 0x020000; +const PRP_ADD_ANY = 0x040000; +const PRP_MEMBER_MEM = 0x080000; +const PRP_MEMBER_ANY = 0x100000; +const PRP_OWNED_ANY = 0x200000; +const PRP_STATUS_MEM = 0x400000; +const PRP_STATUS_ANY = 0x800000; + +/* Misc */ +const PRSUCCESS = 0; +const PR_REMEMBER_TIMES = 1; + + +struct prheader { + long version; + long headerSize; + long freePtr; + long eofPtr; + long maxGroup; + long maxID; + long maxForeign; + long maxInst; + long orphan; + long usercount; + long groupcount; + long foreigncount; + long instcount; + long reserved[5]; + long nameHash[HASHSIZE]; + long idHash[HASHSIZE]; +}; + +struct prheader_disk { + long version; + long headerSize; + long maxGroup; + long maxID; + long orphan<>; + long usercount; + long groupcount; +}; + +struct prentry { + long flags; + long id; + long cellid; + long next; + long reserved[5]; + long entries[PRSIZE]; + long nextID; + long nextName; + long owner; + long creator; + long ngroups; + long nusers; + long count; + long instance; + long owned; + long nextOwned; + long parent; + long sibling; + long child; + char name[PR_MAXNAMELEN]; +}; + +struct prentry_disk { + long flags; + long id; + long cellid; + long owner; + long creator; + long ngroups; + long owned; + string name; + long entries; +}; + +struct prdebugentry { + long flags; + long id; + long cellid; + long next; + long reserved[5]; + long entries[PRSIZE]; + long nextID; + long nextname; + long owner; + long creator; + long ngroups; + long nusers; + long count; + long instance; + long owned; + long nextOwned; + long parent; + long sibling; + long child; + char name[PR_MAXNAMELEN]; +}; + +struct prcheckentry { + long flags; + long id; + long owner; + long creator; + long ngroups; + long nusers; + long count; + long reserved[5]; + char name[PR_MAXNAMELEN]; +}; + + +typedef char prname[PR_MAXNAMELEN]; + +typedef prname namelist; + +typedef long idlist; + +typedef long prlist; + + +/* Error codes */ + +const PREXIST = 267264 ; +const PRIDEXIST = 267265 ; +const PRNOIDS = 267266 ; +const PRDBFAIL = 267267 ; +const PRNOENT = 267268 ; +const PRPERM = 267269 ; +const PRNOTGROUP = 267270 ; +const PRNOTUSER = 267271 ; +const PRBADNAM = 267272 ; +const PRBADARG = 267273 ; +const PRNOMORE = 267274 ; +const PRDBBAD = 267275 ; +const PRGROUPEMPTY = 267276 ; +const PRINCONSISTENT = 267277 ; +const PRBADDR = 267278 ; +const PRTOOMANY = 267279 ; + + +NameToID(IN namelist *nlist, + OUT idlist *ilist) = 504; + +IDToName(IN idlist *ilist, + OUT namelist *nlist) = 505; + +NewEntry(IN string name, + IN long flag, + IN long oid, + OUT long *id) = 509; + +INewEntry(IN string name, + IN long id, + IN long oid) = 500; + +ListEntry(IN long id, + OUT struct prcheckentry *entry) = 512; + +DumpEntry(IN long pos, + OUT struct prdebugentry *entry) = 502; + +ChangeEntry(IN long id, + IN string name, + IN long oid, + IN long newid) = 513; + +SetFieldsEntry(IN long id, + IN long mask, + IN long flags, + IN long ngroups, + IN long nusers, + IN long spare1, + IN long spare2) = 516; + +/* + * Group/entries that can't be deleted: SYSADMINID, ANYUSERID, + * AUTHUSERID, ANONYMOUSID. Error returned is PRPERM. + * + * Rights: member of SYSADMINID, or owner to entry, or member of the + * owner to `id'. + * + * Sucess: PRSUCCESS. + */ + +Delete(IN long id) = 506; + +WhereIsIt(IN long id, + OUT long *ps) = 501; + +AddToGroup(IN long uid, + IN long gid) = 503; + +RemoveFromGroup(IN long id, + IN long gid) = 507; + +ListMax(OUT long *uid, + OUT long *gid) = 510; + +SetMax(IN long uid, + IN long gflag) = 511; + +ListElements(IN long id, + OUT prlist *elist, + OUT long *over) = 514; + +GetCPS(IN long id, + OUT prlist *elist, + OUT long *over) = 508; + +ListOwned(IN long id, + OUT prlist *elist, + INOUT long *over) = 517; + +IsAMemberOf(IN long uid, + IN long gid, + OUT long *flag) = 515; + +GetCPS2(IN long id, + IN long host, + OUT prlist *elist, + OUT long *over) = 518; + +GetHostCPS(IN long host, + OUT prlist *elist, + OUT long *over) = 519; + + +/* the end */ diff --git a/rpc-api/ubik.xg b/rpc-api/ubik.xg new file mode 100644 index 0000000..20725fc --- /dev/null +++ b/rpc-api/ubik.xg @@ -0,0 +1,160 @@ +/* -*- C -*- */ + +/* + * Copyright (c) 1998 - 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + + +/* + * $Id: ubik.xg,v 1.11 2004/08/27 11:14:45 lha Exp $ + */ + +package Ubik_ + +%#include + +error-function conv_to_arla_errno + +/* + * Interface + */ + +struct net_tid { + long epoch; + long counter; +}; + +const UBIK_MAX_INTERFACE_ADDR = 256; /* max interfaces per server */ + +typedef net_tid net_version; + +struct ubik_debug { + long now; + long lastYesTime; + long lastYesHost; + long lastYesState; + long lastYesClaim; + long lowestHost; + long lowestTime; + long syncHost; + long syncTime; + net_version syncVersion; + net_tid syncTid; + long amSyncSite; + long syncSiteUntil; + long nServers; + long lockedPages; + long writeLockedPages; + net_version localVersion; + long activeWrite; + long tidCounter; + long anyReadLocks; + long anyWriteLocks; + long recoveryState; + long currentTrans; + long writeTrans; + long epochTime; +}; + +struct ubik_sdebug { + long addr; + long lastVoteTime; + long lastBeaconSent; + long lastVote; + net_version remoteVersion; + long currentDB; + long beaconSinceDown; + long up; + afs_int32 altAddr[255]; /*alternate addresses:host byte */ + /*this is actually UBIK_MAX_INTERFACE_ADDR-1*/ +}; + + + +/* Opcodes */ + +const VOTE_BEACON = 10000; +const VOTE_DEBUG = 10001; +const VOTE_SDEBUG = 10002; +const VOTE_GETSYNCSITE = 10003; + +/* Error codes */ + +const UNOQUORUM = 5376; +const UNOTSYNC = 5377; +const UNHOSTS = 5378; +const UIOERROR = 5379; +const UINTERNAL = 5380; +const USYNC = 5381; +const UNOENT = 5382; +const UBADLOCK = 5383; +const UBADLOG = 5384; +const UBADHOST = 5385; +const UBADTYPE = 5386; +const UTWOENDS = 5387; +const UDONE = 5388; +const UNOSERVERS = 5389; +const UEOF = 5390; +const ULOGIO = 5391; +const UBADFAM = 5392; +const UBADCELL = 5393; +const UBADSECGRP = 5394; +const UBADGROUP = 5395; +const UBADUUID = 5396; +const UNOMEM = 5397; +const UNOTMEMBER = 5398; +const UNBINDINGS = 5399; +const UBADPRINNAME = 5400; +const UPIPE = 5401; +const UDEADLOCK = 5402; +const UEXCEPTION = 5403; +const UTPQFAIL = 5404; +const USKEWED = 5405; +const UNOLOCK = 5406; +const UNOACCESS = 5407; +const UNOSPC = 5408; +const UBADPATH = 5409; +const UBADF = 5410; +const UREINITIALIZE = 5411; + +/* The rpc calls */ + +Beacon (IN long state, + IN long voteStart, + IN net_version *Version, + IN net_tid *tid) multi = VOTE_BEACON; + +Debug (OUT ubik_debug *db) = VOTE_DEBUG; + +SDebug (IN long which, OUT ubik_sdebug *db) = VOTE_SDEBUG; + +GetSyncSite (OUT long *site) = VOTE_GETSYNCSITE; diff --git a/rpc-api/vldb.xg b/rpc-api/vldb.xg new file mode 100644 index 0000000..033e483 --- /dev/null +++ b/rpc-api/vldb.xg @@ -0,0 +1,578 @@ +/* This is -*-c-*- */ + +/* + * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + +/* + * Interface to VLDB + */ + +package VL_ + +%#include +%#include + +error-function conv_to_arla_errno + +#include "common.h" + +/* + * Structures and defines for vldb data + */ + +const VLDB_MAXNAMELEN = 65; +const MAXNSERVERS = 8; +const NMAXNSERVERS = 13; +const MAX_NUMBER_OPCODES = 30; +const MAXTYPES = 3; +const MAXSERVERID = 30; +const HASHSIZE = 8191; +const DEFAULTBULK = 10000; + +typedef opaque bulk; + +#if 0 +typedef struct single_vldbentry *vldblist; +#endif + +/* + * Used in vlentry.server[i].flags + * ie for each site/server + */ + +const VLSF_NEWREPSITE = 0x01; /* ??? */ +const VLSF_ROVOL = 0x02; /* Readonly volume on this site */ +const VLSF_RWVOL = 0x04; /* Readwrite volume on this site */ +const VLSF_BACKVOL = 0x08; /* Backup volume on this site */ +const VLSF_UUID = 0x10; /* Internal flag in Transarc client */ +const VLSF_DONTUSE = 0x20; /* Not yet released volumes */ + +/* + * Used in vlentry.flags + * ie used for whole entry + */ + +/* Internal information in the vldb */ +const VLFREE = 0x1; +const VLDELETED = 0x2; +const VLLOCKED = 0x4; + +/* Volser information/status */ +const VLOP_MOVE = 0x10; +const VLOP_RELEASE = 0x20; +const VLOP_BACKUP = 0x40; +const VLOP_DELETE = 0x80; +const VLOP_DUMP = 0x100; + +%#define VLOP_ALLOPERS ( VLOP_MOVE | VLOP_RELEASE | VLOP_BACKUP | VLOP_DELETE | VLOP_DUMP) + +/* Location information */ +const VLF_RWEXISTS = 0x1000; +const VLF_ROEXISTS = 0x2000; +const VLF_BOEXISTS = 0x4000; +const VLF_BACKEXISTS = 0x4000; +const VLF_DFSFILESET = 0x8000; + +/* VL error interface */ +const VL_IDEXIST = 363520; +const VL_IO = 363521; +const VL_NAMEEXIST = 363522; +const VL_CREATEFAIL = 363523; +const VL_NOENT = 363524; +const VL_EMPTY = 363525; +const VL_ENTDELETED = 363526; +const VL_BADNAME = 363527; +const VL_BADINDEX = 363528; +const VL_BADVOLTYPE = 363529; +const VL_BADPARTITION = 363530; +const VL_BADSERVER = 363531; +const VL_REPSFULL = 363532; +const VL_NOREPSERVER = 363533; +const VL_DUPREPSERVER = 363534; +const VL_RWNOTFOUND = 363535; +const VL_BADREFCOUNT = 363536; +const VL_SIZEEXCEEDED = 363537; +const VL_BADENTRY = 363538; +const VL_BADVOLIDBUMP = 363539; +const VL_IDALREADHASED = 363540; +const VL_ENTRYLOCKED = 363541; +const VL_BADVOLOPER = 363542; +const VL_BADRELLOCKTYPE= 363543; +const VL_RERELEASE = 363544; +const VL_BADSERVERFLAG = 363545; +const VL_PERM = 363546; +const VL_NOMEM = 363547; +const VL_BADVERSION = 363548; +const VL_INDEXERANGE = 363549; +const VL_MULTIPADDR = 363550; +const VL_BADMASK = 363551; + + +/* + * Opcodes + */ + +const VLCREATEENTRY = 501; +const VLDELETEENTRY = 502; +const VLGETENTRYBYID = 503; +const VLGETENTRYBYNAME = 504; +const VLGETNEWVOLUMEID = 505; +const VLREPLACEENTRY = 506; +const VLUPDATEENTRY = 507; +const VLSETLOCK = 508; +const VLRELEASELOCK = 509; +const VLLISTENTRY = 510; +const VLLISTATTRIBUTES = 511; +const VLLINKEDLIST = 512; +const VLGETSTATS = 513; +const VLPROBE = 514; +const VLGETADDRS = 515; +const VLCHANGEADDR = 516; +const VLCREATEENTRYN = 517; +const VLGETENTRYBYIDN = 518; +const VLGETENTRYBYNAMEN = 519; +const VLREPLACEENTRYN = 520; +const VLLISTENTRYN = 521; +const VLLISTATTRIBUTESN = 522; +const VLLINKEDLISTN = 523; +const VLUPDATEENTRYBYNAME = 524; +const VLCREATEENTRYU = 525; +const VLGETENTRYBYIDU = 526; +const VLGETENTRYBYNAMEU = 527; +const VLREPLACEENTRYU = 528; +const VLLISTENTRYU = 529; +const VLLISTATTRIBUTESU = 530; +const VLLINKEDLISTU = 531; +const VLREGADDR = 532; +const VLGETADDRSU = 533; +const VLLISTATTRIBUTESN2 = 534; + +/* + * ReleaseType argument for VL_ReleaseLock + */ +const LOCKREL_TIMESTAMP = 1; +const LOCKREL_OPCODE = 2; +const LOCKREL_AFSID = 4; + +struct vldbentry { + char name[VLDB_MAXNAMELEN]; + long volumeType; /* currrent unused */ + long nServers; + long serverNumber[MAXNSERVERS]; + long serverPartition[MAXNSERVERS]; + long serverFlags[MAXNSERVERS]; + u_long volumeId[MAXTYPES]; + long cloneId; + long flags; +}; + +struct nvldbentry { + char name[VLDB_MAXNAMELEN]; + long nServers; + long serverNumber[NMAXNSERVERS]; + long serverPartition[NMAXNSERVERS]; + long serverFlags[NMAXNSERVERS]; + u_long volumeId[MAXTYPES]; + long cloneId; + long flags; + long matchindex; + long spares2; + long spares3; + long spares4; + long spares5; + long spares6; + long spares7; + long spares8; + long spares9; +}; + +struct vlentry { + u_long volumeId[MAXTYPES]; + long flags; + long LockAfsId; + long LockTimestamp; + long cloneId; + long AssociatedChain; + long nextIdHash[MAXTYPES]; + long nextNameHash; + long spares1[2]; + char name[VLDB_MAXNAMELEN]; + u_char volumeType; + u_char serverNumber[MAXNSERVERS]; + u_char serverPartition[MAXNSERVERS]; + u_char serverFlags[MAXNSERVERS]; + u_char RefCount; + char spares2[1]; +}; + +/* disk_vlentry is arla specific */ + +struct disk_vlentry { + u_long volumeId[MAXTYPES]; + long flags; + long cloneId; + string name<>; + long serverNumber<>; + long serverPartition<>; + long serverFlags<>; +}; + +struct vital_vlheader { + long vldbversion; + long headersize; + long freePtr; + long eofPtr; + long allocs; + long frees; + long MaxVolumeId; + long totalEntries[MAXTYPES]; +}; + +typedef long longarray[MAXTYPES]; + +struct vlheader { + struct vital_vlheader vital_header; + u_long IpMappedAddr[MAXSERVERID]; + long VolnameHash[HASHSIZE]; +/* long VolidHashRW[HASHSIZE]; + long VolidHashRO[HASHSIZE]; + long VolidHashBACK[HASHSIZE];*/ + longarray VolidHash[HASHSIZE]; +}; + + +const VLUPDATE_VOLUMENAME = 0x1; +const VLUPDATE_FLAGS = 0x4; +const VLUPDATE_READONLYID = 0x8; +const VLUPDATE_BACKUPID = 0x10; +const VLUPDATE_REPSITES = 0x20; +const VLUPDATE_CLONEID = 0x80; +const VLUPDATE_VOLNAMEHASH = 0x100; +const VLUPDATE_RWID = 0x200; + +const VLUPDATE_REPS_DELETE = 0x100; +const VLUPDATE_REPS_ADD = 0x200; +const VLUPDATE_REPS_MODSERV = 0x400; +const VLUPDATE_REPS_MODPART = 0x800; +const VLUPDATE_REPS_MODFLAG = 0x1000; + +struct VldbUpdateEntry { + u_long Mask; + char name[VLDB_MAXNAMELEN]; + long volumeType; + long flags; + u_long ReadOnlyId; + u_long BackupId; + long cloneid; + long nModifiedRepsites; + u_long RepsitesMask[MAXNSERVERS]; + long RepsitesTargetServer[MAXNSERVERS]; + long RepsitesTargetPart[MAXNSERVERS]; + long RepsitesNewServer[MAXNSERVERS]; + long RepsitesNewPart[MAXNSERVERS]; + long RepsitesNewFlags[MAXNSERVERS]; +}; + +/* bit mask for VldbListByAttributes.Mask */ +const VLLIST_SERVER = 0x1; +const VLLIST_PARTITION = 0x2; +/* 0x4 was VLLIST_VOLUMETYPE but now it seems to be depricated */ +const VLLIST_VOLUMEID = 0x8; +const VLLIST_FLAG = 0x10; + +struct VldbListByAttributes { + u_long Mask; + long server; + long partition; + long volumetype; /* depricated */ + long volumeid; + long flag; +}; + +struct uvldbentry { + char name[VLDB_MAXNAMELEN]; + long nServers; + afsUUID serverNumber[NMAXNSERVERS]; + long serverUnique[NMAXNSERVERS]; + long serverPartition[NMAXNSERVERS]; + long serverFlags[NMAXNSERVERS]; + u_long volumeId[MAXTYPES]; + long cloneId; + long flags; + long spares1; + long spares2; + long spares3; + long spares4; + long spares5; + long spares6; + long spares7; + long spares8; + long spares9; +}; + + +#if 0 +struct single_vldbentry { + vldbentry VldbEntry; + vldblist next_vldb; +}; + +struct vldb_list { + vldblist node; +}; +#endif + +struct vldstats { + unsigned long start_time; + long requests[MAX_NUMBER_OPCODES]; + long aborts[MAX_NUMBER_OPCODES]; + long reserved[5]; +}; + +const VL_MAX_BULK_ADDRS = 1024 ; + +typedef vldbentry bulkentries<>; +typedef nvldbentry nbulkentries<>; +typedef uvldbentry ubulkentries<>; +typedef int32_t bulkaddrs; + + +/* + * Bits for ListAddrByAttributes.Mask + * Note, IPADDR/INDEX/UUID are mutually exclusive + */ + +const VLADDR_IPADDR = 0x1; +const VLADDR_INDEX = 0x2; +const VLADDR_UUID = 0x4; + +struct ListAddrByAttributes { + int32_t Mask; + uint32_t ipaddr; + int32_t index; + int32_t spare; + afsUUID uuid; +}; + +struct VL_Callback { + uint32_t version; + uint32_t expiration_time; + uint32_t time; + uint32_t handle; +}; + +/* + * Interface + */ + +CreateEntry (IN vldbentry *newentry) = VLCREATEENTRY; + +DeleteEntry (IN long Volid, + IN long voltype) = VLDELETEENTRY; + +GetEntryByID (IN long Volid, + IN long voltype, + OUT vldbentry *entry) = VLGETENTRYBYID; + +GetEntryByName (IN string volumename, + OUT vldbentry *entry) = VLGETENTRYBYNAME; + +GetNewVolumeId (IN long bumpcount, + OUT long *newvolumid) = VLGETNEWVOLUMEID; + +ReplaceEntry (IN long Volid, + IN long voltype, + IN vldbentry *newentry, + IN long ReleaseType) = VLREPLACEENTRY; + +UpdateEntry (IN long Volid, + IN long voltype, + IN VldbUpdateEntry *UpdateEntry, + IN long ReleaseType) = VLUPDATEENTRY; + +SetLock (IN long Volid, + IN long voltype, + IN long voloper) = VLSETLOCK; + +ReleaseLock (IN long volid, + IN long voltype, + IN long ReleaseType) = VLRELEASELOCK; + +ListEntry (IN long previous_index, + OUT long *count, + OUT long *next_index, + OUT vldbentry *entry) = VLLISTENTRY; + +ListAttributes (IN VldbListByAttributes *attributes, + OUT long *nentries, + OUT bulkentries *blkentries) = VLLISTATTRIBUTES; + +#if 0 +LinkedList (IN VldbListByAttributes *attributes, + OUT long *nentries, + OUT vldb_list *linkedentries) = 512; +#endif + +GetStats (OUT vldstats *stats, + OUT vital_vlheader *vital_header) = VLGETSTATS; + +Probe () = VLPROBE; + +GetAddrs(IN int32_t handle, + IN int32_t spare, + OUT VL_Callback *spare3, + OUT int32_t *nentries, + OUT bulkaddrs *blkaddr) = VLGETADDRS; + +ChangeAddrs(IN int32_t old_ip, + IN int32_t new_ip) = VLCHANGEADDR; /* obsolete */ + +CreateEntryN(IN nvldbentry *newentry) = VLCREATEENTRYN; + +GetEntryByIDN (IN long Volid, + IN long voltype, + OUT nvldbentry *entry) = VLGETENTRYBYIDN; + +GetEntryByNameN (IN string volumename, + OUT nvldbentry *entry) = VLGETENTRYBYNAMEN; + +ReplaceEntryN (IN long Volid, + IN long voltype, + IN nvldbentry *newentry, + IN long ReleaseType) = VLREPLACEENTRYN; + +ListEntryN(IN afs_int32 previous_index, + OUT afs_int32 *count, + OUT afs_int32 *next_index, + OUT nvldbentry *entry) = VLLISTENTRYN; + +ListAttributesN (IN VldbListByAttributes *attributes, + OUT long *nentries, + OUT nbulkentries *blkentries) = VLLISTATTRIBUTESN; + +#if 0 +LinkedListN() = 523; +#endif + +UpdateEntryByName (IN string volname, + IN VldbUpdateEntry *UpdateEntry, + IN long ReleaseType) = VLUPDATEENTRYBYNAME; + +#ifdef not_implemented_yet +CreateEntryU(IN uvldbentry *newentry) = VLCREATEENTRYU; + +GetEntryByIDU() = VLGETENTRYBYIDU; + +GetEntryByNameU (IN string volumename, + OUT struct uvldbentry *entry) = VLGETENTRYBYNAMEU; + +ReplaceEntryU() = VLREPLACEENTRYU; + +ListEntryU() = VLLISTENTRYU; + +ListAttributesU (IN VldbListByAttributes *attributes, + OUT long *nentries, + OUT ubulkentries *blkentries) = VLLISTATTRIBUTESU; + +LinkedListU() = VLLINKEDLISTU; +#endif + +GetAddrsU(IN ListAddrByAttributes *inaddr, + OUT afsUUID *uuidp1, + OUT afs_int32 *uniquifier, + OUT afs_int32 *nentries, + OUT bulkaddrs *blkaddrs) = VLGETADDRSU; + + +RegisterAddrs(IN afsUUID *uid, + IN int32_t spare, + IN bulkaddrs *addrs) = VLREGADDR; + + +ListAttributesN2(IN VldbListByAttributes *attributes, + IN string volumename, + IN afs_int32 startindex, + OUT afs_int32 *nentries, + OUT nbulkentries *blkentries, + OUT afs_int32 *nextstartindex) = VLLISTATTRIBUTESN2; + +#if 0 + +/* + * + */ + +const VL_LISTATTRUUID_MAXATTR = 64; +const VL_LISTATTRUUID_MAXATTRSIZE = 512; + +struct VL_ListAddrUUID { + afs_int32 type; + afs_int32 error; + opaque data; +}; + +typedef VL_ListAddrUUID VL_ListAddrUUIDs<>; + +const VL_UUID_data_INVALID = 1; + +const VL_UUID_data_IPV6 = 1; +struct VL_UUID_data { + opaque ipv6_addr<128>; + int ipv6_mtu; +}; + +const VL_UUID_data_GSSAPI_name = 2; +struct VL_UUID_data_gss_name { + opaque gss_name<>; +}; + +/* + * `uuid' is the uuid we query information the diffrent types are in + * `query'. + * + * For each `query'-item there can be one or more items in `reply'. + * The reply items have `reply<>.type' set to the same type as in the + * query. The are always sorted in the same order as the `query'. + * + * If the `query' type isn't supported a `reply<>' is sent back with + * `reply<>.error' set. + * + * The `reply<>.data' is filled with `reply<>.type' specific data. + * XXX should we use union, I don't think so. + */ + +ListAttrUUID(IN afsUUID *uuid, + IN afs_int32 query, + OUT VL_ListAddrUUIDs *reply) = 10001; + +#endif diff --git a/rpc-api/volumeserver.xg b/rpc-api/volumeserver.xg new file mode 100644 index 0000000..5065725 --- /dev/null +++ b/rpc-api/volumeserver.xg @@ -0,0 +1,412 @@ +/* This is -*-c-*- */ + +/* + * Copyright (c) 1997 - 2004 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. + */ + +/* + * Interface to Volumeserver, + * reference /afs/nada.kth.se/misc/reference/programming/afs/shadow/ + * + * $Id: volumeserver.xg,v 1.27 2004/08/27 11:14:45 lha Exp $ + */ + +package VOLSER_ + +%#include + +error-function conv_to_arla_errno + +const VLDB_MAXSERVER = 80; +const VOLSERVICE_PORT = 7005; +const VOLSERVICE_ID = 4; +const INVALID_BID = 0; +const VOLSER_MAXVOLNAME = 65; +const VOLSER_OLDMAXVOLNAME = 32; +const VOLSER_MAX_REPSITES = 7; +const VNAMESIZE = 32; + +const VOLCREATEVOLUME = 100; +const VOLDELETEVOLUME = 101; +const VOLRESTORE = 102; +const VOLFORWARD = 103; +const VOLENDTRANS = 104; +const VOLCLONE = 105; +const VOLSETFLAGS = 106; +const VOLGETFLAGS = 107; +const VOLTRANSCREATE = 108; +const VOLDUMP = 109; +const VOLGETNTHVOLUME = 110; +const VOLSETFORWARDING = 111; +const VOLGETNAME = 112; +const VOLGETSTATUS = 113; +const VOLSIGNALRESTORE = 114; +const VOLLISTPARTITIONS = 115; +const VOLLISTVOLUMES = 116; +const VOLSETIDTYPES = 117; +const VOLMONITOR = 118; +const VOLPARTITIONINFO = 119; +const VOLRECLONE = 120; +const VOLLISTONEVOLUME = 121; +const VOLNUKEVOLUME = 122; +const VOLSETDATE = 123; +const VOLXLISTVOLUMES = 124; +const VOLXLISTONEVOL = 125; +const VOLSETINFO = 126; +const VOLXLISTPARTITIONS= 127; +const VOLFORWARDMULTIPLE= 128; + +const PARTVALID = 0x01; +const VOK = 0x02; +const VBUSY = 110; + +const VOLSERTRELE_ERROR = 1492325120; +const VOLSERNO_OP = 1492325121; +const VOLSERREAD_DUMPERROR = 1492325122; +const VOLSERDUMPERROR = 1492325123; +const VOLSERATTACH_ERROR = 1492325124; +const VOLSERILLEGAL_PARTITION = 1492325125; +const VOLSERDETACH_ERROR = 1492325126; +const VOLSERBAD_ACCESS = 1492325127; +const VOLSERVLDB_ERROR = 1492325128; +const VOLSERBADNAME = 1492325129; +const VOLSERVOLMOVED = 1492325130; +const VOLSERBADOP = 1492325131; +const VOLSERBADRELEASE = 1492325132; +const VOLSERVOLBUSY = 1492325133; +const VOLSERNO_MEMORY = 1492325134; +const VOLSERNOVOL = 1492325135; +const VOLSERMULTIRWVOL = 1492325136; +const VOLSERFAILEDOP = 1492325137; + +/* Attach mode for this volume at the start of the transaction */ +const ITOffline = 0x1; /* volume offline on server (returns VOFFLINE) */ +const ITBusy = 0x2; /* volume busy on server (returns VBUSY) */ +const ITReadOnly = 0x8; /* do not use */ +const ITCreate = 0x10; /* volume does not exist correctly yet */ +const ITCreateVolID = 0x1000; /* create volid */ + +/* Representing transaction state */ +const TTDeleted = 0x1; /* delete transaction not yet freed due to refCount */ + +const VTDeleteOnSalvage = 1; +const VTOutOfService = 2; +const VTDeleted = 4; + +#if 0 +struct volser_trans { + volser_trans *next; + long tid; + long time; + long creationTime; + long returnCode; + long volid; + long partition; + long dumpTransId; + long dumpSeq; /* Not used */ + short refCount; + short iflags; + char vflags; + char tflags; + char incremental; + char lastProcName[30]; +/* struct rx_call *rxCallPtr; XXXXXXX BROKEN /lha */ +}; +#endif +struct volDescription { + char volName[VOLSER_MAXVOLNAME]; + long volId; + long volSize; + long volFlags; + long volCloneId; +}; + +struct partList { + int partId[26]; + long partFlags[26]; +}; + +struct volser_status { + long volID; + long nextUnique; + long type; + long parentID; + long cloneID; + long backupID; + long restoredFromID; + long maxQuota; + long minQuota; + long owner; + long creationDate; + long accessDate; + long updateDate; + long exprirationDate; + long backupDate; + long copyDate; +}; + +struct destServer { + long destHost; + long destPort; + long destSSID; /* currently allways set to 1 */ +}; + +struct volintInfo { + char name[VNAMESIZE]; + long volid; + long type; + long backupID; + long parentID; + long cloneID; + long status; + long copyDate; + char inUse; + char needsSalvaged; + char destroyMe; + long creationDate; + long accessDate; + long updateDate; + long backupDate; + long dayUse; + long filecount; + long maxquota; + long size; + long flags; + long spare0; + long spare1; + long spare2; + long spare3; +}; + +struct xvolintInfo { + char name[VNAMESIZE]; + long volid; + long type; + long backupID; + long parentID; + long cloneID; + long status; + long copyDate; + char inUse; + long creationDate; + long accessDate; + long updateDate; + long backupDate; + long dayUse; + long filecount; + long maxquota; + long size; + int32_t stat_reads[4]; + int32_t stat_writes[4]; + int32_t stat_fileSameAuthor[6]; + int32_t stat_fileDiffAuthor[6]; + int32_t stat_dirSameAuthor[6]; + int32_t stat_dirDiffAuthor[6]; +}; + +/* + * same site total, same site authenticated + * diff site total, diff site authenticated + */ + +/* + * 0-60 s + * 1-10 min + * 10-60 min + * 1-24 hour + * 1-7 days + * >7 days + */ + +struct transDebugInfo { + long tid; + long time; + long creationTime; + long returnCode; + long volid; + long partition; + short iflags; + char vflags; + char tflags; + char lastProcName[30]; + long callValid; + long readNext; + long transmitNext; + long lastSendTime; + long lastReceiveTime; +}; + +struct pIDs { + long partIds[26]; /* -1 if none */ +}; + +struct diskPartition { + char name[32]; + char devName[32]; + long lock_fd; + long totalUsable; + long free; + long minFree; +}; + +struct restoreCookie { + char name[32]; + long type; + long clone; + long parent; +}; + +typedef transDebugInfo transDebugEntries<>; +typedef volintInfo volEntries<>; +typedef xvolintInfo xvolEntries<>; +typedef int32_t part_entries<>; +typedef int32_t multi_results<>; + +struct replica { + int32_t trans_id; + struct destServer destserver; +}; + +#define AFS_MAX_DESTINATIONS 255 + +typedef replica manyDests; + +AFSVolCreateVolume(IN long partition, + IN string name, + IN long type, + IN long parent, + INOUT long *volid, + OUT long *trans) = VOLCREATEVOLUME; + +AFSVolDeleteVolume(IN long trans) = VOLDELETEVOLUME; + +AFSVolNukeVolume(IN long partID, + IN long volID) = VOLNUKEVOLUME; + +AFSVolDump(IN long fromTrans, + IN long fromDate) split = VOLDUMP; + +AFSVolSignalRestore(IN string name<>, + IN int type, + IN long pid, + IN long cloneid) = VOLSIGNALRESTORE; + +AFSVolRestore(IN long toTrans, + IN long flags, + IN restoreCookie *cookie) split = VOLRESTORE; + +AFSVolForward(IN int32_t fromTrans, + IN int32_t fromData, + IN struct destServer *destination, + IN long destTrans, + IN struct restoreCookie *cookie) = VOLFORWARD; + +AFSVolClone(IN long trans, + IN long purgeVol, + IN long newType, + IN string newName, + INOUT long *newVol) = VOLCLONE; + +AFSVolReClone(IN long tid, + IN long cloneID) = VOLRECLONE; + +AFSVolSetForwarding(IN long tid, + IN long newsite) = VOLSETFORWARDING; + +AFSVolTransCreate(IN long volume, + IN long partition, + IN long flags, + OUT long *trans) = VOLTRANSCREATE; + +AFSVolEndTrans(IN long trans, + OUT long *rcode) = VOLENDTRANS; + +AFSVolGetFlags(IN long trans, + OUT long *flags) = VOLGETFLAGS; + +AFSVolSetFlags(IN long trans, + IN long flags) = VOLSETFLAGS; + +AFSVolGetName(IN long tid, + OUT string tname<256>) = VOLGETNAME; + +AFSVolGetStatus(IN long tid, + OUT volser_status *status) = VOLGETSTATUS; + +AFSVolSetIdsTypes(IN long tId, + IN string name<>, + IN long type, + IN long pId, + IN long cloneId, + IN long backupId) = VOLSETIDTYPES; + +AFSVolSetDate(IN long tid, + IN long newDate) = VOLSETDATE; + +AFSVolListPartitions(OUT struct pIDs *partIDs) = VOLLISTPARTITIONS; + +AFSVolPartitionInfo(IN string name<>, + OUT struct diskPartition *partition) = VOLPARTITIONINFO; + +AFSVolListVolumes(IN long partID, + IN long flags, + OUT struct volEntries *resultEntries) = VOLLISTVOLUMES; + +AFSVolListOneVolume(IN long partID, + IN long volid, + OUT struct volEntries *resultEntries) = VOLLISTONEVOLUME; + +AFSVolGetNthVolume(IN long index, + OUT long *volume, + OUT long *partition) = VOLGETNTHVOLUME; + +AFSVolMonitor(OUT transDebugEntries *result) = VOLMONITOR; + +AFSVolXListVolumes(IN long partID, + IN long flags, + OUT struct xvolEntries *resultEntries) = VOLXLISTVOLUMES; + +AFSVolXListOneVolume(IN long partID, + IN long volid, + OUT struct xvolEntries *resultEntries) = VOLXLISTONEVOL; + +AFSVolSetInfo(IN long transid, + IN volintInfo *volinfo) = VOLSETINFO; + +AFSVolXListPartitions(OUT part_entries *ent) = VOLXLISTPARTITIONS; + +AFSVolForwardMultiple(IN int32_t fromTrans, + IN int32_t fromData, + IN manyDests *destinations, + IN long spare0, + IN struct restoreCookie *cookie, + OUT multi_results *results) = VOLFORWARDMULTIPLE;