Standardize License information
[openafs.git] / src / volser / volser.p.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 _VOLSER_
11 #define _VOLSER_ 1
12 /* vflags, representing state of the volume */
13 #define VTDeleteOnSalvage       1       /* delete on next salvage */
14 #define VTOutOfService          2       /* never put this volume online */
15 #define VTDeleted               4       /* deleted, don't do anything else */
16
17 /* iflags, representing "attach mode" for this volume at the start of this transaction */
18 #define ITOffline       1       /* volume offline on server (returns VOFFLINE) */
19 #define ITBusy          2       /* volume busy on server (returns VBUSY) */
20 #define ITReadOnly      8       /* volume readonly on client, readwrite on server -DO NOT USE*/
21 #define ITCreate        0x10    /* volume does not exist correctly yet */
22 #define ITCreateVolID   0x1000  /* create volid */
23
24 /* tflags, representing transaction state */
25 #define TTDeleted       1       /* delete transaction not yet freed due  to high refCount */
26
27 /* other names for volumes in voldefs.h */
28 #define volser_RW       0
29 #define volser_RO       1
30 #define volser_BACK     2
31
32 #define THOLD(tt)       ((tt)->refCount++)
33
34 struct volser_trans {
35     struct volser_trans *next;  /* next ptr in active trans list */
36     afs_int32 tid;                  /* transaction id */
37     afs_int32 time;                 /* time transaction was last active (for timeouts) */
38     afs_int32 creationTime;         /* time the transaction started */
39     afs_int32 returnCode;           /* transaction error code */
40     struct Volume *volume;  /* pointer to open volume */
41     afs_int32 volid;                /* open volume's id */
42     afs_int32 partition;            /* open volume's partition */
43     afs_int32 dumpTransId;          /* other side's trans id during a dump */
44     afs_int32 dumpSeq;      /* next sequence number to use during a dump */
45     short refCount;         /* reference count on this structure */
46     short iflags;           /* initial attach mode flags (IT*) */
47     char vflags;            /* current volume status flags (VT*) */
48     char tflags;            /* transaction flags (TT*) */
49     char incremental;       /* do an incremental restore */
50     /* the fields below are useful for debugging */
51     char lastProcName[30];  /* name of the last procedure which used transaction */
52     struct rx_call *rxCallPtr; /* pointer to latest associated rx_call */
53     
54 };
55
56 /* This is how often the garbage collection thread wakes up and 
57  * checks for transactions that have timed out: BKGLoop()
58  */
59 #define GCWAKEUP            30
60
61 struct volser_dest {
62     afs_int32 destHost;
63     afs_int32 destPort;
64     afs_int32 destSSID;
65 };
66
67 #define MAXHELPERS          10
68 /* flags for vol helper busyFlags array.  First, VHIdle goes on when a server
69  * becomes idle.  Next, idle flag is cleared and VHRequest goes on when
70  * trans is queued.  Finally, VHRequest goes off (but VHIdle stays off) when
71  * helper is done.  VHIdle goes on again when an lwp waits for work.
72  */
73 #define VHIdle              1       /* vol helper is waiting for a request here */
74 #define VHRequest           2       /* a request has been queued here */
75 extern struct volser_trans *QI_GlobalWriteTrans;
76
77 /* the stuff below is from errors.h in vol directory */
78 #define VICE_SPECIAL_ERRORS     101     /* Lowest special error code */
79
80 #define VSALVAGE        101     /* Volume needs salvage */
81 #define VNOVNODE        102     /* Bad vnode number quoted */
82 #define VNOVOL          103     /* Volume not attached, doesn't exist, 
83                                    not created or not online */
84 #define VVOLEXISTS      104     /* Volume already exists */
85 #define VNOSERVICE      105     /* Volume is not in service (i.e. it's
86                                    is out of funds, is obsolete, or somesuch) */
87 #define VOFFLINE        106     /* Volume is off line, for the reason
88                                    given in the offline message */
89 #define VONLINE         107     /* Volume is already on line */
90 #define VDISKFULL       108     /* Partition is "full", i.e. rougly within
91                                    n% of full */
92 #define VOVERQUOTA      109     /* Volume max quota exceeded */
93 #define VBUSY           110     /* Volume temporarily unavailable; try again.
94                                    The volume should be available again shortly; if
95                                    it isn't something is wrong.  Not normally to be
96                                    propagated to the application level */
97 #define VMOVED          111     /* Volume has moved to another server; do a VGetVolumeInfo
98                                    to THIS server to find out where */
99
100 #define MyPort 5003
101 #define NameLen 80
102 #define VLDB_MAXSERVERS 10
103 #define VOLSERVICE_ID 4
104 #define INVALID_BID 0
105 #define VOLSER_MAXVOLNAME 65
106 #define VOLSER_OLDMAXVOLNAME 32
107 #define VOLMAXPARTS     255
108
109 /*flags used for interfacing with the  backup system */
110 struct volDescription {    /*used for interfacing with the backup system */
111     char volName[VOLSER_MAXVOLNAME];/* should be VNAMESIZE as defined in volume.h*/
112     afs_int32 volId;
113     int volSize;
114     afs_int32 volFlags;
115     afs_int32 volCloneId;
116 };
117
118 struct partList {   /*used by the backup system */
119     afs_int32 partId[VOLMAXPARTS];
120     afs_int32 partFlags[VOLMAXPARTS];
121 };
122
123 #define STDERR  stderr
124 #define STDOUT  stdout
125
126 #define ISNAMEVALID(name) (strlen(name) < (VOLSER_OLDMAXVOLNAME - 9))
127
128 /* values for flags in struct nvldbEntry */
129 #define RW_EXISTS 0x1000
130 #define RO_EXISTS 0x2000
131 #define BACK_EXISTS 0x4000
132
133 /* values for serverFlags in struct nvldbEntry */
134 #define NEW_REPSITE 0x01
135 #define ITSROVOL    0x02
136 #define ITSRWVOL    0x04
137 #define ITSBACKVOL  0x08
138 #define RO_DONTUSE  0x20
139
140 #define VLOP_RESTORE 0x100/*this is bogus, clashes with VLOP_DUMP */
141 #define VLOP_ADDSITE 0x80 /*this is bogus, clashes with VLOP_DELETE*/
142 #define PARTVALID 0x01
143 #define CLONEVALID 0x02
144 #define CLONEZAPPED 0x04
145 #define IDVALID 0x08
146 #define NAMEVALID 0x10
147 #define SIZEVALID 0x20
148 #define ENTRYVALID 0x40
149 #define REUSECLONEID 0x80
150 #define VOK 0x02 
151
152 /* Values for the UV_RestoreVolume flags parameter */
153 #define RV_FULLRST 0x1
154 #define RV_OFFLINE 0x2
155
156 #endif /* _VOLSER_ */
157
158
159
160
161
162
163