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