From: Andrew Deason Date: Mon, 11 Aug 2014 18:51:39 +0000 (-0500) Subject: vol: Avoid FDH_SEEK/FDH_READ X-Git-Tag: upstream/1.8.0_pre1^2~283 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=721451286285d4cc15b2fc22bfcde83b21e954a3;p=packages%2Fo%2Fopenafs.git vol: Avoid FDH_SEEK/FDH_READ All code in the tree except for this uses positional i/o (FDH_PREAD/FDH_PWRITE). For consistency and to ensure that we do not mix positional and non-positional i/o, just use the positional i/o functions here. It's simpler, too. Change-Id: Ib65f81dde7532631cd7d642c9ef814d47c71581a Reviewed-on: http://gerrit.openafs.org/11377 Tested-by: BuildBot Reviewed-by: Hans-Werner Paulsen Tested-by: Hans-Werner Paulsen Reviewed-by: Perry Ruiter Reviewed-by: Benjamin Kaduk --- diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index 3d4b277a3..22ac94a48 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -1331,15 +1331,7 @@ GetDirVnode(struct VolInfoOpt *opt, Volume * vp, VnodeId parent, VnodeDiskObject afs_printable_uint32_lu(V_id(vp))); } offset = vnodeIndexOffset(&VnodeClassInfo[vLarge], parent); - code = FDH_SEEK(DirIndexFd, offset, 0); - if (code == -1) { - fprintf(stderr, - "%s: GetDirVnode: seek failed for %lu.%lu to offset %llu\n", - progname, afs_printable_uint32_lu(V_id(vp)), - afs_printable_uint32_lu(parent), (long long unsigned)offset); - return -1; - } - code = FDH_READ(DirIndexFd, pvn, SIZEOF_LARGEDISKVNODE); + code = FDH_PREAD(DirIndexFd, pvn, SIZEOF_LARGEDISKVNODE, offset); if (code != SIZEOF_LARGEDISKVNODE) { fprintf(stderr, "%s: GetDirVnode: read failed for %lu.%lu at offset %llu\n", @@ -1548,11 +1540,7 @@ ReadSymlinkTarget(struct VnodeDetails *vdp) code = -1; goto cleanup; } - if (FDH_SEEK(fdP, 0, SEEK_SET) < 0) { - code = -1; - goto cleanup; - } - readLength = FDH_READ(fdP, buffer, fileLength); + readLength = FDH_PREAD(fdP, buffer, fileLength, 0); if (readLength < 0) { fprintf(stderr, "%s: Error reading symlink contents for fid (%lu.%lu.%lu.%lu); "