*/
#include <afsconfig.h>
-#include "../afs/param.h"
-
-RCSID("$Header$");
-
-#include "../afs/sysincludes.h" /*Standard vendor system headers*/
-#include "../afs/afsincludes.h" /*AFS-based standard headers*/
-#include "../afs/afs_stats.h" /*Cache Manager stats*/
-#include "../afs/afs_args.h"
-
-afs_int32 afs_allCBs = 0; /*Break callbacks on all objects */
-afs_int32 afs_oddCBs = 0; /*Break callbacks on dirs*/
-afs_int32 afs_evenCBs = 0; /*Break callbacks received on files*/
-afs_int32 afs_allZaps = 0; /*Objects entries deleted */
-afs_int32 afs_oddZaps = 0; /*Dir cache entries deleted*/
-afs_int32 afs_evenZaps = 0; /*File cache entries deleted*/
+#include "afs/param.h"
+
+RCSID
+ ("$Header$");
+
+#include "afs/sysincludes.h" /*Standard vendor system headers */
+#include "afsincludes.h" /*AFS-based standard headers */
+#include "afs/afs_stats.h" /*Cache Manager stats */
+#include "afs/afs_args.h"
+
+afs_int32 afs_allCBs = 0; /*Break callbacks on all objects */
+afs_int32 afs_oddCBs = 0; /*Break callbacks on dirs */
+afs_int32 afs_evenCBs = 0; /*Break callbacks received on files */
+afs_int32 afs_allZaps = 0; /*Objects entries deleted */
+afs_int32 afs_oddZaps = 0; /*Dir cache entries deleted */
+afs_int32 afs_evenZaps = 0; /*File cache entries deleted */
afs_int32 afs_connectBacks = 0;
/*
static struct ltable {
char *name;
char *addr;
-} ltable []= {
- {"afs_xvcache", (char *)&afs_xvcache},
- {"afs_xdcache", (char *)&afs_xdcache},
- {"afs_xserver", (char *)&afs_xserver},
- {"afs_xvcb", (char *)&afs_xvcb},
- {"afs_xbrs", (char *)&afs_xbrs},
- {"afs_xcell", (char *)&afs_xcell},
- {"afs_xconn", (char *)&afs_xconn},
- {"afs_xuser", (char *)&afs_xuser},
- {"afs_xvolume", (char *)&afs_xvolume},
- {"puttofile", (char *)&afs_puttofileLock},
- {"afs_ftf", (char *)&afs_ftf},
- {"afs_xcbhash", (char *)&afs_xcbhash},
- {"afs_xaxs", (char *)&afs_xaxs},
- {"afs_xinterface", (char *)&afs_xinterface}
+} ltable[] = {
+ {
+ "afs_xvcache", (char *)&afs_xvcache}, {
+ "afs_xdcache", (char *)&afs_xdcache}, {
+ "afs_xserver", (char *)&afs_xserver}, {
+ "afs_xvcb", (char *)&afs_xvcb}, {
+ "afs_xbrs", (char *)&afs_xbrs}, {
+ "afs_xcell", (char *)&afs_xcell}, {
+ "afs_xconn", (char *)&afs_xconn}, {
+ "afs_xuser", (char *)&afs_xuser}, {
+ "afs_xvolume", (char *)&afs_xvolume}, {
+ "puttofile", (char *)&afs_puttofileLock}, {
+ "afs_ftf", (char *)&afs_ftf}, {
+ "afs_xcbhash", (char *)&afs_xcbhash}, {
+ "afs_xaxs", (char *)&afs_xaxs}, {
+ "afs_xinterface", (char *)&afs_xinterface},
+#ifndef UKERNEL
+ {
+ "afs_xosi", (char *)&afs_xosi},
+#endif
+ {
+ "afs_xsrvAddr", (char *)&afs_xsrvAddr}
};
-unsigned long lastCallBack_vnode;
-unsigned int lastCallBack_dv;
-osi_timeval_t lastCallBack_time;
+unsigned long lastCallBack_vnode;
+unsigned int lastCallBack_dv;
+osi_timeval_t lastCallBack_time;
/* these are for storing alternate interface addresses */
struct interfaceAddr afs_cb_interface;
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index, struct AFSDBCacheEntry *a_result)
+int
+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 code; /*Return code*/
+ register int i; /*Loop variable */
+ register struct vcache *tvc; /*Ptr to current cache entry */
+ int code; /*Return code */
XSTATS_DECLS;
RX_AFS_GLOCK();
if (a_index == 0)
goto searchDone;
a_index--;
- } /*Zip through current hash chain*/
- } /*Zip through hash chains*/
+ } /*Zip through current hash chain */
+ } /*Zip through hash chains */
searchDone:
if (tvc == NULL) {
- /*Past EOF*/
+ /*Past EOF */
code = 1;
goto fcnDone;
}
a_result->Length = tvc->m.Length;
#endif /* AFS_64BIT_CLIENT */
a_result->DataVersion = hgetlo(tvc->m.DataVersion);
- a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */
+ a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */
a_result->cbExpires = tvc->cbExpires;
a_result->refCount = VREFCOUNT(tvc);
a_result->opens = tvc->opens;
/*
* Return our results.
*/
-fcnDone:
+ fcnDone:
XSTATS_END_TIME;
RX_AFS_GUNLOCK();
- return(code);
+ return (code);
-} /*SRXAFSCB_GetCE*/
+} /*SRXAFSCB_GetCE */
-int SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index, struct AFSDBCacheEntry64 *a_result)
+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 code; /*Return code*/
+ register int i; /*Loop variable */
+ register struct vcache *tvc; /*Ptr to current cache entry */
+ int code; /*Return code */
XSTATS_DECLS;
RX_AFS_GLOCK();
if (a_index == 0)
goto searchDone;
a_index--;
- } /*Zip through current hash chain*/
- } /*Zip through hash chains*/
+ } /*Zip through current hash chain */
+ } /*Zip through hash chains */
searchDone:
if (tvc == NULL) {
- /*Past EOF*/
+ /*Past EOF */
code = 1;
goto fcnDone;
}
a_result->lock.pid_writer = 0;
a_result->lock.src_indicator = 0;
#endif /* AFS_OSF20_ENV */
-#ifdef AFS_64BIT_ENV
- a_result->Length = tvc->m.Length;
-#else /* AFS_64BIT_ENV */
-#ifdef AFS_64BIT_CLIENT
- a_result->Length = tvc->m.Length;
-#else /* AFS_64BIT_CLIENT */
+#if !defined(AFS_64BIT_ENV)
a_result->Length.high = 0;
a_result->Length.low = tvc->m.Length;
-#endif /* AFS_64BIT_CLIENT */
-#endif /* AFS_64BIT_ENV */
+#else
+ a_result->Length = tvc->m.Length;
+#endif
a_result->DataVersion = hgetlo(tvc->m.DataVersion);
- a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */
+ a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */
a_result->cbExpires = tvc->cbExpires;
a_result->refCount = VREFCOUNT(tvc);
a_result->opens = tvc->opens;
/*
* Return our results.
*/
-fcnDone:
+ fcnDone:
XSTATS_END_TIME;
RX_AFS_GUNLOCK();
- return(code);
+ return (code);
-} /*SRXAFSCB_GetCE64*/
+} /*SRXAFSCB_GetCE64 */
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_GetLock (struct rx_call *a_call, afs_int32 a_index, struct AFSDBLock *a_result)
+int
+SRXAFSCB_GetLock(struct rx_call *a_call, afs_int32 a_index,
+ struct AFSDBLock *a_result)
{
- struct ltable *tl; /*Ptr to lock table entry*/
- int nentries; /*Num entries in table*/
- int code; /*Return code*/
+ struct ltable *tl; /*Ptr to lock table entry */
+ int nentries; /*Num entries in table */
+ int code; /*Return code */
XSTATS_DECLS;
RX_AFS_GLOCK();
XSTATS_START_CMTIME(AFS_STATS_CM_RPCIDX_GETLOCK);
-
+
AFS_STATCNT(SRXAFSCB_GetLock);
- nentries = sizeof(ltable)/sizeof(struct ltable);
+ nentries = sizeof(ltable) / sizeof(struct ltable);
if (a_index < 0 || a_index >= nentries) {
/*
- * Past EOF
- */
+ * Past EOF
+ */
code = 1;
- }
- else {
+ } else {
/*
* Found it - copy out its contents.
*/
tl = <able[a_index];
strcpy(a_result->name, tl->name);
- a_result->lock.waitStates = ((struct afs_lock *)(tl->addr))->wait_states;
- a_result->lock.exclLocked = ((struct afs_lock *)(tl->addr))->excl_locked;
- a_result->lock.readersReading = ((struct afs_lock *)(tl->addr))->readers_reading;
- a_result->lock.numWaiting = ((struct afs_lock *)(tl->addr))->num_waiting;
+ a_result->lock.waitStates =
+ ((struct afs_lock *)(tl->addr))->wait_states;
+ a_result->lock.exclLocked =
+ ((struct afs_lock *)(tl->addr))->excl_locked;
+ a_result->lock.readersReading =
+ ((struct afs_lock *)(tl->addr))->readers_reading;
+ a_result->lock.numWaiting =
+ ((struct afs_lock *)(tl->addr))->num_waiting;
#ifdef INSTRUMENT_LOCKS
- a_result->lock.pid_last_reader = ((struct afs_lock *)(tl->addr))->pid_last_reader;
- a_result->lock.pid_writer = ((struct afs_lock *)(tl->addr))->pid_writer;
- a_result->lock.src_indicator = ((struct afs_lock *)(tl->addr))->src_indicator;
+ a_result->lock.pid_last_reader =
+ ((struct afs_lock *)(tl->addr))->pid_last_reader;
+ a_result->lock.pid_writer =
+ ((struct afs_lock *)(tl->addr))->pid_writer;
+ a_result->lock.src_indicator =
+ ((struct afs_lock *)(tl->addr))->src_indicator;
#else
a_result->lock.pid_last_reader = 0;
a_result->lock.pid_writer = 0;
RX_AFS_GUNLOCK();
- return(code);
+ return (code);
-} /*SRXAFSCB_GetLock*/
+} /*SRXAFSCB_GetLock */
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
-static int ClearCallBack(register struct rx_connection *a_conn, register struct AFSFid *a_fid)
+static int
+ClearCallBack(register struct rx_connection *a_conn,
+ register struct AFSFid *a_fid)
{
register struct vcache *tvc;
register int i;
struct VenusFid localFid;
- struct volume * tv;
+ struct volume *tv;
AFS_STATCNT(ClearCallBack);
localFid.Fid.Unique = a_fid->Unique;
/*
- * Volume ID of zero means don't do anything.
- */
+ * Volume ID of zero means don't do anything.
+ */
if (a_fid->Volume != 0) {
if (a_fid->Vnode == 0) {
/*
* Clear callback for the whole volume. Zip through the
* hash chain, nullifying entries whose volume ID matches.
*/
- for (i = 0; i < VCSIZE; i++)
- for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
+ i = VCHashV(&localFid);
+ for (tvc = afs_vhashTV[i]; tvc; tvc = tvc->vhnext) {
if (tvc->fid.Fid.Volume == a_fid->Volume) {
tvc->callback = NULL;
- tvc->quick.stamp = 0;
+ tvc->quick.stamp = 0;
if (!localFid.Cell)
localFid.Cell = tvc->fid.Cell;
- tvc->h1.dchint = NULL; /* invalidate hints */
+ tvc->h1.dchint = NULL; /* invalidate hints */
ObtainWriteLock(&afs_xcbhash, 449);
afs_DequeueCallback(tvc);
tvc->states &= ~(CStatd | CUnique | CBulkFetching);
afs_allCBs++;
if (tvc->fid.Fid.Vnode & 1)
- afs_oddCBs++;
+ afs_oddCBs++;
else
- afs_evenCBs++;
+ afs_evenCBs++;
ReleaseWriteLock(&afs_xcbhash);
if (tvc->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, a_fid->Volume);
- } else if ((tvc->states & CMValid) && (tvc->mvid->Fid.Volume == a_fid->Volume)) {
+ ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32,
+ tvc->states, ICL_TYPE_INT32,
+ a_fid->Volume);
+ } else if ((tvc->states & CMValid)
+ && (tvc->mvid->Fid.Volume == a_fid->Volume)) {
tvc->states &= ~CMValid;
if (!localFid.Cell)
localFid.Cell = tvc->mvid->Cell;
*/
tv = afs_FindVolume(&localFid, 0);
if (tv) {
- afs_ResetVolumeInfo(tv);
- afs_PutVolume(tv, 0);
- /* invalidate mtpoint? */
+ afs_ResetVolumeInfo(tv);
+ afs_PutVolume(tv, 0);
+ /* invalidate mtpoint? */
}
- } /*Clear callbacks for whole volume*/
+ } /*Clear callbacks for whole volume */
else {
/*
* Clear callbacks just for the one file.
*/
afs_allCBs++;
if (a_fid->Vnode & 1)
- afs_oddCBs++; /*Could do this on volume basis, too*/
+ afs_oddCBs++; /*Could do this on volume basis, too */
else
- afs_evenCBs++; /*A particular fid was specified*/
+ afs_evenCBs++; /*A particular fid was specified */
i = VCHash(&localFid);
for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
if (tvc->fid.Fid.Vnode == a_fid->Vnode
&& tvc->fid.Fid.Volume == a_fid->Volume
- && tvc->fid.Fid.Unique == a_fid->Unique ) {
+ && tvc->fid.Fid.Unique == a_fid->Unique) {
tvc->callback = NULL;
- tvc->quick.stamp = 0;
- tvc->h1.dchint = NULL; /* invalidate hints */
+ tvc->quick.stamp = 0;
+ tvc->h1.dchint = NULL; /* invalidate hints */
ObtainWriteLock(&afs_xcbhash, 450);
afs_DequeueCallback(tvc);
tvc->states &= ~(CStatd | CUnique | CBulkFetching);
if (a_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);
+ ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32,
+ tvc->states, ICL_TYPE_LONG, 0);
#ifdef CBDEBUG
lastCallBack_vnode = afid->Vnode;
lastCallBack_dv = tvc->mstat.DataVersion.low;
osi_GetuTime(&lastCallBack_time);
#endif /* CBDEBUG */
}
- } /*Walk through hash table*/
- } /*Clear callbacks for one file*/
- } /*Fid has non-zero volume ID*/
+ } /*Walk through hash table */
+ } /*Clear callbacks for one file */
+ }
+ /*Fid has non-zero volume ID */
/*
* Always return a predictable value.
*/
- return(0);
+ return (0);
-} /*ClearCallBack*/
+} /*ClearCallBack */
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_CallBack(struct rx_call *a_call, register struct AFSCBFids *a_fids, struct AFSCBs *a_callbacks)
+int
+SRXAFSCB_CallBack(struct rx_call *a_call, register struct AFSCBFids *a_fids,
+ struct AFSCBs *a_callbacks)
{
- register int i; /*Loop variable*/
- struct AFSFid *tfid; /*Ptr to current fid*/
- register struct rx_connection *tconn; /*Call's connection*/
- int code=0;
+ register int i; /*Loop variable */
+ struct AFSFid *tfid; /*Ptr to current fid */
+ register struct rx_connection *tconn; /*Call's connection */
+ int code = 0;
XSTATS_DECLS;
RX_AFS_GLOCK();
XSTATS_START_CMTIME(AFS_STATS_CM_RPCIDX_CALLBACK);
AFS_STATCNT(SRXAFSCB_CallBack);
- if (!(tconn = rx_ConnectionOf(a_call))) return(0);
- tfid = (struct AFSFid *) a_fids->AFSCBFids_val;
-
+ if (!(tconn = rx_ConnectionOf(a_call)))
+ return (0);
+ tfid = (struct AFSFid *)a_fids->AFSCBFids_val;
+
/*
* For now, we ignore callbacks, since the File Server only *breaks*
* callbacks at present.
*/
- for (i = 0; i < a_fids->AFSCBFids_len; i++)
+ for (i = 0; i < a_fids->AFSCBFids_len; i++)
ClearCallBack(tconn, &tfid[i]);
XSTATS_END_TIME;
RX_AFS_GUNLOCK();
-
- return(0);
-} /*SRXAFSCB_CallBack*/
+ return (0);
+
+} /*SRXAFSCB_CallBack */
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_Probe(struct rx_call *a_call)
+int
+SRXAFSCB_Probe(struct rx_call *a_call)
{
int code = 0;
XSTATS_DECLS;
RX_AFS_GUNLOCK();
- return(0);
+ return (0);
-} /*SRXAFSCB_Probe*/
+} /*SRXAFSCB_Probe */
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_InitCallBackState(struct rx_call *a_call)
+int
+SRXAFSCB_InitCallBackState(struct rx_call *a_call)
{
register int i;
register struct vcache *tvc;
if ((tconn = rx_ConnectionOf(a_call)) && (peer = rx_PeerOf(tconn))) {
afs_allCBs++;
- afs_oddCBs++; /*Including any missed via create race*/
- afs_evenCBs++; /*Including any missed via create race*/
+ afs_oddCBs++; /*Including any missed via create race */
+ afs_evenCBs++; /*Including any missed via create race */
- ts = afs_FindServer(rx_HostOf(peer), rx_PortOf(peer), (afsUUID *)0, 0);
+ ts = afs_FindServer(rx_HostOf(peer), rx_PortOf(peer), (afsUUID *) 0,
+ 0);
if (ts) {
for (i = 0; i < VCSIZE; i++)
for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
}
}
-
-
+
+
/* find any volumes residing on this server and flush their state */
{
register struct volume *tv;
register int j;
-
- for (i=0;i<NVOLS;i++)
- for (tv = afs_volumes[i]; tv; tv=tv->next) {
- for (j=0; j<MAXHOSTS; j++)
+
+ for (i = 0; i < NVOLS; i++)
+ for (tv = afs_volumes[i]; tv; tv = tv->next) {
+ for (j = 0; j < MAXHOSTS; j++)
if (tv->serverHost[j] == ts)
afs_ResetVolumeInfo(tv);
}
}
- osi_dnlc_purge(); /* may be a little bit extreme */
+ osi_dnlc_purge(); /* may be a little bit extreme */
}
XSTATS_END_TIME;
RX_AFS_GUNLOCK();
- return(0);
+ return (0);
-} /*SRXAFSCB_InitCallBackState*/
+} /*SRXAFSCB_InitCallBackState */
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_XStatsVersion(struct rx_call *a_call, afs_int32 *a_versionP)
+int
+SRXAFSCB_XStatsVersion(struct rx_call *a_call, afs_int32 * a_versionP)
{
- int code=0;
+ int code = 0;
XSTATS_DECLS;
RX_AFS_GUNLOCK();
- return(0);
-} /*SRXAFSCB_XStatsVersion*/
+ return (0);
+} /*SRXAFSCB_XStatsVersion */
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int 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)
+int
+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*/
- afs_int32 *dataBuffP; /*Ptr to data to be returned*/
- afs_int32 dataBytes; /*Bytes in data buffer*/
+ register int code; /*Return value */
+ afs_int32 *dataBuffP; /*Ptr to data to be returned */
+ afs_int32 dataBytes; /*Bytes in data buffer */
XSTATS_DECLS;
RX_AFS_GLOCK();
a_dataP->AFSCB_CollData_len = 0;
a_dataP->AFSCB_CollData_val = NULL;
#else
- switch(a_collectionNumber) {
- case AFSCB_XSTATSCOLL_CALL_INFO:
+ switch (a_collectionNumber) {
+ case AFSCB_XSTATSCOLL_CALL_INFO:
/*
* Pass back all the call-count-related data.
*
* >>> will be freed at the tail end of the server stub code.
*/
dataBytes = sizeof(struct afs_CMStats);
- dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes);
+ dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
memcpy((char *)dataBuffP, (char *)&afs_cmstats, dataBytes);
- a_dataP->AFSCB_CollData_len = dataBytes>>2;
+ a_dataP->AFSCB_CollData_len = dataBytes >> 2;
a_dataP->AFSCB_CollData_val = dataBuffP;
break;
- case AFSCB_XSTATSCOLL_PERF_INFO:
+ case AFSCB_XSTATSCOLL_PERF_INFO:
/*
* Update and then pass back all the performance-related data.
* Note: the only performance fields that need to be computed
afs_stats_cmperf.numPerfCalls++;
afs_CountServers();
dataBytes = sizeof(afs_stats_cmperf);
- dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes);
+ dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
memcpy((char *)dataBuffP, (char *)&afs_stats_cmperf, dataBytes);
- a_dataP->AFSCB_CollData_len = dataBytes>>2;
+ a_dataP->AFSCB_CollData_len = dataBytes >> 2;
a_dataP->AFSCB_CollData_val = dataBuffP;
break;
- case AFSCB_XSTATSCOLL_FULL_PERF_INFO:
+ case AFSCB_XSTATSCOLL_FULL_PERF_INFO:
/*
* Pass back the full range of performance and statistical
* data available. We have to bring the normal performance
*/
afs_stats_cmperf.numPerfCalls++;
afs_CountServers();
- memcpy((char *)(&(afs_stats_cmfullperf.perf)), (char *)(&afs_stats_cmperf), sizeof(struct afs_stats_CMPerf));
+ memcpy((char *)(&(afs_stats_cmfullperf.perf)),
+ (char *)(&afs_stats_cmperf), sizeof(struct afs_stats_CMPerf));
afs_stats_cmfullperf.numFullPerfCalls++;
dataBytes = sizeof(afs_stats_cmfullperf);
- dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes);
+ dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
memcpy((char *)dataBuffP, (char *)(&afs_stats_cmfullperf), dataBytes);
- a_dataP->AFSCB_CollData_len = dataBytes>>2;
+ a_dataP->AFSCB_CollData_len = dataBytes >> 2;
a_dataP->AFSCB_CollData_val = dataBuffP;
break;
- default:
+ default:
/*
* Illegal collection number.
*/
a_dataP->AFSCB_CollData_len = 0;
a_dataP->AFSCB_CollData_val = NULL;
code = 1;
- } /*Switch on collection number*/
+ } /*Switch on collection number */
#endif /* AFS_NOSTATS */
XSTATS_END_TIME;
RX_AFS_GUNLOCK();
- return(code);
+ return (code);
-} /*SRXAFSCB_GetXStats*/
+} /*SRXAFSCB_GetXStats */
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int afs_RXCallBackServer(void)
+int
+afs_RXCallBackServer(void)
{
AFS_STATCNT(afs_RXCallBackServer);
* Donate this process to Rx.
*/
rx_ServerProc();
- return(0);
+ return (0);
-} /*afs_RXCallBackServer*/
+} /*afs_RXCallBackServer */
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int shutdown_CB(void)
+int
+shutdown_CB(void)
{
- AFS_STATCNT(shutdown_CB);
+ AFS_STATCNT(shutdown_CB);
- if (afs_cold_shutdown) {
- afs_oddCBs = afs_evenCBs = afs_allCBs = afs_allZaps = afs_oddZaps = afs_evenZaps =
- afs_connectBacks = 0;
- }
+ if (afs_cold_shutdown) {
+ afs_oddCBs = afs_evenCBs = afs_allCBs = afs_allZaps = afs_oddZaps =
+ afs_evenZaps = afs_connectBacks = 0;
+ }
- return(0);
+ return (0);
-} /*shutdown_CB*/
+} /*shutdown_CB */
/*------------------------------------------------------------------------
* EXPORTED SRXAFSCB_InitCallBackState2
* None
*------------------------------------------------------------------------*/
-int SRXAFSCB_InitCallBackState2(struct rx_call *a_call, struct interfaceAddr *addr)
+int
+SRXAFSCB_InitCallBackState2(struct rx_call *a_call,
+ struct interfaceAddr *addr)
{
- return RXGEN_OPCODE;
+ return RXGEN_OPCODE;
}
/*------------------------------------------------------------------------
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_WhoAreYou(struct rx_call *a_call, struct interfaceAddr *addr)
+int
+SRXAFSCB_WhoAreYou(struct rx_call *a_call, struct interfaceAddr *addr)
{
int i;
int code = 0;
- XSTATS_DECLS;
RX_AFS_GLOCK();
AFS_STATCNT(SRXAFSCB_WhoAreYou);
+ memset(addr, 0, sizeof(*addr));
+
ObtainReadLock(&afs_xinterface);
/* return all network interface addresses */
addr->numberOfInterfaces = afs_cb_interface.numberOfInterfaces;
addr->uuid = afs_cb_interface.uuid;
- for ( i=0; i < afs_cb_interface.numberOfInterfaces; i++) {
+ for (i = 0; i < afs_cb_interface.numberOfInterfaces; i++) {
addr->addr_in[i] = ntohl(afs_cb_interface.addr_in[i]);
addr->subnetmask[i] = ntohl(afs_cb_interface.subnetmask[i]);
addr->mtu[i] = ntohl(afs_cb_interface.mtu[i]);
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_InitCallBackState3(struct rx_call *a_call, afsUUID *a_uuid)
+int
+SRXAFSCB_InitCallBackState3(struct rx_call *a_call, afsUUID * a_uuid)
{
int code;
return code;
}
-
+
/*------------------------------------------------------------------------
* EXPORTED SRXAFSCB_ProbeUuid
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID *a_uuid)
+int
+SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID * a_uuid)
{
int code = 0;
XSTATS_DECLS;
XSTATS_START_CMTIME(AFS_STATS_CM_RPCIDX_PROBE);
if (!afs_uuid_equal(a_uuid, &afs_cb_interface.uuid))
- code = 1; /* failure */
+ code = 1; /* failure */
XSTATS_END_TIME;
RX_AFS_GUNLOCK();
return code;
}
-
+
/*------------------------------------------------------------------------
* EXPORTED SRXAFSCB_GetServerPrefs
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_GetServerPrefs(struct rx_call *a_call, afs_int32 a_index,
- afs_int32 *a_srvr_addr, afs_int32 *a_srvr_rank)
+int
+SRXAFSCB_GetServerPrefs(struct rx_call *a_call, afs_int32 a_index,
+ afs_int32 * a_srvr_addr, afs_int32 * a_srvr_rank)
{
int i, j;
struct srvAddr *sa;
/* Search the hash table for the server with this index */
*a_srvr_addr = 0xffffffff;
*a_srvr_rank = 0xffffffff;
- for (i=0, j=0; j < NSERVERS && i <= a_index; j++) {
+ for (i = 0, j = 0; j < NSERVERS && i <= a_index; j++) {
for (sa = afs_srvAddrs[j]; sa && i <= a_index; sa = sa->next_bkt, i++) {
if (i == a_index) {
*a_srvr_addr = ntohl(sa->sa_ip);
return 0;
}
-
+
/*------------------------------------------------------------------------
* EXPORTED SRXAFSCB_GetCellServDB
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index,
- char **a_name, serverList *a_hosts)
+int
+SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index,
+ char **a_name, serverList * a_hosts)
{
- afs_int32 i, j;
+ afs_int32 i, j = 0;
struct cell *tcell;
char *t_name, *p_name = NULL;
a_hosts->serverList_len = 0;
} else {
p_name = tcell->cellName;
- for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++)
- ;
+ 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_int32 *) afs_osi_Alloc(j * sizeof(afs_int32));
a_hosts->serverList_len = j;
- for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++)
- a_hosts->serverList_val[j] = ntohl(tcell->cellHosts[j]->addr->sa_ip);
+ for (j = 0; j < AFSMAXCELLHOSTS && tcell->cellHosts[j]; j++)
+ a_hosts->serverList_val[j] =
+ ntohl(tcell->cellHosts[j]->addr->sa_ip);
afs_PutCell(tcell, READ_LOCK);
}
- t_name = (char *)afs_osi_Alloc(i+1);
+ t_name = (char *)afs_osi_Alloc(i + 1);
if (t_name == NULL) {
- afs_osi_Free(a_hosts->serverList_val, (j*sizeof(afs_int32)));
+ afs_osi_Free(a_hosts->serverList_val, (j * sizeof(afs_int32)));
RX_AFS_GUNLOCK();
return ENOMEM;
}
*a_name = t_name;
return 0;
}
-
+
/*------------------------------------------------------------------------
* EXPORTED SRXAFSCB_GetLocalCell
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name)
+int
+SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name)
{
int plen;
struct cell *tcell;
plen = strlen(p_name);
else
plen = 0;
- t_name = (char *)afs_osi_Alloc(plen+1);
+ t_name = (char *)afs_osi_Alloc(plen + 1);
if (t_name == NULL) {
- if (tcell) afs_PutCell(tcell, READ_LOCK);
+ if (tcell)
+ afs_PutCell(tcell, READ_LOCK);
RX_AFS_GUNLOCK();
return ENOMEM;
}
RX_AFS_GUNLOCK();
*a_name = t_name;
- if (tcell) afs_PutCell(tcell, READ_LOCK);
+ if (tcell)
+ afs_PutCell(tcell, READ_LOCK);
return 0;
}
*
* Returns void.
*/
-static void afs_MarshallCacheConfig(afs_uint32 callerVersion,
- cm_initparams_v1 *config, afs_uint32 *ptr)
+static void
+afs_MarshallCacheConfig(afs_uint32 callerVersion, cm_initparams_v1 * config,
+ afs_uint32 * ptr)
{
AFS_STATCNT(afs_MarshallCacheConfig);
/*
*(ptr++) = config->setTime;
*(ptr++) = config->memCache;
}
-
+
/*------------------------------------------------------------------------
* EXPORTED SRXAFSCB_GetCacheConfig
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion,
- afs_uint32 *serverVersion, afs_uint32 *configCount, cacheConfig *config)
+int
+SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion,
+ afs_uint32 * serverVersion, afs_uint32 * configCount,
+ cacheConfig * config)
{
afs_uint32 *t_config;
size_t allocsize;
* Currently only support version 1
*/
allocsize = sizeof(cm_initparams_v1);
- t_config = (afs_uint32 *)afs_osi_Alloc(allocsize);
+ t_config = (afs_uint32 *) afs_osi_Alloc(allocsize);
if (t_config == NULL) {
RX_AFS_GUNLOCK();
return ENOMEM;
*serverVersion = AFS_CLIENT_RETRIEVAL_FIRST_EDITION;
*configCount = allocsize;
config->cacheConfig_val = t_config;
- config->cacheConfig_len = allocsize/sizeof(afs_uint32);
+ config->cacheConfig_len = allocsize / sizeof(afs_uint32);
RX_AFS_GUNLOCK();
*
* Side Effects:
*------------------------------------------------------------------------*/
-int SRXAFSCB_FetchData(struct rx_call *rxcall, struct AFSFid *Fid, afs_int32 Fd,
- afs_int64 Position, afs_int64 Length, afs_int64 *TotalLength)
+int
+SRXAFSCB_FetchData(struct rx_call *rxcall, struct AFSFid *Fid, afs_int32 Fd,
+ afs_int64 Position, afs_int64 Length,
+ afs_int64 * TotalLength)
{
return ENOSYS;
}
* Side Effects:
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_StoreData(struct rx_call *rxcall, struct AFSFid *Fid, afs_int32 Fd,
- afs_int64 Position, afs_int64 Length, afs_int64 *TotalLength)
+int
+SRXAFSCB_StoreData(struct rx_call *rxcall, struct AFSFid *Fid, afs_int32 Fd,
+ afs_int64 Position, afs_int64 Length,
+ afs_int64 * TotalLength)
{
return ENOSYS;
}
* As advertised.
*------------------------------------------------------------------------*/
-int SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
- char **a_name, serverList *a_hosts)
+int
+SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
+ char **a_name, serverList * a_hosts)
{
afs_int32 i, sn;
struct cell *tcell;
ObtainReadLock(&tcell->lock);
*a_name = afs_strdup(tcell->cellName);
- for (sn = 0; sn < AFSMAXCELLHOSTS && tcell->cellHosts[sn]; sn++)
- ;
+ 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_int32 *) afs_osi_Alloc(sn * sizeof(afs_int32));
for (i = 0; i < sn; i++)
a_hosts->serverList_val[i] = ntohl(tcell->cellHosts[i]->addr->sa_ip);
RX_AFS_GUNLOCK();
return 0;
}
-
+
+int
+SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call,
+ struct interfaceAddr *addr,
+ Capabilities * capabilities)
+{
+ int i;
+ int code = 0;
+ afs_int32 *dataBuffP;
+ afs_int32 dataBytes;
+
+ RX_AFS_GLOCK();
+
+ AFS_STATCNT(SRXAFSCB_WhoAreYou);
+
+ ObtainReadLock(&afs_xinterface);
+
+ /* return all network interface addresses */
+ addr->numberOfInterfaces = afs_cb_interface.numberOfInterfaces;
+ addr->uuid = afs_cb_interface.uuid;
+ for (i = 0; i < afs_cb_interface.numberOfInterfaces; i++) {
+ addr->addr_in[i] = ntohl(afs_cb_interface.addr_in[i]);
+ addr->subnetmask[i] = ntohl(afs_cb_interface.subnetmask[i]);
+ addr->mtu[i] = ntohl(afs_cb_interface.mtu[i]);
+ }
+
+ ReleaseReadLock(&afs_xinterface);
+
+ RX_AFS_GUNLOCK();
+
+ dataBytes = 1 * sizeof(afs_int32);
+ dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes);
+ dataBuffP[0] = CAPABILITY_ERRORTRANS;
+ capabilities->Capabilities_len = dataBytes / sizeof(afs_int32);
+ capabilities->Capabilities_val = dataBuffP;
+
+ return code;
+}