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