diff options
author | Tomohiro Kusumi <[email protected]> | 2019-04-26 02:17:28 +0900 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-04-25 10:17:27 -0700 |
commit | 126d0fa7333c0d6d6159900d2858c82fa964b4f9 (patch) | |
tree | 8407df8d58c14767a406157defa137f8029ddb77 /module/zfs/zfs_vnops.c | |
parent | f4c594da94d856c422512a54e48070f890b2685b (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
Diffstat (limited to 'module/zfs/zfs_vnops.c')
-rw-r--r-- | module/zfs/zfs_vnops.c | 16 |
1 files changed, 8 insertions, 8 deletions
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); } |