#include <afsconfig.h>
#include "afs/param.h"
-RCSID
- ("$Header$");
#include "afs/stds.h"
#include "afs/sysincludes.h" /* Standard vendor system headers */
* afs_LookupAFSDB: look up AFSDB for given cell name and create locally
*/
-#ifdef AFS_AFSDB_ENV
afs_rwlock_t afsdb_client_lock; /* Serializes client requests */
afs_rwlock_t afsdb_req_lock; /* Serializes client requests */
static char afsdb_handler_running; /* Protected by GLOCK */
* Terminate the AFSDB handler, used on shutdown.
*/
void
-afs_StopAFSDB()
+afs_StopAFSDB(void)
{
if (afsdb_handler_running) {
afs_osi_Wakeup(&afsdb_req);
} else {
afsdb_handler_shutdown = 1;
afs_termState = AFSOP_STOP_RXEVENT;
+ afs_osi_Wakeup(&afs_termState);
}
}
afs_AFSDBHandler(char *acellName, int acellNameLen, afs_int32 * kernelMsg)
{
afs_int32 timeout, code;
- afs_int32 cellHosts[MAXCELLHOSTS];
+ afs_int32 cellHosts[AFS_MAXCELLHOSTS];
if (afsdb_handler_shutdown)
return -2;
if (timeout)
timeout += osi_Time();
- for (i = 0; i < MAXCELLHOSTS; i++) {
+ for (i = 0; i < AFS_MAXCELLHOSTS; i++) {
if (i >= hostCount)
cellHosts[i] = 0;
else
} else
return ENOENT;
}
-#endif
/*!
void
afs_LookupAFSDB(char *acellName)
{
-#ifdef AFS_AFSDB_ENV
int code;
char *cellName = afs_strdup(acellName);
afs_Trace2(afs_iclSetp, CM_TRACE_AFSDB, ICL_TYPE_STRING, cellName,
ICL_TYPE_INT32, code);
afs_osi_FreeStr(cellName);
-#endif
}
/*
*/
struct cell_name *afs_cellname_head; /* Export for kdump */
-static ino_t afs_cellname_inode;
+static afs_dcache_id_t afs_cellname_inode;
static int afs_cellname_inode_set;
static int afs_cellname_dirty;
static afs_int32 afs_cellnum_next;
* \return 0 for success. < 0 for error.
*/
int
-afs_cellname_init(ino_t inode, int lookupcode)
+afs_cellname_init(afs_dcache_id_t *inode, int lookupcode)
{
struct osi_file *tfile;
int cc, off = 0;
return EIO;
}
- afs_cellname_inode = inode;
+ afs_copy_inode(&afs_cellname_inode, inode);
afs_cellname_inode_set = 1;
while (1) {
ObtainWriteLock(&afs_xcell, 693);
afs_cellname_dirty = 0;
off = 0;
- tfile = osi_UFSOpen(afs_cellname_inode);
+ tfile = osi_UFSOpen(&afs_cellname_inode);
if (!tfile) {
ReleaseWriteLock(&afs_xcell);
return EIO;
*/
struct afs_q CellLRU; /* Export for kdump */
-static char *afs_thiscell;
+static char *afs_thiscell = NULL;
afs_int32 afs_cellindex; /* Export for kdump */
/*!
aflags &= ~CNoSUID;
} else {
tc = (struct cell *)afs_osi_Alloc(sizeof(struct cell));
- memset((char *)tc, 0, sizeof(*tc));
+ memset(tc, 0, sizeof(*tc));
tc->cellName = afs_strdup(acellName);
tc->fsport = AFS_FSPORT;
tc->vlport = AFS_VLPORT;
/* we don't want to keep pinging old vlservers which were down,
* since they don't matter any more. It's easier to do this than
* to remove the server from its various hash tables. */
- for (i = 0; i < MAXCELLHOSTS; i++) {
+ for (i = 0; i < AFS_MAXCELLHOSTS; i++) {
if (!tc->cellHosts[i])
break;
tc->cellHosts[i]->flags &= ~SRVR_ISDOWN;
tc->states |= aflags;
tc->timeout = timeout;
- memset((char *)tc->cellHosts, 0, sizeof(tc->cellHosts));
- for (i = 0; i < MAXCELLHOSTS; i++) {
+ memset(tc->cellHosts, 0, sizeof(tc->cellHosts));
+ for (i = 0; i < AFS_MAXCELLHOSTS; i++) {
/* Get server for each host and link this cell in.*/
struct server *ts;
afs_uint32 temp = acellHosts[i];
tc->cellHosts[i] = ts;
afs_PutServer(ts, WRITE_LOCK);
}
- afs_SortServers(tc->cellHosts, MAXCELLHOSTS); /* randomize servers */
+ afs_SortServers(tc->cellHosts, AFS_MAXCELLHOSTS); /* randomize servers */
/* New cell: Build and add to LRU cell queue. */
if (newc) {
ReleaseWriteLock(&tc->lock);
ReleaseWriteLock(&afs_xcell);
afs_PutCell(tc, 0);
- afs_DynrootInvalidate();
+ if (!aflags & CHush)
+ afs_DynrootInvalidate();
return 0;
bad:
* Perform whatever initialization is necessary.
*/
void
-afs_CellInit()
+afs_CellInit(void)
{
+ static char CellInit_done = 0;
+
+ if (CellInit_done)
+ return;
+
+ CellInit_done = 1;
+
AFS_RWLOCK_INIT(&afs_xcell, "afs_xcell");
-#ifdef AFS_AFSDB_ENV
AFS_RWLOCK_INIT(&afsdb_client_lock, "afsdb_client_lock");
AFS_RWLOCK_INIT(&afsdb_req_lock, "afsdb_req_lock");
-#endif
QInit(&CellLRU);
afs_cellindex = 0;
* Called on shutdown, should deallocate memory, etc.
*/
void
-shutdown_cell()
+shutdown_cell(void)
{
struct afs_q *cq, *tq;
struct cell *tc;
+#ifdef AFS_CACHE_VNODE_PATH
+ if (cacheDiskType != AFS_FCACHE_TYPE_MEM) {
+ afs_osi_FreeStr(afs_cellname_inode.ufs);
+ }
+#endif
AFS_RWLOCK_INIT(&afs_xcell, "afs_xcell");
for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
/* Remove the server structure from the cell list - if there */
ObtainWriteLock(&tc->lock, 200);
- for (j = k = 0; j < MAXCELLHOSTS; j++) {
+ for (j = k = 0; j < AFS_MAXCELLHOSTS; j++) {
if (!tc->cellHosts[j])
break;
if (tc->cellHosts[j] != srvp) {
if (k == 0) {
/* What do we do if we remove the last one? */
}
- for (; k < MAXCELLHOSTS; k++) {
+ for (; k < AFS_MAXCELLHOSTS; k++) {
tc->cellHosts[k] = 0;
}
ReleaseWriteLock(&tc->lock);