*/
char *cell = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
- code = afs_InitDynroot();
- if (!code) {
- AFS_COPYINSTR(AFSKPTR(parm2), cell, AFS_SMALLOCSIZ, &bufferSize, code);
- }
+ afs_CellInit();
+ AFS_COPYINSTR(AFSKPTR(parm2), cell, AFS_SMALLOCSIZ, &bufferSize, code);
if (!code)
afs_SetPrimaryCell(cell);
osi_FreeSmallSpace(cell);
+ if (!code) {
+ code = afs_InitDynroot();
+ }
} else if (parm == AFSOP_CACHEINIT) {
struct afs_cacheParams cparms;
*/
struct afs_q CellLRU; /* Export for kdump */
-static char *afs_thiscell;
+static char *afs_thiscell = NULL;
afs_int32 afs_cellindex; /* Export for kdump */
/*!
void
afs_CellInit(void)
{
+ static char CellInit_done = 0;
+
+ if (CellInit_done)
+ return;
+
+ CellInit_done = 1;
+
AFS_RWLOCK_INIT(&afs_xcell, "afs_xcell");
AFS_RWLOCK_INIT(&afsdb_client_lock, "afsdb_client_lock");
AFS_RWLOCK_INIT(&afsdb_req_lock, "afsdb_req_lock");
setpgrp(getpid(), 0);
#endif /* mac2 */
+ /*
+ * Set the primary cell name.
+ */
+ afsd_call_syscall(AFSOP_SET_THISCELL, LclCellName);
+
/* Initialize RX daemons and services */
/* initialize the rx random number generator from user space */
afsconf_CellApply(cdir, ConfigCell, NULL);
afsconf_CellAliasApply(cdir, ConfigCellAlias, NULL);
- /*
- * Set the primary cell name.
- */
- afsd_call_syscall(AFSOP_SET_THISCELL, LclCellName);
-
/* Initialize AFS daemon threads. */
if (afsd_verbose)
printf("%s: Forking AFS daemon.\n", rn);