4 * Copyright (c) 1997 - 2004 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
37 * Interface to Volumeserver,
38 * reference /afs/nada.kth.se/misc/reference/programming/afs/shadow/
45 %#include <fs_errors.h>
47 error-function conv_to_arla_errno
49 const VLDB_MAXSERVER = 80;
50 const VOLSERVICE_PORT = 7005;
51 const VOLSERVICE_ID = 4;
52 const INVALID_BID = 0;
53 const VOLSER_MAXVOLNAME = 65;
54 const VOLSER_OLDMAXVOLNAME = 32;
55 const VOLSER_MAX_REPSITES = 7;
58 const VOLCREATEVOLUME = 100;
59 const VOLDELETEVOLUME = 101;
60 const VOLRESTORE = 102;
61 const VOLFORWARD = 103;
62 const VOLENDTRANS = 104;
64 const VOLSETFLAGS = 106;
65 const VOLGETFLAGS = 107;
66 const VOLTRANSCREATE = 108;
68 const VOLGETNTHVOLUME = 110;
69 const VOLSETFORWARDING = 111;
70 const VOLGETNAME = 112;
71 const VOLGETSTATUS = 113;
72 const VOLSIGNALRESTORE = 114;
73 const VOLLISTPARTITIONS = 115;
74 const VOLLISTVOLUMES = 116;
75 const VOLSETIDTYPES = 117;
76 const VOLMONITOR = 118;
77 const VOLPARTITIONINFO = 119;
78 const VOLRECLONE = 120;
79 const VOLLISTONEVOLUME = 121;
80 const VOLNUKEVOLUME = 122;
81 const VOLSETDATE = 123;
82 const VOLXLISTVOLUMES = 124;
83 const VOLXLISTONEVOL = 125;
84 const VOLSETINFO = 126;
85 const VOLXLISTPARTITIONS= 127;
86 const VOLFORWARDMULTIPLE= 128;
88 const PARTVALID = 0x01;
92 const VOLSERTRELE_ERROR = 1492325120;
93 const VOLSERNO_OP = 1492325121;
94 const VOLSERREAD_DUMPERROR = 1492325122;
95 const VOLSERDUMPERROR = 1492325123;
96 const VOLSERATTACH_ERROR = 1492325124;
97 const VOLSERILLEGAL_PARTITION = 1492325125;
98 const VOLSERDETACH_ERROR = 1492325126;
99 const VOLSERBAD_ACCESS = 1492325127;
100 const VOLSERVLDB_ERROR = 1492325128;
101 const VOLSERBADNAME = 1492325129;
102 const VOLSERVOLMOVED = 1492325130;
103 const VOLSERBADOP = 1492325131;
104 const VOLSERBADRELEASE = 1492325132;
105 const VOLSERVOLBUSY = 1492325133;
106 const VOLSERNO_MEMORY = 1492325134;
107 const VOLSERNOVOL = 1492325135;
108 const VOLSERMULTIRWVOL = 1492325136;
109 const VOLSERFAILEDOP = 1492325137;
111 /* Attach mode for this volume at the start of the transaction */
112 const ITOffline = 0x1; /* volume offline on server (returns VOFFLINE) */
113 const ITBusy = 0x2; /* volume busy on server (returns VBUSY) */
114 const ITReadOnly = 0x8; /* do not use */
115 const ITCreate = 0x10; /* volume does not exist correctly yet */
116 const ITCreateVolID = 0x1000; /* create volid */
118 /* Representing transaction state */
119 const TTDeleted = 0x1; /* delete transaction not yet freed due to refCount */
121 const VTDeleteOnSalvage = 1;
122 const VTOutOfService = 2;
126 struct volser_trans {
135 long dumpSeq; /* Not used */
141 char lastProcName[30];
142 /* struct rx_call *rxCallPtr; XXXXXXX BROKEN /lha */
145 struct volDescription {
146 char volName[VOLSER_MAXVOLNAME];
158 struct volser_status {
172 long exprirationDate;
180 long destSSID; /* currently allways set to 1 */
184 char name[VNAMESIZE];
211 char name[VNAMESIZE];
228 int32_t stat_reads[4];
229 int32_t stat_writes[4];
230 int32_t stat_fileSameAuthor[6];
231 int32_t stat_fileDiffAuthor[6];
232 int32_t stat_dirSameAuthor[6];
233 int32_t stat_dirDiffAuthor[6];
237 * same site total, same site authenticated
238 * diff site total, diff site authenticated
250 struct transDebugInfo {
260 char lastProcName[30];
265 long lastReceiveTime;
269 long partIds[26]; /* -1 if none */
272 struct diskPartition {
281 struct restoreCookie {
288 typedef transDebugInfo transDebugEntries<>;
289 typedef volintInfo volEntries<>;
290 typedef xvolintInfo xvolEntries<>;
291 typedef int32_t part_entries<>;
292 typedef int32_t multi_results<>;
296 struct destServer destserver;
299 #define AFS_MAX_DESTINATIONS 255
301 typedef replica manyDests<AFS_MAX_DESTINATIONS>;
303 AFSVolCreateVolume(IN long partition,
308 OUT long *trans) = VOLCREATEVOLUME;
310 AFSVolDeleteVolume(IN long trans) = VOLDELETEVOLUME;
312 AFSVolNukeVolume(IN long partID,
313 IN long volID) = VOLNUKEVOLUME;
315 AFSVolDump(IN long fromTrans,
316 IN long fromDate) split = VOLDUMP;
318 AFSVolSignalRestore(IN string name<>,
321 IN long cloneid) = VOLSIGNALRESTORE;
323 AFSVolRestore(IN long toTrans,
325 IN restoreCookie *cookie) split = VOLRESTORE;
327 AFSVolForward(IN int32_t fromTrans,
329 IN struct destServer *destination,
331 IN struct restoreCookie *cookie) = VOLFORWARD;
333 AFSVolClone(IN long trans,
337 INOUT long *newVol) = VOLCLONE;
339 AFSVolReClone(IN long tid,
340 IN long cloneID) = VOLRECLONE;
342 AFSVolSetForwarding(IN long tid,
343 IN long newsite) = VOLSETFORWARDING;
345 AFSVolTransCreate(IN long volume,
348 OUT long *trans) = VOLTRANSCREATE;
350 AFSVolEndTrans(IN long trans,
351 OUT long *rcode) = VOLENDTRANS;
353 AFSVolGetFlags(IN long trans,
354 OUT long *flags) = VOLGETFLAGS;
356 AFSVolSetFlags(IN long trans,
357 IN long flags) = VOLSETFLAGS;
359 AFSVolGetName(IN long tid,
360 OUT string tname<256>) = VOLGETNAME;
362 AFSVolGetStatus(IN long tid,
363 OUT volser_status *status) = VOLGETSTATUS;
365 AFSVolSetIdsTypes(IN long tId,
370 IN long backupId) = VOLSETIDTYPES;
372 AFSVolSetDate(IN long tid,
373 IN long newDate) = VOLSETDATE;
375 AFSVolListPartitions(OUT struct pIDs *partIDs) = VOLLISTPARTITIONS;
377 AFSVolPartitionInfo(IN string name<>,
378 OUT struct diskPartition *partition) = VOLPARTITIONINFO;
380 AFSVolListVolumes(IN long partID,
382 OUT struct volEntries *resultEntries) = VOLLISTVOLUMES;
384 AFSVolListOneVolume(IN long partID,
386 OUT struct volEntries *resultEntries) = VOLLISTONEVOLUME;
388 AFSVolGetNthVolume(IN long index,
390 OUT long *partition) = VOLGETNTHVOLUME;
392 AFSVolMonitor(OUT transDebugEntries *result) = VOLMONITOR;
394 AFSVolXListVolumes(IN long partID,
396 OUT struct xvolEntries *resultEntries) = VOLXLISTVOLUMES;
398 AFSVolXListOneVolume(IN long partID,
400 OUT struct xvolEntries *resultEntries) = VOLXLISTONEVOL;
402 AFSVolSetInfo(IN long transid,
403 IN volintInfo *volinfo) = VOLSETINFO;
405 AFSVolXListPartitions(OUT part_entries *ent) = VOLXLISTPARTITIONS;
407 AFSVolForwardMultiple(IN int32_t fromTrans,
409 IN manyDests *destinations,
411 IN struct restoreCookie *cookie,
412 OUT multi_results *results) = VOLFORWARDMULTIPLE;