2 * Copyright 2000, International Business Machines Corporation and others.
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
15 #include <afs/bubasics.h>
18 /* node with info on each dump of interest, associated with taskID
20 * G - generated by butc
24 /* administrative fields */
25 afs_int32 taskID; /* the task id */
26 struct dumpNode *next; /* ptr to the next node on the list */
27 statusP statusNodePtr; /* status node pointer */
29 /* common to dumps and restores */
30 afs_int32 arraySize; /* Size of dump/restore array */
32 /* specific to dumps */
33 char dumpSetName[TC_MAXNAMELEN]; /* name of the dump "<volset>.<dump>" */
34 char *dumpName; /* full dump path */
35 char *volumeSetName; /* volume set */
36 struct tc_tapeSet tapeSetDesc; /* description of the tape set */
37 struct tc_dumpDesc *dumps; /* list of vols to dump */
38 afs_int32 parent; /* parent dump ID, from main call */
39 afs_int32 level; /* this dump's level, from main call */
40 int doAppend; /* Append this dump to a dump set */
42 /* restore specific */
43 struct tc_restoreDesc *restores; /* info needed to restore volumes */
46 struct deviceSyncNode {
47 struct Lock lock; /* this is used to synchronise access to tape drive */
51 /* flags used to monitor status of dumps/restores */
52 #define INPROGRESS 0x01 /*dump is in progress */
53 #define ABORT 0x02 /*abort this dump */
54 #define ABORTED 0x04 /*aborted this dump */
55 #define DONE 0x08 /*done with this dump */
56 #define WAITING 0x10 /*someone is waiting on this dump */
57 #define ERROR 0x20 /*error in operation */
58 #define PARTIAL 0x40 /*partial failure in operation */
60 /* define the opcodes */
61 #define DUMP 0x01 /*dumping */
62 #define RESTORE 0x02 /*restoring */
64 /*these definitions are temporary */
66 #define TCSERVICE_ID 10
68 #define TC_GCTIME 300 /* the interval after which the GC is invoked */
69 #define TC_ABORTTIME 30 /*time alotted for process to respond to abort */
70 #define TC_MAXVOLNAME 64 /*this should come from VNAMESIZE in volume header */
71 /*define some magic numbers to be used with volume headers and trailors on tape */
72 #define TC_VOLBEGINMAGIC 0xb0258191 /*32 bit magic numbers */
73 #define TC_VOLENDMAGIC 0x9167345a
74 #define TC_VOLCONTD 0xffffffff
76 #define TC_HEADERFORMAT "H++NAME#%s#ID#%u#SERVER#%x#PART#%u#FROM#%u#FRAG#%d#BM#%u#--H"
77 #define TC_TRAILORFORMAT "T--NAME#%s#ID#%u#SERVER#%x#PART#%u#FROM#%u#FRAG#%d#CONTD#%x#EM#%u#++T"
79 #define TC_TRAILERBEGIN "+=!@#$%><%$#@!=+" /*indicates that trailer follows */
80 #define TC_MAXTAPENAMELEN 100 /*dont know how to estimate these numbers */
81 #define TC_DEVICEINUSE 0x1000 /* used to indicate use of device by somebody */
82 #define TC_NULLTAPENAME "<NULL>" /* default tape name */
83 #define TC_QUOTEDNULLTAPENAME "\"<NULL>\"" /* null tapename in quotes */
85 /* for user prompt generation */
86 #define READOPCODE 0 /* read tape - for restore */
87 #define WRITEOPCODE 1 /* write tape - for dump */
88 #define LABELOPCODE 2 /* label a tape */
89 #define READLABELOPCODE 3 /* read tape label */
90 #define SCANOPCODE 4 /* scan tape contents */
91 #define APPENDOPCODE 5 /* append write tape - for dump */
92 #define SAVEDBOPCODE 6 /* save a database tape */
93 #define RESTOREDBOPCODE 7 /* restore a database tape */
94 #define CLOSEOPCODE 8 /* close a tape drive - for callout */
96 /* marker used on tape. A header is placed (as a separate block) before the
97 * volume data, and is appended (contiguously with the data) to the volume
100 struct volumeHeader {
103 char volumeName[TC_MAXVOLNAME];
106 afs_int32 server; /* which server */
107 afs_int32 part; /* partition vol. was on */
108 afs_int32 from; /* clone date of vol ?? */
110 afs_int32 magic; /* just for checking */
112 char dumpSetName[TC_MAXNAMELEN];
113 afs_int32 dumpID; /* ID of enclosing dump */
114 afs_int32 level; /* dump level, 0=full */
115 afs_int32 parentID; /* ID of parent dump */
117 afs_int32 versionflags; /* previously spare[0] */
118 afs_int32 cloneDate; /* when this vol. was cloned */
119 afs_int32 spares[2]; /* spare used to be spare[4] */
122 /* Interface structure for STC_LabelTape */
125 struct tc_tapeLabel label;
134 /* Interface structure for STC_SaveDb */
142 /* Iterface structure for STC_DeleteDump */
143 struct deleteDumpIf {