mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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>
This commit is contained in:
committed by
Jens Axboe
parent
1d9e128803
commit
0018784fc8
@@ -188,3 +188,5 @@ int sb_init_dio_done_wq(struct super_block *sb);
|
|||||||
*/
|
*/
|
||||||
unsigned vfs_stat_set_lookup_flags(unsigned *lookup_flags, int flags);
|
unsigned vfs_stat_set_lookup_flags(unsigned *lookup_flags, int flags);
|
||||||
int cp_statx(const struct kstat *stat, struct statx __user *buffer);
|
int cp_statx(const struct kstat *stat, struct statx __user *buffer);
|
||||||
|
int do_statx(int dfd, const char __user *filename, unsigned flags,
|
||||||
|
unsigned int mask, struct statx __user *buffer);
|
||||||
|
32
fs/stat.c
32
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;
|
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
|
* sys_statx - System call to get enhanced stats
|
||||||
* @dfd: Base directory to pathwalk from *or* fd to stat.
|
* @dfd: Base directory to pathwalk from *or* fd to stat.
|
||||||
@@ -583,19 +601,7 @@ SYSCALL_DEFINE5(statx,
|
|||||||
unsigned int, mask,
|
unsigned int, mask,
|
||||||
struct statx __user *, buffer)
|
struct statx __user *, buffer)
|
||||||
{
|
{
|
||||||
struct kstat stat;
|
return do_statx(dfd, filename, flags, mask, buffer);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
|
Reference in New Issue
Block a user