libafs: Do not write-lock afs_xserver on ICBS
[openafs.git] / src / afs / afs_callback.c
index 089c2d0..d9d24f8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -16,8 +16,6 @@
 #include <afsconfig.h>
 #include "afs/param.h"
 
-RCSID
-    ("$Header$");
 
 #include "afs/sysincludes.h"   /*Standard vendor system headers */
 #include "afsincludes.h"       /*AFS-based standard headers */
@@ -62,14 +60,11 @@ static struct ltable {
       "afs_xsrvAddr", (char *)&afs_xsrvAddr},
     {
       "afs_xvreclaim", (char *)&afs_xvreclaim},
-#ifdef AFS_AFSDB_ENV
     { "afsdb_client_lock", (char *)&afsdb_client_lock},
     { "afsdb_req_lock", (char *)&afsdb_req_lock},
-#endif
-#ifdef AFS_DISCON_ENV
     { "afs_discon_lock", (char *)&afs_discon_lock},
-    { "afs_DDirtyVCListLock", (char *)&afs_DDirtyVCListLock},
-#endif
+    { "afs_disconDirtyLock", (char *)&afs_disconDirtyLock},
+    { "afs_discon_vc_dirty", (char *)&afs_xvcdirty},
 };
 unsigned long lastCallBack_vnode;
 unsigned int lastCallBack_dv;
