death to trailing whitespace
[openafs.git] / src / bubasics / butc.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 package TC_
11 prefix S
12 statindex 4
13
14 /*
15 #define TCPERFORMDUMP           100
16 #define TCPERFORMRESTORE        101
17 #define TCCHECKDUMP             102
18 #define TCABORTDUMP             103
19 #define TCWAITFORDUMP           104
20 #define TCENDDUMP               105
21 #define TCGETTMINFO             106
22 #define TCLABELTAPE             107
23 #define TCSCANNODES             108
24 #define TCREADLABEL             109
25 #define TCSCANDUMPS             110
26 #define TCGETTCINFO             111
27 #define TCSAVEDB                112
28 #define TCRESTOREDB             113
29 #define TCGETSTATUS             114
30 #define TCREQUESTABORT          115
31 #define TCENDSTATUS             116
32 #define TCSCANSTATUS            117
33 #define TCDELETEDUMP            118
34 */
35
36 /*random constants */
37 /* there should be a single consistent set of these */
38
39 const TC_MAXDUMPPATH = 256;     /* dump path names*/
40 const TC_MAXNAMELEN = 64;       /* name length */
41 const TC_MAXARRAY = 2000000000; /* max volumes to dump */
42 const TC_MAXFORMATLEN = 100;    /*size of the format statement */
43 const TC_MAXHOSTLEN = 32;       /*for server/machine names */
44 const TC_MAXTAPELEN = 32;       /*max tape name allowed */
45 /*This specifies the interface to the tape coordinator*/
46 /*describes the information that should be dumped to dump a single
47 volume*/
48
49 struct tc_dumpDesc
50 {
51     afs_int32 vid;                      /* volume to dump */
52     afs_int32 vtype;                /* volume type */
53     char name[TC_MAXNAMELEN];   /* name of volume whose clone is to be dumped*/
54     afs_int32 partition;                /* partition at which to find the volume */
55     afs_int32 date;                     /* date from which to do the dump */
56     afs_int32 cloneDate;                /* clone date of the volume */
57     afs_uint32 hostAddr;                /* file server for this volume */
58 };
59
60 /*define how to restore a volume */
61 const RDFLAG_LASTDUMP = 0x1;
62 const RDFLAG_SKIP     = 0x2;
63 const RDFLAG_FIRSTDUMP = 0x4;
64 struct tc_restoreDesc {
65         afs_int32 flags;
66         char tapeName[TC_MAXTAPELEN];   /*name of tape, the frag is on*/
67         afs_uint32 dbDumpId;                /* The dump id of the tape */
68         afs_uint32 initialDumpId;           /* The initial dump id of the tape */
69         afs_int32 position;             /*start position of frag on tape */
70         afs_int32 origVid;              /* original volume id */
71         afs_int32 vid;                  /* 0 means allocate new volid */
72         afs_int32 partition;            /* where to restore the volume */
73         afs_int32 dumpLevel;            /* flags */
74         afs_uint32 hostAddr;    /* file server to restore the volume to */
75         char oldName[TC_MAXNAMELEN];   /*name of volume whose clone is to be dumped */
76         opaque newName[TC_MAXNAMELEN];  /* new name suffix */
77
78 };
79
80 /*describes the current status of a dump */
81 struct tc_dumpStat {
82         afs_int32 dumpID;               /* dump id we're returning */
83         afs_uint32 KbytesDumped;        /* Kbytes dumped so far */
84         afs_uint32 bytesDumped; /* remainder bytes dumped so far */
85         afs_int32 volumeBeingDumped;    /* guess ?*/
86         afs_int32 numVolErrs;   /* # of volumes that had errors in processing */
87         afs_int32 flags;                /* true if the dump is done */
88 };
89
90 /*identifier for a tape */
91 struct tc_tapeLabel {
92         afs_int32 size;                      /* size of tape in bytes */
93         char afsname[TC_MAXTAPELEN];     /* ascii AFS name, defaults to NULL */
94         char pname[TC_MAXTAPELEN];       /* ascii permanent name, defaults to NULL */
95         afs_uint32 tapeId;           /* The tapeId (or dumpId of the initial dump) */
96 };
97
98 /* structure to describe tapes */
99 struct tc_TMInfo {
100         afs_int32 capacity;             /* in 1024 byte units */
101         afs_int32 flags;                /* flags, unused at present */
102 };
103
104 struct tc_tapeSet { /* describes a tape sequence */
105     afs_int32  id;                              /* unique id of tapeSet, assigned by budb */
106     char  tapeServer[TC_MAXHOSTLEN];    /* name of server where this tape is */
107     char  format[TC_MAXFORMATLEN];      /* for using printf to make tape name */
108     int   maxTapes;                     /* maximum number of tapes in seq. */
109     afs_int32  a; afs_int32 b;                  /* linear transforms for tape */
110
111     afs_int32  expDate;                 /* expiration date */
112     afs_int32  expType;                 /* absolute or relative expiration */
113 };
114
115 /* identifies the tape coordinator interface */
116 struct tc_tcInfo
117 {
118     afs_int32   tcVersion;              /* for the interface & this struct */
119 };
120
121 /* flag definition constants */
122 const TC_STAT_DONE = 1; /* all done */
123 const TC_STAT_OPRWAIT = 2;      /* waiting for user interaction */
124 const TC_STAT_DUMP = 4; /* true if dump, false if restore */
125 const TC_STAT_ABORTED = 8;      /* the operation was aborted */
126 const TC_STAT_ERROR = 16;       /* some error ocuured in the operation */
127
128 /* flags for ScanStatus */
129
130 %#define TSK_STAT_FIRST         0x1     /* get id of first task */
131 %#define TSK_STAT_END           0x2     /* no more tasks */
132 %#define TSK_STAT_NOTFOUND      0x4     /* couldn't find task id requested */
133 %#define TSK_STAT_XBSA         0x10     /* An XBSA server */
134 %#define TSK_STAT_ADSM         0x20     /* An ADSM XBSA server */
135
136 typedef struct tc_dumpDesc tc_dumpArray<TC_MAXARRAY>;
137 typedef struct tc_restoreDesc tc_restoreArray<TC_MAXARRAY>;
138
139 /* interface structure */
140 struct tc_dumpInterface
141 {
142     char dumpPath[TC_MAXDUMPPATH];              /* full dump path */
143     char volumeSetName[TC_MAXNAMELEN];          /* volume set name */
144     char dumpName[TC_MAXNAMELEN];               /* volset.dump */
145     struct tc_tapeSet tapeSet;
146     afs_int32 parentDumpId;
147     afs_int32 dumpLevel;
148     int  doAppend;                              /* Append dump to the dump set */
149 };
150
151 struct tciStatusS
152 {
153     char        taskName[TC_MAXNAMELEN];        /* task name */
154     afs_uint32  taskId;                         /* The id for the task */
155     afs_uint32      flags;                          /* as above */
156     afs_uint32      dbDumpId;                       /* dump id */
157     afs_uint32      nKBytes;                        /* bytes xferred */
158     char        volumeName[TC_MAXNAMELEN];      /* current volume (if any) */
159     afs_int32   volsFailed;                     /* # operation failures */
160     afs_int32        lastPolled;                     /* last successful poll */
161 };
162
163 /* Start a dump, given a dump set name, a tape set name and the volumes to
164  * dump.
165  */
166
167 proc PerformDump(IN struct tc_dumpInterface *tcdiPtr,
168                  tc_dumpArray *dumps,
169                  OUT afs_int32 *dumpID);
170
171 /* Start a restore, given a dump set name, a tape set name and the volumes to
172  * dump.
173  */
174 proc PerformRestore(IN string dumpSetName<TC_MAXNAMELEN>,
175     tc_restoreArray *restores,
176     OUT afs_int32 *dumpID);
177
178 /* check the status of a dump; the tape coordinator is assumed to sit on
179  * the status of completed dumps for a reasonable period (2 - 12 hours)
180  * so that they can be examined later
181  */
182 /*
183  * proc CheckDump(IN afs_int32 dumpID, OUT struct tc_dumpStat *status);
184  */
185
186 /* abort a dump */
187 /*
188  * proc AbortDump(IN afs_int32 dumpID);
189  */
190
191 /* this call waits for a dump to complete; it ties up an LWP on the tape
192 coordinator */
193 /*
194  * proc WaitForDump(IN afs_int32 dumpID);
195  */
196
197 /* close a dump normally (not abort) */
198 /*
199  * proc EndDump(IN afs_int32 dumpID);
200  */
201
202 /*
203  * proc GetTMInfo(OUT struct tc_TMInfo *info);
204  */
205
206 proc LabelTape
207  ( IN struct tc_tapeLabel *label,
208    OUT afs_uint32 *taskId
209  );
210
211 /*
212  * proc ScanNodes(IN afs_int32 index, OUT afs_int32 *nodeID);
213  */
214
215 proc ReadLabel
216  ( OUT struct tc_tapeLabel *label,
217    OUT afs_uint32 *taskId
218  );
219
220 proc ScanDumps
221  ( IN afs_int32 addDbFlag,
222   OUT afs_uint32 *taskId
223  );
224
225 /* For returning information about the butc interface.
226  * Currently this is just the version number
227  */
228
229 proc TCInfo(OUT struct tc_tcInfo *tciptr);
230
231 /* for database dump/restores */
232
233 proc SaveDb(IN afs_uint32 archiveTime, OUT afs_uint32 *taskId );
234
235 proc RestoreDb( OUT afs_uint32 *taskId );
236
237
238 /* new status management - PA */
239
240 proc EndStatus( IN  afs_uint32 taskId );
241
242 proc GetStatus
243  ( IN  afs_uint32 taskId,
244    OUT struct tciStatusS *statusPtr
245  );
246
247 proc RequestAbort( IN  afs_uint32 taskId );
248
249 proc ScanStatus
250  ( INOUT afs_uint32     *taskId,
251    OUT struct tciStatusS *statusPtr,
252    INOUT afs_uint32     *flags
253  );
254
255 proc DeleteDump
256  ( IN afs_uint32  aDumpId,
257    OUT afs_uint32 *taskId
258  );
259