Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / libadmin / vos / afs_vosAdmin.h
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 OPENAFS_VOS_ADMIN_H
11 #define OPENAFS_VOS_ADMIN_H
12
13 #include <afs/param.h>
14 #include <afs/afs_Admin.h>
15 #include <sys/types.h>
16 #include <afs/volint.h>
17 #ifdef AFS_NT40_ENV
18 #ifndef _MFC_VER
19 #include <winsock2.h>
20 #endif /* _MFC_VER */
21 #else
22 #include <sys/socket.h>
23 #endif
24
25 #define VOS_MAX_PARTITION_NAME_LEN 32
26 #define VOS_MAX_VOLUME_NAME_LEN 32
27 #define VOS_MAX_VOLUME_TYPES 3
28 #define VOS_MAX_REPLICA_SITES 13
29 #define VOS_MAX_SERVER_ADDRESS 16
30
31 typedef enum {
32 VOS_NORMAL,
33 VOS_FORCE
34 } vos_force_t, *vos_force_p;
35
36 typedef enum {
37 VOS_INCLUDE,
38 VOS_EXCLUDE
39 } vos_exclude_t, *vos_exclude_p;
40
41 typedef enum {
42 VOS_OK,
43 VOS_SALVAGE,
44 VOS_NO_VNODE,
45 VOS_NO_VOL,
46 VOS_VOL_EXISTS,
47 VOS_NO_SERVICE,
48 VOS_OFFLINE,
49 VOS_ONLINE,
50 VOS_DISK_FULL,
51 VOS_OVER_QUOTA,
52 VOS_BUSY,
53 VOS_MOVED
54 } vos_volumeStatus_t, *vos_volumeStatus_p;
55
56 typedef enum {
57 VOS_READ_WRITE_VOLUME,
58 VOS_READ_ONLY_VOLUME,
59 VOS_BACKUP_VOLUME
60 } vos_volumeType_t, *vos_volumeType_p;
61
62 typedef struct vos_fileServerEntry {
63 int serverAddress[VOS_MAX_SERVER_ADDRESS];
64 int count;
65 } vos_fileServerEntry_t, *vos_fileServerEntry_p;
66
67 typedef enum {
68 VOS_VOLUME_READ_WRITE_STATS_SAME_NETWORK,
69 VOS_VOLUME_READ_WRITE_STATS_SAME_NETWORK_AUTHENTICATED,
70 VOS_VOLUME_READ_WRITE_STATS_DIFFERENT_NETWORK,
71 VOS_VOLUME_READ_WRITE_STATS_DIFFERENT_NETWORK_AUTHENTICATED
72 } vos_volumeReadWriteStats_t, *vos_volumeReadWriteStats_p;
73
74 #define VOS_VOLUME_READ_WRITE_STATS_NUMBER 4
75
76 typedef enum {
77 VOS_VOLUME_TIME_STATS_0_TO_60_SECONDS,
78 VOS_VOLUME_TIME_STATS_1_TO_10_MINUTES,
79 VOS_VOLUME_TIME_STATS_10_TO_60_MINUTES,
80 VOS_VOLUME_TIME_STATS_1_TO_24_HOURS,
81 VOS_VOLUME_TIME_STATS_1_TO_7_DAYS,
82 VOS_VOLUME_TIME_STATS_GREATER_THAN_7_DAYS
83 } vos_volumeTimeStats_t, *vos_volumeTimeStats_p;
84
85 #define VOS_VOLUME_TIME_STATS_NUMBER 6
86
87 typedef struct vos_volumeEntry {
88 unsigned int id;
89 unsigned int readWriteId;
90 unsigned int readOnlyId;
91 unsigned int backupId;
92 unsigned long creationDate;
93 unsigned long lastAccessDate;
94 unsigned long lastUpdateDate;
95 unsigned long lastBackupDate;
96 unsigned long copyCreationDate;
97 int accessesSinceMidnight;
98 int fileCount;
99 int maxQuota;
100 int currentSize;
101 int readStats[VOS_VOLUME_READ_WRITE_STATS_NUMBER];
102 int writeStats[VOS_VOLUME_READ_WRITE_STATS_NUMBER];
103 int fileAuthorWriteSameNetwork[VOS_VOLUME_TIME_STATS_NUMBER];
104 int fileAuthorWriteDifferentNetwork[VOS_VOLUME_TIME_STATS_NUMBER];
105 int dirAuthorWriteSameNetwork[VOS_VOLUME_TIME_STATS_NUMBER];
106 int dirAuthorWriteDifferentNetwork[VOS_VOLUME_TIME_STATS_NUMBER];
107 vos_volumeStatus_t status;
108 vos_volumeStatus_t volumeDisposition;
109 vos_volumeType_t type;
110 char name[VOS_MAX_VOLUME_NAME_LEN];
111 } vos_volumeEntry_t, *vos_volumeEntry_p;
112
113 typedef struct vos_partitionEntry {
114 char name[VOS_MAX_PARTITION_NAME_LEN];
115 char deviceName[VOS_MAX_PARTITION_NAME_LEN];
116 int lockFileDescriptor;
117 int totalSpace;
118 int totalFreeSpace;
119 } vos_partitionEntry_t, *vos_partitionEntry_p;
120
121 typedef enum {
122 VOS_VLDB_ENTRY_OK = 0x1,
123 VOS_VLDB_ENTRY_MOVE = 0x2,
124 VOS_VLDB_ENTRY_RELEASE = 0x4,
125 VOS_VLDB_ENTRY_BACKUP = 0x8,
126 VOS_VLDB_ENTRY_DELETE = 0x10,
127 VOS_VLDB_ENTRY_DUMP = 0x20,
128 VOS_VLDB_ENTRY_LOCKED = 0x40,
129 VOS_VLDB_ENTRY_RWEXISTS = 0x1000,
130 VOS_VLDB_ENTRY_ROEXISTS = 0x2000,
131 VOS_VLDB_ENTRY_BACKEXISTS = 0x4000
132 } vos_vldbEntryStatus_t, *vos_vldbEntryStatus_p;
133
134 typedef enum {
135 VOS_VLDB_NEW_REPSITE = 0x1,
136 VOS_VLDB_READ_ONLY = 0x2,
137 VOS_VLDB_READ_WRITE = 0x4,
138 VOS_VLDB_BACKUP = 0x8,
139 VOS_VLDB_DONT_USE = 0x10
140 } vos_vldbServerFlag_t, *vos_vldbServerFlag_p;
141
142 typedef struct vos_vldbEntry {
143 int numServers;
144 unsigned int volumeId[VOS_MAX_VOLUME_TYPES];
145 unsigned int cloneId;
146 vos_vldbEntryStatus_t status;
147 struct {
148 int serverAddress;
149 int serverPartition;
150 vos_vldbServerFlag_t serverFlags;
151 } volumeSites[VOS_MAX_REPLICA_SITES];
152 char name[VOS_MAX_VOLUME_NAME_LEN];
153 } vos_vldbEntry_t, *vos_vldbEntry_p;
154
155 #define VOS_PROCEDURE_NAME_LEN 30
156
157 typedef enum {
158 VOS_VOLUME_ATTACH_MODE_OK,
159 VOS_VOLUME_ATTACH_MODE_OFFLINE,
160 VOS_VOLUME_ATTACH_MODE_BUSY,
161 VOS_VOLUME_ATTACH_MODE_READONLY,
162 VOS_VOLUME_ATTACH_MODE_CREATE,
163 VOS_VOLUME_ATTACH_MODE_CREATE_VOLID
164 } vol_volumeAttachMode_t, *vol_volumeAttachMode_p;
165
166 typedef enum {
167 VOS_VOLUME_ACTIVE_STATUS_OK,
168 VOS_VOLUME_ACTIVE_STATUS_DELETE_ON_SALVAGE,
169 VOS_VOLUME_ACTIVE_STATUS_OUT_OF_SERVICE,
170 VOS_VOLUME_ACTIVE_STATUS_DELETED
171 } vos_volumeActiveStatus_t, *vos_volumeActiveStatus_p;
172
173 typedef enum {
174 VOS_VOLUME_TRANSACTION_STATUS_OK,
175 VOS_VOLUME_TRANSACTION_STATUS_DELETED
176 } vos_volumeTransactionStatus_t, *vos_volumeTransactionStatus_p;
177
178 typedef struct vos_serverTransactionStatus {
179 int transactionId;
180 int lastActiveTime;
181 int creationTime;
182 int errorCode;
183 unsigned int volumeId;
184 int partition;
185 char lastProcedureName[VOS_PROCEDURE_NAME_LEN];
186 int nextReceivePacketSequenceNumber;
187 int nextSendPacketSequenceNumber;
188 int lastReceiveTime;
189 int lastSendTime;
190 vol_volumeAttachMode_t volumeAttachMode;
191 vos_volumeActiveStatus_t volumeActiveStatus;
192 vos_volumeTransactionStatus_t volumeTransactionStatus;
193 } vos_serverTransactionStatus_t, *vos_serverTransactionStatus_p;
194
195 typedef enum {
196 VOS_RESTORE_FULL,
197 VOS_RESTORE_INCREMENTAL
198 } vos_volumeRestoreType_t, *vos_volumeRestoreType_p;
199
200 typedef enum {
201 VOS_ONLINE_BUSY,
202 VOS_ONLINE_OFFLINE
203 } vos_volumeOnlineType_t, *vos_volumeOnlineType_p;
204
205 typedef enum {
206 VOS_DEBUG_MESSAGE = 0x1,
207 VOS_ERROR_MESSAGE = 0x2,
208 VOS_VERBOSE_MESSAGE = 0x4
209 } vos_messageType_t, *vos_messageType_p;
210
211 typedef void
212 (ADMINAPI * vos_MessageCallBack_t) (vos_messageType_t type, char *message);
213
214 extern int ADMINAPI vos_BackupVolumeCreate(const void *cellHandle,
215 vos_MessageCallBack_t callBack,
216 unsigned int volumeId,
217 afs_status_p st);
218
219 extern int ADMINAPI vos_BackupVolumeCreateMultiple(const void *cellHandle,
220 const void *serverHandle,
221 vos_MessageCallBack_t
222 callBack,
223 const unsigned int
224 *partition,
225 const char *volumePrefix,
226 vos_exclude_t
227 excludePrefix,
228 afs_status_p st);
229
230 extern int ADMINAPI vos_PartitionGet(const void *cellHandle,
231 const void *serverHandle,
232 vos_MessageCallBack_t callBack,
233 unsigned int partition,
234 vos_partitionEntry_p partitionP,
235 afs_status_p st);
236
237 extern int ADMINAPI vos_PartitionGetBegin(const void *cellHandle,
238 const void *serverHandle,
239 vos_MessageCallBack_t callBack,
240 void **iterationIdP,
241 afs_status_p st);
242
243 extern int ADMINAPI vos_PartitionGetNext(const void *iterationId,
244 vos_partitionEntry_p partitionP,
245 afs_status_p st);
246
247 extern int ADMINAPI vos_PartitionGetDone(const void *iterationId,
248 afs_status_p st);
249
250 extern int ADMINAPI vos_ServerOpen(const void *cellHandle,
251 const char *serverName,
252 void **serverHandleP, afs_status_p st);
253
254 extern int ADMINAPI vos_ServerClose(const void *serverHandle,
255 afs_status_p st);
256
257 extern int ADMINAPI vos_ServerSync(const void *cellHandle,
258 const void *serverHandle,
259 vos_MessageCallBack_t callBack,
260 const unsigned int *partition,
261 afs_status_p st);
262
263 extern int ADMINAPI vos_FileServerAddressChange(const void *cellHandle,
264 vos_MessageCallBack_t
265 callBack, unsigned int oldAddress,
266 unsigned int newAddress,
267 afs_status_p st);
268
269 extern int ADMINAPI vos_FileServerAddressRemove(const void *cellHandle,
270 vos_MessageCallBack_t
271 callBack, unsigned int serverAddress,
272 afs_status_p st);
273
274 extern int ADMINAPI vos_FileServerGetBegin(const void *cellHandle,
275 vos_MessageCallBack_t callBack,
276 void **iterationIdP,
277 afs_status_p st);
278
279 extern int ADMINAPI vos_FileServerGetNext(void *iterationId,
280 vos_fileServerEntry_p serverEntryP,
281 afs_status_p st);
282
283 extern int ADMINAPI vos_FileServerGetDone(void *iterationId, afs_status_p st);
284
285 extern int ADMINAPI vos_ServerTransactionStatusGetBegin(const void
286 *cellHandle, const void
287 *serverHandle,
288 vos_MessageCallBack_t
289 callBack,
290 void **iterationIdP,
291 afs_status_p st);
292
293 extern int ADMINAPI vos_ServerTransactionStatusGetNext(const void
294 *iterationId,
295 vos_serverTransactionStatus_p
296 serverTransactionStatusP,
297 afs_status_p st);
298
299 extern int ADMINAPI vos_ServerTransactionStatusGetDone(const void
300 *iterationId,
301 afs_status_p st);
302
303 extern int ADMINAPI vos_VLDBGet(const void *cellHandle,
304 vos_MessageCallBack_t callBack,
305 const unsigned int *volumeId,
306 char *volumeName,
307 vos_vldbEntry_p vldbEntry, afs_status_p st);
308
309 extern int ADMINAPI vos_VLDBGetBegin(const void *cellHandle,
310 const void *serverHandle,
311 vos_MessageCallBack_t callBack,
312 unsigned int *partition,
313 void **iterationIdP, afs_status_p st);
314
315 extern int ADMINAPI vos_VLDBGetNext(const void *iterationId,
316 vos_vldbEntry_p vldbEntry,
317 afs_status_p st);
318
319 extern int ADMINAPI vos_VLDBGetDone(const void *iterationId, afs_status_p st);
320
321 extern int ADMINAPI vos_VLDBEntryRemove(const void *cellHandle,
322 const void *serverHandle,
323 vos_MessageCallBack_t callBack,
324 const unsigned int *partition,
325 unsigned int *volumeId,
326 afs_status_p st);
327
328 extern int ADMINAPI vos_VLDBUnlock(const void *cellHandle,
329 const void *serverHandle,
330 vos_MessageCallBack_t callBack,
331 const unsigned int *partition,
332 afs_status_p st);
333
334 extern int ADMINAPI vos_VLDBEntryLock(const void *cellHandle,
335 vos_MessageCallBack_t callBack,
336 unsigned int volumeId, afs_status_p st);
337
338 extern int ADMINAPI vos_VLDBEntryUnlock(const void *cellHandle,
339 vos_MessageCallBack_t callBack,
340 unsigned int volumeId,
341 afs_status_p st);
342
343 extern int ADMINAPI vos_VLDBReadOnlySiteCreate(const void *cellHandle,
344 const void *serverHandle,
345 vos_MessageCallBack_t callBack,
346 unsigned int partition,
347 unsigned int volumeId,
348 afs_status_p st);
349
350 extern int ADMINAPI vos_VLDBReadOnlySiteDelete(const void *cellHandle,
351 const void *serverHandle,
352 vos_MessageCallBack_t callBack,
353 unsigned int partition,
354 unsigned int volumeId,
355 afs_status_p st);
356
357 extern int ADMINAPI vos_VLDBSync(const void *cellHandle,
358 const void *serverHandle,
359 vos_MessageCallBack_t callBack,
360 const unsigned int *partition,
361 vos_force_t force, afs_status_p st);
362
363 extern int ADMINAPI vos_VolumeCreate(const void *cellHandle,
364 const void *serverHandle,
365 vos_MessageCallBack_t callBack,
366 unsigned int partition,
367 char *volumeName,
368 unsigned int quota,
369 unsigned int *volumeId, afs_status_p st);
370
371 extern int ADMINAPI vos_VolumeDelete(const void *cellHandle,
372 const void *serverHandle,
373 vos_MessageCallBack_t callBack,
374 unsigned int partition,
375 unsigned int volumeId, afs_status_p st);
376
377 extern int ADMINAPI vos_VolumeRename(const void *cellHandle,
378 vos_MessageCallBack_t callBack,
379 unsigned int readWriteVolumeId,
380 char *newVolumeName,
381 afs_status_p st);
382
383 extern int ADMINAPI vos_VolumeDump(const void *cellHandle,
384 const void *serverHandle,
385 vos_MessageCallBack_t callBack,
386 unsigned int *partition,
387 unsigned int volumeId,
388 unsigned int startTime,
389 const char *dumpFile, afs_status_p st);
390
391 extern int ADMINAPI vos_VolumeRestore(const void *cellHandle,
392 const void *serverHandle,
393 vos_MessageCallBack_t callBack,
394 unsigned int partition,
395 unsigned int *volumeId,
396 char *volumeName,
397 const char *dumpFile,
398 vos_volumeRestoreType_t dumpType,
399 afs_status_p st);
400
401 extern int ADMINAPI vos_VolumeOnline(const void *serverHandle,
402 vos_MessageCallBack_t callBack,
403 unsigned int partition,
404 unsigned int volumeId,
405 unsigned int sleepTime,
406 vos_volumeOnlineType_t volumeStatus,
407 afs_status_p st);
408
409 extern int ADMINAPI vos_VolumeOffline(const void *serverHandle,
410 vos_MessageCallBack_t callBack,
411 unsigned int partition,
412 unsigned int volumeId, afs_status_p st);
413
414 extern int ADMINAPI vos_VolumeGet(const void *cellHandle,
415 const void *serverHandle,
416 vos_MessageCallBack_t callBack,
417 unsigned int partition,
418 unsigned int volumeId,
419 vos_volumeEntry_p volumeP, afs_status_p st);
420
421 extern int ADMINAPI vos_VolumeGetBegin(const void *cellHandle,
422 const void *serverHandle,
423 vos_MessageCallBack_t callBack,
424 unsigned int partition,
425 void **iterationIdP, afs_status_p st);
426
427 extern int ADMINAPI vos_VolumeGetNext(const void *iterationId,
428 vos_volumeEntry_p volumeP,
429 afs_status_p st);
430
431 extern int ADMINAPI vos_VolumeGetDone(const void *iterationId,
432 afs_status_p st);
433
434 extern int ADMINAPI vos_VolumeMove(const void *cellHandle,
435 vos_MessageCallBack_t callBack,
436 unsigned int volumeId,
437 const void *fromServer,
438 unsigned int fromPartition,
439 const void *toServer,
440 unsigned int toPartition, afs_status_p st);
441
442 extern int ADMINAPI vos_VolumeRelease(const void *cellHandle,
443 vos_MessageCallBack_t callBack,
444 unsigned int volumeId,
445 vos_force_t force, afs_status_p st);
446
447 extern int ADMINAPI vos_VolumeZap(const void *cellHandle,
448 const void *serverHandle,
449 vos_MessageCallBack_t callBack,
450 unsigned int partition,
451 unsigned int volumeId, vos_force_t force,
452 afs_status_p st);
453
454 extern int ADMINAPI vos_PartitionNameToId(const char *partitionName,
455 unsigned int *partitionId,
456 afs_status_p st);
457
458 extern int ADMINAPI vos_PartitionIdToName(unsigned int partitionId,
459 char *partitionName,
460 afs_status_p st);
461
462 extern int ADMINAPI vos_VolumeQuotaChange(const void *cellHandle,
463 const void *serverHandle,
464 vos_MessageCallBack_t callBack,
465 unsigned int partition,
466 unsigned int volumeId,
467 unsigned int volumeQuota,
468 afs_status_p st);
469
470 extern int ADMINAPI vos_VolumeGet2(const void *cellHandle,
471 const void *serverHandle,
472 vos_MessageCallBack_t callBack,
473 unsigned int partition,
474 unsigned int volumeId,
475 volintInfo* pinfo, afs_status_p st);
476
477 extern int ADMINAPI vos_ClearVolUpdateCounter(const void *cellHandle,
478 const void *serverHandle,
479 unsigned int partition,
480 unsigned int volumeId,
481 afs_status_p st);
482
483 #endif /* OPENAFS_VOS_ADMIN_H */