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