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
13 #ifdef AFS_PTHREAD_ENV
17 #include <afs/voldefs.h>
19 /* vflags, representing state of the volume */
20 #define VTDeleteOnSalvage 1 /* delete on next salvage */
21 #define VTOutOfService 2 /* never put this volume online */
22 #define VTDeleted 4 /* deleted, don't do anything else */
24 /* iflags, representing "attach mode" for this volume at the start of this transaction */
25 #define ITOffline 1 /* volume offline on server (returns VOFFLINE) */
26 #define ITBusy 2 /* volume busy on server (returns VBUSY) */
27 #define ITReadOnly 8 /* volume readonly on client, readwrite on server -DO NOT USE */
28 #define ITCreate 0x10 /* volume does not exist correctly yet */
29 #define ITCreateVolID 0x1000 /* create volid */
31 /* tflags, representing transaction state */
32 #define TTDeleted 1 /* delete transaction not yet freed due to high refCount */
34 /* other names for volumes in voldefs.h */
38 #define volser_RWREPL 3
40 #define THOLD(tt) ((tt)->refCount++)
43 struct volser_trans *next; /* next ptr in active trans list */
44 afs_int32 tid; /* transaction id */
45 afs_int32 time; /* time transaction was last active (for timeouts) */
46 afs_int32 creationTime; /* time the transaction started */
47 afs_int32 returnCode; /* transaction error code */
48 struct Volume *volume; /* pointer to open volume */
49 VolumeId volid; /* open volume's id */
50 afs_int32 partition; /* open volume's partition */
51 afs_int32 dumpTransId; /* other side's trans id during a dump */
52 afs_int32 dumpSeq; /* next sequence number to use during a dump */
53 short refCount; /* reference count on this structure */
54 short iflags; /* initial attach mode flags (IT*) */
55 char vflags; /* current volume status flags (VT*) */
56 char tflags; /* transaction flags (TT*) */
57 char incremental; /* do an incremental restore */
58 /* the fields below are useful for debugging */
59 char lastProcName[30]; /* name of the last procedure which used transaction */
60 struct rx_call *rxCallPtr; /* pointer to latest associated rx_call */
61 #ifdef AFS_PTHREAD_ENV
62 pthread_mutex_t lock; /* per transaction lock */
67 /* This is how often the garbage collection thread wakes up and
68 * checks for transactions that have timed out: BKGLoop()
72 #ifdef AFS_PTHREAD_ENV
73 #define VTRANS_OBJ_LOCK_INIT(tt) \
74 opr_mutex_init(&((tt)->lock));
75 #define VTRANS_OBJ_LOCK_DESTROY(tt) \
76 opr_mutex_destroy(&((tt)->lock))
77 #define VTRANS_OBJ_LOCK(tt) \
78 opr_mutex_enter(&((tt)->lock))
79 #define VTRANS_OBJ_UNLOCK(tt) \
80 opr_mutex_exit(&((tt)->lock))
82 #define VTRANS_OBJ_LOCK_INIT(tt)
83 #define VTRANS_OBJ_LOCK_DESTROY(tt)
84 #define VTRANS_OBJ_LOCK(tt)
85 #define VTRANS_OBJ_UNLOCK(tt)
86 #endif /* AFS_PTHREAD_ENV */
89 /* flags for vol helper busyFlags array. First, VHIdle goes on when a server
90 * becomes idle. Next, idle flag is cleared and VHRequest goes on when
91 * trans is queued. Finally, VHRequest goes off (but VHIdle stays off) when
92 * helper is done. VHIdle goes on again when an lwp waits for work.
94 #define VHIdle 1 /* vol helper is waiting for a request here */
95 #define VHRequest 2 /* a request has been queued here */
96 extern struct volser_trans *QI_GlobalWriteTrans;
98 /* the stuff below is from errors.h in vol directory */
99 #define VICE_SPECIAL_ERRORS 101 /* Lowest special error code */
101 #define VSALVAGE 101 /* Volume needs salvage */
102 #define VNOVNODE 102 /* Bad vnode number quoted */
103 #define VNOVOL 103 /* Volume not attached, doesn't exist,
104 * not created or not online */
105 #define VVOLEXISTS 104 /* Volume already exists */
106 #define VNOSERVICE 105 /* Volume is not in service (i.e. it's
107 * is out of funds, is obsolete, or somesuch). This
108 * error code is no longer used, but was previously
109 * used by the OpenAFS fileserver to kill "idle" calls,
110 * and OpenAFS clients may interpret it that way. */
111 #define VOFFLINE 106 /* Volume is off line, for the reason
112 * given in the offline message */
113 #define VONLINE 107 /* Volume is already on line */
114 #define VDISKFULL 108 /* Partition is "full", i.e. rougly within
116 #define VOVERQUOTA 109 /* Volume max quota exceeded */
117 #define VBUSY 110 /* Volume temporarily unavailable; try again.
118 * The volume should be available again shortly; if
119 * it isn't something is wrong. Not normally to be
120 * propagated to the application level */
121 #define VMOVED 111 /* Volume has moved to another server; do a VGetVolumeInfo
122 * to THIS server to find out where */
124 #define VLDB_MAXSERVERS 10
125 #define VOLSERVICE_ID 4
126 #define INVALID_BID 0
127 #define VOLSER_MAXVOLNAME 65
128 #define VOLSER_OLDMAXVOLNAME 32
130 /*flags used for interfacing with the backup system */
131 struct volDescription { /*used for interfacing with the backup system */
132 char volName[VOLSER_MAXVOLNAME]; /* should be VNAMESIZE as defined in volume.h */
136 afs_uint32 volCloneId;
139 struct partList { /*used by the backup system */
140 afs_int32 partId[VOLMAXPARTS];
141 afs_int32 partFlags[VOLMAXPARTS];
144 #define STDERR stderr
145 #define STDOUT stdout
147 #define ISNAMEVALID(name) (strlen(name) < (VOLSER_OLDMAXVOLNAME - 9))
149 #define PARTVALID 0x01
150 #define CLONEVALID 0x02
151 #define CLONEZAPPED 0x04
153 #define NAMEVALID 0x10
154 #define SIZEVALID 0x20
155 #define ENTRYVALID 0x40
156 #define REUSECLONEID 0x80
159 /* Values for the UV_RestoreVolume flags parameter */
160 /* Also used for UV_CopyVolume and UV_CloneVolume */
161 #define RV_FULLRST 0x000001
162 #define RV_OFFLINE 0x000002
163 #define RV_CRDUMP 0x000010
164 #define RV_CRKEEP 0x000020
165 #define RV_CRNEW 0x000040
166 #define RV_LUDUMP 0x000100
167 #define RV_LUKEEP 0x000200
168 #define RV_LUNEW 0x000400
169 #define RV_RDONLY 0x010000
170 #define RV_CPINCR 0x020000
171 #define RV_NOVLDB 0x040000
172 #define RV_NOCLONE 0x080000
173 #define RV_NODEL 0x100000
174 #define RV_RWONLY 0x200000
176 /* Values for the UV_ReleaseVolume flags parameters */
177 #define REL_COMPLETE 0x000001 /* force a complete release */
178 #define REL_FULLDUMPS 0x000002 /* force full dumps */
179 #define REL_STAYUP 0x000004 /* dump to clones to avoid offline time */
182 extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp);
183 extern int vsu_ExtractName(char rname[], char name[]);
184 extern afs_int32 vsu_ClientInit(const char *confDir, char *cellName,
186 int (*secproc)(struct rx_securityClass *,
188 struct ubik_client **uclientp);
195 #endif /* _VOLSER_ */