ReleaseReadLock(&afs_bufferLock);
}
+int
DFlushVolume (vid)
register afs_int32 vid;
{
* 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,
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 */
}
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;
}
}
}
- /* 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) {
#endif /* AFS_PTHREAD_ENV */
/* Initialize the file descriptor cache */
-void ih_Initialize() {
+void ih_Initialize(void) {
int i;
assert(!ih_Inited);
ih_Inited = 1;
/* 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) {
}
/* Allocate a chunk of inode handles */
-void iHandleAllocateChunk()
+void iHandleAllocateChunk(void)
{
int i;
IHandle_t *ihP;
}
/* Allocate a chunk of file descriptor handles */
-void fdHandleAllocateChunk()
+void fdHandleAllocateChunk(void)
{
int i;
FdHandle_t *fdP;
}
/* Allocate a chunk of stream handles */
-void streamHandleAllocateChunk()
+void streamHandleAllocateChunk(void)
{
int i;
StreamHandle_t *streamP;
#include <afs/afssyscalls.h>
#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"
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
* 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
/* 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;
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
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;
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
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;
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;
/* 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);
}
void
-VPutVnode_r(ec,vnp)
- Error *ec;
- register Vnode *vnp;
+VPutVnode_r(Error *ec, register Vnode *vnp)
{
int writeLocked, offset;
VnodeClass class;
* 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
return retVal;
}
-int VVnodeWriteToRead_r(ec,vnp)
- Error *ec;
- register Vnode *vnp;
+int VVnodeWriteToRead_r(Error *ec, register Vnode *vnp)
{
int writeLocked;
VnodeClass class;
/* 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 */
}
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)
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 */
UpdateList[nUpdatedVolumes++] = V_id(vp);
}
-static void VScanUpdateList() {
+static void VScanUpdateList(void) {
register int i, gap;
register Volume *vp;
Error error;
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,
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);
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;
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;
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);
}
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);
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
return 0;
}
-afs_int32 CopyVolumeHeader(from, to)
- VolumeDiskData *from, *to;
+afs_int32 CopyVolumeHeader(VolumeDiskData *from, VolumeDiskData *to)
{
afs_int32 code;
}
void
-ClearVolumeStats(vol)
- register VolumeDiskData *vol;
+ClearVolumeStats(register VolumeDiskData *vol)
{
VOL_LOCK
ClearVolumeStats_r(vol);
}
void
-ClearVolumeStats_r(vol)
- register VolumeDiskData *vol;
+ClearVolumeStats_r(register VolumeDiskData *vol)
{
memset(vol->weekUse, 0, sizeof(vol->weekUse));
vol->dayUse = 0;
#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;
}
/* 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;
* 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));
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;
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);
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) {