@@ -106,8 +101,8 @@ SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index,
               struct AFSDBCacheEntry *a_result)
 {
 
-    register int i;            /*Loop variable */
-    register struct vcache *tvc;       /*Ptr to current cache entry */
+    int i;             /*Loop variable */
+    struct vcache *tvc;        /*Ptr to current cache entry */
     int code;                  /*Return code */
     XSTATS_DECLS;
 
@@ -135,10 +130,10 @@ SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index,
      * Copy out the located entry.
      */
     a_result->addr = afs_data_pointer_to_int32(tvc);
-    a_result->cell = tvc->fid.Cell;
-    a_result->netFid.Volume = tvc->fid.Fid.Volume;
-    a_result->netFid.Vnode = tvc->fid.Fid.Vnode;
-    a_result->netFid.Unique = tvc->fid.Fid.Unique;
+    a_result->cell = tvc->f.fid.Cell;
+    a_result->netFid.Volume = tvc->f.fid.Fid.Volume;
+    a_result->netFid.Vnode = tvc->f.fid.Fid.Vnode;
+    a_result->netFid.Unique = tvc->f.fid.Fid.Unique;
     a_result->lock.waitStates = tvc->lock.wait_states;
     a_result->lock.exclLocked = tvc->lock.excl_locked;
     a_result->lock.readersReading = tvc->lock.readers_reading;
@@ -152,16 +147,16 @@ SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index,
     a_result->lock.pid_last_reader = 0;
     a_result->lock.pid_writer = 0;
     a_result->lock.src_indicator = 0;
-#endif /* AFS_OSF20_ENV */
+#endif /* INSTRUMENT_LOCKS */
 #ifdef AFS_64BIT_CLIENT
-    a_result->Length = (afs_int32) tvc->m.Length & 0xffffffff;
+    a_result->Length = (afs_int32) tvc->f.m.Length & 0xffffffff;
 #else /* AFS_64BIT_CLIENT */
-    a_result->Length = tvc->m.Length;
+    a_result->Length = tvc->f.m.Length;
 #endif /* AFS_64BIT_CLIENT */
-    a_result->DataVersion = hgetlo(tvc->m.DataVersion);
+    a_result->DataVersion = hgetlo(tvc->f.m.DataVersion);
     a_result->callback = afs_data_pointer_to_int32(tvc->callback);     /* XXXX Now a pointer; change it XXXX */
     a_result->cbExpires = tvc->cbExpires;
-    if (tvc->states & CVInit) {
+    if (tvc->f.states & CVInit) {
         a_result->refCount = 1;
     } else {
 #ifdef AFS_DARWIN80_ENV
@@ -173,7 +168,7 @@ SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index,
     a_result->opens = tvc->opens;
     a_result->writers = tvc->execsOrWriters;
     a_result->mvstat = tvc->mvstat;
-    a_result->states = tvc->states;
+    a_result->states = tvc->f.states;
     code = 0;
 
     /*
@@ -192,8 +187,8 @@ int
 SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index,
                 struct AFSDBCacheEntry64 *a_result)
 {
-    register int i;            /*Loop variable */
-    register struct vcache *tvc;       /*Ptr to current cache entry */
+    int i;             /*Loop variable */
+    struct vcache *tvc;        /*Ptr to current cache entry */
     int code;                  /*Return code */
     XSTATS_DECLS;
 
@@ -221,10 +216,10 @@ SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index,
      * Copy out the located entry.
      */
     a_result->addr = afs_data_pointer_to_int32(tvc);
-    a_result->cell = tvc->fid.Cell;
-    a_result->netFid.Volume = tvc->fid.Fid.Volume;
-    a_result->netFid.Vnode = tvc->fid.Fid.Vnode;
-    a_result->netFid.Unique = tvc->fid.Fid.Unique;
+    a_result->cell = tvc->f.fid.Cell;
+    a_result->netFid.Volume = tvc->f.fid.Fid.Volume;
+    a_result->netFid.Vnode = tvc->f.fid.Fid.Vnode;
+    a_result->netFid.Unique = tvc->f.fid.Fid.Unique;
     a_result->lock.waitStates = tvc->lock.wait_states;
     a_result->lock.exclLocked = tvc->lock.excl_locked;
     a_result->lock.readersReading = tvc->lock.readers_reading;
@@ -238,17 +233,12 @@ SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index,
     a_result->lock.pid_last_reader = 0;
     a_result->lock.pid_writer = 0;
     a_result->lock.src_indicator = 0;
-#endif /* AFS_OSF20_ENV */
-#if !defined(AFS_64BIT_ENV) 
-    a_result->Length.high = 0;
-    a_result->Length.low = tvc->m.Length;
-#else
-    a_result->Length = tvc->m.Length;
-#endif
-    a_result->DataVersion = hgetlo(tvc->m.DataVersion);
+#endif /* INSTRUMENT_LOCKS */
+    a_result->Length = tvc->f.m.Length;
+    a_result->DataVersion = hgetlo(tvc->f.m.DataVersion);
     a_result->callback = afs_data_pointer_to_int32(tvc->callback);     /* XXXX Now a pointer; change it XXXX */
     a_result->cbExpires = tvc->cbExpires;
-    if (tvc->states & CVInit) {
+    if (tvc->f.states & CVInit) {
         a_result->refCount = 1;
     } else {
 #ifdef AFS_DARWIN80_ENV
@@ -260,7 +250,7 @@ SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index,
     a_result->opens = tvc->opens;
     a_result->writers = tvc->execsOrWriters;
     a_result->mvstat = tvc->mvstat;
-    a_result->states = tvc->states;
+    a_result->states = tvc->f.states;
     code = 0;
 
     /*
@@ -387,7 +377,7 @@ SRXAFSCB_GetLock(struct rx_call *a_call, afs_int32 a_index,
  *
  * Description:
  *     Clear out callback information for the specified file, or
- *     even a whole volume.  Used to worry about callback was from 
+ *     even a whole volume.  Used to worry about callback was from
  *      within the particular cell or not.  Now we don't bother with
  *      that anymore; it's not worth the time.
  *
@@ -409,11 +399,11 @@ Appears to need to be called with GLOCK held, as the icl_Event4 stuff asserts ot
  *------------------------------------------------------------------------*/
 
 static int
-ClearCallBack(register struct rx_connection *a_conn,
-             register struct AFSFid *a_fid)
+ClearCallBack(struct rx_connection *a_conn,
+             struct AFSFid *a_fid)
 {
-    register struct vcache *tvc;
-    register int i;
+    struct vcache *tvc;
+    int i;
     struct VenusFid localFid;
     struct volume *tv;
 #ifdef AFS_DARWIN80_ENV
@@ -447,28 +437,28 @@ loop1:
                i = VCHashV(&localFid);
                for (tq = afs_vhashTV[i].prev; tq != &afs_vhashTV[i]; tq = uq) {
                    uq = QPrev(tq);
-                   tvc = QTOVH(tq);      
-                   if (tvc->fid.Fid.Volume == a_fid->Volume) {
+                   tvc = QTOVH(tq);
+                   if (tvc->f.fid.Fid.Volume == a_fid->Volume) {
                        tvc->callback = NULL;
                        if (!localFid.Cell)
-                           localFid.Cell = tvc->fid.Cell;
+                           localFid.Cell = tvc->f.fid.Cell;
                        tvc->dchint = NULL;     /* invalidate hints */
-                       if (tvc->states & CVInit) {
+                       if (tvc->f.states & CVInit) {
                            ReleaseReadLock(&afs_xvcache);
-                           afs_osi_Sleep(&tvc->states);
+                           afs_osi_Sleep(&tvc->f.states);
                            goto loop1;
                        }
-#ifdef AFS_DARWIN80_ENV
-                       if (tvc->states & CDeadVnode) {
-                           ReleaseReadLock(&afs_xvcache);
-                           afs_osi_Sleep(&tvc->states);
-                           goto loop1;
-                       }
-#endif
-#if     defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)  || defined(AFS_SUN5_ENV)  || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV)
-                       VN_HOLD(AFSTOV(tvc));
+#if     defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)  || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV)
+                       AFS_FAST_HOLD(tvc);
 #else
 #ifdef AFS_DARWIN80_ENV
+                       if (tvc->f.states & CDeadVnode) {
+                           if (!(tvc->f.states & CBulkFetching)) {
+                               ReleaseReadLock(&afs_xvcache);
+                               afs_osi_Sleep(&tvc->f.states);
+                               goto loop1;
+                           }
+                       }
                        vp = AFSTOV(tvc);
                        if (vnode_get(vp))
                            continue;
@@ -478,29 +468,30 @@ loop1:
                            AFS_GLOCK();
                            continue;
                        }
+                       if (tvc->f.states & (CBulkFetching|CDeadVnode)) {
+                           AFS_GUNLOCK();
+                           vnode_recycle(AFSTOV(tvc));
+                           AFS_GLOCK();
+                       }
 #else
-#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
-                       osi_vnhold(tvc, 0);
-#else
-                       VREFCOUNT_INC(tvc); /* AIX, apparently */
-#endif
+                       AFS_FAST_HOLD(tvc);
 #endif
 #endif
                        ReleaseReadLock(&afs_xvcache);
                        ObtainWriteLock(&afs_xcbhash, 449);
                        afs_DequeueCallback(tvc);
-                       tvc->states &= ~(CStatd | CUnique | CBulkFetching);
+                       tvc->f.states &= ~(CStatd | CUnique | CBulkFetching);
                        afs_allCBs++;
-                       if (tvc->fid.Fid.Vnode & 1)
+                       if (tvc->f.fid.Fid.Vnode & 1)
                            afs_oddCBs++;
                        else
                            afs_evenCBs++;
                        ReleaseWriteLock(&afs_xcbhash);
-                       if ((tvc->fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)))
+                       if ((tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)))
                            osi_dnlc_purgedp(tvc);
                        afs_Trace3(afs_iclSetp, CM_TRACE_CALLBACK,
                                   ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32,
-                                  tvc->states, ICL_TYPE_INT32,
+                                  tvc->f.states, ICL_TYPE_INT32,
                                   a_fid->Volume);
 #ifdef AFS_DARWIN80_ENV
                        vnode_put(AFSTOV(tvc));
@@ -508,9 +499,9 @@ loop1:
                        ObtainReadLock(&afs_xvcache);
                        uq = QPrev(tq);
                        AFS_FAST_RELE(tvc);
-                   } else if ((tvc->states & CMValid)
+                   } else if ((tvc->f.states & CMValid)
                               && (tvc->mvid->Fid.Volume == a_fid->Volume)) {
-                       tvc->states &= ~CMValid;
+                       tvc->f.states &= ~CMValid;
                        if (!localFid.Cell)
                            localFid.Cell = tvc->mvid->Cell;
                    }
@@ -542,27 +533,27 @@ loop2:
            i = VCHash(&localFid);
            for (tvc = afs_vhashT[i]; tvc; tvc = uvc) {
                uvc = tvc->hnext;
-               if (tvc->fid.Fid.Vnode == a_fid->Vnode
-                   && tvc->fid.Fid.Volume == a_fid->Volume
-                   && tvc->fid.Fid.Unique == a_fid->Unique) {
+               if (tvc->f.fid.Fid.Vnode == a_fid->Vnode
+                   && tvc->f.fid.Fid.Volume == a_fid->Volume
+                   && tvc->f.fid.Fid.Unique == a_fid->Unique) {
                    tvc->callback = NULL;
                    tvc->dchint = NULL; /* invalidate hints */
-                   if (tvc->states & CVInit) {
+                   if (tvc->f.states & CVInit) {
                        ReleaseReadLock(&afs_xvcache);
-                       afs_osi_Sleep(&tvc->states);
+                       afs_osi_Sleep(&tvc->f.states);
                        goto loop2;
                    }
-#ifdef AFS_DARWIN80_ENV
-                   if (tvc->states & CDeadVnode) {
-                       ReleaseReadLock(&afs_xvcache);
-                       afs_osi_Sleep(&tvc->states);
-                       goto loop2;
-                   }
-#endif
-#if     defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)  || defined(AFS_SUN5_ENV)  || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV)
-                   VN_HOLD(AFSTOV(tvc));
+#if     defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)  || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV)
+                   AFS_FAST_HOLD(tvc);
 #else
 #ifdef AFS_DARWIN80_ENV
+                   if (tvc->f.states & CDeadVnode) {
+                       if (!(tvc->f.states & CBulkFetching)) {
+                           ReleaseReadLock(&afs_xvcache);
+                           afs_osi_Sleep(&tvc->f.states);
+                           goto loop2;
+                       }
+                   }
                    vp = AFSTOV(tvc);
                    if (vnode_get(vp))
                        continue;
@@ -572,24 +563,25 @@ loop2:
                        AFS_GLOCK();
                        continue;
                    }
+                   if (tvc->f.states & (CBulkFetching|CDeadVnode)) {
+                       AFS_GUNLOCK();
+                       vnode_recycle(AFSTOV(tvc));
+                       AFS_GLOCK();
+                   }
 #else
-#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
-                   osi_vnhold(tvc, 0);
-#else
-                   VREFCOUNT_INC(tvc); /* AIX, apparently */
-#endif
+                   AFS_FAST_HOLD(tvc);
 #endif
 #endif
                    ReleaseReadLock(&afs_xvcache);
                    ObtainWriteLock(&afs_xcbhash, 450);
                    afs_DequeueCallback(tvc);
-                   tvc->states &= ~(CStatd | CUnique | CBulkFetching);
+                   tvc->f.states &= ~(CStatd | CUnique | CBulkFetching);
                    ReleaseWriteLock(&afs_xcbhash);
-                   if ((tvc->fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)))
+                   if ((tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR)))
                        osi_dnlc_purgedp(tvc);
                    afs_Trace3(afs_iclSetp, CM_TRACE_CALLBACK,
                               ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32,
-                              tvc->states, ICL_TYPE_LONG, 0);
+                              tvc->f.states, ICL_TYPE_LONG, 0);
 #ifdef CBDEBUG
                    lastCallBack_vnode = afid->Vnode;
                    lastCallBack_dv = tvc->mstat.DataVersion.low;
@@ -640,12 +632,12 @@ loop2:
  *------------------------------------------------------------------------*/
 
 int
-SRXAFSCB_CallBack(struct rx_call *a_call, register struct AFSCBFids *a_fids,
+SRXAFSCB_CallBack(struct rx_call *a_call, struct AFSCBFids *a_fids,
                  struct AFSCBs *a_callbacks)
 {
-    register int i;            /*Loop variable */
+    int i;             /*Loop variable */
     struct AFSFid *tfid;       /*Ptr to current fid */
-    register struct rx_connection *tconn;      /*Call's connection */
+    struct rx_connection *tconn;       /*Call's connection */
     int code = 0;
     XSTATS_DECLS;
 
@@ -737,10 +729,10 @@ SRXAFSCB_Probe(struct rx_call *a_call)
 int
 SRXAFSCB_InitCallBackState(struct rx_call *a_call)
 {
-    register int i;
-    register struct vcache *tvc;
-    register struct rx_connection *tconn;
-    register struct rx_peer *peer;
+    int i;
+    struct vcache *tvc;
+    struct rx_connection *tconn;
+    struct rx_peer *peer;
     struct server *ts;
     int code = 0;
     XSTATS_DECLS;
@@ -768,22 +760,25 @@ SRXAFSCB_InitCallBackState(struct rx_call *a_call)
                        ObtainWriteLock(&afs_xcbhash, 451);
                        afs_DequeueCallback(tvc);
                        tvc->callback = NULL;
-                       tvc->states &= ~(CStatd | CUnique | CBulkFetching);
+                       tvc->f.states &= ~(CStatd | CUnique | CBulkFetching);
                        ReleaseWriteLock(&afs_xcbhash);
                    }
                }
+
+           /* capabilities need be requested again */
+           ts->flags &= ~SCAPS_KNOWN;
        }
 
 
 
        /* find any volumes residing on this server and flush their state */
        {
-           register struct volume *tv;
-           register int j;
+           struct volume *tv;
+           int j;
 
            for (i = 0; i < NVOLS; i++)
                for (tv = afs_volumes[i]; tv; tv = tv->next) {
-                   for (j = 0; j < MAXHOSTS; j++)
+                   for (j = 0; j < AFS_MAXHOSTS; j++)
                        if (tv->serverHost[j] == ts)
                            afs_ResetVolumeInfo(tv);
                }
@@ -873,7 +868,7 @@ SRXAFSCB_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
                   afs_int32 a_collectionNumber, afs_int32 * a_srvVersionNumP,
                   afs_int32 * a_timeP, AFSCB_CollData * a_dataP)
 {
-    register int code;         /*Return value */
+    int code;          /*Return value */
     afs_int32 *dataBuffP;      /*Ptr to data to be returned */
     afs_int32 dataBytes;       /*Bytes in data buffer */
     XSTATS_DECLS;
@@ -912,6 +907,7 @@ SRXAFSCB_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
         */
        dataBytes = sizeof(struct afs_CMStats);
        dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
+       osi_Assert(dataBuffP != NULL);
        memcpy((char *)dataBuffP, (char *)&afs_cmstats, dataBytes);
        a_dataP->AFSCB_CollData_len = dataBytes >> 2;
        a_dataP->AFSCB_CollData_val = dataBuffP;
@@ -932,6 +928,7 @@ SRXAFSCB_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
        afs_CountServers();
        dataBytes = sizeof(afs_stats_cmperf);
        dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
+       osi_Assert(dataBuffP != NULL);
        memcpy((char *)dataBuffP, (char *)&afs_stats_cmperf, dataBytes);
        a_dataP->AFSCB_CollData_len = dataBytes >> 2;
        a_dataP->AFSCB_CollData_val = dataBuffP;
@@ -956,6 +953,7 @@ SRXAFSCB_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
 
        dataBytes = sizeof(afs_stats_cmfullperf);
        dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
+       osi_Assert(dataBuffP != NULL);
        memcpy((char *)dataBuffP, (char *)(&afs_stats_cmfullperf), dataBytes);
        a_dataP->AFSCB_CollData_len = dataBytes >> 2;
        a_dataP->AFSCB_CollData_val = dataBuffP;
@@ -1063,7 +1061,7 @@ shutdown_CB(void)
  *      a_call : Ptr to Rx call on which this request came in.
  *
  * Returns:
- *      RXGEN_OPCODE (always). 
+ *      RXGEN_OPCODE (always).
  *
  * Environment:
  *      Nothing interesting.
@@ -1309,8 +1307,8 @@ SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index,
        p_name = tcell->cellName;
        for (j = 0; j < AFSMAXCELLHOSTS && tcell->cellHosts[j]; j++);
        i = strlen(p_name);
-       a_hosts->serverList_val =
-           (afs_int32 *) afs_osi_Alloc(j * sizeof(afs_int32));
+       a_hosts->serverList_val = afs_osi_Alloc(j * sizeof(afs_int32));
+       osi_Assert(a_hosts->serverList_val != NULL);
        a_hosts->serverList_len = j;
        for (j = 0; j < AFSMAXCELLHOSTS && tcell->cellHosts[j]; j++)
            a_hosts->serverList_val[j] =
@@ -1318,7 +1316,7 @@ SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index,
        afs_PutCell(tcell, READ_LOCK);
     }
 
-    t_name = (char *)afs_osi_Alloc(i + 1);
+    t_name = afs_osi_Alloc(i + 1);
     if (t_name == NULL) {
        afs_osi_Free(a_hosts->serverList_val, (j * sizeof(afs_int32)));
        RX_AFS_GUNLOCK();
@@ -1376,7 +1374,7 @@ SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name)
        plen = strlen(p_name);
     else
        plen = 0;
-    t_name = (char *)afs_osi_Alloc(plen + 1);
+    t_name = afs_osi_Alloc(plen + 1);
     if (t_name == NULL) {
        if (tcell)
            afs_PutCell(tcell, READ_LOCK);
@@ -1473,7 +1471,7 @@ SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion,
      * Currently only support version 1
      */
     allocsize = sizeof(cm_initparams_v1);
-    t_config = (afs_uint32 *) afs_osi_Alloc(allocsize);
+    t_config = afs_osi_Alloc(allocsize);
     if (t_config == NULL) {
        RX_AFS_GUNLOCK();
        return ENOMEM;
@@ -1614,8 +1612,8 @@ SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
 
     for (sn = 0; sn < AFSMAXCELLHOSTS && tcell->cellHosts[sn]; sn++);
     a_hosts->serverList_len = sn;
-    a_hosts->serverList_val =
-       (afs_int32 *) afs_osi_Alloc(sn * sizeof(afs_int32));
+    a_hosts->serverList_val = afs_osi_Alloc(sn * sizeof(afs_int32));
+    osi_Assert(a_hosts->serverList_val != NULL);
 
     for (i = 0; i < sn; i++)
        a_hosts->serverList_val[i] = ntohl(tcell->cellHosts[i]->addr->sa_ip);
@@ -1633,7 +1631,7 @@ SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call,
 {
     int i;
     int code = 0;
-    afs_int32 *dataBuffP;
+    afs_uint32 *dataBuffP;
     afs_int32 dataBytes;
 
     RX_AFS_GLOCK();
@@ -1655,10 +1653,11 @@ SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call,
 
     RX_AFS_GUNLOCK();
 
-    dataBytes = 1 * sizeof(afs_int32);
-    dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
+    dataBytes = 1 * sizeof(afs_uint32);
+    dataBuffP = afs_osi_Alloc(dataBytes);
+    osi_Assert(dataBuffP != NULL);
     dataBuffP[0] = CLIENT_CAPABILITY_ERRORTRANS;
-    capabilities->Capabilities_len = dataBytes / sizeof(afs_int32);
+    capabilities->Capabilities_len = dataBytes / sizeof(afs_uint32);
     capabilities->Capabilities_val = dataBuffP;
 
     return code;
@@ -1704,7 +1703,7 @@ resume:
         * All done at this level ... ascend and resume the search.
         */
        if (this_parent != parent) {
-               next = this_parent->d_child.next; 
+               next = this_parent->d_child.next;
                this_parent = this_parent->d_parent;
                goto resume;
        }
@@ -1713,7 +1712,7 @@ resume:
  searchdone3:
     if (d_unhashed(dentry))
       *flags = 1;
-    else 
+    else
       *flags = 0;
 
     *fileName = afs_strdup(dentry->d_name.name?dentry->d_name.name:"");
@@ -1727,19 +1726,15 @@ resume:
 }
 #endif
 
-int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName)
-    struct rx_call *a_call;
-    afs_int32 a_index;
-    afs_int32 *addr;
-    afs_int32 *inode;
-    afs_int32 *flags;
-    afs_int32 *time;
-    char ** fileName;
+int
+SRXAFSCB_GetDE(struct rx_call *a_call, afs_int32 a_index, afs_int32 *addr,
+              afs_int32 *inode, afs_int32 *flags, afs_int32 *time,
+              char ** fileName)
 { /*SRXAFSCB_GetDE*/
     int code = 0;                              /*Return code*/
 #if 0 && defined(AFS_LINUX24_ENV)
-    register int i;                    /*Loop variable*/
-    register struct vcache *tvc = afs_globalVp;
+    int i;                     /*Loop variable*/
+    struct vcache *tvc = afs_globalVp;
     struct dentry *dentry;
     struct list_head *cur, *head = &(AFSTOI(tvc))->i_dentry;
 
@@ -1754,9 +1749,9 @@ int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName)
     cur = head;
     while ((cur = cur->next) != head) {
       dentry = list_entry(cur, struct dentry, d_alias);
-      
+
       dget_locked(dentry);
-      
+
 #if defined(AFS_LINUX24_ENV)
       spin_unlock(&dcache_lock);
 #endif
@@ -1770,7 +1765,7 @@ int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName)
        goto fcnDone;
       }
       dput(dentry);
-    }                   
+    }
  searchdone2:
     if (cur == head) {
        /*Past EOF*/
@@ -1781,7 +1776,7 @@ int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName)
 
     if (d_unhashed(dentry))
       *flags = 1;
-    else 
+    else
       *flags = 0;
 
     *fileName = afs_strdup(dentry->d_name.name?dentry->d_name.name:"");