OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright 2000, International Business Machines Corporation and others. 00003 * All Rights Reserved. 00004 * 00005 * This software has been released under the terms of the IBM Public 00006 * License. For details, see the LICENSE file in the top-level source 00007 * directory or online at http://www.openafs.org/dl/license10.html 00008 */ 00009 00010 #ifndef _AFS_H_ 00011 #define _AFS_H_ 00012 /* 00013 * AFS system call opcodes 00014 */ 00015 #ifdef KDUMP_KERNEL 00016 #include <afs/afs_args.h> 00017 #include <afs/afs_consts.h> 00018 #else 00019 #include "afs/afs_args.h" 00020 #include "afs/afs_consts.h" 00021 #endif 00022 00023 /* 00024 * afs_fsfragsize cannot be less than 1023, or some cache-tracking 00025 * calculations will be incorrect (since we track cache usage in kb). 00026 * Some filesystems have fundamental blocksizes less than 1k, and 00027 * normally we would tune afs_fsfragsize to be fragsize-1, but we must 00028 * make sure to check that afs_fsfragsize does not go below this value. 00029 */ 00030 #define AFS_MIN_FRAGSIZE 1023 00031 00032 /* Upper bound on number of iovecs out uio routines will deal with. */ 00033 #define AFS_MAXIOVCNT 16 00034 00035 00036 extern int afs_shuttingdown; 00037 00038 /* 00039 * Macros to uniquely identify the AFS vfs struct 00040 */ 00041 #define AFS_VFSMAGIC 0x1234 00042 #if defined(AFS_SUN5_ENV) || defined(AFS_HPUX90_ENV) || defined(AFS_LINUX20_ENV) 00043 #define AFS_VFSFSID 99 00044 #else 00045 #if defined(AFS_SGI_ENV) 00046 #define AFS_VFSFSID afs_fstype 00047 #else 00048 #define AFS_VFSFSID AFS_MOUNT_AFS 00049 #endif 00050 #endif 00051 00052 /* Moved from VNOPS/afs_vnop_flocks so can be used in prototypes */ 00053 #if defined(AFS_HPUX102_ENV) 00054 #define AFS_FLOCK k_flock 00055 #else 00056 #if defined(AFS_SUN5_ENV) || (defined(AFS_LINUX24_ENV) && !(defined(AFS_LINUX26_ENV) && defined(AFS_LINUX_64BIT_KERNEL))) 00057 #define AFS_FLOCK flock64 00058 #else 00059 #define AFS_FLOCK flock 00060 #endif /* AFS_SUN65_ENV */ 00061 #endif /* AFS_HPUX102_ENV */ 00062 00063 /* The following are various levels of afs debugging */ 00064 #define AFSDEB_GENERAL 1 /* Standard debugging */ 00065 #define AFSDEB_NETWORK 2 /* low level afs networking */ 00066 #define AFSDEB_RX 4 /* RX debugging */ 00067 #define AFSDEB_VNLAYER 8 /* interface layer to AFS (aixops, gfsops, etc) */ 00068 00069 /* generic undefined vice id */ 00070 #define UNDEFVID (-1) 00071 00072 /* The basic defines for the Andrew file system 00073 better keep things powers of two so "& (foo-1)" hack works for masking bits */ 00074 #define NBRS 15 /* max number of queued daemon requests */ 00075 #define NUSERS 16 /* hash table size for unixuser table */ 00076 #define NSERVERS 16 /* hash table size for server table */ 00077 #define NVOLS 64 /* hash table size for volume table */ 00078 #define NFENTRIES 256 /* hash table size for disk volume table */ 00079 #define VCSIZE 1024 /* stat cache hash table size */ 00080 #define DCSIZE 512 /* disk cache hash table size */ 00081 #define CBRSIZE 512 /* call back returns hash table size */ 00082 #define PIGGYSIZE 1350 /* max piggyback size */ 00083 #define MAXVOLS 128 /* max vols we can store */ 00084 #define MAXSYSNAME 128 /* max sysname (i.e. @sys) size */ 00085 #define MAXNUMSYSNAMES 32 /* max that current constants allow */ 00086 #define NOTOKTIMEOUT (2*3600) /* time after which to timeout conns sans tokens */ 00087 #define NOPAG 0xffffffff 00088 00089 00090 00091 #define AFS_MAXCBRSCALL 32 /* max to return in a given call (must be <= AFSCBMAX) */ 00092 #define AFS_SALLOC_LOW_WATER 250 /* Min free blocks before allocating more */ 00093 #define AFS_LRALLOCSIZ 4096 /* "Large" allocated size */ 00094 #define VCACHE_FREE 5 00095 #define AFS_NRXPACKETS 80 00096 #define AFS_RXDEADTIME 50 00097 #define AFS_HARDDEADTIME 120 00098 #define AFS_IDLEDEADTIME 1200 00099 #define AFS_IDLEDEADTIME_REP 180 /* more than fs's cb dead time */ 00100 #define AFS_BLKBITS 12 00101 #define AFS_BLKSIZE (1 << AFS_BLKBITS) 00102 00103 extern afs_int32 afs_rx_deadtime; 00104 extern afs_int32 afs_rx_harddead; 00105 extern afs_int32 afs_rx_idledead; 00106 extern afs_int32 afs_rx_idledead_rep; 00107 00108 struct sysname_info { 00109 char *name; 00110 short offset; 00111 signed char index, allocked; 00112 }; 00113 00114 /* flags to use with AFSOP_CACHEINIT */ 00115 #define AFSCALL_INIT_MEMCACHE 0x1 /* use a memory-based cache */ 00116 00117 /* below here used only for kernel procedures */ 00118 #ifdef KERNEL 00119 /* Store synchrony flags - SYNC means that data should be forced to server's 00120 * disk immediately upon completion. */ 00121 #define AFS_ASYNC 0 00122 #define AFS_SYNC 1 00123 #define AFS_VMSYNC_INVAL 2 /* sync and invalidate pages */ 00124 #define AFS_LASTSTORE 4 00125 #define AFS_VMSYNC 8 /* sync pages but do not invalidate */ 00126 00127 /* background request structure */ 00128 #define BPARMS 4 00129 00130 #define BOP_NOOP 0 /* leave 0 unused */ 00131 #define BOP_FETCH 1 /* parm1 is chunk to get */ 00132 #define BOP_STORE 2 /* parm1 is chunk to store */ 00133 #define BOP_PATH 3 /* parm1 is path, parm2 is chunk to fetch */ 00134 #define BOP_FETCH_NOCACHE 4 /* parms are: vnode ptr, offset, segment ptr, addr, cred ptr */ 00135 #ifdef AFS_DARWIN_ENV 00136 #define BOP_MOVE 5 /* ptr1 afs_uspc_param ptr2 sname ptr3 dname */ 00137 #endif 00138 00139 #define B_DONTWAIT 1 /* On failure return; don't wait */ 00140 00141 /* protocol is: refCount is incremented by user to take block out of free pool. 00142 Next, BSTARTED is set when daemon finds request. This prevents 00143 other daemons from picking up the same request. Finally, when 00144 request is done, refCount is zeroed. BDONE and BWAIT are used by 00145 dudes waiting for operation to proceed to a certain point before returning. 00146 */ 00147 #define BSTARTED 1 /* request picked up by a daemon */ 00148 #define BUVALID 2 /* code is valid (store) */ 00149 #define BUWAIT 4 /* someone is waiting for BUVALID */ 00150 struct brequest { 00151 struct vcache *vc; /* vnode to use, with vrefcount bumped */ 00152 afs_ucred_t *cred; /* credentials to use for operation */ 00153 afs_size_t size_parm[BPARMS]; /* random parameters */ 00154 void *ptr_parm[BPARMS]; /* pointer parameters */ 00155 afs_int32 code; /* return code */ 00156 short refCount; /* use counter for this structure */ 00157 char opcode; /* what to do (store, fetch, etc) */ 00158 char flags; /* free, etc */ 00159 afs_int32 ts; /* counter "timestamp" */ 00160 }; 00161 00162 struct SecretToken { 00163 char data[56]; 00164 }; 00165 00166 struct ClearToken { 00167 afs_int32 AuthHandle; 00168 char HandShakeKey[8]; 00169 afs_int32 ViceId; 00170 afs_int32 BeginTimestamp; 00171 afs_int32 EndTimestamp; 00172 }; 00173 00174 struct VenusFid { 00175 afs_int32 Cell; /* better sun packing if at end of structure */ 00176 struct AFSFid Fid; 00177 }; 00178 00179 /* Temporary struct to be passed between afs_fid and afs_vget; in SunOS4.x we can only pass a maximum of 10 bytes for a handle (we ideally need 16!) */ 00180 struct SmallFid { 00181 afs_int32 Volume; 00182 afs_int32 CellAndUnique; 00183 u_short Vnode; 00184 }; 00185 /* The actual number of bytes in the SmallFid, not the sizeof struct. */ 00186 #define SIZEOF_SMALLFID 10 00187 00188 /* Queues 00189 * ------ 00190 * 00191 * Circular queues, implemented with pointers. Structures may contain as many 00192 * queues as required, which may be located at any point within the structure, 00193 * providing the QEntry macro is used to translate between a queue pointer, and 00194 * the address of its containing structure 00195 */ 00196 00197 struct afs_q { 00198 struct afs_q *next; 00199 struct afs_q *prev; 00200 }; 00201 00202 #define QZero(e) ((e)->prev = (e)->next = NULL) 00203 #define QInit(q) ((q)->prev = (q)->next = (q)) 00204 #define QAdd(q,e) ((e)->next = (q)->next, (e)->prev = (q), \ 00205 (q)->next->prev = (e), (q)->next = (e)) 00206 #define QRemove(e) ((e)->next->prev = (e)->prev, (e)->prev->next = (e)->next, (e)->prev = NULL, (e)->next = NULL) 00207 #define QNext(e) ((e)->next) 00208 #define QPrev(e) ((e)->prev) 00209 #define QEmpty(q) ((q)->prev == (q)) 00210 /* this one takes q1 and sticks it on the end of q2 - that is, the other end, not the end 00211 * that things are added onto. q1 shouldn't be empty, it's silly */ 00212 #define QCat(q1,q2) ((q2)->prev->next = (q1)->next, (q1)->next->prev=(q2)->prev, (q1)->prev->next=(q2), (q2)->prev=(q1)->prev, (q1)->prev=(q1)->next=(q1)) 00213 00214 /* Given a pointer to an afs_q within a structure, go back to the address of 00215 * the parent structure 00216 */ 00217 00218 #define QEntry(queue, structure, member) \ 00219 ((structure *)((char *)(queue)-(char *)(&((structure *)NULL)->member))) 00220 00221 /* And implement operations for individual lists in terms of the above macro */ 00222 00223 #define QTOV(e) QEntry(e, struct vcache, vlruq) 00224 #define QTOC(e) QEntry(e, struct cell, lruq) 00225 #define QTOVH(e) QEntry(e, struct vcache, vhashq) 00226 00230 struct afs_slotlist { 00231 afs_uint32 slot; 00232 struct afs_slotlist *next; 00233 }; 00234 00235 struct vrequest { 00236 afs_int32 uid; /* user id making the request */ 00237 afs_int32 busyCount; /* how many busies we've seen so far */ 00238 afs_int32 flags; /* things like O_SYNC, O_NONBLOCK go here */ 00239 char initd; /* if non-zero, Error fields meaningful */ 00240 char accessError; /* flags for overriding error return code */ 00241 char volumeError; /* encountered a missing or busy volume */ 00242 char networkError; /* encountered network problems */ 00243 char permWriteError; /* fileserver returns permenent error. */ 00244 char tokenError; /* a token error other than expired. */ 00245 char idleError; /* the server idled too long */ 00246 char skipserver[AFS_MAXHOSTS]; 00247 afs_int32 lasterror[AFS_MAXHOSTS]; 00248 }; 00249 #define VOLMISSING 1 00250 #define VOLBUSY 2 00251 00252 /* structure linked off of a server to keep track of queued returned 00253 * callbacks. Sent asynchronously when we run a little low on free dudes. 00254 */ 00255 struct afs_cbr { 00256 struct afs_cbr **pprev; 00257 struct afs_cbr *next; 00258 00259 struct afs_cbr **hash_pprev; 00260 struct afs_cbr *hash_next; 00261 00262 struct AFSFid fid; 00263 }; 00264 00265 #ifdef AFS_LINUX22_ENV 00266 /* On Linux, we have to be able to allocate the storage for this using 00267 * kmalloc, as otherwise we may deadlock. So, it needs to be able to fit 00268 * in a single page 00269 */ 00270 # define AFS_NCBRS PAGE_SIZE/sizeof(struct afs_cbr) 00271 #else 00272 # define AFS_NCBRS 1024 /* max # of call back return entries */ 00273 #endif 00274 00275 /* cellinfo file magic number */ 00276 #define AFS_CELLINFO_MAGIC 0xf32817cd 00277 00278 /* cell flags */ 00279 #define CNoSUID 0x02 /* disable suid bit for this cell */ 00280 #define CLinkedCell4 0x04 /* reserved for ADDCELL2 pioctl */ 00281 #define CNoAFSDB 0x08 /* never bother trying AFSDB */ 00282 #define CHasVolRef 0x10 /* volumes were referenced */ 00283 #define CLinkedCell 0x20 /* has a linked cell in lcellp */ 00284 #define CHush 0x40 /* don't display until referenced */ 00285 00286 struct cell { 00287 struct afs_q lruq; /* lru q next and prev */ 00288 char *cellName; /* char string name of cell */ 00289 afs_int32 cellIndex; /* sequence number */ 00290 afs_int32 cellNum; /* semi-permanent cell number */ 00291 struct server *cellHosts[AFS_MAXCELLHOSTS]; /* volume *location* hosts */ 00292 struct cell *lcellp; /* Associated linked cell */ 00293 u_short fsport; /* file server port */ 00294 u_short vlport; /* volume server port */ 00295 short states; /* state flags */ 00296 time_t timeout; /* data expire time, if non-zero */ 00297 struct cell_name *cnamep; /* pointer to our cell_name */ 00298 afs_rwlock_t lock; /* protects cell data */ 00299 unsigned char cellHandle[16]; /* deterministic handle for this cell */ 00300 }; 00301 00302 struct cell_name { 00303 struct cell_name *next; 00304 afs_int32 cellnum; 00305 char *cellname; 00306 char used; 00307 }; 00308 00309 struct cell_alias { 00310 struct cell_alias *next; 00311 afs_int32 index; 00312 char *alias; 00313 char *cell; 00314 }; 00315 00316 #define afs_PutCell(cellp, locktype) 00317 00318 /* the unixuser flag bit definitions */ 00319 #define UHasTokens 1 /* are the st and ct fields valid (ever set)? */ 00320 #define UTokensBad 2 /* are tokens bad? */ 00321 #define UPrimary 4 /* on iff primary identity */ 00322 #define UNeedsReset 8 /* needs afs_ResetAccessCache call done */ 00323 #define UPAGCounted 16 /* entry seen during PAG search (for stats) */ 00324 #define UNFSGetCreds 32 /* getting creds for NFS client */ 00325 /* A flag used by afs_GCPAGs to keep track of 00326 * which entries in afs_users need to be deleted. 00327 * The lifetime of its presence in the table is the 00328 * lifetime of the afs_GCPAGs function. 00329 */ 00330 #define TMP_UPAGNotReferenced 128 00331 00332 /* unixuser notify events */ 00333 #define UTokensObtained 1 00334 #define UTokensDropped 2 00335 00336 /* values for afs_gcpags */ 00337 enum { AFS_GCPAGS_NOTCOMPILED = 0, AFS_GCPAGS_OK = 00338 1, AFS_GCPAGS_USERDISABLED, AFS_GCPAGS_EPROC0, AFS_GCPAGS_EPROCN, 00339 AFS_GCPAGS_EEQPID, AFS_GCPAGS_EINEXACT, AFS_GCPAGS_EPROCEND, 00340 AFS_GCPAGS_EPROCWALK, AFS_GCPAGS_ECREDWALK, AFS_GCPAGS_EPIDCHECK, 00341 AFS_GCPAGS_ENICECHECK 00342 }; 00343 00344 extern afs_int32 afs_gcpags; 00345 extern afs_int32 afs_gcpags_procsize; 00346 extern afs_int32 afs_bkvolpref; 00347 extern char afs_cachebasedir[1024]; 00348 extern afs_int32 afs_numcachefiles; 00349 extern afs_int32 afs_numfilesperdir; 00350 00351 struct rxkadToken { 00352 afs_int32 ticketLen; 00353 char * ticket; 00354 struct ClearToken clearToken; 00355 }; 00356 00357 union tokenUnion { 00358 struct rxkadToken rxkad; 00359 }; 00360 00361 struct tokenJar { 00362 struct tokenJar *next; 00363 int type; 00364 union tokenUnion content; 00365 }; 00366 00367 struct unixuser { 00368 struct unixuser *next; /* next hash pointer */ 00369 afs_int32 uid; /* search based on uid and cell */ 00370 afs_int32 cell; 00371 afs_int32 viceId; /* Optional viced ID corresponding to current tokens */ 00372 short refCount; /* reference count for allocation */ 00373 char states; /* flag info */ 00374 afs_int32 tokenTime; /* last time tokens were set, used for timing out conn data */ 00375 struct tokenJar *tokens; 00376 struct afs_exporter *exporter; /* more info about the exporter for the remote user */ 00377 void *cellinfo; /* pointer to cell info (PAG manager only) */ 00378 afs_rwlock_t lock; 00379 }; 00380 00381 #define CVEC_LEN 3 /* per-user connection pool */ 00382 00383 struct sa_conn_vector; 00384 typedef struct sa_conn_vector * p_sa_conn_vector; /* forward decl */ 00385 00386 #define CONN_REPLICATED 0x1 00387 00388 struct afs_conn { 00389 int refCount; 00390 int activated; 00391 char forceConnectFS; /* Should we try again with these tokens? */ 00392 struct rx_connection *id; /* RPC connid */ 00393 struct sa_conn_vector *parent; /* the con_vector which contains us */ 00394 }; 00395 00396 /* An sa_conn_vector replaces the erstwhile list of conn 00397 structures maintained by the cache manager. The sa_conn_vector 00398 contains a C array of connections which, if non-zero, represent 00399 connections to AFS servers. 00400 */ 00401 00402 struct sa_conn_vector { 00403 /* linked-list machinery */ 00404 struct sa_conn_vector *next; 00405 00406 /* AFS conn-identifying info */ 00407 struct unixuser *user; /* user validated with respect to. */ 00408 struct srvAddr *srvr; /* server associated with this conn */ 00409 short refCount; /* reference count for allocation */ 00410 unsigned short port; /* port associated with this connection */ 00411 int flags; 00412 00413 /* next connection to return when all in cvec are fully utilized */ 00414 int select_index; 00415 00416 /* connections vector */ 00417 struct afs_conn cvec[CVEC_LEN]; 00418 }; 00419 00420 #define SQNULL -1 00421 00422 /* Fid comparison routines */ 00423 #define FidCmp(a,b) ((a)->Fid.Unique != (b)->Fid.Unique \ 00424 || (a)->Fid.Vnode != (b)->Fid.Vnode \ 00425 || (a)->Fid.Volume != (b)->Fid.Volume \ 00426 || (a)->Cell != (b)->Cell) 00427 00428 #define FidMatches(afid,tvc) ((tvc)->f.fid.Fid.Vnode == (afid)->Fid.Vnode && \ 00429 (tvc)->f.fid.Fid.Volume == (afid)->Fid.Volume && \ 00430 (tvc)->f.fid.Cell == (afid)->Cell && \ 00431 ( (tvc)->f.fid.Fid.Unique == (afid)->Fid.Unique || \ 00432 (!(afid)->Fid.Unique && ((tvc)->f.states & CUnique)))) 00433 00434 00435 #define SRVADDR_MH 1 00436 #define SRVADDR_ISDOWN 0x20 /* same as SRVR_ISDOWN */ 00437 #define SRVADDR_NOUSE 0x40 /* Don't use this srvAddr */ 00438 00439 struct srvAddr { 00440 struct srvAddr *next_bkt; /* next item in hash bucket */ 00441 struct srvAddr *next_sa; /* another interface on same host */ 00442 struct server *server; /* back to parent */ 00443 struct sa_conn_vector *conns; /* All user connections to this server */ 00444 struct afs_conn *natping; 00445 afs_int32 sa_ip; /* Host addr in network byte order */ 00446 u_short sa_iprank; /* indiv ip address priority */ 00447 u_short sa_portal; /* port addr in network byte order */ 00448 u_char sa_flags; 00449 }; 00450 00451 /* 00452 * Values used in the flags field of the server structure below. 00453 * 00454 * AFS_SERVER_FLAG_ACTIVATED Has the server ever had a user connection 00455 * associated with it? 00456 */ 00457 #define AFS_SERVER_FLAG_ACTIVATED 0x01 00458 #define SNO_LHOSTS 0x04 00459 #define SYES_LHOSTS 0x08 00460 #define SVLSRV_UUID 0x10 00461 #define SRVR_ISDOWN 0x20 00462 #define SRVR_MULTIHOMED 0x40 00463 #define SRVR_ISGONE 0x80 00464 #define SNO_INLINEBULK 0x100 00465 #define SNO_64BIT 0x200 00466 #define SCAPS_KNOWN 0x400 00467 00468 #define SRV_CAPABILITIES(ts) \ 00469 { if ( !(ts->flags & SCAPS_KNOWN)) afs_GetCapabilities(ts); ts->capabilities; } 00470 00471 #define afs_serverSetNo64Bit(s) (((struct sa_conn_vector*)(s)->parent)->srvr->server->flags |= SNO_64BIT) 00472 #define afs_serverHasNo64Bit(s) (((struct sa_conn_vector*)(s)->parent)->srvr->server->flags & SNO_64BIT) 00473 00474 struct server { 00475 union { 00476 struct { 00477 afsUUID suuid; 00478 afs_int32 addr_uniquifier; 00479 afs_int32 spares[2]; 00480 } _srvUuid; 00481 struct { 00482 struct srvAddr haddr; 00483 } _srvId; 00484 } _suid; 00485 #define sr_uuid _suid._srvUuid.suuid 00486 #define sr_addr_uniquifier _suid._srvUuid.addr_uniquifier 00487 #define sr_host _suid._srvId.haddr.ip 00488 #define sr_portal _suid._srvId.haddr.portal 00489 #define sr_rank _suid._srvId.haddr.ip_rank 00490 #define sr_flags _suid._srvId.haddr.flags 00491 #define sr_conns _suid._srvId.haddr.conns 00492 struct server *next; /* Ptr to next server in hash chain */ 00493 struct cell *cell; /* Cell in which this host resides */ 00494 struct afs_cbr *cbrs; /* Return list of callbacks */ 00495 afs_int32 activationTime; /* Time when this record was first activated */ 00496 afs_int32 lastDowntimeStart; /* Time when last downtime incident began */ 00497 afs_int32 numDowntimeIncidents; /* # (completed) downtime incidents */ 00498 afs_int32 sumOfDowntimes; /* Total downtime experienced, in seconds */ 00499 struct srvAddr *addr; 00500 afs_uint32 flags; /* Misc flags */ 00501 afs_int32 capabilities; 00502 }; 00503 00504 #define afs_PutServer(servp, locktype) 00505 00506 /* structs for some pioctls - these are (or should be) 00507 * also in venus.h 00508 */ 00509 struct spref { 00510 struct in_addr host; 00511 unsigned short rank; 00512 }; 00513 00514 struct sprefrequest_33 { 00515 unsigned short offset; 00516 unsigned short num_servers; 00517 }; 00518 00519 00520 struct sprefrequest { /* new struct for 3.4 */ 00521 unsigned short offset; 00522 unsigned short num_servers; 00523 unsigned short flags; 00524 }; 00525 #define DBservers 1 00526 00527 struct sprefinfo { 00528 unsigned short next_offset; 00529 unsigned short num_servers; 00530 struct spref servers[1]; /* we overrun this array intentionally... */ 00531 }; 00532 00533 struct setspref { 00534 unsigned short flags; 00535 unsigned short num_servers; 00536 struct spref servers[1]; /* we overrun this array intentionally... */ 00537 }; 00538 /* struct for GAG pioctl 00539 */ 00540 struct gaginfo { 00541 afs_uint32 showflags, logflags, logwritethruflag, spare[3]; 00542 unsigned char spare2[128]; 00543 }; 00544 #define GAGUSER 1 00545 #define GAGCONSOLE 2 00546 #define logwritethruON 1 00547 00548 struct rxparams { 00549 afs_int32 rx_initReceiveWindow, rx_maxReceiveWindow, rx_initSendWindow, 00550 rx_maxSendWindow, rxi_nSendFrags, rxi_nRecvFrags, rxi_OrphanFragSize; 00551 afs_int32 rx_maxReceiveSize, rx_MyMaxSendSize; 00552 afs_uint32 spare[21]; 00553 }; 00554 00555 /* struct for checkservers */ 00556 00557 struct chservinfo { 00558 int magic; 00559 char tbuffer[128]; 00560 int tsize; 00561 afs_int32 tinterval; 00562 afs_int32 tflags; 00563 }; 00564 00565 00566 /* state bits for volume */ 00567 #define VRO 1 /* volume is readonly */ 00568 #define VRecheck 2 /* recheck volume info with server */ 00569 #define VBackup 4 /* is this a backup volume? */ 00570 #define VForeign 8 /* this is a non-afs volume */ 00571 #define VPartVisible 16 /* Volume's partition is visible on the client */ 00572 #define VHardMount 32 /* we are hard-mount waiting for the vol */ 00573 00574 enum repstate { not_busy, end_not_busy = 6, rd_busy, rdwr_busy, offline }; 00575 00576 struct volume { 00577 /* One structure per volume, describing where the volume is located 00578 * and where its mount points are. */ 00579 struct volume *next; /* Next volume in hash list. */ 00580 afs_int32 cell; /* the cell in which the volume resides */ 00581 afs_rwlock_t lock; /* the lock for this structure */ 00582 afs_int32 volume; /* This volume's ID number. */ 00583 char *name; /* This volume's name, or 0 if unknown */ 00584 struct server *serverHost[AFS_MAXHOSTS]; /* servers serving this volume */ 00585 enum repstate status[AFS_MAXHOSTS]; /* busy, offline, etc */ 00586 struct VenusFid dotdot; /* dir to access as .. */ 00587 struct VenusFid mtpoint; /* The mount point for this volume. */ 00588 afs_int32 rootVnode, rootUnique; /* Volume's root fid */ 00589 afs_int32 roVol; 00590 afs_int32 backVol; 00591 afs_int32 rwVol; /* For r/o vols, original read/write volume. */ 00592 afs_int32 accessTime; /* last time we used it */ 00593 afs_int32 vtix; /* volume table index */ 00594 afs_int32 copyDate; /* copyDate field, for tracking vol releases */ 00595 afs_int32 expireTime; /* for per-volume callbacks... */ 00596 short refCount; /* reference count for allocation */ 00597 char states; /* here for alignment reasons */ 00598 }; 00599 00600 #define afs_PutVolume(av, locktype) ((av)->refCount--) 00601 00602 /* format of an entry in volume info file */ 00603 struct fvolume { 00604 afs_int32 cell; /* cell for this entry */ 00605 afs_int32 volume; /* volume */ 00606 afs_int32 next; /* has index */ 00607 struct VenusFid dotdot; /* .. value */ 00608 struct VenusFid mtpoint; /* mt point's fid */ 00609 afs_int32 rootVnode, rootUnique; /* Volume's root fid */ 00610 }; 00611 00612 struct SimpleLocks { 00613 struct SimpleLocks *next; 00614 int type; 00615 afs_int32 boff, eoff; 00616 afs_int32 pid; 00617 #if defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) 00618 afs_int32 sysid; 00619 #endif 00620 }; 00621 00622 /* vcache state bits */ 00623 #define CStatd 0x00000001 /* has this file ever been stat'd? */ 00624 #define CBackup 0x00000002 /* file is on a backup volume */ 00625 #define CRO 0x00000004 /* is it on a read-only volume */ 00626 #define CMValid 0x00000008 /* is the mount point info valid? */ 00627 #define CCore 0x00000010 /* storing a core file, needed since we don't get an open */ 00628 #define CDirty 0x00000020 /* file has been modified since first open (... O_RDWR) */ 00629 #define CSafeStore 0x00000040 /* close must wait for store to finish (should be in fd) */ 00630 #define CMAPPED 0x00000080 /* Mapped files; primarily used by SunOS 4.0.x */ 00631 #define CNSHARE 0x00000100 /* support O_NSHARE semantics */ 00632 #define CLied 0x00000200 00633 #define CTruth 0x00000400 00634 00635 #if defined(AFS_DARWIN80_ENV) 00636 #define CDeadVnode 0x00000800 00637 #elif defined(AFS_DARWIN_ENV) 00638 #define CUBCinit 0x00000800 00639 #else 00640 #define CWRITE_IGN 0x00000800 /* Next OS hack only */ 00641 #endif 00642 00643 #define CUnique 0x00001000 /* vc's uniquifier - latest unifiquier for fid */ 00644 #define CForeign 0x00002000 /* this is a non-afs vcache */ 00645 #define CReadDir 0x00004000 /* readdir in progress */ 00646 #define CUnlinked 0x00010000 00647 #define CBulkStat 0x00020000 /* loaded by a bulk stat, and not ref'd since */ 00648 #define CUnlinkedDel 0x00040000 00649 #define CVFlushed 0x00080000 00650 #ifdef AFS_LINUX22_ENV 00651 #define CPageWrite 0x00200000 /* to detect vm deadlock - linux */ 00652 #elif defined(AFS_SGI_ENV) 00653 #define CWritingUFS 0x00200000 /* to detect vm deadlock - used by sgi */ 00654 #elif defined(AFS_DARWIN80_ENV) 00655 #define CEvent 0x00200000 /* to preclude deadlock when sending events */ 00656 #endif 00657 #define CCreating 0x00400000 /* avoid needless store after open truncate */ 00658 #define CPageHog 0x00800000 /* AIX - dumping large cores is a page hog. */ 00659 #define CDCLock 0x02000000 /* Vnode lock held over call to GetDownD */ 00660 #define CBulkFetching 0x04000000 /* stats are being fetched by bulk stat */ 00661 #define CExtendedFile 0x08000000 /* extended file via ftruncate call. */ 00662 #define CVInit 0x10000000 /* being initialized */ 00663 #define CMetaDirty 0x20000000 /* vnode meta-data needs to be flushed */ 00664 #define CPartVisible 0x40000000 /* fileserver partition visible on client */ 00665 00666 /* vcache vstate bits */ 00667 #define VRevokeWait 0x1 00668 #define VPageCleaning 0x2 /* Solaris - Cache Trunc Daemon sez keep out */ 00669 00670 /* Dirty disconnected vcache flags. */ 00671 #define VDisconSetTime 0x00000001 /* set time. */ 00672 #define VDisconSetMode 0x00000002 /* set mode. */ 00673 /* XXX: to be continued ? */ 00674 #define VDisconTrunc 0x00000020 /* truncate file. */ 00675 #define VDisconSetAttrMask 0x0000003F /* Masks for setattr ops. */ 00676 #define VDisconWriteClose 0x00000400 /* Write op on file close. */ 00677 #define VDisconWriteFlush 0x00000800 /* Write op on normal fsync/flush. */ 00678 #define VDisconWriteOsiFlush 0x00001000 /* Write op on osi flush. */ 00679 00680 #define VDisconRemove 0x00002000 /* Remove vnop. */ 00681 #define VDisconCreate 0x00004000 /* Create vnop. */ 00682 #define VDisconCreated 0x00008000 /* A file that was created during 00683 this resync operation */ 00684 #define VDisconRename 0x00010000 /* Rename vnop. */ 00685 #define VDisconRenameSameDir 0x00020000 /* Rename in same dir. */ 00686 00687 /*... to be continued ... */ 00688 00689 /* vcache (file) cachingStates bits */ 00690 #define FCSDesireBypass 0x1 /* This file should bypass the cache */ 00691 #define FCSBypass 0x2 /* This file is currently NOT being cached */ 00692 #define FCSManuallySet 0x4 /* The bypass flags were set, or reset, manually (via pioctl) 00693 and should not be overridden by the file's name */ 00694 00695 /* Flag values used by the Transition routines */ 00696 #define TRANSChangeDesiredBit 0x1 /* The Transition routine should set or 00697 * reset the FCSDesireBypass bit */ 00698 #define TRANSVcacheIsLocked 0x2 /* The Transition routine does not need to 00699 * lock vcache (it's already locked) */ 00700 #define TRANSSetManualBit 0x4 /* The Transition routine should set FCSManuallySet so that 00701 * filename checking does not override pioctl requests */ 00702 00703 #define CPSIZE 2 00704 #if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) 00705 #define vrefCount v->v_usecount 00706 #else 00707 #define vrefCount v.v_count 00708 #endif /* AFS_XBSD_ENV */ 00709 00710 #if defined(AFS_DARWIN80_ENV) 00711 #define VREFCOUNT_GT(v, y) vnode_isinuse(AFSTOV(v), (y)) 00712 #elif defined(AFS_FBSD_ENV) 00713 #define VREFCOUNT(v) (vrefcnt(AFSTOV(v))) 00714 #define VREFCOUNT_GT(v, y) (vrefcnt(AFSTOV(v)) > y) 00715 #elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) 00716 #define VREFCOUNT(v) ((v)->vrefCount) 00717 #define VREFCOUNT_GT(v, y) (AFSTOV(v)->v_usecount > (y)) 00718 #elif defined(AFS_LINUX24_ENV) 00719 #define VREFCOUNT(v) atomic_read(&(AFSTOV(v)->v_count)) 00720 #define VREFCOUNT_GT(v, y) (VREFCOUNT(v)>y) 00721 #define VREFCOUNT_SET(v, c) atomic_set(&(AFSTOV(v)->v_count), c) 00722 #define VREFCOUNT_DEC(v) atomic_dec(&(AFSTOV(v)->v_count)) 00723 #define VREFCOUNT_INC(v) atomic_inc(&(AFSTOV(v)->v_count)) 00724 #else 00725 #define VREFCOUNT(v) ((v)->vrefCount) 00726 #define VREFCOUNT_GT(v,y) ((v)->vrefCount > (y)) 00727 #define VREFCOUNT_SET(v, c) (v)->vrefCount = c; 00728 #define VREFCOUNT_DEC(v) (v)->vrefCount--; 00729 #define VREFCOUNT_INC(v) (v)->vrefCount++; 00730 #define d_unhash(d) list_empty(&(d)->d_hash) 00731 #define dget_locked(d) dget(d) 00732 #endif 00733 00734 #define AFS_MAXDV 0x7fffffff /* largest dataversion number */ 00735 #ifdef AFS_64BIT_CLIENT 00736 #define AFS_NOTRUNC 0x7fffffffffffffffLL /* largest positive int64 number */ 00737 #else /* AFS_64BIT_CLIENT */ 00738 #define AFS_NOTRUNC 0x7fffffff /* largest dataversion number */ 00739 #endif /* AFS_64BIT_CLIENT */ 00740 00741 extern afs_int32 vmPageHog; /* counter for # of vnodes which are page hogs. */ 00742 00743 #if defined(AFS_DARWIN80_ENV) 00744 #define VTOAFS(v) ((struct vcache *)vnode_fsnode((v))) 00745 #define AFSTOV(vc) ((vc)->v) 00746 #elif defined(AFS_NBSD40_ENV) 00747 struct nbvdata { 00748 struct genfs_node gfsn; 00749 struct vcache *afsvc; 00750 }; 00751 #define VTOAFS(v) ((((struct nbvdata *)((v)->v_data)))->afsvc) 00752 #define AFSTOV(vc) ((vc)->v) 00753 #elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || (defined(AFS_LINUX22_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)) 00754 #define VTOAFS(v) ((struct vcache *)(v)->v_data) 00755 #define AFSTOV(vc) ((vc)->v) 00756 #else 00757 #define VTOAFS(V) ((struct vcache *)(V)) 00758 #define AFSTOV(V) (&(V)->v) 00759 #endif 00760 00761 struct afs_vnuniq { 00762 afs_uint32 vnode; 00763 afs_uint32 unique; 00764 }; 00765 00766 /* VCache elements which are kept on disk, and in the kernel */ 00767 struct fvcache { 00768 struct VenusFid fid; 00769 struct mstat { 00770 afs_size_t Length; 00771 afs_hyper_t DataVersion; 00772 afs_uint32 Date; 00773 afs_uint32 Owner; 00774 afs_uint32 Group; 00775 afs_uint16 Mode; /* XXXX Should be afs_int32 XXXX */ 00776 afs_uint16 LinkCount; 00777 #ifdef AFS_DARWIN80_ENV 00778 afs_uint16 Type; 00779 #else 00780 /* vnode type is in v.v_type */ 00781 #endif 00782 } m; 00783 struct afs_vnuniq parent; 00784 00786 afs_size_t truncPos; 00787 00789 afs_int32 anyAccess; 00790 00792 afs_uint32 states; 00793 00795 afs_uint32 ddirty_flags; 00797 struct afs_vnuniq shadow; 00799 struct afs_vnuniq oldParent; 00800 }; 00801 00802 #ifdef AFS_SUN5_ENV 00803 /* 00804 * This is for the multiPage field in struct vcache. Each one of these 00805 * represents an outstanding getpage request that is larger than a single page. 00806 * Recording these is necessary to prevent afs_GetOnePage from trying to evict 00807 * a dcache entry that an earlier afs_GetOnePage call got in the same getpage 00808 * request. See osi_VM_MultiPageConflict and afs_getpage. 00809 */ 00810 struct multiPage_range { 00811 struct afs_q q; 00812 offset_t off; 00813 u_int len; 00814 }; 00815 #endif 00816 00817 /* INVARIANTs: (vlruq.next != NULL) == (vlruq.prev != NULL) 00818 * nextfree => !vlruq.next && ! vlruq.prev 00819 * !(avc->nextfree) && !avc->vlruq.next => (FreeVCList == avc->nextfree) 00820 */ 00821 struct vcache { 00822 #if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || (defined(AFS_LINUX22_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)) 00823 struct vnode *v; 00824 #else 00825 struct vnode v; /* Has reference count in v.v_count */ 00826 #endif 00827 struct afs_q vlruq; /* lru q next and prev */ 00828 #if !defined(AFS_LINUX22_ENV) 00829 struct vcache *nextfree; /* next on free list (if free) */ 00830 #endif 00831 struct vcache *hnext; /* Hash next */ 00832 struct afs_q vhashq; /* Hashed per-volume list */ 00834 struct afs_q dirtyq; 00836 struct afs_q shadowq; 00838 struct afs_q metadirty; 00840 afs_uint32 diskSlot; 00841 struct fvcache f; 00842 afs_rwlock_t lock; /* The lock on the vcache contents. */ 00843 #if defined(AFS_SUN5_ENV) 00844 /* Lock used to protect the activeV, multipage, and vstates fields. 00845 * Do not try to get the vcache lock when the vlock is held */ 00846 afs_rwlock_t vlock; 00847 #endif /* defined(AFS_SUN5_ENV) */ 00848 #if defined(AFS_SUN5_ENV) 00849 krwlock_t rwlock; 00850 struct cred *credp; 00851 #endif 00852 #ifdef AFS_BOZONLOCK_ENV 00853 afs_bozoLock_t pvnLock; /* see locks.x */ 00854 #endif 00855 #ifdef AFS_AIX32_ENV 00856 afs_lock_t pvmlock; 00857 vmhandle_t vmh; 00858 #if defined(AFS_AIX51_ENV) 00859 vmid_t segid; 00860 #else 00861 int segid; 00862 #endif 00863 struct ucred *credp; 00864 #endif 00865 #ifdef AFS_AIX_ENV 00866 int ownslock; /* pid of owner of excl lock, else 0 - defect 3083 */ 00867 #endif 00868 #ifdef AFS_DARWIN80_ENV 00869 lck_mtx_t *rwlock; 00870 #elif defined(AFS_DARWIN_ENV) 00871 struct lock__bsd__ rwlock; 00872 #endif 00873 #ifdef AFS_XBSD_ENV 00874 #if !defined(AFS_DFBSD_ENV) && !defined(AFS_NBSD_ENV) 00875 struct lock rwlock; 00876 #endif 00877 #endif 00878 00879 struct VenusFid *mvid; /* Either parent dir (if root) or root (if mt pt) */ 00880 char *linkData; /* Link data if a symlink. */ 00881 afs_hyper_t flushDV; /* data version last flushed from text */ 00882 afs_hyper_t mapDV; /* data version last flushed from map */ 00883 struct server *callback; /* The callback host, if any */ 00884 afs_uint32 cbExpires; /* time the callback expires */ 00885 struct afs_q callsort; /* queue in expiry order, sort of */ 00886 struct axscache *Access; /* a list of cached access bits */ 00887 afs_int32 last_looker; /* pag/uid from last lookup here */ 00888 #if defined(AFS_SUN5_ENV) 00889 afs_int32 activeV; 00890 #endif /* defined(AFS_SUN5_ENV) */ 00891 struct SimpleLocks *slocks; 00892 short opens; /* The numbers of opens, read or write, on this file. */ 00893 short execsOrWriters; /* The number of execs (if < 0) or writers (if > 0) of 00894 * this file. */ 00895 short flockCount; /* count of flock readers, or -1 if writer */ 00896 char mvstat; /* 0->normal, 1->mt pt, 2->root. */ 00897 00898 char cachingStates; /* Caching policies for this file */ 00899 afs_uint32 cachingTransitions; /* # of times file has flopped between caching and not */ 00900 00901 #if defined(AFS_LINUX24_ENV) 00902 off_t next_seq_offset; /* Next sequential offset (used by prefetch/readahead) */ 00903 #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI65_ENV) 00904 off_t next_seq_blk_offset; /* accounted in blocks for Solaris & IRIX */ 00905 #endif 00906 00907 #if defined(AFS_SUN5_ENV) 00908 afs_uint32 vstates; /* vstate bits */ 00909 #endif /* defined(AFS_SUN5_ENV) */ 00910 struct dcache *dchint; 00911 struct dcache *dcreaddir; /* dcache for in-progress readdir */ 00912 unsigned int readdir_pid; /* pid of the thread in readdir */ 00913 #if defined(AFS_SGI_ENV) 00914 daddr_t lastr; /* for read-ahead */ 00915 #ifdef AFS_SGI64_ENV 00916 uint64_t vc_rwlockid; /* kthread owning rwlock */ 00917 #else 00918 short vc_rwlockid; /* pid of process owning rwlock */ 00919 #endif 00920 short vc_locktrips; /* # of rwlock reacquisitions */ 00921 sema_t vc_rwlock; /* vop_rwlock for afs */ 00922 pgno_t mapcnt; /* # of pages mapped */ 00923 struct cred *cred; /* last writer's cred */ 00924 #ifdef AFS_SGI64_ENV 00925 struct bhv_desc vc_bhv_desc; /* vnode's behavior data. */ 00926 #endif 00927 #endif /* AFS_SGI_ENV */ 00928 #if defined(AFS_LINUX26_ENV) 00929 cred_t *cred; /* last writer's cred */ 00930 #endif 00931 #ifdef AFS_LINUX24_ENV 00932 struct dentry *target_link; /* dentry we prefer, when we are redirecting 00933 * all requests due to duplicate dentry aliases. 00934 * See LINUX/osi_vnodeops.c. Note that this is 00935 * NOT an actual reference to a dentry, so this 00936 * pointer MUST NOT be dereferenced on its own. */ 00937 #endif 00938 afs_int32 vc_error; /* stash write error for this vnode. */ 00939 int xlatordv; /* Used by nfs xlator */ 00940 afs_ucred_t *uncred; 00941 int asynchrony; /* num kbytes to store behind */ 00942 #ifdef AFS_SUN5_ENV 00943 struct afs_q multiPage; /* list of multiPage_range structs */ 00944 #endif 00945 int protocol; /* RX_FILESERVER, RX_OSD, ... defined in afsint.xg */ 00946 #if !defined(UKERNEL) 00947 void *vpacRock; /* used to read or write in visible partitions */ 00948 #endif 00949 }; 00950 00951 #define DONT_CHECK_MODE_BITS 0 00952 #define CHECK_MODE_BITS 1 00953 #define CMB_ALLOW_EXEC_AS_READ 2 /* For the NFS xlator */ 00954 00955 #if defined(AFS_SGI_ENV) 00956 #define AVCRWLOCK(avc) (valusema(&(avc)->vc_rwlock) <= 0) 00957 00958 /* SGI vnode rwlock macros and flags. */ 00959 #ifndef AFS_SGI62_ENV 00960 /* The following are defined here. SGI 6.2 declares them in vnode.h */ 00961 #define VRWLOCK_READ 0 00962 #define VRWLOCK_WRITE 1 00963 #define VRWLOCK_WRITE_DIRECT 2 00964 #endif 00965 00966 #ifdef AFS_SGI53_ENV 00967 #ifdef AFS_SGI62_ENV 00968 #define AFS_RWLOCK_T vrwlock_t 00969 #else 00970 #define AFS_RWLOCK_T int 00971 #endif /* AFS_SGI62_ENV */ 00972 #ifdef AFS_SGI64_ENV 00973 #include <ksys/behavior.h> 00974 #define AFS_RWLOCK(V,F) \ 00975 afs_rwlock(&VTOAFS(V)->vc_bhv_desc, (F)); 00976 #define AFS_RWUNLOCK(V,F) \ 00977 afs_rwunlock(&VTOAFS(V)->vc_bhv_desc, (F)); 00978 00979 #else 00980 #define AFS_RWLOCK(V,F) afs_rwlock((vnode_t *)(V), (F) ) 00981 #define AFS_RWUNLOCK(V,F) afs_rwunlock((vnode_t *)(V), (F) ) 00982 #endif 00983 #else /* AFS_SGI53_ENV */ 00984 #define AFS_RWLOCK(V,F) afs_rwlock((V)) 00985 #define AFS_RWUNLOCK(V,F) afs_rwunlock((V)) 00986 #endif /* AFS_SGI53_ENV */ 00987 #endif /* AFS_SGI_ENV */ 00988 00989 struct vcxstat { 00990 struct VenusFid fid; 00991 afs_hyper_t DataVersion; 00992 afs_rwlock_t lock; 00993 afs_int32 parentVnode; 00994 afs_int32 parentUnique; 00995 afs_hyper_t flushDV; 00996 afs_hyper_t mapDV; 00997 afs_int32 truncPos; 00998 afs_int32 randomUid[CPSIZE]; 00999 afs_int32 callback; /* Now a pointer to 'server' struct */ 01000 afs_int32 cbExpires; 01001 afs_int32 randomAccess[CPSIZE]; 01002 afs_int32 anyAccess; 01003 short opens; 01004 short execsOrWriters; 01005 short flockCount; 01006 char mvstat; 01007 afs_uint32 states; 01008 }; 01009 01010 struct vcxstat2 { 01011 afs_int32 callerAccess; 01012 afs_int32 cbExpires; 01013 afs_int32 anyAccess; 01014 char mvstat; 01015 }; 01016 01017 struct sbstruct { 01018 int sb_thisfile; 01019 int sb_default; 01020 }; 01021 01022 /* CM inititialization parameters. What CM actually used after calculations 01023 * based on passed in arguments. 01024 */ 01025 #define CMI_VERSION 1 /* increment when adding new fields. */ 01026 struct cm_initparams { 01027 int cmi_version; 01028 int cmi_nChunkFiles; 01029 int cmi_nStatCaches; 01030 int cmi_nDataCaches; 01031 int cmi_nVolumeCaches; 01032 int cmi_firstChunkSize; 01033 int cmi_otherChunkSize; 01034 int cmi_cacheSize; /* The original cache size, in 1K blocks. */ 01035 unsigned cmi_setTime:1; 01036 unsigned cmi_memCache:1; 01037 int spare[16 - 9]; /* size of struct is 16 * 4 = 64 bytes */ 01038 }; 01039 01040 01041 /*---------------------------------------------------------------------- 01042 * AFS Data cache definitions 01043 * 01044 * Each entry describes a Unix file on the local disk that is 01045 * is serving as a cached copy of all or part of a Vice file. 01046 * Entries live in circular queues for each hash table slot 01047 * 01048 * Which queue is this thing in? Good question. 01049 * A struct dcache entry is in the freeDSlot queue when not associated with a cache slot (file). 01050 * Otherwise, it is in the DLRU queue. The freeDSlot queue uses the lruq.next field as 01051 * its "next" pointer. 01052 * 01053 * Cache entries in the DLRU queue are either associated with vice files, in which case 01054 * they are hashed by afs_dvnextTbl and afs_dcnextTbl pointers, or they are in the freeDCList 01055 * and are not associated with any vice file. This last list uses the afs_dvnextTbl pointer for 01056 * its "next" pointer. 01057 *----------------------------------------------------------------------*/ 01058 01059 #define NULLIDX (-1) /* null index definition */ 01060 /* struct dcache states bits */ 01061 #define DRO 1 01062 #define DBackup 2 01063 #define DRW 4 01064 #define DWriting 8 /* file being written (used for cache validation) */ 01065 01066 /* dcache data flags */ 01067 #define DFEntryMod 0x02 /* has entry itself been modified? */ 01068 #define DFFetching 0x04 /* file is currently being fetched */ 01069 01070 /* dcache meta flags */ 01071 #define DFNextStarted 0x01 /* next chunk has been prefetched already */ 01072 #define DFFetchReq 0x10 /* someone is waiting for DFFetching to go on */ 01073 01074 01075 /* flags in afs_indexFlags array */ 01076 #define IFEverUsed 1 /* index entry has >= 1 byte of data */ 01077 #define IFFree 2 /* index entry in freeDCList */ 01078 #define IFDataMod 4 /* file needs to be written out */ 01079 #define IFFlag 8 /* utility flag */ 01080 #define IFDirtyPages 16 /* Solaris-only. contains dirty pages */ 01081 #define IFAnyPages 32 01082 #define IFDiscarded 64 /* index entry in discardDCList */ 01083 01084 #ifdef AFS_DARWIN100_ENV 01085 typedef user_addr_t iparmtype; /* 64 bit */ 01086 typedef user_addr_t uparmtype; /* 64 bit */ 01087 #else 01088 typedef char * uparmtype; 01089 #ifdef AFS_SGI65_ENV 01090 typedef afs_uint32 iparmtype; 01091 #else 01092 typedef long iparmtype; 01093 #endif 01094 #endif 01095 01096 #if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT 01097 # define uintptrsz unsigned int 01098 #elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG 01099 # define uintptrsz unsigned long 01100 #elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG_LONG 01101 # define uintptrsz unsigned long long 01102 #else 01103 # error "Unable to determine casting for pointers" 01104 #endif 01105 01106 struct afs_ioctl { 01107 uparmtype in; /* input buffer */ 01108 uparmtype out; /* output buffer */ 01109 short in_size; /* Size of input buffer <= 2K */ 01110 short out_size; /* Maximum size of output buffer, <= 2K */ 01111 }; 01112 01113 /* 01114 * This version of afs_ioctl is required to pass in 32 bit user space 01115 * pointers into a 64 bit kernel. 01116 */ 01117 01118 struct afs_ioctl32 { 01119 unsigned int in; 01120 unsigned int out; 01121 short in_size; 01122 short out_size; 01123 }; 01124 01125 01126 /* CacheItems file has a header of type struct afs_fheader 01127 * (keep aligned properly). Since we already have sgi_62 clients running 01128 * with a 32 bit inode, a change is required to the header so that 01129 * they can distinguish the old 32 bit inode CacheItems file and zap it 01130 * instead of using it. 01131 */ 01132 struct afs_fheader { 01133 #define AFS_FHMAGIC 0x7635abaf /* uses version number */ 01134 afs_int32 magic; 01135 #define AFS_CI_VERSION 4 01136 afs_int32 version; 01137 afs_uint32 dataSize; 01138 afs_int32 firstCSize; 01139 afs_int32 otherCSize; 01140 }; 01141 01142 #if defined(AFS_CACHE_VNODE_PATH) 01143 typedef char *afs_ufs_dcache_id_t; 01144 #elif defined(AFS_SGI61_ENV) || defined(AFS_SUN5_64BIT_ENV) 01145 /* Using ino64_t here so that user level debugging programs compile 01146 * the size correctly. 01147 */ 01148 typedef ino64_t afs_ufs_dcache_id_t; 01149 #elif defined(AFS_LINUX26_ENV) 01150 #define MAX_FH_LEN 10 01151 typedef union { 01152 #if defined(NEW_EXPORT_OPS) 01153 struct fid fh; 01154 #endif 01155 __u32 raw[MAX_FH_LEN]; 01156 } afs_ufs_dcache_id_t; 01157 extern int cache_fh_type; 01158 extern int cache_fh_len; 01159 #elif defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_S390X_LINUX24_ENV) 01160 typedef long afs_ufs_dcache_id_t; 01161 #elif defined(AFS_AIX51_ENV) || defined(AFS_HPUX1123_ENV) 01162 typedef ino_t afs_ufs_dcache_id_t; 01163 #else 01164 typedef afs_int32 afs_ufs_dcache_id_t; 01165 #endif 01166 01167 typedef afs_int32 afs_mem_dcache_id_t; 01168 01169 typedef union { 01170 afs_ufs_dcache_id_t ufs; 01171 afs_mem_dcache_id_t mem; 01172 } afs_dcache_id_t; 01173 01174 /* it does not compile outside kernel */ 01175 struct buffer { 01176 afs_int32 fid; /* is adc->index, the cache file number */ 01177 afs_dcache_id_t inode; /* is adc->f.inode, the inode number of the cac\ 01178 he file */ 01179 afs_int32 page; 01180 afs_int32 accesstime; 01181 struct buffer *hashNext; 01182 char *data; 01183 char lockers; 01184 char dirty; 01185 char hashIndex; 01186 afs_rwlock_t lock; /* the lock for this structure */ 01187 }; 01188 01189 /* kept on disk and in dcache entries */ 01190 struct fcache { 01191 struct VenusFid fid; /* Fid for this file */ 01192 afs_int32 modTime; /* last time this entry was modified */ 01193 afs_hyper_t versionNo; /* Associated data version number */ 01194 afs_int32 chunk; /* Relative chunk number */ 01195 afs_dcache_id_t inode; /* Unix inode for this chunk */ 01196 afs_int32 chunkBytes; /* Num bytes in this chunk */ 01197 char states; /* Has this chunk been modified? */ 01198 }; 01199 01200 /* magic numbers to specify the cache type */ 01201 01202 #define AFS_FCACHE_TYPE_UFS 0x0 01203 #define AFS_FCACHE_TYPE_MEM 0x1 01204 #define AFS_FCACHE_TYPE_NFS 0x2 01205 #define AFS_FCACHE_TYPE_EPI 0x3 01206 01207 /* kept in memory */ 01208 struct dcache { 01209 struct afs_q lruq; /* Free queue for in-memory images */ 01210 struct afs_q dirty; /* Queue of dirty entries that need written */ 01211 afs_rwlock_t lock; /* Protects validPos, some f */ 01212 afs_rwlock_t tlock; /* Atomizes updates to refCount */ 01213 afs_rwlock_t mflock; /* Atomizes accesses/updates to mflags */ 01214 afs_size_t validPos; /* number of valid bytes during fetch */ 01215 afs_int32 index; /* The index in the CacheInfo file */ 01216 short refCount; /* Associated reference count. */ 01217 char dflags; /* Data flags */ 01218 char mflags; /* Meta flags */ 01219 struct fcache f; /* disk image */ 01220 afs_int32 bucket; /* which bucket these dcache entries are in */ 01221 /* 01222 * Locking rules: 01223 * 01224 * dcache.lock protects the actual contents of the cache file (in 01225 * f.inode), subfields of f except those noted below, dflags and 01226 * validPos. 01227 * 01228 * dcache.tlock is used to make atomic updates to refCount. Zero 01229 * refCount dcache entries are protected by afs_xdcache instead of 01230 * tlock. 01231 * 01232 * dcache.mflock is used to access and update mflags. It cannot be 01233 * held without holding the corresponding dcache.lock. Updating 01234 * mflags requires holding dcache.lock(R) and dcache.mflock(W), and 01235 * checking for mflags requires dcache.lock(R) and dcache.mflock(R). 01236 * Note that dcache.lock(W) gives you the right to update mflags, 01237 * as dcache.mflock(W) can only be held with dcache.lock(R). 01238 * 01239 * dcache.index, dcache.f.fid, dcache.f.chunk and dcache.f.inode are 01240 * write-protected by afs_xdcache and read-protected by refCount. 01241 * Once an entry is referenced, these values cannot change, and if 01242 * it's on the free list (with refCount=0), it can be reused for a 01243 * different file/chunk. These values can only be written while 01244 * holding afs_xdcache(W) and allocating this dcache entry (thereby 01245 * ensuring noone else has a refCount on it). 01246 */ 01247 }; 01248 01249 /* afs_memcache.c */ 01250 struct memCacheEntry { 01251 int size; /* # of valid bytes in this entry */ 01252 int dataSize; /* size of allocated data area */ 01253 afs_lock_t afs_memLock; 01254 char *data; /* bytes */ 01255 }; 01256 01257 struct afs_FetchOutput { 01258 struct AFSVolSync tsync; 01259 struct AFSFetchStatus OutStatus; 01260 struct AFSCallBack CallBack; 01261 }; 01262 01263 /* macro to mark a dcache entry as bad */ 01264 #define ZapDCE(x) \ 01265 do { \ 01266 (x)->f.fid.Fid.Unique = 0; \ 01267 afs_indexUnique[(x)->index] = 0; \ 01268 (x)->dflags |= DFEntryMod; \ 01269 } while(0) 01270 01271 /* FakeOpen and Fake Close used to be real subroutines. They're only used in 01272 * sun_subr and afs_vnodeops, and they're very frequently called, so I made 01273 * them into macros. They do: 01274 * FakeOpen: fake the file being open for writing. avc->lock must be held 01275 * in write mode. Having the file open for writing is like having a DFS 01276 * write-token: you're known to have the best version of the data around, 01277 * and so the CM won't let it be overwritten by random server info. 01278 * FakeClose: undo the effects of FakeOpen, noting that we want to ensure 01279 * that a real close eventually gets done. We use CCore to achieve this if 01280 * we would end up closing the file. avc->lock must be held in write mode */ 01281 01282 #ifdef AFS_AIX_IAUTH_ENV 01283 #define CRKEEP(V, C) (V)->linkData = (char*)crdup((C)) 01284 #else 01285 #define CRKEEP(V, C) crhold((C)); (V)->linkData = (char*)(C) 01286 #endif 01287 01288 #define afs_FakeOpen(avc) { avc->opens++; avc->execsOrWriters++; } 01289 #define afs_FakeClose(avc, acred) \ 01290 { if (avc->execsOrWriters == 1) { \ 01291 /* we're the last writer, just use CCore flag */ \ 01292 avc->f.states |= CCore; /* causes close to be called later */ \ 01293 \ 01294 /* The cred and vnode holds will be released in afs_FlushActiveVcaches */ \ 01295 AFS_FAST_HOLD(avc); /* So it won't disappear */ \ 01296 CRKEEP(avc, acred); /* Should use a better place for the creds */ \ 01297 } \ 01298 else { \ 01299 /* we're not the last writer, let the last one do the store-back for us */ \ 01300 avc->opens--; \ 01301 avc->execsOrWriters--; \ 01302 } \ 01303 } 01304 01305 #define AFS_ZEROS 64 /* zero buffer */ 01306 01307 /*#define afs_DirtyPages(avc) (((avc)->f.states & CDirty) || osi_VMDirty_p((avc)))*/ 01308 #define afs_DirtyPages(avc) ((avc)->f.states & CDirty) 01309 01310 #define afs_InReadDir(avc) (((avc)->f.states & CReadDir) && (avc)->readdir_pid == MyPidxx2Pid(MyPidxx)) 01311 01312 /* The PFlush algorithm makes use of the fact that Fid.Unique is not used in 01313 below hash algorithms. Change it if need be so that flushing algorithm 01314 doesn't move things from one hash chain to another 01315 */ 01316 /* extern int afs_dhashsize; */ 01317 #define DCHash(v, c) ((((v)->Fid.Vnode + (v)->Fid.Volume + (c))) & (afs_dhashsize-1)) 01318 /*Vnode, Chunk -> Hash table index */ 01319 #define DVHash(v) ((((v)->Fid.Vnode + (v)->Fid.Volume )) & (afs_dhashsize-1)) 01320 /*Vnode -> Other hash table index */ 01321 /* don't hash on the cell, our callback-breaking code sometimes fails to compute 01322 the cell correctly, and only scans one hash bucket */ 01323 #define VCHash(fid) (((fid)->Fid.Volume + (fid)->Fid.Vnode) & (VCSIZE-1)) 01324 /* Hash only on volume to speed up volume callbacks. */ 01325 #define VCHashV(fid) ((fid)->Fid.Volume & (VCSIZE-1)) 01326 01327 extern struct dcache **afs_indexTable; /*Pointers to in-memory dcache entries */ 01328 extern afs_int32 *afs_indexUnique; /*dcache entry Fid.Unique */ 01329 extern afs_int32 *afs_dvnextTbl; /*Dcache hash table links */ 01330 extern afs_int32 *afs_dcnextTbl; /*Dcache hash table links */ 01331 extern afs_int32 afs_cacheFiles; /*Size of afs_indexTable */ 01332 extern afs_int32 afs_cacheBlocks; /*1K blocks in cache */ 01333 extern afs_int32 afs_cacheStats; /*Stat entries in cache */ 01334 extern struct vcache *afs_vhashT[VCSIZE]; /*Stat cache hash table */ 01335 extern struct afs_q afs_vhashTV[VCSIZE]; /* cache hash table on volume */ 01336 extern afs_int32 afs_initState; /*Initialization state */ 01337 extern afs_int32 afs_termState; /* Termination state */ 01338 extern struct VenusFid afs_rootFid; /*Root for whole file system */ 01339 extern afs_int32 afs_allCBs; /* Count of callbacks */ 01340 extern afs_int32 afs_oddCBs; /* Count of odd callbacks */ 01341 extern afs_int32 afs_evenCBs; /* Count of even callbacks */ 01342 extern afs_int32 afs_allZaps; /* Count of fid deletes */ 01343 extern afs_int32 afs_oddZaps; /* Count of odd fid deletes */ 01344 extern afs_int32 afs_evenZaps; /* Count of even fid deletes */ 01345 extern struct brequest afs_brs[NBRS]; /* request structures */ 01346 01347 #define UHash(auid) ((auid) & (NUSERS-1)) 01348 #define VHash(avol) ((avol)&(NVOLS-1)) 01349 #define SHash(aserv) ((ntohl(aserv)) & (NSERVERS-1)) 01350 #define FVHash(acell,avol) (((avol)+(acell)) & (NFENTRIES-1)) 01351 01352 /* Performance hack - we could replace VerifyVCache2 with the appropriate 01353 * GetVCache incantation, and could eliminate even this code from afs_UFSRead 01354 * by making intentionally invalidating quick.stamp in the various callbacks 01355 * expiration/breaking code */ 01356 #ifdef AFS_DARWIN_ENV 01357 #define afs_VerifyVCache(avc, areq) \ 01358 (((avc)->f.states & CStatd) ? (osi_VM_Setup(avc, 0), 0) : \ 01359 afs_VerifyVCache2((avc),areq)) 01360 #else 01361 #define afs_VerifyVCache(avc, areq) \ 01362 (((avc)->f.states & CStatd) ? 0 : afs_VerifyVCache2((avc),areq)) 01363 #endif 01364 01365 #define DO_STATS 1 /* bits used by FindVCache */ 01366 #define DO_VLRU 2 01367 #define IS_SLOCK 4 01368 #define IS_WLOCK 8 01369 01370 /* values for adown value of afs_LoopServers */ 01371 #define AFS_LS_UP 0 01372 #define AFS_LS_DOWN 1 01373 #define AFS_LS_ALL 2 01374 01375 /* values for flag param of afs_CheckVolumeNames */ 01376 #define AFS_VOLCHECK_EXPIRED 0x1 /* volumes whose callbacks have expired */ 01377 #define AFS_VOLCHECK_BUSY 0x2 /* volumes which were marked busy */ 01378 #define AFS_VOLCHECK_MTPTS 0x4 /* mount point invalidation also */ 01379 #define AFS_VOLCHECK_FORCE 0x8 /* do all forcibly */ 01380 01381 #endif /* KERNEL */ 01382 01383 #define AFS_FSPORT ((unsigned short) htons(7000)) 01384 #define AFS_VLPORT ((unsigned short) htons(7003)) 01385 #define AFS_RXOSDPORT ((unsigned short) htons(7011)) 01386 01387 #define afs_rdwr(avc, uio, rw, io, cred) \ 01388 (((rw) == UIO_WRITE) ? afs_write(avc, uio, io, cred, 0) : afs_read(avc, uio, cred, 0)) 01389 #define afs_nlrdwr(avc, uio, rw, io, cred) \ 01390 (((rw) == UIO_WRITE) ? afs_write(avc, uio, io, cred, 1) : afs_read(avc, uio, cred, 1)) 01391 01392 /* Cache size truncation uses the following low and high water marks: 01393 * If the cache is more than 95% full (CM_DCACHECOUNTFREEPCT), the cache 01394 * truncation daemon is awakened and will free up space until the cache is 85% 01395 * (CM_DCACHESPACEFREEPCT - CM_DCACHEEXTRAPCT) full. 01396 * afs_UFSWrite and afs_GetDCache (when it needs to fetch data) will wait on 01397 * afs_WaitForCacheDrain if the cache is 98% (CM_WAITFORDRAINPCT) full. 01398 * afs_GetDownD wakes those processes once the cache is 95% full 01399 * (CM_CACHESIZEDRAINEDPCT). 01400 */ 01401 #define CM_MAXDISCARDEDCHUNKS 16 /* # of chunks */ 01402 #define CM_DCACHECOUNTFREEPCT 95 /* max pct of chunks in use */ 01403 #define CM_DCACHESPACEFREEPCT 90 /* max pct of space in use */ 01404 #define CM_DCACHEEXTRAPCT 5 /* extra to get when freeing */ 01405 #define CM_CACHESIZEDRAINEDPCT 95 /* wakeup processes when down to here. */ 01406 #define CM_WAITFORDRAINPCT 98 /* sleep if cache is this full. */ 01407 01408 /* when afs_cacheBlocks is large, settle for slightly decreased precision */ 01409 #define PERCENT(p, v) \ 01410 ((afs_cacheBlocks & 0xffe00000) ? ((v) / 100 * (p)) : ((p) * (v) / 100)) 01411 01412 #define afs_CacheIsTooFull() \ 01413 (afs_blocksUsed - afs_blocksDiscarded > \ 01414 PERCENT(CM_DCACHECOUNTFREEPCT, afs_cacheBlocks) || \ 01415 afs_freeDCCount - afs_discardDCCount < \ 01416 PERCENT(100 - CM_DCACHECOUNTFREEPCT, afs_cacheFiles)) 01417 01418 /* Handy max length of a numeric string. */ 01419 #define CVBS 12 /* max afs_int32 is 2^32 ~ 4*10^9, +1 for NULL, +luck */ 01420 01421 #define refpanic(foo) if (afs_norefpanic) \ 01422 { printf( foo ); afs_norefpanic++;} else osi_Panic( foo ) 01423 01424 /* 01425 ** these are defined in the AIX source code sys/fs_locks.h but are not 01426 ** defined anywhere in the /usr/include directory 01427 */ 01428 #if defined(AFS_AIX41_ENV) 01429 #define VN_LOCK(vp) simple_lock(&(vp)->v_lock) 01430 #define VN_UNLOCK(vp) simple_unlock(&(vp)->v_lock) 01431 #endif 01432 01433 /* get a file's serial number from a vnode */ 01434 #ifndef afs_vnodeToInumber 01435 #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV) 01436 #define afs_vnodeToInumber(V) VnodeToIno(V) 01437 #else 01438 #define afs_vnodeToInumber(V) (VTOI(V)->i_number) 01439 #endif /* AFS_SGI62_ENV */ 01440 #endif 01441 01442 /* get a file's device number from a vnode */ 01443 #ifndef afs_vnodeToDev 01444 #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV) 01445 #define afs_vnodeToDev(V) VnodeToDev(V) 01446 #elif defined(UKERNEL) 01447 #define afs_vnodeToDev(V) (VTOI(V) ? (VTOI(V)->i_dev) : (-1)) 01448 #else 01449 #define afs_vnodeToDev(V) (VTOI(V)->i_dev) 01450 #endif 01451 #endif 01452 01453 /* declare something so that prototypes don't flip out */ 01454 /* appears struct buf stuff is only actually passed around as a pointer, 01455 except with libuafs, in which case it is actually defined */ 01456 01457 struct buf; 01458 01459 struct rxfs_storeVariables { 01460 struct rx_call *call; 01461 struct vcache *vcache; 01462 char *tbuffer; 01463 struct iovec *tiov; 01464 afs_int32 tnio; 01465 afs_int32 hasNo64bit; 01466 struct AFSStoreStatus InStatus; 01467 }; 01468 01469 struct storeOps { 01470 int (*prepare)(void *rock, afs_uint32 size, afs_uint32 *bytestoxfer); 01471 int (*read)(void *rock, struct osi_file *tfile, afs_uint32 offset, 01472 afs_uint32 tlen, afs_uint32 *bytesread); 01473 int (*write)(void *rock, afs_uint32 tlen, afs_uint32 *byteswritten); 01474 int (*status)(void *rock); 01475 int (*padd)(void *rock, afs_uint32 tlen); 01476 int (*close)(void *rock, struct AFSFetchStatus *OutStatus, 01477 afs_int32 *doProcessFS); 01478 int (*destroy)(void **rock, afs_int32 error); 01479 int (*storeproc)(struct storeOps *, void *, struct dcache *, int *, 01480 afs_size_t *); 01481 }; 01482 01483 struct fetchOps { 01484 int (*more)(void *rock, afs_int32 *length, afs_uint32 *moredata); 01485 int (*read)(void *rock, afs_uint32 tlen, afs_uint32 *bytesread); 01486 int (*write)(void *rock, struct osi_file *fp, afs_uint32 offset, 01487 afs_uint32 tlen, afs_uint32 *byteswritten); 01488 int (*close)(void *rock, struct vcache *avc, struct dcache *adc, 01489 struct afs_FetchOutput *Outputs); 01490 int (*destroy)(void **rock, afs_int32 error); 01491 }; 01492 01493 /* fakestat support: opaque storage for afs_EvalFakeStat to remember 01494 * what vcache should be released. 01495 */ 01496 struct afs_fakestat_state { 01497 char valid; 01498 char did_eval; 01499 char need_release; 01500 struct vcache *root_vp; 01501 }; 01502 01503 extern int afs_fakestat_enable; 01504 extern int afsd_dynamic_vcaches; 01505 01506 /* 01507 * Wrappers for access to credentials structure members 01508 * Linux uses the kernel cred structure if available, with the 01509 * wrappers defined in LINUX/osi_machdep.h 01510 */ 01511 #if defined(AFS_NBSD40_ENV) 01512 /* in osi_machdep.h as expected */ 01513 #elif defined (AFS_DARWIN110_ENV) 01514 #define afs_cr_uid(cred) kauth_cred_getuid((kauth_cred_t)(cred)) 01515 #define afs_cr_gid(cred) kauth_cred_getgid((kauth_cred_t)(cred)) 01516 #elif !(defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)) 01517 #define afs_cr_uid(cred) ((cred)->cr_uid) 01518 #define afs_cr_gid(cred) ((cred)->cr_gid) 01519 #if !defined(AFS_OBSD_ENV) 01520 #define afs_cr_ruid(cred) ((cred)->cr_ruid) 01521 #define afs_cr_rgid(cred) ((cred)->cr_rgid) 01522 #endif 01523 01524 #if !defined(AFS_DARWIN110_ENV) 01525 static_inline void 01526 afs_set_cr_uid(afs_ucred_t *cred, uid_t uid) { 01527 cred->cr_uid = uid; 01528 } 01529 static_inline void 01530 afs_set_cr_gid(afs_ucred_t *cred, gid_t gid) { 01531 cred->cr_gid = gid; 01532 } 01533 #if !defined(AFS_OBSD_ENV) 01534 static_inline void 01535 afs_set_cr_ruid(afs_ucred_t *cred, uid_t uid) { 01536 cred->cr_ruid = uid; 01537 } 01538 static_inline void 01539 afs_set_cr_rgid(afs_ucred_t *cred, gid_t gid) { 01540 cred->cr_rgid = gid; 01541 } 01542 #endif /* ! AFS_OBSD_ENV */ 01543 #endif /* ! AFS_DARWIN110_ENV */ 01544 #endif 01545 01546 #ifdef AFS_SUN5_ENV 01547 01553 struct afssysa { 01554 long syscall; 01555 long parm1; 01556 long parm2; 01557 long parm3; 01558 long parm4; 01559 long parm5; 01560 long parm6; 01561 }; 01562 extern int Afs_syscall(struct afssysa *uap, rval_t *rvp); 01563 #endif /* AFS_SUN5_ENV */ 01564 01565 /* 01566 * Various definitions for osi_sleep and its event hash table 01567 * DFBSD and SUNOS have no osi_sleep, and HPUX has its own hack for this stuff 01568 */ 01569 #define AFS_EVHASHSIZE 128 /* size of afs_evhasht, must be power of 2 */ 01570 01571 typedef struct afs_event { 01572 struct afs_event *next; /* next in hash chain */ 01573 char *event; /* lwp event: an address */ 01574 int refcount; /* Is it in use? */ 01575 int seq; /* Sequence number: this is incremented 01576 * by wakeup calls; wait will not return until 01577 * it changes */ 01578 #if defined(AFS_AIX_ENV) 01579 tid_t cond; 01580 #elif defined(AFS_DARWIN_ENV) 01581 # ifdef AFS_DARWIN80_ENV 01582 lck_mtx_t *lck; 01583 thread_t owner; 01584 # endif 01585 /* no cond member */ 01586 #elif defined(AFS_FBSD_ENV) || defined(AFS_OBSD_ENV) 01587 int cond; /* "all this gluck should probably be replaced by CVs" */ 01588 #elif defined(AFS_LINUX24_ENV) 01589 wait_queue_head_t cond; 01590 #elif defined(AFS_NBSD_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) 01591 kcondvar_t cond; /* Currently associated condition variable */ 01592 #endif 01593 } afs_event_t; 01594 01595 extern afs_event_t *afs_evhasht[AFS_EVHASHSIZE]; /* Hash table for events */ 01596 01597 #endif /* _AFS_H_ */