steps to support modern FreeBSD. After Robert Watson <rwatson@FreeBSD.org> and Alec...
[arla.git] / rxdef / volumeserver.xg
blob3b5fc132187e5ccbf2a5ff0120730d615f784880
1 /* This is -*-c-*- */
3 /*
4  * Copyright (c) 1997 - 2004 Kungliga Tekniska Högskolan
5  * (Royal Institute of Technology, Stockholm, Sweden).
6  * All rights reserved.
7  * 
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 
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.
18  * 
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.
22  * 
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
33  * SUCH DAMAGE.
34  */
37  * Interface to Volumeserver, 
38  * reference /afs/nada.kth.se/misc/reference/programming/afs/shadow/
39  *
40  * $Id$
41  */
43 package VOLSER_
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;
56 const VNAMESIZE                 = 32;
58 const VOLCREATEVOLUME   = 100;
59 const VOLDELETEVOLUME   = 101;
60 const VOLRESTORE        = 102;
61 const VOLFORWARD        = 103;
62 const VOLENDTRANS       = 104;
63 const VOLCLONE          = 105;
64 const VOLSETFLAGS       = 106;
65 const VOLGETFLAGS       = 107;
66 const VOLTRANSCREATE    = 108;
67 const VOLDUMP           = 109;
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;
89 const VOK       = 0x02;
90 const VBUSY     = 110;
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;
123 const VTDeleted = 4;
125 #if 0
126 struct volser_trans { 
127     volser_trans *next;
128     long tid;
129     long time;
130     long creationTime;
131     long returnCode;
132     long volid;
133     long partition;
134     long dumpTransId;
135     long dumpSeq;   /* Not used */
136     short refCount;
137     short iflags;
138     char vflags;    
139     char tflags;
140     char incremental;
141     char lastProcName[30];
142 /*    struct rx_call *rxCallPtr; XXXXXXX BROKEN /lha */
144 #endif
145 struct volDescription {
146     char volName[VOLSER_MAXVOLNAME];
147     long volId;
148     long volSize;
149     long volFlags;
150     long volCloneId;
153 struct partList {
154     int partId[26];
155     long partFlags[26];
158 struct volser_status {
159     long volID;
160     long nextUnique;
161     long type;
162     long parentID;
163     long cloneID;
164     long backupID;
165     long restoredFromID;
166     long maxQuota;
167     long minQuota;
168     long owner;
169     long creationDate;
170     long accessDate;
171     long updateDate;
172     long exprirationDate;
173     long backupDate;
174     long copyDate;
177 struct destServer {
178     long destHost;
179     long destPort;
180     long destSSID;   /* currently allways set to 1 */
183 struct volintInfo {
184     char name[VNAMESIZE];
185     long volid;
186     long type;
187     long backupID;
188     long parentID;
189     long cloneID;
190     long status;
191     long copyDate;
192     char inUse;
193     char needsSalvaged;
194     char destroyMe;
195     long creationDate;
196     long accessDate;
197     long updateDate;
198     long backupDate;
199     long dayUse;
200     long filecount;
201     long maxquota;
202     long size;
203     long flags;
204     long spare0;
205     long spare1;
206     long spare2;
207     long spare3;
210 struct xvolintInfo {
211     char name[VNAMESIZE];
212     long volid;
213     long type;
214     long backupID;
215     long parentID;
216     long cloneID;
217     long status;
218     long copyDate;
219     char inUse;
220     long creationDate;
221     long accessDate;
222     long updateDate;
223     long backupDate;
224     long dayUse;
225     long filecount;
226     long maxquota;
227     long size;
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
239  */
242  * 0-60 s
243  * 1-10 min
244  * 10-60 min
245  * 1-24 hour
246  * 1-7 days
247  * >7 days
248  */
250 struct transDebugInfo {
251     long tid;
252     long time;
253     long creationTime;
254     long returnCode;
255     long volid;
256     long partition;
257     short iflags;
258     char vflags;
259     char tflags;
260     char lastProcName[30];
261     long callValid;
262     long readNext;
263     long transmitNext;
264     long lastSendTime;
265     long lastReceiveTime;
268 struct pIDs {
269     long partIds[26];           /* -1 if none */
272 struct diskPartition {
273     char name[32];
274     char devName[32];
275     long lock_fd;
276     long totalUsable;
277     long free;
278     long minFree;
281 struct restoreCookie {
282     char name[32];
283     long type;
284     long clone;
285     long parent;
287   
288 typedef transDebugInfo transDebugEntries<>;
289 typedef volintInfo volEntries<>;
290 typedef xvolintInfo xvolEntries<>;
291 typedef int32_t part_entries<>;
292 typedef int32_t multi_results<>;
294 struct replica {
295     int32_t trans_id;
296     struct destServer destserver;
299 #define AFS_MAX_DESTINATIONS    255
301 typedef replica manyDests<AFS_MAX_DESTINATIONS>;
303 AFSVolCreateVolume(IN long partition,
304                    IN string name,
305                    IN long type,
306                    IN long parent,
307                    INOUT long *volid,
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<>,
319                     IN int type,
320                     IN long pid,
321                     IN long cloneid) = VOLSIGNALRESTORE;
323 AFSVolRestore(IN long toTrans,
324               IN long flags,
325               IN restoreCookie *cookie) split = VOLRESTORE;
327 AFSVolForward(IN int32_t fromTrans,
328               IN int32_t fromData,
329               IN struct destServer *destination,
330               IN long destTrans,
331               IN struct restoreCookie *cookie) = VOLFORWARD;
333 AFSVolClone(IN long trans,
334             IN long purgeVol,
335             IN long newType,
336             IN string newName,
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,
346                   IN long partition,
347                   IN long flags,
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,
366                   IN string name<>,
367                   IN long type,
368                   IN long pId,
369                   IN long cloneId,
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,
381                   IN long flags,
382                   OUT struct volEntries *resultEntries) = VOLLISTVOLUMES;
384 AFSVolListOneVolume(IN long partID,
385                     IN long volid,
386                     OUT struct volEntries *resultEntries) = VOLLISTONEVOLUME;
388 AFSVolGetNthVolume(IN long index,
389                    OUT long *volume,
390                    OUT long *partition) = VOLGETNTHVOLUME;
392 AFSVolMonitor(OUT transDebugEntries *result) = VOLMONITOR;
393     
394 AFSVolXListVolumes(IN long partID,
395                    IN long flags,
396                    OUT struct xvolEntries *resultEntries) = VOLXLISTVOLUMES;
398 AFSVolXListOneVolume(IN long partID,
399                      IN long volid,
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,
408                       IN int32_t fromData,
409                       IN manyDests *destinations,
410                       IN long spare0,
411                       IN struct restoreCookie *cookie,
412                       OUT multi_results *results) = VOLFORWARDMULTIPLE;