From df3dbd15787b2523681a3ff8a5c2a2ba22155314 Mon Sep 17 00:00:00 2001 From: "R. Lindsay Todd" Date: Mon, 2 Jun 2003 15:35:59 +0000 Subject: [PATCH] splint-fileserver-volserver-cleanup-20030602 FIXES 1493 add "make splint" target for viced, vol, volser and clean up for splint --- src/viced/Makefile.in | 7 + src/viced/afsfileprocs.c | 61 ++++--- src/viced/callback.c | 22 +-- src/viced/host.c | 6 +- src/viced/viced.c | 2 +- src/vol/Makefile.in | 8 + src/vol/clone.c | 2 +- src/vol/fssync.c | 10 +- src/vol/ihandle.c | 10 +- src/vol/namei_ops.c | 4 +- src/vol/physio.c | 2 +- src/vol/vnode.c | 14 +- src/vol/vnode.h | 4 +- src/vol/vol-info.c | 6 +- src/vol/vol-salvage.c | 34 ++-- src/vol/volume.c | 36 ++--- src/vol/volume.h | 18 ++- src/vol/vutil.c | 2 +- src/volser/Makefile.in | 7 + src/volser/lockprocs.c | 6 +- src/volser/volprocs.c | 7 +- src/volser/vos.c | 183 ++++++++++++--------- src/volser/vsprocs.c | 335 +++++++++++++++++++++++++-------------- src/volser/vsutils.c | 4 +- 24 files changed, 481 insertions(+), 309 deletions(-) diff --git a/src/viced/Makefile.in b/src/viced/Makefile.in index a1ad4a860..1fb303d02 100644 --- a/src/viced/Makefile.in +++ b/src/viced/Makefile.in @@ -122,3 +122,10 @@ ${TOP_INCDIR}/afs/fs_stats.h: fs_stats.h dest: ${DEST}/root.server/usr/afs/bin/fileserver ${DEST}/include/afs/fs_stats.h +splint:: + splint $(CFLAGS) \ + viced.c \ + afsfileprocs.c \ + host.c \ + physio.c \ + callback.c diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index c77716110..da10a258e 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -2227,7 +2227,8 @@ afs_int32 common_FetchData64 (struct rx_call *acall, Bad_FetchData: /* Update and store volume/vnode and parent vnodes back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); ViceLog(2, ("SRXAFS_FetchData returns %d\n", errorCode)); errorCode = CallPostamble(tcon, errorCode); @@ -2379,7 +2380,8 @@ afs_int32 SRXAFS_FetchACL (struct rx_call *acall, Bad_FetchACL: /* Update and store volume/vnode and parent vnodes back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); ViceLog(2, ("SAFS_FetchACL returns %d (ACL=%s)\n", errorCode, AccessList->AFSOpaque_val)); errorCode = CallPostamble(tcon, errorCode); @@ -2475,7 +2477,8 @@ afs_int32 SAFSS_FetchStatus (struct rx_call *acall, Bad_FetchStatus: /* Update and store volume/vnode and parent vnodes back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); ViceLog(2, ("SAFS_FetchStatus returns %d\n", errorCode)); return errorCode; @@ -2587,7 +2590,8 @@ afs_int32 SRXAFS_BulkStatus(struct rx_call *acall, } /* put back the file ID and volume */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0, + volptr); parentwhentargetnotdir = (Vnode *) 0; targetptr = (Vnode *) 0; volptr = (Volume *) 0; @@ -2595,7 +2599,8 @@ afs_int32 SRXAFS_BulkStatus(struct rx_call *acall, Bad_BulkStatus: /* Update and store volume/vnode and parent vnodes back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); errorCode = CallPostamble(tcon, errorCode); #if FS_STATS_DETAILED @@ -2718,7 +2723,7 @@ afs_int32 SRXAFS_InlineBulkStatus(struct rx_call *acall, CHK_FETCHSTATUS, 0))) { tstatus = &OutStats->AFSBulkStats_val[i]; tstatus->errorCode = errorCode; - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0, volptr); parentwhentargetnotdir = (Vnode *) 0; targetptr = (Vnode *) 0; volptr = (Volume *) 0; @@ -2743,7 +2748,7 @@ afs_int32 SRXAFS_InlineBulkStatus(struct rx_call *acall, } /* put back the file ID and volume */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0, volptr); parentwhentargetnotdir = (Vnode *) 0; targetptr = (Vnode *) 0; volptr = (Volume *) 0; @@ -2751,7 +2756,7 @@ afs_int32 SRXAFS_InlineBulkStatus(struct rx_call *acall, Bad_InlineBulkStatus: /* Update and store volume/vnode and parent vnodes back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); errorCode = CallPostamble(tcon, errorCode); #if FS_STATS_DETAILED @@ -3042,7 +3047,8 @@ afs_int32 common_StoreData64 (struct rx_call *acall, Bad_StoreData: /* Update and store volume/vnode and parent vnodes back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); ViceLog(2, ("SAFS_StoreData returns %d\n", errorCode)); errorCode = CallPostamble(tcon, errorCode); @@ -3626,7 +3632,8 @@ SAFSS_CreateFile (struct rx_call *acall, Bad_CreateFile: /* Update and store volume/vnode and parent vnodes back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, + volptr); FidZap(&dir); ViceLog(2, ("SAFS_CreateFile returns %d\n", errorCode)); return errorCode; @@ -4093,8 +4100,9 @@ Bad_Rename: VPutVnode(&fileCode, newfileptr); assert(fileCode == 0); } - PutVolumePackage(fileptr, (newvptr && newvptr != oldvptr? newvptr : 0), - oldvptr, volptr); + (void) PutVolumePackage(fileptr, + (newvptr && newvptr != oldvptr? newvptr : 0), + oldvptr, volptr); FidZap(&olddir); FidZap(&newdir); FidZap(&filedir); @@ -4293,7 +4301,8 @@ SAFSS_Symlink (struct rx_call *acall, Bad_SymLink: /* Write the all modified vnodes (parent, new files) and volume back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, + volptr); FidZap(&dir); ViceLog(2, ("SAFS_Symlink returns %d\n", errorCode)); return errorCode; @@ -4496,7 +4505,8 @@ SAFSS_Link (struct rx_call *acall, Bad_Link: /* Write the all modified vnodes (parent, new files) and volume back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, + volptr); FidZap(&dir); ViceLog(2, ("SAFS_Link returns %d\n", errorCode)); return errorCode; @@ -4691,7 +4701,8 @@ SAFSS_MakeDir (struct rx_call *acall, Bad_MakeDir: /* Write the all modified vnodes (parent, new files) and volume back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, + volptr); FidZap(&dir); FidZap(&parentdir); ViceLog(2, ("SAFS_MakeDir returns %d\n", errorCode)); @@ -4853,7 +4864,8 @@ SAFSS_RemoveDir (struct rx_call *acall, Bad_RemoveDir: /* Write the all modified vnodes (parent, new files) and volume back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, + volptr); FidZap(&dir); ViceLog(2, ("SAFS_RemoveDir returns %d\n", errorCode)); return errorCode; @@ -4972,7 +4984,8 @@ SAFSS_SetLock (struct rx_call *acall, Bad_SetLock: /* Write the all modified vnodes (parent, new files) and volume back */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); if ((errorCode == VREADONLY) && (type == LockRead)) errorCode = 0; /* allow read locks on RO volumes without saving state */ @@ -5096,7 +5109,8 @@ SAFSS_ExtendLock (struct rx_call *acall, Bad_ExtendLock: /* Put back file's vnode and volume */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); if ((errorCode == VREADONLY)) /* presumably, we already granted this lock */ errorCode = 0; /* under our generous policy re RO vols */ @@ -5228,7 +5242,8 @@ SAFSS_ReleaseLock (struct rx_call *acall, Bad_ReleaseLock: /* Put back file's vnode and volume */ - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); if ((errorCode == VREADONLY)) /* presumably, we already granted this lock */ errorCode = 0; /* under our generous policy re RO vols */ @@ -6260,10 +6275,12 @@ afs_int32 SRXAFS_GetVolumeStatus(struct rx_call *acall, errorCode = EACCES; goto Bad_GetVolumeStatus; } - RXGetVolumeStatus(FetchVolStatus, Name, OfflineMsg, Motd, volptr); + (void) RXGetVolumeStatus(FetchVolStatus, Name, OfflineMsg, Motd, + volptr); Bad_GetVolumeStatus: - PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr); + (void) PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, + volptr); ViceLog(2,("SAFS_GetVolumeStatus returns %d\n",errorCode)); /* next is to guarantee out strings exist for stub */ if (*Name == 0) {*Name = (char *) malloc(1); **Name = 0;} @@ -6671,7 +6688,7 @@ FetchData_RXStyle(Volume *volptr, } if (Pos + Len > tlen) Len = tlen - Pos; /* get length we should send */ - FDH_SEEK(fdP, Pos, 0); + (void) FDH_SEEK(fdP, Pos, 0); tlen = htonl(Len); if (Int64Mode) { afs_int32 zero = 0; diff --git a/src/viced/callback.c b/src/viced/callback.c index 086a5b292..8b5b2f844 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -1639,19 +1639,19 @@ int DumpCallBackState(void) ViceLog(0, ("Couldn't create callback dump file %s\n", AFSDIR_SERVER_CBKDUMP_FILEPATH)); return 0; } - write(fd, &magic, sizeof(magic)); - write(fd, &now, sizeof(now)); - write(fd, &cbstuff, sizeof(cbstuff)); - write(fd, TimeOuts, sizeof(TimeOuts)); - write(fd, timeout, sizeof(timeout)); - write(fd, &tfirst, sizeof(tfirst)); + (void) write(fd, &magic, sizeof(magic)); + (void) write(fd, &now, sizeof(now)); + (void) write(fd, &cbstuff, sizeof(cbstuff)); + (void) write(fd, TimeOuts, sizeof(TimeOuts)); + (void) write(fd, timeout, sizeof(timeout)); + (void) write(fd, &tfirst, sizeof(tfirst)); freelisthead = cbtoi((struct CallBack *) CBfree); - write(fd, &freelisthead, sizeof(freelisthead)); /* This is a pointer */ + (void) write(fd, &freelisthead, sizeof(freelisthead)); /* This is a pointer */ freelisthead = fetoi((struct FileEntry *) FEfree); - write(fd, &freelisthead, sizeof(freelisthead)); /* This is a pointer */ - write(fd, HashTable, sizeof(HashTable)); - write(fd, &CB[1], sizeof(CB[1])*cbstuff.nblks); /* CB stuff */ - write(fd, &FE[1], sizeof(FE[1])*cbstuff.nblks); /* FE stuff */ + (void) write(fd, &freelisthead, sizeof(freelisthead)); /* This is a pointer */ + (void) write(fd, HashTable, sizeof(HashTable)); + (void) write(fd, &CB[1], sizeof(CB[1])*cbstuff.nblks); /* CB stuff */ + (void) write(fd, &FE[1], sizeof(FE[1])*cbstuff.nblks); /* FE stuff */ close(fd); return 0; diff --git a/src/viced/host.c b/src/viced/host.c index 6ac7fffec..372ac9f95 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -2000,7 +2000,7 @@ int CheckHost(register struct host *host, int held) if ( code ) { char hoststr[16]; - afs_inet_ntoa_r(host->host, hoststr); + (void) afs_inet_ntoa_r(host->host, hoststr); ViceLog(0, ("CB: RCallBackConnectBack (host.c) failed for host %s:%d\n", hoststr, ntohs(host->port))); @@ -2024,7 +2024,7 @@ int CheckHost(register struct host *host, int held) if(code) { if ( MultiProbeAlternateAddress_r(host) ) { char hoststr[16]; - afs_inet_ntoa_r(host->host, hoststr); + (void) afs_inet_ntoa_r(host->host, hoststr); ViceLog(0, ("ProbeUuid failed for host %s:%d\n", hoststr, ntohs(host->port))); @@ -2037,7 +2037,7 @@ int CheckHost(register struct host *host, int held) H_LOCK if (code) { char hoststr[16]; - afs_inet_ntoa_r(host->host, hoststr); + (void) afs_inet_ntoa_r(host->host, hoststr); ViceLog(0, ("Probe failed for host %s:%d\n", hoststr, ntohs(host->port))); host->hostFlags |= VENUSDOWN; diff --git a/src/viced/viced.c b/src/viced/viced.c index 7eb51d227..34c13bd43 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -328,7 +328,7 @@ CheckAdminName() strcpy(adminName, "System:Administrators"); /* use the default name */ } else { - read(fd, adminName, status.st_size); /* use name from the file */ + (void)read(fd, adminName, status.st_size); /* use name from the file */ } if (fd) close(fd); /* close fd if it was opened */ diff --git a/src/vol/Makefile.in b/src/vol/Makefile.in index 68aa77538..74f0a6de7 100644 --- a/src/vol/Makefile.in +++ b/src/vol/Makefile.in @@ -280,3 +280,11 @@ dest: \ ${DEST}/include/afs/ihandle.h \ ${DEST}/include/afs/namei_ops.h +splint:: + for FILE in \ + vnode.c volume.c vutil.c partition.c fssync.c purge.c \ + clone.c nuke.c devname.c listinodes.c common.c ihandle.c \ + namei_ops.c \ + physio.c vol-salvage.c vol-info.c ; do \ + splint $(CFLAGS) $$FILE ; \ + done diff --git a/src/vol/clone.c b/src/vol/clone.c index ca9810313..6e9a38514 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -68,7 +68,7 @@ int (*vol_PollProc)() = 0; /* someone must init this */ */ struct clone_rock { IHandle_t *h; - afs_int32 vol; + VolId vol; }; #define CLONE_MAXITEMS 100 diff --git a/src/vol/fssync.c b/src/vol/fssync.c index 3dfd14280..ef447c994 100644 --- a/src/vol/fssync.c +++ b/src/vol/fssync.c @@ -147,8 +147,8 @@ int FSYNC_clientInit(void) { struct sockaddr_in addr; /* I can't believe the following is needed for localhost connections!! */ - static backoff[] = {3,3,3,5,5,5,7,15,16,24,32,40,48,0}; - int *timeout = &backoff[0]; + static time_t backoff[] = {3,3,3,5,5,5,7,15,16,24,32,40,48,0}; + time_t *timeout = &backoff[0]; for (;;) { FS_sd = getport(&addr); @@ -221,7 +221,7 @@ int FSYNC_askfs(VolumeId volume, char *partName, int com, int reason) } #endif if (response == 0) { - printf("FSYNC_askfs: negative response from file server; volume %u, command %d\n", command.volume, command.command); + printf("FSYNC_askfs: negative response from file server; volume %u, command %d\n", command.volume, (int) command.command); } return response; @@ -561,9 +561,9 @@ defect #2080 for details. VOL_UNLOCK VATTACH_UNLOCK #ifdef AFS_NT40_ENV - send(fd, &rc, 1, 0); + (void) send(fd, &rc, 1, 0); #else - write(fd, &rc, 1); + (void) write(fd, &rc, 1); #endif } diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index cfd761476..3866ec653 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -41,8 +41,8 @@ RCSID("$Header$"); #include #include #include -#include "ihandle.h" #include "nfs.h" +#include "ihandle.h" #include "viceinode.h" #ifdef AFS_PTHREAD_ENV #include @@ -136,8 +136,10 @@ void ih_Initialize() { /* Avoid problems with "UFSOpen: igetinode failed" panics on HPUX 11.0 */ fdMaxCacheSize = 0; #else - fdMaxCacheSize = MAX(sysconf(_SC_OPEN_MAX)-FD_HANDLE_SETASIDE, 0); - fdMaxCacheSize = MIN(fdMaxCacheSize, FD_MAX_CACHESIZE); + { + long fdMax = MAX(sysconf(_SC_OPEN_MAX)-FD_HANDLE_SETASIDE, 0); + fdMaxCacheSize = (int) MIN(fdMax, FD_MAX_CACHESIZE); + } #endif fdCacheSize = MIN(fdMaxCacheSize, FD_DEFAULT_CACHESIZE); } @@ -277,7 +279,7 @@ FdHandle_t *ih_open(IHandle_t *ihP) DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev); ihP->ih_refcnt++; IH_UNLOCK - FDH_SEEK(fdP, 0, SEEK_SET); + (void) FDH_SEEK(fdP, 0, SEEK_SET); return fdP; } } diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index 81c0dc504..f04c11d00 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -212,7 +212,7 @@ int namei_ViceREADME(char *partition) sprintf(filename, "%s/%s/README", partition, INODEDIR); fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0444); if (fd >= 0) { - write(fd, VICE_README, strlen(VICE_README)); + (void) write(fd, VICE_README, strlen(VICE_README)); close(fd); } return(errno); @@ -1448,7 +1448,7 @@ int namei_ConvertROtoRWvolume(IHandle_t * h, afs_uint32 vid) return EIO; } - while (dp = readdir(dirp)) { + while ((dp = readdir(dirp))) { /* struct ViceInodeInfo info; */ if (*dp->d_name == '.') continue; diff --git a/src/vol/physio.c b/src/vol/physio.c index b4674fa96..f612d6eb2 100644 --- a/src/vol/physio.c +++ b/src/vol/physio.c @@ -42,8 +42,8 @@ RCSID("$Header$"); #include #include #include -#include "ihandle.h" #include "nfs.h" +#include "ihandle.h" #include "salvage.h" #include "afs/assert.h" #include "afs/dir.h" diff --git a/src/vol/vnode.c b/src/vol/vnode.c index a9fc4b8bd..7fe9b8134 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -282,7 +282,7 @@ Vnode *VAllocVnode_r(ec,vp,type) vcp = &VnodeClassInfo[class]; if (!VolumeWriteable(vp)) { - *ec = VREADONLY; + *ec = (bit32) VREADONLY; return NULL; } @@ -392,7 +392,7 @@ Vnode *VAllocVnode_r(ec,vp,type) char *buf = (char *)malloc(16*1024); if (!buf) Abort("VAllocVnode: malloc failed\n"); memset(buf, 0, 16*1024); - FDH_WRITE(fdP, buf, 16*1024); + (void) FDH_WRITE(fdP, buf, 16*1024); free(buf); } FDH_CLOSE(fdP); @@ -468,7 +468,7 @@ Vnode *VGetVnode_r(ec,vp,vnodeNumber,locktype) class = vnodeIdToClass(vnodeNumber); vcp = &VnodeClassInfo[class]; if (locktype == WRITE_LOCK && !VolumeWriteable(vp)) { - *ec = VREADONLY; + *ec = (bit32) VREADONLY; mlkReason = 3; return NULL; } @@ -584,8 +584,8 @@ Vnode *VGetVnode_r(ec,vp,vnodeNumber,locktype) } else { struct vnodeIndex *index = &vp->vnodeIndex[class]; - int bitNumber = vnodeIdToBitNumber(vnodeNumber); - int offset = bitNumber >> 3; + unsigned int bitNumber = vnodeIdToBitNumber(vnodeNumber); + unsigned int offset = bitNumber >> 3; /* Test to see if vnode number is valid. */ if ((offset >= index->bitmapSize) || @@ -703,7 +703,7 @@ VPutVnode_r(ec,vnp) Abort("VPutVnode: Vnode at 0x%x locked by another process!\n",vnp); if (vnp->changed_oldTime || vnp->changed_newTime || vnp->delete) { Volume *vp = vnp->volumePtr; - afs_int32 now = FT_ApproxTime(); + afs_uint32 now = FT_ApproxTime(); assert(vnp->cacheCheck == vp->cacheCheck); if (vnp->delete) { @@ -846,7 +846,7 @@ int VVnodeWriteToRead_r(ec,vnp) } if (vnp->changed_oldTime || vnp->changed_newTime) { Volume *vp = vnp->volumePtr; - afs_int32 now = FT_ApproxTime(); + afs_uint32 now = FT_ApproxTime(); assert(vnp->cacheCheck == vp->cacheCheck); if (vnp->changed_newTime) vnp->disk.serverModifyTime = now; diff --git a/src/vol/vnode.h b/src/vol/vnode.h index 0dabc6102..1a262431c 100644 --- a/src/vol/vnode.h +++ b/src/vol/vnode.h @@ -28,7 +28,7 @@ typedef struct ViceLock #define ROOTVNODE 1 /*typedef enum {vNull=0, vFile=1, vDirectory=2, vSymlink=3} VnodeType;*/ -typedef int VnodeType; +typedef unsigned int VnodeType; #define vNull 0 #define vFile 1 #define vDirectory 2 @@ -68,7 +68,7 @@ extern struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES]; of the index. The header record is the same size as a vnode */ #define vnodeIndexOffset(vcp,vnodeNumber) \ ((vnodeIdToBitNumber(vnodeNumber)+1)<<(vcp)->logSize) -#define bitNumberToVnodeNumber(b,class) (((b)<d_name, '.'); if (p != NULL && strcmp(p, VHDREXT) == 0) { HandleVolume(partP, dp->d_name); diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 923ae2eb4..481d6f220 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -507,11 +507,11 @@ static int handleit(struct cmd_syndesc *as) Exit(0); } #endif /* FAST_RESTART */ - if (ti = as->parms[0].items) { /* -partition */ + if ((ti = as->parms[0].items)) { /* -partition */ seenpart = 1; strncpy(pname, ti->data, 100); } - if (ti = as->parms[1].items) { /* -volumeid */ + if ((ti = as->parms[1].items)) { /* -volumeid */ if (!seenpart) { printf("You must also specify '-partition' option with the '-volumeid' option\n"); exit(-1); @@ -535,7 +535,7 @@ static int handleit(struct cmd_syndesc *as) RebuildDirs = 1; if (as->parms[9].items) /* -ForceReads */ forceR = 1; - if (ti = as->parms[10].items) {/* -Parallel # */ + if ((ti = as->parms[10].items)) {/* -Parallel # */ temp = ti->data; if (strncmp(temp,"all",3) == 0) { PartsPerDisk = 1; @@ -550,7 +550,7 @@ static int handleit(struct cmd_syndesc *as) } } } - if (ti = as->parms[11].items) {/* -tmpdir */ + if ((ti = as->parms[11].items)) {/* -tmpdir */ DIR *dirp; tmpdir = ti->data; @@ -561,19 +561,19 @@ static int handleit(struct cmd_syndesc *as) } else closedir(dirp); } - if (ti = as->parms[12].items) /* -showlog */ + if ((ti = as->parms[12].items)) /* -showlog */ ShowLog = 1; - if (ti = as->parms[13].items) { /* -log */ + if ((ti = as->parms[13].items)) { /* -log */ Testing = 1; ShowSuid = 1; Showmode = 1; } - if (ti = as->parms[14].items) { /* -showmounts */ + if ((ti = as->parms[14].items)) { /* -showmounts */ Testing = 1; Showmode = 1; ShowMounts = 1; } - if (ti = as->parms[15].items) { /* -orphans */ + if ((ti = as->parms[15].items)) { /* -orphans */ if (Testing) orphans = ORPH_IGNORE; else if (strcmp(ti->data, "remove")==0 || strcmp(ti->data, "r")==0) @@ -583,15 +583,15 @@ static int handleit(struct cmd_syndesc *as) } #ifndef AFS_NT40_ENV /* ignore options on NT */ - if ( ti = as->parms[16].items) { /* -syslog */ + if ((ti = as->parms[16].items)) { /* -syslog */ useSyslog = 1; ShowLog = 0; } - if ( ti = as->parms[17].items) { /* -syslogfacility */ + if ((ti = as->parms[17].items)) { /* -syslogfacility */ useSyslogFacility = atoi(ti->data); } - if (ti = as->parms[18].items) { /* -datelogs */ + if ((ti = as->parms[18].items)) { /* -datelogs */ TimeStampLogFile(); } #endif @@ -1089,7 +1089,7 @@ void SalvageFileSysParallel(struct DiskPartition *partP) if (!partP) { for (i=0; id_name, "salvage.inodes.", 15) || !strncmp(dp->d_name, "salvage.temp.", 13)) { char npath[1024]; @@ -1602,7 +1602,7 @@ void GetVolumeSummary(VolumeId singleVolumeNumber) if (chdir(fileSysPath) == -1 || (dirp = opendir(".")) == NULL) Abort("Can't read directory %s; not salvaged\n", fileSysPath); if (!singleVolumeNumber) { - while (dp = readdir(dirp)) { + while ((dp = readdir(dirp))) { char *p = dp->d_name; p = strrchr(dp->d_name, '.'); if (p != NULL && strcmp(p, VHDREXT) == 0) { @@ -1630,7 +1630,7 @@ void GetVolumeSummary(VolumeId singleVolumeNumber) nVolumes = 0; vsp = volumeSummaryp; - while (dp = readdir(dirp)) { + while ((dp = readdir(dirp))) { char *p = dp->d_name; p = strrchr(dp->d_name, '.'); if (p != NULL && strcmp(p, VHDREXT) == 0) { @@ -3578,9 +3578,9 @@ static char *TimeStamp(time_t clock, int precision) static char timestamp[20]; lt = localtime(&clock); if (precision) - strftime (timestamp, 20, "%m/%d/%Y %T", lt); + (void) strftime (timestamp, 20, "%m/%d/%Y %T", lt); else - strftime (timestamp, 20, "%m/%d/%Y %H:%M", lt); + (void) strftime (timestamp, 20, "%m/%d/%Y %H:%M", lt); return timestamp; } diff --git a/src/vol/volume.c b/src/vol/volume.c index 45c514a10..d7091f16f 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -208,7 +208,7 @@ int VInit; /* 0 - uninitialized, VConnectFS() has completed. */ -int VolumeCacheCheck; /* Incremented everytime a volume goes on line-- +bit32 VolumeCacheCheck; /* Incremented everytime a volume goes on line-- * used to stamp volume headers and in-core * vnodes. When the volume goes on-line the * vnode will be invalidated */ @@ -386,7 +386,7 @@ void VShutdown(void) static void ReadHeader(Error *ec, IHandle_t *h, char *to, int size, - int magic, int version) + bit32 magic, bit32 version) { struct versionStamp *vsn; FdHandle_t *fdP; @@ -465,14 +465,15 @@ void DiskToVolumeHeader(VolumeHeader_t *h, VolumeDiskHeader_t *dh) h->parent = dh->parent; #ifdef AFS_64BIT_IOPS_ENV - h->volumeInfo = dh->volumeInfo_lo | ((Inode)dh->volumeInfo_hi << 32); + h->volumeInfo = (Inode)dh->volumeInfo_lo | + ((Inode)dh->volumeInfo_hi << 32); - h->smallVnodeIndex = dh->smallVnodeIndex_lo | + h->smallVnodeIndex = (Inode)dh->smallVnodeIndex_lo | ((Inode)dh->smallVnodeIndex_hi << 32); - h->largeVnodeIndex = dh->largeVnodeIndex_lo | + h->largeVnodeIndex = (Inode)dh->largeVnodeIndex_lo | ((Inode)dh->largeVnodeIndex_hi << 32); - h->linkTable = dh->linkTable_lo | + h->linkTable = (Inode)dh->linkTable_lo | ((Inode)dh->linkTable_hi << 32); #else h->volumeInfo = dh->volumeInfo_lo; @@ -681,7 +682,7 @@ private Volume *attach2(Error *ec, char *path, register struct VolumeHeader VOL_UNLOCK vp = (Volume *) calloc(1, sizeof(Volume)); assert(vp != NULL); - vp->specialStatus = (isbusy ? VBUSY : 0); + vp->specialStatus = (byte) (isbusy ? VBUSY : 0); vp->device = partp->device; vp->partition = partp; IH_INIT(vp->vnodeIndex[vLarge].handle, partp->device, header->parent, @@ -1224,14 +1225,14 @@ void VDetachVolume(Error *ec, Volume *vp) } -int VAllocBitmapEntry_r(Error *ec, Volume *vp, register struct vnodeIndex +VnodeId VAllocBitmapEntry_r(Error *ec, Volume *vp, register struct vnodeIndex *index) { register byte *bp,*ep; *ec = 0; /* This test is probably redundant */ if (!VolumeWriteable(vp)) { - *ec = VREADONLY; + *ec = (bit32) VREADONLY; return 0; } #ifdef BITMAP_LATER @@ -1274,14 +1275,14 @@ int VAllocBitmapEntry_r(Error *ec, Volume *vp, register struct vnodeIndex bp = index->bitmap + index->bitmapOffset; ep = index->bitmap + index->bitmapSize; while (bp < ep) { - if ((*(bit32 *)bp) != 0xffffffff) { + if ((*(bit32 *)bp) != (bit32)0xffffffff) { int o; - index->bitmapOffset = bp - index->bitmap; + index->bitmapOffset = (afs_uint32) (bp - index->bitmap); while (*bp == 0xff) bp++; o = ffs(~*bp)-1; /* ffs is documented in BSTRING(3) */ *bp |= (1 << o); - return (bp - index->bitmap)*8 + o; + return (VnodeId) ((bp - index->bitmap)*8 + o); } bp += sizeof(bit32) /* i.e. 4 */; } @@ -1298,9 +1299,9 @@ int VAllocBitmapEntry_r(Error *ec, Volume *vp, register struct vnodeIndex return index->bitmapOffset*8; } -int VAllocBitmapEntry(Error *ec, Volume *vp, register struct vnodeIndex *index) +VnodeId VAllocBitmapEntry(Error *ec, Volume *vp, register struct vnodeIndex *index) { - int retVal; + VnodeId retVal; VOL_LOCK retVal = VAllocBitmapEntry_r(ec,vp,index); VOL_UNLOCK @@ -1308,7 +1309,7 @@ int VAllocBitmapEntry(Error *ec, Volume *vp, register struct vnodeIndex *index) } void VFreeBitMapEntry_r(Error *ec, register struct vnodeIndex *index, - int bitNumber) + unsigned bitNumber) { unsigned int offset; *ec = 0; @@ -1326,7 +1327,7 @@ void VFreeBitMapEntry_r(Error *ec, register struct vnodeIndex *index, } void VFreeBitMapEntry(Error *ec, register struct vnodeIndex *index, - int bitNumber) + unsigned bitNumber) { VOL_LOCK VFreeBitMapEntry_r(ec, index, bitNumber); @@ -1394,7 +1395,6 @@ static void GetBitmap(Error *ec, Volume *vp, VnodeClass class) StreamHandle_t *file; int nVnodes; int size; - int counter = 0; struct VnodeClassInfo *vcp = &VnodeClassInfo[class]; struct vnodeIndex *vip = &vp->vnodeIndex[class]; struct VnodeDiskObject *vnode; @@ -1682,7 +1682,7 @@ static void VScanUpdateList() { register int i, gap; register Volume *vp; Error error; - afs_int32 now = FT_ApproxTime(); + afs_uint32 now = FT_ApproxTime(); /* Be careful with this code, since it works with interleaved calls to AddToVolumeUpdateList */ for (i = gap = 0; i 0) { printf("---------------------------\n"); - printf("%s RW-Id %u",old->name,old->ids[RWVOL]); + printf("%s RW-Id %lu",old->name,(unsigned long) old->ids[RWVOL]); if(old->isValid[RWVOL]) printf(" valid "); else printf(" invalid "); - printf("RO-Id %u",old->ids[ROVOL]); + printf("RO-Id %lu",(unsigned long) old->ids[ROVOL]); if(old->isValid[ROVOL]) printf(" valid "); else printf(" invalid "); - printf("BACKUP-Id %u",old->ids[BACKVOL]); + printf("BACKUP-Id %lu",(unsigned long) old->ids[BACKVOL]); if(old->isValid[BACKVOL]) printf(" valid "); else printf(" invalid "); diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index f5cdd3817..f210bfeb4 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -59,6 +59,7 @@ RCSID("$Header$"); #include #include #include "afs/audit.h" +#include #include "volser.h" #include "volint.h" @@ -138,7 +139,7 @@ char *aname; afs_int32 asize; { if (asize < 18) return -1; /* It's better using the Generic VFORMAT since otherwise we have to make changes to too many places... The 14 char limitation in names hits us again in AIX; print in field of 9 digits (still 10 for the rest), right justified with 0 padding */ - sprintf(aname, VFORMAT, avol); + sprintf(aname, VFORMAT, (unsigned long) avol); return 0; } @@ -1123,7 +1124,7 @@ afs_int32 destTrans; fail: if (tcon) { - rx_EndCall(tcall,0); + (void) rx_EndCall(tcall,0); rx_DestroyConnection(tcon); } if (tt){ @@ -1209,7 +1210,7 @@ afs_int32 SAFSVolForwardMultiple (acid, fromTrans, fromDate, destinations, codes[i] = StartAFSVolRestore(tcalls[i], dest->trans, is_incremental,cookie); if (codes[i]) { - rx_EndCall (tcalls[i],0); tcalls[i] = 0; + (void) rx_EndCall (tcalls[i],0); tcalls[i] = 0; rx_DestroyConnection(tcons[i]); tcons[i] = 0; } } diff --git a/src/volser/vos.c b/src/volser/vos.c index 95e041dc2..d1f9519a1 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -59,6 +59,7 @@ RCSID("$Header$"); #ifdef AFS_AIX32_ENV #include #endif +#include "volser_prototypes.h" struct tqElem { afs_int32 volid; @@ -102,9 +103,6 @@ extern VL_ChangeAddr(); extern int vsu_ExtractName(); extern PrintError(); -extern int MapPartIdIntoName(); -extern int MapHostToNetwork(); -extern int MapNetworkToHost(); extern void EnumerateEntry(); extern void SubEnumerateEntry(); @@ -470,12 +468,12 @@ int fast,longlist, disp; char pname[10]; if(fast){ - fprintf(STDOUT,"%-10u\n",pntr->volid); + fprintf(STDOUT,"%-10lu\n", (unsigned long) pntr->volid); } else if(longlist){ if(pntr->status == VOK){ fprintf(STDOUT,"%-32s ",pntr->name); - fprintf(STDOUT,"%10u ",pntr->volid); + fprintf(STDOUT,"%10lu ", (unsigned long) pntr->volid); if(pntr->type == 0) fprintf(STDOUT,"RW "); if(pntr->type == 1) fprintf(STDOUT,"RO "); if(pntr->type == 2) fprintf(STDOUT,"BK "); @@ -491,7 +489,10 @@ int fast,longlist, disp; fprintf(STDOUT,"\n"); MapPartIdIntoName(part,pname); fprintf(STDOUT," %s %s \n",hostutil_GetNameByINet(server),pname); - fprintf(STDOUT," RWrite %10u ROnly %10u Backup %10u \n", pntr->parentID,pntr->cloneID, pntr->backupID); + fprintf(STDOUT," RWrite %10lu ROnly %10lu Backup %10lu \n", + (unsigned long) pntr->parentID, + (unsigned long) pntr->cloneID, + (unsigned long) pntr->backupID); fprintf(STDOUT," MaxQuota %10d K \n",pntr->maxquota); fprintf(STDOUT," Creation %s", ctime((time_t *)&pntr->creationDate)); @@ -519,19 +520,21 @@ int fast,longlist, disp; else if (pntr->status == VBUSY) { *totalBusy += 1; qPut(&busyHead,pntr->volid); - if (disp) fprintf(STDOUT,"**** Volume %u is busy ****\n",pntr->volid); + if (disp) fprintf(STDOUT,"**** Volume %lu is busy ****\n", + (unsigned long) pntr->volid); } else { *totalNotOK += 1; qPut(¬okHead,pntr->volid); - if (disp) fprintf(STDOUT,"**** Could not attach volume %u ****\n",pntr->volid); + if (disp) fprintf(STDOUT,"**** Could not attach volume %lu ****\n", + (unsigned long) pntr->volid); } fprintf(STDOUT,"\n"); } else {/* default listing */ if(pntr->status == VOK){ fprintf(STDOUT,"%-32s ",pntr->name); - fprintf(STDOUT,"%10u ",pntr->volid); + fprintf(STDOUT,"%10lu ",(unsigned long) pntr->volid); if(pntr->type == 0) fprintf(STDOUT,"RW "); if(pntr->type == 1) fprintf(STDOUT,"RO "); if(pntr->type == 2) fprintf(STDOUT,"BK "); @@ -549,12 +552,14 @@ int fast,longlist, disp; else if (pntr->status == VBUSY) { *totalBusy += 1; qPut(&busyHead,pntr->volid); - if (disp) fprintf(STDOUT,"**** Volume %u is busy ****\n",pntr->volid); + if (disp) fprintf(STDOUT,"**** Volume %lu is busy ****\n", + (unsigned long) pntr->volid); } else { *totalNotOK += 1; qPut(¬okHead,pntr->volid); - if (disp) fprintf(STDOUT,"**** Could not attach volume %u ****\n",pntr->volid); + if (disp) fprintf(STDOUT,"**** Could not attach volume %lu ****\n", + (unsigned long) pntr->volid); } } } @@ -607,7 +612,7 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, /* * Short & sweet. */ - fprintf(STDOUT, "%-10u\n", a_xInfoP->volid); + fprintf(STDOUT, "%-10lu\n", (unsigned long) a_xInfoP->volid); } else if (a_int32) { @@ -619,7 +624,7 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, * Volume's status is OK - all the fields are valid. */ fprintf(STDOUT, "%-32s ", a_xInfoP->name); - fprintf(STDOUT, "%10u ", a_xInfoP->volid); + fprintf(STDOUT, "%10lu ", (unsigned long) a_xInfoP->volid); if (a_xInfoP->type == 0) fprintf(STDOUT,"RW "); if (a_xInfoP->type == 1) fprintf(STDOUT,"RO "); if (a_xInfoP->type == 2) fprintf(STDOUT,"BK "); @@ -638,8 +643,10 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, fprintf(STDOUT, " %s %s \n", hostutil_GetNameByINet(a_servID), pname); - fprintf(STDOUT, " RWrite %10u ROnly %10u Backup %10u \n", - a_xInfoP->parentID, a_xInfoP->cloneID, a_xInfoP->backupID); + fprintf(STDOUT, " RWrite %10lu ROnly %10lu Backup %10lu \n", + (unsigned long) a_xInfoP->parentID, + (unsigned long) a_xInfoP->cloneID, + (unsigned long) a_xInfoP->backupID); fprintf(STDOUT, " MaxQuota %10d K \n", a_xInfoP->maxquota); fprintf(STDOUT, " Creation %s", @@ -751,15 +758,15 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, (*a_totalBusyP)++; qPut(&busyHead, a_xInfoP->volid); if (a_showProblems) - fprintf(STDOUT, "**** Volume %u is busy ****\n", - a_xInfoP->volid); + fprintf(STDOUT, "**** Volume %lu is busy ****\n", + (unsigned long) a_xInfoP->volid); } /*Busy volume*/ else { (*a_totalNotOKP)++; qPut(¬okHead, a_xInfoP->volid); if (a_showProblems) - fprintf(STDOUT, "**** Could not attach volume %u ****\n", - a_xInfoP->volid); + fprintf(STDOUT, "**** Could not attach volume %lu ****\n", + (unsigned long) a_xInfoP->volid); } /*Screwed volume*/ fprintf(STDOUT,"\n"); } /*Long listing*/ @@ -769,7 +776,7 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, */ if (a_xInfoP->status == VOK) { fprintf(STDOUT, "%-32s ", a_xInfoP->name); - fprintf(STDOUT, "%10u ", a_xInfoP->volid); + fprintf(STDOUT, "%10lu ", (unsigned long) a_xInfoP->volid); if (a_xInfoP->type == 0) fprintf(STDOUT, "RW "); if (a_xInfoP->type == 1) fprintf(STDOUT, "RO "); if (a_xInfoP->type == 2) fprintf(STDOUT, "BK "); @@ -788,15 +795,15 @@ static void XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, (*a_totalBusyP)++; qPut(&busyHead, a_xInfoP->volid); if (a_showProblems) - fprintf(STDOUT,"**** Volume %u is busy ****\n", - a_xInfoP->volid); + fprintf(STDOUT,"**** Volume %lu is busy ****\n", + (unsigned long) a_xInfoP->volid); } /*Busy volume*/ else { (*a_totalNotOKP)++; qPut(¬okHead, a_xInfoP->volid); if (a_showProblems) - fprintf(STDOUT,"**** Could not attach volume %u ****\n", - a_xInfoP->volid); + fprintf(STDOUT,"**** Could not attach volume %lu ****\n", + (unsigned long) a_xInfoP->volid); } /*Screwed volume*/ } /*Default listing*/ } /*XDisplayFormat*/ @@ -913,13 +920,15 @@ int quiet; if(totalBusy){ while(busyHead.count){ qGet(&busyHead,&volid); - fprintf(STDOUT,"**** Volume %u is busy ****\n",volid); + fprintf(STDOUT,"**** Volume %lu is busy ****\n", + (unsigned long) volid); } } if(totalNotOK){ while(notokHead.count){ qGet(¬okHead,&volid); - fprintf(STDOUT,"**** Could not attach volume %u ****\n",volid); + fprintf(STDOUT,"**** Could not attach volume %lu ****\n", + (unsigned long) volid); } } if(!quiet){ @@ -1004,13 +1013,15 @@ static void XDisplayVolumes(a_servID, a_partID, a_xInfoP, if (totalBusy) { while (busyHead.count) { qGet(&busyHead, &volid); - fprintf(STDOUT, "**** Volume %u is busy ****\n", volid); + fprintf(STDOUT, "**** Volume %lu is busy ****\n", + (unsigned long) volid); } } if (totalNotOK) { while (notokHead.count) { qGet(¬okHead, &volid); - fprintf(STDOUT, "**** Could not attach volume %u ****\n", volid); + fprintf(STDOUT, "**** Could not attach volume %lu ****\n", + (unsigned long) volid); } } @@ -1216,12 +1227,14 @@ register struct cmd_syndesc *as; } if (verbose) { - fprintf(STDOUT, "Fetching VLDB entry for %u .. ", volid); + fprintf(STDOUT, "Fetching VLDB entry for %lu .. ", + (unsigned long) volid); fflush(STDOUT); } vcode = VLDB_GetEntryByID (volid, -1, &entry); if (vcode) { - fprintf(STDERR, "Could not fetch the entry for volume number %u from VLDB \n",volid); + fprintf(STDERR, "Could not fetch the entry for volume number %lu from VLDB \n", + (unsigned long) volid); return (vcode); } if (verbose) @@ -1351,7 +1364,8 @@ register struct cmd_syndesc *as; code = VLDB_GetEntryByID (volid, RWVOL, &entry); if (code) { - fprintf(STDERR, "Could not fetch the entry for volume number %u from VLDB \n",volid); + fprintf(STDERR, "Could not fetch the entry for volume number %lu from VLDB \n", + (unsigned long) volid); return (code); } MapHostToNetwork(&entry); @@ -1387,7 +1401,8 @@ register struct cmd_syndesc *as; } code = UV_SetVolumeInfo(aserver, apart, volid, &info); if (code) - fprintf(STDERR,"Could not update volume info fields for volume number %u\n",volid); + fprintf(STDERR,"Could not update volume info fields for volume number %lu\n", + (unsigned long) volid); return (code); } @@ -1569,7 +1584,8 @@ static int CreateVolume(register struct cmd_syndesc *as) return code; } MapPartIdIntoName(pname, part); - fprintf(STDOUT,"Volume %u created on partition %s of %s\n", volid, part,as->parms[0].items->data ); + fprintf(STDOUT,"Volume %lu created on partition %s of %s\n", + (unsigned long) volid, part,as->parms[0].items->data ); return 0; } @@ -1651,8 +1667,8 @@ static DeleteVolume(as) code = VLDB_GetEntryByID(volid, -1, &entry); if (code) { - fprintf(STDERR,"Could not fetch the entry for volume %u from VLDB\n", - volid); + fprintf(STDERR,"Could not fetch the entry for volume %lu from VLDB\n", + (unsigned long) volid); PrintError("",code); return (code); } @@ -1703,8 +1719,8 @@ static DeleteVolume(as) } MapPartIdIntoName(partition, pname); - fprintf(STDOUT,"Volume %u on partition %s server %s deleted\n", - volid, pname, hostutil_GetNameByINet(server)); + fprintf(STDOUT,"Volume %lu on partition %s server %s deleted\n", + (unsigned long) volid, pname, hostutil_GetNameByINet(server)); return 0; } @@ -1782,16 +1798,18 @@ register struct cmd_syndesc *as; code=UV_ListOneVolume(fromserver,frompart,volid,&p); if(code) { - fprintf(STDERR,"vos:cannot access volume %u\n",volid); + fprintf(STDERR,"vos:cannot access volume %lu\n", + (unsigned long) volid); free(p); exit(1); } if(TESTM) - fprintf(STDOUT,"volume %u size %d\n",volid,p->size); + fprintf(STDOUT,"volume %lu size %d\n", + (unsigned long) volid,p->size); if(partition.free<=p->size) { - fprintf(STDERR,"vos: no space on target partition %s to move volume %u\n", - toPartName,volid); + fprintf(STDERR,"vos: no space on target partition %s to move volume %lu\n", + toPartName,(unsigned long) volid); free(p); exit(1); } @@ -1812,7 +1830,10 @@ register struct cmd_syndesc *as; } MapPartIdIntoName(topart,toPartName); MapPartIdIntoName(frompart, fromPartName); - fprintf(STDOUT,"Volume %u moved from %s %s to %s %s \n",volid,as->parms[1].items->data,fromPartName,as->parms[3].items->data,toPartName); + fprintf(STDOUT,"Volume %lu moved from %s %s to %s %s \n", + (unsigned long) volid, + as->parms[1].items->data,fromPartName, + as->parms[3].items->data,toPartName); return 0; } @@ -1913,15 +1934,16 @@ register struct cmd_syndesc *as; code=UV_ListOneVolume(fromserver,frompart,volid,&p); if(code) { - fprintf(STDERR,"vos:cannot access volume %u\n",volid); + fprintf(STDERR,"vos:cannot access volume %lu\n", + (unsigned long) volid); free(p); exit(1); } if(partition.free<=p->size) { - fprintf(STDERR,"vos: no space on target partition %s to copy volume %u\n", - toPartName,volid); + fprintf(STDERR,"vos: no space on target partition %s to copy volume %lu\n", + toPartName,(unsigned long) volid); free(p); exit(1); } @@ -1936,7 +1958,8 @@ register struct cmd_syndesc *as; } MapPartIdIntoName(topart,toPartName); MapPartIdIntoName(frompart, fromPartName); - fprintf(STDOUT,"Volume %u copied from %s %s to %s on %s %s \n",volid, + fprintf(STDOUT,"Volume %lu copied from %s %s to %s on %s %s \n", + (unsigned long) volid, as->parms[1].items->data,fromPartName, tovolume, as->parms[4].items->data,toPartName); @@ -1992,8 +2015,9 @@ register struct cmd_syndesc *as; } if (!code) { - fprintf(STDERR,"FATAL ERROR: backup volume %u exists on server %u\n", - buvolid,buserver); + fprintf(STDERR,"FATAL ERROR: backup volume %lu exists on server %lu\n", + (unsigned long) buvolid, + (unsigned long) buserver); exit(1); } } @@ -2299,8 +2323,8 @@ register struct cmd_syndesc *as; restoreflags = 0; if (vol_elsewhere) { fprintf(STDERR, - "%s volume %u already exists on a different server/part; not allowed\n", - readonly ? "RO" : "RW", avolid); + "%s volume %lu already exists on a different server/part; not allowed\n", + readonly ? "RO" : "RW", (unsigned long) avolid); exit(1); } } @@ -2733,7 +2757,7 @@ register struct cmd_syndesc *as; } MapPartIdIntoName(dummyPartList.partId[i],pname); if(!quiet) - fprintf(STDOUT,"Total number of volumes on server %s partition %s: %u \n",as->parms[0].items->data,pname,count); + fprintf(STDOUT,"Total number of volumes on server %s partition %s: %lu \n",as->parms[0].items->data,pname, (unsigned long) count); if (wantExtendedInfo) { XDisplayVolumes(aserver, dummyPartList.partId[i], @@ -2948,8 +2972,8 @@ register struct cmd_syndesc *as; if (!code) { if (volid == entry.volumeId[RWVOL]) backupid = entry.volumeId[BACKVOL]; - fprintf(STDERR,"Warning: Entry for volume number %u exists in VLDB (but we're zapping it anyway!)\n", - volid); + fprintf(STDERR,"Warning: Entry for volume number %lu exists in VLDB (but we're zapping it anyway!)\n", + (unsigned long) volid); } if (zapbackupid) { volintInfo *pntr = (volintInfo *)0; @@ -2968,7 +2992,8 @@ register struct cmd_syndesc *as; PrintDiagnostics("zap", code); exit(1); } - fprintf(STDOUT,"Backup Volume %u deleted\n", backupid); + fprintf(STDOUT,"Backup Volume %lu deleted\n", + (unsigned long) backupid); } } code = UV_VolumeZap(server,part,volid); @@ -2976,7 +3001,7 @@ register struct cmd_syndesc *as; PrintDiagnostics("zap", code); exit(1); } - fprintf(STDOUT,"Volume %u deleted\n",volid); + fprintf(STDOUT,"Volume %lu deleted\n", (unsigned long) volid); return 0; } @@ -3010,10 +3035,12 @@ register struct cmd_syndesc *as; for(i = 0; i < count ; i++){ /*print out the relevant info */ fprintf(STDOUT,"--------------------------------------\n"); - fprintf(STDOUT,"transaction: %u created: %s",pntr->tid, + fprintf(STDOUT,"transaction: %lu created: %s", + (unsigned long) pntr->tid, ctime((time_t *)&pntr->time)); if(pntr->returnCode){ - fprintf(STDOUT,"returnCode: %u\n",pntr->returnCode); + fprintf(STDOUT,"returnCode: %lu\n", + (unsigned long) pntr->returnCode); } if(pntr->iflags){ fprintf(STDOUT,"attachFlags: "); @@ -3045,9 +3072,13 @@ register struct cmd_syndesc *as; fprintf(STDOUT,"delete\n"); } MapPartIdIntoName(pntr->partition ,pname); - fprintf(STDOUT,"volume: %u partition: %s procedure: %s\n",pntr->volid,pname, pntr->lastProcName); + fprintf(STDOUT,"volume: %lu partition: %s procedure: %s\n", + (unsigned long) pntr->volid, pname, + pntr->lastProcName); if(pntr->callValid){ - fprintf(STDOUT,"packetRead: %u lastReceiveTime: %d packetSend: %u lastSendTime: %d\n",pntr->readNext,pntr->lastReceiveTime,pntr->transmitNext, pntr->lastSendTime); + fprintf(STDOUT,"packetRead: %lu lastReceiveTime: %d packetSend: %lu lastSendTime: %d\n", + (unsigned long) pntr->readNext,pntr->lastReceiveTime, + (unsigned long) pntr->transmitNext, pntr->lastSendTime); } pntr++; fprintf(STDOUT,"--------------------------------------\n"); @@ -3113,7 +3144,8 @@ register struct nvldbentry *rentry; vcode = VLDB_GetEntryByID(volid, -1, rentry); if(vcode) { - fprintf(STDERR,"Could not fetch the entry for volume %u from VLDB \n",volid); + fprintf(STDERR,"Could not fetch the entry for volume %lu from VLDB \n", + (unsigned long) volid); PrintError("",vcode); return (vcode); } @@ -3126,7 +3158,7 @@ register struct nvldbentry *rentry; index = i; } if(index == -1) { - fprintf(STDERR,"RO volume is not found in VLDB entry for volume %u\n", volid); + fprintf(STDERR,"RO volume is not found in VLDB entry for volume %lu\n", (unsigned long) volid); return -1; } @@ -3137,7 +3169,8 @@ register struct nvldbentry *rentry; index = Lp_GetRwIndex(rentry); if(index == -1) { - fprintf(STDERR,"RW Volume is not found in VLDB entry for volume %u\n", volid); + fprintf(STDERR,"RW Volume is not found in VLDB entry for volume %lu\n", + (unsigned long) volid); return -1; } if(volid == rentry->volumeId[RWVOL]){ @@ -3309,7 +3342,8 @@ register struct cmd_syndesc *as; } /*for*/ fprintf(STDOUT,"----------------------\n"); - fprintf(STDOUT,"Total VLDB entries deleted: %u; failed to delete: %u\n",totalBack,totalFail); + fprintf(STDOUT,"Total VLDB entries deleted: %lu; failed to delete: %lu\n", + (unsigned long) totalBack, (unsigned long) totalFail); if (arrayEntries.nbulkentries_val) free(arrayEntries.nbulkentries_val); return 0; } @@ -3514,7 +3548,8 @@ static ListVLDB(as) } bypass: - if (!quiet) fprintf(STDOUT,"\nTotal entries: %u\n", nentries); + if (!quiet) fprintf(STDOUT,"\nTotal entries: %lu\n", + (unsigned long) nentries); if (tarray) free(tarray); return 0; } @@ -3754,7 +3789,8 @@ static BackSys(as) fflush(STDOUT); } /* process each vldb entry */ fprintf(STDOUT,"done\n"); - fprintf(STDOUT,"Total volumes backed up: %u; failed to backup: %u\n",totalBack,totalFail); + fprintf(STDOUT,"Total volumes backed up: %lu; failed to backup: %lu\n", + (unsigned long) totalBack, (unsigned long) totalFail); fflush(STDOUT); if(arrayEntries.nbulkentries_val) free(arrayEntries.nbulkentries_val); return 0; @@ -3823,7 +3859,7 @@ register struct cmd_syndesc *as; } MapPartIdIntoName(apart,pname); - if(totalE) fprintf(STDOUT,"Could not lock %u VLDB entries of %u locked entries\n",totalE,nentries); + if(totalE) fprintf(STDOUT,"Could not lock %lu VLDB entries of %lu locked entries\n", (unsigned long) totalE, (unsigned long) nentries); else { if(as->parms[0].items) { fprintf(STDOUT,"Unlocked all the VLDB entries for volumes on server %s ",as->parms[0].items->data); @@ -4201,8 +4237,8 @@ register struct cmd_syndesc *as; vcode = VLDB_GetEntryByID (volid, -1, &entry); if(vcode) { - fprintf(STDERR,"Could not fetch the entry for volume %u from VLDB\n", - volid); + fprintf(STDERR,"Could not fetch the entry for volume %lu from VLDB\n", + (unsigned long) volid); PrintError("convertROtoRW", code); return vcode; } @@ -4260,7 +4296,7 @@ register struct cmd_syndesc *as; aconn = UV_Bind(server, AFSCONF_VOLUMEPORT); code = AFSVolConvertROtoRWvolume(aconn, partition, volid); if (code) { - fprintf(STDERR,"Converting RO volume %u to RW volume failed with code %d\n", volid, code); + fprintf(STDERR,"Converting RO volume %lu to RW volume failed with code %d\n", (unsigned long) volid, code); PrintError("convertROtoRW ", code); return -1; } @@ -4333,9 +4369,10 @@ char *arock; { sauth = 1; if(as->parms[16].items) /* -crypt specified */ vsu_SetCrypt(1); - if (code = vsu_ClientInit((as->parms[13].items != 0), confdir, tcell, sauth, - &cstruct, UV_SetSecurity)) { - fprintf(STDERR,"could not initialize VLDB library (code=%u) \n",code); + if ((code = vsu_ClientInit((as->parms[13].items != 0), confdir, tcell, sauth, + &cstruct, UV_SetSecurity))) { + fprintf(STDERR,"could not initialize VLDB library (code=%lu) \n", + (unsigned long) code); exit(1); } rxInitDone = 1; @@ -4610,7 +4647,7 @@ char **argv; { if (rxInitDone) { /* Shut down the ubik_client and rx connections */ if (cstruct) { - ubik_ClientDestroy (cstruct); + (void) ubik_ClientDestroy (cstruct); cstruct = 0; } rx_Finalize(); diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index bd168d80d..39f7f0210 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -427,10 +427,11 @@ void SubEnumerateEntry(struct nvldbentry *entry) if (entry->flags & BACK_EXISTS) fprintf(STDOUT," Backup: %-10u",entry->volumeId[BACKVOL]); if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS)) - fprintf(STDOUT," RClone: %-10u",entry->cloneId); + fprintf(STDOUT," RClone: %-10lu", (unsigned long) entry->cloneId); fprintf(STDOUT,"\n"); #endif - fprintf(STDOUT," number of sites -> %u\n",entry->nServers); + fprintf(STDOUT," number of sites -> %lu\n", + (unsigned long) entry->nServers); for(i = 0; i < entry->nServers; i++) { if(entry->serverFlags[i] & NEW_REPSITE) isMixed = 1; @@ -564,7 +565,8 @@ int UV_CreateVolume2(afs_int32 aserver, afs_int32 apart, char *aname, afs_int32 /* create the vldb entry */ vcode = VLDB_CreateEntry(&storeEntry); if(vcode) { - fprintf(STDERR,"Could not create a VLDB entry for the volume %s %u\n", aname,*anewid); + fprintf(STDERR,"Could not create a VLDB entry for the volume %s %lu\n", + aname, (unsigned long) *anewid); /*destroy the created volume*/ VPRINT1("Deleting the newly created volume %u\n",*anewid); AFSVolDeleteVolume(aconn,tid); @@ -578,7 +580,8 @@ int UV_CreateVolume2(afs_int32 aserver, afs_int32 apart, char *aname, afs_int32 vldb entry exists then the volume is guaranteed to exist too wrt create*/ tid = 0; if(code){ - fprintf(STDERR,"Failed to end the transaction on the volume %s %u\n",aname,*anewid); + fprintf(STDERR,"Failed to end the transaction on the volume %s %lu\n", + aname, (unsigned long) *anewid); error = code; goto cfail; } @@ -632,7 +635,8 @@ int UV_AddVLDBEntry(afs_int32 aserver, afs_int32 apart, char *aname, afs_int32 a /* create the vldb entry */ vcode = VLDB_CreateEntry(&storeEntry); if(vcode) { - fprintf(STDERR,"Could not create a VLDB entry for the volume %s %u\n", aname,aid); + fprintf(STDERR,"Could not create a VLDB entry for the volume %s %lu\n", + aname, (unsigned long) aid); error = vcode; goto cfail; } @@ -734,7 +738,8 @@ int UV_DeleteVolume(afs_int32 aserver, afs_int32 apart, afs_int32 avolid) } if (verbose) - fprintf(STDOUT,"Marking the readonly volume %u deleted in the VLDB\n", avolid); + fprintf(STDOUT,"Marking the readonly volume %lu deleted in the VLDB\n", + (unsigned long) avolid); Lp_SetROValue(&entry, aserver, apart, 0, 0); /* delete the site */ entry.nServers--; @@ -773,8 +778,8 @@ int UV_DeleteVolume(afs_int32 aserver, afs_int32 apart, afs_int32 avolid) } if (verbose) - fprintf(STDOUT,"Marking the readwrite volume %u%s deleted in the VLDB\n", - avolid, ((entry.flags & BACK_EXISTS)?", and its backup volume,":"")); + fprintf(STDOUT,"Marking the readwrite volume %lu%s deleted in the VLDB\n", + (unsigned long) avolid, ((entry.flags & BACK_EXISTS)?", and its backup volume,":"")); Lp_SetRWValue(&entry, aserver, apart, 0L, 0L); entry.nServers--; @@ -793,7 +798,8 @@ int UV_DeleteVolume(afs_int32 aserver, afs_int32 apart, afs_int32 avolid) /* Either delete or replace the VLDB entry */ if ((entry.nServers <= 0) || !(entry.flags & (RO_EXISTS | RW_EXISTS))) { if (verbose) - fprintf(STDOUT,"Last reference to the VLDB entry for %u - deleting entry\n", avolid); + fprintf(STDOUT,"Last reference to the VLDB entry for %lu - deleting entry\n", + (unsigned long) avolid); code = ubik_Call(VL_DeleteEntry, cstruct, 0, avolid, vtype); EGOTO1(error_exit, code, "Could not delete the VLDB entry for the volume %u \n",avolid); } else { @@ -813,18 +819,21 @@ int UV_DeleteVolume(afs_int32 aserver, afs_int32 apart, afs_int32 avolid) if (!error) error = VOLSERNOVOL; } else if (notondisk) { - fprintf(STDERR,"WARNING: Volume %u did not exist on the partition\n", avolid); + fprintf(STDERR,"WARNING: Volume %lu did not exist on the partition\n", + (unsigned long) avolid); } else if (notinvldb) { - fprintf(STDERR,"WARNING: Volume %u does not exist in VLDB %s\n", - avolid, ((notinvldb == 2)?"on server and partition":"")); + fprintf(STDERR,"WARNING: Volume %lu does not exist in VLDB %s\n", + (unsigned long) avolid, + ((notinvldb == 2)?"on server and partition":"")); } if (ttid) { code = AFSVolEndTrans(aconn, ttid, &rcode); code = (code ? code : rcode); if (code) { - fprintf(STDERR,"Could not end transaction on the volume %u\n", avolid); + fprintf(STDERR,"Could not end transaction on the volume %lu\n", + (unsigned long) avolid); PrintError("", code); if (!error) error = code; } @@ -964,7 +973,8 @@ int UV_MoveVolume(afs_int32 afromvol, afs_int32 afromserver, if ( !Lp_Match(atoserver, atopart, &entry) ) { /* the to server and partition do not exist in the vldb entry corresponding to volid */ - fprintf(STDERR,"The volume %u is not on the specified site. \n", afromvol); + fprintf(STDERR,"The volume %lu is not on the specified site. \n", + (unsigned long) afromvol); fprintf(STDERR,"The current site is :"); for (i=0; iserverNumber[index])); + fprintf(STDOUT,"Creating new volume %lu on replication site %s: ", + (unsigned long) volid, + hostutil_GetNameByINet(vldbEntryPtr->serverNumber[index])); fflush(STDOUT); } @@ -2537,7 +2571,8 @@ int UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afromp if (verbose) { if (fullrelease) { - fprintf(STDOUT,"This is a complete release of the volume %u\n", afromvol); + fprintf(STDOUT,"This is a complete release of the volume %lu\n", + (unsigned long) afromvol); } else { fprintf(STDOUT,"This is a completion of the previous release\n"); } @@ -2770,8 +2805,8 @@ int UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afromp if (!volcount) continue; if (verbose) { - fprintf(STDOUT,"Starting ForwardMulti from %u to %u on %s", - cloneVolId, entry.volumeId[ROVOL], + fprintf(STDOUT,"Starting ForwardMulti from %lu to %u on %s", + (unsigned long) cloneVolId, entry.volumeId[ROVOL], hostutil_GetNameByINet(entry.serverNumber[times[0].vldbEntryIndex])); for (s=1; svolFlags |= CLONEZAPPED; - if(!success) fprintf(STDERR,"Could not zap volume %u\n",curPtr->volCloneId); + if(!success) fprintf(STDERR,"Could not zap volume %lu\n", + (unsigned long) curPtr->volCloneId); if(success) VPRINT2("Clone of %s %u deleted\n", curPtr->volName,curPtr->volCloneId); curPos++; tid = 0; @@ -3882,7 +3957,8 @@ int UV_GenerateVolumeClones(afs_int32 aserver, afs_int32 apart, struct volDescri if(code){ curPtr->volFlags &= ~CLONEVALID; curPos++; - fprintf(STDERR,"Could not clone %s due to error %u\n", curPtr->volName,code); + fprintf(STDERR,"Could not clone %s due to error %lu\n", curPtr->volName, + (unsigned long) code); code=AFSVolEndTrans(aconn, tid, &rcode); if(code) fprintf(STDERR,"WARNING: could not end transaction\n"); @@ -4029,7 +4105,8 @@ int UV_ListOneVolume(afs_int32 aserver, afs_int32 apart, afs_int32 volid, struct aconn = UV_Bind(aserver,AFSCONF_VOLUMEPORT); code = AFSVolListOneVolume(aconn, apart, volid, &volumeInfo); if(code) { - fprintf(STDERR,"Could not fetch the information about volume %u from the server\n",volid); + fprintf(STDERR,"Could not fetch the information about volume %lu from the server\n", + (unsigned long) volid); } else{ *resultPtr = volumeInfo.volEntries_val; @@ -4151,7 +4228,8 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 if (++pass == 2) { code = ubik_Call(VL_SetLock, cstruct, 0, rwvolid, RWVOL, VLOP_DELETE); if (code) { - fprintf(STDERR, "Could not lock VLDB entry for %u\n", rwvolid); + fprintf(STDERR, "Could not lock VLDB entry for %lu\n", + (unsigned long) rwvolid); ERROR_EXIT(code); } islocked = 1; @@ -4165,7 +4243,8 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 code = VLDB_GetEntryByID(rwvolid, RWVOL, &entry); if (code) { if (code != VL_NOENT) { - fprintf(STDOUT,"Could not retreive the VLDB entry for volume %u \n", rwvolid); + fprintf(STDOUT,"Could not retreive the VLDB entry for volume %lu \n", + (unsigned long) rwvolid); ERROR_EXIT(code); } @@ -4214,11 +4293,12 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 /* The RW volume exists elsewhere - report this one a duplicate */ if (pass == 1) { MapPartIdIntoName(apart, pname); - fprintf(STDERR,"*** Warning: Orphaned RW volume %u exists on %s %s\n", - rwvolid, hostutil_GetNameByINet(aserver), pname); + fprintf(STDERR,"*** Warning: Orphaned RW volume %lu exists on %s %s\n", + (unsigned long) rwvolid, + hostutil_GetNameByINet(aserver), pname); MapPartIdIntoName(entry.serverPartition[idx], pname); - fprintf(STDERR," VLDB reports RW volume %u exists on %s %s\n", - rwvolid, + fprintf(STDERR," VLDB reports RW volume %lu exists on %s %s\n", + (unsigned long) rwvolid, hostutil_GetNameByINet(entry.serverNumber[idx]), pname); } } else { @@ -4233,8 +4313,9 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 entry.volumeId[BACKVOL], hostutil_GetNameByINet(entry.serverNumber[idx]), pname); MapPartIdIntoName(apart, pname); - fprintf(STDERR," VLDB reports its RW volume %u exists on %s %s\n", - rwvolid, hostutil_GetNameByINet(aserver), pname); + fprintf(STDERR," VLDB reports its RW volume %lu exists on %s %s\n", + (unsigned long) rwvolid, + hostutil_GetNameByINet(aserver), pname); } } } @@ -4293,11 +4374,12 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 /* VLDB says RW and/or BK is elsewhere - report this BK volume orphaned */ if (pass == 1) { MapPartIdIntoName(apart, pname); - fprintf(STDERR,"*** Warning: Orphaned BK volume %u exists on %s %s\n", - volumeinfo->volid, hostutil_GetNameByINet(aserver), pname); + fprintf(STDERR,"*** Warning: Orphaned BK volume %lu exists on %s %s\n", + (unsigned long) volumeinfo->volid, + hostutil_GetNameByINet(aserver), pname); MapPartIdIntoName(entry.serverPartition[idx], pname); - fprintf(STDERR," VLDB reports its RW/BK volume %u exists on %s %s\n", - rwvolid, + fprintf(STDERR," VLDB reports its RW/BK volume %lu exists on %s %s\n", + (unsigned long) rwvolid, hostutil_GetNameByINet(entry.serverNumber[idx]), pname); } } else { @@ -4312,14 +4394,15 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 MapPartIdIntoName(entry.serverPartition[idx], pname); fprintf(STDERR,"*** Warning: Orphaned BK volume %u exists on %s %s\n", entry.volumeId[BACKVOL], hostutil_GetNameByINet(aserver), pname); - fprintf(STDERR," VLDB reports its BK volume ID is %u\n", - volumeinfo->volid); + fprintf(STDERR," VLDB reports its BK volume ID is %lu\n", + (unsigned long) volumeinfo->volid); } } else { if (pass == 1) { MapPartIdIntoName(entry.serverPartition[idx], pname); - fprintf(STDERR,"*** Warning: Orphaned BK volume %u exists on %s %s\n", - volumeinfo->volid, hostutil_GetNameByINet(aserver), pname); + fprintf(STDERR,"*** Warning: Orphaned BK volume %lu exists on %s %s\n", + (unsigned long) volumeinfo->volid, + hostutil_GetNameByINet(aserver), pname); fprintf(STDERR," VLDB reports its BK volume ID is %u\n", entry.volumeId[BACKVOL]); } @@ -4387,8 +4470,8 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 fprintf(STDERR,"*** Warning: Orphaned RO volume %u exists on %s %s\n", entry.volumeId[ROVOL], hostutil_GetNameByINet(entry.serverNumber[j]), pname); - fprintf(STDERR," VLDB reports its RO volume ID is %u\n", - volumeinfo->volid); + fprintf(STDERR," VLDB reports its RO volume ID is %lu\n", + (unsigned long) volumeinfo->volid); } Lp_SetRWValue(entry, entry.serverNumber[idx], @@ -4409,8 +4492,9 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 */ if (pass == 1) { MapPartIdIntoName(apart, pname); - fprintf(STDERR,"*** Warning: Orphaned RO volume %u exists on %s %s\n", - volumeinfo->volid, hostutil_GetNameByINet(aserver), pname); + fprintf(STDERR,"*** Warning: Orphaned RO volume %lu exists on %s %s\n", + (unsigned long) volumeinfo->volid, + hostutil_GetNameByINet(aserver), pname); fprintf(STDERR," VLDB reports its RO volume ID is %u\n", entry.volumeId[ROVOL]); } @@ -4453,7 +4537,8 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 if (createentry) { code = VLDB_CreateEntry(&storeEntry); if (code) { - fprintf(STDOUT,"Could not create a VLDB entry for the volume %u\n", rwvolid); + fprintf(STDOUT,"Could not create a VLDB entry for the volume %lu\n", + (unsigned long) rwvolid); ERROR_EXIT(code); } } @@ -4462,7 +4547,8 @@ static afs_int32 CheckVolume(volintInfo *volumeinfo, afs_int32 aserver, afs_int3 code = VLDB_ReplaceEntry(rwvolid, RWVOL, &storeEntry, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP); if (code) { - fprintf(STDERR,"Could not update entry for %u\n", rwvolid); + fprintf(STDERR,"Could not update entry for %lu\n", + (unsigned long) rwvolid); ERROR_EXIT(code); } } @@ -4772,8 +4858,8 @@ int UV_SyncVldb(afs_int32 aserver, afs_int32 apart, int flags, int force) tentries++; if (verbose) { - fprintf(STDOUT,"Processing volume entry %d: %s (%u) on server %s %s...\n", - j+1, vi->name, vi->volid, + fprintf(STDOUT,"Processing volume entry %d: %s (%lu) on server %s %s...\n", + j+1, vi->name, (unsigned long) vi->volid, hostutil_GetNameByINet(aserver), pname); fflush(STDOUT); } @@ -5455,13 +5541,15 @@ int UV_VolumeZap(afs_int32 server, afs_int32 part, afs_int32 volid) aconn = UV_Bind(server, AFSCONF_VOLUMEPORT); code = AFSVolTransCreate(aconn, volid, part, ITOffline, &ttid); if(code){ - fprintf(STDERR,"Could not start transaction on volume %u\n",volid); + fprintf(STDERR,"Could not start transaction on volume %lu\n", + (unsigned long) volid); error = code; goto zfail; } code = AFSVolDeleteVolume(aconn, ttid); if(code){ - fprintf(STDERR,"Could not delete volume %u\n",volid); + fprintf(STDERR,"Could not delete volume %lu\n", + (unsigned long) volid); error = code; goto zfail; } @@ -5469,7 +5557,8 @@ int UV_VolumeZap(afs_int32 server, afs_int32 part, afs_int32 volid) ttid = 0; if(!code) code = rcode; if(code){ - fprintf(STDERR,"Could not end transaction on volume %u\n",volid); + fprintf(STDERR,"Could not end transaction on volume %lu\n", + (unsigned long) volid); error = code; goto zfail; } diff --git a/src/volser/vsutils.c b/src/volser/vsutils.c index 20b91c429..2bfc6eb77 100644 --- a/src/volser/vsutils.c +++ b/src/volser/vsutils.c @@ -583,7 +583,7 @@ char *astring; { str = astring; ptr = astring; tryname = 0; - while (curval = *str++){ + while ((curval = *str++)){ if(curval < '0' || curval > '9') tryname = 1; } @@ -605,7 +605,7 @@ char *astring; { } value = 0; - while (tc = *astring++) { + while ((tc = *astring++)) { if (tc & 0x80) { if(!tryname) fprintf(STDERR,"goofed in volid \n"); else {fprintf(STDERR,"Could not get entry from vldb for %s\n",ptr);PrintError("",vcode);} -- 2.39.5