Re: [PATCH v3 0/2] quota: Add mountpath based quota support
From: Christoph Hellwig
Date: Tue May 25 2021 - 04:08:32 EST
Adding the dfd argument should be as simple as this patch (which also
moves the cmd argument later to match typical calling conventions).
It might be worth to rename the syscall to quotactlat to better match
other syscalls. A flags argument doesn't make much sense here, as the
cmd argument can be used for extensions and is properly checked for
unknown values.
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 05e4bd9ab6d6..940101396feb 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -968,8 +968,8 @@ SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
return ret;
}
-SYSCALL_DEFINE4(quotactl_path, unsigned int, cmd, const char __user *,
- mountpoint, qid_t, id, void __user *, addr)
+SYSCALL_DEFINE5(quotactl_path, int, dfd, const char __user *, mountpoint,
+ unsigned int, cmd, qid_t, id, void __user *, addr)
{
struct super_block *sb;
struct path mountpath;
@@ -980,8 +980,8 @@ SYSCALL_DEFINE4(quotactl_path, unsigned int, cmd, const char __user *,
if (type >= MAXQUOTAS)
return -EINVAL;
- ret = user_path_at(AT_FDCWD, mountpoint,
- LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT, &mountpath);
+ ret = user_path_at(dfd, mountpoint, LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT,
+ &mountpath);
if (ret)
return ret;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a672bbe28577..ae34984e2ab9 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -483,8 +483,8 @@ asmlinkage long sys_pipe2(int __user *fildes, int flags);
/* fs/quota.c */
asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special,
qid_t id, void __user *addr);
-asmlinkage long sys_quotactl_path(unsigned int cmd, const char __user *mountpoint,
- qid_t id, void __user *addr);
+asmlinkage long sys_quotactl_path(int dfd, const char __user *mountpoint,
+ unsigned int cmd, qid_t id, void __user *addr);
/* fs/readdir.c */
asmlinkage long sys_getdents64(unsigned int fd,