Skip to content

Commit 3737bb2

Browse files
committed
xfs: move eofblocks conversion function to xfs_ioctl.c
Move xfs_fs_eofblocks_from_user into the only file that actually uses it, so that we don't have this function cluttering up the header file. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Brian Foster <[email protected]>
1 parent df42ce6 commit 3737bb2

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

fs/xfs/xfs_icache.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -81,41 +81,6 @@ int xfs_inode_ag_iterator_tag(struct xfs_mount *mp,
8181
int (*execute)(struct xfs_inode *ip, int flags, void *args),
8282
int flags, void *args, int tag);
8383

84-
static inline int
85-
xfs_fs_eofblocks_from_user(
86-
struct xfs_fs_eofblocks *src,
87-
struct xfs_eofblocks *dst)
88-
{
89-
if (src->eof_version != XFS_EOFBLOCKS_VERSION)
90-
return -EINVAL;
91-
92-
if (src->eof_flags & ~XFS_EOF_FLAGS_VALID)
93-
return -EINVAL;
94-
95-
if (memchr_inv(&src->pad32, 0, sizeof(src->pad32)) ||
96-
memchr_inv(src->pad64, 0, sizeof(src->pad64)))
97-
return -EINVAL;
98-
99-
dst->eof_flags = src->eof_flags;
100-
dst->eof_prid = src->eof_prid;
101-
dst->eof_min_file_size = src->eof_min_file_size;
102-
103-
dst->eof_uid = INVALID_UID;
104-
if (src->eof_flags & XFS_EOF_FLAGS_UID) {
105-
dst->eof_uid = make_kuid(current_user_ns(), src->eof_uid);
106-
if (!uid_valid(dst->eof_uid))
107-
return -EINVAL;
108-
}
109-
110-
dst->eof_gid = INVALID_GID;
111-
if (src->eof_flags & XFS_EOF_FLAGS_GID) {
112-
dst->eof_gid = make_kgid(current_user_ns(), src->eof_gid);
113-
if (!gid_valid(dst->eof_gid))
114-
return -EINVAL;
115-
}
116-
return 0;
117-
}
118-
11984
int xfs_icache_inode_is_allocated(struct xfs_mount *mp, struct xfs_trans *tp,
12085
xfs_ino_t ino, bool *inuse);
12186

fs/xfs/xfs_ioctl.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,6 +2039,41 @@ xfs_ioc_setlabel(
20392039
return error;
20402040
}
20412041

2042+
static inline int
2043+
xfs_fs_eofblocks_from_user(
2044+
struct xfs_fs_eofblocks *src,
2045+
struct xfs_eofblocks *dst)
2046+
{
2047+
if (src->eof_version != XFS_EOFBLOCKS_VERSION)
2048+
return -EINVAL;
2049+
2050+
if (src->eof_flags & ~XFS_EOF_FLAGS_VALID)
2051+
return -EINVAL;
2052+
2053+
if (memchr_inv(&src->pad32, 0, sizeof(src->pad32)) ||
2054+
memchr_inv(src->pad64, 0, sizeof(src->pad64)))
2055+
return -EINVAL;
2056+
2057+
dst->eof_flags = src->eof_flags;
2058+
dst->eof_prid = src->eof_prid;
2059+
dst->eof_min_file_size = src->eof_min_file_size;
2060+
2061+
dst->eof_uid = INVALID_UID;
2062+
if (src->eof_flags & XFS_EOF_FLAGS_UID) {
2063+
dst->eof_uid = make_kuid(current_user_ns(), src->eof_uid);
2064+
if (!uid_valid(dst->eof_uid))
2065+
return -EINVAL;
2066+
}
2067+
2068+
dst->eof_gid = INVALID_GID;
2069+
if (src->eof_flags & XFS_EOF_FLAGS_GID) {
2070+
dst->eof_gid = make_kgid(current_user_ns(), src->eof_gid);
2071+
if (!gid_valid(dst->eof_gid))
2072+
return -EINVAL;
2073+
}
2074+
return 0;
2075+
}
2076+
20422077
/*
20432078
* Note: some of the ioctl's return positive numbers as a
20442079
* byte count indicating success, such as readlink_by_handle.

0 commit comments

Comments
 (0)