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
10 #ifndef _AFS_PROTOTYPES_H_
11 #define _AFS_PROTOTYPES_H_
14 extern int afs_Analyze(struct afs_conn
*aconn
, struct rx_connection
*rxconn
,
15 afs_int32 acode
, struct VenusFid
*afid
,
16 struct vrequest
*areq
,
17 int op
, afs_int32 locktype
, struct cell
*cellp
);
20 extern afs_rwlock_t afs_xaxs
;
21 extern struct axscache
*afs_SlowFindAxs(struct axscache
**cachep
,
23 extern struct axscache
*axs_Alloc(void);
24 extern void afs_RemoveAxs(struct axscache
**headp
, struct axscache
*axsp
);
25 extern void afs_FreeAllAxs(struct axscache
**headp
);
26 extern void shutdown_xscache(void);
29 extern void shutdown_bufferpackage(void);
32 extern int afs_cold_shutdown
;
33 extern char afs_rootVolumeName
[MAXROOTVOLNAMELEN
];
34 extern void afs_shutdown(void);
35 extern void afs_FlushCBs(void);
36 extern int afs_CheckInit(void);
37 extern void afs_shutdown(void);
38 extern void shutdown_afstest(void);
39 extern int afs_syscall_call(long parm
, long parm2
, long parm3
,
40 long parm4
, long parm5
, long parm6
);
41 #if defined(AFS_DARWIN100_ENV)
42 extern int afs_syscall64_call(user_addr_t parm
, user_addr_t parm2
,
43 user_addr_t parm3
, user_addr_t parm4
,
44 user_addr_t parm5
, user_addr_t parm6
);
49 extern afs_int32 afs_allCBs
;
50 extern afs_int32 afs_oddCBs
;
51 extern afs_int32 afs_evenCBs
;
52 extern afs_int32 afs_allZaps
;
53 extern afs_int32 afs_oddZaps
;
54 extern afs_int32 afs_evenZaps
;
55 extern afs_int32 afs_connectBacks
;
56 extern unsigned long lastCallBack_vnode
;
57 extern unsigned int lastCallBack_dv
;
58 extern osi_timeval_t lastCallBack_time
;
59 extern struct interfaceAddr afs_cb_interface
;
61 extern int afs_RXCallBackServer(void);
62 extern int SRXAFSCB_GetCE(struct rx_call
*a_call
, afs_int32 a_index
,
63 struct AFSDBCacheEntry
*a_result
);
64 extern int SRXAFSCB_GetCE64(struct rx_call
*a_call
, afs_int32 a_index
,
65 struct AFSDBCacheEntry64
*a_result
);
66 extern int SRXAFSCB_GetLock(struct rx_call
*a_call
, afs_int32 a_index
,
67 struct AFSDBLock
*a_result
);
68 extern int SRXAFSCB_CallBack(struct rx_call
*a_call
,
69 struct AFSCBFids
*a_fids
,
70 struct AFSCBs
*a_callbacks
);
71 extern int SRXAFSCB_Probe(struct rx_call
*a_call
);
72 extern int SRXAFSCB_InitCallBackState(struct rx_call
*a_call
);
73 extern int SRXAFSCB_XStatsVersion(struct rx_call
*a_call
,
74 afs_int32
* a_versionP
);
75 extern int SRXAFSCB_GetXStats(struct rx_call
*a_call
,
76 afs_int32 a_clientVersionNum
,
77 afs_int32 a_collectionNumber
,
78 afs_int32
* a_srvVersionNumP
,
79 afs_int32
* a_timeP
, AFSCB_CollData
* a_dataP
);
80 extern int afs_RXCallBackServer(void);
81 extern int shutdown_CB(void);
82 extern int SRXAFSCB_InitCallBackState2(struct rx_call
*a_call
,
83 struct interfaceAddr
*addr
);
84 extern int SRXAFSCB_WhoAreYou(struct rx_call
*a_call
,
85 struct interfaceAddr
*addr
);
86 extern int SRXAFSCB_InitCallBackState3(struct rx_call
*a_call
,
88 extern int SRXAFSCB_ProbeUuid(struct rx_call
*a_call
, afsUUID
* a_uuid
);
89 extern int SRXAFSCB_GetServerPrefs(struct rx_call
*a_call
, afs_int32 a_index
,
90 afs_int32
* a_srvr_addr
,
91 afs_int32
* a_srvr_rank
);
92 extern int SRXAFSCB_GetCellServDB(struct rx_call
*a_call
, afs_int32 a_index
,
93 char **a_name
, serverList
* a_hosts
);
94 extern int SRXAFSCB_GetLocalCell(struct rx_call
*a_call
, char **a_name
);
95 extern int SRXAFSCB_GetCacheConfig(struct rx_call
*a_call
,
96 afs_uint32 callerVersion
,
97 afs_uint32
* serverVersion
,
98 afs_uint32
* configCount
,
99 cacheConfig
* config
);
100 extern int SRXAFSCB_FetchData(struct rx_call
*rxcall
, struct AFSFid
*Fid
,
101 afs_int32 Fd
, afs_int64 Position
,
102 afs_int64 Length
, afs_int64
* TotalLength
);
103 extern int SRXAFSCB_StoreData(struct rx_call
*rxcall
, struct AFSFid
*Fid
,
104 afs_int32 Fd
, afs_int64 Position
,
105 afs_int64 Length
, afs_int64
* TotalLength
);
109 extern afs_rwlock_t afs_xcbhash
;
110 extern void afs_QueueCallback(struct vcache
*avc
, unsigned int atime
,
112 extern void afs_CheckCallbacks(unsigned int secs
);
113 extern void afs_FlushCBs(void);
114 extern void afs_FlushServerCBs(struct server
*srvp
);
115 extern int afs_BumpBase(void);
116 extern void afs_InitCBQueue(int doLockInit
);
117 extern void afs_DequeueCallback(struct vcache
*avc
);
120 extern afs_int32 afs_cellindex
;
121 extern afs_rwlock_t afs_xcell
;
122 extern afs_rwlock_t afsdb_client_lock
;
123 extern afs_rwlock_t afsdb_req_lock
;
124 extern struct afs_q CellLRU
;
126 extern void afs_CellInit(void);
127 extern void shutdown_cell(void);
128 extern int afs_cellname_init(afs_dcache_id_t
*inode
, int lookupcode
);
129 extern int afs_cellname_write(void);
130 extern afs_int32
afs_NewCell(char *acellName
, afs_int32
* acellHosts
,
131 int aflags
, char *linkedcname
, u_short fsport
,
132 u_short vlport
, int timeout
);
133 extern afs_int32
afs_SetPrimaryCell(char *acellName
);
134 extern struct cell
*afs_GetCell(afs_int32 acell
, afs_int32 locktype
);
135 extern struct cell
*afs_GetCellStale(afs_int32 acell
, afs_int32 locktype
);
136 extern struct cell
*afs_GetCellByHandle(void *handle
, afs_int32 locktype
);
137 extern struct cell
*afs_GetCellByIndex(afs_int32 cellidx
, afs_int32 locktype
);
138 extern struct cell
*afs_GetCellByName(char *acellName
, afs_int32 locktype
);
139 extern struct cell
*afs_GetPrimaryCell(afs_int32 locktype
);
140 extern afs_int32
afs_GetPrimaryCellNum(void);
141 extern int afs_IsPrimaryCellNum(afs_int32 cellnum
);
142 extern int afs_IsPrimaryCell(struct cell
*cell
);
143 extern void *afs_TraverseCells(void *(*cb
) (struct cell
*, void *),
145 extern int afs_CellOrAliasExists(char *aname
);
146 extern int afs_CellNumValid(afs_int32 cellnum
);
147 extern afs_int32
afs_NewCellAlias(char *alias
, char *cell
);
148 extern struct cell_alias
*afs_GetCellAlias(int index
);
149 extern void afs_PutCellAlias(struct cell_alias
*a
);
150 extern int afs_AFSDBHandler(char *acellName
, int acellNameLen
,
151 afs_int32
* kernelMsg
);
152 extern void afs_LookupAFSDB(char *acellName
);
153 extern void afs_StopAFSDB(void);
154 extern void afs_RemoveCellEntry(struct server
*srvp
);
157 extern afs_int32 afs_FirstCSize
;
158 extern afs_int32 afs_OtherCSize
;
159 extern afs_int32 afs_LogChunk
;
162 extern struct cell
*afs_GetRealCellByIndex(afs_int32 cellindex
,
167 extern afs_int32 cryptall
;
168 extern afs_rwlock_t afs_xinterface
;
169 extern afs_rwlock_t afs_xconn
;
170 extern struct afs_conn
*afs_Conn(struct VenusFid
*afid
,
171 struct vrequest
*areq
,
173 struct rx_connection
**rxconn
);
174 extern struct afs_conn
*afs_ConnBySA(struct srvAddr
*sap
, unsigned short aport
,
175 afs_int32 acell
, struct unixuser
*tu
,
176 int force_if_down
, afs_int32 create
,
177 afs_int32 locktype
, afs_int32 replicated
,
178 struct rx_connection
**rxconn
);
179 extern struct afs_conn
*afs_ConnByMHosts(struct server
*ahosts
[],
180 unsigned short aport
, afs_int32 acell
,
181 struct vrequest
*areq
,
183 afs_int32 replicated
,
184 struct rx_connection
**rxconn
);
185 extern struct afs_conn
*afs_ConnByHost(struct server
*aserver
,
186 unsigned short aport
, afs_int32 acell
,
187 struct vrequest
*areq
, int aforce
,
189 afs_int32 replicated
,
190 struct rx_connection
**rxconn
);
191 extern void afs_PutConn(struct afs_conn
*ac
, struct rx_connection
*rxconn
,
193 extern void afs_ReleaseConns(struct sa_conn_vector
*tcv
);
194 extern void afs_ReleaseConnsUser(register struct unixuser
*au
);
195 extern void ForceNewConnections(struct srvAddr
*sap
);
199 extern afs_lock_t afs_xbrs
;
200 extern short afs_brsWaiters
;
201 extern short afs_brsDaemons
;
202 extern struct brequest afs_brs
[NBRS
];
203 extern struct afs_osi_WaitHandle AFS_WaitHandler
, AFS_CSWaitHandler
;
204 extern afs_int32 afs_gcpags
;
205 extern afs_int32 afs_gcpags_procsize
;
206 extern afs_int32 afs_CheckServerDaemonStarted
;
207 extern afs_int32 afs_probe_interval
;
208 extern afs_int32 afs_preCache
;
210 extern void afs_Daemon(void);
211 extern struct brequest
*afs_BQueue(short aopcode
,
213 afs_int32 dontwait
, afs_int32 ause
,
215 afs_size_t asparm0
, afs_size_t asparm1
,
216 void *apparm0
, void *apparm1
,
218 extern void afs_SetCheckServerNATmode(int isnat
);
219 extern void afs_CheckServerDaemon(void);
220 extern int afs_CheckRootVolume(void);
221 extern void afs_BRelease(struct brequest
*ab
);
222 extern int afs_BBusy(void);
223 extern int afs_BioDaemon(afs_int32 nbiods
);
225 extern int afs_BackgroundDaemon(struct afs_uspc_param
*uspc
, void *param1
, void *param2
);
227 extern void afs_BackgroundDaemon(void);
229 extern void shutdown_daemons(void);
230 extern int afs_sgidaemon(void);
234 extern u_int afs_min_cache
;
235 extern afs_int32
*afs_dvhashTbl
;
236 extern afs_int32 afs_dhashsize
;
237 extern afs_rwlock_t afs_xdcache
;
238 extern afs_size_t afs_vmMappingEnd
;
239 extern afs_int32 afs_blocksUsed
;
240 extern afs_int32 afs_blocksDiscarded
;
241 extern int afs_WaitForCacheDrain
;
242 extern int cacheDiskType
;
243 extern afs_uint32 afs_tpct1
, afs_tpct2
, splitdcache
;
244 extern unsigned char *afs_indexFlags
;
245 extern struct afs_cacheOps
*afs_cacheType
;
246 extern afs_dcache_id_t cacheInode
;
247 extern struct osi_file
*afs_cacheInodep
;
248 extern int DCHash(struct VenusFid
*fid
, afs_int32 chunk
);
249 extern int DVHash(struct VenusFid
*fid
);
250 extern void afs_dcacheInit(int afiles
, int ablocks
, int aDentries
, int achunk
,
252 extern int afs_PutDCache(struct dcache
*adc
);
253 extern void afs_FlushDCache(struct dcache
*adc
);
254 extern void shutdown_dcache(void);
255 extern void afs_CacheTruncateDaemon(void);
256 extern afs_int32 afs_fsfragsize
;
257 extern struct dcache
*afs_MemGetDSlot(afs_int32 aslot
, dslot_state type
);
258 extern struct dcache
*afs_GetDCache(struct vcache
*avc
,
260 struct vrequest
*areq
,
261 afs_size_t
* aoffset
, afs_size_t
* alen
,
263 extern struct dcache
*afs_FindDCache(struct vcache
*avc
,
265 extern void afs_StoreWarn(afs_int32 acode
, afs_int32 avolume
,
267 extern void afs_MaybeWakeupTruncateDaemon(void);
268 extern void afs_CacheTruncateDaemon(void);
269 extern void afs_AdjustSize(struct dcache
*adc
,
271 extern int afs_HashOutDCache(struct dcache
*adc
, int zap
);
272 extern int afs_MaybeFreeDiscardedDCache(void);
273 extern int afs_RefDCache(struct dcache
*adc
);
274 extern void afs_TryToSmush(struct vcache
*avc
,
275 afs_ucred_t
*acred
, int sync
);
276 extern void updateV2DC(int lockVc
, struct vcache
*v
, struct dcache
*d
,
278 extern void afs_WriteThroughDSlots(void);
279 extern struct dcache
*afs_UFSGetDSlot(afs_int32 aslot
, dslot_state type
);
280 extern int afs_WriteDCache(struct dcache
*adc
, int atime
);
281 extern int afs_wakeup(struct vcache
*avc
);
282 extern int afs_InitCacheFile(char *afile
, ino_t ainode
);
283 extern int afs_DCacheMissingChunks(struct vcache
*avc
);
284 extern struct dcache
*afs_ObtainDCacheForWriting(struct vcache
*avc
,
287 struct vrequest
*areq
,
289 extern void afs_PopulateDCache(struct vcache
*avc
, afs_size_t apos
,
290 struct vrequest
*areq
);
292 /* afs_disconnected.c */
295 extern afs_rwlock_t afs_dynrootDirLock
;
296 extern afs_rwlock_t afs_dynSymlinkLock
;
297 extern int afs_IsDynrootVolume(struct volume
*v
);
298 extern int afs_IsDynrootFid(struct VenusFid
*fid
);
299 extern int afs_IsDynrootMountFid(struct VenusFid
*fid
);
300 extern int afs_IsDynrootAnyFid(struct VenusFid
*fid
);
301 extern void afs_GetDynrootFid(struct VenusFid
*fid
);
302 extern void afs_GetDynrootMountFid(struct VenusFid
*fid
);
303 extern int afs_IsDynroot(struct vcache
*avc
);
304 extern int afs_IsDynrootMount(struct vcache
*avc
);
305 extern int afs_IsDynrootAny(struct vcache
*avc
);
306 extern void afs_DynrootInvalidate(void);
307 extern void afs_GetDynroot(char **dynrootDir
, int *dynrootLen
,
308 struct AFSFetchStatus
*status
);
309 extern void afs_GetDynrootMount(char **dynrootDir
, int *dynrootLen
,
310 struct AFSFetchStatus
*status
);
311 extern void afs_PutDynroot(void);
312 extern int afs_DynrootNewVnode(struct vcache
*avc
,
313 struct AFSFetchStatus
*status
);
314 extern int afs_InitDynroot(void);
315 extern int afs_SetDynrootEnable(int enable
);
316 extern int afs_GetDynrootEnable(void);
317 extern int afs_DynrootVOPRemove(struct vcache
*avc
, afs_ucred_t
*acred
,
319 extern int afs_DynrootVOPSymlink(struct vcache
*avc
, afs_ucred_t
*acred
,
320 char *aname
, char *atargetName
);
323 extern void init_et_to_sys_error(void);
324 extern afs_int32
et_to_sys_error(afs_int32 in
);
325 extern void afs_FinalizeReq(struct vrequest
*areq
);
326 extern int afs_CheckCode(afs_int32 acode
, struct vrequest
*areq
, int where
);
327 extern void afs_CopyError(struct vrequest
*afrom
,
328 struct vrequest
*ato
);
329 extern void init_sys_error_to_et(void);
332 extern struct afs_exporter
*root_exported
;
333 extern struct afs_exporter
*exporter_find(int type
);
334 extern void shutdown_exporter(void);
336 /* afs_fetchstore.c */
337 extern int afs_UFSCacheFetchProc(struct rx_call
*, struct osi_file
*,
338 afs_size_t
, struct dcache
*,
339 struct vcache
*, afs_size_t
*,
340 afs_size_t
*, afs_int32
);
342 extern int afs_UFSCacheStoreProc(struct rx_call
*, struct osi_file
*,
343 afs_int32
, struct vcache
*,
348 extern struct afs_icl_set
*afs_icl_allSets
;
349 extern int afs_icl_InitLogs(void);
350 extern void shutdown_icl(void);
351 extern int afs_icl_CreateLog(char *name
, afs_int32 logSize
,
352 struct afs_icl_log
**outLogpp
);
353 extern int afs_icl_CreateLogWithFlags(char *name
, afs_int32 logSize
,
355 struct afs_icl_log
**outLogpp
);
356 extern int afs_icl_CopyOut(struct afs_icl_log
*logp
,
357 afs_int32
* bufferp
, afs_int32
* bufSizep
,
358 afs_uint32
* cookiep
, afs_int32
* flagsp
);
359 extern int afs_icl_GetLogParms(struct afs_icl_log
*logp
, afs_int32
* maxSizep
,
360 afs_int32
* curSizep
);
361 extern int afs_icl_LogHold(struct afs_icl_log
*logp
);
362 extern int afs_icl_LogHoldNL(struct afs_icl_log
*logp
);
363 extern int afs_icl_LogUse(struct afs_icl_log
*logp
);
364 extern int afs_icl_LogFreeUse(struct afs_icl_log
*logp
);
365 extern int afs_icl_LogSetSize(struct afs_icl_log
*logp
,
367 extern int afs_icl_ZapLog(struct afs_icl_log
*logp
);
368 extern int afs_icl_LogRele(struct afs_icl_log
*logp
);
369 extern int afs_icl_LogReleNL(struct afs_icl_log
*logp
);
370 extern int afs_icl_ZeroLog(struct afs_icl_log
*logp
);
371 extern int afs_icl_LogFree(struct afs_icl_log
*logp
);
372 extern struct afs_icl_log
*afs_icl_FindLog(char *name
);
374 afs_icl_EnumerateLogs(int (*aproc
)
376 (char *name
, char *arock
, struct afs_icl_log
* tp
),
378 extern int afs_icl_CreateSet(char *name
, struct afs_icl_log
*baseLogp
,
379 struct afs_icl_log
*fatalLogp
,
380 struct afs_icl_set
**outSetpp
);
381 extern int afs_icl_CreateSetWithFlags(char *name
,
382 struct afs_icl_log
*baseLogp
,
383 struct afs_icl_log
*fatalLogp
,
385 struct afs_icl_set
**outSetpp
);
386 extern int afs_icl_SetEnable(struct afs_icl_set
*setp
, afs_int32 eventID
,
388 extern int afs_icl_GetEnable(struct afs_icl_set
*setp
, afs_int32 eventID
,
390 extern int afs_icl_ZeroSet(struct afs_icl_set
*setp
);
392 afs_icl_EnumerateSets(int (*aproc
)
394 (char *name
, char *arock
, struct afs_icl_log
* tp
),
396 extern int afs_icl_AddLogToSet(struct afs_icl_set
*setp
,
397 struct afs_icl_log
*newlogp
);
398 extern int afs_icl_SetSetStat(struct afs_icl_set
*setp
, int op
);
399 extern int afs_icl_SetHold(struct afs_icl_set
*setp
);
400 extern int afs_icl_ZapSet(struct afs_icl_set
*setp
);
401 extern int afs_icl_SetRele(struct afs_icl_set
*setp
);
402 extern int afs_icl_SetFree(struct afs_icl_set
*setp
);
403 extern struct afs_icl_set
*afs_icl_FindSet(char *name
);
405 extern int afs_icl_Event4(struct afs_icl_set
*setp
,
406 afs_int32 eventID
, afs_int32 lAndT
, long p1
,
407 long p2
, long p3
, long p4
);
408 extern int afs_icl_Event3(struct afs_icl_set
*setp
,
409 afs_int32 eventID
, afs_int32 lAndT
, long p1
,
411 extern int afs_icl_Event2(struct afs_icl_set
*setp
,
412 afs_int32 eventID
, afs_int32 lAndT
, long p1
,
414 extern int afs_icl_Event1(struct afs_icl_set
*setp
,
415 afs_int32 eventID
, afs_int32 lAndT
, long p1
);
416 extern int afs_icl_Event0(struct afs_icl_set
*setp
,
417 afs_int32 eventID
, afs_int32 lAndT
);
418 extern void afs_icl_AppendRecord(struct afs_icl_log
*logp
,
419 afs_int32 op
, afs_int32 types
, long p1
,
420 long p2
, long p3
, long p4
);
421 #if defined(AFS_NBSD_ENV)
422 extern int Afscall_icl(long opcode
, long p1
, long p2
, long p3
, long p4
,
425 extern int Afscall_icl(long opcode
, long p1
, long p2
, long p3
, long p4
,
428 #ifdef AFS_DARWIN100_ENV
429 extern int Afscall64_icl(int opcode
, user_addr_t p1
, user_addr_t p2
,
430 user_addr_t p3
, user_addr_t p4
, int *retval
);
434 extern struct cm_initparams cm_initParams
;
435 extern int afs_resourceinit_flag
;
436 extern afs_rwlock_t afs_puttofileLock
;
437 extern char *afs_sysname
;
438 extern char *afs_sysnamelist
[MAXNUMSYSNAMES
];
439 extern int afs_sysnamecount
;
440 extern int afs_sysnamegen
;
441 extern afs_int32 cacheInfoModTime
;
442 extern int afs_CacheInit(afs_int32 astatSize
, afs_int32 afiles
,
443 afs_int32 ablocks
, afs_int32 aDentries
,
444 afs_int32 aVolumes
, afs_int32 achunk
,
445 afs_int32 aflags
, afs_int32 ninodes
,
446 afs_int32 nusers
, afs_int32 dynamic_vcaches
);
447 extern void afs_ComputeCacheParms(void);
448 extern void afs_InitFHeader(struct afs_fheader
*aheader
);
449 extern int afs_InitCacheInfo(char *afile
);
450 extern int afs_InitVolumeInfo(char *afile
);
451 extern int afs_InitCellInfo(char *afile
);
452 extern int afs_ResourceInit(int preallocs
);
453 extern void shutdown_cache(void);
454 extern void shutdown_vnodeops(void);
455 extern void shutdown_AFS(void);
456 extern int afs_LookupInodeByPath(char *filename
, afs_ufs_dcache_id_t
*inode
,
457 struct vnode
**fvpp
);
460 extern void Lock_Init(struct afs_lock
*lock
);
461 extern void ObtainLock(struct afs_lock
*lock
, int how
,
462 unsigned int src_indicator
);
463 extern void ReleaseLock(struct afs_lock
*lock
, int how
);
464 extern int Afs_Lock_Trace(int op
, struct afs_lock
*alock
, int type
,
465 char *file
, int line
);
466 extern void Afs_Lock_Obtain(struct afs_lock
*lock
, int how
);
467 extern void Afs_Lock_ReleaseR(struct afs_lock
*lock
);
468 extern void Afs_Lock_ReleaseW(struct afs_lock
*lock
);
469 extern void afs_osi_SleepR(char *addr
,
470 struct afs_lock
*alock
);
471 extern void afs_osi_SleepW(char *addr
,
472 struct afs_lock
*alock
);
473 extern void afs_osi_SleepS(char *addr
,
474 struct afs_lock
*alock
);
480 extern afs_int32 afs_mariner
;
481 extern afs_int32 afs_marinerHost
;
482 extern struct rx_service
*afs_server
;
483 extern int afs_AddMarinerName(char *aname
,
485 extern char *afs_GetMariner(struct vcache
*avc
);
486 extern void afs_MarinerLogFetch(struct vcache
*avc
,
490 extern void afs_MarinerLog(char *astring
,
492 extern void shutdown_mariner(void);
494 /* afs_fetchstore.c */
495 extern int afs_CacheStoreVCache(struct dcache
**dcList
, struct vcache
*avc
,
496 struct vrequest
*areq
,
497 int sync
, unsigned int minj
,
498 unsigned int high
, unsigned int moredata
,
500 afs_size_t
*amaxStoredLength
);
501 extern int afs_CacheFetchProc(struct afs_conn
*tc
, struct rx_connection
*rxconn
,
503 afs_size_t abase
, struct dcache
*adc
,
504 struct vcache
*avc
, afs_int32 size
,
505 struct afs_FetchOutput
*tsmall
)
509 extern int afs_InitMemCache(int blkCount
, int blkSize
, int flags
);
510 extern int afs_MemCacheClose(struct osi_file
*file
);
511 extern void *afs_MemCacheOpen(afs_dcache_id_t
*ainode
);
512 extern int afs_MemReadBlk(struct osi_file
*fP
, int offset
,
513 void *dest
, int size
);
514 extern int afs_MemReadvBlk(struct memCacheEntry
*mceP
, int offset
,
515 struct iovec
*iov
, int nio
, int size
);
516 extern int afs_MemReadUIO(afs_dcache_id_t
*ainode
, struct uio
*uioP
);
517 extern int afs_MemWriteBlk(struct osi_file
*fP
, int offset
,
518 void *src
, int size
);
519 extern int afs_MemWritevBlk(struct memCacheEntry
*mceP
, int offset
,
520 struct iovec
*iov
, int nio
, int size
);
521 extern int afs_MemWriteUIO(struct vcache
*, afs_dcache_id_t
*, struct uio
*);
522 extern int afs_MemCacheTruncate(struct osi_file
*fP
,
524 extern void shutdown_memcache(void);
528 extern struct afs_exporter
*afs_nfsexported
;
529 extern struct afs_exporter
*afs_nfsexporter
;
530 extern void afs_nfsclient_init(void);
531 extern int afs_nfsclient_reqhandler(struct afs_exporter
*exporter
,
533 afs_uint32 host
, afs_int32
*pagparam
,
534 struct afs_exporter
**outexporter
);
535 extern void shutdown_nfsclnt(void);
538 extern afs_lock_t afs_ftf
;
539 extern void afs_osi_Invisible(void);
540 extern void afs_osi_Visible(void);
541 extern void afs_osi_RxkRegister(void);
542 extern void afs_osi_MaskSignals(void);
543 extern void afs_osi_UnmaskRxkSignals(void);
544 extern void afs_osi_MaskUserLoop(void);
545 extern void osi_Init(void);
546 extern void afs_osi_MaskSignals(void);
547 extern void afs_osi_UnmaskRxkSignals(void);
548 extern void afs_osi_RxkRegister(void);
549 extern void afs_osi_Invisible(void);
550 extern void shutdown_osi(void);
551 extern void shutdown_osinet(void);
552 extern void shutdown_osisleep(void);
553 extern int afs_osi_suser(void *credp
);
554 extern void afs_osi_TraverseProcTable(void);
555 #if defined(KERNEL) && !defined(UKERNEL)
556 extern const afs_ucred_t
*afs_osi_proc2cred(afs_proc_t
* pr
);
559 /* afs_osi_alloc.c */
560 #ifndef AFS_PRIVATE_OSI_ALLOCSPACES
561 extern afs_lock_t osi_fsplock
;
562 extern afs_lock_t osi_flplock
;
565 extern void *afs_osi_Alloc_debug(size_t x
, char *func
, int line
);
567 extern void afs_osi_Free(void *x
, size_t asize
);
569 #if !defined(AFS_OBSD44_ENV)
570 extern void afs_osi_FreeStr(char *x
);
572 extern void osi_FreeLargeSpace(void *adata
);
573 extern void osi_FreeSmallSpace(void *adata
);
574 extern void *osi_AllocLargeSpace(size_t size
);
575 extern void *osi_AllocSmallSpace(size_t size
);
576 extern void shutdown_osinet(void);
579 #if defined(AFS_SUN5_ENV)
580 extern int afs_setpag(afs_ucred_t
**credpp
);
581 #elif defined(AFS_FBSD_ENV)
582 extern int afs_setpag(struct thread
*td
, void *args
);
583 #elif defined(AFS_NBSD_ENV)
584 extern int afs_setpag(afs_proc_t
*p
, const void *args
, register_t
*retval
);
585 #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
586 extern int afs_setpag(afs_proc_t
*p
, void *args
, int *retval
);
588 extern int afs_setpag(void);
591 extern afs_uint32
genpag(void);
592 extern afs_uint32
getpag(void);
593 #if defined(AFS_FBSD_ENV)
594 extern int AddPag(struct thread
*td
, afs_int32 aval
, afs_ucred_t
**credpp
);
595 #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
596 extern int AddPag(afs_proc_t
*p
, afs_int32 aval
, afs_ucred_t
**credpp
);
598 extern int AddPag(afs_int32 aval
, afs_ucred_t
**credpp
);
600 extern int afs_InitReq(struct vrequest
*av
, afs_ucred_t
*acred
);
601 extern int afs_CreateReq(struct vrequest
**avpp
, afs_ucred_t
*acred
);
602 extern void afs_DestroyReq(struct vrequest
*av
);
603 extern afs_uint32
afs_get_pag_from_groups(gid_t g0a
, gid_t g1a
);
604 extern void afs_get_groups_from_pag(afs_uint32 pag
, gid_t
* g0p
, gid_t
* g1p
);
605 extern afs_int32
PagInCred(afs_ucred_t
*cred
);
608 #if !defined(AFS_DARWIN80_ENV)
609 extern int afsio_copy(struct uio
*ainuio
, struct uio
*aoutuio
,
610 struct iovec
*aoutvec
);
611 extern int afsio_trim(struct uio
*auio
, afs_int32 asize
);
612 extern void afsio_free(struct uio
*auio
);
615 extern struct uio
* afsio_partialcopy(struct uio
*auio
, size_t size
);
616 extern int afsio_skip(struct uio
*auio
, afs_int32 asize
);
619 extern int osi_Active(struct vcache
*avc
);
620 extern void osi_FlushPages(struct vcache
*avc
,
622 extern void osi_FlushText_really(struct vcache
*vp
);
623 extern int osi_VMDirty_p(struct vcache
*avc
);
625 extern void osi_ReleaseVM(struct vcache
*avc
, afs_ucred_t
*acred
);
629 /* LINUX/osi_fetchstore.c */
630 #ifdef AFS_LINUX26_ENV
631 extern int afs_linux_storeproc(struct storeOps
*, void *, struct dcache
*,
632 int *, afs_size_t
*);
635 /* ARCH/osi_crypto.c */
636 extern int osi_readRandom(void *, afs_size_t
);
638 /* ARCH/osi_misc.c */
639 extern void afs_osi_SetTime(osi_timeval_t
* atv
);
641 /* LINUX/osi_misc.c */
642 #ifdef AFS_LINUX20_ENV
643 #ifdef AFS_LINUX24_ENV
644 extern int osi_lookupname(char *aname
, uio_seg_t seg
, int followlink
,
645 struct dentry
**dpp
);
646 extern int osi_InitCacheInfo(char *aname
);
647 extern int osi_rdwr(struct osi_file
*osifile
, struct uio
*uiop
, int rw
);
648 extern void setup_uio(struct uio
*uiop
, struct iovec
*iovecp
, const char *buf
,
649 afs_offs_t pos
, int count
, uio_flag_t flag
,
651 extern int uiomove(char *dp
, int length
, uio_flag_t rw
, struct uio
*uiop
);
652 extern void osi_linux_free_inode_pages(void);
654 extern void osi_linux_mask(void);
655 extern void osi_linux_unmask(void);
656 extern int setpag(cred_t
** cr
, afs_uint32 pagvalue
, afs_uint32
* newpag
,
661 /* ARCH/osi_sleep.c */
662 extern void afs_osi_InitWaitHandle(struct afs_osi_WaitHandle
*achandle
);
663 extern void afs_osi_CancelWait(struct afs_osi_WaitHandle
*achandle
);
664 extern int afs_osi_Wait(afs_int32 ams
, struct afs_osi_WaitHandle
*ahandle
,
666 extern int afs_osi_TimedSleep(void *event
, afs_int32 ams
, int aintok
);
667 #ifndef afs_osi_Wakeup
668 extern int afs_osi_Wakeup(void *event
);
670 #ifndef afs_osi_Sleep
671 extern void afs_osi_Sleep(void *event
);
673 #ifndef afs_osi_SleepSig
674 extern int afs_osi_SleepSig(void *event
);
678 /* ARCH/osi_inode.c */
680 extern int afs_syscall_icreate(dev_t
, long, long, long, long, long,
681 rval_t
*, afs_ucred_t
*);
682 extern int afs_syscall_iopen(dev_t
, int, int, rval_t
*, afs_ucred_t
*);
683 extern int afs_syscall_iincdec(dev_t
, int, int, int, rval_t
*,
685 #elif defined(AFS_SGI65_ENV)
686 extern int afs_syscall_icreate(afs_uint32
, afs_uint32
, afs_uint32
, afs_uint32
, afs_uint32
, afs_uint32
, rval_t
*);
687 extern int afs_syscall_iopen(int, ino_t
, int, rval_t
*);
688 extern int afs_syscall_iincdec(int, int, int, int);
689 #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
690 #if defined(AFS_NBSD_ENV)
691 extern int afs_syscall_icreate(long, long, long, long, long, long, register_t
*);
692 extern int afs_syscall_iopen(int dev
, int inode
, int usrmod
, register_t
*);
694 extern int afs_syscall_icreate(long, long, long, long, long, long, long*);
695 extern int afs_syscall_iopen(int dev
, int inode
, int usrmod
, long *retval
);
697 extern int afs_syscall_iincdec(int dev
, int inode
, int inode_p1
, int amount
);
699 extern int afs_syscall_icreate(long, long, long, long, long, long);
700 extern int afs_syscall_iopen(int, int, int);
701 extern int afs_syscall_iincdec(int, int, int, int);
704 /* ARCH/osi_file.c */
705 extern int afs_osicred_initialized
;
706 extern void *osi_UFSOpen(afs_dcache_id_t
*ainode
);
707 #if defined(AFS_LINUX22_ENV)
708 extern void osi_get_fh(struct dentry
*dp
, afs_ufs_dcache_id_t
*ainode
);
710 extern int afs_osi_Stat(struct osi_file
*afile
,
711 struct osi_stat
*astat
);
712 extern int osi_UFSClose(struct osi_file
*afile
);
713 extern int osi_UFSTruncate(struct osi_file
*afile
, afs_int32 asize
);
714 extern void osi_DisableAtimes(struct vnode
*avp
);
715 extern int afs_osi_Read(struct osi_file
*afile
, int offset
,
716 void *aptr
, afs_int32 asize
);
717 extern int afs_osi_Write(struct osi_file
*afile
, afs_int32 offset
,
718 void *aptr
, afs_int32 asize
);
719 extern int afs_osi_MapStrategy(int (*aproc
) (struct buf
* bp
),
721 extern void shutdown_osifile(void);
724 /* ARCH/osi_groups.c */
726 extern int usr_setpag(afs_ucred_t
**cred
, afs_uint32 pagvalue
,
727 afs_uint32
* newpag
, int change_parent
);
729 # if defined AFS_XBSD_ENV
730 # if !defined(AFS_DFBSD_ENV)
731 # if defined(AFS_FBSD_ENV)
732 extern int setpag(struct thread
*td
, struct ucred
**cred
, afs_uint32 pagvalue
,
733 afs_uint32
* newpag
, int change_parent
);
735 # elif defined(AFS_NBSD_ENV)
736 extern int setpag(afs_proc_t
*proc
, afs_ucred_t
**cred
, afs_uint32 pagvalue
,
737 afs_uint32
* newpag
, int change_parent
);
739 extern int setpag(afs_proc_t
*proc
, struct ucred
**cred
, afs_uint32 pagvalue
,
740 afs_uint32
* newpag
, int change_parent
);
741 # endif /* AFS_FBSD_ENV */
742 # endif /* ! AFS_DFBSD_ENV */
743 # endif /* AFS_XBSD_ENV */
746 #if defined(AFS_LINUX26_ENV) || defined(AFS_PAG_ONEGROUP_ENV)
747 extern afs_int32
osi_get_group_pag(afs_ucred_t
*cred
);
753 extern int osi_VM_FlushVCache(struct vcache
*avc
);
754 extern void osi_VM_StoreAllSegments(struct vcache
*avc
);
755 extern void osi_VM_TryToSmush(struct vcache
*avc
, afs_ucred_t
*acred
,
757 extern void osi_VM_FlushPages(struct vcache
*avc
, afs_ucred_t
*credp
);
758 #if !defined(AFS_NBSD_ENV)
759 extern void osi_VM_Truncate(struct vcache
*avc
, int alen
, afs_ucred_t
*acred
);
761 extern void osi_VM_Truncate(struct vcache
*avc
, voff_t alen
, afs_ucred_t
*acred
);
763 extern void osi_VM_TryReclaim(struct vcache
*avc
, int *slept
);
764 extern void osi_VM_NukePages(struct vnode
*vp
, off_t offset
, off_t size
);
765 extern int osi_VM_Setup(struct vcache
*avc
, int force
);
768 extern int osi_VM_GetDownD(struct vcache
*avc
, struct dcache
*adc
);
769 extern int osi_VM_MultiPageConflict(struct vcache
*avc
, struct dcache
*adc
);
770 extern void osi_VM_PreTruncate(struct vcache
*avc
, int alen
,
775 /* ARCH/osi_vnodeops.c */
776 extern struct vnodeops Afs_vnodeops
;
777 extern int afs_inactive(struct vcache
*avc
, afs_ucred_t
*acred
);
782 extern afs_uint32 pag_epoch
;
783 extern afs_uint32 pagCounter
;
785 /* OS/osi_vfsops.c */
786 #if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV)
787 extern struct mount
*afs_globalVFS
;
789 extern struct vfs
*afs_globalVFS
;
791 extern struct vcache
*afs_globalVp
;
792 #ifdef AFS_LINUX20_ENV
793 extern void vcache2inode(struct vcache
*avc
);
794 extern void vcache2fakeinode(struct vcache
*rootvp
, struct vcache
*mpvp
);
798 extern int afs_mount(struct vfs
*afsp
, char *path
, void *data
);
799 extern int afs_root(OSI_VFS_DECL(afsp
), struct vnode
**avpp
);
800 extern int afs_unmount(struct vfs
*afsp
);
804 extern afs_int32 afs_nfs_server_addr
;
805 extern void afspag_Init(afs_int32 nfs_server_addr
);
806 extern void afspag_Shutdown(void);
809 extern afs_rwlock_t afs_xpagcell
;
810 extern afs_rwlock_t afs_xpagsys
;
811 extern int afspag_PUnlog(char *ain
, afs_int32 ainSize
,
812 afs_ucred_t
**acred
);
813 extern int afspag_PSetTokens(char *ain
, afs_int32 ainSize
,
814 afs_ucred_t
**acred
);
815 extern int afspag_PSetSysName(char *ain
, afs_int32 ainSize
,
816 afs_ucred_t
**acred
);
819 extern struct VenusFid afs_rootFid
;
820 extern afs_int32 afs_waitForever
;
821 extern short afs_waitForeverCount
;
822 extern afs_int32 afs_showflags
;
823 extern int afs_defaultAsynchrony
;
824 #if defined(AFS_DARWIN100_ENV)
825 extern int afs_syscall64_pioctl(user_addr_t path
, unsigned int com
,
826 user_addr_t cmarg
, int follow
, \
830 extern int afs_syscall_pioctl(char *path
, unsigned int com
, caddr_t cmarg
,
831 int follow
, rval_t
*rvp
, afs_ucred_t
*credp
);
832 #elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
833 extern int afs_syscall_pioctl(char *path
, unsigned int com
, caddr_t cmarg
,
834 int follow
, afs_ucred_t
*credp
);
836 extern int afs_syscall_pioctl(char *path
, unsigned int com
, caddr_t cmarg
,
839 extern int HandleIoctl(struct vcache
*avc
, afs_int32 acom
,
840 struct afs_ioctl
*adata
);
844 extern int afs_StoreAllSegments(struct vcache
*avc
,
845 struct vrequest
*areq
, int sync
);
846 extern int afs_InvalidateAllSegments(struct vcache
*avc
);
847 extern int afs_ExtendSegments(struct vcache
*avc
,
848 afs_size_t alen
, struct vrequest
*areq
);
849 extern int afs_TruncateAllSegments(struct vcache
*avc
,
850 afs_size_t alen
, struct vrequest
*areq
,
854 extern afs_rwlock_t afs_xsrvAddr
;
855 extern afs_rwlock_t afs_xserver
;
856 extern afs_rwlock_t afs_icl_lock
;
857 extern struct srvAddr
*afs_srvAddrs
[NSERVERS
];
858 extern struct server
*afs_servers
[NSERVERS
];
859 extern int afs_totalServers
;
860 extern struct server
*afs_FindServer(afs_int32 aserver
, afs_uint16 aport
,
861 afsUUID
* uuidp
, afs_int32 locktype
);
862 extern struct server
*afs_GetServer(afs_uint32
* aserver
, afs_int32 nservers
,
863 afs_int32 acell
, u_short aport
,
864 afs_int32 locktype
, afsUUID
* uuidp
,
865 afs_int32 addr_uniquifier
,
867 extern void afs_GetCapabilities(struct server
*ts
);
868 extern void ForceAllNewConnections(void);
869 extern void afs_MarkServerUpOrDown(struct srvAddr
*sa
, int a_isDown
);
870 extern afs_int32
afs_ServerDown(struct srvAddr
*sa
, int code
,
871 struct rx_connection
*rxconn
);
872 extern void afs_CountServers(void);
873 extern void afs_CheckServers(int adown
, struct cell
*acellp
);
874 extern void afs_LoopServers(int adown
, struct cell
*acellp
, int vlalso
,
875 void (*func1
) (int nconns
, struct rx_connection
**rxconns
,
876 struct afs_conn
**conns
),
877 void (*func2
) (int nconns
, struct rx_connection
**rxconns
,
878 struct afs_conn
**conns
));
879 extern unsigned int afs_random(void);
880 extern int afs_randomMod15(void);
881 extern int afs_randomMod127(void);
882 extern void afs_SortOneServer(struct server
*asp
);
883 extern void afs_SortServers(struct server
*aservers
[], int count
);
884 extern void afs_ActivateServer(struct srvAddr
*sap
);
885 #ifdef AFS_USERSPACE_IP_ADDR
886 extern void afsi_SetServerIPRank(struct srvAddr
*sa
, afs_int32 addr
,
887 afs_uint32 subnetmask
);
889 #if (!defined(AFS_SUN5_ENV)) && defined(USEIFADDR)
890 void afsi_SetServerIPRank(struct srvAddr
*sa
, struct in_ifaddr
*ifa
);
893 extern int afs_HaveCallBacksFrom(struct server
*aserver
);
894 extern void afs_RemoveAllConns(void);
895 extern void afs_MarkAllServersUp(void);
898 extern int osi_dnlc_enter(struct vcache
*adp
, char *aname
, struct vcache
*avc
,
900 extern struct vcache
*osi_dnlc_lookup(struct vcache
*adp
, char *aname
,
902 extern int osi_dnlc_remove(struct vcache
*adp
, char *aname
,
904 extern int osi_dnlc_purgedp(struct vcache
*adp
);
905 extern int osi_dnlc_purgevp(struct vcache
*avc
);
906 extern int osi_dnlc_purge(void);
907 extern int osi_dnlc_purgevol(struct VenusFid
*fidp
);
908 extern int osi_dnlc_init(void);
909 extern int osi_dnlc_shutdown(void);
912 extern void afspag_SetPrimaryCell(char *acell
);
915 extern struct afs_CMStats afs_cmstats
;
916 extern struct afs_stats_CMPerf afs_stats_cmperf
;
917 extern struct afs_stats_CMFullPerf afs_stats_cmfullperf
;
918 extern afs_int32 afs_stats_XferSumBytes
[AFS_STATS_NUM_FS_XFER_OPS
];
919 extern void afs_InitStats(void);
920 extern void afs_GetCMStat(char **ptr
, unsigned *size
);
922 extern void afs_AddToMean(struct afs_MeanStats
*oldMean
, afs_int32 newValue
);
926 #ifdef AFS_DARWIN100_ENV
927 extern int copyin_afs_ioctl(user_addr_t cmarg
, struct afs_ioctl
*dst
);
929 extern int copyin_afs_ioctl(caddr_t cmarg
, struct afs_ioctl
*dst
);
932 #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
933 #ifdef AFS_DARWIN100_ENV
934 extern int afs3_syscall(afs_proc_t
*p
, void *args
, unsigned int *retval
);
935 #elif (defined(AFS_FBSD90_ENV) || defined(AFS_FBSD82_ENV)) && (__FreeBSD_version < 900044)
936 /* afs3_syscall prototype is in sys/sysproto.h
937 Yes, they put it in, then took it out again (renamed with a sys_ prefix) */
938 #elif defined(AFS_FBSD_ENV)
939 extern int afs3_syscall(struct thread
*p
, void *args
);
940 #elif defined(AFS_NBSD50_ENV)
941 extern int afs3_syscall(afs_proc_t
*p
, const void *args
, register_t
*retval
);
942 #elif defined(AFS_NBSD40_ENV)
943 extern int afs3_syscall(struct lwp
*p
, void *args
);
945 extern int afs3_syscall(afs_proc_t
*p
, void *args
, long *retval
);
950 extern int Afs_syscall(void);
954 struct ktc_tokenUnion
;
955 struct ktc_setTokenData
;
957 extern union tokenUnion
*afs_FindToken(struct tokenJar
*, rx_securityIndex
);
958 extern void afs_FreeTokens(struct tokenJar
**);
959 extern union tokenUnion
*afs_AddToken(struct tokenJar
**, rx_securityIndex
);
960 extern void afs_DiscardExpiredTokens(struct tokenJar
**, afs_int32
);
961 extern int afs_HasValidTokens(struct tokenJar
*, afs_int32
);
962 extern int afs_HasUsableTokens(struct tokenJar
*, afs_int32
);
963 extern void afs_AddRxkadToken(struct tokenJar
**, char *, int,
964 struct ClearToken
*);
965 extern int afs_AddTokenFromPioctl(struct tokenJar
**, struct ktc_tokenUnion
*);
966 extern int afs_ExtractTokensForPioctl(struct tokenJar
*, time_t,
967 struct ktc_setTokenData
*);
969 /* UKERNEL/afs_usrops.c */
971 extern void uafs_Shutdown(void);
972 extern void osi_ReleaseVM(struct vcache
*avc
, int len
,
974 extern int osi_GetTime(struct timeval
*tv
);
975 extern int iodone(struct usr_buf
*bp
);
976 extern int usr_ioctl(void);
977 extern int lookupname(char *fnamep
, int segflg
, int followlink
,
978 struct usr_vnode
**compvpp
);
979 extern int usr_uiomove(char *kbuf
, int n
, int rw
, struct usr_uio
*uio
);
980 extern int afs_osi_VOP_RDWR(struct usr_vnode
*vnodeP
, struct usr_uio
*uioP
,
981 int rw
, int flags
, afs_ucred_t
*credP
);
986 extern afs_rwlock_t afs_xuser
;
987 extern struct unixuser
*afs_users
[NUSERS
];
988 extern struct unixuser
*afs_FindUser(afs_int32 auid
, afs_int32 acell
,
990 extern struct unixuser
*afs_GetUser(afs_int32 auid
, afs_int32 acell
,
992 extern void afs_LockUser(struct unixuser
*au
, afs_int32 locktype
,
993 unsigned int src_indicator
);
994 extern void afs_NotifyUser(struct unixuser
*auser
, int event
);
997 extern afs_int32
afs_GCPAGs(afs_int32
* ReleasedCount
);
998 extern void afs_GCPAGs_perproc_func(afs_proc_t
* pproc
);
999 #endif /* AFS_GCPAGS */
1000 extern void afs_ComputePAGStats(void);
1001 extern void afs_PutUser(struct unixuser
*au
, afs_int32 locktype
);
1002 extern void afs_GCUserData(void);
1003 extern void afs_CheckTokenCache(void);
1004 extern void afs_ResetAccessCache(afs_int32 uid
, afs_int32 cell
, int alock
);
1005 extern void afs_ResetUserConns(struct unixuser
*auser
);
1006 extern void afs_SetPrimary(struct unixuser
*au
, int aflag
);
1007 extern void afs_MarkUserExpired(afs_int32 pag
);
1010 extern afs_int32
afs_strtoi_r(const char *str
, char **endptr
, afs_uint32
*ret
);
1011 extern afs_int32
afs_calc_inum(afs_int32 cell
, afs_int32 volume
,
1013 #ifndef afs_cv2string
1014 extern char *afs_cv2string(char *ttp
, afs_uint32 aval
);
1016 #ifndef afs_strcasecmp
1017 extern int afs_strcasecmp(const char *s1
, const char *s2
);
1020 extern char *afs_strcat(char *s1
, char *s2
);
1022 #ifdef AFS_OBSD34_ENV
1023 extern char *afs_strcpy(char *s1
, char *s2
);
1026 extern char *afs_strchr(char *s
, int c
);
1029 extern char *afs_strrchr(char *s
, int c
);
1031 extern char *afs_strdup(char *s
);
1032 extern void print_internet_address(char *preamble
, struct srvAddr
*sa
,
1033 char *postamble
, int flag
, int code
,
1034 struct rx_connection
*rxconn
);
1035 extern afs_int32
afs_data_pointer_to_int32(const void *p
);
1037 extern void afs_CheckLocks(void);
1038 extern int afs_badop(void);
1039 extern int afs_noop(void);
1040 extern afs_int32
afs_data_pointer_to_int32(const void *p
);
1045 /* AIX doesn't have usable va_args support in its kernel */
1046 extern void afs_warn();
1047 extern void afs_warnuser();
1048 extern void afs_warnall();
1050 extern void afs_warn(char *fmt
, ...)
1051 AFS_ATTRIBUTE_FORMAT(__printf__
, 1, 2);
1052 extern void afs_warnuser(char *fmt
, ...)
1053 AFS_ATTRIBUTE_FORMAT(__printf__
, 1, 2);
1054 extern void afs_warnall(char *fmt
, ...)
1055 AFS_ATTRIBUTE_FORMAT(__printf__
, 1, 2);
1059 extern int VCHash(struct VenusFid
*fid
);
1060 extern int VCHashV(struct VenusFid
*fid
);
1061 extern int afs_ShakeLooseVCaches(afs_int32 anumber
);
1062 extern afs_int32 afs_maxvcount
;
1063 extern afs_int32 afs_vcount
;
1064 extern int afsvnumbers
;
1065 extern afs_rwlock_t afs_xvreclaim
;
1066 extern afs_rwlock_t afs_xvcache
;
1067 extern afs_rwlock_t afs_xvcdirty
;
1068 extern afs_lock_t afs_xvcb
;
1069 extern struct afs_q VLRU
;
1070 extern afs_int32 vcachegen
;
1071 extern unsigned int afs_paniconwarn
;
1072 extern struct afs_q afs_vhashTV
[VCSIZE
];
1073 extern afs_int32 afs_bulkStatsLost
;
1074 extern int afs_norefpanic
;
1075 extern struct vcache
*ReclaimedVCList
;
1076 extern ino_t vcacheMetaInode
;
1077 extern struct osi_file
*afs_vcacheMetaInodep
;
1079 extern void afs_FlushReclaimedVcaches(void);
1080 void afs_vcacheInit(int astatSize
);
1081 extern struct vcache
*afs_FindVCache(struct VenusFid
*afid
, afs_int32
* retry
,
1083 extern void afs_BadFetchStatus(struct afs_conn
*tc
);
1084 extern int afs_CheckFetchStatus(struct afs_conn
*tc
,
1085 struct AFSFetchStatus
*status
);
1086 extern afs_int32
afs_FetchStatus(struct vcache
*avc
, struct VenusFid
*afid
,
1087 struct vrequest
*areq
,
1088 struct AFSFetchStatus
*Outsp
);
1090 extern afs_int32
afs_FlushVCBs(afs_int32 lockit
);
1091 extern void afs_InactiveVCache(struct vcache
*avc
, afs_ucred_t
*acred
);
1092 extern struct vcache
*afs_LookupVCache(struct VenusFid
*afid
,
1093 struct vrequest
*areq
,
1094 afs_int32
* cached
, struct vcache
*adp
,
1096 extern void afs_FlushAllVCaches(void);
1097 extern int afs_FlushVCache(struct vcache
*avc
, int *slept
);
1098 extern struct vcache
*afs_GetRootVCache(struct VenusFid
*afid
,
1099 struct vrequest
*areq
,
1101 struct volume
*tvolp
);
1102 extern struct vcache
*afs_NewVCache(struct VenusFid
*afid
,
1103 struct server
*serverp
);
1104 extern struct vcache
*afs_NewBulkVCache(struct VenusFid
*afid
,
1105 struct server
*serverp
, int seq
);
1106 extern int afs_VerifyVCache2(struct vcache
*avc
, struct vrequest
*areq
);
1107 extern struct vcache
*afs_GetVCache(struct VenusFid
*afid
,
1108 struct vrequest
*areq
, afs_int32
* cached
,
1109 struct vcache
*avc
);
1110 extern void afs_PutVCache(struct vcache
*avc
);
1111 extern int afs_RefVCache(struct vcache
*avc
);
1113 /* Flags for afs_StaleVCacheFlags */
1115 /* afs_xcbhash is already locked by the caller */
1116 #define AFS_STALEVC_CBLOCKED (0x01)
1118 /* Normally we assume we only need to invalidate cached
1119 * name -> vcache mappings for entries where the given
1120 * vcache is the parent dir. This flag says to also clear
1121 * entries for the vcache itself. */
1122 #define AFS_STALEVC_FILENAME (0x02)
1124 /* Do not touch the DNLC; the caller will deal with it. */
1125 #define AFS_STALEVC_NODNLC (0x04)
1127 /* Do not run afs_DequeueCallback; the caller will take
1128 * care of callback management. */
1129 #define AFS_STALEVC_NOCB (0x08)
1131 /* NULL-out the callback field of the vcache, to save code at the callsite. */
1132 #define AFS_STALEVC_CLEARCB (0x10)
1134 /* Skip the DNLC purge if CVInit or CVFlushed is set, for efficiency.
1135 * A transitional flag used to reduce the logic change during refactoring
1136 * that is expected to be removed and the purge behavior standardized. */
1137 #define AFS_STALEVC_SKIP_DNLC_FOR_INIT_FLUSHED (0x20)
1138 typedef unsigned int afs_stalevc_flags_t
;
1140 #define afs_StaleVCache(avc) afs_StaleVCacheFlags(avc, 0, 0)
1141 extern void afs_StaleVCacheFlags(struct vcache
*avc
, afs_stalevc_flags_t flags
,
1144 extern void afs_SetDataVersion(struct vcache
*avc
, afs_hyper_t
*avers
);
1146 extern void afs_ProcessFS(struct vcache
*avc
,
1147 struct AFSFetchStatus
*astat
,
1148 struct vrequest
*areq
);
1149 extern struct afs_cbr
*afs_AllocCBR(void);
1150 extern int afs_FreeCBR(struct afs_cbr
*asp
);
1151 extern void afs_RemoveVCB(struct VenusFid
*afid
);
1152 extern void afs_FlushActiveVcaches(afs_int32 doflocks
);
1153 extern int afs_WriteVCache(struct vcache
*avc
,
1154 struct AFSStoreStatus
*astatus
,
1155 struct vrequest
*areq
);
1156 extern int afs_RemoteLookup(struct VenusFid
*afid
,
1157 struct vrequest
*areq
, char *name
,
1158 struct VenusFid
*nfid
,
1159 struct AFSFetchStatus
*OutStatusp
,
1160 struct AFSCallBack
*CallBackp
,
1161 struct server
**serverp
,
1162 struct AFSVolSync
*tsyncp
);
1163 extern void afs_ResetVCache(struct vcache
*, afs_ucred_t
*, afs_int32 skipdnlc
);
1164 extern afs_int32
afs_NFSFindVCache(struct vcache
**avcp
,
1165 struct VenusFid
*afid
);
1166 extern void afs_vcacheInit(int astatSize
);
1167 extern void shutdown_vcache(void);
1168 extern void afs_DisconGiveUpCallbacks(void);
1169 extern void afs_ClearAllStatdFlag(void);
1171 /* VNOPS/afs_vnop_access.c */
1172 extern afs_int32
afs_GetAccessBits(struct vcache
*avc
,
1174 struct vrequest
*areq
);
1175 extern int afs_AccessOK(struct vcache
*avc
, afs_int32 arights
,
1176 struct vrequest
*areq
, afs_int32 check_mode_bits
);
1177 #if defined(AFS_SUN5_ENV) || (defined(AFS_SGI_ENV) && !defined(AFS_SGI65_ENV))
1178 extern int afs_access(OSI_VC_DECL(avc
), afs_int32 amode
, int flags
,
1179 afs_ucred_t
*acred
);
1181 extern int afs_access(OSI_VC_DECL(avc
), afs_int32 amode
,
1182 afs_ucred_t
*acred
);
1184 extern int afs_getRights(OSI_VC_DECL(avc
), afs_int32 arights
,
1185 afs_ucred_t
*acred
);
1187 /* VNOPS/afs_vnop_attrs.c */
1188 extern int afs_CopyOutAttrs(struct vcache
*avc
,
1189 struct vattr
*attrs
);
1190 #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
1191 extern int afs_getattr(OSI_VC_DECL(avc
), struct vattr
*attrs
, int flags
,
1192 afs_ucred_t
*acred
);
1194 extern int afs_getattr(OSI_VC_DECL(avc
), struct vattr
*attrs
,
1195 afs_ucred_t
*acred
);
1197 extern int afs_VAttrToAS(struct vcache
*avc
,
1199 struct AFSStoreStatus
*as
);
1200 #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
1201 extern int afs_setattr(OSI_VC_DECL(avc
), struct vattr
*attrs
,
1202 int flags
, afs_ucred_t
*acred
);
1204 extern int afs_setattr(OSI_VC_DECL(avc
), struct vattr
*attrs
,
1205 afs_ucred_t
*acred
);
1207 extern int afs_CreateAttr(struct vattr
**out
);
1208 extern void afs_DestroyAttr(struct vattr
*vattr
);
1210 /* VNOPS/afs_vnop_create.c */
1211 #ifdef AFS_SGI64_ENV
1212 extern int afs_create(OSI_VC_DECL(adp
), char *aname
, struct vattr
*attrs
,
1213 int flags
, int amode
, struct vcache
**avcp
,
1214 afs_ucred_t
*acred
);
1215 #else /* AFS_SGI64_ENV */
1216 extern int afs_create(OSI_VC_DECL(adp
), char *aname
, struct vattr
*attrs
,
1217 enum vcexcl aexcl
, int amode
, struct vcache
**avcp
,
1218 afs_ucred_t
*acred
);
1219 #endif /* AFS_SGI64_ENV */
1220 extern int afs_LocalHero(struct vcache
*avc
,
1222 AFSFetchStatus
* astat
, int aincr
);
1224 /* VNOPS/afs_vnop_dirops.c */
1226 extern int afs_mkdir(OSI_VC_DECL(adp
), char *aname
, struct vattr
*attrs
,
1227 struct vcache
**avcp
, afs_ucred_t
*acred
);
1228 #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
1229 extern int afs_rmdir(OSI_VC_DECL(adp
), char *aname
, struct vnode
*cdirp
,
1230 afs_ucred_t
*acred
);
1232 extern int afs_rmdir(OSI_VC_DECL(adp
), char *aname
, afs_ucred_t
*acred
);
1236 /* VNOPS/afs_vnop_fid.c */
1237 #ifdef AFS_AIX41_ENV
1238 int afs_fid(OSI_VC_DECL(avc
), struct fid
*fidpp
, struct ucred
*credp
);
1239 #elif defined(AFS_SUN5_ENV)
1240 int afs_fid(OSI_VC_DECL(avc
), struct fid
*fidpp
);
1242 int afs_fid(OSI_VC_DECL(avc
), struct fid
**fidpp
);
1243 #endif /* AFS_AIX41_ENV */
1245 /* VNOPS/afs_vnop_flock.c */
1246 extern void lockIdSet(struct AFS_FLOCK
*flock
, struct SimpleLocks
*slp
,
1248 extern int HandleFlock(struct vcache
*avc
, int acom
,
1249 struct vrequest
*areq
, pid_t clid
, int onlymine
);
1251 #if defined(AFS_SGI_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
1252 extern int afs_lockctl(struct vcache
* avc
, struct AFS_FLOCK
* af
, int acmd
,
1253 afs_ucred_t
* acred
, pid_t clid
);
1255 extern int afs_lockctl(struct vcache
* avc
, struct AFS_FLOCK
* af
, int acmd
,
1256 afs_ucred_t
* acred
);
1259 /* VNOPS/afs_vnop_link.c */
1260 #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
1261 extern int afs_link(OSI_VC_DECL(adp
), struct vcache
*avc
, char *aname
,
1262 afs_ucred_t
*acred
);
1264 extern int afs_link(struct vcache
*avc
, OSI_VC_DECL(adp
), char *aname
,
1265 afs_ucred_t
*acred
);
1268 /* VNOPS/afs_vnop_lookup.c */
1269 extern int EvalMountPoint(struct vcache
*avc
, struct vcache
*advc
,
1270 struct volume
**avolpp
,
1271 struct vrequest
*areq
);
1272 extern void afs_InitFakeStat(struct afs_fakestat_state
*state
);
1273 extern int afs_EvalFakeStat(struct vcache
**avcp
,
1274 struct afs_fakestat_state
*state
,
1275 struct vrequest
*areq
);
1276 extern int afs_TryEvalFakeStat(struct vcache
**avcp
,
1277 struct afs_fakestat_state
*state
,
1278 struct vrequest
*areq
);
1279 extern void afs_PutFakeStat(struct afs_fakestat_state
*state
);
1280 extern int afs_ENameOK(char *aname
);
1281 extern void Check_AtSys(struct vcache
*avc
, const char *aname
,
1282 struct sysname_info
*state
, struct vrequest
*areq
);
1283 extern int Next_AtSys(struct vcache
*avc
, struct vrequest
*areq
,
1284 struct sysname_info
*state
);
1285 extern int afs_DoBulkStat(struct vcache
*adp
, long dirCookie
,
1286 struct vrequest
*areqp
);
1288 #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
1289 extern int afs_lookup(OSI_VC_DECL(adp
), char *aname
, struct vcache
**avcp
,
1290 struct pathname
*pnp
, int flags
, struct vnode
*rdir
,
1291 afs_ucred_t
*acred
);
1292 #elif defined(UKERNEL)
1293 extern int afs_lookup(OSI_VC_DECL(adp
), char *aname
, struct vcache
**avcp
,
1294 afs_ucred_t
*acred
, int flags
);
1296 extern int afs_lookup(OSI_VC_DECL(adp
), char *aname
, struct vcache
**avcp
,
1297 afs_ucred_t
*acred
);
1300 /* VNOPS/afs_vnop_open.c */
1301 #ifdef AFS_SGI64_ENV
1302 extern int afs_open(bhv_desc_t
* bhv
, struct vcache
**avcp
, afs_int32 aflags
,
1303 afs_ucred_t
*acred
);
1305 extern int afs_open(struct vcache
**avcp
, afs_int32 aflags
,
1306 afs_ucred_t
*acred
);
1310 /* VNOPS/afs_vnop_read.c */
1311 extern int afs_read(struct vcache
*avc
, struct uio
*auio
,
1312 afs_ucred_t
*acred
, int noLock
);
1314 extern int afs_UFSReadUIO(afs_dcache_id_t
*cacheId
, struct uio
*tuiop
);
1316 extern void afs_PrefetchChunk(struct vcache
*avc
, struct dcache
*adc
,
1317 afs_ucred_t
*acred
, struct vrequest
*areq
);
1320 /* VNOPS/afs_vnop_readdir.c */
1321 extern int afs_rd_stash_i
;
1322 #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
1323 extern int afs_readdir(OSI_VC_DECL(avc
), struct uio
*auio
,
1324 afs_ucred_t
*acred
, int *eofp
);
1325 #elif defined(AFS_HPUX100_ENV)
1326 extern int afs_readdir2(OSI_VC_DECL(avc
), struct uio
*auio
,
1327 afs_ucred_t
*acred
);
1329 extern int afs_readdir(OSI_VC_DECL(avc
), struct uio
*auio
,
1330 afs_ucred_t
*acred
);
1333 /* VNOPS/afs_vnop_remove.c */
1334 extern int afsremove(struct vcache
*adp
, struct dcache
*tdc
,
1335 struct vcache
*tvc
, char *aname
,
1336 afs_ucred_t
*acred
, struct vrequest
*treqp
);
1337 extern int afs_remunlink(struct vcache
*avc
, int doit
);
1338 extern int afs_remove(OSI_VC_DECL(adp
), char *aname
, afs_ucred_t
*acred
);
1339 extern char *afs_newname(void);
1341 /* VNOPS/afs_vnop_rename.c */
1342 extern int afsrename(struct vcache
*aodp
, char *aname1
, struct vcache
*andp
,
1343 char *aname2
, afs_ucred_t
*acred
,
1344 struct vrequest
*areq
);
1346 extern int afs_rename(OSI_VC_DECL(aodp
), char *aname1
, struct vcache
*andp
,
1347 char *aname2
, struct pathname
*npnp
,
1348 afs_ucred_t
*acred
);
1350 extern int afs_rename(OSI_VC_DECL(aodp
), char *aname1
, struct vcache
*andp
,
1351 char *aname2
, afs_ucred_t
*acred
);
1354 /* VNOPS/afs_vnop_strategy.c */
1355 #if defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
1356 extern int afs_ustrategy(struct buf
*adp
, afs_ucred_t
*credp
);
1358 extern int afs_ustrategy(struct buf
*adp
);
1361 /* VNOPS/afs_vnop_symlink.c */
1362 extern int afs_MemHandleLink(struct vcache
*avc
,
1363 struct vrequest
*areq
);
1364 extern int afs_UFSHandleLink(struct vcache
*avc
,
1365 struct vrequest
*areq
);
1366 extern int afs_symlink(OSI_VC_DECL(adp
), char *aname
,
1367 struct vattr
*attrs
, char *atargetName
,
1368 struct vcache
**tvcp
, afs_ucred_t
*acred
);
1369 extern int afs_readlink(OSI_VC_DECL(avc
), struct uio
*auio
,
1370 afs_ucred_t
*acred
);
1372 /* VNOPS/afs_vnop_write.c */
1373 extern int afs_write(struct vcache
*avc
, struct uio
*auio
, int aio
,
1374 afs_ucred_t
*acred
, int noLock
);
1376 extern int afs_UFSWriteUIO(struct vcache
*, afs_dcache_id_t
*, struct uio
*);
1378 extern int afs_StoreOnLastReference(struct vcache
*avc
,
1379 struct vrequest
*treq
);
1380 extern int afs_DoPartialWrite(struct vcache
*avc
,
1381 struct vrequest
*areq
);
1382 extern int afs_closex(struct file
*afd
);
1384 #ifdef AFS_SGI65_ENV
1385 extern int afs_close(OSI_VC_DECL(avc
), afs_int32 aflags
,
1386 lastclose_t lastclose
, afs_ucred_t
*acred
);
1387 #elif defined(AFS_SGI64_ENV)
1388 extern int afs_close(OSI_VC_DECL(avc
), afs_int32 aflags
,
1389 lastclose_t lastclose
, off_t offset
,
1390 afs_ucred_t
*acred
, struct flid
*flp
);
1391 #elif defined(AFS_SGI_ENV)
1392 extern int afs_close(OSI_VC_DECL(avc
), afs_int32 aflags
,
1393 lastclose_t lastclose
, off_t offset
,
1394 afs_ucred_t
*acred
);
1395 #elif defined(AFS_SUN5_ENV)
1396 extern int afs_close(OSI_VC_DECL(avc
), afs_int32 aflags
, int count
,
1397 offset_t offset
, afs_ucred_t
*acred
);
1399 extern int afs_close(OSI_VC_DECL(avc
), afs_int32 aflags
,
1400 afs_ucred_t
*acred
);
1403 #if defined(AFS_SGI65_ENV)
1404 extern int afs_fsync(OSI_VC_DECL(avc
), int flags
, afs_ucred_t
*acred
,
1405 off_t start
, off_t stop
);
1406 #elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)
1407 extern int afs_fsync(OSI_VC_DECL(avc
), int flag
, afs_ucred_t
*acred
);
1409 extern int afs_fsync(OSI_VC_DECL(avc
), afs_ucred_t
*acred
);
1414 extern afs_int32 afs_FVIndex
;
1415 extern afs_int32 afs_volCounter
;
1416 extern afs_rwlock_t afs_xvolume
;
1417 extern struct volume
*afs_volumes
[NVOLS
];
1418 extern afs_dcache_id_t volumeInode
;
1419 extern struct volume
*afs_FindVolume(struct VenusFid
*afid
,
1420 afs_int32 locktype
);
1421 extern struct volume
*afs_freeVolList
;
1422 extern afs_int32 fvTable
[NFENTRIES
];
1423 extern void LockAndInstallVolumeEntry(struct volume
*av
, struct vldbentry
*ve
,
1425 extern void LockAndInstallNVolumeEntry(struct volume
*av
, struct nvldbentry
*ve
,
1427 extern void LockAndInstallUVolumeEntry(struct volume
*av
, struct uvldbentry
*ve
,
1428 int acell
, struct cell
*tcell
,
1429 struct vrequest
*areq
);
1430 extern void afs_ResetVolumeInfo(struct volume
*tv
);
1431 extern struct volume
*afs_MemGetVolSlot(afs_int32 volid
, struct cell
*cell
);
1432 extern void afs_ResetVolumes(struct server
*srvp
, struct volume
*tv
);
1433 extern struct volume
*afs_GetVolume(struct VenusFid
*afid
,
1434 struct vrequest
*areq
,
1435 afs_int32 locktype
);
1436 extern struct volume
*afs_GetVolumeByName(char *aname
,
1437 afs_int32 acell
, int agood
,
1438 struct vrequest
*areq
,
1439 afs_int32 locktype
);
1440 extern struct volume
*afs_UFSGetVolSlot(afs_int32 volid
, struct cell
*cell
);
1441 extern void afs_CheckVolumeNames(int flags
);
1443 /* Prototypes for generated files that aren't really in src/afs/ */
1446 extern afs_int32
afs_uuid_equal(afsUUID
* u1
, afsUUID
* u2
);
1447 extern afs_int32
afs_uuid_is_nil(afsUUID
* u1
);
1448 extern void afs_htonuuid(afsUUID
* uuidp
);
1449 extern void afs_ntohuuid(afsUUID
* uuidp
);
1450 extern afs_int32
afs_uuid_create(afsUUID
* uuid
);
1451 extern u_short
afs_uuid_hash(afsUUID
* uuid
);
1453 #if defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI62_ENV) || defined(UKERNEL)
1454 #include "osi_prototypes.h"
1457 #endif /* _AFS_PROTOTYPES_H_ */