Commit | Line | Data |
---|---|---|
805e021f CE |
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 | #ifndef __BUBASIC__ | |
11 | #define __BUBASIC__ | |
12 | ||
13 | /* version numbers. This version information is accessed from more than | |
14 | * one module. Version information is kept for: | |
15 | * bucoord <-> butc interface | |
16 | * butc <-> butm interface | |
17 | * bu* <-> budb interface | |
18 | * | |
19 | * and as an interim measure, for | |
20 | * dumpschedule files | |
21 | * dump database files i.e. D*.db | |
22 | */ | |
23 | ||
24 | /* Version of butc <-> butm interface | |
25 | * These are not version flags as the name suggests. | |
26 | */ | |
27 | ||
28 | #define BUTM_VERSIONFLAG_0 0 /* every size measure is in bytes */ | |
29 | #define BUTM_VERSIONFLAG_1 1 /* every size measure is in kbytes */ | |
30 | #define BUTM_VERSIONFLAG_2 2 /* afs 3.1 features */ | |
31 | ||
32 | /* current version of the interface */ | |
33 | #define BUTM_MAJORVERSION BUTM_VERSIONFLAG_2 | |
34 | ||
35 | /* versions for the bucoord <-> butc interface */ | |
36 | #define BUTC_VERSION_1 1 /* initial version, afs 3.1 */ | |
37 | #define BUTC_VERSION_2 2 /* 3.4 version - added voltype to tc_dumpDesc */ | |
38 | #define BUTC_VERSION_3 3 /* 3.4 version - labeltape change */ | |
39 | #define CUR_BUTC_VERSION BUTC_VERSION_3 | |
40 | ||
41 | /* TAPE_VERSION Version of the current tape format used by butc | |
42 | * Notes: | |
43 | * | |
44 | * version 0: ?? - sizes in bytes | |
45 | * version 1: Sizes in kbytes. | |
46 | * version 2: | |
47 | * 1) Tape expiration information in label | |
48 | * 2) backup systems's EOT markers at the end of a dump | |
49 | * version 3: | |
50 | * 1) dump id and tape use count in label | |
51 | * version 4: | |
52 | * 1) Got rid of large EOT markers | |
53 | * 2) Supports appended dumps | |
54 | */ | |
55 | ||
56 | #define TAPE_VERSION_0 0 | |
57 | #define TAPE_VERSION_1 1 | |
58 | #define TAPE_VERSION_2 2 | |
59 | #define TAPE_VERSION_3 3 | |
60 | #define TAPE_VERSION_4 4 | |
61 | #define CUR_TAPE_VERSION TAPE_VERSION_4 | |
62 | ||
63 | #define BC_SCHEDULE_MAGIC 0x74327285 /* magic # for schedules */ | |
64 | #define BC_SCHEDULE_V3_1 1 /* afs 3.1 */ | |
65 | #define BC_SCHEDULE_VERSION BC_SCHEDULE_V3_1 /* current version */ | |
66 | ||
67 | #define BC_DUMPDB_MAGIC 0x10381645 /* magic # for dump db */ | |
68 | #define BC_DUMPDB_V3_1 1 /* afs 3.1 */ | |
69 | #define BC_DUMPDB_VERSION BC_DUMPDB_V3_1 /* current version */ | |
70 | ||
71 | /* define ports that move to system configuration later */ | |
72 | #define BC_MESSAGEPORT 7020 /* for communicating with backup coordinator */ | |
73 | #define BC_TAPEPORT 7025 /* for communicating with tape controller */ | |
74 | ||
75 | #ifndef AFSCONF_BUDBPORT | |
76 | #define AFSCONF_BUDBPORT 7021 /* for communicating with backup database */ | |
77 | #endif | |
78 | #define BUDB_SERVICE 22314 /* service id */ | |
79 | ||
80 | /* maximums for various text strings | |
81 | * DON'T alter these values until all disk/tape structures can be handled | |
82 | * correctly. In particular, volume names are 64. | |
83 | */ | |
84 | ||
85 | /* dump states */ | |
86 | #define DUMP_FAILED 1 /* outright failed */ | |
87 | #define DUMP_PARTIAL 2 /* partial on tape */ | |
88 | #define DUMP_SUCCESS 3 /* all ok */ | |
89 | #define DUMP_RETRY 4 /* failed, but retry */ | |
90 | #define DUMP_NORETRYEOT 5 /* failed, and don't retry */ | |
91 | #define DUMP_NOTHING 6 /* Nothing was dumped */ | |
92 | #define DUMP_NODUMP 7 /* don't dump, and don't retry */ | |
93 | ||
94 | ||
95 | #define BU_MAXNAMELEN 32 /* max for misc. names: eg volumes */ | |
96 | #define BU_MAXTAPELEN 32 /* for tape names */ | |
97 | #define BU_MAXHOSTLEN 32 /* for server (machine) names */ | |
98 | #define BU_MAXTOKENLEN 16 /* identifiers */ | |
99 | #define BU_MAXUNAMELEN 256 /* length of a user name */ | |
100 | #define BU_MAXCELLLEN 256 /* length of a cell name */ | |
101 | ||
102 | /* proposed maximum name lengths PA */ | |
103 | #define BU_MAX_NAME 64 /* misc. names */ | |
104 | #define BU_MAX_DUMP_PATH 256 /* length of schedule path name */ | |
105 | ||
106 | #define BC_MAXPORTOFFSET 58510 /* max number of port offsets in database */ | |
107 | ||
108 | #ifndef NEVERDATE | |
109 | #define NEVERDATE 037777777777 /* a date that will never come */ | |
110 | #endif | |
111 | #ifndef NEVERSTRING | |
112 | #define NEVERSTRING "NEVER \n" | |
113 | #endif | |
114 | #define cTIME(t) ( (*(t) == NEVERDATE) ? (char *)NEVERSTRING : (char *)ctime(t) ) | |
115 | ||
116 | #ifndef Date | |
117 | #define Date afs_uint32 | |
118 | #endif | |
119 | ||
120 | #define DUMP_TAPE_NAME "Ubik_db_dump" /* base database tape name */ | |
121 | ||
122 | /* for expiration date processing */ | |
123 | #define BC_NO_EXPDATE 0 /* no expiration date */ | |
124 | #define BC_ABS_EXPDATE 1 /* absolute expiration date */ | |
125 | #define BC_REL_EXPDATE 2 /* relative expiration date */ | |
126 | ||
127 | /*macro which generates tape names from tapeSetName */ | |
128 | #define tc_MakeTapeName(name,set,seq) \ | |
129 | sprintf (name, (set)->format, (seq) + (set)->b) | |
130 | ||
131 | /* common structure definitions */ | |
132 | struct dlqlink { | |
133 | struct dlqlink *dlq_next; | |
134 | struct dlqlink *dlq_prev; | |
135 | afs_int32 dlq_type; | |
136 | void *dlq_structPtr; /* enclosing structure */ | |
137 | }; | |
138 | ||
139 | typedef struct dlqlink dlqlinkT; | |
140 | typedef dlqlinkT *dlqlinkP; | |
141 | ||
142 | ||
143 | /* invariants */ | |
144 | #define DLQ_HEAD 1001 | |
145 | ||
146 | #define DLQ_VOLENTRY 10 | |
147 | #define DLQ_FINISHTAPE 11 | |
148 | #define DLQ_USETAPE 12 | |
149 | #define DLQ_FINISHDUMP 13 | |
150 | #define DLQ_USEDUMP 14 | |
151 | ||
152 | /* simple assertion - for testing, don't halt processing */ | |
153 | ||
154 | #define DLQASSERT(condition) \ | |
155 | if ( (condition) == 0 ) \ | |
156 | { \ | |
157 | printf("DLQASSERT: %s failed\n", #condition); \ | |
158 | } | |
159 | ||
160 | /* function typing */ | |
161 | extern dlqlinkP dlqFront(dlqlinkP); | |
162 | extern dlqlinkP dlqUnlinkb(dlqlinkP); | |
163 | extern dlqlinkP dlqUnlinkf(dlqlinkP); | |
164 | ||
165 | /* ----------------------------- | |
166 | * Status management | |
167 | * ----------------------------- | |
168 | */ | |
169 | ||
170 | /* status management flags | |
171 | * | |
172 | * Key to comments: | |
173 | * C - client side only | |
174 | * S - server side only | |
175 | * B - client or server | |
176 | */ | |
177 | ||
178 | #define STARTING 0x1 /* C; still setting up, no server task yet */ | |
179 | #define ABORT_REQUEST 0x2 /* B; user requested abort */ | |
180 | #define ABORT_SENT 0x4 /* C; abort sent to server (REQ cleared) */ | |
181 | #define ABORT_DONE 0x8 /* S; abort complete on server */ | |
182 | #define ABORT_LOCAL 0x10 /* C; abort local task if contact lost */ | |
183 | #define TASK_DONE 0x20 /* B; task complete */ | |
184 | #define SILENT 0x400 /* C; don't be verbose about termination */ | |
185 | #define NOREMOVE 0x1000 /* C; don't remove from queue */ | |
186 | ||
187 | /* comm status */ | |
188 | #define CONTACT_LOST 0x40 /* B; contact lost */ | |
189 | ||
190 | /* errror handling */ | |
191 | #define TASK_ERROR 0x80 /* S; had fatal error, will terminate */ | |
192 | ||
193 | /* general status - copied back to client for jobs status */ | |
194 | #define DRIVE_WAIT 0x100 /* S; waiting for drive to become free */ | |
195 | #define OPR_WAIT 0x200 /* S; waiting for operator action */ | |
196 | #define CALL_WAIT 0x800 /* S; waiting for callout routine completion */ | |
197 | ||
198 | struct statusS { | |
199 | dlqlinkT link; | |
200 | ||
201 | afs_uint32 taskId; /* task identifier */ | |
202 | afs_uint32 dbDumpId; /* dump id */ | |
203 | afs_uint32 flags; /* as above */ | |
204 | afs_uint32 nKBytes; /* bytes xferred */ | |
205 | char volumeName[BU_MAXNAMELEN]; /* current volume (if any) */ | |
206 | afs_int32 volsFailed; /* # operation failures */ | |
207 | afs_int32 lastPolled; /* last successful poll */ | |
208 | ||
209 | /* bucoord local */ | |
210 | char taskName[64]; /* type of task */ | |
211 | afs_int32 port; | |
212 | afs_int32 jobNumber; | |
213 | afs_int32 volsTotal; /* total # vols */ | |
214 | afs_int32 scheduledDump; /* Time this dump was scheduled */ | |
215 | char *cmdLine; /* Command to exectute for this dump */ | |
216 | }; | |
217 | ||
218 | typedef struct statusS statusT; | |
219 | typedef statusT *statusP; | |
220 | ||
221 | #endif |