From 89d85da6044a82eee34ef5c424921dad12b2ae7a Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 28 Dec 2012 00:46:12 -0500 Subject: [PATCH] vol: fix everything to use volumeid type use one type for volumeid, not 3. kill VolId, and stop using afs_uint32 (and a few times, afs_int32) Change-Id: Ibcbd09b5a24d8720b02a02f926e6f59dc0f529aa Reviewed-on: http://gerrit.openafs.org/8845 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Derrick Brashear --- src/WINNT/afssvrcfg/config_server_page.cpp | 1 + src/bozo/bos.c | 1 + src/bucoord/commands.c | 1 + src/bucoord/dsstub.c | 1 + src/bucoord/main.c | 1 + src/bucoord/ubik_db_if.c | 1 + src/bucoord/volstub.c | 1 + src/butc/dbentries.c | 1 + src/butc/dump.c | 1 + src/butc/lwps.c | 1 + src/config/stds.h | 1 + src/finale/translate_et.c | 1 + src/libadmin/adminutil/afs_utilAdmin.c | 2 +- src/libadmin/vos/afs_vosAdmin.c | 1 + src/tools/dumpscan/afsdump_dirlist.c | 1 + src/tools/dumpscan/afsdump_extract.c | 1 + src/tools/dumpscan/afsdump_scan.c | 1 + src/tools/dumpscan/dumptool.c | 12 +- src/tools/dumpscan/xf_rxcall.c | 1 + src/viced/afsfileprocs.c | 94 +++++------ src/viced/callback.c | 28 ++-- src/viced/callback.h | 2 +- src/viced/host.c | 4 +- src/viced/host.h | 2 +- src/viced/physio.c | 22 +-- src/viced/serialize_state.h | 2 +- src/viced/state_analyzer.c | 12 +- src/viced/viced_prototypes.h | 2 +- src/vol/clone.c | 13 +- src/vol/fssync-debug.c | 16 +- src/vol/fssync-server.c | 54 ++++--- src/vol/fssync.h | 6 +- src/vol/ihandle.h | 2 +- src/vol/listinodes.c | 14 +- src/vol/namei_ops.c | 66 ++++---- src/vol/namei_ops.h | 12 +- src/vol/nuke.c | 4 +- src/vol/physio.c | 4 +- src/vol/salvsync-server.c | 4 +- src/vol/salvsync.h | 2 +- src/vol/viceinode.h | 8 +- src/vol/vnode.c | 18 +-- src/vol/vol-info.c | 35 ++-- src/vol/vol-salvage.c | 131 +++++++-------- src/vol/vol-salvage.h | 4 +- src/vol/vol_internal.h | 2 +- src/vol/voldefs.h | 4 +- src/vol/volume.c | 149 ++++++++--------- src/vol/volume.h | 34 ++-- src/vol/vutil.c | 30 ++-- src/volser/common.c | 1 + src/volser/physio.c | 2 +- src/volser/physio.h | 2 +- src/volser/vol_split.c | 132 +++++++-------- src/volser/volprocs.c | 179 +++++++++++---------- src/volser/volser.p.h | 2 +- src/volser/volser_internal.h | 2 +- src/volser/voltrans.c | 8 +- 58 files changed, 596 insertions(+), 543 deletions(-) diff --git a/src/WINNT/afssvrcfg/config_server_page.cpp b/src/WINNT/afssvrcfg/config_server_page.cpp index dc9d27a28..dfbd38464 100644 --- a/src/WINNT/afssvrcfg/config_server_page.cpp +++ b/src/WINNT/afssvrcfg/config_server_page.cpp @@ -28,6 +28,7 @@ extern "C" { #include #include #include +#include #include #include #include diff --git a/src/bozo/bos.c b/src/bozo/bos.c index d52646655..24b9dc398 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -29,6 +29,7 @@ #include #include #include +#include #include static int IStatServer(struct cmd_syndesc *as, int int32p); diff --git a/src/bucoord/commands.c b/src/bucoord/commands.c index e69701561..48f82e0c8 100644 --- a/src/bucoord/commands.c +++ b/src/bucoord/commands.c @@ -24,6 +24,7 @@ #include #include #include /* PA */ +#include #include #include /* PA */ #include /* PA */ diff --git a/src/bucoord/dsstub.c b/src/bucoord/dsstub.c index 717ee3e98..bd9447b27 100644 --- a/src/bucoord/dsstub.c +++ b/src/bucoord/dsstub.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "bc.h" diff --git a/src/bucoord/main.c b/src/bucoord/main.c index c8bb725fe..414aa1f80 100644 --- a/src/bucoord/main.c +++ b/src/bucoord/main.c @@ -26,6 +26,7 @@ #include #include #include +#include #include /*VLDB_MAXSERVERS */ #include #include diff --git a/src/bucoord/ubik_db_if.c b/src/bucoord/ubik_db_if.c index aef496f18..33c9b4e93 100644 --- a/src/bucoord/ubik_db_if.c +++ b/src/bucoord/ubik_db_if.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/src/bucoord/volstub.c b/src/bucoord/volstub.c index e149f44ac..3839aa254 100644 --- a/src/bucoord/volstub.c +++ b/src/bucoord/volstub.c @@ -15,6 +15,7 @@ #include #include /*Misc server-side Volume Location stuff */ #include +#include #include #include "bc.h" diff --git a/src/butc/dbentries.c b/src/butc/dbentries.c index f7ee29013..a3faf8cfe 100644 --- a/src/butc/dbentries.c +++ b/src/butc/dbentries.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/butc/dump.c b/src/butc/dump.c index 2d95e09f6..5389a4667 100644 --- a/src/butc/dump.c +++ b/src/butc/dump.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/src/butc/lwps.c b/src/butc/lwps.c index bb5e63e52..b43449a02 100644 --- a/src/butc/lwps.c +++ b/src/butc/lwps.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/config/stds.h b/src/config/stds.h index b0b826531..6eecadd66 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -256,6 +256,7 @@ typedef struct afsUUID afsUUID; # define AFS_SIZET_FMT "lu" # endif /* PRINTF_TAKES_Z_LEN */ #endif /* AFS_NT40_ENV */ +#define AFS_VOLID_FMT "lu" /* Functions to safely cast afs_int32 and afs_uint32 so they can be used in * printf statemements with %ld and %lu diff --git a/src/finale/translate_et.c b/src/finale/translate_et.c index d76a43a2a..6e603b8dd 100644 --- a/src/finale/translate_et.c +++ b/src/finale/translate_et.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/src/libadmin/adminutil/afs_utilAdmin.c b/src/libadmin/adminutil/afs_utilAdmin.c index dfbfe73a4..05b66b5f0 100644 --- a/src/libadmin/adminutil/afs_utilAdmin.c +++ b/src/libadmin/adminutil/afs_utilAdmin.c @@ -30,8 +30,8 @@ #include #include #include -#include #include +#include #include "afs_AdminInternal.h" #include "afs_utilAdmin.h" diff --git a/src/libadmin/vos/afs_vosAdmin.c b/src/libadmin/vos/afs_vosAdmin.c index be15797fb..1fb8c00a5 100644 --- a/src/libadmin/vos/afs_vosAdmin.c +++ b/src/libadmin/vos/afs_vosAdmin.c @@ -16,6 +16,7 @@ #include #include +#include #include #include diff --git a/src/tools/dumpscan/afsdump_dirlist.c b/src/tools/dumpscan/afsdump_dirlist.c index bb0d2443d..0af2ed7d1 100644 --- a/src/tools/dumpscan/afsdump_dirlist.c +++ b/src/tools/dumpscan/afsdump_dirlist.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include diff --git a/src/tools/dumpscan/afsdump_extract.c b/src/tools/dumpscan/afsdump_extract.c index dec8dc848..98f3a0c27 100644 --- a/src/tools/dumpscan/afsdump_extract.c +++ b/src/tools/dumpscan/afsdump_extract.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include diff --git a/src/tools/dumpscan/afsdump_scan.c b/src/tools/dumpscan/afsdump_scan.c index 7a2abfcb2..dafae676b 100644 --- a/src/tools/dumpscan/afsdump_scan.c +++ b/src/tools/dumpscan/afsdump_scan.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include diff --git a/src/tools/dumpscan/dumptool.c b/src/tools/dumpscan/dumptool.c index 1b1c6ba1a..6f6e44fef 100644 --- a/src/tools/dumpscan/dumptool.c +++ b/src/tools/dumpscan/dumptool.c @@ -1443,15 +1443,19 @@ DirListInternal(struct vnodeData *vdata, char *pathnames[], int numpathnames, } else if (iflag) for (i = 0; i < numentries; i++) if (!(lvdata = GetVnode(ntohl(eplist[i]->fid.vnode)))) - printf("%d.0.0\t%s\n", - vol->parentId ? vol->parentId : vol->id, + printf("%" AFS_VOLID_FMT ".0.0\t%s\n", + vol->parentId ? afs_printable_VolumeId_lu(vol->parentId) + : afs_printable_VolumeId_lu(vol->id), eplist[i]->name); else if (path) - printf("%d.%d.%d\t%s/%s\n", vol->id, + printf("%" AFS_VOLID_FMT ".%d.%d\t%s/%s\n", + afs_printable_VolumeId_lu(vol->id), ntohl(eplist[i]->fid.vnode), ntohl(eplist[i]->fid.vunique), path, eplist[i]->name); else - printf("%d.%d.%d\t%s\n", vol->id, ntohl(eplist[i]->fid.vnode), + printf("%" AFS_VOLID_FMT ".%d.%d\t%s\n", + afs_printable_VolumeId_lu(vol->id), + ntohl(eplist[i]->fid.vnode), ntohl(eplist[i]->fid.vunique), eplist[i]->name); else if (lflag) { for (i = 0; i < numentries; i++) diff --git a/src/tools/dumpscan/xf_rxcall.c b/src/tools/dumpscan/xf_rxcall.c index e74eef417..deec1cb5c 100644 --- a/src/tools/dumpscan/xf_rxcall.c +++ b/src/tools/dumpscan/xf_rxcall.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index adf653f1a..468faffe8 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -283,8 +283,8 @@ CheckLength(struct Volume *vp, struct Vnode *vnp, afs_sfsize_t alen) fdP = IH_OPEN(vnp->handle); if (fdP == NULL) { - ViceLog(0, ("CheckLength: cannot open inode for fid %lu.%lu.%lu\n", - afs_printable_uint32_lu(vp->hashid), + ViceLog(0, ("CheckLength: cannot open inode for fid %" AFS_VOLID_FMT ".%lu.%lu\n", + afs_printable_VolumeId_lu(vp->hashid), afs_printable_uint32_lu(Vn_id(vnp)), afs_printable_uint32_lu(vnp->disk.uniquifier))); return -1; @@ -293,9 +293,9 @@ CheckLength(struct Volume *vp, struct Vnode *vnp, afs_sfsize_t alen) FDH_CLOSE(fdP); if (alen < 0) { afs_int64 alen64 = alen; - ViceLog(0, ("CheckLength: cannot get size for inode for fid " - "%lu.%lu.%lu; FDH_SIZE returned %" AFS_INT64_FMT "\n", - afs_printable_uint32_lu(vp->hashid), + ViceLog(0, ("CheckLength: cannot get size for inode for fid %" + AFS_VOLID_FMT ".%lu.%lu; FDH_SIZE returned %" AFS_INT64_FMT "\n", + afs_printable_VolumeId_lu(vp->hashid), afs_printable_uint32_lu(Vn_id(vnp)), afs_printable_uint32_lu(vnp->disk.uniquifier), alen64)); @@ -305,9 +305,9 @@ CheckLength(struct Volume *vp, struct Vnode *vnp, afs_sfsize_t alen) if (alen != vlen) { afs_int64 alen64 = alen, vlen64 = vlen; - ViceLog(0, ("Fid %lu.%lu.%lu has inconsistent length (index " + ViceLog(0, ("Fid %" AFS_VOLID_FMT ".%lu.%lu has inconsistent length (index " "%lld inode %lld ); volume must be salvaged\n", - afs_printable_uint32_lu(vp->hashid), + afs_printable_VolumeId_lu(vp->hashid), afs_printable_uint32_lu(Vn_id(vnp)), afs_printable_uint32_lu(vnp->disk.uniquifier), vlen64, alen64)); @@ -1286,16 +1286,16 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len) if (!VALID_INO(ino)) { free(buff); VTakeOffline(volptr); - ViceLog(0, ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ViceLog(0, ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return EIO; } targFdP = IH_OPEN(targetptr->handle); if (targFdP == NULL) { rc = errno; ViceLog(0, - ("CopyOnWrite failed: Failed to open target vnode %u in volume %u (errno = %d)\n", - targetptr->vnodeNumber, V_id(volptr), rc)); + ("CopyOnWrite failed: Failed to open target vnode %u in volume %" AFS_VOLID_FMT " (errno = %d)\n", + targetptr->vnodeNumber, afs_printable_VolumeId_lu(V_id(volptr)), rc)); free(buff); VTakeOffline(volptr); return rc; @@ -1310,8 +1310,8 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len) (int)targetptr->disk.dataVersion); if (!VALID_INO(ino)) { ViceLog(0, - ("CopyOnWrite failed: Partition %s that contains volume %u may be out of free inodes(errno = %d)\n", - volptr->partition->name, V_id(volptr), errno)); + ("CopyOnWrite failed: Partition %s that contains volume %" AFS_VOLID_FMT " may be out of free inodes(errno = %d)\n", + volptr->partition->name, afs_printable_VolumeId_lu(V_id(volptr)), errno)); FDH_CLOSE(targFdP); free(buff); return ENOSPC; @@ -1361,8 +1361,8 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len) if ((rdlen != length) || (wrlen != length)) { if ((wrlen < 0) && (errno == ENOSPC)) { /* disk full */ ViceLog(0, - ("CopyOnWrite failed: Partition %s containing volume %u is full\n", - volptr->partition->name, V_id(volptr))); + ("CopyOnWrite failed: Partition %s containing volume %" AFS_VOLID_FMT " is full\n", + volptr->partition->name, afs_printable_VolumeId_lu(V_id(volptr)))); /* remove destination inode which was partially copied till now */ FDH_REALLYCLOSE(newFdP); IH_RELEASE(newH); @@ -1370,8 +1370,8 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len) rc = IH_DEC(V_linkHandle(volptr), ino, V_parentId(volptr)); if (rc) { ViceLog(0, - ("CopyOnWrite failed: error %u after i_dec on disk full, volume %u in partition %s needs salvage\n", - rc, V_id(volptr), volptr->partition->name)); + ("CopyOnWrite failed: error %u after i_dec on disk full, volume %" AFS_VOLID_FMT " in partition %s needs salvage\n", + rc, afs_printable_VolumeId_lu(V_id(volptr)), volptr->partition->name)); VTakeOffline(volptr); } free(buff); @@ -1382,8 +1382,8 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len) * time, just case to an unsigned int for printing */ ViceLog(0, - ("CopyOnWrite failed: volume %u in partition %s (tried reading %u, read %u, wrote %u, errno %u) volume needs salvage\n", - V_id(volptr), volptr->partition->name, (unsigned)length, (unsigned)rdlen, + ("CopyOnWrite failed: volume %" AFS_VOLID_FMT " in partition %s (tried reading %u, read %u, wrote %u, errno %u) volume needs salvage\n", + afs_printable_VolumeId_lu(V_id(volptr)), volptr->partition->name, (unsigned)length, (unsigned)rdlen, (unsigned)wrlen, errno)); #if defined(AFS_DEMAND_ATTACH_FS) ViceLog(0, ("CopyOnWrite failed: requesting salvage\n")); @@ -1481,8 +1481,8 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr, if ((*targetptr)->disk.uniquifier != fileFid->Unique) { VTakeOffline(volptr); ViceLog(0, - ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); errorCode = VSALVAGE; return errorCode; } @@ -1513,8 +1513,8 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr, { VTakeOffline(volptr); ViceLog(0, - ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return (EIO); } DT1++; @@ -1539,8 +1539,8 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr, Directory) ? "directory" : "file"))); VTakeOffline(volptr); ViceLog(0, - ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); if (!errorCode) errorCode = code; } @@ -1805,14 +1805,16 @@ AdjustDiskUsage(Volume * volptr, afs_sfsize_t length, VAdjustDiskUsage(&nc, volptr, -length, 0); if (rc == VOVERQUOTA) { ViceLog(2, - ("Volume %u (%s) is full\n", V_id(volptr), + ("Volume %" AFS_VOLID_FMT " (%s) is full\n", + afs_printable_VolumeId_lu(V_id(volptr)), V_name(volptr))); return (rc); } if (rc == VDISKFULL) { ViceLog(0, - ("Partition %s that contains volume %u is full\n", - volptr->partition->name, V_id(volptr))); + ("Partition %s that contains volume %" AFS_VOLID_FMT " is full\n", + volptr->partition->name, + afs_printable_VolumeId_lu(V_id(volptr)))); return (rc); } ViceLog(0, ("Got error return %d from VAdjustDiskUsage\n", rc)); @@ -1873,8 +1875,8 @@ Alloc_NewVnode(Vnode * parentptr, DirHandle * dir, Volume * volptr, /* error in creating inode */ if (!VALID_INO(inode)) { ViceLog(0, - ("Volume : %u vnode = %u Failed to create inode: errno = %d\n", - V_id((*targetptr)->volumePtr), + ("Volume : %" AFS_VOLID_FMT " vnode = %u Failed to create inode: errno = %d\n", + afs_printable_VolumeId_lu(V_id((*targetptr)->volumePtr)), (*targetptr)->vnodeNumber, errno)); VAdjustDiskUsage(&temp, volptr, -BlocksPreallocatedForVnode, 0); (*targetptr)->delete = 1; /* delete vnode */ @@ -3770,8 +3772,8 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, if ((top == 1) && (testnode != 0)) { VTakeOffline(volptr); ViceLog(0, - ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); errorCode = EIO; goto Bad_Rename; } @@ -4102,8 +4104,8 @@ SAFSS_Symlink(struct rx_call *acall, struct AFSFid *DirFid, char *Name, (void)PutVolumePackage(acall, parentwhentargetnotdir, targetptr, parentptr, volptr, &client); VTakeOffline(volptr); - ViceLog(0, ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ViceLog(0, ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return EIO; } len = strlen((char *) LinkContents); @@ -6187,8 +6189,8 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr, fdP = IH_OPEN(ihP); if (fdP == NULL) { VTakeOffline(volptr); - ViceLog(0, ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ViceLog(0, ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return EIO; } optSize = sendBufSize; @@ -6198,8 +6200,8 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr, if (tlen < 0) { FDH_CLOSE(fdP); VTakeOffline(volptr); - ViceLog(0, ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ViceLog(0, ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return EIO; } if (CheckLength(volptr, targetptr, tlen)) { @@ -6242,8 +6244,8 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr, FDH_CLOSE(fdP); FreeSendBuffer((struct afs_buffer *)tbuffer); VTakeOffline(volptr); - ViceLog(0, ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ViceLog(0, ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return EIO; } nBytes = rx_Write(Call, tbuffer, wlen); @@ -6258,8 +6260,8 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr, if (nBytes != wlen) { FDH_CLOSE(fdP); VTakeOffline(volptr); - ViceLog(0, ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ViceLog(0, ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return EIO; } nBytes = rx_Writev(Call, tiov, tnio, wlen); @@ -6427,8 +6429,8 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, if (GetLinkCountAndSize(volptr, fdP, &linkCount, &DataLength) < 0) { FDH_CLOSE(fdP); VTakeOffline(volptr); - ViceLog(0, ("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ViceLog(0, ("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return EIO; } if (CheckLength(volptr, targetptr, DataLength)) { @@ -6479,8 +6481,8 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, } if (!VALID_INO(tinode)) { VTakeOffline(volptr); - ViceLog(0,("Volume %u now offline, must be salvaged.\n", - volptr->hashid)); + ViceLog(0,("Volume %" AFS_VOLID_FMT " now offline, must be salvaged.\n", + afs_printable_VolumeId_lu(volptr->hashid))); return EIO; } diff --git a/src/viced/callback.c b/src/viced/callback.c index fae956883..3c21a494a 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -99,6 +99,9 @@ #include #include #include +#include +#include +#include #include "viced_prototypes.h" #include "viced.h" @@ -1190,7 +1193,7 @@ MultiBreakVolumeLaterCallBack(struct host *host, void *rock) extern pthread_cond_t fsync_cond; int -BreakVolumeCallBacksLater(afs_uint32 volume) +BreakVolumeCallBacksLater(VolumeId volume) { int hash; afs_uint32 *feip; @@ -1199,7 +1202,8 @@ BreakVolumeCallBacksLater(afs_uint32 volume) struct host *host; int found = 0; - ViceLog(25, ("Setting later on volume %u\n", volume)); + ViceLog(25, ("Setting later on volume %" AFS_VOLID_FMT "\n", + afs_printable_VolumeId_lu(volume))); H_LOCK; for (hash = 0; hash < FEHASH_SIZE; hash++) { for (feip = &HashTable[hash]; (fe = itofe(*feip)) != NULL; ) { @@ -1260,8 +1264,8 @@ BreakLaterCallBacks(void) /* Ugly, but used to avoid left side casting */ struct object *tmpfe; ViceLog(125, - ("Unchaining for %u:%u:%u\n", fe->vnode, fe->unique, - fe->volid)); + ("Unchaining for %u:%u:%" AFS_VOLID_FMT "\n", fe->vnode, + fe->unique, afs_printable_VolumeId_lu(fe->volid))); fid.Volume = fe->volid; *feip = fe->fnext; fe->status &= ~FE_LATER; /* not strictly needed */ @@ -1301,9 +1305,10 @@ BreakLaterCallBacks(void) /* leave flag for MultiBreakVolumeCallBack to clear */ } else { ViceLog(125, - ("Found host %p (%s:%d) non-DELAYED cb for %u:%u:%u\n", + ("Found host %p (%s:%d) non-DELAYED cb for %u:%u:%" AFS_VOLID_FMT "\n", host, afs_inet_ntoa_r(host->host, hoststr), - ntohs(host->port), fe->vnode, fe->unique, fe->volid)); + ntohs(host->port), fe->vnode, fe->unique, + afs_printable_VolumeId_lu(fe->volid))); } } myfe = fe; @@ -1364,10 +1369,11 @@ CleanupTimedOutCallBacks_r(void) cb = itocb(cbi); cbi = cb->tnext; ViceLog(8, - ("CCB: deleting timed out call back %x (%s:%d), (%u,%u,%u)\n", + ("CCB: deleting timed out call back %x (%s:%d), (%" AFS_VOLID_FMT ",%u,%u)\n", h_itoh(cb->hhead)->host, afs_inet_ntoa_r(h_itoh(cb->hhead)->host, hoststr), - h_itoh(cb->hhead)->port, itofe(cb->fhead)->volid, + h_itoh(cb->hhead)->port, + afs_printable_VolumeId_lu(itofe(cb->fhead)->volid), itofe(cb->fhead)->vnode, itofe(cb->fhead)->unique)); HDel(cb); CDel(cb, 1); @@ -2916,9 +2922,9 @@ PrintCB(struct CallBack *cb, afs_uint32 now) if (fe == NULL) return; - printf("vol=%u vn=%u cbs=%d hi=%d st=%d fest=%d, exp in %lu secs at %s", - fe->volid, fe->vnode, fe->ncbs, cb->hhead, cb->status, fe->status, - expires - now, ctime(&expires)); + printf("vol=%" AFS_VOLID_FMT " vn=%u cbs=%d hi=%d st=%d fest=%d, exp in %lu secs at %s", + afs_printable_VolumeId_lu(fe->volid), fe->vnode, fe->ncbs, + cb->hhead, cb->status, fe->status, expires - now, ctime(&expires)); } #endif diff --git a/src/viced/callback.h b/src/viced/callback.h index 58e6ee0d4..8f5217790 100644 --- a/src/viced/callback.h +++ b/src/viced/callback.h @@ -51,7 +51,7 @@ struct cbstruct { struct FileEntry { afs_uint32 vnode; afs_uint32 unique; - afs_uint32 volid; + VolumeId volid; afs_uint32 fnext; /* index of next FE in hash chain */ afs_uint32 ncbs; /* number of callbacks for this FE */ afs_uint32 firstcb; /* index of first cb in per-FE list */ diff --git a/src/viced/host.c b/src/viced/host.c index 27aa92e32..654e0a4de 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -72,7 +72,7 @@ static struct rx_securityClass *sc = NULL; /* arguments for PerHost_EnumerateClient enumeration */ struct enumclient_args { - afs_int32 vid; + VolumeId vid; int (*proc)(struct client *client, void *rock); void *rock; }; @@ -2258,7 +2258,7 @@ PerHost_EnumerateClient(struct host *host, void *arock) } void -h_EnumerateClients(afs_int32 vid, +h_EnumerateClients(VolumeId vid, int (*proc)(struct client *client, void *rock), void *rock) { diff --git a/src/viced/host.h b/src/viced/host.h index ceded26b9..eb896302e 100644 --- a/src/viced/host.h +++ b/src/viced/host.h @@ -210,7 +210,7 @@ extern struct host *h_GetHost_r(struct rx_connection *tcon); extern struct client *h_FindClient_r(struct rx_connection *tcon); extern int h_ReleaseClient_r(struct client *client); extern void h_TossStuff_r(struct host *host); -extern void h_EnumerateClients(afs_int32 vid, +extern void h_EnumerateClients(VolumeId vid, int (*proc)(struct client *client, void *rock), void *arock); extern int GetClient(struct rx_connection *tcon, struct client **cp); diff --git a/src/viced/physio.c b/src/viced/physio.c index 45a635bbc..345c23d74 100644 --- a/src/viced/physio.c +++ b/src/viced/physio.c @@ -52,10 +52,11 @@ ReallyRead(DirHandle * file, int block, char *data) if (fdP == NULL) { code = errno; ViceLog(0, - ("ReallyRead(): open failed device %X inode %s (volume=%u) errno %d\n", + ("ReallyRead(): open failed device %X inode %s (volume=%" AFS_VOLID_FMT ") errno %d\n", file->dirh_handle->ih_dev, PrintInode(stmp, file->dirh_handle-> - ih_ino), file->dirh_handle->ih_vid,code)); + ih_ino), + afs_printable_VolumeId_lu(file->dirh_handle->ih_vid), code)); return code; } rdlen = FDH_PREAD(fdP, data, PAGESIZE, ((afs_foff_t)block) * PAGESIZE); @@ -65,10 +66,11 @@ ReallyRead(DirHandle * file, int block, char *data) else code = EIO; ViceLog(0, - ("ReallyRead(): read failed device %X inode %s (volume=%u) errno %d\n", + ("ReallyRead(): read failed device %X inode %s (volume=%" AFS_VOLID_FMT ") errno %d\n", file->dirh_handle->ih_dev, PrintInode(stmp, file->dirh_handle-> - ih_ino), file->dirh_handle->ih_vid,code)); + ih_ino), + afs_printable_VolumeId_lu(file->dirh_handle->ih_vid), code)); FDH_REALLYCLOSE(fdP); return code; } @@ -88,19 +90,21 @@ ReallyWrite(DirHandle * file, int block, char *data) fdP = IH_OPEN(file->dirh_handle); if (fdP == NULL) { ViceLog(0, - ("ReallyWrite(): open failed device %X inode %s (volume=%u) errno %d\n", + ("ReallyWrite(): open failed device %X inode %s (volume=%" AFS_VOLID_FMT ") errno %d\n", file->dirh_handle->ih_dev, PrintInode(stmp, file->dirh_handle-> - ih_ino), file->dirh_handle->ih_vid,errno)); + ih_ino), + afs_printable_VolumeId_lu(file->dirh_handle->ih_vid), errno)); lpErrno = errno; return 0; } if ((count = FDH_PWRITE(fdP, data, PAGESIZE, ((afs_foff_t)block) * PAGESIZE)) != PAGESIZE) { ViceLog(0, - ("ReallyWrite(): write failed device %X inode %s (volume=%u) errno %d\n", + ("ReallyWrite(): write failed device %X inode %s (volume=%" AFS_VOLID_FMT ") errno %d\n", file->dirh_handle->ih_dev, PrintInode(stmp, file->dirh_handle-> - ih_ino), file->dirh_handle->ih_vid,errno)); + ih_ino), + afs_printable_VolumeId_lu(file->dirh_handle->ih_vid), errno)); lpCount = count; lpErrno = errno; FDH_REALLYCLOSE(fdP); @@ -159,7 +163,7 @@ FidEq(DirHandle * afile, DirHandle * bfile) } int -FidVolEq(DirHandle * afile, afs_int32 vid) +FidVolEq(DirHandle * afile, VolumeId vid) { if (afile->dirh_vid != vid) return 0; diff --git a/src/viced/serialize_state.h b/src/viced/serialize_state.h index 2d095dfdc..c8e021b69 100644 --- a/src/viced/serialize_state.h +++ b/src/viced/serialize_state.h @@ -195,7 +195,7 @@ typedef afs_uint32 active_volume_state_avehash_entry; /* active volume entry */ struct AVDiskEntry { - afs_uint32 volume; + VolumeId volume; afs_uint32 partition; afs_uint32 hash_next; }; diff --git a/src/viced/state_analyzer.c b/src/viced/state_analyzer.c index 40f68c5e3..184a9c80f 100644 --- a/src/viced/state_analyzer.c +++ b/src/viced/state_analyzer.c @@ -26,11 +26,17 @@ #include #include #include +#include +#include +#include #include #include #include #include #include +#include +#include +#include #include #include #include @@ -123,7 +129,7 @@ static int get_cb_entry(void); static int find_fe_by_index(afs_uint32 idx); static int find_cb_by_index(afs_uint32 idx); -static int find_fe_by_fid(afs_uint32 vol, afs_uint32 vn, afs_uint32 uniq); +static int find_fe_by_fid(VolumeId vol, afs_uint32 vn, afs_uint32 uniq); static int dump_fd = -1; @@ -1342,7 +1348,7 @@ dump_fe_entry(void) DPFSO1("fe"); DPFV2("vnode", "u", fe_cursor.fe.fe.vnode); DPFV2("unique", "u", fe_cursor.fe.fe.unique); - DPFV2("volid", "u", fe_cursor.fe.fe.volid); + DPFV2("volid", AFS_VOLID_FMT, afs_printable_VolumeId_lu(fe_cursor.fe.fe.volid)); DPFV2("fnext", "u", fe_cursor.fe.fe.fnext); DPFV2("ncbs", "u", fe_cursor.fe.fe.ncbs); DPFV2("firstcb", "u", fe_cursor.fe.fe.firstcb); @@ -1890,7 +1896,7 @@ find_fe_by_index(afs_uint32 idx) } static int -find_fe_by_fid(afs_uint32 volid, afs_uint32 vnode, afs_uint32 unique) +find_fe_by_fid(VolumeId volid, afs_uint32 vnode, afs_uint32 unique) { int i; diff --git a/src/viced/viced_prototypes.h b/src/viced/viced_prototypes.h index 55eaff48b..544bde310 100644 --- a/src/viced/viced_prototypes.h +++ b/src/viced/viced_prototypes.h @@ -22,7 +22,7 @@ extern afs_int32 PctSpare; /* callback.c */ extern int InitCallBack(int); extern int BreakLaterCallBacks(void); -extern int BreakVolumeCallBacksLater(afs_uint32); +extern int BreakVolumeCallBacksLater(VolumeId); #ifdef AFS_DEMAND_ATTACH_FS /* diff --git a/src/vol/clone.c b/src/vol/clone.c index 8cc5ad446..dfe67cad2 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -256,9 +256,9 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone) } else if (rwinode) { if (IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) { - Log("IH_INC failed: %"AFS_PTR_FMT", %s, %u errno %d\n", + Log("IH_INC failed: %"AFS_PTR_FMT", %s, %" AFS_VOLID_FMT " errno %d\n", V_linkHandle(rwvp), PrintInode(stmp, rwinode), - V_parentId(rwvp), errno); + afs_printable_VolumeId_lu(V_parentId(rwvp)), errno); VForceOffline(rwvp); ERROR_EXIT(EIO); } @@ -309,9 +309,9 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone) if (inodeinced) { if (IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) { - Log("IH_DEC failed: %"AFS_PTR_FMT", %s, %u errno %d\n", + Log("IH_DEC failed: %"AFS_PTR_FMT", %s, %" AFS_VOLID_FMT " errno %d\n", V_linkHandle(rwvp), PrintInode(stmp, rwinode), - V_parentId(rwvp), errno); + afs_printable_VolumeId_lu(V_parentId(rwvp)), errno); VForceOffline(rwvp); ERROR_EXIT(EIO); } @@ -426,8 +426,9 @@ CloneVolume(Error * rerror, Volume * original, Volume * new, Volume * old) if (code) ERROR_EXIT(code); if (filecount != V_filecount(original) || diskused != V_diskused(original)) - Log("Clone %u: filecount %d -> %d diskused %d -> %d\n", - V_id(original), filecount, V_filecount(original), diskused, V_diskused(original)); + Log("Clone %" AFS_VOLID_FMT ": filecount %d -> %d diskused %d -> %d\n", + afs_printable_VolumeId_lu(V_id(original)), filecount, + V_filecount(original), diskused, V_diskused(original)); code = CopyVolumeHeader(&V_disk(original), &V_disk(new)); if (code) diff --git a/src/vol/fssync-debug.c b/src/vol/fssync-debug.c index c65fc5174..7f11e18e1 100644 --- a/src/vol/fssync-debug.c +++ b/src/vol/fssync-debug.c @@ -58,7 +58,7 @@ int VolumeChanged; /* hack to make dir package happy */ struct volop_state { - afs_uint32 volume; + VolumeId volume; afs_uint32 vnode; afs_uint32 unique; char partName[16]; @@ -698,7 +698,7 @@ VolQuery(struct cmd_syndesc * as, void * rock) memcpy(&v, res.payload.buf, sizeof(Volume)); printf("volume = {\n"); - printf("\thashid = %u\n", v.hashid); + printf("\thashid = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.hashid)); printf("\theader = %p\n", v.header); printf("\tdevice = %d\n", v.device); printf("\tpartition = %p\n", v.partition); @@ -820,7 +820,7 @@ VolHdrQuery(struct cmd_syndesc * as, void * rock) printf("\t\tversion = %u\n", v.stamp.version); printf("\t}\n"); - printf("\tid = %u\n", v.id); + printf("\tid = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.id)); printf("\tname = '%s'\n", v.name); if (v.inUse != 0) { printf("\tinUse = %d (%s)\n", v.inUse, VPTypeToString(v.inUse)); @@ -832,10 +832,10 @@ VolHdrQuery(struct cmd_syndesc * as, void * rock) printf("\tneedsSalvaged = %d\n", v.needsSalvaged); printf("\tuniquifier = %u\n", v.uniquifier); printf("\ttype = %d\n", v.type); - printf("\tparentId = %u\n", v.parentId); - printf("\tcloneId = %u\n", v.cloneId); - printf("\tbackupId = %u\n", v.backupId); - printf("\trestoredFromId = %u\n", v.restoredFromId); + printf("\tparentId = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.parentId)); + printf("\tcloneId = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.cloneId)); + printf("\tbackupId = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.backupId)); + printf("\trestoredFromId = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(v.restoredFromId)); printf("\tneedsCallback = %d\n", v.needsCallback); printf("\tdestroyMe = %d\n", v.destroyMe); printf("\tdontSalvage = %d\n", v.dontSalvage); @@ -908,7 +908,7 @@ VolOpQuery(struct cmd_syndesc * as, void * rock) printf("\t}\n"); printf("\tvop = {\n"); - printf("\t\tvolume = %u\n", vop.vop.volume); + printf("\t\tvolume = %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(vop.vop.volume)); if (strnlen(vop.vop.partName, sizeof(vop.vop.partName)) < sizeof(vop.vop.partName)) { printf("\t\tpartName = '%s'\n", vop.vop.partName); diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index 536aa0dc1..8ede22b0b 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -367,7 +367,7 @@ FSYNC_salvageThread(void * args) if (node->update_salv_prio) { if (VUpdateSalvagePriority_r(vp)) { ViceLog(0, ("FSYNC_salvageThread: unable to raise salvage priority " - "for volume %lu\n", afs_printable_uint32_lu(vp->hashid))); + "for volume %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(vp->hashid))); } } @@ -411,8 +411,8 @@ FSYNC_backgroundSalvage(Volume *vp) node->update_salv_prio = vp->salvage.requested; if (VRequestSalvage_r(&ec, vp, SALVSYNC_ERROR, 0)) { - ViceLog(0, ("FSYNC_backgroundSalvage: unable to request salvage for volume %lu\n", - afs_printable_uint32_lu(vp->hashid))); + ViceLog(0, ("FSYNC_backgroundSalvage: unable to request salvage for volume %" AFS_VOLID_FMT "\n", + afs_printable_VolumeId_lu(vp->hashid))); } queue_Append(&fsync_salv.head, node); @@ -704,10 +704,10 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res) (vcom->hdr->programType != vp->pending_vol_op->com.programType)) { /* a different program has this volume checked out. deny. */ Log("FSYNC_VolOn: WARNING: program type %u has attempted to manipulate " - "state for volume %u using command code %u while the volume is " + "state for volume %" AFS_VOLID_FMT " using command code %u while the volume is " "checked out by program type %u for command code %u.\n", vcom->hdr->programType, - vcom->vop->volume, + afs_printable_VolumeId_lu(vcom->vop->volume), vcom->hdr->command, vp->pending_vol_op->com.programType, vp->pending_vol_op->com.command); @@ -784,7 +784,7 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res) } #else /* !AFS_DEMAND_ATTACH_FS */ tvolName[0] = OS_DIRSEPC; - snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, afs_printable_uint32_lu(vcom->vop->volume)); + snprintf(&tvolName[1], sizeof(tvolName)-1, VFORMAT, afs_printable_VolumeId_lu(vcom->vop->volume)); tvolName[sizeof(tvolName)-1] = '\0'; vp = VAttachVolumeByName_r(&error, vcom->vop->partName, tvolName, @@ -893,37 +893,38 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res) if (vp->pending_vol_op->com.command == FSYNC_VOL_OFF && vp->pending_vol_op->com.reason == FSYNC_SALVAGE) { - Log("denying offline request for volume %lu; volume is salvaging\n", - afs_printable_uint32_lu(vp->hashid)); + Log("denying offline request for volume %" AFS_VOLID_FMT "; volume is salvaging\n", + afs_printable_VolumeId_lu(vp->hashid)); res->hdr.reason = FSYNC_SALVAGE; goto deny; } - Log("volume %u already checked out\n", vp->hashid); + Log("volume %" AFS_VOLID_FMT " already checked out\n", + afs_printable_VolumeId_lu(vp->hashid)); /* XXX debug */ - Log("vp->vop = { com = { ver=%u, prog=%d, com=%d, reason=%d, len=%u, flags=0x%x }, vop = { vol=%u, part='%s' } }\n", + Log("vp->vop = { com = { ver=%u, prog=%d, com=%d, reason=%d, len=%u, flags=0x%x }, vop = { vol=%" AFS_VOLID_FMT ", part='%s' } }\n", vp->pending_vol_op->com.proto_version, vp->pending_vol_op->com.programType, vp->pending_vol_op->com.command, vp->pending_vol_op->com.reason, vp->pending_vol_op->com.command_len, vp->pending_vol_op->com.flags, - vp->pending_vol_op->vop.volume, + afs_printable_VolumeId_lu(vp->pending_vol_op->vop.volume), vp->pending_vol_op->vop.partName ); - Log("vcom = { com = { ver=%u, prog=%d, com=%d, reason=%d, len=%u, flags=0x%x } , vop = { vol=%u, part='%s' } }\n", + Log("vcom = { com = { ver=%u, prog=%d, com=%d, reason=%d, len=%u, flags=0x%x } , vop = { vol=%" AFS_VOLID_FMT ", part='%s' } }\n", vcom->hdr->proto_version, vcom->hdr->programType, vcom->hdr->command, vcom->hdr->reason, vcom->hdr->command_len, vcom->hdr->flags, - vcom->vop->volume, + afs_printable_VolumeId_lu(vcom->vop->volume), vcom->vop->partName); res->hdr.reason = FSYNC_EXCLUSIVE; goto deny; } else { - Log("warning: volume %u recursively checked out by programType id %d\n", - vp->hashid, vcom->hdr->programType); + Log("warning: volume %" AFS_VOLID_FMT " recursively checked out by programType id %d\n", + afs_printable_VolumeId_lu(vp->hashid), vcom->hdr->programType); } } @@ -965,8 +966,8 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res) case volumeUtility: case volumeServer: if (VIsSalvaging(vp)) { - Log("denying offline request for volume %lu; volume is in salvaging state\n", - afs_printable_uint32_lu(vp->hashid)); + Log("denying offline request for volume %" AFS_VOLID_FMT "; volume is in salvaging state\n", + afs_printable_VolumeId_lu(vp->hashid)); res->hdr.reason = FSYNC_SALVAGE; /* the volume hasn't been checked out yet by the salvager, @@ -1038,8 +1039,9 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res) break; } - Log("FSYNC_com_VolOff: failed to get heavyweight reference to volume %u (state=%u, flags=0x%x)\n", - vcom->vop->volume, V_attachState(vp), V_attachFlags(vp)); + Log("FSYNC_com_VolOff: failed to get heavyweight reference to volume %" AFS_VOLID_FMT " (state=%u, flags=0x%x)\n", + afs_printable_VolumeId_lu(vcom->vop->volume), + V_attachState(vp), V_attachFlags(vp)); res->hdr.reason = FSYNC_VOL_PKG_ERROR; goto deny; } else if (nvp != vp) { @@ -1062,8 +1064,8 @@ FSYNC_com_VolOff(FSSYNC_VolOp_command * vcom, SYNC_response * res) if (VVolOpLeaveOnline_r(vp, &info)) { VUpdateVolume_r(&error, vp, VOL_UPDATE_WAIT); /* At least get volume stats right */ if (LogLevel) { - Log("FSYNC: Volume %u (%s) was left on line for an external %s request\n", - V_id(vp), V_name(vp), + Log("FSYNC: Volume %" AFS_VOLID_FMT " (%s) was left on line for an external %s request\n", + afs_printable_VolumeId_lu(V_id(vp)), V_name(vp), vcom->hdr->reason == V_CLONE ? "clone" : vcom->hdr->reason == V_READONLY ? "readonly" : vcom->hdr->reason == V_DUMP ? "dump" : @@ -1194,8 +1196,8 @@ FSYNC_com_VolMove(FSSYNC_VolOp_command * vcom, SYNC_response * res) } if ((code == SYNC_OK) && (V_BreakVolumeCallbacks != NULL)) { - Log("fssync: volume %u moved to %x; breaking all call backs\n", - vcom->vop->volume, vcom->hdr->reason); + Log("fssync: volume %" AFS_VOLID_FMT " moved to %x; breaking all call backs\n", + afs_printable_VolumeId_lu(vcom->vop->volume), vcom->hdr->reason); VOL_UNLOCK; (*V_BreakVolumeCallbacks) (vcom->vop->volume); VOL_LOCK; @@ -1411,8 +1413,8 @@ FSYNC_com_VolBreakCBKs(FSSYNC_VolOp_command * vcom, SYNC_response * res) { /* if the volume is being restored, break all callbacks on it */ if (V_BreakVolumeCallbacks) { - Log("fssync: breaking all call backs for volume %u\n", - vcom->vop->volume); + Log("fssync: breaking all call backs for volume %" AFS_VOLID_FMT "\n", + afs_printable_VolumeId_lu(vcom->vop->volume)); VOL_UNLOCK; (*V_BreakVolumeCallbacks) (vcom->vop->volume); VOL_LOCK; @@ -2011,7 +2013,7 @@ FSYNC_Drop(osi_socket fd) } #else tvolName[0] = OS_DIRSEPC; - sprintf(&tvolName[1], VFORMAT, afs_printable_uint32_lu(p[i].volumeID)); + sprintf(&tvolName[1], VFORMAT, afs_printable_VolumeId_lu(p[i].volumeID)); vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName, V_VOLUPD); if (vp) diff --git a/src/vol/fssync.h b/src/vol/fssync.h index e9bdf8b6b..d596cb76e 100644 --- a/src/vol/fssync.h +++ b/src/vol/fssync.h @@ -87,7 +87,7 @@ enum FSYNCReasonCode { /* FSYNC flag codes */ struct offlineInfo { - afs_uint32 volumeID; + VolumeId volumeID; char partName[16]; }; @@ -95,7 +95,7 @@ struct offlineInfo { * fssync protocol volume operation request message. */ typedef struct FSSYNC_VolOp_hdr { - afs_uint32 volume; /**< volume id associated with request */ + VolumeId volume; /**< volume id associated with request */ char partName[16]; /**< partition name, e.g. /vicepa */ } FSSYNC_VolOp_hdr; @@ -157,7 +157,7 @@ typedef struct FSSYNC_StatsOp_command { * fssync protocol vnode query request message. */ typedef struct FSSYNC_VnQry_hdr { - afs_uint32 volume; /**< volume id */ + VolumeId volume; /**< volume id */ afs_uint32 vnode; /**< vnode id */ afs_uint32 unique; /**< uniqifier */ afs_uint32 spare; /**< reserved for future use */ diff --git a/src/vol/ihandle.h b/src/vol/ihandle.h index 88b54c4c4..4a1ae6352 100644 --- a/src/vol/ihandle.h +++ b/src/vol/ihandle.h @@ -253,7 +253,7 @@ typedef struct ih_init_params /* Inode handle */ typedef struct IHandle_s { - afs_uint32 ih_vid; /* Parent volume id. */ + VolumeId ih_vid; /* Parent volume id. */ int ih_dev; /* device id. */ int ih_flags; /* Flags */ int ih_synced; /* should be synced next time */ diff --git a/src/vol/listinodes.c b/src/vol/listinodes.c index b05776e85..d094a184f 100644 --- a/src/vol/listinodes.c +++ b/src/vol/listinodes.c @@ -36,7 +36,7 @@ */ int ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, - afs_uint32 (*judgeInode) (), afs_uint32 judgeParam, int *forcep, int forceR, + afs_uint32 (*judgeInode) (), VolumeId judgeParam, int *forcep, int forceR, char *wpath, void *rock) { Log("ListViceInodes not implemented for this platform!\n"); @@ -159,7 +159,7 @@ struct dinode *ginode(); int ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, - int (*judgeInode) (), afs_uint32 judgeParam, int *forcep, int forceR, + int (*judgeInode) (), VolumeId judgeParam, int *forcep, int forceR, char *wpath, void *rock) { char dev[50], rdev[51]; @@ -600,7 +600,7 @@ xfs_RenameFiles(char *dir, xfs_Rename_t * renames, int n_renames) int xfs_ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, - int (*judgeInode) (), afs_uint32 judgeParam, int *forcep, + int (*judgeInode) (), VolumeId judgeParam, int *forcep, int forceR, char *wpath, void *rock) { i_list_inode_t info; @@ -794,7 +794,7 @@ xfs_ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, int ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, - int (*judgeInode) (), afs_uint32 judgeParam, int *forcep, int forceR, + int (*judgeInode) (), VolumeId judgeParam, int *forcep, int forceR, char *wpath, void *rock) { char dev[50], rdev[51]; @@ -859,7 +859,7 @@ BUFAREA sblk; extern char *afs_rawname(); int ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, - int (*judgeInode) (), afs_uint32 judgeParam, int *forcep, int forceR, + int (*judgeInode) (), VolumeId judgeParam, int *forcep, int forceR, char *wpath, void *rock) { union { @@ -1245,7 +1245,7 @@ bread(FD_t fd, char *buf, daddr_t blk, afs_int32 size) #endif /* AFS_LINUX20_ENV */ static afs_int32 -convertVolumeInfo(FdHandle_t *fdhr, FdHandle_t *fdhw, afs_uint32 vid) +convertVolumeInfo(FdHandle_t *fdhr, FdHandle_t *fdhw, VolumeId vid) { struct VolumeDiskData vd; char *p; @@ -1333,7 +1333,7 @@ getDevName(char *pbuffer, char *wpath) #ifdef FSSYNC_BUILD_CLIENT int -inode_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId) +inode_ConvertROtoRWvolume(char *pname, VolumeId volumeId) { char dir_name[512], oldpath[512], newpath[512]; char volname[20]; diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index 53622a690..c48c1b2f1 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -599,7 +599,7 @@ namei_RemoveDataDirectories(namei_t * name) * types, but if we get that far, this could should be dead by then. */ Inode -namei_MakeSpecIno(int volid, int type) +namei_MakeSpecIno(VolumeId volid, int type) { Inode ino; ino = NAMEI_INODESPECIAL; @@ -1166,8 +1166,8 @@ namei_dec(IHandle_t * ih, Inode ino, int p1) } else { IHandle_t *th; IH_INIT(th, ih->ih_dev, ih->ih_vid, ino); - Log("Warning: Lost ref on ihandle dev %d vid %d ino %lld\n", - th->ih_dev, th->ih_vid, (afs_int64)th->ih_ino); + Log("Warning: Lost ref on ihandle dev %d vid %" AFS_VOLID_FMT " ino %lld\n", + th->ih_dev, afs_printable_VolumeId_lu(th->ih_vid), (afs_int64)th->ih_ino); IH_RELEASE(th); /* If we're less than 0, someone presumably unlinked; @@ -1673,15 +1673,15 @@ namei_SetLinkCount(FdHandle_t * fdP, Inode ino, int count, int locked) /* ListViceInodes - write inode data to a results file. */ static int DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, - unsigned int volid); -static int DecodeVolumeName(char *name, unsigned int *vid); + VolumeId volid); +static int DecodeVolumeName(char *name, VolumeId *vid); static int namei_ListAFSSubDirs(IHandle_t * dirIH, int (*write_fun) (FD_t, struct ViceInodeInfo *, char *, char *), FD_t fp, int (*judgeFun) (struct ViceInodeInfo *, - afs_uint32 vid, void *), - afs_uint32 singleVolumeNumber, void *rock); + VolumeId vid, void *), + VolumeId singleVolumeNumber, void *rock); /* WriteInodeInfo @@ -1745,8 +1745,8 @@ VerifyDirPerms(char *path) */ int ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, - int (*judgeInode) (struct ViceInodeInfo * info, afs_uint32 vid, void *rock), - afs_uint32 singleVolumeNumber, int *forcep, int forceR, char *wpath, + int (*judgeInode) (struct ViceInodeInfo * info, VolumeId vid, void *rock), + VolumeId singleVolumeNumber, int *forcep, int forceR, char *wpath, void *rock) { int ninodes; @@ -1812,8 +1812,8 @@ namei_ListAFSFiles(char *dev, int (*writeFun) (FD_t, struct ViceInodeInfo *, char *, char *), FD_t fp, - int (*judgeFun) (struct ViceInodeInfo *, afs_uint32, void *), - afs_uint32 singleVolumeNumber, void *rock) + int (*judgeFun) (struct ViceInodeInfo *, VolumeId, void *), + VolumeId singleVolumeNumber, void *rock) { IHandle_t ih; namei_t name; @@ -1929,8 +1929,8 @@ _namei_examine_special(char * path1, int (*writeFun) (FD_t, struct ViceInodeInfo *, char *, char *), FD_t fp, - int (*judgeFun) (struct ViceInodeInfo *, afs_uint32, void *), - int singleVolumeNumber, + int (*judgeFun) (struct ViceInodeInfo *, VolumeId, void *), + VolumeId singleVolumeNumber, void *rock) { int ret = 0; @@ -1948,9 +1948,9 @@ _namei_examine_special(char * path1, * consistent with VGID encoded in namei path */ Log("namei_ListAFSSubDirs: warning: inconsistent linktable " "filename \"%s" OS_DIRSEP "%s\"; salvager will delete it " - "(dir_vgid=%u, inode_vgid=%u)\n", - path1, dname, myIH->ih_vid, - info.u.param[0]); + "(dir_vgid=%" AFS_VOLID_FMT ", inode_vgid=%" AFS_VOLID_FMT ")\n", + path1, dname, afs_printable_VolumeId_lu(myIH->ih_vid), + afs_printable_VolumeId_lu(info.u.param[0])); } else { char path2[512]; /* Open this handle */ @@ -2012,8 +2012,8 @@ _namei_examine_reg(char * path3, int (*writeFun) (FD_t, struct ViceInodeInfo *, char *, char *), FD_t fp, - int (*judgeFun) (struct ViceInodeInfo *, afs_uint32, void *), - int singleVolumeNumber, + int (*judgeFun) (struct ViceInodeInfo *, VolumeId, void *), + VolumeId singleVolumeNumber, void *rock) { int ret = 0; @@ -2083,8 +2083,8 @@ struct listsubdirs_work_node { int (*writeFun) (FD_t, struct ViceInodeInfo *, char *, char *); /** inode filter function */ - int (*judgeFun) (struct ViceInodeInfo *, afs_uint32, void *); - int singleVolumeNumber; /**< volume id filter */ + int (*judgeFun) (struct ViceInodeInfo *, VolumeId, void *); + VolumeId singleVolumeNumber; /**< volume id filter */ void * rock; /**< pointer passed to writeFun and judgeFun */ int code; /**< return code from examine function */ int special; /**< asserted when this is a volume @@ -2410,8 +2410,8 @@ namei_ListAFSSubDirs(IHandle_t * dirIH, int (*writeFun) (FD_t, struct ViceInodeInfo *, char *, char *), FD_t fp, - int (*judgeFun) (struct ViceInodeInfo *, afs_uint32, void *), - afs_uint32 singleVolumeNumber, void *rock) + int (*judgeFun) (struct ViceInodeInfo *, VolumeId, void *), + VolumeId singleVolumeNumber, void *rock) { int code = 0, ret = 0; IHandle_t myIH = *dirIH; @@ -2515,8 +2515,8 @@ namei_ListAFSSubDirs(IHandle_t * dirIH, #endif if (linkHandle.fd_fd == INVALID_FD) { - Log("namei_ListAFSSubDirs: warning: VG %u does not have a link table; " - "salvager will recreate it.\n", dirIH->ih_vid); + Log("namei_ListAFSSubDirs: warning: VG %" AFS_VOLID_FMT " does not have a link table; " + "salvager will recreate it.\n", afs_printable_VolumeId_lu(dirIH->ih_vid)); } /* Now run through all the other subdirs */ @@ -2643,7 +2643,7 @@ namei_ListAFSSubDirs(IHandle_t * dirIH, #ifdef AFS_NT40_ENV static int -DecodeVolumeName(char *name, unsigned int *vid) +DecodeVolumeName(char *name, VolumeId *vid) { /* Name begins with "Vol_" and ends with .data. See nt_HandleToVolDir() */ char stmp[32]; @@ -2663,7 +2663,7 @@ DecodeVolumeName(char *name, unsigned int *vid) } #else static int -DecodeVolumeName(char *name, unsigned int *vid) +DecodeVolumeName(char *name, VolumeId *vid) { if (strlen(name) < 1) return -1; @@ -2681,7 +2681,7 @@ DecodeVolumeName(char *name, unsigned int *vid) #ifdef AFS_NT40_ENV static int DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, - unsigned int volid) + VolumeId volid) { char fpath[512]; int tag, vno; @@ -2757,7 +2757,7 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, #else static int DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, - unsigned int volid) + VolumeId volid) { char fpath[512]; struct afs_stat_st status; @@ -2806,15 +2806,15 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, #ifdef FSSYNC_BUILD_CLIENT static afs_int32 -convertVolumeInfo(FD_t fdr, FD_t fdw, afs_uint32 vid) +convertVolumeInfo(FD_t fdr, FD_t fdw, VolumeId vid) { struct VolumeDiskData vd; char *p; if (OS_READ(fdr, &vd, sizeof(struct VolumeDiskData)) != sizeof(struct VolumeDiskData)) { - Log("1 convertVolumeInfo: read failed for %lu with code %d\n", - afs_printable_uint32_lu(vid), + Log("1 convertVolumeInfo: read failed for %" AFS_VOLID_FMT " with code %d\n", + afs_printable_VolumeId_lu(vid), errno); return -1; } @@ -2876,7 +2876,7 @@ convertVolumeInfo(FD_t fdr, FD_t fdw, afs_uint32 vid) */ int -namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId) +namei_ConvertROtoRWvolume(char *pname, VolumeId volumeId) { int code = 0; #ifdef FSSYNC_BUILD_CLIENT @@ -3003,7 +3003,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId) largeSeen = 1; } else { closedir(dirp); - Log("1 namei_ConvertROtoRWvolume: unknown type %d of special file found : %s" OS_DIRSEP "%s\n", info.u.param[2], dir_name, dp->d_name); + Log("1 namei_ConvertROtoRWvolume: unknown type %u of special file found : %s" OS_DIRSEP "%s\n", info.u.param[2], dir_name, dp->d_name); code = -1; goto done; } diff --git a/src/vol/namei_ops.h b/src/vol/namei_ops.h index 9b8053562..d3cf996dd 100644 --- a/src/vol/namei_ops.h +++ b/src/vol/namei_ops.h @@ -19,7 +19,7 @@ extern FD_t namei_fdopen(IHandle_t * h, char *fdperms); extern int namei_unlink(char *name); /* Inode operations */ -extern Inode namei_MakeSpecIno(int volid, int type); +extern Inode namei_MakeSpecIno(VolumeId volid, int type); extern Inode namei_icreate(IHandle_t * lh, char *part, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4); extern FD_t namei_iopen(IHandle_t * h); @@ -41,12 +41,12 @@ int namei_ListAFSFiles(char *dev, struct ViceInodeInfo * info, char *dir, char *file), FD_t fp, int (*judge_fun) (struct ViceInodeInfo * info, - afs_uint32 vid, void *rock), - afs_uint32 singleVolumeNumber, void *rock); + VolumeId vid, void *rock), + VolumeId singleVolumeNumber, void *rock); int ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile, - int (*judgeInode) (struct ViceInodeInfo * info, afs_uint32 vid, + int (*judgeInode) (struct ViceInodeInfo * info, VolumeId vid, void *rock), - afs_uint32 singleVolumeNumber, int *forcep, int forceR, + VolumeId singleVolumeNumber, int *forcep, int forceR, char *wpath, void *rock); #define NAMEI_LCOMP_LEN 32 @@ -77,7 +77,7 @@ typedef struct { #endif void namei_HandleToName(namei_t * name, IHandle_t * h); -int namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId); +int namei_ConvertROtoRWvolume(char *pname, VolumeId volumeId); int namei_replace_file_by_hardlink(IHandle_t *hLink, IHandle_t *hTarget); # ifdef AFS_SALSRV_ENV diff --git a/src/vol/nuke.c b/src/vol/nuke.c index b1f69b14e..1618b44ea 100644 --- a/src/vol/nuke.c +++ b/src/vol/nuke.c @@ -51,7 +51,7 @@ struct ilist { * Note that ainfo->u.param[0] is always the volume ID, for any vice inode. */ static int -NukeProc(struct ViceInodeInfo *ainfo, afs_uint32 avolid, void *arock) +NukeProc(struct ViceInodeInfo *ainfo, VolumeId avolid, void *arock) { struct ilist **allInodes = (struct ilist **)arock; struct ilist *ti; @@ -88,7 +88,7 @@ NukeProc(struct ViceInodeInfo *ainfo, afs_uint32 avolid, void *arock) * indices will be gone. */ int -nuke(char *aname, afs_int32 avolid) +nuke(char *aname, VolumeId avolid) { /* first process the partition containing this junk */ struct afs_stat_st tstat; diff --git a/src/vol/physio.c b/src/vol/physio.c index bf9c1b504..170c9c79d 100644 --- a/src/vol/physio.c +++ b/src/vol/physio.c @@ -94,7 +94,7 @@ ReallyWrite(DirHandle * file, int block, char *data) * The handle needs to be dereferenced with the FidZap() routine. */ void -SetSalvageDirHandle(DirHandle * dir, afs_int32 volume, Device device, +SetSalvageDirHandle(DirHandle * dir, VolumeId volume, Device device, Inode inode, int *volumeChanged) { static int SalvageCacheCheck = 1; @@ -137,7 +137,7 @@ FidEq(DirHandle * afile, DirHandle * bfile) } int -FidVolEq(DirHandle * afile, afs_int32 vid) +FidVolEq(DirHandle * afile, VolumeId vid) { if (afile->dirh_volume != vid) return 0; diff --git a/src/vol/salvsync-server.c b/src/vol/salvsync-server.c index 5cfdd9f10..14027dbef 100644 --- a/src/vol/salvsync-server.c +++ b/src/vol/salvsync-server.c @@ -182,7 +182,7 @@ static void (*HandlerProc[MAXHANDLERS]) (int); static struct QueueHead SalvageHashTable[VSHASH_SIZE]; static struct SalvageQueueNode * -LookupNode(afs_uint32 vid, char * partName, +LookupNode(VolumeId vid, char * partName, struct SalvageQueueNode ** parent) { struct rx_queue *qp, *nqp; @@ -1315,7 +1315,7 @@ SALVSYNC_doneWorkByPid(int pid, int status) { struct SalvageQueueNode * node; char partName[16]; - afs_uint32 volids[VOLMAXTYPES+1]; + VolumeId volids[VOLMAXTYPES+1]; unsigned int idx; memset(volids, 0, sizeof(volids)); diff --git a/src/vol/salvsync.h b/src/vol/salvsync.h index 67845d009..e88c60959 100644 --- a/src/vol/salvsync.h +++ b/src/vol/salvsync.h @@ -91,7 +91,7 @@ typedef enum { typedef struct SALVSYNC_command_hdr { afs_uint32 hdr_version; /**< salvsync protocol header version */ afs_uint32 prio; /**< salvage priority */ - afs_uint32 volume; /**< volume on which to operate */ + VolumeId volume; /**< volume on which to operate */ afs_uint32 parent; /**< parent volume (for vol group linking command) */ char partName[16]; /**< partition name, e.g. /vicepa */ afs_uint32 reserved[6]; diff --git a/src/vol/viceinode.h b/src/vol/viceinode.h index 842d48e85..983066a23 100644 --- a/src/vol/viceinode.h +++ b/src/vol/viceinode.h @@ -20,7 +20,7 @@ /* The four inode parameters for most inodes (files, directories, symbolic links) */ struct InodeParams { - VolId volumeId; + VolumeId volumeId; VnodeId vnodeNumber; Unique vnodeUniquifier; FileVersion inodeDataVersion; @@ -29,14 +29,14 @@ struct InodeParams { /* The four inode parameters for special inodes, i.e. the descriptive inodes for a volume */ struct SpecialInodeParams { - VolId volumeId; + VolumeId volumeId; VnodeId vnodeNumber; /* this must be INODESPECIAL */ #ifdef AFS_3DISPARES - VolId parentId; + VolumeId parentId; int type; #else int type; - VolId parentId; + VolumeId parentId; #endif }; diff --git a/src/vol/vnode.c b/src/vol/vnode.c index a645be121..82d851c74 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -761,8 +761,8 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type, VnodeId in_vnode, Unique * this vnode number was free, so something is wrong. */ if (vnp->disk.type != vNull) { Error tmp; - Log("VAllocVnode: addled bitmap or vnode object! (vol %ld, " - "vnode %p, number %ld, type %ld)\n", (long)vp->hashid, vnp, + Log("VAllocVnode: addled bitmap or vnode object! (vol %" AFS_VOLID_FMT ", " + "vnode %p, number %ld, type %ld)\n", afs_printable_VolumeId_lu(vp->hashid), vnp, (long)Vn_id(vnp), (long)vnp->disk.type); *ec = EIO; VFreeBitMapEntry_r(&tmp, vp, &vp->vnodeIndex[class], bitNumber, @@ -973,12 +973,12 @@ VnLoad(Error * ec, Volume * vp, Vnode * vnp, dosalv = 0; } else if (nBytes == -1 && errno == EIO) { /* disk error; salvage */ - Log("VnLoad: Couldn't read vnode %u, volume %u (%s); volume needs salvage\n", Vn_id(vnp), V_id(vp), V_name(vp)); + Log("VnLoad: Couldn't read vnode %u, volume %" AFS_VOLID_FMT " (%s); volume needs salvage\n", Vn_id(vnp), afs_printable_VolumeId_lu(V_id(vp)), V_name(vp)); } else { /* vnode is not allocated */ if (LogLevel >= 5) - Log("VnLoad: Couldn't read vnode %u, volume %u (%s); read %d bytes, errno %d\n", - Vn_id(vnp), V_id(vp), V_name(vp), (int)nBytes, errno); + Log("VnLoad: Couldn't read vnode %u, volume %" AFS_VOLID_FMT " (%s); read %d bytes, errno %d\n", + Vn_id(vnp), afs_printable_VolumeId_lu(V_id(vp)), V_name(vp), (int)nBytes, errno); *ec = VIO; dosalv = 0; } @@ -1007,17 +1007,17 @@ VnLoad(Error * ec, Volume * vp, Vnode * vnp, if ((offset >= index->bitmapSize) || ((*(index->bitmap + offset) & (1 << (bitNumber & 0x7))) == 0)) { - Log("VnLoad: Request for unallocated vnode %u, volume %u (%s) denied.\n", Vn_id(vnp), V_id(vp), V_name(vp)); + Log("VnLoad: Request for unallocated vnode %u, volume %" AFS_VOLID_FMT " (%s) denied.\n", Vn_id(vnp), afs_printable_VolumeId_lu(V_id(vp)), V_name(vp)); *ec = VNOVNODE; dosalv = 0; } else { - Log("VnLoad: Bad magic number, vnode %u, volume %u (%s); volume needs salvage\n", Vn_id(vnp), V_id(vp), V_name(vp)); + Log("VnLoad: Bad magic number, vnode %u, volume %" AFS_VOLID_FMT " (%s); volume needs salvage\n", Vn_id(vnp), afs_printable_VolumeId_lu(V_id(vp)), V_name(vp)); } } goto error_encountered; } - IH_INIT(vnp->handle, V_device(vp), V_parentId(vp), VN_GET_INO(vnp)); + IH_INIT(vnp->handle, V_device(vp), afs_printable_VolumeId_lu(V_parentId(vp)), VN_GET_INO(vnp)); VnUnlock(vnp, WRITE_LOCK); #ifdef AFS_DEMAND_ATTACH_FS VnChangeState_r(vnp, VN_STATE_ONLINE); @@ -1106,7 +1106,7 @@ VnStore(Error * ec, Volume * vp, Vnode * vnp, VnChangeState_r(vnp, VN_STATE_ERROR); #endif } else { - Log("VnStore: Couldn't write vnode %u, volume %u (%s) (error %d)\n", Vn_id(vnp), V_id(Vn_volume(vnp)), V_name(Vn_volume(vnp)), (int)nBytes); + Log("VnStore: Couldn't write vnode %u, volume %" AFS_VOLID_FMT " (%s) (error %d)\n", Vn_id(vnp), afs_printable_VolumeId_lu(V_id(Vn_volume(vnp))), V_name(Vn_volume(vnp)), (int)nBytes); #ifdef AFS_DEMAND_ATTACH_FS goto error_encountered; #else diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index 4d7366019..c1fe3dbf3 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -379,8 +379,8 @@ PrintVolumeSizes(Volume * vp) afs_int64 diff_k = volumeTotals.size_k - volumeTotals.diskused_k; PrintVolumeSizeHeading(); - printf("%u\t%9llu%9llu%10llu%10llu%9lld\t%24s\n", - V_id(vp), + printf("%" AFS_VOLID_FMT "\t%9llu%9llu%10llu%10llu%9lld\t%24s\n", + afs_printable_VolumeId_lu(V_id(vp)), volumeTotals.diskused_k, volumeTotals.auxsize_k, volumeTotals.vnodesize_k, volumeTotals.size_k, diff_k, V_name(vp)); @@ -658,7 +658,7 @@ GetPartitionName(afs_uint32 partId, char *partName, afs_size_t partNameSize) * @return 0 if successful */ static int -ScanPartitions(char *partNameOrId, afs_uint32 volumeId) +ScanPartitions(char *partNameOrId, VolumeId volumeId) { int err = 0; char partName[64] = ""; @@ -743,7 +743,7 @@ ScanPartitions(char *partNameOrId, afs_uint32 volumeId) } } snprintf(name1, sizeof name1, VFORMAT, - afs_printable_uint32_lu(volumeId)); + afs_printable_VolumeId_lu(volumeId)); if (PrintHeading) { PrintColumnHeading(); } @@ -788,7 +788,7 @@ static int VolInfo(struct cmd_syndesc *as, void *arock) { struct cmd_item *ti; - afs_uint32 volumeId = 0; + VolumeId volumeId = 0; char *partNameOrId = NULL; DumpInfo = 1; /* volinfo default mode */ @@ -916,7 +916,7 @@ static int VolScan(struct cmd_syndesc *as, void *arock) { struct cmd_item *ti; - afs_uint32 volumeId = 0; + VolumeId volumeId = 0; char *partNameOrId = NULL; int i; @@ -1183,16 +1183,16 @@ HandleSpecialFile(const char *name, struct DiskPartition64 *dp, fdP = IH_OPEN(ih); if (fdP == NULL) { fprintf(stderr, - "%s: Error opening header file '%s' for volume %u\n", progname, - name, header->id); + "%s: Error opening header file '%s' for volume %" AFS_VOLID_FMT "\n", progname, + name, afs_printable_VolumeId_lu(header->id)); perror("open"); goto error; } size = FDH_SIZE(fdP); if (size == -1) { fprintf(stderr, - "%s: Error getting size of header file '%s' for volume %u\n", - progname, name, header->id); + "%s: Error getting size of header file '%s' for volume %" AFS_VOLID_FMT "\n", + progname, name, afs_printable_VolumeId_lu(header->id)); perror("fstat"); goto error; } @@ -1240,8 +1240,8 @@ HandleHeaderFiles(struct DiskPartition64 *dp, FD_t header_fd, size = OS_SIZE(header_fd); printf("Volume header (size = %lld):\n", size); printf("\tstamp\t= 0x%x\n", header->stamp.version); - printf("\tVolId\t= %u\n", header->id); - printf("\tparent\t= %u\n", header->parent); + printf("\tVolId\t= %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(header->id)); + printf("\tparent\t= %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(header->parent)); } HandleSpecialFile("Info", dp, header, header->volumeInfo, &size); @@ -1288,8 +1288,8 @@ IsScannable(Volume * vp) case BACKVOL: return ScanVolType & SCAN_BK; default: - fprintf(stderr, "%s: Volume %u; Unknown volume type %d\n", progname, - V_id(vp), V_type(vp)); + fprintf(stderr, "%s: Volume %" AFS_VOLID_FMT "; Unknown volume type %d\n", progname, + afs_printable_VolumeId_lu(V_id(vp)), V_type(vp)); break; } return 0; @@ -1560,7 +1560,7 @@ volumeTypeShortString(int type) void PrintHeader(Volume * vp) { - printf("Volume header for volume %u (%s)\n", V_id(vp), V_name(vp)); + printf("Volume header for volume %" AFS_VOLID_FMT " (%s)\n", afs_printable_VolumeId_lu(V_id(vp)), V_name(vp)); printf("stamp.magic = %x, stamp.version = %u\n", V_stamp(vp).magic, V_stamp(vp).version); printf @@ -1572,9 +1572,8 @@ PrintHeader(Volume * vp) V_type(vp), volumeTypeString(V_type(vp)), V_uniquifier(vp), V_needsCallback(vp), V_destroyMe(vp)); printf - ("id = %u, parentId = %u, cloneId = %u, backupId = %u, restoredFromId = %u\n", - V_id(vp), V_parentId(vp), V_cloneId(vp), V_backupId(vp), - V_restoredFromId(vp)); + ("id = %" AFS_VOLID_FMT ", parentId = %" AFS_VOLID_FMT ", cloneId = %" AFS_VOLID_FMT ", backupId = %" AFS_VOLID_FMT ", restoredFromId = %" AFS_VOLID_FMT "\n", + afs_printable_VolumeId_lu(V_id(vp)), afs_printable_VolumeId_lu(V_parentId(vp)), afs_printable_VolumeId_lu(V_cloneId(vp)), afs_printable_VolumeId_lu(V_backupId(vp)), afs_printable_VolumeId_lu(V_restoredFromId(vp))); printf ("maxquota = %d, minquota = %d, maxfiles = %d, filecount = %d, diskused = %d\n", V_maxquota(vp), V_minquota(vp), V_maxfiles(vp), V_filecount(vp), diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 78ac9544e..659fb990e 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -987,9 +987,9 @@ DeleteExtraVolumeHeaderFile(struct SalvInfo *salvinfo, struct VolumeSummary *vsp afs_int32 code; code = VDestroyVolumeDiskHeader(salvinfo->fileSysPartition, vsp->header.id, vsp->header.parent); if (code) { - Log("Error %ld destroying volume disk header for volume %lu\n", + Log("Error %ld destroying volume disk header for volume %" AFS_VOLID_FMT "\n", afs_printable_int32_ld(code), - afs_printable_uint32_lu(vsp->header.id)); + afs_printable_VolumeId_lu(vsp->header.id)); } /* make sure we actually delete the header file; ENOENT @@ -1133,7 +1133,7 @@ CountVolumeInodes(struct ViceInodeInfo *ip, int maxInodes, } int -OnlyOneVolume(struct ViceInodeInfo *inodeinfo, afs_uint32 singleVolumeNumber, void *rock) +OnlyOneVolume(struct ViceInodeInfo *inodeinfo, VolumeId singleVolumeNumber, void *rock) { if (inodeinfo->u.vnode.vnodeNumber == INODESPECIAL) return (inodeinfo->u.special.parentId == singleVolumeNumber); @@ -1429,9 +1429,9 @@ AskVolumeSummary(struct SalvInfo *salvinfo, VolumeId singleVolumeNumber) } if (code) { - Log("fileserver refused VGCQuery request for volume %lu on " + Log("fileserver refused VGCQuery request for volume %" AFS_VOLID_FMT " on " "partition %s, code %ld reason %ld\n", - afs_printable_uint32_lu(singleVolumeNumber), + afs_printable_VolumeId_lu(singleVolumeNumber), salvinfo->fileSysPartition->name, afs_printable_int32_ld(code), afs_printable_int32_ld(res.hdr.reason)); @@ -1439,9 +1439,9 @@ AskVolumeSummary(struct SalvInfo *salvinfo, VolumeId singleVolumeNumber) } if (q_res.rw != singleVolumeNumber) { - Log("fileserver requested salvage of clone %lu; scheduling salvage of volume group %lu...\n", - afs_printable_uint32_lu(singleVolumeNumber), - afs_printable_uint32_lu(q_res.rw)); + Log("fileserver requested salvage of clone %" AFS_VOLID_FMT "; scheduling salvage of volume group %" AFS_VOLID_FMT "...\n", + afs_printable_VolumeId_lu(singleVolumeNumber), + afs_printable_VolumeId_lu(q_res.rw)); #ifdef SALVSYNC_BUILD_CLIENT if (SALVSYNC_LinkVolume(q_res.rw, singleVolumeNumber, @@ -1583,8 +1583,9 @@ RecordHeader(struct DiskPartition64 *dp, const char *name, if (programType == salvageServer) { #ifdef SALVSYNC_BUILD_CLIENT - Log("fileserver requested salvage of clone %u; scheduling salvage of volume group %u...\n", - summary.header.id, summary.header.parent); + Log("fileserver requested salvage of clone %" AFS_VOLID_FMT "; scheduling salvage of volume group %" AFS_VOLID_FMT "...\n", + afs_printable_VolumeId_lu(summary.header.id), + afs_printable_VolumeId_lu(summary.header.parent)); if (SALVSYNC_LinkVolume(summary.header.parent, summary.header.id, dp->name, @@ -1595,8 +1596,8 @@ RecordHeader(struct DiskPartition64 *dp, const char *name, Exit(SALSRV_EXIT_VOLGROUP_LINK); } else { - Log("%u is a read-only volume; not salvaged\n", - singleVolumeNumber); + Log("%" AFS_VOLID_FMT " is a read-only volume; not salvaged\n", + afs_printable_VolumeId_lu(singleVolumeNumber)); Exit(1); } } @@ -1614,7 +1615,7 @@ RecordHeader(struct DiskPartition64 *dp, const char *name, } snprintf(nameShouldBe, sizeof nameShouldBe, - VFORMAT, afs_printable_uint32_lu(summary.header.id)); + VFORMAT, afs_printable_VolumeId_lu(summary.header.id)); if (strcmp(nameShouldBe, base)) { @@ -1832,25 +1833,25 @@ CreateLinkTable(struct SalvInfo *salvinfo, struct InodeSummary *isp, Inode ino) INODESPECIAL, VI_LINKTABLE, isp->RWvolumeId); if (!VALID_INO(ino)) Abort - ("Unable to allocate link table inode for volume %u (error = %d)\n", - isp->RWvolumeId, errno); + ("Unable to allocate link table inode for volume %" AFS_VOLID_FMT " (error = %d)\n", + afs_printable_VolumeId_lu(isp->RWvolumeId), errno); IH_INIT(salvinfo->VGLinkH, salvinfo->fileSysDevice, isp->RWvolumeId, ino); fdP = IH_OPEN(salvinfo->VGLinkH); if (fdP == NULL) - Abort("Can't open link table for volume %u (error = %d)\n", - isp->RWvolumeId, errno); + Abort("Can't open link table for volume %" AFS_VOLID_FMT " (error = %d)\n", + afs_printable_VolumeId_lu(isp->RWvolumeId), errno); if (FDH_TRUNC(fdP, sizeof(version) + sizeof(short)) < 0) - Abort("Can't truncate link table for volume %u (error = %d)\n", - isp->RWvolumeId, errno); + Abort("Can't truncate link table for volume %" AFS_VOLID_FMT " (error = %d)\n", + afs_printable_VolumeId_lu(isp->RWvolumeId), errno); version.magic = LINKTABLEMAGIC; version.version = LINKTABLEVERSION; if (FDH_PWRITE(fdP, (char *)&version, sizeof(version), 0) != sizeof(version)) - Abort("Can't truncate link table for volume %u (error = %d)\n", - isp->RWvolumeId, errno); + Abort("Can't truncate link table for volume %" AFS_VOLID_FMT " (error = %d)\n", + afs_printable_VolumeId_lu(isp->RWvolumeId), errno); FDH_REALLYCLOSE(fdP); @@ -1964,14 +1965,14 @@ DoSalvageVolumeGroup(struct SalvInfo *salvinfo, struct InodeSummary *isp, int nV nBytes = FDH_PREAD(fdP, (char *)&header, sizeof(struct versionStamp), 0); if (nBytes != sizeof(struct versionStamp) || header.magic != LINKTABLEMAGIC) { - Log("Bad linktable header for volume %u.\n", isp->RWvolumeId); + Log("Bad linktable header for volume %" AFS_VOLID_FMT ".\n", afs_printable_VolumeId_lu(isp->RWvolumeId)); FDH_REALLYCLOSE(fdP); fdP = NULL; } } if (!VALID_INO(ino) || fdP == NULL) { - Log("%s link table for volume %u.\n", - Testing ? "Would have recreated" : "Recreating", isp->RWvolumeId); + Log("%s link table for volume %" AFS_VOLID_FMT ".\n", + Testing ? "Would have recreated" : "Recreating", afs_printable_VolumeId_lu(isp->RWvolumeId)); if (Testing) { IH_INIT(salvinfo->VGLinkH, salvinfo->fileSysDevice, -1, -1); } else { @@ -2017,8 +2018,8 @@ DoSalvageVolumeGroup(struct SalvInfo *salvinfo, struct InodeSummary *isp, int nV } #endif if (!Showmode) - Log("%s VOLUME %u%s.\n", rw ? "SALVAGING" : "CHECKING CLONED", - lisp->volumeId, (Testing ? "(READONLY mode)" : "")); + Log("%s VOLUME %" AFS_VOLID_FMT "%s.\n", rw ? "SALVAGING" : "CHECKING CLONED", + afs_printable_VolumeId_lu(lisp->volumeId), (Testing ? "(READONLY mode)" : "")); /* Check inodes twice. The second time do things seriously. This * way the whole RO volume can be deleted, below, if anything goes wrong */ for (check = 1; check >= 0; check--) { @@ -2058,7 +2059,7 @@ DoSalvageVolumeGroup(struct SalvInfo *salvinfo, struct InodeSummary *isp, int nV #endif if (ip->linkCount != 0 && TraceBadLinkCounts) { TraceBadLinkCounts--; /* Limit reports, per volume */ - Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %llu, p=(%u,%u,%u,%u)\n", ip->linkCount, PrintInode(stmp, ip->inodeNumber), (afs_uintmax_t) ip->byteCount, ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]); + Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %llu, p=(%u,%u,%u,%u)\n", ip->linkCount, PrintInode(stmp, ip->inodeNumber), (afs_uintmax_t) ip->byteCount, ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]); /* VolumeId in param */ } while (ip->linkCount > 0) { /* below used to assert, not break */ @@ -2241,8 +2242,8 @@ SalvageVolumeHeaderFile(struct SalvInfo *salvinfo, struct InodeSummary *isp, continue; } if (!Showmode) { - Log("Duplicate special %d inodes for volume %u found (%s, %s);\n", - ip->u.special.type, isp->volumeId, + Log("Duplicate special %d inodes for volume %" AFS_VOLID_FMT " found (%s, %s);\n", + ip->u.special.type, afs_printable_VolumeId_lu(isp->volumeId), PrintInode(stmp1, ip->inodeNumber), PrintInode(stmp2, (ip+1)->inodeNumber)); } @@ -2265,7 +2266,7 @@ SalvageVolumeHeaderFile(struct SalvInfo *salvinfo, struct InodeSummary *isp, } } else { if (!Showmode) - Log("cannot determine which is correct; salvage of volume %u aborted\n", isp->volumeId); + Log("cannot determine which is correct; salvage of volume %" AFS_VOLID_FMT " aborted\n", afs_printable_VolumeId_lu(isp->volumeId)); if (skip) { free(skip); } @@ -2346,16 +2347,16 @@ SalvageVolumeHeaderFile(struct SalvInfo *salvinfo, struct InodeSummary *isp, char path[64]; char headerName[64]; snprintf(headerName, sizeof headerName, VFORMAT, - afs_printable_uint32_lu(isp->volumeId)); + afs_printable_VolumeId_lu(isp->volumeId)); snprintf(path, sizeof path, "%s" OS_DIRSEP "%s", salvinfo->fileSysPath, headerName); if (check) { - Log("No header file for volume %u\n", isp->volumeId); + Log("No header file for volume %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(isp->volumeId)); return -1; } if (!Showmode) - Log("No header file for volume %u; %screating %s\n", - isp->volumeId, (Testing ? "it would have been " : ""), + Log("No header file for volume %" AFS_VOLID_FMT "; %screating %s\n", + afs_printable_VolumeId_lu(isp->volumeId), (Testing ? "it would have been " : ""), path); isp->volSummary = calloc(1, sizeof(struct VolumeSummary)); @@ -2387,16 +2388,16 @@ SalvageVolumeHeaderFile(struct SalvInfo *salvinfo, struct InodeSummary *isp, sizeof(struct VolumeHeader)); if (Testing) { if (!Showmode) - Log("It would have written a new header file for volume %u\n", - isp->volumeId); + Log("It would have written a new header file for volume %" AFS_VOLID_FMT "\n", + afs_printable_VolumeId_lu(isp->volumeId)); } else { afs_int32 code; VolumeHeaderToDisk(&diskHeader, &tempHeader); code = (*writefunc)(&diskHeader, salvinfo->fileSysPartition); if (code) { - Log("Error %ld writing volume header file for volume %lu\n", + Log("Error %ld writing volume header file for volume %" AFS_VOLID_FMT "\n", afs_printable_int32_ld(code), - afs_printable_uint32_lu(diskHeader.id)); + afs_printable_VolumeId_lu(diskHeader.id)); return -1; } } @@ -2509,9 +2510,9 @@ SalvageHeader(struct SalvInfo *salvinfo, struct afs_inode_info *sp, header.volumeInfo.stamp = sp->stamp; header.volumeInfo.id = isp->volumeId; header.volumeInfo.parentId = isp->RWvolumeId; - sprintf(header.volumeInfo.name, "bogus.%u", isp->volumeId); - Log("Warning: the name of volume %u is now \"bogus.%u\"\n", - isp->volumeId, isp->volumeId); + sprintf(header.volumeInfo.name, "bogus.%" AFS_VOLID_FMT, afs_printable_VolumeId_lu(isp->volumeId)); + Log("Warning: the name of volume %" AFS_VOLID_FMT " is now \"bogus.%" AFS_VOLID_FMT "\"\n", + afs_printable_VolumeId_lu(isp->volumeId), afs_printable_VolumeId_lu(isp->volumeId)); header.volumeInfo.inService = 0; header.volumeInfo.blessed = 0; /* The + 1000 is a hack in case there are any files out in venus caches */ @@ -2554,14 +2555,14 @@ SalvageHeader(struct SalvInfo *salvinfo, struct afs_inode_info *sp, if (salvinfo->VolInfo.updateDate) { strcpy(update, TimeStamp(salvinfo->VolInfo.updateDate, 0)); if (!Showmode) - Log("%s (%u) %supdated %s\n", salvinfo->VolInfo.name, - salvinfo->VolInfo.id, + Log("%s (%" AFS_VOLID_FMT ") %supdated %s\n", salvinfo->VolInfo.name, + afs_printable_VolumeId_lu(salvinfo->VolInfo.id), (Testing ? "it would have been " : ""), update); } else { strcpy(update, TimeStamp(salvinfo->VolInfo.creationDate, 0)); if (!Showmode) - Log("%s (%u) not updated (created %s)\n", - salvinfo->VolInfo.name, salvinfo->VolInfo.id, update); + Log("%s (%" AFS_VOLID_FMT ") not updated (created %s)\n", + salvinfo->VolInfo.name, afs_printable_VolumeId_lu(salvinfo->VolInfo.id), update); } } @@ -3202,14 +3203,15 @@ JudgeEntry(void *arock, char *name, afs_int32 vnodeNumber, if (nBytes == size) { buf[size] = '\0'; if ( (*buf != '#' && *buf != '%') || buf[strlen(buf)-1] != '.' ) { - Log("Volume %u (%s) mount point %s" OS_DIRSEP "%s to '%s' invalid, %s to symbolic link\n", - dir->dirHandle.dirh_handle->ih_vid, dir->vname, dir->name ? dir->name : "??", name, buf, + Log("Volume %" AFS_VOLID_FMT " (%s) mount point %s" OS_DIRSEP "%s to '%s' invalid, %s to symbolic link\n", + afs_printable_VolumeId_lu(dir->dirHandle.dirh_handle->ih_vid), dir->vname, dir->name ? dir->name : "??", name, buf, Testing ? "would convert" : "converted"); vnodeEssence->modeBits |= 0111; vnodeEssence->changed = 1; - } else if (ShowMounts) Log("In volume %u (%s) found mountpoint %s" OS_DIRSEP "%s to '%s'\n", - dir->dirHandle.dirh_handle->ih_vid, dir->vname, - dir->name ? dir->name : "??", name, buf); + } else if (ShowMounts) + Log("In volume %" AFS_VOLID_FMT " (%s) found mountpoint %s" OS_DIRSEP "%s to '%s'\n", + afs_printable_VolumeId_lu(dir->dirHandle.dirh_handle->ih_vid), + dir->vname, dir->name ? dir->name : "??", name, buf); } else { Log("Volume %s cound not read mount point vnode %u size %d code %d\n", dir->vname, vnodeNumber, (int)size, (int)nBytes); @@ -4216,8 +4218,8 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t * opr_Assert(nBytes == sizeof(volHeader)); } if (!Showmode) { - Log("%sSalvaged %s (%u): %d files, %d blocks\n", - (Testing ? "It would have " : ""), volHeader.name, volHeader.id, + Log("%sSalvaged %s (%" AFS_VOLID_FMT "): %d files, %d blocks\n", + (Testing ? "It would have " : ""), volHeader.name, afs_printable_VolumeId_lu(volHeader.id), FilesInVolume, BlocksInVolume); } @@ -4261,12 +4263,12 @@ MaybeZapVolume(struct SalvInfo *salvinfo, struct InodeSummary *isp, if (isp->volSummary && !isp->volSummary->deleted) { if (deleteMe) { if (!Showmode) - Log("Volume %u (is only a partial volume--probably an attempt was made to move/restore it when a machine crash occured.\n", isp->volumeId); + Log("Volume %" AFS_VOLID_FMT " (is only a partial volume--probably an attempt was made to move/restore it when a machine crash occured.\n", afs_printable_VolumeId_lu(isp->volumeId)); if (!Showmode) Log("It will be deleted on this server (you may find it elsewhere)\n"); } else { if (!Showmode) - Log("Volume %u needs to be salvaged. Since it is read-only, however,\n", isp->volumeId); + Log("Volume %" AFS_VOLID_FMT " needs to be salvaged. Since it is read-only, however,\n", afs_printable_VolumeId_lu(isp->volumeId)); if (!Showmode) Log("it will be deleted instead. It should be recloned.\n"); } @@ -4279,9 +4281,9 @@ MaybeZapVolume(struct SalvInfo *salvinfo, struct InodeSummary *isp, code = VDestroyVolumeDiskHeader(salvinfo->fileSysPartition, isp->volumeId, isp->RWvolumeId); if (code) { - Log("Error %ld destroying volume disk header for volume %lu\n", + Log("Error %ld destroying volume disk header for volume %" AFS_VOLID_FMT "\n", afs_printable_int32_ld(code), - afs_printable_uint32_lu(isp->volumeId)); + afs_printable_VolumeId_lu(isp->volumeId)); } /* make sure we actually delete the header file; ENOENT @@ -4297,9 +4299,9 @@ MaybeZapVolume(struct SalvInfo *salvinfo, struct InodeSummary *isp, } } } else if (!check) { - Log("%s salvage was unsuccessful: read-write volume %u\n", message, - isp->volumeId); - Abort("Salvage of volume %u aborted\n", isp->volumeId); + Log("%s salvage was unsuccessful: read-write volume %" AFS_VOLID_FMT "\n", message, + afs_printable_VolumeId_lu(isp->volumeId)); + Abort("Salvage of volume %" AFS_VOLID_FMT " aborted\n", afs_printable_VolumeId_lu(isp->volumeId)); } } @@ -4521,7 +4523,7 @@ AskOnline(struct SalvInfo *salvinfo, VolumeId volumeId) if (code == SYNC_OK) { break; } else if (code == SYNC_DENIED) { - Log("AskOnline: file server denied online request to volume %u partition %s; trying again...\n", volumeId, salvinfo->fileSysPartition->name); + Log("AskOnline: file server denied online request to volume %" AFS_VOLID_FMT " partition %s; trying again...\n", afs_printable_VolumeId_lu(volumeId), salvinfo->fileSysPartition->name); } else if (code == SYNC_BAD_COMMAND) { Log("AskOnline: fssync protocol mismatch (bad command word '%d')\n", FSYNC_VOL_ON); @@ -4550,7 +4552,7 @@ AskDelete(struct SalvInfo *salvinfo, VolumeId volumeId) if (code == SYNC_OK) { break; } else if (code == SYNC_DENIED) { - Log("AskOnline: file server denied DONE request to volume %u partition %s; trying again...\n", volumeId, salvinfo->fileSysPartition->name); + Log("AskOnline: file server denied DONE request to volume %" AFS_VOLID_FMT " partition %s; trying again...\n", afs_printable_VolumeId_lu(volumeId), salvinfo->fileSysPartition->name); } else if (code == SYNC_BAD_COMMAND) { Log("AskOnline: fssync protocol mismatch (bad command word '%d')\n", FSYNC_VOL_DONE); @@ -4627,9 +4629,10 @@ PrintInodeList(struct SalvInfo *salvinfo) nInodes = st_size / sizeof(struct ViceInodeInfo); opr_Verify(OS_READ(salvinfo->inodeFd, buf, st_size) == st_size); for (ip = buf; nInodes--; ip++) { - Log("Inode:%s, linkCount=%d, size=%#llx, p=(%u,%u,%u,%u)\n", + Log("Inode:%s, linkCount=%d, size=%#llx, p=(%" AFS_VOLID_FMT ",%u,%u,%u)\n", /* VolumeId in param */ PrintInode(stmp, ip->inodeNumber), ip->linkCount, - (afs_uintmax_t) ip->byteCount, ip->u.param[0], ip->u.param[1], + (afs_uintmax_t) ip->byteCount, + afs_printable_VolumeId_lu(ip->u.param[0]), ip->u.param[1], ip->u.param[2], ip->u.param[3]); } free(buf); @@ -4643,7 +4646,7 @@ PrintInodeSummary(struct SalvInfo *salvinfo) for (i = 0; i < salvinfo->nVolumesInInodeFile; i++) { isp = &salvinfo->inodeSummary[i]; - Log("VID:%u, RW:%u, index:%d, nInodes:%d, nSpecialInodes:%d, maxUniquifier:%u, volSummary\n", isp->volumeId, isp->RWvolumeId, isp->index, isp->nInodes, isp->nSpecialInodes, isp->maxUniquifier); + Log("VID:%" AFS_VOLID_FMT ", RW:%" AFS_VOLID_FMT ", index:%d, nInodes:%d, nSpecialInodes:%d, maxUniquifier:%u, volSummary\n", afs_printable_VolumeId_lu(isp->volumeId), afs_printable_VolumeId_lu(isp->RWvolumeId), isp->index, isp->nInodes, isp->nSpecialInodes, isp->maxUniquifier); } } diff --git a/src/vol/vol-salvage.h b/src/vol/vol-salvage.h index e1f087550..014cf6881 100644 --- a/src/vol/vol-salvage.h +++ b/src/vol/vol-salvage.h @@ -22,8 +22,8 @@ /* salvager data structures */ struct InodeSummary { /* Inode summary file--an entry for each * volume in the inode file for a partition */ - VolId volumeId; /* Volume id */ - VolId RWvolumeId; /* RW volume associated */ + VolumeId volumeId; /* Volume id */ + VolumeId RWvolumeId; /* RW volume associated */ int index; /* index into inode file (0, 1, 2 ...) */ int nInodes; /* Number of inodes for this volume */ int nSpecialInodes; /* Number of special inodes, i.e. volume diff --git a/src/vol/vol_internal.h b/src/vol/vol_internal.h index 095f72fd2..7fa771941 100644 --- a/src/vol/vol_internal.h +++ b/src/vol/vol_internal.h @@ -2,7 +2,7 @@ #define AFS_SRC_VOL_INTERNAL_H /* physio.c */ -extern void SetSalvageDirHandle(DirHandle *, afs_int32, Device, Inode, +extern void SetSalvageDirHandle(DirHandle *, VolumeId, Device, Inode, int *); #endif diff --git a/src/vol/voldefs.h b/src/vol/voldefs.h index 634119158..aa9d25d23 100644 --- a/src/vol/voldefs.h +++ b/src/vol/voldefs.h @@ -44,10 +44,10 @@ /* All volumes will have a volume header name in this format */ #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) /* Note that must have been included before we get here... */ -#define VFORMAT "V%010lu.vl" /* Sys5's filename length limitation hits us again */ +#define VFORMAT "V%010" AFS_VOLID_FMT ".vl" /* Sys5's filename length limitation hits us again */ #define VHDREXT ".vl" #else -#define VFORMAT "V%010lu.vol" +#define VFORMAT "V%010" AFS_VOLID_FMT ".vol" #define VHDREXT ".vol" #endif #define VHDRNAMELEN (VFORMATDIGITS + 1 + sizeof(VHDREXT) - 1) /* must match VFORMAT */ diff --git a/src/vol/volume.c b/src/vol/volume.c index a83e77709..fc6807745 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -145,7 +145,7 @@ extern void *calloc(), *realloc(); #endif /* Forward declarations */ -static Volume *attach2(Error * ec, VolId volumeId, char *path, +static Volume *attach2(Error * ec, VolumeId volumeId, char *path, struct DiskPartition64 *partp, Volume * vp, int isbusy, int mode, int *acheckedOut); static void ReallyFreeVolume(Volume * vp); @@ -159,7 +159,7 @@ static void VInitVolumeHeaderCache(afs_uint32 howMany); static int GetVolumeHeader(Volume * vp); static void ReleaseVolumeHeader(struct volHeader *hd); static void FreeVolumeHeader(Volume * vp); -static void AddVolumeToHashTable(Volume * vp, int hashid); +static void AddVolumeToHashTable(Volume * vp, VolumeId hashid); static void DeleteVolumeFromHashTable(Volume * vp); #if 0 static int VHold(Volume * vp); @@ -171,7 +171,7 @@ static void VCloseVolumeHandles_r(Volume * vp); static void LoadVolumeHeader(Error * ec, Volume * vp); static int VCheckOffline(Volume * vp); static int VCheckDetach(Volume * vp); -static Volume * GetVolume(Error * ec, Error * client_ec, VolId volumeId, +static Volume * GetVolume(Error * ec, Error * client_ec, VolumeId volumeId, Volume * hint, const struct timespec *ts); int LogLevel; /* Vice loglevel--not defined as extern so that it will be @@ -311,7 +311,7 @@ struct vinitvolumepackage_thread_param { static void *VInitVolumePackageThread(void *args); static struct DiskPartition64 *VInitNextPartition(struct partition_queue *pq); -static VolId VInitNextVolumeId(DIR *dirp); +static VolumeId VInitNextVolumeId(DIR *dirp); static int VInitPreAttachVolumes(int nthreads, struct volume_init_queue *vq); #endif /* !AFS_DEMAND_ATTACH_FS */ @@ -339,7 +339,7 @@ struct VLRU_DiskHeader { }; struct VLRU_DiskEntry { - afs_uint32 vid; /* volume ID */ + VolumeId vid; /* volume ID */ afs_uint32 idx; /* generation */ afs_uint32 last_get; /* timestamp of last get */ }; @@ -938,7 +938,7 @@ VInitVolumePackageThread(void *args) Log("Scanning partitions on thread %d of %d\n", params->thread, params->nthreads); while((partition = VInitNextPartition(pq))) { DIR *dirp; - VolId vid; + VolumeId vid; Log("Partition %s: pre-attaching volumes\n", partition->name); dirp = opendir(VPartitionPath(partition)); @@ -1019,11 +1019,11 @@ VInitNextPartition(struct partition_queue *pq) /** * Find next volume id on the partition. */ -static VolId +static VolumeId VInitNextVolumeId(DIR *dirp) { struct dirent *d; - VolId vid = 0; + VolumeId vid = 0; char *ext; while((d = readdir(dirp))) { @@ -1075,7 +1075,7 @@ VInitPreAttachVolumes(int nthreads, struct volume_init_queue *vq) Log("Error looking up volume, code=%d\n", ec); } else if (dup) { - Log("Warning: Duplicate volume id %d detected.\n", vp->hashid); + Log("Warning: Duplicate volume id %" AFS_VOLID_FMT " detected.\n", afs_printable_VolumeId_lu(vp->hashid)); } else { /* put pre-attached volume onto the hash table @@ -1365,8 +1365,8 @@ VShutdown_r(void) code = VHold_r(vp); if (code == 0) { if (LogLevel >= 5) - Log("VShutdown: Attempting to take volume %u offline.\n", - vp->hashid); + Log("VShutdown: Attempting to take volume %" AFS_VOLID_FMT " offline.\n", + afs_printable_VolumeId_lu(vp->hashid)); /* next, take the volume offline (drops reference count) */ VOffline_r(vp, "File server was shut down"); @@ -1848,8 +1848,9 @@ VShutdownVolume_r(Volume * vp) VCreateReservation_r(vp); if (LogLevel >= 5) { - Log("VShutdownVolume_r: vid=%u, device=%d, state=%hu\n", - vp->hashid, vp->partition->device, V_attachState(vp)); + Log("VShutdownVolume_r: vid=%" AFS_VOLID_FMT ", device=%d, state=%hu\n", + afs_printable_VolumeId_lu(vp->hashid), vp->partition->device, + V_attachState(vp)); } /* wait for other blocking ops to finish */ @@ -1875,8 +1876,8 @@ VShutdownVolume_r(Volume * vp) code = VHold_r(vp); if (!code) { if (LogLevel >= 5) - Log("VShutdown: Attempting to take volume %u offline.\n", - vp->hashid); + Log("VShutdown: Attempting to take volume %" AFS_VOLID_FMT " offline.\n", + afs_printable_VolumeId_lu(vp->hashid)); /* take the volume offline (drops reference count) */ VOffline_r(vp, "File server was shut down"); @@ -1938,7 +1939,7 @@ ReadHeader(Error * ec, IHandle_t * h, char *to, int size, bit32 magic, fdP = IH_OPEN(h); if (fdP == NULL) { Log("ReadHeader: Failed to open %s header file " - "(volume=%u, inode=%s); errno=%d\n", HeaderName(magic), h->ih_vid, + "(volume=%" AFS_VOLID_FMT ", inode=%s); errno=%d\n", HeaderName(magic), afs_printable_VolumeId_lu(h->ih_vid), PrintInode(stmp, h->ih_ino), errno); *ec = VSALVAGE; return; @@ -1948,7 +1949,7 @@ ReadHeader(Error * ec, IHandle_t * h, char *to, int size, bit32 magic, nbytes = FDH_PREAD(fdP, to, size, 0); if (nbytes < 0) { Log("ReadHeader: Failed to read %s header file " - "(volume=%u, inode=%s); errno=%d\n", HeaderName(magic), h->ih_vid, + "(volume=%" AFS_VOLID_FMT ", inode=%s); errno=%d\n", HeaderName(magic), afs_printable_VolumeId_lu(h->ih_vid), PrintInode(stmp, h->ih_ino), errno); *ec = VSALVAGE; FDH_REALLYCLOSE(fdP); @@ -1956,18 +1957,18 @@ ReadHeader(Error * ec, IHandle_t * h, char *to, int size, bit32 magic, } if (nbytes != size) { Log("ReadHeader: Incorrect number of bytes read from %s header file " - "(volume=%u, inode=%s); expected=%d, read=%d\n", - HeaderName(magic), h->ih_vid, PrintInode(stmp, h->ih_ino), size, - (int)nbytes); + "(volume=%" AFS_VOLID_FMT ", inode=%s); expected=%d, read=%d\n", + HeaderName(magic), afs_printable_VolumeId_lu(h->ih_vid), + PrintInode(stmp, h->ih_ino), size, (int)nbytes); *ec = VSALVAGE; FDH_REALLYCLOSE(fdP); return; } if (vsn->magic != magic) { Log("ReadHeader: Incorrect magic for %s header file " - "(volume=%u, inode=%s); expected=0x%x, read=0x%x\n", - HeaderName(magic), h->ih_vid, PrintInode(stmp, h->ih_ino), magic, - vsn->magic); + "(volume=%" AFS_VOLID_FMT ", inode=%s); expected=0x%x, read=0x%x\n", + HeaderName(magic), afs_printable_VolumeId_lu(h->ih_vid), + PrintInode(stmp, h->ih_ino), magic, vsn->magic); *ec = VSALVAGE; FDH_REALLYCLOSE(fdP); return; @@ -1978,8 +1979,8 @@ ReadHeader(Error * ec, IHandle_t * h, char *to, int size, bit32 magic, /* Check is conditional, in case caller wants to inspect version himself */ if (version && vsn->version != version) { Log("ReadHeader: Incorrect version for %s header file " - "(volume=%u, inode=%s); expected=%x, read=%x\n", - HeaderName(magic), h->ih_vid, PrintInode(stmp, h->ih_ino), + "(volume=%" AFS_VOLID_FMT ", inode=%s); expected=%x, read=%x\n", + HeaderName(magic), afs_printable_VolumeId_lu(h->ih_vid), PrintInode(stmp, h->ih_ino), version, vsn->version); *ec = VSALVAGE; } @@ -2145,7 +2146,7 @@ VPreAttachVolumeByName_r(Error * ec, char *partition, char *name) Volume * VPreAttachVolumeById_r(Error * ec, char * partition, - VolId volumeId) + VolumeId volumeId) { Volume *vp; struct DiskPartition64 *partp; @@ -2198,7 +2199,7 @@ Volume * VPreAttachVolumeByVp_r(Error * ec, struct DiskPartition64 * partp, Volume * vp, - VolId vid) + VolumeId vid) { Volume *nvp = NULL; @@ -2217,8 +2218,9 @@ VPreAttachVolumeByVp_r(Error * ec, * - volume is in an error state * - volume is pre-attached */ - Log("VPreattachVolumeByVp_r: volume %u not in quiescent state (state %u flags 0x%x)\n", - vid, V_attachState(vp), V_attachFlags(vp)); + Log("VPreattachVolumeByVp_r: volume %" AFS_VOLID_FMT " not in quiescent state (state %u flags 0x%x)\n", + afs_printable_VolumeId_lu(vid), V_attachState(vp), + V_attachFlags(vp)); goto done; } else if (vp) { /* we're re-attaching a volume; clear out some old state */ @@ -2279,7 +2281,7 @@ VPreAttachVolumeByVp_r(Error * ec, VChangeState_r(vp, VOL_STATE_PREATTACHED); if (LogLevel >= 5) - Log("VPreAttachVolumeByVp_r: volume %u pre-attached\n", vp->hashid); + Log("VPreAttachVolumeByVp_r: volume %" AFS_VOLID_FMT " pre-attached\n", afs_printable_VolumeId_lu(vp->hashid)); done: if (*ec) @@ -2310,7 +2312,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) struct DiskPartition64 *partp; char path[64]; int isbusy = 0; - VolId volumeId; + VolumeId volumeId; int checkedOut; #ifdef AFS_DEMAND_ATTACH_FS VolumeStats stats_save; @@ -2558,7 +2560,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) } } if (LogLevel) - Log("VOnline: volume %u (%s) attached and online\n", V_id(vp), + Log("VOnline: volume %" AFS_VOLID_FMT " (%s) attached and online\n", afs_printable_VolumeId_lu(V_id(vp)), V_name(vp)); } @@ -2594,7 +2596,7 @@ VAttachVolumeByVp_r(Error * ec, Volume * vp, int mode) struct DiskPartition64 *partp; char path[64]; int isbusy = 0; - VolId volumeId; + VolumeId volumeId; Volume * nvp = NULL; VolumeStats stats_save; int checkedOut; @@ -2681,7 +2683,8 @@ VAttachVolumeByVp_r(Error * ec, Volume * vp, int mode) VUpdateVolume_r(ec, vp, 0); if (*ec) { - Log("VAttachVolume: Error updating volume %u\n", vp->hashid); + Log("VAttachVolume: Error updating volume %" AFS_VOLID_FMT "\n", + afs_printable_VolumeId_lu(vp->hashid)); VPutVolume_r(vp); goto done; } @@ -2699,15 +2702,16 @@ VAttachVolumeByVp_r(Error * ec, Volume * vp, int mode) #endif /* !AFS_DEMAND_ATTACH_FS */ VAddToVolumeUpdateList_r(ec, vp); if (*ec) { - Log("VAttachVolume: Error adding volume %u to update list\n", vp->hashid); + Log("VAttachVolume: Error adding volume %" AFS_VOLID_FMT " to update list\n", + afs_printable_VolumeId_lu(vp->hashid)); if (vp) VPutVolume_r(vp); goto done; } } if (LogLevel) - Log("VOnline: volume %u (%s) attached and online\n", V_id(vp), - V_name(vp)); + Log("VOnline: volume %" AFS_VOLID_FMT " (%s) attached and online\n", + afs_printable_VolumeId_lu(V_id(vp)), V_name(vp)); done: if (reserve) { VCancelReservation_r(nvp); @@ -3152,7 +3156,7 @@ attach_check_vop(Error *ec, VolumeId volid, struct DiskPartition64 *partp, * @post VOL_LOCK held */ static Volume * -attach2(Error * ec, VolId volumeId, char *path, struct DiskPartition64 *partp, +attach2(Error * ec, VolumeId volumeId, char *path, struct DiskPartition64 *partp, Volume * vp, int isbusy, int mode, int *acheckedOut) { /* have we read in the header successfully? */ @@ -3493,8 +3497,9 @@ locked_error: #ifdef AFS_DEMAND_ATTACH_FS if (!VIsErrorState(V_attachState(vp))) { if (VIsErrorState(error_state)) { - Log("attach2: forcing vol %u to error state (state %u flags 0x%x ec %d)\n", - vp->hashid, V_attachState(vp), V_attachFlags(vp), *ec); + Log("attach2: forcing vol %" AFS_VOLID_FMT " to error state (state %u flags 0x%x ec %d)\n", + afs_printable_VolumeId_lu(vp->hashid), V_attachState(vp), + V_attachFlags(vp), *ec); } VChangeState_r(vp, error_state); } @@ -3910,7 +3915,7 @@ VPutVolumeWithCall(Volume *vp, struct VCallByVol *cbv) of whether or not the volume is in service or on/off line. An error code, however, is returned with an indication of the volume's status */ Volume * -VGetVolume(Error * ec, Error * client_ec, VolId volumeId) +VGetVolume(Error * ec, Error * client_ec, VolumeId volumeId) { Volume *retVal; VOL_LOCK; @@ -3941,7 +3946,7 @@ VGetVolume(Error * ec, Error * client_ec, VolId volumeId) * VPutVolumeWithCall */ Volume * -VGetVolumeWithCall(Error * ec, Error * client_ec, VolId volumeId, +VGetVolumeWithCall(Error * ec, Error * client_ec, VolumeId volumeId, const struct timespec *ts, struct VCallByVol *cbv) { Volume *retVal; @@ -3953,7 +3958,7 @@ VGetVolumeWithCall(Error * ec, Error * client_ec, VolId volumeId, } Volume * -VGetVolume_r(Error * ec, VolId volumeId) +VGetVolume_r(Error * ec, VolumeId volumeId) { return GetVolume(ec, NULL, volumeId, NULL, NULL); } @@ -3989,7 +3994,7 @@ VGetVolumeByVp_r(Error * ec, Volume * vp) * @note for LWP builds, 'timeout' must be NULL */ static Volume * -GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, +GetVolume(Error * ec, Error * client_ec, VolumeId volumeId, Volume * hint, const struct timespec *timeout) { Volume *vp = hint; @@ -4204,8 +4209,8 @@ GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, /* Only log the error if it was a totally unexpected error. Simply * a missing inode is likely to be caused by the volume being deleted */ if (errno != ENXIO || LogLevel) - Log("Volume %u: couldn't reread volume header\n", - vp->hashid); + Log("Volume %" AFS_VOLID_FMT ": couldn't reread volume header\n", + afs_printable_VolumeId_lu(vp->hashid)); #ifdef AFS_DEMAND_ATTACH_FS if (VCanScheduleSalvage()) { VRequestSalvage_r(ec, vp, SALVSYNC_ERROR, 0 /*flags*/); @@ -4383,7 +4388,7 @@ VForceOffline_r(Volume * vp, int flags) strcpy(V_offlineMessage(vp), "Forced offline due to internal error: volume needs to be salvaged"); - Log("Volume %u forced offline: it needs salvaging!\n", V_id(vp)); + Log("Volume %" AFS_VOLID_FMT " forced offline: it needs salvaging!\n", afs_printable_VolumeId_lu(V_id(vp))); V_inUse(vp) = 0; vp->goingOffline = 0; @@ -4456,9 +4461,9 @@ VScanCalls_r(struct Volume *vp) char hoststr[16]; peer = rx_PeerOf(rx_ConnectionOf(cbv->call)); - Log("Offlining volume %lu while client %s:%u is trying to read " + Log("Offlining volume %" AFS_VOLID_FMT " while client %s:%u is trying to read " "from it; kicking client off with error %ld\n", - (long unsigned) vp->hashid, + afs_printable_VolumeId_lu(vp->hashid), afs_inet_ntoa_r(rx_HostOf(peer), hoststr), (unsigned) ntohs(rx_PortOf(peer)), (long) err); @@ -4917,8 +4922,8 @@ VUpdateVolume_r(Error * ec, Volume * vp, int flags) #endif if (*ec) { - Log("VUpdateVolume: error updating volume header, volume %u (%s)\n", - V_id(vp), V_name(vp)); + Log("VUpdateVolume: error updating volume header, volume %" AFS_VOLID_FMT " (%s)\n", + afs_printable_VolumeId_lu(V_id(vp)), V_name(vp)); /* try to update on-disk header, * while preventing infinite recursion */ if (!(flags & VOL_UPDATE_NOFORCEOFF)) { @@ -5041,8 +5046,8 @@ VCheckDetach(Volume * vp) V_inUse(vp) = 0; VUpdateVolume_r(&ec, vp, VOL_UPDATE_NOFORCEOFF); if (ec) { - Log("VCheckDetach: volume header update for volume %u " - "failed with errno %d\n", vp->hashid, errno); + Log("VCheckDetach: volume header update for volume %" AFS_VOLID_FMT " " + "failed with errno %d\n", afs_printable_VolumeId_lu(vp->hashid), errno); } } VReleaseVolumeHandles_r(vp); @@ -5075,8 +5080,8 @@ VCheckDetach(Volume * vp) V_inUse(vp) = 0; VUpdateVolume_r(&ec, vp, VOL_UPDATE_NOFORCEOFF); if (ec) { - Log("VCheckDetach: volume header update for volume %u failed with errno %d\n", - vp->hashid, errno); + Log("VCheckDetach: volume header update for volume %" AFS_VOLID_FMT " failed with errno %d\n", + afs_printable_VolumeId_lu(vp->hashid), errno); } } VReleaseVolumeHandles_r(vp); @@ -5632,7 +5637,7 @@ VRequestSalvage_r(Error * ec, Volume * vp, int reason, int flags) *ec = VSALVAGING; } else { - Log("VRequestSalvage: volume %u online salvaged too many times; forced offline.\n", vp->hashid); + Log("VRequestSalvage: volume %" AFS_VOLID_FMT " online salvaged too many times; forced offline.\n", afs_printable_VolumeId_lu(vp->hashid)); /* make sure neither VScheduleSalvage_r nor * VUpdateSalvagePriority_r try to schedule another salvage */ @@ -5716,8 +5721,8 @@ static_inline int try_SALVSYNC(Volume *vp, char *partName, int *code) { #ifdef SALVSYNC_BUILD_CLIENT if (VCanUseSALVSYNC()) { - Log("Scheduling salvage for volume %lu on part %s over SALVSYNC\n", - afs_printable_uint32_lu(vp->hashid), partName); + Log("Scheduling salvage for volume %" AFS_VOLID_FMT " on part %s over SALVSYNC\n", + afs_printable_VolumeId_lu(vp->hashid), partName); /* can't use V_id() since there's no guarantee * we have the disk data header at this point */ @@ -5737,8 +5742,8 @@ static_inline int try_FSSYNC(Volume *vp, char *partName, int *code) { #ifdef FSSYNC_BUILD_CLIENT if (VCanUseFSSYNC()) { - Log("Scheduling salvage for volume %lu on part %s over FSSYNC\n", - afs_printable_uint32_lu(vp->hashid), partName); + Log("Scheduling salvage for volume %" AFS_VOLID_FMT " on part %s over FSSYNC\n", + afs_printable_VolumeId_lu(vp->hashid), partName); /* * If we aren't the fileserver, tell the fileserver the volume @@ -5863,19 +5868,19 @@ VScheduleSalvage_r(Volume * vp) break; case SYNC_DENIED: ret = VCHECK_SALVAGE_DENIED; - Log("VScheduleSalvage_r: Salvage request for volume %lu " - "denied\n", afs_printable_uint32_lu(vp->hashid)); + Log("VScheduleSalvage_r: Salvage request for volume %" AFS_VOLID_FMT " " + "denied\n", afs_printable_VolumeId_lu(vp->hashid)); break; case SYNC_FAILED: ret = VCHECK_SALVAGE_FAIL; - Log("VScheduleSalvage_r: Salvage request for volume %lu " - "failed\n", afs_printable_uint32_lu(vp->hashid)); + Log("VScheduleSalvage_r: Salvage request for volume %" AFS_VOLID_FMT " " + "failed\n", afs_printable_VolumeId_lu(vp->hashid)); break; default: ret = VCHECK_SALVAGE_FAIL; - Log("VScheduleSalvage_r: Salvage request for volume %lu " + Log("VScheduleSalvage_r: Salvage request for volume %" AFS_VOLID_FMT " " "received unknown protocol error %d\n", - afs_printable_uint32_lu(vp->hashid), code); + afs_printable_VolumeId_lu(vp->hashid), code); break; } @@ -6569,7 +6574,7 @@ VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class) * */ void -VGetVolumePath(Error * ec, VolId volumeId, char **partitionp, char **namep) +VGetVolumePath(Error * ec, VolumeId volumeId, char **partitionp, char **namep) { static char partition[VMAXPATHLEN], name[VMAXPATHLEN]; char path[VMAXPATHLEN]; @@ -6579,7 +6584,7 @@ VGetVolumePath(Error * ec, VolId volumeId, char **partitionp, char **namep) *ec = 0; name[0] = OS_DIRSEPC; snprintf(&name[1], (sizeof name) - 1, VFORMAT, - afs_printable_uint32_lu(volumeId)); + afs_printable_VolumeId_lu(volumeId)); for (dp = DiskPartitionList; dp; dp = dp->next) { struct afs_stat_st status; strcpy(path, VPartitionPath(dp)); @@ -6642,7 +6647,7 @@ char * VolumeExternalName(VolumeId volumeId) { static char name[VMAXPATHLEN]; - snprintf(name, sizeof name, VFORMAT, afs_printable_uint32_lu(volumeId)); + snprintf(name, sizeof name, VFORMAT, afs_printable_VolumeId_lu(volumeId)); return name; } @@ -6663,7 +6668,7 @@ VolumeExternalName(VolumeId volumeId) int VolumeExternalName_r(VolumeId volumeId, char * name, size_t len) { - return snprintf(name, len, VFORMAT, afs_printable_uint32_lu(volumeId)); + return snprintf(name, len, VFORMAT, afs_printable_VolumeId_lu(volumeId)); } @@ -8402,7 +8407,7 @@ VInitVolumeHash(void) * asynchronous hash chain reordering to finish. */ static void -AddVolumeToHashTable(Volume * vp, int hashid) +AddVolumeToHashTable(Volume * vp, VolumeId hashid) { VolumeHashChainHead * head; @@ -8497,7 +8502,7 @@ DeleteVolumeFromHashTable(Volume * vp) * hint volume object. */ Volume * -VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint) +VLookupVolume_r(Error * ec, VolumeId volumeId, Volume * hint) { int looks = 0; Volume * vp, *np; diff --git a/src/vol/volume.h b/src/vol/volume.h index 66eaa9348..929008219 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -393,13 +393,13 @@ typedef struct VolumeDiskData { * occurred while the volume was on line. */ bit32 uniquifier; /* Next vnode uniquifier for this volume */ int type; /* */ - VolId parentId; /* Id of parent, if type==readonly */ - VolId cloneId; /* Latest read-only clone, if type==readwrite, + VolumeId parentId; /* Id of parent, if type==readonly */ + VolumeId cloneId; /* Latest read-only clone, if type==readwrite, * 0 if the volume has never been cloned. Note: the * indicated volume does not necessarily exist (it * may have been deleted since cloning). */ - VolId backupId; /* Latest backup copy of this read write volume */ - VolId restoredFromId; /* The id in the dump this volume was restored from--used simply + VolumeId backupId; /* Latest backup copy of this read write volume */ + VolumeId restoredFromId; /* The id in the dump this volume was restored from--used simply * to make sure that an incremental dump is not restored on top * of something inappropriate: Note: this field itself is NEVER * dumped!!! */ @@ -787,10 +787,10 @@ struct volHeader { extern char *VSalvageMessage; /* Canonical message when a volume is forced * offline */ -extern Volume *VGetVolume(Error * ec, Error * client_ec, VolId volumeId); -extern Volume *VGetVolumeWithCall(Error * ec, Error * client_ec, VolId volumeId, +extern Volume *VGetVolume(Error * ec, Error * client_ec, VolumeId volumeId); +extern Volume *VGetVolumeWithCall(Error * ec, Error * client_ec, VolumeId volumeId, const struct timespec *ts, struct VCallByVol *cbv); -extern Volume *VGetVolume_r(Error * ec, VolId volumeId); +extern Volume *VGetVolume_r(Error * ec, VolumeId volumeId); extern void VPutVolume(Volume *); extern void VPutVolumeWithCall(Volume *vp, struct VCallByVol *cbv); extern void VPutVolume_r(Volume *); @@ -803,10 +803,10 @@ extern void VDisconnectFS_r(void); extern int VChildProcReconnectFS(void); extern Volume *VAttachVolume(Error * ec, VolumeId volumeId, int mode); extern Volume *VAttachVolume_r(Error * ec, VolumeId volumeId, int mode); -extern Volume *VCreateVolume(Error * ec, char *partname, VolId volumeId, - VolId parentId); -extern Volume *VCreateVolume_r(Error * ec, char *partname, VolId volumeId, - VolId parentId); +extern Volume *VCreateVolume(Error * ec, char *partname, VolumeId volumeId, + VolumeId parentId); +extern Volume *VCreateVolume_r(Error * ec, char *partname, VolumeId volumeId, + VolumeId parentId); extern void VGrowBitmap(struct vnodeIndex *index); extern int VAllocBitmapEntry(Error * ec, Volume * vp, struct vnodeIndex *index); @@ -849,8 +849,8 @@ extern void VolumeHeaderToDisk(VolumeDiskHeader_t * dh, VolumeHeader_t * h); extern void AssignVolumeName(VolumeDiskData * vol, char *name, char *ext); extern void VTakeOffline_r(Volume * vp); extern void VTakeOffline(Volume * vp); -extern Volume * VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint); -extern void VGetVolumePath(Error * ec, VolId volumeId, char **partitionp, +extern Volume * VLookupVolume_r(Error * ec, VolumeId volumeId, Volume * hint); +extern void VGetVolumePath(Error * ec, VolumeId volumeId, char **partitionp, char **namep); extern char *vol_DevName(dev_t adev, char *wpath); extern afs_int32 VIsGoingOffline(struct Volume *vp); @@ -866,9 +866,9 @@ extern void VLockFileUnlock(struct VLockFile *lf, afs_uint32 offset); extern Volume *VPreAttachVolumeByName(Error * ec, char *partition, char *name); extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name); extern Volume *VPreAttachVolumeById_r(Error * ec, char * partition, - VolId volumeId); + VolumeId volumeId); extern Volume *VPreAttachVolumeByVp_r(Error * ec, struct DiskPartition64 * partp, - Volume * vp, VolId volume_id); + Volume * vp, VolumeId volume_id); extern Volume *VGetVolumeByVp_r(Error * ec, Volume * vp); extern int VShutdownByPartition_r(struct DiskPartition64 * dp); extern int VShutdownVolume_r(Volume * vp); @@ -1031,8 +1031,8 @@ extern int VWalkVolumeHeaders(struct DiskPartition64 *dp, const char *partpath, #define V_pref(vp,nearInode) nearInode = 0 #endif /* NEARINODE_HINT */ -hdr_static_inline(unsigned int) -afs_printable_VolumeId_u(VolumeId d) { return (unsigned int) d; } +hdr_static_inline(unsigned long) +afs_printable_VolumeId_lu(VolumeId d) { return (unsigned long) (d); } hdr_static_inline(unsigned int) afs_printable_VnodeId_u(VnodeId d) { return (unsigned int) d; } diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 5f0e0b6f5..7517e709f 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -99,7 +99,7 @@ RemoveInodes(struct afs_inode_info *stuff, Device dev, VolumeId parent, } Volume * -VCreateVolume(Error * ec, char *partname, VolId volumeId, VolId parentId) +VCreateVolume(Error * ec, char *partname, VolumeId volumeId, VolumeId parentId) { /* Should be the same as volumeId if there is * no parent */ Volume *retVal; @@ -110,7 +110,7 @@ VCreateVolume(Error * ec, char *partname, VolId volumeId, VolId parentId) } Volume * -VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId) +VCreateVolume_r(Error * ec, char *partname, VolumeId volumeId, VolumeId parentId) { /* Should be the same as volumeId if there is * no parent */ VolumeDiskData vol; @@ -192,7 +192,7 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId) vol.stamp.version = VOLUMEINFOVERSION; vol.destroyMe = DESTROY_ME; snprintf(headerName, sizeof headerName, VFORMAT, - afs_printable_uint32_lu(vol.id)); + afs_printable_VolumeId_lu(vol.id)); snprintf(volumePath, sizeof volumePath, "%s" OS_DIRSEP "%s", VPartitionPath(partition), headerName); rc = stat(volumePath, &st); @@ -303,8 +303,8 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId) rc = VCreateVolumeDiskHeader(&diskHeader, partition); if (rc) { Log("VCreateVolume: Error %d trying to write volume header for " - "volume %u on partition %s; volume not created\n", rc, - vol.id, VPartitionPath(partition)); + "volume %" AFS_VOLID_FMT " on partition %s; volume not created\n", rc, + afs_printable_VolumeId_lu(vol.id), VPartitionPath(partition)); if (rc == EEXIST) { *ec = VVOLEXISTS; } @@ -449,16 +449,16 @@ VReadVolumeDiskHeader(VolumeId volid, char path[MAXPATHLEN]; snprintf(path, sizeof(path), "%s" OS_DIRSEP VFORMAT, - VPartitionPath(dp), afs_printable_uint32_lu(volid)); + VPartitionPath(dp), afs_printable_VolumeId_lu(volid)); fd = open(path, O_RDONLY); if (fd < 0) { - Log("VReadVolumeDiskHeader: Couldn't open header for volume %lu (errno %d).\n", - afs_printable_uint32_lu(volid), errno); + Log("VReadVolumeDiskHeader: Couldn't open header for volume %" AFS_VOLID_FMT " (errno %d).\n", + afs_printable_VolumeId_lu(volid), errno); code = -1; } else if (hdr && read(fd, hdr, sizeof(*hdr)) != sizeof(*hdr)) { - Log("VReadVolumeDiskHeader: Couldn't read header for volume %lu.\n", - afs_printable_uint32_lu(volid)); + Log("VReadVolumeDiskHeader: Couldn't read header for volume %" AFS_VOLID_FMT ".\n", + afs_printable_VolumeId_lu(volid)); code = EIO; } @@ -504,7 +504,7 @@ _VWriteVolumeDiskHeader(VolumeDiskHeader_t * hdr, flags |= O_RDWR; snprintf(path, sizeof(path), "%s" OS_DIRSEP VFORMAT, - VPartitionPath(dp), afs_printable_uint32_lu(hdr->id)); + VPartitionPath(dp), afs_printable_VolumeId_lu(hdr->id)); fd = open(path, flags, 0644); if (fd < 0) { code = errno; @@ -683,7 +683,7 @@ VDestroyVolumeDiskHeader(struct DiskPartition64 * dp, #endif /* AFS_DEMAND_ATTACH_FS */ snprintf(path, sizeof(path), "%s" OS_DIRSEP VFORMAT, - VPartitionPath(dp), afs_printable_uint32_lu(volid)); + VPartitionPath(dp), afs_printable_VolumeId_lu(volid)); code = unlink(path); if (code) { Log("VDestroyVolumeDiskHeader: Couldn't unlink disk header, error = %d\n", errno); @@ -709,10 +709,10 @@ VDestroyVolumeDiskHeader(struct DiskPartition64 * dp, } code = FSYNC_VGCDel(dp->name, parent, volid, FSYNC_WHATEVER, &res); if (code) { - Log("VDestroyVolumeDiskHeader: FSYNC_VGCDel(%s, %lu, %lu) failed " + Log("VDestroyVolumeDiskHeader: FSYNC_VGCDel(%s, %" AFS_VOLID_FMT ", %" AFS_VOLID_FMT ") failed " "with code %ld reason %ld\n", dp->name, - afs_printable_uint32_lu(parent), - afs_printable_uint32_lu(volid), + afs_printable_VolumeId_lu(parent), + afs_printable_VolumeId_lu(volid), afs_printable_int32_ld(code), afs_printable_int32_ld(res.hdr.reason)); } diff --git a/src/volser/common.c b/src/volser/common.c index 74cf8ba9a..68cfe09c7 100644 --- a/src/volser/common.c +++ b/src/volser/common.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "volser.h" #endif diff --git a/src/volser/physio.c b/src/volser/physio.c index ccb474c09..3562cf828 100644 --- a/src/volser/physio.c +++ b/src/volser/physio.c @@ -83,7 +83,7 @@ ReallyWrite(DirHandle * file, int block, char *data) * The handle needs to be dereferenced with the FidZap() routine. */ void -SetSalvageDirHandle(DirHandle * dir, afs_uint32 volume, afs_int32 device, +SetSalvageDirHandle(DirHandle * dir, VolumeId volume, afs_int32 device, Inode inode) { private int SalvageCacheCheck = 1; diff --git a/src/volser/physio.h b/src/volser/physio.h index ae62c3abf..2975c0ba6 100644 --- a/src/volser/physio.h +++ b/src/volser/physio.h @@ -11,7 +11,7 @@ #define _VOLSER_PHYSIO_H /* physio.c */ -extern void SetSalvageDirHandle(DirHandle *, afs_uint32, afs_int32, Inode); +extern void SetSalvageDirHandle(DirHandle *, VolumeId, afs_int32, Inode); extern void FidZap(DirHandle *); #endif diff --git a/src/volser/vol_split.c b/src/volser/vol_split.c index 0351b5ddc..c6f31c3a1 100644 --- a/src/volser/vol_split.c +++ b/src/volser/vol_split.c @@ -85,8 +85,8 @@ ExtractVnodes(struct Msg *m, Volume *vol, afs_int32 class, fdP = IH_OPEN(vol->vnodeIndex[class].handle); if (!fdP) { - sprintf(m->line, "Couldn't open %s Index of volume %u\n", - class ? "small":"large", V_id(vol)); + sprintf(m->line, "Couldn't open %s Index of volume %" AFS_VOLID_FMT "\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(vol))); rx_Write(m->call, m->line, strlen(m->line)); code = EIO; goto Bad_Extract; @@ -99,8 +99,8 @@ ExtractVnodes(struct Msg *m, Volume *vol, afs_int32 class, } stream = FDH_FDOPEN(fdP, "r"); if (!stream) { - sprintf(m->line, "Couldn't stream open %s Index of volume %u\n", - class ? "small":"large", V_id(vol)); + sprintf(m->line, "Couldn't stream open %s Index of volume %" AFS_VOLID_FMT "\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(vol))); rx_Write(m->call, m->line, strlen(m->line)); code = EIO; goto Bad_Extract; @@ -142,9 +142,9 @@ ExtractVnodes(struct Msg *m, Volume *vol, afs_int32 class, } } if (m->verbose) { - sprintf(m->line, "Volume %u has %u %s vnodes in volume %u\n", - V_parentId(vol), *length, class? "small":"large", - V_id(vol)); + sprintf(m->line, "Volume %" AFS_VOLID_FMT " has %u %s vnodes in volume %" AFS_VOLID_FMT "\n", + afs_printable_VolumeId_lu(V_parentId(vol)), *length, + class? "small":"large", afs_printable_VolumeId_lu(V_id(vol))); rx_Write(m->call, m->line, strlen(m->line)); } @@ -238,10 +238,10 @@ copyDir(struct Msg *m, IHandle_t *inh, IHandle_t *outh) infdP = IH_OPEN(inh); if (!infdP) { - sprintf(m->line, "Couldn't open input directory %u.%u.%u\n", - infdP->fd_ih->ih_vid, - (afs_uint32)(infdP->fd_ih->ih_ino & NAMEI_VNODEMASK), - (afs_uint32)(infdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT)); + sprintf(m->line, "Couldn't open input directory %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(infdP->fd_ih->ih_vid), + (afs_uint32)(infdP->fd_ih->ih_ino & NAMEI_VNODEMASK), + (afs_uint32)(infdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT)); rx_Write(m->call, m->line, strlen(m->line)); return EIO; } @@ -256,10 +256,10 @@ copyDir(struct Msg *m, IHandle_t *inh, IHandle_t *outh) FDH_REALLYCLOSE(outfdP); outfdP = IH_OPEN(outh); if (!outfdP) { - sprintf(m->line, "Couldn't open output directory %u.%u.%u\n", - outfdP->fd_ih->ih_vid, - (afs_uint32)(outfdP->fd_ih->ih_ino & NAMEI_VNODEMASK), - (afs_uint32)(outfdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT)); + sprintf(m->line, "Couldn't open output directory %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(outfdP->fd_ih->ih_vid), + (afs_uint32)(outfdP->fd_ih->ih_ino & NAMEI_VNODEMASK), + (afs_uint32)(outfdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT)); rx_Write(m->call, m->line, strlen(m->line)); FDH_REALLYCLOSE(infdP); return EIO; @@ -271,8 +271,8 @@ copyDir(struct Msg *m, IHandle_t *inh, IHandle_t *outh) size_t tlen; tlen = size > 2048 ? 2048 : size; if (FDH_PREAD(infdP, tbuf, tlen, offset) != tlen) { - sprintf(m->line, "Couldn't read directory %u.%u.%u\n", - infdP->fd_ih->ih_vid, + sprintf(m->line, "Couldn't read directory %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(infdP->fd_ih->ih_vid), (afs_uint32)(infdP->fd_ih->ih_ino & NAMEI_VNODEMASK), (afs_uint32)(infdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT)); rx_Write(m->call, m->line, strlen(m->line)); @@ -282,8 +282,8 @@ copyDir(struct Msg *m, IHandle_t *inh, IHandle_t *outh) return EIO; } if (FDH_PWRITE(outfdP, tbuf, tlen, offset) != tlen) { - sprintf(m->line, "Couldn't write directory %u.%u.%u\n", - outfdP->fd_ih->ih_vid, + sprintf(m->line, "Couldn't write directory %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(outfdP->fd_ih->ih_vid), (afs_uint32)(outfdP->fd_ih->ih_ino & NAMEI_VNODEMASK), (afs_uint32)(outfdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT)); rx_Write(m->call, m->line, strlen(m->line)); @@ -320,15 +320,15 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, fdP = IH_OPEN(vol->vnodeIndex[class].handle); if (!fdP) { - Log("Couldn't open %s Index of volume %u\n", - class ? "small":"large", V_id(vol)); + Log("Couldn't open %s Index of volume %" AFS_VOLID_FMT "\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(vol))); code = EIO; goto Bad_Copy; } newfdP = IH_OPEN(newvol->vnodeIndex[class].handle); if (!newfdP) { - Log("Couldn't open %s Index of volume %u\n", - class ? "small":"large", V_id(newvol)); + Log("Couldn't open %s Index of volume %" AFS_VOLID_FMT "\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(newvol))); code = EIO; goto Bad_Copy; } @@ -340,8 +340,9 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, afs_uint64 size; offset = (e->vN + 1 - class) << (vcp->logSize -1); if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) { - Log("Couldn't read in %s Index of volume %u at offset %llu\n", - class ? "small":"large", V_id(vol), offset); + Log("Couldn't read in %s Index of volume %" AFS_VOLID_FMT " at offset %llu\n", + class ? "small":"large", + afs_printable_VolumeId_lu(V_id(vol)), offset); code = EIO; goto Bad_Copy; } @@ -371,8 +372,8 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, VNDISK_SET_INO(vnode, newino); vnode->cloned = 0; if (FDH_PWRITE(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) { - Log("Couldn't write in %s Index of volume %u at offset %llu\n", - class ? "small":"large", V_id(vol), offset); + Log("Couldn't write in %s Index of volume %" AFS_VOLID_FMT " at offset %llu\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(vol)), offset); code = EIO; goto Bad_Copy; } @@ -398,8 +399,8 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, e->vN, vnode->uniquifier, vnode->dataVersion); if (!VALID_INO(newino)) { - Log("IH_CREATE failed for %u.%u.%u\n", - V_id(newvol), e->vN, vnode->uniquifier); + Log("IH_CREATE failed for %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(V_id(newvol)), e->vN, vnode->uniquifier); code = EIO; goto Bad_Copy; } @@ -418,8 +419,8 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, vnode->parent = 1; /* in new root-directory */ vnode->cloned = 0; if (FDH_PWRITE(newfdP, vnode, vcp->diskSize, offset) != vcp->diskSize) { - Log("Couldn't write in %s Index of volume %u to offset %llu\n", - class ? "small":"large", V_id(newvol), offset); + Log("Couldn't write in %s Index of volume %" AFS_VOLID_FMT " to offset %llu\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(newvol)), offset); code = EIO; goto Bad_Copy; } @@ -437,15 +438,15 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, newoffset = vcp->diskSize; if (FDH_PREAD(newfdP, vnode2, vcp->diskSize, newoffset) != vcp->diskSize) { - Log("splitvolume: couldn't read in large Index of new volume %u at offset %u\n", - V_id(newvol), vcp->diskSize); + Log("splitvolume: couldn't read in large Index of new volume %" AFS_VOLID_FMT " at offset %u\n", + afs_printable_VolumeId_lu(V_id(newvol)), vcp->diskSize); code = EIO; goto Bad_Copy; } offset = (where + 1 - class) << (vcp->logSize -1); if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) { - Log("Couldn't read in large Index of old volume %u at offset %llu\n", - V_id(vol), offset); + Log("Couldn't read in large Index of old volume %" AFS_VOLID_FMT " at offset %llu\n", + afs_printable_VolumeId_lu(V_id(vol)), offset); code = EIO; goto Bad_Copy; } @@ -458,8 +459,9 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, code = copyDir(m, h, newh); if (code) { Log("splitvolume: copyDir failed for new root from " - "%u.%u.%u to %u.1.1\n", - V_id(vol), where, vnode->uniquifier, V_id(newvol)); + "%" AFS_VOLID_FMT ".%u.%u to %" AFS_VOLID_FMT ".1.1\n", + afs_printable_VolumeId_lu(V_id(vol)), where, vnode->uniquifier, + afs_printable_VolumeId_lu(V_id(newvol))); code = EIO; goto Bad_Copy; } @@ -469,8 +471,8 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol, vnode->parent = vnode2->parent; vnode->serverModifyTime = vnode2->serverModifyTime; if (FDH_PWRITE(newfdP, vnode, vcp->diskSize, newoffset) != vcp->diskSize) { - Log("splitvolume: couldn't write in large Index of %u at offset %u\n", - V_id(newvol), vcp->diskSize); + Log("splitvolume: couldn't write in large Index of %" AFS_VOLID_FMT " at offset %u\n", + afs_printable_VolumeId_lu(V_id(newvol)), vcp->diskSize); code = EIO; } } @@ -524,7 +526,7 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent, FT_GetTimeOfDay(&now, 0); fdP = IH_OPEN(vol->vnodeIndex[vSmall].handle); if (!fdP) { - Log("split volume: error opening small vnode index of %u\n", V_id(vol)); + Log("split volume: error opening small vnode index of %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(V_id(vol))); return EIO; } offset = vcp->diskSize; @@ -532,7 +534,7 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent, rc = FDH_PREAD(fdP, &vnode, vcp->diskSize, offset); if (rc != vcp->diskSize) { if (rc < 0) { - Log("split volume: error reading small vnode index of %u\n", V_id(vol)); + Log("split volume: error reading small vnode index of %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(V_id(vol))); return EIO; } if (rc == 0) @@ -569,15 +571,15 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent, IH_INIT(h, V_device(vol), V_parentId(vol), newino); fdP2 = IH_OPEN(h); if (!fdP2) { - Log("split volume: couldn't open inode for mountpoint %u.%u.%u\n", - V_id(vol), newvN, vnode.uniquifier); + Log("split volume: couldn't open inode for mountpoint %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(V_id(vol)), newvN, vnode.uniquifier); return EIO; } sprintf(symlink, "#%s", V_name(newvol)); size = strlen(symlink) + 1; if (FDH_PWRITE(fdP2, symlink, size, 0) != size) { - Log("split volume: couldn't write mountpoint %u.%u.%u\n", - V_id(vol), newvN, vnode.uniquifier); + Log("split volume: couldn't write mountpoint %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(V_id(vol)), newvN, vnode.uniquifier); return EIO; } FDH_REALLYCLOSE(fdP2); @@ -588,8 +590,8 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent, vnode.vnodeMagic = SMALLVNODEMAGIC; #endif if (FDH_PWRITE(fdP, &vnode, vcp->diskSize, offset) != vcp->diskSize) { - Log("split volume: couldn't write vnode for mountpoint %u.%u.%u\n", - V_id(vol), newvN, vnode.uniquifier); + Log("split volume: couldn't write vnode for mountpoint %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(V_id(vol)), newvN, vnode.uniquifier); return EIO; } FDH_REALLYCLOSE(fdP); @@ -607,8 +609,8 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent, code = afs_dir_Delete(&dir, name); if (code) { - Log("splitvolume: couldn't delete directory entry for %s in %u.%u.%u, code = %d\n", - name, V_id(vol), vN, parent->uniquifier, code); + Log("splitvolume: couldn't delete directory entry for %s in %" AFS_VOLID_FMT ".%u.%u, code = %d\n", + name, afs_printable_VolumeId_lu(V_id(vol)), vN, parent->uniquifier, code); return code; } code = afs_dir_Create(&dir, name, &fid); @@ -627,8 +629,8 @@ createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent, offset = (vN + 1 - class) << (vcp->logSize -1); parent->dataVersion++; if (FDH_PWRITE(fdP, parent, vcp->diskSize, offset) != vcp->diskSize) { - Log("split volume: couldn't write vnode for parent directory %u.%u.%u\n", - V_id(vol), vN, parent->uniquifier); + Log("split volume: couldn't write vnode for parent directory %" AFS_VOLID_FMT ".%u.%u\n", + afs_printable_VolumeId_lu(V_id(vol)), vN, parent->uniquifier); return EIO; } FDH_REALLYCLOSE(fdP); @@ -652,8 +654,8 @@ deleteVnodes(Volume *vol, afs_int32 class, fdP = IH_OPEN(vol->vnodeIndex[class].handle); if (!fdP) { - Log("Couldn't open %s Index of volume %u\n", - class ? "small":"large", V_id(vol)); + Log("Couldn't open %s Index of volume %" AFS_VOLID_FMT "\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(vol))); code = EIO; goto Bad_Delete; } @@ -663,8 +665,8 @@ deleteVnodes(Volume *vol, afs_int32 class, if (e->flag & NEEDED) { offset = (e->vN + 1 - class) << (vcp->logSize -1); if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) { - Log("Couldn't read in %s Index of volume %u at offset %llu\n", - class ? "small":"large", V_id(vol), offset); + Log("Couldn't read in %s Index of volume %" AFS_VOLID_FMT " at offset %llu\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(vol)), offset); code = EIO; goto Bad_Delete; } @@ -683,8 +685,8 @@ deleteVnodes(Volume *vol, afs_int32 class, memset(vnode, 0, vcp->diskSize); vnode->type = vNull; if (FDH_PWRITE(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) { - Log("Couldn't write in %s Index of volume %u to offset %llu\n", - class ? "small":"large", V_id(vol), offset); + Log("Couldn't write in %s Index of volume %" AFS_VOLID_FMT " to offset %llu\n", + class ? "small":"large", afs_printable_VolumeId_lu(V_id(vol)), offset); } } } @@ -732,23 +734,23 @@ split_volume(struct rx_call *call, Volume *vol, Volume *newvol, &parent, parVnode); if (code) { sprintf(m->line, - "ExtractVnodes failed for %u for directories with code %d\n", - V_id(vol), code); + "ExtractVnodes failed for %" AFS_VOLID_FMT " for directories with code %d\n", + afs_printable_VolumeId_lu(V_id(vol)), code); rx_Write(m->call, m->line, strlen(m->line)); return code; } if (verbose) { - sprintf(m->line, "2nd step: look for name of vnode %u in directory %u.%u.%u\n", - where, V_id(vol), parent, parVnode->uniquifier); + sprintf(m->line, "2nd step: look for name of vnode %u in directory %" AFS_VOLID_FMT ".%u.%u\n", + where, afs_printable_VolumeId_lu(V_id(vol)), parent, parVnode->uniquifier); rx_Write(m->call, m->line, strlen(m->line)); } code = findName(vol, parVnode, where, rootVnode->uniquifier, name, sizeof(name)); if (code) { sprintf(m->line, - "splitvolume: could'nt find name of %u in directory %u.%u.%u.\n", - where, V_id(vol), parent, parVnode->uniquifier); + "splitvolume: could'nt find name of %u in directory %" AFS_VOLID_FMT ".%u.%u.\n", + where, afs_printable_VolumeId_lu(V_id(vol)), parent, parVnode->uniquifier); rx_Write(m->call, m->line, strlen(m->line)); return code; } @@ -777,8 +779,8 @@ split_volume(struct rx_call *call, Volume *vol, Volume *newvol, code = ExtractVnodes(m, vol, vSmall, &fileList, &fl, where, 0, 0, 0); if (code) { sprintf(m->line, - "ExtractVnodes failed for %u for files with code %d\n", - V_id(vol), code); + "ExtractVnodes failed for %" AFS_VOLID_FMT " for files with code %d\n", + afs_printable_VolumeId_lu(V_id(vol)), code); rx_Write(m->call, m->line, strlen(m->line)); return code; } diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index f24a9f251..13c2fc247 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -81,10 +81,10 @@ static afs_int32 VolCreateVolume(struct rx_call *, afs_int32, char *, afs_int32, afs_uint32, afs_uint32 *, afs_int32 *); static afs_int32 VolDeleteVolume(struct rx_call *, afs_int32); -static afs_int32 VolClone(struct rx_call *, afs_int32, afs_uint32, - afs_int32, char *, afs_uint32 *); -static afs_int32 VolReClone(struct rx_call *, afs_int32, afs_int32); -static afs_int32 VolTransCreate(struct rx_call *, afs_uint32, afs_int32, +static afs_int32 VolClone(struct rx_call *, afs_int32, VolumeId, + afs_int32, char *, VolumeId *); +static afs_int32 VolReClone(struct rx_call *, afs_int32, VolumeId); +static afs_int32 VolTransCreate(struct rx_call *, VolumeId, afs_int32, afs_int32, afs_int32 *); static afs_int32 VolGetNthVolume(struct rx_call *, afs_int32, afs_uint32 *, afs_int32 *); @@ -104,9 +104,9 @@ static afs_int32 VolSetInfo(struct rx_call *, afs_int32, struct volintInfo *); static afs_int32 VolGetName(struct rx_call *, afs_int32, char **); static afs_int32 VolListPartitions(struct rx_call *, struct pIDs *); static afs_int32 XVolListPartitions(struct rx_call *, struct partEntries *); -static afs_int32 VolListOneVolume(struct rx_call *, afs_int32, afs_uint32, +static afs_int32 VolListOneVolume(struct rx_call *, afs_int32, VolumeId, volEntries *); -static afs_int32 VolXListOneVolume(struct rx_call *, afs_int32, afs_uint32, +static afs_int32 VolXListOneVolume(struct rx_call *, afs_int32, VolumeId, volXEntries *); static afs_int32 VolListVolumes(struct rx_call *, afs_int32, afs_int32, volEntries *); @@ -114,8 +114,8 @@ static afs_int32 VolXListVolumes(struct rx_call *, afs_int32, afs_int32, volXEntries *); static afs_int32 VolMonitor(struct rx_call *, transDebugEntries *); static afs_int32 VolSetIdsTypes(struct rx_call *, afs_int32, char [], - afs_int32, afs_uint32, afs_uint32, - afs_uint32); + afs_int32, VolumeId, VolumeId, + VolumeId); static afs_int32 VolSetDate(struct rx_call *, afs_int32, afs_int32); /** @@ -196,12 +196,12 @@ PartitionID(char *aname) } static int -ConvertVolume(afs_uint32 avol, char *aname, afs_int32 asize) +ConvertVolume(VolumeId avol, 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 */ - snprintf(aname, asize, VFORMAT, (unsigned long)avol); + snprintf(aname, asize, VFORMAT, afs_printable_VolumeId_lu(avol)); return 0; } @@ -466,7 +466,7 @@ VolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition64 /* obliterate a volume completely, and slowly. */ afs_int32 -SAFSVolNukeVolume(struct rx_call *acid, afs_int32 apartID, afs_uint32 avolID) +SAFSVolNukeVolume(struct rx_call *acid, afs_int32 apartID, VolumeId avolID) { afs_int32 code; @@ -515,7 +515,7 @@ VolNukeVolume(struct rx_call *acid, afs_int32 apartID, afs_uint32 avolID) */ afs_int32 SAFSVolCreateVolume(struct rx_call *acid, afs_int32 apart, char *aname, - afs_int32 atype, afs_uint32 aparent, afs_uint32 *avolid, + afs_int32 atype, VolumeId aparent, VolumeId *avolid, afs_int32 *atrans) { afs_int32 code; @@ -647,14 +647,15 @@ VolDeleteVolume(struct rx_call *acid, afs_int32 atrans) if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: Delete: volume %u already deleted \n", tt->volid); + Log("1 Volser: Delete: volume %" AFS_VOLID_FMT " already deleted \n", + afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } if (DoLogging) { char buffer[16]; - Log("%s on %s is executing Delete Volume %u\n", caller, - callerAddress(acid, buffer), tt->volid); + Log("%s on %s is executing Delete Volume %" AFS_VOLID_FMT "\n", caller, + callerAddress(acid, buffer), afs_printable_VolumeId_lu(tt->volid)); } TSetRxCall(tt, acid, "DeleteVolume"); VPurgeVolume(&error, tt->volume); /* don't check error code, it is not set! */ @@ -669,7 +670,8 @@ VolDeleteVolume(struct rx_call *acid, afs_int32 atrans) if (TRELE(tt)) return VOLSERTRELE_ERROR; - Log("1 Volser: Delete: volume %u deleted \n", tt->volid); + Log("1 Volser: Delete: volume %" AFS_VOLID_FMT " deleted \n", + afs_printable_VolumeId_lu(tt->volid)); return 0; /* vpurgevolume doesn't set an error code */ } @@ -685,11 +687,10 @@ VolDeleteVolume(struct rx_call *acid, afs_int32 atrans) */ /* for efficiency reasons, sometimes faster to piggyback a purge here */ afs_int32 -SAFSVolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, - afs_int32 newType, char *newName, afs_uint32 *newNumber) +SAFSVolClone(struct rx_call *acid, afs_int32 atrans, VolumeId purgeId, + afs_int32 newType, char *newName, VolumeId *newNumber) { afs_int32 code; - code = VolClone(acid, atrans, purgeId, newType, newName, newNumber); osi_auditU(acid, VS_CloneEvent, code, AUD_LONG, atrans, AUD_LONG, purgeId, AUD_STR, newName, AUD_LONG, newType, AUD_LONG, *newNumber, @@ -698,10 +699,10 @@ SAFSVolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, } static afs_int32 -VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, - afs_int32 newType, char *newName, afs_uint32 *newNumber) +VolClone(struct rx_call *acid, afs_int32 atrans, VolumeId purgeId, + afs_int32 newType, char *newName, VolumeId *newNumber) { - afs_uint32 newId; + VolumeId newId; struct Volume *originalvp, *purgevp, *newvp; Error error, code; struct volser_trans *tt, *ttc; @@ -735,7 +736,7 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: Clone: volume %u has been deleted \n", tt->volid); + Log("1 Volser: Clone: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -750,7 +751,7 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, if (purgeId) { purgevp = VAttachVolume_retry(&error, purgeId, V_VOLUPD); if (error) { - Log("1 Volser: Clone: Could not attach 'purge' volume %u; clone aborted\n", purgeId); + Log("1 Volser: Clone: Could not attach 'purge' volume %" AFS_VOLID_FMT "; clone aborted\n", afs_printable_VolumeId_lu(purgeId)); goto fail; } } else { @@ -758,14 +759,14 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, } originalvp = tt->volume; if ((V_destroyMe(originalvp) == DESTROY_ME) || !V_inService(originalvp)) { - Log("1 Volser: Clone: Volume %d is offline and cannot be cloned\n", - V_id(originalvp)); + Log("1 Volser: Clone: Volume %" AFS_VOLID_FMT " is offline and cannot be cloned\n", + afs_printable_VolumeId_lu(V_id(originalvp))); error = VOFFLINE; goto fail; } if (purgevp) { if (originalvp->device != purgevp->device) { - Log("1 Volser: Clone: Volumes %u and %u are on different devices\n", tt->volid, purgeId); + Log("1 Volser: Clone: Volumes %" AFS_VOLID_FMT " and %" AFS_VOLID_FMT " are on different devices\n", afs_printable_VolumeId_lu(tt->volid), afs_printable_VolumeId_lu(purgeId)); error = EXDEV; goto fail; } @@ -775,7 +776,7 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, goto fail; } if (V_parentId(originalvp) != V_parentId(purgevp)) { - Log("1 Volser: Clone: Volume %u and volume %u were not originally cloned from the same parent; aborted\n", purgeId, tt->volid); + Log("1 Volser: Clone: Volume %" AFS_VOLID_FMT " and volume %" AFS_VOLID_FMT " were not originally cloned from the same parent; aborted\n", afs_printable_VolumeId_lu(purgeId), afs_printable_VolumeId_lu(tt->volid)); error = EXDEV; goto fail; } @@ -800,10 +801,10 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, } if (newType == readonlyVolume) V_cloneId(originalvp) = newId; - Log("1 Volser: Clone: Cloning volume %u to new volume %u\n", tt->volid, - newId); + Log("1 Volser: Clone: Cloning volume %" AFS_VOLID_FMT " to new volume %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(tt->volid), + afs_printable_VolumeId_lu(newId)); if (purgevp) - Log("1 Volser: Clone: Purging old read only volume %u\n", purgeId); + Log("1 Volser: Clone: Purging old read only volume %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(purgeId)); CloneVolume(&error, originalvp, newvp, purgevp); purgevp = NULL; /* clone releases it, maybe even if error */ if (error) { @@ -876,7 +877,7 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId, /* reclone this volume into the specified id */ afs_int32 -SAFSVolReClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 cloneId) +SAFSVolReClone(struct rx_call *acid, afs_int32 atrans, VolumeId cloneId) { afs_int32 code; @@ -887,7 +888,7 @@ SAFSVolReClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 cloneId) } static afs_int32 -VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId) +VolReClone(struct rx_call *acid, afs_int32 atrans, VolumeId cloneId) { struct Volume *originalvp, *clonevp; Error error, code; @@ -901,8 +902,8 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId) return VOLSERBAD_ACCESS; if (DoLogging) { char buffer[16]; - Log("%s on %s is executing Reclone Volume %u\n", caller, - callerAddress(acid, buffer), cloneId); + Log("%s on %s is executing Reclone Volume %" AFS_VOLID_FMT "\n", caller, + callerAddress(acid, buffer), afs_printable_VolumeId_lu(cloneId)); } error = 0; clonevp = originalvp = (Volume *) 0; @@ -912,7 +913,7 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId) if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolReClone: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolReClone: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -925,28 +926,28 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId) originalvp = tt->volume; if ((V_destroyMe(originalvp) == DESTROY_ME) || !V_inService(originalvp)) { - Log("1 Volser: Clone: Volume %d is offline and cannot be cloned\n", - V_id(originalvp)); + Log("1 Volser: Clone: Volume %" AFS_VOLID_FMT " is offline and cannot be cloned\n", + afs_printable_VolumeId_lu(V_id(originalvp))); error = VOFFLINE; goto fail; } clonevp = VAttachVolume_retry(&error, cloneId, V_VOLUPD); if (error) { - Log("1 Volser: can't attach clone %d\n", cloneId); + Log("1 Volser: can't attach clone %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(cloneId)); goto fail; } newType = V_type(clonevp); /* type of the new volume */ if (originalvp->device != clonevp->device) { - Log("1 Volser: Clone: Volumes %u and %u are on different devices\n", - tt->volid, cloneId); + Log("1 Volser: Clone: Volumes %" AFS_VOLID_FMT " and %" AFS_VOLID_FMT " are on different devices\n", + afs_printable_VolumeId_lu(tt->volid), afs_printable_VolumeId_lu(cloneId)); error = EXDEV; goto fail; } if (V_parentId(originalvp) != V_parentId(clonevp)) { - Log("1 Volser: Clone: Volume %u was not originally cloned from volume %u; aborted\n", cloneId, tt->volid); + Log("1 Volser: Clone: Volume %" AFS_VOLID_FMT " was not originally cloned from volume %" AFS_VOLID_FMT "; aborted\n", afs_printable_VolumeId_lu(cloneId), afs_printable_VolumeId_lu(tt->volid)); error = EXDEV; goto fail; } @@ -956,8 +957,8 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId) } error = 0; - Log("1 Volser: Clone: Recloning volume %u to volume %u\n", tt->volid, - cloneId); + Log("1 Volser: Clone: Recloning volume %" AFS_VOLID_FMT " to volume %" AFS_VOLID_FMT "\n", afs_printable_VolumeId_lu(tt->volid), + afs_printable_VolumeId_lu(cloneId)); CloneVolume(&error, originalvp, clonevp, clonevp); if (error) { Log("1 Volser: Clone: reclone operation failed with code %d\n", @@ -1044,7 +1045,7 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId) * See volser.h for definition of iflags (the constants are named IT*). */ afs_int32 -SAFSVolTransCreate(struct rx_call *acid, afs_uint32 volume, afs_int32 partition, +SAFSVolTransCreate(struct rx_call *acid, VolumeId volume, afs_int32 partition, afs_int32 iflags, afs_int32 *ttid) { afs_int32 code; @@ -1056,7 +1057,7 @@ SAFSVolTransCreate(struct rx_call *acid, afs_uint32 volume, afs_int32 partition, } static afs_int32 -VolTransCreate(struct rx_call *acid, afs_uint32 volume, afs_int32 partition, +VolTransCreate(struct rx_call *acid, VolumeId volume, afs_int32 partition, afs_int32 iflags, afs_int32 *ttid) { struct volser_trans *tt; @@ -1113,7 +1114,7 @@ VolTransCreate(struct rx_call *acid, afs_uint32 volume, afs_int32 partition, * Both the volume number and partition number (one-based) are returned. */ afs_int32 -SAFSVolGetNthVolume(struct rx_call *acid, afs_int32 aindex, afs_uint32 *avolume, +SAFSVolGetNthVolume(struct rx_call *acid, afs_int32 aindex, VolumeId *avolume, afs_int32 *apart) { afs_int32 code; @@ -1153,8 +1154,8 @@ VolGetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 *aflags) if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolGetFlags: volume %u has been deleted \n", - tt->volid); + Log("1 Volser: VolGetFlags: volume %" AFS_VOLID_FMT " has been deleted \n", + afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1197,8 +1198,8 @@ VolSetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 aflags) if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolSetFlags: volume %u has been deleted \n", - tt->volid); + Log("1 Volser: VolSetFlags: volume %" AFS_VOLID_FMT " has been deleted \n", + afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1277,7 +1278,7 @@ VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolForward: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolForward: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1376,7 +1377,7 @@ SAFSVolForwardMultiple(struct rx_call *acid, afs_int32 fromTrans, afs_int32 if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolForward: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolForward: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1499,7 +1500,7 @@ VolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolDump: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolDump: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1547,7 +1548,7 @@ VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags, if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolRestore: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolRestore: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1616,8 +1617,8 @@ VolSetForwarding(struct rx_call *acid, afs_int32 atid, afs_int32 anewsite) if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolSetForwarding: volume %u has been deleted \n", - tt->volid); + Log("1 Volser: VolSetForwarding: volume %" AFS_VOLID_FMT " has been deleted \n", + afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1657,8 +1658,8 @@ VolGetStatus(struct rx_call *acid, afs_int32 atrans, if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolGetStatus: volume %u has been deleted \n", - tt->volid); + Log("1 Volser: VolGetStatus: volume %" AFS_VOLID_FMT " has been deleted \n", + afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1721,7 +1722,7 @@ VolSetInfo(struct rx_call *acid, afs_int32 atrans, if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolSetInfo: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolSetInfo: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1781,7 +1782,7 @@ VolGetName(struct rx_call *acid, afs_int32 atrans, char **aname) if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolGetName: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolGetName: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -1813,7 +1814,7 @@ VolGetName(struct rx_call *acid, afs_int32 atrans, char **aname) * - a noop now !*/ afs_int32 SAFSVolSignalRestore(struct rx_call *acid, char volname[], int volType, - afs_uint32 parentId, afs_uint32 cloneId) + VolumeId parentId, VolumeId cloneId) { return 0; } @@ -1917,7 +1918,7 @@ XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries) * false if we got to the end of the directory */ static int -GetNextVol(DIR *dirp, char *volname, afs_uint32 *volid) +GetNextVol(DIR *dirp, char *volname, VolumeId *volid) { struct dirent *dp; @@ -2136,7 +2137,7 @@ FillVolInfo(Volume * vp, volint_info_handle_t * handle) * @internal */ static int -GetVolObject(afs_uint32 volumeId, char * pname, Volume ** vp) +GetVolObject(VolumeId volumeId, char * pname, Volume ** vp) { int code; SYNC_response res; @@ -2192,7 +2193,7 @@ typedef enum { */ static int GetVolInfo(afs_uint32 partId, - afs_uint32 volumeId, + VolumeId volumeId, char * pname, char * volname, volint_info_handle_t * handle, @@ -2235,8 +2236,8 @@ GetVolInfo(afs_uint32 partId, } if (error) { - Log("1 Volser: GetVolInfo: Could not attach volume %u (%s:%s) error=%d\n", - volumeId, pname, volname, error); + Log("1 Volser: GetVolInfo: Could not attach volume %" AFS_VOLID_FMT " (%s:%s) error=%d\n", + afs_printable_VolumeId_lu(volumeId), pname, volname, error); goto drop; } @@ -2254,8 +2255,8 @@ GetVolInfo(afs_uint32 partId, goto drop; case VOL_INFO_LIST_SINGLE: - Log("1 Volser: GetVolInfo: Volume %u (%s:%s) will be destroyed on next salvage\n", - volumeId, pname, volname); + Log("1 Volser: GetVolInfo: Volume %" AFS_VOLID_FMT " (%s:%s) will be destroyed on next salvage\n", + afs_printable_VolumeId_lu(volumeId), pname, volname); default: goto drop; @@ -2264,8 +2265,8 @@ GetVolInfo(afs_uint32 partId, if (V_needsSalvaged(tv)) { /*this volume will be salvaged */ - Log("1 Volser: GetVolInfo: Volume %u (%s:%s) needs to be salvaged\n", - volumeId, pname, volname); + Log("1 Volser: GetVolInfo: Volume %" AFS_VOLID_FMT " (%s:%s) needs to be salvaged\n", + afs_printable_VolumeId_lu(volumeId), pname, volname); } #ifdef AFS_DEMAND_ATTACH_FS @@ -2309,8 +2310,8 @@ GetVolInfo(afs_uint32 partId, if (error) { VOLINT_INFO_STORE(handle, status, 0); strcpy((char *)VOLINT_INFO_PTR(handle, name), volname); - Log("1 Volser: GetVolInfo: Could not detach volume %u (%s:%s)\n", - volumeId, pname, volname); + Log("1 Volser: GetVolInfo: Could not detach volume %" AFS_VOLID_FMT " (%s:%s)\n", + afs_printable_VolumeId_lu(volumeId), pname, volname); } } if (ttc) { @@ -2324,7 +2325,7 @@ GetVolInfo(afs_uint32 partId, /*return the header information about the */ afs_int32 SAFSVolListOneVolume(struct rx_call *acid, afs_int32 partid, - afs_uint32 volumeId, volEntries *volumeInfo) + VolumeId volumeId, volEntries *volumeInfo) { afs_int32 code; @@ -2335,12 +2336,12 @@ SAFSVolListOneVolume(struct rx_call *acid, afs_int32 partid, static afs_int32 VolListOneVolume(struct rx_call *acid, afs_int32 partid, - afs_uint32 volumeId, volEntries *volumeInfo) + VolumeId volumeId, volEntries *volumeInfo) { struct DiskPartition64 *partP; char pname[9], volname[20]; DIR *dirp; - afs_uint32 volid; + VolumeId volid; int found = 0; int code; volint_info_handle_t handle; @@ -2413,7 +2414,7 @@ VolListOneVolume(struct rx_call *acid, afs_int32 partid, afs_int32 SAFSVolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, - afs_uint32 a_volID, volXEntries *a_volumeXInfoP) + VolumeId a_volID, volXEntries *a_volumeXInfoP) { afs_int32 code; @@ -2424,13 +2425,13 @@ SAFSVolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, static afs_int32 VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, - afs_uint32 a_volID, volXEntries *a_volumeXInfoP) + VolumeId a_volID, volXEntries *a_volumeXInfoP) { /*SAFSVolXListOneVolume */ struct DiskPartition64 *partP; /*Ptr to partition */ char pname[9], volname[20]; /*Partition, volume names */ DIR *dirp; /*Partition directory ptr */ - afs_uint32 currVolID; /*Current volume ID */ + VolumeId currVolID; /*Current volume ID */ int found = 0; /*Did we find the volume we need? */ int code; volint_info_handle_t handle; @@ -2530,7 +2531,7 @@ VolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, afs_int32 allocSize = 1000; /*to be changed to a larger figure */ char pname[9], volname[20]; DIR *dirp; - afs_uint32 volid; + VolumeId volid; int code; volint_info_handle_t handle; @@ -2640,7 +2641,7 @@ VolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID, afs_int32 allocSize = 1000; /*To be changed to a larger figure */ char pname[9], volname[20]; /*Partition, volume names */ DIR *dirp; /*Partition directory ptr */ - afs_uint32 volid; /*Current volume ID */ + VolumeId volid; /*Current volume ID */ int code; volint_info_handle_t handle; @@ -2817,8 +2818,8 @@ done: afs_int32 SAFSVolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], - afs_int32 type, afs_uint32 pId, afs_uint32 cloneId, - afs_uint32 backupId) + afs_int32 type, afs_uint32 pId, VolumeId cloneId, + VolumeId backupId) { afs_int32 code; @@ -2831,8 +2832,8 @@ SAFSVolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], static afs_int32 VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], - afs_int32 type, afs_uint32 pId, afs_uint32 cloneId, - afs_uint32 backupId) + afs_int32 type, VolumeId pId, VolumeId cloneId, + VolumeId backupId) { struct Volume *tv; Error error = 0; @@ -2848,7 +2849,7 @@ VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolSetIds: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolSetIds: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -2904,7 +2905,7 @@ VolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate) if (!tt) return ENOENT; if (tt->vflags & VTDeleted) { - Log("1 Volser: VolSetDate: volume %u has been deleted \n", tt->volid); + Log("1 Volser: VolSetDate: volume %" AFS_VOLID_FMT " has been deleted \n", afs_printable_VolumeId_lu(tt->volid)); TRELE(tt); return ENOENT; } @@ -2932,7 +2933,7 @@ VolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate) afs_int32 SAFSVolConvertROtoRWvolume(struct rx_call *acid, afs_int32 partId, - afs_uint32 volumeId) + VolumeId volumeId) { #ifdef AFS_NT40_ENV return EXDEV; @@ -2943,7 +2944,7 @@ SAFSVolConvertROtoRWvolume(struct rx_call *acid, afs_int32 partId, char pname[16], volname[20]; struct DiskPartition64 *partP; afs_int32 ret = ENODEV; - afs_uint32 volid; + VolumeId volid; if (!afsconf_SuperUser(tdir, acid, caller)) return VOLSERBAD_ACCESS; /*not a super user */ diff --git a/src/volser/volser.p.h b/src/volser/volser.p.h index ce6933144..9f7b9409a 100644 --- a/src/volser/volser.p.h +++ b/src/volser/volser.p.h @@ -46,7 +46,7 @@ struct volser_trans { afs_int32 creationTime; /* time the transaction started */ afs_int32 returnCode; /* transaction error code */ struct Volume *volume; /* pointer to open volume */ - afs_uint32 volid; /* open volume's id */ + VolumeId volid; /* open volume's id */ afs_int32 partition; /* open volume's partition */ afs_int32 dumpTransId; /* other side's trans id during a dump */ afs_int32 dumpSeq; /* next sequence number to use during a dump */ diff --git a/src/volser/volser_internal.h b/src/volser/volser_internal.h index d33795741..c082e0cef 100644 --- a/src/volser/volser_internal.h +++ b/src/volser/volser_internal.h @@ -21,7 +21,7 @@ extern afs_int32 split_volume(struct rx_call *, Volume *, Volume *, /* voltrans.c */ extern struct volser_trans *FindTrans(afs_int32); -extern struct volser_trans *NewTrans(afs_uint32, afs_int32); +extern struct volser_trans *NewTrans(VolumeId, afs_int32); extern struct volser_trans *TransList(void); extern afs_int32 DeleteTrans(struct volser_trans *atrans, afs_int32 lock); extern afs_int32 TRELE (struct volser_trans *); diff --git a/src/volser/voltrans.c b/src/volser/voltrans.c index 41b4b4571..18811b1b1 100644 --- a/src/volser/voltrans.c +++ b/src/volser/voltrans.c @@ -54,7 +54,7 @@ static afs_int32 transCounter = 1; /* create a new transaction, returning ptr to same with high ref count */ struct volser_trans * -NewTrans(afs_uint32 avol, afs_int32 apart) +NewTrans(VolumeId avol, afs_int32 apart) { /* set volid, next, partition */ struct volser_trans *tt, *newtt; @@ -182,15 +182,15 @@ GCTrans(void) for (tt = allTrans; tt; tt = nt) { nt = tt->next; /* remember in case we zap it */ if (tt->time + OLDTRANSWARN < now) { - Log("trans %u on volume %u %s than %d seconds\n", tt->tid, - tt->volid, + Log("trans %u on volume %" AFS_VOLID_FMT " %s than %d seconds\n", tt->tid, + afs_printable_VolumeId_lu(tt->volid), ((tt->refCount > 0) ? "is older" : "has been idle for more"), (((now - tt->time) / GCWAKEUP) * GCWAKEUP)); } if (tt->refCount > 0) continue; if (tt->time + OLDTRANSTIME < now) { - Log("trans %u on volume %u has timed out\n", tt->tid, tt->volid); + Log("trans %u on volume %" AFS_VOLID_FMT " has timed out\n", tt->tid, afs_printable_VolumeId_lu(tt->volid)); tt->refCount++; /* we're using it now */ -- 2.39.5