summaryrefslogtreecommitdiffstats
path: root/fs/stat.c
diff options
context:
space:
mode:
authorBijan Mottahedeh <bijan.mottahedeh@oracle.com>2020-05-22 21:31:17 -0700
committerJens Axboe <axboe@kernel.dk>2020-05-26 16:48:06 -0600
commit0018784fc84f636d473a0d2a65a34f9d01893c0a (patch)
tree8c468f2701736c720aefa84e53ab90df0a967e87 /fs/stat.c
parent1d9e1288039a47dc1189c3c1fed5cf3c215e94b7 (diff)
downloadlinux-0018784fc84f636d473a0d2a65a34f9d01893c0a.tar.bz2
statx: allow system call to be invoked from io_uring
This is a prepatory patch to allow io_uring to invoke statx directly. Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/stat.c')
-rw-r--r--fs/stat.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/stat.c b/fs/stat.c
index 030008796479..65cf51fda2aa 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -567,6 +567,24 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0;
}
+int do_statx(int dfd, const char __user *filename, unsigned flags,
+ unsigned int mask, struct statx __user *buffer)
+{
+ struct kstat stat;
+ int error;
+
+ if (mask & STATX__RESERVED)
+ return -EINVAL;
+ if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE)
+ return -EINVAL;
+
+ error = vfs_statx(dfd, filename, flags, &stat, mask);
+ if (error)
+ return error;
+
+ return cp_statx(&stat, buffer);
+}
+
/**
* sys_statx - System call to get enhanced stats
* @dfd: Base directory to pathwalk from *or* fd to stat.
@@ -583,19 +601,7 @@ SYSCALL_DEFINE5(statx,
unsigned int, mask,
struct statx __user *, buffer)
{
- struct kstat stat;
- int error;
-
- if (mask & STATX__RESERVED)
- return -EINVAL;
- if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE)
- return -EINVAL;
-
- error = vfs_statx(dfd, filename, flags, &stat, mask);
- if (error)
- return error;
-
- return cp_statx(&stat, buffer);
+ return do_statx(dfd, filename, flags, mask, buffer);
}
#ifdef CONFIG_COMPAT