aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomohiro Kusumi <[email protected]>2019-04-26 02:17:28 +0900
committerBrian Behlendorf <[email protected]>2019-04-25 10:17:27 -0700
commit126d0fa7333c0d6d6159900d2858c82fa964b4f9 (patch)
tree8407df8d58c14767a406157defa137f8029ddb77
parentf4c594da94d856c422512a54e48070f890b2685b (diff)
Use SEEK_{SET,CUR,END} for file seek "whence"
Use either SEEK_* or 0,1,2..., but not both. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tomohiro Kusumi <[email protected]> Closes #8656
-rw-r--r--module/spl/spl-vnode.c2
-rw-r--r--module/zfs/vdev_file.c2
-rw-r--r--module/zfs/zfs_replay.c2
-rw-r--r--module/zfs/zfs_vnops.c16
-rw-r--r--module/zfs/zpl_file.c2
-rw-r--r--module/zfs/zpl_inode.c2
6 files changed, 13 insertions, 13 deletions
diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
index 855c642c9..ef5f60540 100644
--- a/module/spl/spl-vnode.c
+++ b/module/spl/spl-vnode.c
@@ -426,7 +426,7 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
int fstrans;
#endif
- if (cmd != F_FREESP || bfp->l_whence != 0)
+ if (cmd != F_FREESP || bfp->l_whence != SEEK_SET)
return (EOPNOTSUPP);
ASSERT(vp);
diff --git a/module/zfs/vdev_file.c b/module/zfs/vdev_file.c
index c04f40ca4..c15505785 100644
--- a/module/zfs/vdev_file.c
+++ b/module/zfs/vdev_file.c
@@ -255,7 +255,7 @@ vdev_file_io_start(zio_t *zio)
flck.l_type = F_FREESP;
flck.l_start = zio->io_offset;
flck.l_len = zio->io_size;
- flck.l_whence = 0;
+ flck.l_whence = SEEK_SET;
zio->io_error = VOP_SPACE(vf->vf_vnode, F_FREESP, &flck,
0, 0, kcred, NULL);
diff --git a/module/zfs/zfs_replay.c b/module/zfs/zfs_replay.c
index ba103084f..144381769 100644
--- a/module/zfs/zfs_replay.c
+++ b/module/zfs/zfs_replay.c
@@ -792,7 +792,7 @@ zfs_replay_truncate(void *arg1, void *arg2, boolean_t byteswap)
bzero(&fl, sizeof (fl));
fl.l_type = F_WRLCK;
- fl.l_whence = 0;
+ fl.l_whence = SEEK_SET;
fl.l_start = lr->lr_offset;
fl.l_len = lr->lr_length;
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 18dfc5a68..281f58249 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -4867,19 +4867,19 @@ convoff(struct inode *ip, flock64_t *lckdat, int whence, offset_t offset)
vattr_t vap;
int error;
- if ((lckdat->l_whence == 2) || (whence == 2)) {
+ if ((lckdat->l_whence == SEEK_END) || (whence == SEEK_END)) {
if ((error = zfs_getattr(ip, &vap, 0, CRED())))
return (error);
}
switch (lckdat->l_whence) {
- case 1:
+ case SEEK_CUR:
lckdat->l_start += offset;
break;
- case 2:
+ case SEEK_END:
lckdat->l_start += vap.va_size;
/* FALLTHRU */
- case 0:
+ case SEEK_SET:
break;
default:
return (SET_ERROR(EINVAL));
@@ -4889,13 +4889,13 @@ convoff(struct inode *ip, flock64_t *lckdat, int whence, offset_t offset)
return (SET_ERROR(EINVAL));
switch (whence) {
- case 1:
+ case SEEK_CUR:
lckdat->l_start -= offset;
break;
- case 2:
+ case SEEK_END:
lckdat->l_start -= vap.va_size;
/* FALLTHRU */
- case 0:
+ case SEEK_SET:
break;
default:
return (SET_ERROR(EINVAL));
@@ -4950,7 +4950,7 @@ zfs_space(struct inode *ip, int cmd, flock64_t *bfp, int flag,
return (SET_ERROR(EROFS));
}
- if ((error = convoff(ip, bfp, 0, offset))) {
+ if ((error = convoff(ip, bfp, SEEK_SET, offset))) {
ZFS_EXIT(zfsvfs);
return (error);
}
diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c
index 45e82c80d..9c231d950 100644
--- a/module/zfs/zpl_file.c
+++ b/module/zfs/zpl_file.c
@@ -771,7 +771,7 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
if (offset + len > olen)
len = olen - offset;
bf.l_type = F_WRLCK;
- bf.l_whence = 0;
+ bf.l_whence = SEEK_SET;
bf.l_start = offset;
bf.l_len = len;
bf.l_pid = 0;
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
index 41b91cabc..720330a8b 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/zfs/zpl_inode.c
@@ -636,7 +636,7 @@ zpl_truncate_range(struct inode *ip, loff_t start, loff_t end)
crhold(cr);
bf.l_type = F_WRLCK;
- bf.l_whence = 0;
+ bf.l_whence = SEEK_SET;
bf.l_start = start;
bf.l_len = end - start;
bf.l_pid = 0;