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