4 * Copyright (c) 1997 - 2002 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the Institute nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 %#include <fs_errors.h>
45 error-function conv_to_arla_errno
50 * Structures and defines for vldb data
53 const VLDB_MAXNAMELEN = 65;
54 const MAXNSERVERS = 8;
55 const NMAXNSERVERS = 13;
56 const MAX_NUMBER_OPCODES = 30;
58 const MAXSERVERID = 30;
59 const HASHSIZE = 8191;
60 const DEFAULTBULK = 10000;
62 typedef opaque bulk<DEFAULTBULK>;
65 typedef struct single_vldbentry *vldblist;
69 * Used in vlentry.server[i].flags
70 * ie for each site/server
73 const VLSF_NEWREPSITE = 0x01; /* ??? */
74 const VLSF_ROVOL = 0x02; /* Readonly volume on this site */
75 const VLSF_RWVOL = 0x04; /* Readwrite volume on this site */
76 const VLSF_BACKVOL = 0x08; /* Backup volume on this site */
77 const VLSF_UUID = 0x10; /* Internal flag in Transarc client */
78 const VLSF_DONTUSE = 0x20; /* Not yet released volumes */
81 * Used in vlentry.flags
82 * ie used for whole entry
85 /* Internal information in the vldb */
87 const VLDELETED = 0x2;
90 /* Volser information/status */
91 const VLOP_MOVE = 0x10;
92 const VLOP_RELEASE = 0x20;
93 const VLOP_BACKUP = 0x40;
94 const VLOP_DELETE = 0x80;
95 const VLOP_DUMP = 0x100;
97 %#define VLOP_ALLOPERS ( VLOP_MOVE | VLOP_RELEASE | VLOP_BACKUP | VLOP_DELETE | VLOP_DUMP)
99 /* Location information */
100 const VLF_RWEXISTS = 0x1000;
101 const VLF_ROEXISTS = 0x2000;
102 const VLF_BOEXISTS = 0x4000;
103 const VLF_BACKEXISTS = 0x4000;
104 const VLF_DFSFILESET = 0x8000;
106 /* VL error interface */
107 const VL_IDEXIST = 363520;
108 const VL_IO = 363521;
109 const VL_NAMEEXIST = 363522;
110 const VL_CREATEFAIL = 363523;
111 const VL_NOENT = 363524;
112 const VL_EMPTY = 363525;
113 const VL_ENTDELETED = 363526;
114 const VL_BADNAME = 363527;
115 const VL_BADINDEX = 363528;
116 const VL_BADVOLTYPE = 363529;
117 const VL_BADPARTITION = 363530;
118 const VL_BADSERVER = 363531;
119 const VL_REPSFULL = 363532;
120 const VL_NOREPSERVER = 363533;
121 const VL_DUPREPSERVER = 363534;
122 const VL_RWNOTFOUND = 363535;
123 const VL_BADREFCOUNT = 363536;
124 const VL_SIZEEXCEEDED = 363537;
125 const VL_BADENTRY = 363538;
126 const VL_BADVOLIDBUMP = 363539;
127 const VL_IDALREADHASED = 363540;
128 const VL_ENTRYLOCKED = 363541;
129 const VL_BADVOLOPER = 363542;
130 const VL_BADRELLOCKTYPE= 363543;
131 const VL_RERELEASE = 363544;
132 const VL_BADSERVERFLAG = 363545;
133 const VL_PERM = 363546;
134 const VL_NOMEM = 363547;
135 const VL_BADVERSION = 363548;
136 const VL_INDEXERANGE = 363549;
137 const VL_MULTIPADDR = 363550;
138 const VL_BADMASK = 363551;
145 const VLCREATEENTRY = 501;
146 const VLDELETEENTRY = 502;
147 const VLGETENTRYBYID = 503;
148 const VLGETENTRYBYNAME = 504;
149 const VLGETNEWVOLUMEID = 505;
150 const VLREPLACEENTRY = 506;
151 const VLUPDATEENTRY = 507;
152 const VLSETLOCK = 508;
153 const VLRELEASELOCK = 509;
154 const VLLISTENTRY = 510;
155 const VLLISTATTRIBUTES = 511;
156 const VLLINKEDLIST = 512;
157 const VLGETSTATS = 513;
159 const VLGETADDRS = 515;
160 const VLCHANGEADDR = 516;
161 const VLCREATEENTRYN = 517;
162 const VLGETENTRYBYIDN = 518;
163 const VLGETENTRYBYNAMEN = 519;
164 const VLREPLACEENTRYN = 520;
165 const VLLISTENTRYN = 521;
166 const VLLISTATTRIBUTESN = 522;
167 const VLLINKEDLISTN = 523;
168 const VLUPDATEENTRYBYNAME = 524;
169 const VLCREATEENTRYU = 525;
170 const VLGETENTRYBYIDU = 526;
171 const VLGETENTRYBYNAMEU = 527;
172 const VLREPLACEENTRYU = 528;
173 const VLLISTENTRYU = 529;
174 const VLLISTATTRIBUTESU = 530;
175 const VLLINKEDLISTU = 531;
176 const VLREGADDR = 532;
177 const VLGETADDRSU = 533;
178 const VLLISTATTRIBUTESN2 = 534;
181 * ReleaseType argument for VL_ReleaseLock
183 const LOCKREL_TIMESTAMP = 1;
184 const LOCKREL_OPCODE = 2;
185 const LOCKREL_AFSID = 4;
188 char name[VLDB_MAXNAMELEN];
189 long volumeType; /* currrent unused */
191 long serverNumber[MAXNSERVERS];
192 long serverPartition[MAXNSERVERS];
193 long serverFlags[MAXNSERVERS];
194 u_long volumeId[MAXTYPES];
200 char name[VLDB_MAXNAMELEN];
202 long serverNumber[NMAXNSERVERS];
203 long serverPartition[NMAXNSERVERS];
204 long serverFlags[NMAXNSERVERS];
205 u_long volumeId[MAXTYPES];
220 u_long volumeId[MAXTYPES];
225 long AssociatedChain;
226 long nextIdHash[MAXTYPES];
229 char name[VLDB_MAXNAMELEN];
231 u_char serverNumber[MAXNSERVERS];
232 u_char serverPartition[MAXNSERVERS];
233 u_char serverFlags[MAXNSERVERS];
238 /* disk_vlentry is arla specific */
240 struct disk_vlentry {
241 u_long volumeId[MAXTYPES];
246 long serverPartition<>;
250 struct vital_vlheader {
258 long totalEntries[MAXTYPES];
261 typedef long longarray[MAXTYPES];
264 struct vital_vlheader vital_header;
265 u_long IpMappedAddr[MAXSERVERID];
266 long VolnameHash[HASHSIZE];
267 /* long VolidHashRW[HASHSIZE];
268 long VolidHashRO[HASHSIZE];
269 long VolidHashBACK[HASHSIZE];*/
270 longarray VolidHash[HASHSIZE];
274 const VLUPDATE_VOLUMENAME = 0x1;
275 const VLUPDATE_FLAGS = 0x4;
276 const VLUPDATE_READONLYID = 0x8;
277 const VLUPDATE_BACKUPID = 0x10;
278 const VLUPDATE_REPSITES = 0x20;
279 const VLUPDATE_CLONEID = 0x80;
280 const VLUPDATE_VOLNAMEHASH = 0x100;
281 const VLUPDATE_RWID = 0x200;
283 const VLUPDATE_REPS_DELETE = 0x100;
284 const VLUPDATE_REPS_ADD = 0x200;
285 const VLUPDATE_REPS_MODSERV = 0x400;
286 const VLUPDATE_REPS_MODPART = 0x800;
287 const VLUPDATE_REPS_MODFLAG = 0x1000;
289 struct VldbUpdateEntry {
291 char name[VLDB_MAXNAMELEN];
297 long nModifiedRepsites;
298 u_long RepsitesMask[MAXNSERVERS];
299 long RepsitesTargetServer[MAXNSERVERS];
300 long RepsitesTargetPart[MAXNSERVERS];
301 long RepsitesNewServer[MAXNSERVERS];
302 long RepsitesNewPart[MAXNSERVERS];
303 long RepsitesNewFlags[MAXNSERVERS];
306 /* bit mask for VldbListByAttributes.Mask */
307 const VLLIST_SERVER = 0x1;
308 const VLLIST_PARTITION = 0x2;
309 /* 0x4 was VLLIST_VOLUMETYPE but now it seems to be depricated */
310 const VLLIST_VOLUMEID = 0x8;
311 const VLLIST_FLAG = 0x10;
313 struct VldbListByAttributes {
317 long volumetype; /* depricated */
323 char name[VLDB_MAXNAMELEN];
325 afsUUID serverNumber[NMAXNSERVERS];
326 long serverUnique[NMAXNSERVERS];
327 long serverPartition[NMAXNSERVERS];
328 long serverFlags[NMAXNSERVERS];
329 u_long volumeId[MAXTYPES];
345 struct single_vldbentry {
356 unsigned long start_time;
357 long requests[MAX_NUMBER_OPCODES];
358 long aborts[MAX_NUMBER_OPCODES];
362 const VL_MAX_BULK_ADDRS = 1024 ;
364 typedef vldbentry bulkentries<>;
365 typedef nvldbentry nbulkentries<>;
366 typedef uvldbentry ubulkentries<>;
367 typedef int32_t bulkaddrs<VL_MAX_BULK_ADDRS>;
371 * Bits for ListAddrByAttributes.Mask
372 * Note, IPADDR/INDEX/UUID are mutually exclusive
375 const VLADDR_IPADDR = 0x1;
376 const VLADDR_INDEX = 0x2;
377 const VLADDR_UUID = 0x4;
379 struct ListAddrByAttributes {
389 uint32_t expiration_time;
398 CreateEntry (IN vldbentry *newentry) = VLCREATEENTRY;
400 DeleteEntry (IN long Volid,
401 IN long voltype) = VLDELETEENTRY;
403 GetEntryByID (IN long Volid,
405 OUT vldbentry *entry) = VLGETENTRYBYID;
407 GetEntryByName (IN string volumename<VLDB_MAXNAMELEN>,
408 OUT vldbentry *entry) = VLGETENTRYBYNAME;
410 GetNewVolumeId (IN long bumpcount,
411 OUT long *newvolumid) = VLGETNEWVOLUMEID;
413 ReplaceEntry (IN long Volid,
415 IN vldbentry *newentry,
416 IN long ReleaseType) = VLREPLACEENTRY;
418 UpdateEntry (IN long Volid,
420 IN VldbUpdateEntry *UpdateEntry,
421 IN long ReleaseType) = VLUPDATEENTRY;
423 SetLock (IN long Volid,
425 IN long voloper) = VLSETLOCK;
427 ReleaseLock (IN long volid,
429 IN long ReleaseType) = VLRELEASELOCK;
431 ListEntry (IN long previous_index,
433 OUT long *next_index,
434 OUT vldbentry *entry) = VLLISTENTRY;
436 ListAttributes (IN VldbListByAttributes *attributes,
438 OUT bulkentries *blkentries) = VLLISTATTRIBUTES;
441 LinkedList (IN VldbListByAttributes *attributes,
443 OUT vldb_list *linkedentries) = 512;
446 GetStats (OUT vldstats *stats,
447 OUT vital_vlheader *vital_header) = VLGETSTATS;
451 GetAddrs(IN int32_t handle,
453 OUT VL_Callback *spare3,
454 OUT int32_t *nentries,
455 OUT bulkaddrs *blkaddr) = VLGETADDRS;
457 ChangeAddrs(IN int32_t old_ip,
458 IN int32_t new_ip) = VLCHANGEADDR; /* obsolete */
460 CreateEntryN(IN nvldbentry *newentry) = VLCREATEENTRYN;
462 GetEntryByIDN (IN long Volid,
464 OUT nvldbentry *entry) = VLGETENTRYBYIDN;
466 GetEntryByNameN (IN string volumename<VLDB_MAXNAMELEN>,
467 OUT nvldbentry *entry) = VLGETENTRYBYNAMEN;
469 ReplaceEntryN (IN long Volid,
471 IN nvldbentry *newentry,
472 IN long ReleaseType) = VLREPLACEENTRYN;
474 ListEntryN(IN afs_int32 previous_index,
475 OUT afs_int32 *count,
476 OUT afs_int32 *next_index,
477 OUT nvldbentry *entry) = VLLISTENTRYN;
479 ListAttributesN (IN VldbListByAttributes *attributes,
481 OUT nbulkentries *blkentries) = VLLISTATTRIBUTESN;
487 UpdateEntryByName (IN string volname<VLDB_MAXNAMELEN>,
488 IN VldbUpdateEntry *UpdateEntry,
489 IN long ReleaseType) = VLUPDATEENTRYBYNAME;
491 #ifdef not_implemented_yet
492 CreateEntryU(IN uvldbentry *newentry) = VLCREATEENTRYU;
494 GetEntryByIDU() = VLGETENTRYBYIDU;
496 GetEntryByNameU (IN string volumename<VLDB_MAXNAMELEN>,
497 OUT struct uvldbentry *entry) = VLGETENTRYBYNAMEU;
499 ReplaceEntryU() = VLREPLACEENTRYU;
501 ListEntryU() = VLLISTENTRYU;
503 ListAttributesU (IN VldbListByAttributes *attributes,
505 OUT ubulkentries *blkentries) = VLLISTATTRIBUTESU;
507 LinkedListU() = VLLINKEDLISTU;
510 GetAddrsU(IN ListAddrByAttributes *inaddr,
512 OUT afs_int32 *uniquifier,
513 OUT afs_int32 *nentries,
514 OUT bulkaddrs *blkaddrs) = VLGETADDRSU;
517 RegisterAddrs(IN afsUUID *uid,
519 IN bulkaddrs *addrs) = VLREGADDR;
522 ListAttributesN2(IN VldbListByAttributes *attributes,
523 IN string volumename<VLDB_MAXNAMELEN>,
524 IN afs_int32 startindex,
525 OUT afs_int32 *nentries,
526 OUT nbulkentries *blkentries,
527 OUT afs_int32 *nextstartindex) = VLLISTATTRIBUTESN2;
535 const VL_LISTATTRUUID_MAXATTR = 64;
536 const VL_LISTATTRUUID_MAXATTRSIZE = 512;
538 struct VL_ListAddrUUID {
541 opaque data<VL_LISTATTRUUID_MAXATTRSIZE>;
544 typedef VL_ListAddrUUID VL_ListAddrUUIDs<>;
546 const VL_UUID_data_INVALID = 1;
548 const VL_UUID_data_IPV6 = 1;
549 struct VL_UUID_data {
550 opaque ipv6_addr<128>;
554 const VL_UUID_data_GSSAPI_name = 2;
555 struct VL_UUID_data_gss_name {
560 * `uuid' is the uuid we query information the diffrent types are in
563 * For each `query'-item there can be one or more items in `reply'.
564 * The reply items have `reply<>.type' set to the same type as in the
565 * query. The are always sorted in the same order as the `query'.
567 * If the `query' type isn't supported a `reply<>' is sent back with
568 * `reply<>.error' set.
570 * The `reply<>.data' is filled with `reply<>.type' specific data.
571 * XXX should we use union, I don't think so.
574 ListAttrUUID(IN afsUUID *uuid,
575 IN afs_int32 query<VL_LISTATTRUUID_MAXATTR>,
576 OUT VL_ListAddrUUIDs *reply) = 10001;