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
11 * afs_init.c - initialize AFS client.
16 #include <afsconfig.h>
17 #include "afs/param.h"
21 #include "afs/sysincludes.h" /* Standard vendor system headers */
22 #include "afsincludes.h" /* Afs-based standard headers */
23 #include "afs/afs_stats.h" /* afs statistics */
24 #include "rx/rxstat.h"
25 #if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED)
26 #include <linux/cred.h>
29 #define FSINT_COMMON_XG
30 #include "afs/afscbint.h"
32 /* Exported variables */
33 struct osi_dev cacheDev; /*Cache device */
34 afs_int32 cacheInfoModTime; /*Last time cache info modified */
35 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
36 struct mount *afs_cacheVfsp = 0;
37 #elif defined(AFS_LINUX20_ENV)
38 struct super_block *afs_cacheSBp = 0;
40 struct vfs *afs_cacheVfsp = 0;
42 afs_rwlock_t afs_puttofileLock; /* not used */
43 char *afs_sysname = 0; /* So that superuser may change the
44 * local value of @sys */
45 char *afs_sysnamelist[MAXNUMSYSNAMES]; /* For support of a list of sysname */
46 int afs_sysnamecount = 0;
47 int afs_sysnamegen = 0;
48 struct volume *Initialafs_freeVolList;
49 int afs_memvolumes = 0;
50 #if defined(AFS_XBSD_ENV)
51 static struct vnode *volumeVnode;
53 #if defined(AFS_DISCON_ENV)
54 afs_rwlock_t afs_discon_lock;
55 extern afs_rwlock_t afs_disconDirtyLock;
57 #if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED)
58 const struct cred *cache_creds;
61 /* This is the kernel side of the dynamic vcache setting */
62 #ifdef AFS_MAXVCOUNT_ENV
63 int afsd_dynamic_vcaches = 0; /* Enable dynamic-vcache support */
67 * Initialization order is important. Must first call afs_CacheInit,
68 * then cache file and volume file initialization routines. Next, the
69 * individual cache entry initialization routines are called.
79 * astatSize : The number of stat cache (vnode) entries to
81 * afiles : The number of disk files to allocate to the cache
82 * ablocks : The max number of 1 Kbyte blocks that all of
83 * the files in the cache may occupy.
84 * aDentries : Number of dcache entries to allocate.
85 * aVolumes : Number of volume cache entries to allocate.
86 * achunk : Power of 2 to make the chunks.
87 * aflags : Flags passed in.
88 * inodes : max inodes to pin down in inode[]
89 * users : what should size of per-user access cache be?
92 * This routine should only be called at initialization time, since
93 * it reclaims no resources and doesn't sufficiently synchronize
94 * with other processes.
97 struct cm_initparams cm_initParams;
98 static int afs_cacheinit_flag = 0;
100 afs_CacheInit(afs_int32 astatSize, afs_int32 afiles, afs_int32 ablocks,
101 afs_int32 aDentries, afs_int32 aVolumes, afs_int32 achunk,
102 afs_int32 aflags, afs_int32 ninodes, afs_int32 nusers, afs_int32 dynamic_vcaches)
104 register afs_int32 i;
105 register struct volume *tv;
107 AFS_STATCNT(afs_CacheInit);
109 * Jot down the epoch time, namely when this incarnation of the
110 * Cache Manager started.
112 afs_stats_cmperf.epoch = pag_epoch = osi_Time();
114 afs_stats_cmperf.sysName_ID = SYS_NAME_ID;
116 afs_stats_cmperf.sysName_ID = SYS_NAME_ID_UNDEFINED;
117 #endif /* SYS_NAME_ID */
119 #ifdef AFS_MAXVCOUNT_ENV
120 afsd_dynamic_vcaches = dynamic_vcaches;
121 printf("%s dynamically allocated vcaches\n",
122 ( afsd_dynamic_vcaches ? "enabling" : "disabling" ));
125 printf("Starting AFS cache scan...");
126 if (afs_cacheinit_flag)
128 afs_cacheinit_flag = 1;
129 cacheInfoModTime = 0;
131 LOCK_INIT(&afs_ftf, "afs_ftf");
132 AFS_RWLOCK_INIT(&afs_xaxs, "afs_xaxs");
133 #ifdef AFS_DISCON_ENV
134 AFS_RWLOCK_INIT(&afs_discon_lock, "afs_discon_lock");
135 AFS_RWLOCK_INIT(&afs_disconDirtyLock, "afs_disconDirtyLock");
136 QInit(&afs_disconDirty);
137 QInit(&afs_disconShadow);
142 * create volume list structure
146 else if (aVolumes > 32767)
149 tv = (struct volume *)afs_osi_Alloc(aVolumes * sizeof(struct volume));
150 for (i = 0; i < aVolumes - 1; i++)
151 tv[i].next = &tv[i + 1];
152 tv[aVolumes - 1].next = NULL;
153 afs_freeVolList = Initialafs_freeVolList = tv;
154 afs_memvolumes = aVolumes;
156 afs_cacheFiles = afiles;
157 afs_cacheStats = astatSize;
158 afs_vcacheInit(astatSize);
159 afs_dcacheInit(afiles, ablocks, aDentries, achunk, aflags);
160 #if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED)
162 * Save current credentials for later access to disk cache files.
163 * If selinux, apparmor or other security modules are enabled,
164 * they might deny access to cache files if the userspace process
165 * is restricted. Save the credentials used at cache initialisation
166 * for later use when opening cache files.
168 cache_creds = get_current_cred();
170 #ifdef AFS_64BIT_CLIENT
171 #ifdef AFS_VM_RDWR_ENV
172 afs_vmMappingEnd = AFS_CHUNKBASE(0x7fffffff);
173 #endif /* AFS_VM_RDWR_ENV */
174 #endif /* AFS_64BIT_CLIENT */
176 #if defined(AFS_AIX_ENV) && !defined(AFS_AIX51_ENV)
178 static void afs_procsize_init(void);
184 /* Save the initialization parameters for later pioctl queries. */
185 cm_initParams.cmi_version = CMI_VERSION;
186 cm_initParams.cmi_nChunkFiles = afiles;
187 cm_initParams.cmi_nStatCaches = astatSize;
188 cm_initParams.cmi_nDataCaches = aDentries;
189 cm_initParams.cmi_nVolumeCaches = aVolumes;
190 cm_initParams.cmi_firstChunkSize = AFS_FIRSTCSIZE;
191 cm_initParams.cmi_otherChunkSize = AFS_OTHERCSIZE;
192 cm_initParams.cmi_cacheSize = afs_cacheBlocks;
193 cm_initParams.cmi_setTime = afs_setTime;
194 cm_initParams.cmi_memCache = (aflags & AFSCALL_INIT_MEMCACHE) ? 1 : 0;
202 * afs_ComputeCacheParams
205 * Set some cache parameters.
212 afs_ComputeCacheParms(void)
214 register afs_int32 i;
215 afs_int32 afs_maxCacheDirty;
218 * Don't allow more than 2/3 of the files in the cache to be dirty.
220 afs_maxCacheDirty = (2 * afs_cacheFiles) / 3;
223 * Also, don't allow more than 2/3 of the total space get filled
224 * with dirty chunks. Compute the total number of chunks required
225 * to fill the cache, make sure we don't set out limit above 2/3 of
226 * that. If the cache size is greater than 1G, avoid overflow at
227 * the expense of precision on the chunk size.
229 if (afs_cacheBlocks & 0xffe00000) {
230 i = afs_cacheBlocks / (AFS_FIRSTCSIZE >> 10);
232 i = (afs_cacheBlocks << 10) / AFS_FIRSTCSIZE;
235 if (afs_maxCacheDirty > i)
236 afs_maxCacheDirty = i;
237 if (afs_maxCacheDirty < 1)
238 afs_maxCacheDirty = 1;
239 afs_stats_cmperf.cacheMaxDirtyChunks = afs_maxCacheDirty;
240 } /*afs_ComputeCacheParms */
244 * afs_LookupInodeByPath
246 * Look up inode given a file name.
247 * Optionally return the vnode too.
248 * If the vnode is not returned, we rele it.
251 afs_LookupInodeByPath(char *filename, afs_ufs_dcache_id_t *inode, struct vnode **fvpp)
255 #if defined(AFS_LINUX22_ENV)
257 code = gop_lookupname(filename, AFS_UIOSYS, 0, &dp);
260 osi_get_fh(dp, inode);
263 struct vnode *filevp;
264 code = gop_lookupname(filename, AFS_UIOSYS, 0, &filevp);
267 *inode = afs_vnodeToInumber(filevp);
279 afs_InitCellInfo(char *afile)
281 afs_dcache_id_t inode;
284 #ifdef AFS_CACHE_VNODE_PATH
285 inode.ufs = AFS_CACHE_CELLS_INODE;
287 code = afs_LookupInodeByPath(afile, &inode.ufs, NULL);
289 return afs_cellname_init(&inode, code);
296 * Set up the volume info storage file.
299 * afile : the file to be declared to be the volume info storage
300 * file for AFS. It must be already truncated to 0 length.
303 * This function is called only during initialization.
305 * WARNING: Data will be written to this file over time by AFS.
309 afs_InitVolumeInfo(char *afile)
312 struct osi_file *tfile;
314 AFS_STATCNT(afs_InitVolumeInfo);
315 #if defined(AFS_XBSD_ENV)
317 * On Open/Free/NetBSD, we can get into big trouble if we don't hold the volume file
318 * vnode. SetupVolume holds afs_xvolume lock exclusive.
319 * SetupVolume->GetVolSlot->UFSGetVolSlot->{GetVolCache or WriteVolCache}
320 * ->osi_UFSOpen->VFS_VGET()->ffs_vget->getnewvnode->vgone on some vnode.
321 * If it's AFS, then ->vclean->afs_nbsd_reclaim->FlushVCache->QueueVCB->
322 * GetVolume->FindVolume-> waits on afs_xvolume lock !
324 * In general, anything that's called with afs_xvolume locked must not
325 * end up calling getnewvnode(). The only cases I've found so far
326 * are things which try to get the volumeInode, and since we keep
329 code = afs_LookupInodeByPath(afile, &volumeInode.ufs, &volumeVnode);
330 #elif defined(AFS_CACHE_VNODE_PATH)
331 volumeInode.ufs = AFS_CACHE_VOLUME_INODE;
333 code = afs_LookupInodeByPath(afile, &volumeInode.ufs, NULL);
337 tfile = afs_CFileOpen(&volumeInode);
338 afs_CFileTruncate(tfile, 0);
339 afs_CFileClose(tfile);
347 * Set up the given file as the AFS cache info file.
350 * afile : Name of the file assumed to be the cache info file
351 * for the Cache Manager; it will be used as such.
352 * Side Effects: This sets afs_fragsize, which is used in the cache usage
353 * calculations such as in afs_adjustsize()
356 * This function is called only during initialization. The given
357 * file should NOT be truncated to 0 lenght; its contents descrebe
358 * what data is really in the cache.
360 * WARNING: data will be written to this file over time by AFS.
362 * NOTE: Starting to use separate osi_InitCacheInfo() routines to clean up
367 afs_InitCacheInfo(register char *afile)
369 register afs_int32 code;
370 struct osi_stat tstat;
371 register struct osi_file *tfile;
372 struct afs_fheader theader;
373 #ifndef AFS_LINUX22_ENV
374 struct vnode *filevp;
378 AFS_STATCNT(afs_InitCacheInfo);
379 if (cacheDiskType != AFS_FCACHE_TYPE_UFS)
380 osi_Panic("afs_InitCacheInfo --- called for non-ufs cache!");
381 #ifdef AFS_LINUX22_ENV
382 code = osi_InitCacheInfo(afile);
386 code = gop_lookupname(afile, AFS_UIOSYS, 0, &filevp);
390 #if defined(AFS_SUN56_ENV)
392 #elif defined(AFS_HPUX102_ENV)
394 #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) ||defined(AFS_HPUX100_ENV)
396 #elif defined(AFS_DARWIN80_ENV)
402 #if defined(AFS_SGI_ENV)
404 VFS_STATVFS(filevp->v_vfsp, &st, NULL, code);
407 if (!VFS_STATFS(filevp->v_vfsp, &st, NULL))
408 #endif /* AFS_SGI65_ENV */
409 #elif defined(AFS_SUN5_ENV) || defined(AFS_HPUX100_ENV)
410 if (!VFS_STATVFS(filevp->v_vfsp, &st))
411 #elif defined(AFS_AIX41_ENV)
412 if (!VFS_STATFS(filevp->v_vfsp, &st, &afs_osi_cred))
413 #elif defined(AFS_LINUX20_ENV)
418 VFS_STATFS(filevp->v_vfsp, &st);
421 #elif defined(AFS_DARWIN80_ENV)
422 afs_cacheVfsp = vnode_mount(filevp);
423 if (afs_cacheVfsp && ((st = *(vfs_statfs(afs_cacheVfsp))),1))
424 #elif defined(AFS_DARWIN_ENV)
425 if (!VFS_STATFS(filevp->v_mount, &st, current_proc()))
426 #elif defined(AFS_FBSD80_ENV)
427 if (!VFS_STATFS(filevp->v_mount, &st))
428 #elif defined(AFS_FBSD50_ENV)
429 if (!VFS_STATFS(filevp->v_mount, &st, curthread))
430 #elif defined(AFS_XBSD_ENV)
431 if (!VFS_STATFS(filevp->v_mount, &st, curproc))
433 if (!VFS_STATFS(filevp->v_vfsp, &st))
435 #if defined(AFS_SUN5_ENV) || defined(AFS_HPUX100_ENV)
436 if (strcmp("zfs", st.f_basetype) == 0) {
438 * Files in ZFS can take up to around the next
439 * recordsize boundary after being truncated. recordsize
440 * is reported in statvfs by f_bsize, so use that
443 afs_fsfragsize = st.f_bsize - 1;
445 afs_fsfragsize = st.f_frsize - 1;
448 afs_fsfragsize = st.f_bsize - 1;
451 #if defined(AFS_LINUX20_ENV)
452 cacheInode.ufs = filevp->i_ino;
453 afs_cacheSBp = filevp->i_sb;
454 #elif defined(AFS_XBSD_ENV)
455 cacheInode.ufs = VTOI(filevp)->i_number;
456 cacheDev.mp = filevp->v_mount;
457 cacheDev.held_vnode = filevp;
458 vref(filevp); /* Make sure mount point stays busy. XXX */
459 #if !defined(AFS_OBSD_ENV)
460 afs_cacheVfsp = filevp->v_vfsp;
463 #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
464 afs_InitDualFSCacheOps(filevp);
466 #ifndef AFS_CACHE_VNODE_PATH
467 #ifndef AFS_DARWIN80_ENV
468 afs_cacheVfsp = filevp->v_vfsp;
470 cacheInode.ufs = afs_vnodeToInumber(filevp);
472 cacheInode.ufs = AFS_CACHE_ITEMS_INODE;
474 cacheDev.dev = afs_vnodeToDev(filevp);
475 #endif /* AFS_LINUX20_ENV */
477 #endif /* AFS_LINUX22_ENV */
478 if (afs_fsfragsize < AFS_MIN_FRAGSIZE) {
479 afs_fsfragsize = AFS_MIN_FRAGSIZE;
481 tfile = osi_UFSOpen(&cacheInode);
482 afs_osi_Stat(tfile, &tstat);
483 cacheInfoModTime = tstat.mtime;
484 code = afs_osi_Read(tfile, -1, &theader, sizeof(theader));
486 if (code == sizeof(theader)) {
487 /* read the header correctly */
488 if (theader.magic == AFS_FHMAGIC
489 && theader.firstCSize == AFS_FIRSTCSIZE
490 && theader.otherCSize == AFS_OTHERCSIZE
491 && theader.version == AFS_CI_VERSION)
495 /* write out a good file label */
496 theader.magic = AFS_FHMAGIC;
497 theader.firstCSize = AFS_FIRSTCSIZE;
498 theader.otherCSize = AFS_OTHERCSIZE;
499 theader.version = AFS_CI_VERSION;
500 afs_osi_Write(tfile, 0, &theader, sizeof(theader));
502 * Truncate the rest of the file, since it may be arbitrarily
505 osi_UFSTruncate(tfile, sizeof(struct afs_fheader));
507 /* Leave the file open now, since reopening the file makes public pool
508 * vnode systems (like OSF/Alpha) much harder to handle, That's because
509 * they can do a vnode recycle operation any time we open a file, which
510 * we'd do on any afs_GetDSlot call, etc.
512 afs_cacheInodep = (struct osi_file *)tfile;
516 int afs_resourceinit_flag = 0;
518 afs_ResourceInit(int preallocs)
520 register afs_int32 i;
521 static struct rx_securityClass *secobj;
523 AFS_STATCNT(afs_ResourceInit);
524 AFS_RWLOCK_INIT(&afs_xuser, "afs_xuser");
525 AFS_RWLOCK_INIT(&afs_xvolume, "afs_xvolume");
526 AFS_RWLOCK_INIT(&afs_xserver, "afs_xserver");
527 AFS_RWLOCK_INIT(&afs_xsrvAddr, "afs_xsrvAddr");
528 AFS_RWLOCK_INIT(&afs_icl_lock, "afs_icl_lock");
529 AFS_RWLOCK_INIT(&afs_xinterface, "afs_xinterface");
530 LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock");
532 LOCK_INIT(&osi_fsplock, "osi_fsplock");
533 LOCK_INIT(&osi_flplock, "osi_flplock");
535 AFS_RWLOCK_INIT(&afs_xconn, "afs_xconn");
538 afs_InitCBQueue(1); /* initialize callback queues */
540 if (afs_resourceinit_flag == 0) {
541 afs_resourceinit_flag = 1;
542 for (i = 0; i < NFENTRIES; i++)
544 for (i = 0; i < MAXNUMSYSNAMES; i++)
545 afs_sysnamelist[i] = afs_osi_Alloc(MAXSYSNAME);
546 afs_sysname = afs_sysnamelist[0];
547 strcpy(afs_sysname, SYS_NAME);
548 afs_sysnamecount = 1;
552 secobj = rxnull_NewServerSecurityObject();
554 rx_NewService(0, 1, "afs", &secobj, 1, RXAFSCB_ExecuteRequest);
556 rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", &secobj, 1,
557 RXSTATS_ExecuteRequest);
559 afs_osi_Wakeup(&afs_server); /* wakeup anyone waiting for it */
562 } /*afs_ResourceInit */
564 #if defined(AFS_AIX_ENV) && !defined(AFS_AIX51_ENV)
567 * AIX dynamic sizeof(struct proc)
569 * AIX keeps its proc structures in an array. The size of struct proc
570 * varies from release to release of the OS. In order to maintain
571 * binary compatibility with releases later than what we build on, we
572 * need to determine the size of struct proc at run time.
574 * We need this in order to walk the proc[] array to do PAG garbage
577 * We also need this in order to support 'klog -setpag', since the
578 * kernel code needs to locate the proc structure for the parent process
579 * of the current process.
581 * To compute sizeof(struct proc), we need the addresses of two proc
582 * structures and their corresponding pids. Given the pids, we can use
583 * the PROCMASK() macro to compute their corresponding indices in the
584 * proc[] array. By dividing the distance between the pointers by the
585 * number of proc structures, we can compute the size of a single proc
588 * We know the base address of the proc table from v.vb_proc:
590 * <sys/sysconfig.h> declares sysconfig() and SYS_GETPARMS;
591 * (we don't use this, but I note it here for completeness)
593 * <sys/var.h> declares struct var and external variable v;
597 * v.ve_proc &proc[x] (current highwater mark for
598 * proc[] array usage)
600 * The first proc pointer is v.vb_proc, which is the proc structure for
601 * process 0. Process 0's pointer to its first child is the other proc
602 * pointer. If process 0 has no children, we simply give up and do not
603 * support features that require knowing the size of struct proc.
607 afs_procsize_init(void)
609 afs_proc_t *p0; /* pointer to process 0 */
610 afs_proc_t *pN; /* pointer to process 0's first child */
618 p0 = (afs_proc_t *)v.vb_proc;
620 afs_gcpags = AFS_GCPAGS_EPROC0;
635 afs_gcpags = AFS_GCPAGS_EPROCN;
639 if (pN->p_pid == p0->p_pid) {
640 afs_gcpags = AFS_GCPAGS_EEQPID;
644 pN_index = PROCMASK(pN->p_pid);
645 pN_offset = ((char *)pN - (char *)p0);
646 procsize = pN_offset / pN_index;
649 * check that the computation was exact
652 if (pN_index * procsize != pN_offset) {
653 afs_gcpags = AFS_GCPAGS_EINEXACT;
658 * check that the proc table size is a multiple of procsize.
661 if ((((char *)v.ve_proc - (char *)v.vb_proc) % procsize) != 0) {
662 afs_gcpags = AFS_GCPAGS_EPROCEND;
668 afs_gcpags_procsize = procsize;
676 * Clean up and shut down the AFS cache.
682 * Nothing interesting.
687 AFS_STATCNT(shutdown_cache);
688 afs_WriteThroughDSlots();
689 if (afs_cold_shutdown) {
690 afs_cacheinit_flag = 0;
695 afs_cacheFiles = afs_cacheBlocks = 0;
698 #if defined(AFS_XBSD_ENV)
699 vrele(volumeVnode); /* let it go, finally. */
701 if (cacheDev.held_vnode) {
702 vrele(cacheDev.held_vnode);
703 cacheDev.held_vnode = NULL;
706 afs_reset_inode(&cacheInode);
707 afs_reset_inode(&volumeInode);
708 cacheInfoModTime = 0;
710 afs_fsfragsize = 1023;
711 memset(&afs_stats_cmperf, 0, sizeof(afs_stats_cmperf));
712 memset(&cacheDev, 0, sizeof(struct osi_dev));
715 #if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED)
716 put_cred(cache_creds);
718 } /*shutdown_cache */
722 shutdown_vnodeops(void)
724 #if !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV)
725 struct buf *afs_bread_freebp = 0;
729 AFS_STATCNT(shutdown_vnodeops);
730 if (afs_cold_shutdown) {
731 #ifndef AFS_SUN5_ENV /* XXX */
734 #ifndef AFS_LINUX20_ENV
737 #if !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV)
738 afs_bread_freebp = 0;
749 register struct srvAddr *sa;
751 AFS_STATCNT(shutdown_AFS);
752 if (afs_cold_shutdown) {
753 afs_resourceinit_flag = 0;
755 * Free Volumes table allocations
759 for (i = 0; i < NVOLS; i++) {
760 for (tv = afs_volumes[i]; tv; tv = tv->next) {
762 afs_osi_Free(tv->name, strlen(tv->name) + 1);
771 * Free FreeVolList allocations
773 afs_osi_Free(Initialafs_freeVolList,
774 afs_memvolumes * sizeof(struct volume));
775 afs_freeVolList = Initialafs_freeVolList = 0;
777 /* XXX HACK fort MEM systems XXX
779 * For -memcache cache managers when we run out of free in memory volumes
780 * we simply malloc more; we won't be able to free those additional volumes.
786 * Free Users table allocation
789 struct unixuser *tu, *ntu;
790 for (i = 0; i < NUSERS; i++) {
791 for (tu = afs_users[i]; tu; tu = ntu) {
794 afs_osi_Free(tu->stp, tu->stLen);
796 EXP_RELE(tu->exporter);
797 afs_osi_Free(tu, sizeof(struct unixuser));
804 * Free Servers table allocation
807 struct server *ts, *nts;
808 struct afs_conn *tc, *ntc;
809 register struct afs_cbr *tcbrp, *tbrp;
811 for (i = 0; i < NSERVERS; i++) {
812 for (ts = afs_servers[i]; ts; ts = nts) {
814 for (sa = ts->addr; sa; sa = sa->next_sa) {
817 * Free all server's connection structs
823 rx_DestroyConnection(tc->id);
825 afs_osi_Free(tc, sizeof(struct afs_conn));
830 for (tcbrp = ts->cbrs; tcbrp; tcbrp = tbrp) {
832 * Free all server's callback structs
837 afs_osi_Free(ts, sizeof(struct server));
842 for (i = 0; i < NFENTRIES; i++)
844 /* Reinitialize local globals to defaults */
845 for (i = 0; i < MAXNUMSYSNAMES; i++)
846 afs_osi_Free(afs_sysnamelist[i], MAXSYSNAME);
848 afs_sysnamecount = 0;
850 afs_setTimeHost = NULL;
852 afs_waitForever = afs_waitForeverCount = 0;
854 afs_server = (struct rx_service *)0;
855 AFS_RWLOCK_INIT(&afs_xconn, "afs_xconn");
856 memset(&afs_rootFid, 0, sizeof(struct VenusFid));
857 AFS_RWLOCK_INIT(&afs_xuser, "afs_xuser");
858 AFS_RWLOCK_INIT(&afs_xvolume, "afs_xvolume");
859 AFS_RWLOCK_INIT(&afs_xserver, "afs_xserver");
860 LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock");