From 8236e418cc829a30eb6176184a9fe3b51c7ed1ba Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 20 Jun 2003 01:40:15 +0000 Subject: [PATCH] more-warnings-and-prototyping-work-20030619 FIXES 1816 abstracted from work by toddr@rpi.edu --- src/dir/buffer.c | 1 + src/viced/afsfileprocs.c | 12 ++++----- src/vol/clone.c | 2 +- src/vol/ihandle.c | 10 +++---- src/vol/vnode.c | 69 ++++++++++++++++++------------------------------ src/vol/volume.c | 5 +--- src/vol/volume.h | 23 ++++++++-------- src/vol/vutil.c | 40 +++++++++++----------------- src/volser/physio.c | 43 +++++++----------------------- src/volser/volprocs.c | 2 +- 10 files changed, 76 insertions(+), 131 deletions(-) diff --git a/src/dir/buffer.c b/src/dir/buffer.c index 0d0549e..0939494 100644 --- a/src/dir/buffer.c +++ b/src/dir/buffer.c @@ -325,6 +325,7 @@ DZap (fid) ReleaseReadLock(&afs_bufferLock); } +int DFlushVolume (vid) register afs_int32 vid; { diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index a7e7cb7..c9c4f54 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -676,7 +676,7 @@ GetVolumePackage(struct rx_connection *tcon, * This is the opposite of GetVolumePackage(), and is always used at the end of * AFS calls to put back all used vnodes and the volume in the proper order! */ -static afs_int32 +static void PutVolumePackage(Vnode *parentwhentargetnotdir, Vnode *targetptr, Vnode *parentptr, @@ -2070,7 +2070,7 @@ afs_int32 common_FetchData64 (struct rx_call *acall, AFSCallStats.FetchData++, AFSCallStats.TotalCalls++; FS_UNLOCK - if (errorCode = CallPreamble(acall, ACTIVECALL, &tcon)) + if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon))) goto Bad_FetchData; /* Get ptr to client data for user Id for logging */ @@ -3777,10 +3777,10 @@ SAFSS_Rename (struct rx_call *acall, } if (OldDirFid->Vnode <= NewDirFid->Vnode) { - if (errorCode = GetVolumePackage(tcon, OldDirFid, &volptr, - &oldvptr, MustBeDIR, &parent, - &client, WRITE_LOCK, &rights, - &anyrights)) { + if ((errorCode = GetVolumePackage(tcon, OldDirFid, &volptr, + &oldvptr, MustBeDIR, &parent, + &client, WRITE_LOCK, &rights, + &anyrights))) { DFlush(); goto Bad_Rename; } diff --git a/src/vol/clone.c b/src/vol/clone.c index 68b0d1f..ea7ff26 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -279,7 +279,7 @@ afs_int32 DoCloneIndex(Volume *rwvp, Volume *clvp, } } - /* Overwrite the vnode etnry in the clone volume */ + /* Overwrite the vnode entry in the clone volume */ rwvnode->cloned = 0; code = STREAM_WRITE(rwvnode, vcp->diskSize, 1, clfileout); if (code != 1) { diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index 3866ec6..59bd08c 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -99,7 +99,7 @@ void ih_glock_init() #endif /* AFS_PTHREAD_ENV */ /* Initialize the file descriptor cache */ -void ih_Initialize() { +void ih_Initialize(void) { int i; assert(!ih_Inited); ih_Inited = 1; @@ -146,7 +146,7 @@ void ih_Initialize() { /* Make the file descriptor cache as big as possible. Don't this call * if the program uses fopen or fdopen. */ -void ih_UseLargeCache() { +void ih_UseLargeCache(void) { IH_LOCK if (!ih_Inited) { @@ -158,7 +158,7 @@ void ih_UseLargeCache() { } /* Allocate a chunk of inode handles */ -void iHandleAllocateChunk() +void iHandleAllocateChunk(void) { int i; IHandle_t *ihP; @@ -224,7 +224,7 @@ IHandle_t *ih_copy(IHandle_t *ihP) } /* Allocate a chunk of file descriptor handles */ -void fdHandleAllocateChunk() +void fdHandleAllocateChunk(void) { int i; FdHandle_t *fdP; @@ -241,7 +241,7 @@ void fdHandleAllocateChunk() } /* Allocate a chunk of stream handles */ -void streamHandleAllocateChunk() +void streamHandleAllocateChunk(void) { int i; StreamHandle_t *streamP; diff --git a/src/vol/vnode.c b/src/vol/vnode.c index 06e3959..511567f 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -42,8 +42,8 @@ RCSID("$Header$"); #include #include "ihandle.h" #include "vnode.h" -#include "partition.h" #include "volume.h" +#include "partition.h" #if defined(AFS_SGI_ENV) #include "sys/types.h" #include "fcntl.h" @@ -70,9 +70,8 @@ RCSID("$Header$"); struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES]; -private int moveHash(); -void StickOnLruChain_r(); -void VPutVnode_r(); +private int moveHash(register Vnode *vnp, bit32 newHash); +void StickOnLruChain_r(register Vnode *vnp, register struct VnodeClassInfo *vcp); #define BAD_IGET -1000 @@ -133,7 +132,7 @@ afs_int32 av1, av2, av3,av4; { * when there are not many volumes represented), and spread * equally amongst vnodes within a single volume. */ -int VolumeHashOffset_r() { +int VolumeHashOffset_r(void) { static int nextVolumeHashOffset = 0; /* hashindex Must be power of two in size */ # define hashShift 3 @@ -232,8 +231,8 @@ int VInitVnodes(VnodeClass class, int nVnodes) /* allocate an *unused* vnode from the LRU chain, going backwards of course. It shouldn't be necessary to specify that nUsers == 0 since if it is in the list, nUsers should be 0. Things shouldn't be in lruq unless no one is using them. */ -Vnode *VGetFreeVnode_r(vcp) -struct VnodeClassInfo *vcp; { +Vnode *VGetFreeVnode_r(struct VnodeClassInfo *vcp) +{ register Vnode *vnp; vnp = vcp->lruHead->lruPrev; @@ -249,10 +248,7 @@ static mlkLastAlloc = 0; static mlkLastOver = 0; static mlkLastDelete = 0; -Vnode *VAllocVnode(ec,vp,type) - Error *ec; - Volume *vp; - VnodeType type; +Vnode *VAllocVnode(Error *ec, Volume *vp, VnodeType type) { Vnode *retVal; VOL_LOCK @@ -261,10 +257,7 @@ Vnode *VAllocVnode(ec,vp,type) return retVal; } -Vnode *VAllocVnode_r(ec,vp,type) - Error *ec; - Volume *vp; - VnodeType type; +Vnode *VAllocVnode_r(Error *ec, Volume *vp, VnodeType type) { register Vnode *vnp; VnodeId vnodeNumber; @@ -423,11 +416,11 @@ Vnode *VAllocVnode_r(ec,vp,type) return vnp; } -Vnode *VGetVnode(ec,vp,vnodeNumber,locktype) - Error *ec; - Volume *vp; - VnodeId vnodeNumber; - int locktype; /* READ_LOCK or WRITE_LOCK, as defined in lock.h */ +Vnode *VGetVnode( + Error *ec, + Volume *vp, + VnodeId vnodeNumber, + int locktype) /* READ_LOCK or WRITE_LOCK, as defined in lock.h */ { Vnode *retVal; VOL_LOCK @@ -436,11 +429,11 @@ Vnode *VGetVnode(ec,vp,vnodeNumber,locktype) return retVal; } -Vnode *VGetVnode_r(ec,vp,vnodeNumber,locktype) - Error *ec; - Volume *vp; - VnodeId vnodeNumber; - int locktype; /* READ_LOCK or WRITE_LOCK, as defined in lock.h */ +Vnode *VGetVnode_r( + Error *ec, + Volume *vp, + VnodeId vnodeNumber, + int locktype) /* READ_LOCK or WRITE_LOCK, as defined in lock.h */ { register Vnode *vnp; int newHash; @@ -530,7 +523,7 @@ Vnode *VGetVnode_r(ec,vp,vnodeNumber,locktype) VOL_UNLOCK fdP = IH_OPEN(ihP); if (fdP == NULL) { - Log("VGetVnode: can't open index dev=%d, i=%s\n", + Log("VGetVnode: can't open index dev=%u, i=%s\n", vp->device, PrintInode(NULL, vp->vnodeIndex[class].handle->ih_ino)); *ec = VIO; @@ -667,9 +660,7 @@ int TrustVnodeCacheEntry = 1; /* This variable is bogus--when it's set to 0, the hash chains fill up with multiple versions of the same vnode. Should fix this!! */ void -VPutVnode(ec,vnp) - Error *ec; - register Vnode *vnp; +VPutVnode(Error *ec, register Vnode *vnp) { VOL_LOCK VPutVnode_r(ec,vnp); @@ -677,9 +668,7 @@ VPutVnode(ec,vnp) } void -VPutVnode_r(ec,vnp) - Error *ec; - register Vnode *vnp; +VPutVnode_r(Error *ec, register Vnode *vnp) { int writeLocked, offset; VnodeClass class; @@ -797,9 +786,7 @@ VPutVnode_r(ec,vnp) * Do nothing if the vnode isn't write locked or the vnode has * been deleted. */ -int VVnodeWriteToRead(ec,vnp) - Error *ec; - register Vnode *vnp; +int VVnodeWriteToRead(Error *ec, register Vnode *vnp) { int retVal; VOL_LOCK @@ -808,9 +795,7 @@ int VVnodeWriteToRead(ec,vnp) return retVal; } -int VVnodeWriteToRead_r(ec,vnp) - Error *ec; - register Vnode *vnp; +int VVnodeWriteToRead_r(Error *ec, register Vnode *vnp) { int writeLocked; VnodeClass class; @@ -906,9 +891,7 @@ int VVnodeWriteToRead_r(ec,vnp) /* Move the vnode, vnp, to the new hash table given by the hash table index, newHash */ -static int moveHash(vnp, newHash) - register Vnode *vnp; - bit32 newHash; +static int moveHash(register Vnode *vnp, bit32 newHash) { Vnode *tvnp; /* Remove it from the old hash chain */ @@ -929,9 +912,7 @@ static int moveHash(vnp, newHash) } void -StickOnLruChain_r(vnp,vcp) - register Vnode *vnp; - register struct VnodeClassInfo *vcp; +StickOnLruChain_r(register Vnode *vnp, register struct VnodeClassInfo *vcp) { /* Add it to the circular LRU list */ if (vcp->lruHead == NULL) diff --git a/src/vol/volume.c b/src/vol/volume.c index caaca6a..ffcc645 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -194,9 +194,6 @@ struct Lock vol_listLock; /* Lock obtained when listing volumes: prevents a vo extern struct Lock FSYNC_handler_lock; -Volume *VAttachVolumeByName(); -Volume *VAttachVolumeByName_r(); - static int TimeZoneCorrection; /* Number of seconds west of GMT */ /* Common message used when the volume goes off line */ @@ -1680,7 +1677,7 @@ void VAddToVolumeUpdateList_r(Error *ec, Volume *vp) UpdateList[nUpdatedVolumes++] = V_id(vp); } -static void VScanUpdateList() { +static void VScanUpdateList(void) { register int i, gap; register Volume *vp; Error error; diff --git a/src/vol/volume.h b/src/vol/volume.h index 2f846b1..82be75a 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -398,18 +398,19 @@ struct volHeader { extern char *VSalvageMessage; /* Canonical message when a volume is forced offline */ -extern Volume * VGetVolume(); -extern Volume * VGetVolume_r(); +extern Volume * VGetVolume(Error *ec, VolId volumeId); +extern Volume * VGetVolume_r(Error *ec, VolId volumeId); extern void VPutVolume(Volume *); extern void VPutVolume_r(Volume *); extern void VOffline(Volume *vp, char *message); extern void VOffline_r(Volume *vp, char *message); extern int VConnectFS(void); extern int VConnectFS_r(void); -extern Volume * VAttachVolume(); -extern Volume * VAttachVolume_r(); -extern Volume * VCreateVolume(); -extern Volume * VCreateVolume_r(); +extern Volume * VAttachVolume(Error *ec, VolumeId volumeId, int mode); +extern Volume * VAttachVolume_r(Error *ec, VolumeId volumeId, int mode); +extern Volume * VCreateVolume(Error *ec, char *partname, VolId volumeId, VolId parentId); +extern Volume * VCreateVolume_r(Error *ec, char *partname, + VolId volumeId, VolId parentId); extern VnodeId VAllocBitmapEntry(Error *ec, Volume *vp, struct vnodeIndex *index); extern VnodeId VAllocBitmapEntry_r(Error *ec, Volume *vp, @@ -418,12 +419,10 @@ extern void VFreeBitMapEntry(Error *ec, register struct vnodeIndex *index, unsigned bitNumber); extern void VFreeBitMapEntry_r(Error *ec, register struct vnodeIndex *index, unsigned bitNumber); -extern int VolumeNumber(); -extern int VolumeNumber_r(); -extern char * VolumeExternalName(); -extern char * VolumeExternalName_r(); -extern Volume * VAttachVolumeByName(); -extern Volume * VAttachVolumeByName_r(); +extern int VolumeNumber(char *name); +extern char * VolumeExternalName(VolumeId volumeId); +extern Volume * VAttachVolumeByName(Error *ec, char *partition, char *name, int mode); +extern Volume * VAttachVolumeByName_r(Error *ec, char *partition, char *name, int mode); extern void VShutdown(void); extern void VUpdateVolume(Error *ec,Volume *vp); extern void VUpdateVolume_r(Error *ec,Volume *vp); diff --git a/src/vol/vutil.c b/src/vol/vutil.c index d643ee2..7e554db 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -97,11 +97,11 @@ static void RemoveInodes(Device dev, VolumeId vid) IH_RELEASE(handle); } -Volume *VCreateVolume(ec, partname, volumeId, parentId) - Error *ec; - char *partname; - VolId volumeId; - VolId parentId; /* Should be the same as volumeId if there is +Volume *VCreateVolume( + Error *ec, + char *partname, + VolId volumeId, + VolId parentId) /* Should be the same as volumeId if there is no parent */ { Volume *retVal; @@ -111,11 +111,11 @@ Volume *VCreateVolume(ec, partname, volumeId, parentId) return retVal; } -Volume *VCreateVolume_r(ec, partname, volumeId, parentId) - Error *ec; - char *partname; - VolId volumeId; - VolId parentId; /* Should be the same as volumeId if there is +Volume *VCreateVolume_r( + Error *ec, + char *partname, + VolId volumeId, + VolId parentId) /* Should be the same as volumeId if there is no parent */ { VolumeDiskData vol; @@ -289,9 +289,7 @@ Volume *VCreateVolume_r(ec, partname, volumeId, parentId) void -AssignVolumeName(vol, name, ext) - register VolumeDiskData *vol; - char *name,*ext; +AssignVolumeName(register VolumeDiskData *vol, char *name, char *ext) { VOL_LOCK AssignVolumeName_r(vol, name, ext); @@ -299,9 +297,7 @@ AssignVolumeName(vol, name, ext) } void -AssignVolumeName_r(vol, name, ext) - register VolumeDiskData *vol; - char *name,*ext; +AssignVolumeName_r(register VolumeDiskData *vol, char *name, char *ext) { register char *dot; strncpy(vol->name, name, VNAMESIZE-1); @@ -313,8 +309,7 @@ AssignVolumeName_r(vol, name, ext) strncat(vol->name, ext, VNAMESIZE-1-strlen(vol->name)); } -afs_int32 CopyVolumeHeader_r(from, to) - VolumeDiskData *from, *to; +afs_int32 CopyVolumeHeader_r(VolumeDiskData *from, VolumeDiskData *to) { /* The id and parentId fields are not copied; these are inviolate--the to volume is assumed to have already been created. The id's cannot be changed once @@ -338,8 +333,7 @@ afs_int32 CopyVolumeHeader_r(from, to) return 0; } -afs_int32 CopyVolumeHeader(from, to) - VolumeDiskData *from, *to; +afs_int32 CopyVolumeHeader(VolumeDiskData *from, VolumeDiskData *to) { afs_int32 code; @@ -350,8 +344,7 @@ afs_int32 CopyVolumeHeader(from, to) } void -ClearVolumeStats(vol) - register VolumeDiskData *vol; +ClearVolumeStats(register VolumeDiskData *vol) { VOL_LOCK ClearVolumeStats_r(vol); @@ -359,8 +352,7 @@ ClearVolumeStats(vol) } void -ClearVolumeStats_r(vol) - register VolumeDiskData *vol; +ClearVolumeStats_r(register VolumeDiskData *vol) { memset(vol->weekUse, 0, sizeof(vol->weekUse)); vol->dayUse = 0; diff --git a/src/volser/physio.c b/src/volser/physio.c index c778eab..0694772 100644 --- a/src/volser/physio.c +++ b/src/volser/physio.c @@ -42,10 +42,7 @@ RCSID("$Header$"); #include "vol.h" /* returns 0 on success, errno on failure */ -int ReallyRead (file, block, data) -DirHandle * file; -int block; -char * data; +int ReallyRead(DirHandle *file, int block, char *data) { FdHandle_t *fdP; int code; @@ -74,10 +71,7 @@ char * data; } /* returns 0 on success, errno on failure */ -int ReallyWrite (file, block, data) -DirHandle * file; -int block; -char * data; +int ReallyWrite (DirHandle *file, int block, char *data) { FdHandle_t *fdP; extern int VolumeChanged; @@ -113,11 +107,7 @@ char * data; * Create a handle to a directory entry and reference it (IH_INIT). * The handle needs to be dereferenced with the FidZap() routine. */ -SetSalvageDirHandle(dir, volume, device, inode) -DirHandle *dir; -afs_int32 volume; -Inode inode; -afs_int32 device; +void SetSalvageDirHandle(DirHandle *dir, afs_int32 volume, Inode inode, afs_int32 device) { private SalvageCacheCheck = 1; memset(dir, 0, sizeof(DirHandle)); @@ -131,25 +121,18 @@ afs_int32 device; dir->dirh_cacheCheck = SalvageCacheCheck++; } -FidZap (file) -DirHandle * file; - +void FidZap(DirHandle *file) { IH_RELEASE(file->dirh_handle); memset(file, 0, sizeof(DirHandle)); } -FidZero (file) -DirHandle * file; - +void FidZero(DirHandle *file) { memset(file, 0, sizeof(DirHandle)); } -FidEq (afile, bfile) -DirHandle * afile; -DirHandle * bfile; - +int FidEq(DirHandle *afile, DirHandle *bfile) { if (afile->dirh_volume != bfile->dirh_volume) return 0; if (afile->dirh_device != bfile->dirh_device) return 0; @@ -158,27 +141,19 @@ DirHandle * bfile; return 1; } -FidVolEq (afile, vid) -DirHandle * afile; -afs_int32 vid; - +int FidVolEq(DirHandle *afile, afs_int32 vid) { if (afile->dirh_volume != vid) return 0; return 1; } -FidCpy (tofile, fromfile) -DirHandle * tofile; -DirHandle * fromfile; - +void FidCpy(DirHandle *tofile, DirHandle *fromfile) { *tofile = *fromfile; IH_COPY(tofile->dirh_handle, fromfile->dirh_handle); } -Die (msg) -char * msg; - +void Die (char *msg) { printf("%s\n",msg); assert(1==2); diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 9ab46fb..aca7e08 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -389,7 +389,7 @@ afs_int32 *avolid; if (strlen(aname) > 31) return VOLSERBADNAME; if (!afsconf_SuperUser(tdir, acid, caller)) return VOLSERBAD_ACCESS; if (DoLogging) Log("%s is executing CreateVolume '%s'\n", caller, aname); - if (error = ConvertPartition(apart, ppath, sizeof(ppath))) return error;/*a standard unix error*/ + if ((error = ConvertPartition(apart, ppath, sizeof(ppath)))) return error;/*a standard unix error*/ if (atype != readwriteVolume && atype != readonlyVolume && atype != backupVolume) return EINVAL; if ((volumeID = *avolid) == 0) { -- 1.9.4