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