From: Marc Dionne Date: Sat, 11 Sep 2010 16:14:09 +0000 (-0400) Subject: vol: Set but not used variables X-Git-Tag: openafs-devel-1_7_1~1570 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=6d118a03664880782730716b1daef1fc63d95540 vol: Set but not used variables Fix some set but unused variable warnings in the vol directory. In VDetachVolume_r, much of the code and variables are only useful in the FSSYNC_BUILD_CLIENT case. Scope the code accordingly. forcefree is only used in the AFS_DEMAND_ATTACH_FS case, so scope code that sets it accordingly. Spotted by gcc 4.6 Change-Id: I345db6c9aba2d433ccbbc33fdc10d716c06b913c Reviewed-on: http://gerrit.openafs.org/2786 Tested-by: BuildBot Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 5ad2e58..1387bf3 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -2522,7 +2522,6 @@ SalvageIndex(struct SalvInfo *salvinfo, Inode ino, VnodeClass class, int RW, struct ViceInodeInfo *ip, int nInodes, struct VolumeSummary *volSummary, int check) { - VolumeId volumeNumber; char buf[SIZEOF_LARGEDISKVNODE]; struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf; int err = 0; @@ -2536,7 +2535,6 @@ SalvageIndex(struct SalvInfo *salvinfo, Inode ino, VnodeClass class, int RW, IHandle_t *handle; FdHandle_t *fdP; - volumeNumber = volSummary->header.id; IH_INIT(handle, salvinfo->fileSysDevice, volSummary->header.parent, ino); fdP = IH_OPEN(handle); assert(fdP != NULL); @@ -2558,12 +2556,6 @@ SalvageIndex(struct SalvInfo *salvinfo, Inode ino, VnodeClass class, int RW, if (vnode->type != vNull) { int vnodeChanged = 0; int vnodeNumber = bitNumberToVnodeNumber(vnodeIndex, class); - /* Log programs that belong to root (potentially suid root); - * don't bother for read-only or backup volumes */ -#ifdef notdef /* This is done elsewhere */ - if (ShowRootFiles && RW && vnode->owner == 0 && vnodeNumber != 1) - Log("OWNER IS ROOT %s %u dir %u vnode %u author %u owner %u mode %o\n", salvinfo->VolInfo.name, volumeNumber, vnode->parent, vnodeNumber, vnode->author, vnode->owner, vnode->modeBits); -#endif if (VNDISK_GET_INO(vnode) == 0) { if (RW) { /* Log("### DEBUG ### Deleted Vnode with 0 inode (vnode %d)\n", vnodeNumber); */ diff --git a/src/vol/volume.c b/src/vol/volume.c index 9c50992..f440151 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -3082,11 +3082,11 @@ attach2(Error * ec, VolId volumeId, char *path, struct DiskPartition64 *partp, /* have we read in the header successfully? */ int read_header = 0; +#ifdef AFS_DEMAND_ATTACH_FS /* should we FreeVolume(vp) instead of VCheckFree(vp) in the error * cleanup? */ int forcefree = 0; -#ifdef AFS_DEMAND_ATTACH_FS /* in the case of an error, to what state should the volume be * transitioned? */ VolState error_state = VOL_STATE_ERROR; @@ -3267,10 +3267,10 @@ attach2(Error * ec, VolId volumeId, char *path, struct DiskPartition64 *partp, VRequestSalvage_r(ec, vp, SALVSYNC_ERROR, VOL_SALVAGE_INVALIDATE_HEADER); VChangeState_r(vp, VOL_STATE_ERROR); vp->nUsers = 0; + forcefree = 1; #endif /* AFS_DEMAND_ATTACH_FS */ Log("VAttachVolume: volume %s is junk; it should be destroyed at next salvage\n", path); *ec = VNOVOL; - forcefree = 1; goto error; } @@ -4171,12 +4171,12 @@ VOffline(Volume * vp, char *message) void VDetachVolume_r(Error * ec, Volume * vp) { +#ifdef FSSYNC_BUILD_CLIENT VolumeId volume; struct DiskPartition64 *tpartp; int notifyServer = 0; int useDone = FSYNC_VOL_ON; - *ec = 0; /* always "succeeds" */ if (VCanUseFSSYNC()) { notifyServer = vp->needsPutBack; if (V_destroyMe(vp) == DESTROY_ME) @@ -4188,6 +4188,9 @@ VDetachVolume_r(Error * ec, Volume * vp) } tpartp = vp->partition; volume = V_id(vp); +#endif /* FSSYNC_BUILD_CLIENT */ + + *ec = 0; /* always "succeeds" */ DeleteVolumeFromHashTable(vp); vp->shuttingDown = 1; #ifdef AFS_DEMAND_ATTACH_FS