vos: complain if no fields are passed
[openafs.git] / src / volser / volint.xg
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11  *  Module:         Volint.xg
12  *  System:         Volser
13  *  Instituition:           ITC, CMU
14  *  Date:                   December, 88
15  */
16
17 package AFSVol
18 prefix S
19 statindex 16
20
21 #define     VOLCREATEVOLUME     100
22 #define     VOLDELETEVOLUME     101
23 #define     VOLRESTORE          102
24 #define     VOLFORWARD          103
25 #define     VOLENDTRANS         104
26 #define     VOLCLONE            105
27 #define     VOLSETFLAGS         106
28 #define     VOLGETFLAGS         107
29 #define     VOLTRANSCREATE      108
30 #define     VOLDUMP             109
31 #define     VOLGETNTHVOLUME     110
32 #define     VOLSETFORWARDING    111  /* defunct */
33 #define     VOLGETNAME          112
34 #define     VOLGETSTATUS        113
35 #define             VOLSIGRESTORE       114
36 #define     VOLLISTPARTITIONS   115
37 #define     VOLLISTVOLS         116
38 #define             VOLSETIDSTYPES      117
39 #define             VOLMONITOR          118
40 #define             VOLDISKPART 119
41 #define         VOLRECLONE      120
42 #define     VOLLISTONEVOL       121
43 #define         VOLNUKE         122
44 #define         VOLSETDATE      123
45 #define         VOLXLISTVOLS    124
46 #define         VOLXLISTONEVOL  125
47 #define     VOLSETINFO          126
48 #define     VOLXLISTPARTITIONS  127
49 #define     VOLFORWARDMULTIPLE  128
50 #define     VOLCONVERTRO        65536
51 #define     VOLGETSIZE          65537
52 #define     VOLDUMPV2           65538
53 #define     VOLDISKPART64       65539
54 #define     VOLOSDSUPPORT       65540
55 #define     VOLTRAVERSE         65541
56 #define     VOLWIPECAND         65542
57 #define     OLDVOLSALVAGE       65543
58 #define     VOLARCHCANDold      65544
59 #define     VOLSALVAGE          65545
60 #define     VOLLISTOBJECTS      65546
61 #define     VOLSPLIT            65547
62 #define     VOLARCHCAND         65548
63
64 /* Bits for flags for DumpV2 */
65 %#define     VOLDUMPV2_OMITDIRS 1
66
67 const SIZE = 1024;
68
69 struct volser_status {
70         afs_uint32 volID;               /* Volume id--unique over all systems */
71         afs_int32 nextUnique;           /* Next vnode uniquifier for this volume */
72         int type;                       /* readwrite, etc. */
73         afs_uint32 parentID;            /* Id of parent, if type==readonly or backup */
74         afs_uint32 cloneID;             /* Latest read-only clone, if type==readwrite */
75         afs_uint32 backupID;            /* Latest backup copy of this read write volume */
76         afs_uint32 restoredFromID;      /* The id in a dump this volume was restored from--used simply
77                                    to make sure that an incremental dump is not restored on top
78                                    of something inappropriate:  Note:  this field itself is NEVER
79                                    dumped!!! */
80         afs_int32 maxQuota;             /* Quota maximum, 1K blocks */
81         afs_int32 minQuota;             /* Quota minimum, 1K blocks */
82         afs_int32 owner;                /* The person responsible for this volume */
83         afs_int32 creationDate;         /* Creation date for a read/write
84                                    volume; cloning date for original copy of
85                                    a readonly volume (replicated volumes have
86                                    the same creation date) */
87         afs_int32 accessDate;           /* Last access time by a user, large granularity */
88         afs_int32 updateDate;           /* Last modification by user */
89         afs_int32 expirationDate;               /* 0 if it never expires */
90         afs_int32 backupDate;           /* last time a backup clone was taken */
91         afs_int32 copyDate;             /* Time that this copy of this volume was created */
92 };
93
94 struct destServer {
95     afs_int32 destHost;
96     afs_int32 destPort;
97     afs_int32 destSSID;
98 };
99
100
101 struct volintInfo {
102 #define VNAMESIZE 32
103     char name[VNAMESIZE];
104     afs_uint32 volid;           /* volume's id */
105     afs_int32 type;             /* read-only, read-write, backup */
106     afs_uint32 backupID;
107     afs_uint32 parentID;
108     afs_uint32 cloneID;
109     afs_int32 status;
110     afs_int32 copyDate;
111     unsigned char inUse;
112     unsigned char needsSalvaged;
113     unsigned char destroyMe;
114     afs_int32 creationDate;
115     afs_int32 accessDate;
116     afs_int32 updateDate;
117     afs_int32 backupDate;
118     int dayUse;
119     int filecount;
120     int maxquota;
121     int size;
122     afs_int32 flags;            /* used by the backup system */
123     afs_int32 spare0;           /* Used to hold the minquota value */
124     afs_int32 spare1;           /* Used to hold the weekuse value */
125     afs_int32 spare2;           /* Used to hold volUpdateCounter */
126     afs_int32 spare3;
127 };
128
129 /*
130  * Define some values needed for the detailed volume info structure.
131  */
132 const VOLINT_STATS_NUM_RWINFO_FIELDS = 4;
133
134 const VOLINT_STATS_SAME_NET      = 0;   /*Within same site (total)*/
135 const VOLINT_STATS_SAME_NET_AUTH = 1;   /*Within same site (authenticated);
136                                           (must be 1 more than above)*/
137 const VOLINT_STATS_DIFF_NET      = 2;   /*From external site (total)*/
138 const VOLINT_STATS_DIFF_NET_AUTH = 3;   /*From external site (authenticated)
139                                           (must be 1 more than above)*/
140
141 const VOLINT_STATS_NUM_TIME_RANGES = 6;
142
143 const VOLINT_STATS_TIME_CAP_0   =     60;  /*60 seconds*/
144 const VOLINT_STATS_TIME_CAP_1   =    600;  /*10 minutes, in seconds*/
145 const VOLINT_STATS_TIME_CAP_2   =   3600;  /*1 hour, in seconds*/
146 const VOLINT_STATS_TIME_CAP_3   =  86400;  /*1 day, in seconds*/
147 const VOLINT_STATS_TIME_CAP_4   = 604800;  /*1 week, in seconds*/
148
149 const VOLINT_STATS_NUM_TIME_FIELDS = 6;
150
151 const VOLINT_STATS_TIME_IDX_0 = 0;      /*0 secs to 60 secs*/
152 const VOLINT_STATS_TIME_IDX_1 = 1;      /*1 min to 10 mins*/
153 const VOLINT_STATS_TIME_IDX_2 = 2;      /*10 mins to 60 mins*/
154 const VOLINT_STATS_TIME_IDX_3 = 3;      /*1 hr to 24 hrs*/
155 const VOLINT_STATS_TIME_IDX_4 = 4;      /*1 day to 7 days*/
156 const VOLINT_STATS_TIME_IDX_5 = 5;      /*Greater than 1 week*/
157
158 /*
159  * More detailed volume info
160  */
161 struct volintXInfo {
162     char name[VNAMESIZE];
163     afs_uint32 volid;                   /*Volume's ID*/
164     afs_int32 type;                     /*RWVOL, ROVOL, BACKVOL*/
165     afs_uint32 backupID;                /*Backup volume ID*/
166     afs_uint32 parentID;                /*Parent volume ID*/
167     afs_uint32 cloneID;         /*Clone volume ID*/
168     afs_int32 status;           /*Volume status*/
169     afs_int32 copyDate;         /*Date when this volume INSTANCE created*/
170     unsigned char inUse;        /*In use at time of last crash?*/
171     afs_int32 creationDate;             /*Date when this volume was created*/
172     afs_int32 accessDate;               /*Date when this volume was last accessed*/
173     afs_int32 updateDate;               /*Date when this volume was last updated*/
174     afs_int32 backupDate;               /*Date when this volume was last backed up*/
175     int dayUse;                 /*Number of accesses since midnight*/
176     int filecount;              /*Number of files in the volume*/
177     int maxquota;               /*Max volume quota, in Kbytes*/
178     int size;                   /*Current size in Kbytes*/
179     /*
180      * Detailed statistics for reads/writes and authorship.
181      */
182     afs_int32 stat_reads[VOLINT_STATS_NUM_RWINFO_FIELDS];
183     afs_int32 stat_writes[VOLINT_STATS_NUM_RWINFO_FIELDS];
184     afs_int32 stat_fileSameAuthor[VOLINT_STATS_NUM_TIME_FIELDS];
185     afs_int32 stat_fileDiffAuthor[VOLINT_STATS_NUM_TIME_FIELDS];
186     afs_int32 stat_dirSameAuthor[VOLINT_STATS_NUM_TIME_FIELDS];
187     afs_int32 stat_dirDiffAuthor[VOLINT_STATS_NUM_TIME_FIELDS];
188 };
189
190 struct transDebugInfo {
191         afs_int32 tid;           /*transaction id */
192         afs_int32 time;  /* time transaction was last active (for timeouts) */
193         afs_int32 creationTime;    /* time the transaction started */
194         afs_int32 returnCode;       /* transaction error code */
195         afs_uint32 volid;       /*sequence number of the next packet to be read*/ /* open volume's id */
196         afs_int32 partition;        /* open volume's partition */
197         short iflags;       /* initial attach mode flags (IT*) */
198         char vflags;        /* current volume status flags (VT*) */
199         char tflags;        /* transaction flags (TT*) */
200         char lastProcName[30];  /* name of the last procedure which used transaction */
201         int callValid;  /*flag which determines if following data is valid*/
202         afs_int32 readNext;     /*sequence number of the next packet to be read*/
203         afs_int32 transmitNext; /*sequence number of the next packet to be transmitted*/
204         int lastSendTime;
205         int lastReceiveTime;
206 };
207
208 struct pIDs {
209         afs_int32 partIds[26];
210 };
211
212 struct diskPartition {
213         char    name[32];       /* Mounted partition name */
214         char    devName[32];
215         int     lock_fd;        /* assigned from DiskPartition FD_t
216                                    which is 64-bit HANDLE on Windows */
217         int     totalUsable;
218         int     free;
219         int     minFree;
220
221 };
222
223 struct diskPartition64 {
224         char            name[256];      /* Mounted partition name */
225         char            devName[256];
226         int             lock_fd;        /* assigned from DiskPartition64 FD_t
227                                            which is a 64-bit HANDLE on Windows */
228         afs_int64       totalUsable;
229         afs_int64       free;
230         afs_int64       minFree;
231 };
232
233 struct restoreCookie {
234         char name[32];
235         afs_int32 type;
236         afs_uint32 clone;
237         afs_uint32 parent;
238 };
239
240 struct replica {
241         afs_int32 trans;
242         struct destServer server;
243 };
244
245 /*  Various size parameters of the volume  */
246 struct volintSize {
247     afs_uint64 dump_size;
248 };
249
250 typedef  replica manyDests<>;
251 typedef  afs_int32 manyResults<>;
252 typedef  transDebugInfo transDebugEntries<>;
253 typedef  volintInfo volEntries<>;
254 typedef  afs_int32 partEntries<>;
255 typedef  volintXInfo volXEntries<>;
256
257 proc CreateVolume(
258   IN afs_int32 partition,
259   string name<>,
260   IN afs_int32 type,
261   IN afs_uint32 parent,
262   INOUT afs_uint32 *volid,
263   OUT afs_int32 *trans
264 ) = VOLCREATEVOLUME;
265
266 proc DeleteVolume(
267   IN afs_int32 trans
268 ) = VOLDELETEVOLUME;
269
270 proc Restore(
271   IN afs_int32 toTrans,
272   IN afs_int32 flags,
273   IN struct restoreCookie *cookie
274 ) split = VOLRESTORE;
275
276 proc Forward(
277   IN afs_int32 fromTrans,
278   IN afs_int32 fromDate,
279   IN struct destServer *destination,
280   IN afs_int32 destTrans,
281   IN struct restoreCookie *cookie
282 ) = VOLFORWARD;
283
284 proc EndTrans(
285   IN afs_int32 trans,
286   OUT afs_int32 *rcode
287 ) = VOLENDTRANS;
288
289 proc Clone(
290   IN afs_int32 trans,
291   IN afs_uint32 purgeVol,
292   IN afs_int32 newType,
293   IN string newName<>,
294   INOUT afs_uint32 *newVol
295 ) = VOLCLONE;
296
297 proc SetFlags(
298   IN afs_int32 trans,
299   IN afs_int32 flags
300 ) = VOLSETFLAGS;
301
302 proc GetFlags(
303   IN afs_int32 trans,
304   OUT afs_int32 *flags
305 ) = VOLGETFLAGS;
306
307 proc TransCreate(
308   IN afs_uint32 volume,
309   IN afs_int32 partition,
310   IN afs_int32 flags,
311   OUT afs_int32 *trans
312 ) = VOLTRANSCREATE;
313
314 proc Dump(
315   IN afs_int32 fromTrans,
316   IN afs_int32 fromDate
317 ) split = VOLDUMP;
318
319 proc GetNthVolume(
320   IN afs_int32 index,
321   OUT afs_uint32 *volume,
322   OUT afs_int32 *partition
323 ) = VOLGETNTHVOLUME;
324
325 proc SetForwarding(
326   IN afs_int32 tid,
327   IN afs_int32 newsite
328 ) = VOLSETFORWARDING;
329
330 proc GetName(
331   IN afs_int32 tid,
332   OUT string tname<256>
333 ) = VOLGETNAME;
334
335 proc GetStatus(
336   IN afs_int32 tid,
337   OUT struct volser_status *status
338 ) = VOLGETSTATUS;
339
340 proc SignalRestore(
341   IN string name<>,
342   int type,
343   afs_uint32 pid,
344   afs_uint32 cloneid
345 ) = VOLSIGRESTORE;
346
347 proc ListPartitions(
348   OUT struct pIDs *partIDs
349 ) = VOLLISTPARTITIONS;
350
351 proc ListVolumes(
352   IN afs_int32 partID,
353   afs_int32 flags,
354   OUT volEntries *resultEntries
355 ) = VOLLISTVOLS;
356
357 proc SetIdsTypes(
358   IN afs_int32 tId,
359   string name<>,
360   afs_int32 type,
361   afs_uint32 pId,
362   afs_uint32 cloneId,
363   afs_uint32 backupId
364 ) = VOLSETIDSTYPES;
365
366 proc Monitor(
367   OUT transDebugEntries *result
368 ) = VOLMONITOR;
369
370 proc PartitionInfo(
371   IN string name<>,
372   OUT struct diskPartition *partition
373 ) = VOLDISKPART;
374
375 proc ReClone(
376   IN afs_int32 tid,
377   afs_uint32 cloneID
378 ) = VOLRECLONE;
379
380 proc ListOneVolume(
381   IN afs_int32 partID,
382   afs_uint32 volid,
383   OUT volEntries *resultEntries
384 ) = VOLLISTONEVOL;
385
386 proc NukeVolume(
387   IN afs_int32 partID,
388   afs_uint32 volID
389 ) = VOLNUKE;
390
391 proc SetDate(
392   IN afs_int32 tid,
393   afs_int32 newDate
394 ) = VOLSETDATE;
395
396 proc XListVolumes(
397   IN afs_int32 partID,
398   afs_int32 flags,
399   OUT volXEntries *resultXEntriesP
400 ) = VOLXLISTVOLS;
401
402 proc XListOneVolume(
403   IN afs_int32 partID,
404   afs_uint32 volid,
405   OUT volXEntries *resultXEntries
406 ) = VOLXLISTONEVOL;
407
408 proc SetInfo(
409   IN afs_int32 tid,
410   struct volintInfo *status
411 ) = VOLSETINFO;
412
413 proc XListPartitions(
414   OUT struct partEntries *partIDs
415 ) = VOLXLISTPARTITIONS;
416
417 proc ForwardMultiple(
418   IN afs_int32 fromTrans,
419   IN afs_int32 fromDate,
420   IN manyDests *destinations,
421   IN afs_int32 spare,
422   IN struct restoreCookie *cookie,
423   OUT manyResults *results
424 ) = VOLFORWARDMULTIPLE;
425
426 proc ConvertROtoRWvolume(
427   IN afs_int32 partid,
428   IN afs_uint32 volid
429 ) = VOLCONVERTRO;
430
431 proc GetSize(
432   IN afs_int32 fromTrans,
433   IN afs_int32 fromDate,
434   OUT struct volintSize *size
435 ) = VOLGETSIZE;
436
437 proc DumpV2(
438   IN afs_int32 fromTrans,
439   IN afs_int32 fromDate,
440   IN afs_int32 flags
441 ) split = VOLDUMPV2;
442
443 proc PartitionInfo64(
444     IN string name<>,
445     OUT struct diskPartition64 *partition
446 ) = VOLDISKPART64;
447
448 proc SplitVolume (
449   IN afs_uint32 vid,
450   IN afs_uint32 newid,
451   IN afs_uint32 where,
452   IN afs_int32 verbose
453 ) split = VOLSPLIT;