/*
* 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
#ifdef AFS_SGI62_ENV
#include "h/hashing.h"
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_DARWIN60_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_DARWIN_ENV)
#include "netinet/in_var.h"
#endif
#endif /* !defined(UKERNEL) */
-#ifdef AFS_LINUX22_ENV
-#include "h/smp_lock.h"
-#endif
struct afs_icl_set *afs_iclSetp = (struct afs_icl_set *)0;
struct afs_icl_set *afs_iclLongTermSetp = (struct afs_icl_set *)0;
-#if defined(AFS_OSF_ENV) || defined(AFS_SGI61_ENV)
-/* For SGI 6.2, this can is changed to 1 if it's a 32 bit kernel. */
-#if defined(AFS_SGI62_ENV) && defined(KERNEL) && !defined(_K64U64)
-int afs_icl_sizeofLong = 1;
-#else
-int afs_icl_sizeofLong = 2;
-#endif /* SGI62 */
-#else
-#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)
-int afs_icl_sizeofLong = 2;
+/* Matches below where ICL_APPENDLONG is 2 INT32s */
+#if (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_DARWIN_ENV) && defined(__amd64__)
+#define ICL_LONG 2
#else
-int afs_icl_sizeofLong = 1;
-#endif
+#define ICL_LONG 1
#endif
+int afs_icl_sizeofLong = ICL_LONG;
+
int afs_icl_inited = 0;
/* init function, called once, under afs_icl_lock */
}
/* Function called at shutdown - zap everything */
-int
+void
shutdown_icl(void)
{
struct afs_icl_log *logp;
struct afs_icl_set *setp;
- setp = afs_icl_FindSet("cm");
- if (setp) {
- /* Release the reference from Find, and the initial one */
- afs_icl_SetFree(setp);
+ if (afs_iclSetp) {
+ setp = afs_iclSetp; /* "cm" */
+ afs_iclSetp = NULL;
afs_icl_SetFree(setp);
}
- setp = afs_icl_FindSet("cmlongterm");
- if (setp) {
- /* Release the reference from Find, and the initial one */
- afs_icl_SetFree(setp);
+ if (afs_iclLongTermSetp) {
+ setp = afs_iclLongTermSetp; /* "cmlongterm" */
+ afs_iclLongTermSetp = NULL;
afs_icl_SetFree(setp);
}
logp = afs_icl_FindLog("cmfx");
afs_icl_LogFree(logp);
afs_icl_LogFree(logp);
}
- return 0;
}
int
/* initialize the ICL system */
code = afs_icl_CreateLog("cmfx", 60 * 1024, &logp);
- if (code == 0)
- code =
- afs_icl_CreateSetWithFlags("cm", logp, NULL,
- ICL_CRSET_FLAG_DEFAULT_OFF,
- &afs_iclSetp);
- code =
- afs_icl_CreateSet("cmlongterm", logp, NULL,
- &afs_iclLongTermSetp);
+ if (code)
+ return code;
+
+ code = afs_icl_CreateSetWithFlags("cm", logp, NULL,
+ ICL_CRSET_FLAG_DEFAULT_OFF,
+ &afs_iclSetp);
+ if (code)
+ return code;
+
+ code = afs_icl_CreateSet("cmlongterm", logp, NULL,
+ &afs_iclLongTermSetp);
return code;
}
#endif
{
afs_int32 *lp, elts, flags;
- register afs_int32 code;
+ afs_int32 code;
struct afs_icl_log *logp;
struct afs_icl_set *setp;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
size_t temp;
#else /* AFS_SGI61_ENV */
#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)
if (!logp)
return ENOENT;
#define BUFFERSIZE AFS_LRALLOCSIZ
- lp = (afs_int32 *) osi_AllocLargeSpace(AFS_LRALLOCSIZ);
+ lp = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
elts = BUFFERSIZE / sizeof(afs_int32);
if (p3 < elts)
elts = p3;
setp = afs_icl_FindSet(tname);
if (!setp)
return ENOENT;
- if (p2 > ICL_LOGSPERSET)
+ if (p2 >= ICL_LOGSPERSET)
return EINVAL;
if (!(tlp = setp->logs[p2]))
return EBADF;
/* exported routine: a 4 parameter event */
int
-afs_icl_Event4(register struct afs_icl_set *setp, afs_int32 eventID,
+afs_icl_Event4(struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1, long p2, long p3, long p4)
{
afs_int32 mask;
- register int i;
- register afs_int32 tmask;
+ int i;
+ afs_int32 tmask;
int ix;
/* If things aren't init'ed yet (or the set is inactive), don't panic */
return 0;
AFS_ASSERT_GLOCK();
+ afs_icl_SetHold(setp);
mask = lAndT >> 24 & 0xff; /* mask of which logs to log to */
ix = ICL_EVENTBYTE(eventID);
ObtainReadLock(&setp->lock);
}
}
ReleaseReadLock(&setp->lock);
+ afs_icl_SetRele(setp);
return 0;
}
* Otherwise, could call afs_icl_Event4 directly.
*/
int
-afs_icl_Event3(register struct afs_icl_set *setp, afs_int32 eventID,
+afs_icl_Event3(struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1, long p2, long p3)
{
return afs_icl_Event4(setp, eventID, lAndT, p1, p2, p3, (long)0);
}
int
-afs_icl_Event2(register struct afs_icl_set *setp, afs_int32 eventID,
+afs_icl_Event2(struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1, long p2)
{
return afs_icl_Event4(setp, eventID, lAndT, p1, p2, (long)0, (long)0);
}
int
-afs_icl_Event1(register struct afs_icl_set *setp, afs_int32 eventID,
+afs_icl_Event1(struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT, long p1)
{
return afs_icl_Event4(setp, eventID, lAndT, p1, (long)0, (long)0,
}
int
-afs_icl_Event0(register struct afs_icl_set *setp, afs_int32 eventID,
+afs_icl_Event0(struct afs_icl_set *setp, afs_int32 eventID,
afs_int32 lAndT)
{
return afs_icl_Event4(setp, eventID, lAndT, (long)0, (long)0, (long)0,
* Log must be write-locked.
*/
static void
-afs_icl_GetLogSpace(register struct afs_icl_log *logp, afs_int32 minSpace)
+afs_icl_GetLogSpace(struct afs_icl_log *logp, afs_int32 minSpace)
{
- register unsigned int tsize;
+ unsigned int tsize;
while (logp->logSize - logp->logElements <= minSpace) {
/* eat a record */
{
char *op; /* ptr to char to write */
int tc;
- register int bib; /* bytes in buffer */
+ int bib; /* bytes in buffer */
bib = 0;
op = (char *)&(logp->datap[logp->firstFree]);
(lp)->logElements++; \
MACRO_END
-#if defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_DARWIN_ENV) && defined(__amd64__)
+#if ICL_LONG == 2
#define ICL_APPENDLONG(lp, x) \
MACRO_BEGIN \
ICL_APPENDINT32((lp), ((x) >> 32) & 0xffffffffL); \
ICL_APPENDINT32((lp), (x) & 0xffffffffL); \
MACRO_END
-#else /* AFS_OSF_ENV */
+#else
#define ICL_APPENDLONG(lp, x) ICL_APPENDINT32((lp), (x))
-#endif /* AFS_OSF_ENV */
+#endif
/* routine to tell whether we're dealing with the address or the
* object itself
return 0;
}
+void
+afs_icl_AppendOne(struct afs_icl_log *logp, int type, long parm)
+{
+ if (type) {
+ /* marshall parameter 3 now */
+ if (type == ICL_TYPE_STRING)
+ afs_icl_AppendString(logp, (char *)parm);
+ else if (type == ICL_TYPE_HYPER) {
+ ICL_APPENDINT32(logp,
+ (afs_int32) ((struct afs_hyper_t *)parm)->high);
+ ICL_APPENDINT32(logp,
+ (afs_int32) ((struct afs_hyper_t *)parm)->low);
+ } else if (type == ICL_TYPE_INT64) {
+#ifndef WORDS_BIGENDIAN
+#ifdef AFS_64BIT_CLIENT
+ ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) parm)[1]);
+ ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) parm)[0]);
+#else /* AFS_64BIT_CLIENT */
+ ICL_APPENDINT32(logp, (afs_int32) parm);
+ ICL_APPENDINT32(logp, (afs_int32) 0);
+#endif /* AFS_64BIT_CLIENT */
+#else /* AFSLITTLE_ENDIAN */
+#ifdef AFS_64BIT_CLIENT
+ ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) parm)[0]);
+ ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) parm)[1]);
+#else /* AFS_64BIT_CLIENT */
+ ICL_APPENDINT32(logp, (afs_int32) 0);
+ ICL_APPENDINT32(logp, (afs_int32) parm);
+#endif /* AFS_64BIT_CLIENT */
+#endif /* AFSLITTLE_ENDIAN */
+ } else if (type == ICL_TYPE_FID) {
+ ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) parm)[0]);
+ ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) parm)[1]);
+ ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) parm)[2]);
+ ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) parm)[3]);
+ }
+#if ICL_LONG == 2
+ else if (type == ICL_TYPE_INT32)
+ ICL_APPENDINT32(logp, (afs_int32) parm);
+#endif
+ else
+ ICL_APPENDLONG(logp, parm);
+ }
+}
+
/* Function to append a record to the log. Written for speed
* since we know that we're going to have to make this work fast
* pretty soon, anyway. The log must be unlocked.
*/
void
-afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op,
+afs_icl_AppendRecord(struct afs_icl_log *logp, afs_int32 op,
afs_int32 types, long p1, long p2, long p3, long p4)
{
int rsize; /* record size in longs */
- register int tsize; /* temp size */
- osi_timeval_t tv;
+ int tsize; /* temp size */
+ osi_timeval32_t tv;
int t1, t2, t3, t4;
t4 = types & 0x3f; /* decode types */
logp->lastTS = tv.tv_sec;
}
- rsize = 4; /* base case */
+ rsize = 4; /* base case: see 4 items below */
if (t1) {
/* compute size of parameter p1. Only tricky case is string.
* In that case, we have to call strlen to get the string length.
*/
- ICL_SIZEHACK(t1, p1);
+ ICL_SIZEHACK(t1, p1, tsize, rsize);
}
if (t2) {
/* compute size of parameter p2. Only tricky case is string.
* In that case, we have to call strlen to get the string length.
*/
- ICL_SIZEHACK(t2, p2);
+ ICL_SIZEHACK(t2, p2, tsize, rsize);
}
if (t3) {
/* compute size of parameter p3. Only tricky case is string.
* In that case, we have to call strlen to get the string length.
*/
- ICL_SIZEHACK(t3, p3);
+ ICL_SIZEHACK(t3, p3, tsize, rsize);
}
if (t4) {
/* compute size of parameter p4. Only tricky case is string.
* In that case, we have to call strlen to get the string length.
*/
- ICL_SIZEHACK(t4, p4);
+ ICL_SIZEHACK(t4, p4, tsize, rsize);
}
/* At this point, we've computed all of the parameter sizes, and
ICL_APPENDINT32(logp,
(afs_int32) (tv.tv_sec & 0x3ff) * 1000000 + tv.tv_usec);
- if (t1) {
- /* marshall parameter 1 now */
- if (t1 == ICL_TYPE_STRING) {
- afs_icl_AppendString(logp, (char *)p1);
- } else if (t1 == ICL_TYPE_HYPER) {
- ICL_APPENDINT32(logp,
- (afs_int32) ((struct afs_hyper_t *)p1)->high);
- ICL_APPENDINT32(logp,
- (afs_int32) ((struct afs_hyper_t *)p1)->low);
- } else if (t1 == ICL_TYPE_INT64) {
-#ifndef WORDS_BIGENDIAN
-#ifdef AFS_64BIT_CLIENT
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[1]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[0]);
-#else /* AFS_64BIT_CLIENT */
- ICL_APPENDINT32(logp, (afs_int32) p1);
- ICL_APPENDINT32(logp, (afs_int32) 0);
-#endif /* AFS_64BIT_CLIENT */
-#else /* AFSLITTLE_ENDIAN */
-#ifdef AFS_64BIT_CLIENT
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[0]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[1]);
-#else /* AFS_64BIT_CLIENT */
- ICL_APPENDINT32(logp, (afs_int32) 0);
- ICL_APPENDINT32(logp, (afs_int32) p1);
-#endif /* AFS_64BIT_CLIENT */
-#endif /* AFSLITTLE_ENDIAN */
- } else if (t1 == ICL_TYPE_FID) {
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[0]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[1]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[2]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[3]);
- }
-#if defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
- else if (t1 == ICL_TYPE_INT32)
- ICL_APPENDINT32(logp, (afs_int32) p1);
-#endif /* AFS_OSF_ENV */
- else
- ICL_APPENDLONG(logp, p1);
- }
- if (t2) {
- /* marshall parameter 2 now */
- if (t2 == ICL_TYPE_STRING)
- afs_icl_AppendString(logp, (char *)p2);
- else if (t2 == ICL_TYPE_HYPER) {
- ICL_APPENDINT32(logp,
- (afs_int32) ((struct afs_hyper_t *)p2)->high);
- ICL_APPENDINT32(logp,
- (afs_int32) ((struct afs_hyper_t *)p2)->low);
- } else if (t2 == ICL_TYPE_INT64) {
-#ifndef WORDS_BIGENDIAN
-#ifdef AFS_64BIT_CLIENT
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[1]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[0]);
-#else /* AFS_64BIT_CLIENT */
- ICL_APPENDINT32(logp, (afs_int32) p2);
- ICL_APPENDINT32(logp, (afs_int32) 0);
-#endif /* AFS_64BIT_CLIENT */
-#else /* AFSLITTLE_ENDIAN */
-#ifdef AFS_64BIT_CLIENT
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[0]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[1]);
-#else /* AFS_64BIT_CLIENT */
- ICL_APPENDINT32(logp, (afs_int32) 0);
- ICL_APPENDINT32(logp, (afs_int32) p2);
-#endif /* AFS_64BIT_CLIENT */
-#endif /* AFSLITTLE_ENDIAN */
- } else if (t2 == ICL_TYPE_FID) {
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[0]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[1]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[2]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[3]);
- }
-#if defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
- else if (t2 == ICL_TYPE_INT32)
- ICL_APPENDINT32(logp, (afs_int32) p2);
-#endif /* AFS_OSF_ENV */
- else
- ICL_APPENDLONG(logp, p2);
- }
- if (t3) {
- /* marshall parameter 3 now */
- if (t3 == ICL_TYPE_STRING)
- afs_icl_AppendString(logp, (char *)p3);
- else if (t3 == ICL_TYPE_HYPER) {
- ICL_APPENDINT32(logp,
- (afs_int32) ((struct afs_hyper_t *)p3)->high);
- ICL_APPENDINT32(logp,
- (afs_int32) ((struct afs_hyper_t *)p3)->low);
- } else if (t3 == ICL_TYPE_INT64) {
-#ifndef WORDS_BIGENDIAN
-#ifdef AFS_64BIT_CLIENT
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[1]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[0]);
-#else /* AFS_64BIT_CLIENT */
- ICL_APPENDINT32(logp, (afs_int32) p3);
- ICL_APPENDINT32(logp, (afs_int32) 0);
-#endif /* AFS_64BIT_CLIENT */
-#else /* AFSLITTLE_ENDIAN */
-#ifdef AFS_64BIT_CLIENT
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[0]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[1]);
-#else /* AFS_64BIT_CLIENT */
- ICL_APPENDINT32(logp, (afs_int32) 0);
- ICL_APPENDINT32(logp, (afs_int32) p3);
-#endif /* AFS_64BIT_CLIENT */
-#endif /* AFSLITTLE_ENDIAN */
- } else if (t3 == ICL_TYPE_FID) {
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[0]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[1]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[2]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[3]);
- }
-#if defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
- else if (t3 == ICL_TYPE_INT32)
- ICL_APPENDINT32(logp, (afs_int32) p3);
-#endif /* AFS_OSF_ENV */
- else
- ICL_APPENDLONG(logp, p3);
- }
- if (t4) {
- /* marshall parameter 4 now */
- if (t4 == ICL_TYPE_STRING)
- afs_icl_AppendString(logp, (char *)p4);
- else if (t4 == ICL_TYPE_HYPER) {
- ICL_APPENDINT32(logp,
- (afs_int32) ((struct afs_hyper_t *)p4)->high);
- ICL_APPENDINT32(logp,
- (afs_int32) ((struct afs_hyper_t *)p4)->low);
- } else if (t4 == ICL_TYPE_INT64) {
-#ifndef WORDS_BIGENDIAN
-#ifdef AFS_64BIT_CLIENT
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[1]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[0]);
-#else /* AFS_64BIT_CLIENT */
- ICL_APPENDINT32(logp, (afs_int32) p4);
- ICL_APPENDINT32(logp, (afs_int32) 0);
-#endif /* AFS_64BIT_CLIENT */
-#else /* AFSLITTLE_ENDIAN */
-#ifdef AFS_64BIT_CLIENT
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[0]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[1]);
-#else /* AFS_64BIT_CLIENT */
- ICL_APPENDINT32(logp, (afs_int32) 0);
- ICL_APPENDINT32(logp, (afs_int32) p4);
-#endif /* AFS_64BIT_CLIENT */
-#endif /* AFSLITTLE_ENDIAN */
- } else if (t4 == ICL_TYPE_FID) {
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[0]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[1]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[2]);
- ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[3]);
- }
-#if defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
- else if (t4 == ICL_TYPE_INT32)
- ICL_APPENDINT32(logp, (afs_int32) p4);
-#endif /* AFS_OSF_ENV */
- else
- ICL_APPENDLONG(logp, p4);
- }
+ afs_icl_AppendOne(logp, t1, p1);
+ afs_icl_AppendOne(logp, t2, p2);
+ afs_icl_AppendOne(logp, t3, p3);
+ afs_icl_AppendOne(logp, t4, p4);
ReleaseWriteLock(&logp->lock);
}
afs_icl_CreateLogWithFlags(char *name, afs_int32 logSize, afs_uint32 flags,
struct afs_icl_log **outLogpp)
{
- register struct afs_icl_log *logp;
+ struct afs_icl_log *logp;
/* add into global list under lock */
ObtainWriteLock(&afs_icl_lock, 183);
}
}
- logp = (struct afs_icl_log *)
- osi_AllocSmallSpace(sizeof(struct afs_icl_log));
+ logp = osi_AllocSmallSpace(sizeof(struct afs_icl_log));
memset((caddr_t) logp, 0, sizeof(*logp));
logp->refCount = 1;
* find the record with cookie value cookie.
*/
int
-afs_icl_CopyOut(register struct afs_icl_log *logp, afs_int32 * bufferp,
+afs_icl_CopyOut(struct afs_icl_log *logp, afs_int32 * bufferp,
afs_int32 * bufSizep, afs_uint32 * cookiep,
afs_int32 * flagsp)
{
/* hold and release logs */
int
-afs_icl_LogHold(register struct afs_icl_log *logp)
+afs_icl_LogHold(struct afs_icl_log *logp)
{
ObtainWriteLock(&afs_icl_lock, 187);
logp->refCount++;
/* hold and release logs, called with lock already held */
int
-afs_icl_LogHoldNL(register struct afs_icl_log *logp)
+afs_icl_LogHoldNL(struct afs_icl_log *logp)
{
logp->refCount++;
return 0;
/* keep track of how many sets believe the log itself is allocated */
int
-afs_icl_LogUse(register struct afs_icl_log *logp)
+afs_icl_LogUse(struct afs_icl_log *logp)
{
ObtainWriteLock(&logp->lock, 188);
if (logp->setCount == 0) {
/* we weren't passed in a hint and it wasn't set */
logp->logSize = ICL_DEFAULT_LOGSIZE;
}
- logp->datap =
- (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logp->logSize);
+ logp->datap = afs_osi_Alloc(sizeof(afs_int32) * logp->logSize);
+ osi_Assert(logp->datap != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)logp->datap, sizeof(afs_int32) * logp->logSize);
#endif
/* decrement the number of real users of the log, free if possible */
int
-afs_icl_LogFreeUse(register struct afs_icl_log *logp)
+afs_icl_LogFreeUse(struct afs_icl_log *logp)
{
ObtainWriteLock(&logp->lock, 189);
if (--logp->setCount == 0) {
/* set the size of the log to 'logSize' */
int
-afs_icl_LogSetSize(register struct afs_icl_log *logp, afs_int32 logSize)
+afs_icl_LogSetSize(struct afs_icl_log *logp, afs_int32 logSize)
{
ObtainWriteLock(&logp->lock, 190);
if (!logp->datap) {
#ifdef KERNEL_HAVE_PIN
unpin((char *)logp->datap, sizeof(afs_int32) * logp->logSize);
#endif
- logp->datap =
- (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logSize);
+ logp->datap = afs_osi_Alloc(sizeof(afs_int32) * logSize);
+ osi_Assert(logp->datap != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)logp->datap, sizeof(afs_int32) * logSize);
#endif
/* free a log. Called with afs_icl_lock locked. */
int
-afs_icl_ZapLog(register struct afs_icl_log *logp)
+afs_icl_ZapLog(struct afs_icl_log *logp)
{
- register struct afs_icl_log **lpp, *tp;
+ struct afs_icl_log **lpp, *tp;
for (lpp = &afs_icl_allLogs, tp = *lpp; tp; lpp = &tp->nextp, tp = *lpp) {
if (tp == logp) {
/* do the release, watching for deleted entries */
int
-afs_icl_LogRele(register struct afs_icl_log *logp)
+afs_icl_LogRele(struct afs_icl_log *logp)
{
ObtainWriteLock(&afs_icl_lock, 191);
if (--logp->refCount == 0 && (logp->states & ICL_LOGF_DELETED)) {
/* do the release, watching for deleted entries, log already held */
int
-afs_icl_LogReleNL(register struct afs_icl_log *logp)
+afs_icl_LogReleNL(struct afs_icl_log *logp)
{
if (--logp->refCount == 0 && (logp->states & ICL_LOGF_DELETED)) {
afs_icl_ZapLog(logp); /* destroys logp's lock! */
/* zero out the log */
int
-afs_icl_ZeroLog(register struct afs_icl_log *logp)
+afs_icl_ZeroLog(struct afs_icl_log *logp)
{
ObtainWriteLock(&logp->lock, 192);
logp->firstUsed = logp->firstFree = 0;
/* free a log entry, and drop its reference count */
int
-afs_icl_LogFree(register struct afs_icl_log *logp)
+afs_icl_LogFree(struct afs_icl_log *logp)
{
ObtainWriteLock(&logp->lock, 193);
logp->states |= ICL_LOGF_DELETED;
struct afs_icl_log *
afs_icl_FindLog(char *name)
{
- register struct afs_icl_log *tp;
+ struct afs_icl_log *tp;
ObtainWriteLock(&afs_icl_lock, 194);
for (tp = afs_icl_allLogs; tp; tp = tp->nextp) {
if (strcmp(tp->name, name) == 0) {
(char *name, char *arock, struct afs_icl_log * tp),
char *arock)
{
- register struct afs_icl_log *tp;
- register afs_int32 code;
+ struct afs_icl_log *tp;
+ afs_int32 code;
code = 0;
ObtainWriteLock(&afs_icl_lock, 195);
struct afs_icl_log *fatalLogp, afs_uint32 flags,
struct afs_icl_set **outSetpp)
{
- register struct afs_icl_set *setp;
- register int i;
+ struct afs_icl_set *setp;
+ int i;
afs_int32 states = ICL_DEFAULT_SET_STATES;
ObtainWriteLock(&afs_icl_lock, 197);
if (flags & ICL_CRSET_FLAG_PERSISTENT)
states |= ICL_SETF_PERSISTENT;
- setp = (struct afs_icl_set *)osi_AllocSmallSpace(sizeof(struct afs_icl_set));
+ setp = osi_AllocSmallSpace(sizeof(struct afs_icl_set));
memset((caddr_t) setp, 0, sizeof(*setp));
setp->refCount = 1;
if (states & ICL_SETF_FREED)
strcpy(setp->name, name);
setp->nevents = ICL_DEFAULTEVENTS;
setp->eventFlags = afs_osi_Alloc(ICL_DEFAULTEVENTS);
+ osi_Assert(setp->eventFlags != NULL);
#ifdef KERNEL_HAVE_PIN
pin((char *)setp->eventFlags, ICL_DEFAULTEVENTS);
#endif
/* hold and release event sets */
int
-afs_icl_SetHold(register struct afs_icl_set *setp)
+afs_icl_SetHold(struct afs_icl_set *setp)
{
ObtainWriteLock(&afs_icl_lock, 201);
setp->refCount++;
/* free a set. Called with afs_icl_lock locked */
int
-afs_icl_ZapSet(register struct afs_icl_set *setp)
+afs_icl_ZapSet(struct afs_icl_set *setp)
{
- register struct afs_icl_set **lpp, *tp;
+ struct afs_icl_set **lpp, *tp;
int i;
- register struct afs_icl_log *tlp;
+ struct afs_icl_log *tlp;
for (lpp = &afs_icl_allSets, tp = *lpp; tp; lpp = &tp->nextp, tp = *lpp) {
if (tp == setp) {
/* do the release, watching for deleted entries */
int
-afs_icl_SetRele(register struct afs_icl_set *setp)
+afs_icl_SetRele(struct afs_icl_set *setp)
{
ObtainWriteLock(&afs_icl_lock, 202);
if (--setp->refCount == 0 && (setp->states & ICL_SETF_DELETED)) {
/* free a set entry, dropping its reference count */
int
-afs_icl_SetFree(register struct afs_icl_set *setp)
+afs_icl_SetFree(struct afs_icl_set *setp)
{
ObtainWriteLock(&setp->lock, 203);
setp->states |= ICL_SETF_DELETED;
struct afs_icl_set *
afs_icl_FindSet(char *name)
{
- register struct afs_icl_set *tp;
+ struct afs_icl_set *tp;
ObtainWriteLock(&afs_icl_lock, 204);
for (tp = afs_icl_allSets; tp; tp = tp->nextp) {
if (strcmp(tp->name, name) == 0) {
int
afs_icl_ZeroSet(struct afs_icl_set *setp)
{
- register int i;
+ int i;
int code = 0;
int tcode;
struct afs_icl_log *logp;
(char *name, char *arock, struct afs_icl_log * tp),
char *arock)
{
- register struct afs_icl_set *tp, *np;
- register afs_int32 code;
+ struct afs_icl_set *tp, *np;
+ afs_int32 code;
code = 0;
ObtainWriteLock(&afs_icl_lock, 205);
int
afs_icl_AddLogToSet(struct afs_icl_set *setp, struct afs_icl_log *newlogp)
{
- register int i;
+ int i;
int code = -1;
ObtainWriteLock(&setp->lock, 207);
break;
case ICL_OP_SS_FREE: /* deassert design for log */
- /*
+ /*
* if we are already in this state, do nothing; otherwise
* deassert desire for log
*/