/*
* 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
memCacheBlkSize = blkSize;
memMaxBlkNumber = blkCount;
- memCache = (struct memCacheEntry *)
+ memCache =
afs_osi_Alloc(memMaxBlkNumber * sizeof(struct memCacheEntry));
+ osi_Assert(memCache != NULL);
for (index = 0; index < memMaxBlkNumber; index++) {
char *blk;
(memCache + index)->data = blk;
memset((memCache + index)->data, 0, memCacheBlkSize);
}
-#if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS)
+#if defined(AFS_HAVE_VXFS)
afs_InitDualFSCacheOps((struct vnode *)0);
#endif
-
+ for (index = 0; index < blkCount; index++)
+ afs_InitCacheFile(NULL, 0);
return 0;
nomem:
- printf("afsd: memCache allocation failure at %d KB.\n",
- (index * memCacheBlkSize) / 1024);
+ afs_warn("afsd: memCache allocation failure at %d KB.\n",
+ (index * memCacheBlkSize) / 1024);
while (--index >= 0) {
afs_osi_Free((memCache + index)->data, memCacheBlkSize);
(memCache + index)->data = NULL;
}
/*
- * this routine simulates a read in the Memory Cache
+ * this routine simulates a read in the Memory Cache
*/
int
-afs_MemReadBlk(register struct osi_file *fP, int offset, void *dest,
+afs_MemReadBlk(struct osi_file *fP, int offset, void *dest,
int size)
{
- register struct memCacheEntry *mceP = (struct memCacheEntry *)fP;
+ struct memCacheEntry *mceP = (struct memCacheEntry *)fP;
int bytesRead;
ObtainReadLock(&mceP->afs_memLock);
}
/*
- * this routine simulates a readv in the Memory Cache
+ * this routine simulates a readv in the Memory Cache
*/
int
-afs_MemReadvBlk(register struct memCacheEntry *mceP, int offset,
+afs_MemReadvBlk(struct memCacheEntry *mceP, int offset,
struct iovec *iov, int nio, int size)
{
int i;
int
afs_MemReadUIO(afs_dcache_id_t *ainode, struct uio *uioP)
{
- register struct memCacheEntry *mceP =
+ struct memCacheEntry *mceP =
(struct memCacheEntry *)afs_MemCacheOpen(ainode);
int length = mceP->size - AFS_UIO_OFFSET(uioP);
afs_int32 code;
}
int
-afs_MemWriteBlk(register struct osi_file *fP, int offset, void *src,
+afs_MemWriteBlk(struct osi_file *fP, int offset, void *src,
int size)
{
- register struct memCacheEntry *mceP = (struct memCacheEntry *)fP;
+ struct memCacheEntry *mceP = (struct memCacheEntry *)fP;
struct iovec tiov;
tiov.iov_base = src;
/*XXX: this extends a block arbitrarily to support big directories */
int
-afs_MemWritevBlk(register struct memCacheEntry *mceP, int offset,
+afs_MemWritevBlk(struct memCacheEntry *mceP, int offset,
struct iovec *iov, int nio, int size)
{
int i;
}
int
-afs_MemWriteUIO(afs_dcache_id_t *ainode, struct uio *uioP)
+afs_MemWriteUIO(struct vcache *avc, afs_dcache_id_t *ainode, struct uio *uioP)
{
- register struct memCacheEntry *mceP =
+ struct memCacheEntry *mceP =
(struct memCacheEntry *)afs_MemCacheOpen(ainode);
afs_int32 code;
}
int
-afs_MemCacheTruncate(register struct osi_file *fP, int size)
+afs_MemCacheTruncate(struct osi_file *fP, int size)
{
- register struct memCacheEntry *mceP = (struct memCacheEntry *)fP;
+ struct memCacheEntry *mceP = (struct memCacheEntry *)fP;
AFS_STATCNT(afs_MemCacheTruncate);
ObtainWriteLock(&mceP->afs_memLock, 313);
void
shutdown_memcache(void)
{
- register int index;
+ int index;
if (cacheDiskType != AFS_FCACHE_TYPE_MEM)
return;