From d79a064148be1cd15ab87986d284583ecd998709 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 16 Mar 2009 13:11:55 +0000 Subject: [PATCH] DEVEL15-vol-prototypes-20090316 LICENSE IPL10 FIXES 124252 prototype the vol directory (cherry picked from commit f28659bd826c2bb7311c84122262000caf33316c) --- src/vol/clone.c | 8 ++--- src/vol/daemon_com.c | 4 +-- src/vol/devname.c | 2 -- src/vol/fssync-debug.c | 53 ++++++++++++++++--------------- src/vol/fssync-server.c | 65 +++++++++++++++++---------------------- src/vol/gi.c | 7 ++--- src/vol/ihandle.c | 8 +++-- src/vol/namei_ops.c | 8 ++--- src/vol/nuke.c | 4 +-- src/vol/partition.c | 8 ++--- src/vol/physio.c | 2 +- src/vol/purge.c | 10 +++++- src/vol/salvager.c | 7 ++++- src/vol/salvsync-server.c | 24 +++++++-------- src/vol/vnode.c | 26 ++++++---------- src/vol/vol-info.c | 9 +++--- src/vol/vol-salvage.c | 8 ++--- src/vol/volinodes.h | 2 -- src/vol/volume.c | 22 ++++++++----- src/vol/volume.h | 7 +++-- 20 files changed, 142 insertions(+), 142 deletions(-) diff --git a/src/vol/clone.c b/src/vol/clone.c index a8d93a01a..8d4936129 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -56,7 +56,7 @@ RCSID /*@printflike@*/ extern void Log(const char *format, ...); -int (*vol_PollProc) () = 0; /* someone must init this */ +int (*vol_PollProc) (void) = 0; /* someone must init this */ #define ERROR_EXIT(code) {error = code; goto error_exit;} @@ -80,8 +80,7 @@ struct clone_head { struct clone_items *last; }; -void CloneVolume(); -void CloneVolume_r(); +void CloneVolume(Error *, Volume *, Volume *, Volume *); static int ci_AddItem(struct clone_head *ah, Inode aino) @@ -124,7 +123,7 @@ ci_InitHead(struct clone_head *ah) /* apply a function to all dudes in the set */ int -ci_Apply(struct clone_head *ah, int (*aproc) (), char *arock) +ci_Apply(struct clone_head *ah, int (*aproc) (Inode, void *), void *arock) { register struct clone_items *ti; register int i; @@ -177,7 +176,6 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone) struct VnodeClassInfo *vcp = &VnodeClassInfo[class]; int ReadWriteOriginal = VolumeWriteable(rwvp); - Device device = rwvp->device; /* Open the RW volume's index file and seek to beginning */ IH_COPY(rwH, rwvp->vnodeIndex[class].handle); diff --git a/src/vol/daemon_com.c b/src/vol/daemon_com.c index 764f23483..a500afac6 100644 --- a/src/vol/daemon_com.c +++ b/src/vol/daemon_com.c @@ -63,7 +63,7 @@ RCSID /*@printflike@*/ extern void Log(const char *format, ...); -int (*V_BreakVolumeCallbacks) (); +int (*V_BreakVolumeCallbacks) (VolumeId); #define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that * move = dump+restore can run on single server */ @@ -211,7 +211,6 @@ SYNC_disconnect(SYNC_client_state * state) afs_int32 SYNC_closeChannel(SYNC_client_state * state) { - afs_int32 code; SYNC_command com; SYNC_response res; SYNC_PROTO_BUF_DECL(ores); @@ -631,7 +630,6 @@ SYNC_putRes(SYNC_server_state_t * state, int SYNC_verifyProtocolString(char * buf, size_t len) { - int ret = 0; size_t s_len; s_len = afs_strnlen(buf, len); diff --git a/src/vol/devname.c b/src/vol/devname.c index c06544a61..f9fce94d7 100644 --- a/src/vol/devname.c +++ b/src/vol/devname.c @@ -96,7 +96,6 @@ vol_DevName(dev_t adev, char *wpath) { static char pbuffer[128]; char pbuf[128], *ptr; - int code, i; #ifdef AFS_SUN5_ENV struct mnttab mnt; FILE *mntfile; @@ -242,7 +241,6 @@ afs_rawname(char *devfile) { static char rawname[100]; struct stat statbuf; - char *p; int code, i; i = strlen(devfile); diff --git a/src/vol/fssync-debug.c b/src/vol/fssync-debug.c index abbc457a3..4a5fe48be 100644 --- a/src/vol/fssync-debug.c +++ b/src/vol/fssync-debug.c @@ -145,8 +145,6 @@ main(int argc, char **argv) { struct cmd_syndesc *ts; int err = 0; - int i; - extern char cml_version_number[]; /* Initialize directory paths */ if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) { @@ -264,7 +262,6 @@ static int common_volop_prolog(struct cmd_syndesc * as, struct state * state) { register struct cmd_item *ti; - char pname[100], *temp; state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state)); assert(state->vop != NULL); @@ -321,6 +318,9 @@ do_volop(struct state * state, afs_int32 command, SYNC_response * res) res->hdr.reason, reason_code_to_string(res->hdr.reason)); VDisconnectFS(); + + return 0; + } @@ -658,7 +658,9 @@ VolQuery(struct cmd_syndesc * as, void * rock) SYNC_PROTO_BUF_DECL(res_buf); SYNC_response res; Volume v; +#ifdef AFS_DEMAND_ATTACH_FS int hi, lo; +#endif res.hdr.response_len = sizeof(res.hdr); res.payload.buf = res_buf; @@ -674,12 +676,12 @@ VolQuery(struct cmd_syndesc * as, void * rock) printf("volume = {\n"); printf("\thashid = %u\n", v.hashid); - printf("\theader = 0x%x\n", v.header); + printf("\theader = %p\n", v.header); printf("\tdevice = %d\n", v.device); - printf("\tpartition = 0x%x\n", v.partition); - printf("\tlinkHandle = 0x%x\n", v.linkHandle); + printf("\tpartition = %p\n", v.partition); + printf("\tlinkHandle = %p\n", v.linkHandle); printf("\tnextVnodeUnique = %u\n", v.nextVnodeUnique); - printf("\tdiskDataHandle = 0x%x\n", v.diskDataHandle); + printf("\tdiskDataHandle = %p\n", v.diskDataHandle); printf("\tvnodeHashOffset = %u\n", v.vnodeHashOffset); printf("\tshuttingDown = %d\n", v.shuttingDown); printf("\tgoingOffline = %d\n", v.goingOffline); @@ -690,14 +692,14 @@ VolQuery(struct cmd_syndesc * as, void * rock) printf("\tupdateTime = %u\n", v.updateTime); printf("\tvnodeIndex[vSmall] = {\n"); - printf("\t\thandle = 0x%x\n", v.vnodeIndex[vSmall].handle); - printf("\t\tbitmap = 0x%x\n", v.vnodeIndex[vSmall].bitmap); + printf("\t\thandle = %p\n", v.vnodeIndex[vSmall].handle); + printf("\t\tbitmap = %p\n", v.vnodeIndex[vSmall].bitmap); printf("\t\tbitmapSize = %u\n", v.vnodeIndex[vSmall].bitmapSize); printf("\t\tbitmapOffset = %u\n", v.vnodeIndex[vSmall].bitmapOffset); printf("\t}\n"); printf("\tvnodeIndex[vLarge] = {\n"); - printf("\t\thandle = 0x%x\n", v.vnodeIndex[vLarge].handle); - printf("\t\tbitmap = 0x%x\n", v.vnodeIndex[vLarge].bitmap); + printf("\t\thandle = %p\n", v.vnodeIndex[vLarge].handle); + printf("\t\tbitmap = %p\n", v.vnodeIndex[vLarge].bitmap); printf("\t\tbitmapSize = %u\n", v.vnodeIndex[vLarge].bitmapSize); printf("\t\tbitmapOffset = %u\n", v.vnodeIndex[vLarge].bitmapOffset); printf("\t}\n"); @@ -766,7 +768,7 @@ VolQuery(struct cmd_syndesc * as, void * rock) printf("\t}\n"); /* volume op state */ - printf("\tpending_vol_op = 0x%x\n", v.pending_vol_op); + printf("\tpending_vol_op = %p\n", v.pending_vol_op); } #else /* !AFS_DEMAND_ATTACH_FS */ if (res.hdr.flags & SYNC_FLAG_DAFS_EXTENSIONS) { @@ -863,7 +865,6 @@ VolOpQuery(struct cmd_syndesc * as, void * rock) SYNC_PROTO_BUF_DECL(res_buf); SYNC_response res; FSSYNC_VolOp_info vop; - int i; res.hdr.response_len = sizeof(res.hdr); res.payload.buf = res_buf; @@ -897,7 +898,7 @@ VolOpQuery(struct cmd_syndesc * as, void * rock) printf("\t\treason = %d (%s)\n", vop.com.reason, reason_code_to_string(vop.com.reason)); printf("\t\tcommand_len = %u\n", vop.com.command_len); - printf("\t\tflags = 0x%x\n", vop.com.flags); + printf("\t\tflags = 0x%lux\n", afs_cast_uint32(vop.com.flags)); printf("\t}\n"); printf("\tvop = {\n"); @@ -920,7 +921,6 @@ static int vn_prolog(struct cmd_syndesc * as, struct state * state) { register struct cmd_item *ti; - char pname[100], *temp; state->vop = (struct volop_state *) calloc(1, sizeof(struct volop_state)); assert(state->vop != NULL); @@ -996,7 +996,6 @@ VnQuery(struct cmd_syndesc * as, void * rock) SYNC_PROTO_BUF_DECL(res_buf); SYNC_response res; Vnode v; - int hi, lo; res.hdr.response_len = sizeof(res.hdr); res.payload.buf = res_buf; @@ -1013,19 +1012,19 @@ VnQuery(struct cmd_syndesc * as, void * rock) printf("vnode = {\n"); printf("\tvid_hash = {\n"); - printf("\t\tnext = 0x%lx\n", v.vid_hash.next); - printf("\t\tprev = 0x%lx\n", v.vid_hash.prev); + printf("\t\tnext = %p\n", v.vid_hash.next); + printf("\t\tprev = %p\n", v.vid_hash.prev); printf("\t}\n"); - printf("\thashNext = 0x%lx\n", v.hashNext); - printf("\tlruNext = 0x%lx\n", v.lruNext); - printf("\tlruPrev = 0x%lx\n", v.lruPrev); + printf("\thashNext = %p\n", v.hashNext); + printf("\tlruNext = %p\n", v.lruNext); + printf("\tlruPrev = %p\n", v.lruPrev); printf("\thashIndex = %hu\n", v.hashIndex); printf("\tchanged_newTime = %u\n", (unsigned int) v.changed_newTime); printf("\tchanged_oldTime = %u\n", (unsigned int) v.changed_oldTime); printf("\tdelete = %u\n", (unsigned int) v.delete); printf("\tvnodeNumber = %u\n", v.vnodeNumber); - printf("\tvolumePtr = 0x%lx\n", v.volumePtr); + printf("\tvolumePtr = %p\n", v.volumePtr); printf("\tnUsers = %u\n", v.nUsers); printf("\tcacheCheck = %u\n", v.cacheCheck); @@ -1049,9 +1048,9 @@ VnQuery(struct cmd_syndesc * as, void * rock) } #endif /* !AFS_DEMAND_ATTACH_FS */ - printf("\twriter = %u\n", v.writer); - printf("\tvcp = 0x%lx\n", v.vcp); - printf("\thandle = 0x%lx\n", v.handle); + printf("\twriter = %u\n", (unsigned int) v.writer); + printf("\tvcp = %p\n", v.vcp); + printf("\thandle = %p\n", v.handle); printf("\tdisk = {\n"); printf("\t\ttype = %u\n", v.disk.type); @@ -1216,7 +1215,9 @@ StatsQuery(struct cmd_syndesc * as, void * rock) static void print_vol_stats_general(VolPkgStats * stats) { +#ifdef AFS_DEMAND_ATTACH_FS int i; +#endif afs_uint32 hi, lo; printf("VolPkgStats = {\n"); @@ -1297,7 +1298,9 @@ print_vol_stats_viceP(struct DiskPartitionStats64 * stats) static void print_vol_stats_hash(struct VolumeHashChainStats * stats) { +#ifdef AFS_DEMAND_ATTACH_FS afs_uint32 hi, lo; +#endif printf("DiskPartitionStats = {\n"); printf("\ttable_size = %d\n", stats->table_size); diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index d5256fd91..7892842b7 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -15,15 +15,6 @@ Institution: The Information Technology Center, Carnegie-Mellon University */ -#ifdef notdef - -/* All this is going away in early 1989 */ -int newVLDB; /* Compatibility flag */ - -#endif -static int newVLDB = 1; - - #ifndef AFS_PTHREAD_ENV #define USUAL_PRIORITY (LWP_MAX_PRIORITY - 2) @@ -104,7 +95,7 @@ RCSID /*@printflike@*/ extern void Log(const char *format, ...); -int (*V_BreakVolumeCallbacks) (); +int (*V_BreakVolumeCallbacks) (VolumeId volume); #define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that * move = dump+restore can run on single server */ @@ -133,16 +124,16 @@ static SYNC_server_state_t fssync_server_state = /* Forward declarations */ static void * FSYNC_sync(void *); -static void FSYNC_newconnection(); -static void FSYNC_com(); -static void FSYNC_Drop(); -static void AcceptOn(); -static void AcceptOff(); -static void InitHandler(); -static int AddHandler(); -static int FindHandler(); -static int FindHandler_r(); -static int RemoveHandler(); +static void FSYNC_newconnection(int afd); +static void FSYNC_com(int fd); +static void FSYNC_Drop(int fd); +static void AcceptOn(void); +static void AcceptOff(void); +static void InitHandler(void); +static int AddHandler(int fd, void (*aproc)(int)); +static int FindHandler(int afd); +static int FindHandler_r(int afd); +static int RemoveHandler(int afd); #if defined(HAVE_POLL) && defined (AFS_PTHREAD_ENV) static void CallHandler(struct pollfd *fds, int nfds, int mask); static void GetHandler(struct pollfd *fds, int maxfds, int events, int *nfds); @@ -154,7 +145,9 @@ extern int LogLevel; static afs_int32 FSYNC_com_VolOp(int fd, SYNC_command * com, SYNC_response * res); +#ifdef AFS_DEMAND_ATTACH_FS static afs_int32 FSYNC_com_VolError(FSSYNC_VolOp_command * com, SYNC_response * res); +#endif static afs_int32 FSYNC_com_VolOn(FSSYNC_VolOp_command * com, SYNC_response * res); static afs_int32 FSYNC_com_VolOff(FSSYNC_VolOp_command * com, SYNC_response * res); static afs_int32 FSYNC_com_VolMove(FSSYNC_VolOp_command * com, SYNC_response * res); @@ -171,11 +164,13 @@ static afs_int32 FSYNC_com_VnQry(int fd, SYNC_command * com, SYNC_response * res static afs_int32 FSYNC_com_StatsOp(int fd, SYNC_command * com, SYNC_response * res); static afs_int32 FSYNC_com_StatsOpGeneral(FSSYNC_StatsOp_command * scom, SYNC_response * res); + +#ifdef AFS_DEMAND_ATTACH_FS static afs_int32 FSYNC_com_StatsOpViceP(FSSYNC_StatsOp_command * scom, SYNC_response * res); static afs_int32 FSYNC_com_StatsOpHash(FSSYNC_StatsOp_command * scom, SYNC_response * res); static afs_int32 FSYNC_com_StatsOpHdr(FSSYNC_StatsOp_command * scom, SYNC_response * res); static afs_int32 FSYNC_com_StatsOpVLRU(FSSYNC_StatsOp_command * scom, SYNC_response * res); - +#endif static void FSYNC_com_to_info(FSSYNC_VolOp_command * vcom, FSSYNC_VolOp_info * info); @@ -221,13 +216,8 @@ static fd_set FSYNC_readfds; static void * FSYNC_sync(void * args) { -#ifdef USE_UNIX_SOCKETS - char tbuffer[AFSDIR_PATH_MAX]; -#endif /* USE_UNIX_SOCKETS */ - int on = 1; extern int VInit; int code; - int numTries; #ifdef AFS_PTHREAD_ENV int tid; #endif @@ -304,6 +294,7 @@ FSYNC_sync(void * args) CallHandler(&FSYNC_readfds); #endif } + return NULL; /* hush now, little gcc */ } static void @@ -314,7 +305,8 @@ FSYNC_newconnection(int afd) #else /* USE_UNIX_SOCKETS */ struct sockaddr_in other; #endif - int junk, fd; + int fd; + socklen_t junk; junk = sizeof(other); fd = accept(afd, (struct sockaddr *)&other, &junk); if (fd == -1) { @@ -585,7 +577,7 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res) } #else /* !AFS_DEMAND_ATTACH_FS */ tvolName[0] = '/'; - snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, vcom->vop->volume); + snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, afs_cast_uint32(vcom->vop->volume)); tvolName[sizeof(tvolName)-1] = '\0'; vp = VAttachVolumeByName_r(&error, vcom->vop->partName, tvolName, @@ -631,10 +623,11 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res) FSSYNC_VolOp_info info; afs_int32 code = SYNC_OK; int i; - Volume * vp, * nvp; + Volume * vp; Error error; #ifdef AFS_DEMAND_ATTACH_FS int reserved = 0; + Volume *nvp; #endif if (SYNC_verifyProtocolString(vcom->vop->partName, sizeof(vcom->vop->partName))) { @@ -1168,7 +1161,6 @@ FSYNC_com_VolHdrQuery(FSSYNC_VolOp_command * vcom, SYNC_response * res) afs_int32 code = SYNC_FAILED; Error error; Volume * vp; - int hdr_ok = 0; if (SYNC_verifyProtocolString(vcom->vop->partName, sizeof(vcom->vop->partName))) { res->hdr.reason = SYNC_REASON_MALFORMED_PACKET; @@ -1209,7 +1201,6 @@ FSYNC_com_VolHdrQuery(FSSYNC_VolOp_command * vcom, SYNC_response * res) goto done; } - load_done: memcpy(res->payload.buf, &V_disk(vp), sizeof(VolumeDiskData)); res->hdr.response_len += sizeof(VolumeDiskData); #ifndef AFS_DEMAND_ATTACH_FS @@ -1495,7 +1486,7 @@ FSYNC_Drop(int fd) Volume *vp; tvolName[0] = '/'; - sprintf(&tvolName[1], VFORMAT, p[i].volumeID); + sprintf(&tvolName[1], VFORMAT, afs_cast_uint32(p[i].volumeID)); vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName, V_VOLUPD); if (vp) @@ -1516,7 +1507,7 @@ FSYNC_Drop(int fd) static int AcceptHandler = -1; /* handler id for accept, if turned on */ static void -AcceptOn() +AcceptOn(void) { if (AcceptHandler == -1) { assert(AddHandler(fssync_server_state.fd, FSYNC_newconnection)); @@ -1525,7 +1516,7 @@ AcceptOn() } static void -AcceptOff() +AcceptOff(void) { if (AcceptHandler != -1) { assert(RemoveHandler(fssync_server_state.fd)); @@ -1536,10 +1527,10 @@ AcceptOff() /* The multiple FD handling code. */ static int HandlerFD[MAXHANDLERS]; -static int (*HandlerProc[MAXHANDLERS]) (); +static void (*HandlerProc[MAXHANDLERS]) (int); static void -InitHandler() +InitHandler(void) { register int i; ObtainWriteLock(&FSYNC_handler_lock); @@ -1585,7 +1576,7 @@ CallHandler(fd_set * fdsetp) #endif static int -AddHandler(int afd, int (*aproc) ()) +AddHandler(int afd, void (*aproc) (int)) { register int i; ObtainWriteLock(&FSYNC_handler_lock); diff --git a/src/vol/gi.c b/src/vol/gi.c index c9f5f9a4b..d59da4e58 100644 --- a/src/vol/gi.c +++ b/src/vol/gi.c @@ -33,14 +33,13 @@ Perror(char *err, int a1, int a2, int a3) int main(int argc, char **argv) { - int error = 0; - struct stat status; - int dev, fd, inode; - #if defined(AFS_NT40_ENV) || defined(AFS_NAMEI_ENV) fprintf(stderr, "gi not supported on NT or NAMEI systems.\n"); exit(1); #else + int error = 0; + struct stat status; + int dev, fd, inode; argc--; argv++; diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index 04c4b0b66..743ddb80d 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -93,6 +93,7 @@ int fdInUseCount = 0; /* Hash table for inode handles */ IHashBucket_t ihashTable[I_HANDLE_HASH_SIZE]; +void *ih_sync_thread(void *); #ifdef AFS_PTHREAD_ENV /* Initialize the global ihandle mutex */ @@ -151,7 +152,6 @@ ih_Initialize(void) fdCacheSize = MIN(fdMaxCacheSize, FD_DEFAULT_CACHESIZE); { - void *ih_sync_thread(); #ifdef AFS_PTHREAD_ENV pthread_t syncer; pthread_attr_t tattr; @@ -865,7 +865,8 @@ ih_condsync(IHandle_t * ihP) } void -ih_sync_all() { +ih_sync_all(void) { + int ihash; IH_LOCK; @@ -910,7 +911,7 @@ ih_sync_all() { } void * -ih_sync_thread() { +ih_sync_thread(void *dummy) { while(1) { #ifdef AFS_PTHREAD_ENV @@ -924,6 +925,7 @@ ih_sync_thread() { #endif ih_sync_all(); } + return NULL; } diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index ec542582e..b7145ccc2 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1492,10 +1492,7 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, int volid) */ static afs_int32 -convertVolumeInfo(fdr, fdw, vid) - int fdr; - int fdw; - afs_uint32 vid; +convertVolumeInfo(int fdr, int fdw, afs_uint32 vid) { struct VolumeDiskData vd; char *p; @@ -1561,7 +1558,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_int32 volumeId) char smallSeen = 0; char largeSeen = 0; char linkSeen = 0; - int code, fd, fd2, found; + int code, fd, fd2; char *p; DIR *dirp; Inode ino; @@ -1569,7 +1566,6 @@ namei_ConvertROtoRWvolume(char *pname, afs_int32 volumeId) struct DiskPartition64 *partP; struct ViceInodeInfo info; struct VolumeDiskHeader h; - char volname[20]; char headername[16]; afs_int32 error = 0; diff --git a/src/vol/nuke.c b/src/vol/nuke.c index 8c6ff93b9..45d8e6f21 100644 --- a/src/vol/nuke.c +++ b/src/vol/nuke.c @@ -29,7 +29,8 @@ RCSID #else #include #endif - +#include + #include #include "nfs.h" #include "lwp.h" @@ -54,7 +55,6 @@ RCSID struct Lock localLock; -char *vol_DevName(); #define MAXATONCE 100 /* structure containing neatly packed set of inodes and the # of times we'll have diff --git a/src/vol/partition.c b/src/vol/partition.c index 6db056e26..bf4fdff05 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -350,7 +350,7 @@ VCheckPartition(char *part, char *devname) dirp = opendir(part); assert(dirp); - while (dp = readdir(dirp)) { + while ((dp = readdir(dirp))) { if (dp->d_name[0] == 'V') { Log("This program is compiled with AFS_NAMEI_ENV, but partition %s seems to contain volumes which don't use the namei-interface; aborting\n", part); closedir(dirp); @@ -417,7 +417,7 @@ VIsAlwaysAttach(char *part) * partitions, in the NAMEI fileserver. */ void -VAttachPartitions2() +VAttachPartitions2(void) { #ifdef AFS_NAMEI_ENV DIR *dirp; @@ -628,7 +628,7 @@ VAttachPartitions(void) exit(-1); } - while (fsent = getfsent()) { + while ((fsent = getfsent())) { if (strcmp(fsent->fs_type, "rw") != 0) continue; @@ -901,7 +901,7 @@ VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp) void VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp) { - int fd, bsize, code; + int bsize, code; afs_int64 totalblks, free, used, availblks; int reserved; #ifdef afs_statvfs diff --git a/src/vol/physio.c b/src/vol/physio.c index c463a4e7d..086b56b15 100644 --- a/src/vol/physio.c +++ b/src/vol/physio.c @@ -115,7 +115,7 @@ void SetSalvageDirHandle(DirHandle * dir, afs_int32 volume, Device device, Inode inode) { - static SalvageCacheCheck = 1; + static int SalvageCacheCheck = 1; memset(dir, 0, sizeof(DirHandle)); dir->dirh_device = device; diff --git a/src/vol/purge.c b/src/vol/purge.c index 8c6c6303d..352e2d92d 100644 --- a/src/vol/purge.c +++ b/src/vol/purge.c @@ -31,6 +31,7 @@ RCSID #include #include #include +#include #include #include "afs/afsint.h" @@ -52,10 +53,13 @@ RCSID /* forward declarations */ static int ObliterateRegion(Volume * avp, VnodeClass aclass, StreamHandle_t * afile, afs_int32 * aoffset); +#if 0 static void PurgeIndex(Volume * vp, VnodeClass class); +static void PurgeHeader(Volume * vp); +#endif + static void PurgeIndex_r(Volume * vp, VnodeClass class); static void PurgeHeader_r(Volume * vp); -static void PurgeHeader(Volume * vp); /* No lock needed. Only the volserver will call this, and only one transaction * can have a given volume (volid/partition pair) in use at a time @@ -159,6 +163,7 @@ ObliterateRegion(Volume * avp, VnodeClass aclass, StreamHandle_t * afile, return -1; } +#if 0 static void PurgeIndex(Volume * vp, VnodeClass class) { @@ -166,6 +171,7 @@ PurgeIndex(Volume * vp, VnodeClass class) PurgeIndex_r(vp, class); VOL_UNLOCK; } +#endif static void PurgeIndex_r(Volume * vp, VnodeClass class) @@ -197,6 +203,7 @@ PurgeIndex_r(Volume * vp, VnodeClass class) FDH_CLOSE(fdP); } +#if 0 static void PurgeHeader(Volume * vp) { @@ -204,6 +211,7 @@ PurgeHeader(Volume * vp) PurgeHeader_r(vp); VOL_UNLOCK; } +#endif static void PurgeHeader_r(Volume * vp) diff --git a/src/vol/salvager.c b/src/vol/salvager.c index 3cd862d2b..04930aaa4 100644 --- a/src/vol/salvager.c +++ b/src/vol/salvager.c @@ -141,7 +141,12 @@ handleit(struct cmd_syndesc *as, void *arock) { register struct cmd_item *ti; char pname[100], *temp; - afs_int32 seenpart = 0, seenvol = 0, vid = 0, seenany = 0; + afs_int32 seenpart = 0, seenvol = 0, vid = 0; + +#ifdef FAST_RESTART + afs_int32 seenany = 0; +#endif + struct DiskPartition64 *partP; #ifdef AFS_SGI_VNODE_GLUE diff --git a/src/vol/salvsync-server.c b/src/vol/salvsync-server.c index 7b0a3bd63..59ef63d02 100644 --- a/src/vol/salvsync-server.c +++ b/src/vol/salvsync-server.c @@ -77,6 +77,18 @@ RCSID #define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that * move = dump+restore can run on single server */ + +/* + * This lock controls access to the handler array. + */ +struct Lock SALVSYNC_handler_lock; + + +#ifdef AFS_DEMAND_ATTACH_FS +/* + * SALVSYNC is a feature specific to the demand attach fileserver + */ + /* Forward declarations */ static void * SALVSYNC_syncThread(void *); static void SALVSYNC_newconnection(int fd); @@ -92,18 +104,6 @@ static int FindHandler_r(register int afd); static int RemoveHandler(register int afd); static void GetHandler(fd_set * fdsetp, int *maxfdp); - -/* - * This lock controls access to the handler array. - */ -struct Lock SALVSYNC_handler_lock; - - -#ifdef AFS_DEMAND_ATTACH_FS -/* - * SALVSYNC is a feature specific to the demand attach fileserver - */ - static int AllocNode(struct SalvageQueueNode ** node); static int AddToSalvageQueue(struct SalvageQueueNode * node); diff --git a/src/vol/vnode.c b/src/vol/vnode.c index 8f0ab80a3..9c1677bb2 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -25,6 +25,7 @@ RCSID #include #include #include +#include #ifdef AFS_PTHREAD_ENV #include #else /* AFS_PTHREAD_ENV */ @@ -72,8 +73,7 @@ RCSID struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES]; -private void StickOnLruChain_r(register Vnode * vnp, - register struct VnodeClassInfo *vcp); +void VNLog(afs_int32 aop, afs_int32 anparms, ... ); extern int LogLevel; @@ -109,17 +109,13 @@ extern int LogLevel; static afs_int32 theLog[THELOGSIZE]; static afs_int32 vnLogPtr = 0; void -VNLog(afs_int32 aop, afs_int32 anparms, afs_int32 av1, afs_int32 av2, - afs_int32 av3, afs_int32 av4) +VNLog(afs_int32 aop, afs_int32 anparms, ... ) { register afs_int32 temp; - afs_int32 data[4]; + va_list ap; + + va_start(ap, anparms); - /* copy data to array */ - data[0] = av1; - data[1] = av2; - data[2] = av3; - data[3] = av4; if (anparms > 4) anparms = 4; /* do bounds checking */ @@ -128,10 +124,11 @@ VNLog(afs_int32 aop, afs_int32 anparms, afs_int32 av1, afs_int32 av2, if (vnLogPtr >= THELOGSIZE) vnLogPtr = 0; for (temp = 0; temp < anparms; temp++) { - theLog[vnLogPtr++] = data[temp]; + theLog[vnLogPtr++] = va_arg(ap, afs_int32); if (vnLogPtr >= THELOGSIZE) vnLogPtr = 0; } + va_end(ap); } /* VolumeHashOffset -- returns a new value to be stored in the @@ -592,7 +589,7 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type) { register Vnode *vnp; VnodeId vnodeNumber; - int bitNumber, code; + int bitNumber; register struct VnodeClassInfo *vcp; VnodeClass class; Unique unique; @@ -1114,10 +1111,8 @@ 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 code; VnodeClass class; struct VnodeClassInfo *vcp; - Volume * oldvp = NULL; *ec = 0; @@ -1317,7 +1312,6 @@ VPutVnode_r(Error * ec, register Vnode * vnp) int writeLocked; VnodeClass class; struct VnodeClassInfo *vcp; - int code; *ec = 0; assert(Vn_refcount(vnp) != 0); @@ -1453,7 +1447,6 @@ VVnodeWriteToRead_r(Error * ec, register Vnode * vnp) int writeLocked; VnodeClass class; struct VnodeClassInfo *vcp; - int code; #ifdef AFS_PTHREAD_ENV pthread_t thisProcess; #else /* AFS_PTHREAD_ENV */ @@ -1515,7 +1508,6 @@ VVnodeWriteToRead_r(Error * ec, register Vnode * vnp) } else { VnStore(ec, vp, vnp, vcp, class); } - sane: vcp->writes++; vnp->changed_newTime = vnp->changed_oldTime = 0; } diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index a00f3701b..28374a691 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -50,7 +50,8 @@ RCSID #include "viceinode.h" #include "volinodes.h" #include - +#include + #ifdef _AIX #include #endif @@ -106,7 +107,7 @@ date(time_t date) { #define MAX_DATE_RESULT 100 static char results[8][MAX_DATE_RESULT]; - static next; + static int next; struct tm *tm = localtime(&date); char buf[32]; @@ -334,7 +335,7 @@ handleit(struct cmd_syndesc *as, void *arock) #ifdef AFS_NT40_ENV #include struct DiskPartition64 * -FindCurrentPartition() +FindCurrentPartition(void) { int dr = _getdrive(); struct DiskPartition64 *dp; @@ -351,7 +352,7 @@ FindCurrentPartition() } #else struct DiskPartition64 * -FindCurrentPartition() +FindCurrentPartition(void) { char partName[1024]; char tmp = '\0'; diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index b5942aa9c..4570a66d3 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -880,6 +880,7 @@ DeleteExtraVolumeHeaderFile(register struct VolumeSummary *vsp) vsp->fileName = 0; } +int CompareInodes(const void *_p1, const void *_p2) { register const struct ViceInodeInfo *p1 = _p1; @@ -982,7 +983,7 @@ CountVolumeInodes(register struct ViceInodeInfo *ip, int maxInodes, { int volume = ip->u.vnode.volumeId; int rwvolume = volume; - register n, nSpecial; + register int n, nSpecial; register Unique maxunique; n = nSpecial = 0; maxunique = 0; @@ -3299,7 +3300,7 @@ PrintInodeList(void) register struct ViceInodeInfo *ip; struct ViceInodeInfo *buf; struct afs_stat status; - register nInodes; + register int nInodes; assert(afs_fstat(inodeFd, &status) == 0); buf = (struct ViceInodeInfo *)malloc(status.st_size); @@ -3364,8 +3365,7 @@ Fork(void) } void -Exit(code) - int code; +Exit(int code) { if (ShowLog) showlog(); diff --git a/src/vol/volinodes.h b/src/vol/volinodes.h index 37b00fef6..1255e1763 100644 --- a/src/vol/volinodes.h +++ b/src/vol/volinodes.h @@ -58,6 +58,4 @@ LINKTABLEMAGIC, LINKTABLEVERSION}, VI_LINKTABLE, we require the table to be ordered */ #define MAXINODETYPE VI_LINKTABLE -Volume *VWaitAttachVolume(); - #endif /* __volinodes_h_ */ diff --git a/src/vol/volume.c b/src/vol/volume.c index d94c5fde4..06b62eded 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -191,7 +191,9 @@ static void ReleaseVolumeHeader(register struct volHeader *hd); static void FreeVolumeHeader(register Volume * vp); static void AddVolumeToHashTable(register Volume * vp, int hashid); static void DeleteVolumeFromHashTable(register Volume * vp); +#if 0 static int VHold(Volume * vp); +#endif static int VHold_r(Volume * vp); static void VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class); static void VReleaseVolumeHandles_r(Volume * vp); @@ -200,7 +202,9 @@ static void LoadVolumeHeader(Error * ec, Volume * vp); static int VCheckOffline(register Volume * vp); static int VCheckDetach(register Volume * vp); static Volume * GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, int flags); +#if 0 static int VolumeExternalName_r(VolumeId volumeId, char * name, size_t len); +#endif int LogLevel; /* Vice loglevel--not defined as extern so that it will be * defined when not linked with vice, XXXX */ @@ -575,8 +579,6 @@ VInitVolumePackage(ProgramType pt, afs_uint32 nLargeVnodes, afs_uint32 nSmallVno assert(pthread_cond_destroy(¶ms.thread_done_cv) == 0); #else /* AFS_PTHREAD_ENV */ - DIR *dirp; - struct dirent *dp; /* Attach all the volumes in this partition */ for (diskP = DiskPartitionList; diskP; diskP = diskP->next) { @@ -1754,7 +1756,7 @@ VAttachVolumeByName(Error * ec, char *partition, char *name, int mode) Volume * VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) { - register Volume *vp = NULL, *svp = NULL; + register Volume *vp = NULL; int fd, n; struct afs_stat status; struct VolumeDiskHeader diskHeader; @@ -1765,6 +1767,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) VolId volumeId; #ifdef AFS_DEMAND_ATTACH_FS VolumeStats stats_save; + Volume *svp = NULL; #endif /* AFS_DEMAND_ATTACH_FS */ *ec = 0; @@ -2320,9 +2323,8 @@ attach2(Error * ec, VolId volumeId, char *path, register struct VolumeHeader * h Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%u\n", path, *ec); } - disk_header_loaded: - #ifdef AFS_DEMAND_ATTACH_FS + disk_header_loaded: if (!*ec) { /* check for pending volume operations */ @@ -2615,6 +2617,7 @@ VHold_r(register Volume * vp) } #endif /* AFS_DEMAND_ATTACH_FS */ +#if 0 static int VHold(register Volume * vp) { @@ -2624,6 +2627,7 @@ VHold(register Volume * vp) VOL_UNLOCK; return retVal; } +#endif /***************************************************/ @@ -3638,7 +3642,6 @@ VCheckDetach(register Volume * vp) static int VCheckOffline(register Volume * vp) { - Volume * rvp = NULL; int ret = 0; if (vp->goingOffline && !vp->nUsers) { @@ -4962,11 +4965,13 @@ VolumeExternalName(VolumeId volumeId) * * @internal volume package internal use only. */ +#ifdef AFS_DEMAND_ATTACH_FS static int VolumeExternalName_r(VolumeId volumeId, char * name, size_t len) { return afs_snprintf(name, len, VFORMAT, volumeId); } +#endif /***************************************************/ @@ -6729,7 +6734,10 @@ Volume * VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint) { register int looks = 0; - Volume * vp, *np, *pp; + Volume * vp, *np; +#ifdef AFS_DEMAND_ATTACH_FS + Volume *pp; +#endif VolumeHashChainHead * head; *ec = 0; diff --git a/src/vol/volume.h b/src/vol/volume.h index 079d9a259..51824d31f 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -128,8 +128,9 @@ extern ProgramType programType; /* The type of program using the package */ /* Some initialization parameters for the volume package */ /* Add new initialization parameters here */ -extern int (*V_BreakVolumeCallbacks) (); -extern int (*vol_PollProc) (); +extern int (*V_BreakVolumeCallbacks) (VolumeId); +extern int (*vol_PollProc) (void); + #define DOPOLL ((vol_PollProc)? (*vol_PollProc)() : 0) #ifdef AFS_DEMAND_ATTACH_FS @@ -787,6 +788,8 @@ extern void VTakeOffline(register Volume * vp); extern Volume * VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint); extern void VGetVolumePath(Error * ec, VolId volumeId, char **partitionp, char **namep); +extern char *vol_DevName(dev_t adev, char *wpath); + #ifdef AFS_DEMAND_ATTACH_FS extern Volume *VPreAttachVolumeByName(Error * ec, char *partition, char *name); extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name); -- 2.39.5