* [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd
@ 2021-10-18 13:14 Yang Xu
2021-10-18 13:14 ` [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem Yang Xu
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Yang Xu @ 2021-10-18 13:14 UTC (permalink / raw)
To: ltp
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
configure.ac | 1 +
include/lapi/quotactl.h | 16 +++++++++++++++-
testcases/kernel/syscalls/quotactl/quotactl01.c | 2 +-
testcases/kernel/syscalls/quotactl/quotactl04.c | 2 +-
testcases/kernel/syscalls/quotactl/quotactl07.c | 2 +-
5 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5bf3c52ec..859aa9857 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,6 +122,7 @@ AC_CHECK_FUNCS_ONCE([ \
profil \
pwritev \
pwritev2 \
+ quotactl_fd \
rand_r \
readlinkat \
recvmmsg \
diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h
index 348b70b58..e265a6708 100644
--- a/include/lapi/quotactl.h
+++ b/include/lapi/quotactl.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2017-2019 Fujitsu Ltd.
+ * Copyright (c) 2017-2021 FUJITSU LIMITED. All rights reserved
* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
* Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
*/
@@ -9,6 +9,20 @@
#define LAPI_QUOTACTL_H__
#include <sys/quota.h>
+#include "lapi/syscalls.h"
+
+static inline void quotactl_fd_supported(void)
+{
+ /* allow the tests to fail early */
+ tst_syscall(__NR_quotactl_fd);
+}
+
+#ifndef HAVE_QUOTACTL_FD
+static inline int quotactl_fd(int fd, int cmd, int id, caddr_t addr)
+{
+ return tst_syscall(__NR_quotactl_fd, fd, cmd, id, addr);
+}
+#endif
#ifdef HAVE_STRUCT_IF_NEXTDQBLK
# include <linux/quota.h>
diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
index 4b791a03a..469c47437 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl01.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
@@ -63,8 +63,8 @@
#include <string.h>
#include <unistd.h>
#include <stdio.h>
-#include "lapi/quotactl.h"
#include "tst_test.h"
+#include "lapi/quotactl.h"
#define USRPATH MNTPOINT "/aquota.user"
#define GRPPATH MNTPOINT "/aquota.group"
diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
index ca6a94263..e01657de5 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl04.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -41,9 +41,9 @@
#include <sys/stat.h>
#include <sys/mount.h>
#include "config.h"
+#include "tst_test.h"
#include "lapi/quotactl.h"
#include "tst_safe_stdio.h"
-#include "tst_test.h"
#define FMTID QFMT_VFS_V1
#define MNTPOINT "mntpoint"
diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c
index a55416f0e..f745e9b1c 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl07.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl07.c
@@ -16,8 +16,8 @@
#include <unistd.h>
#include <stdio.h>
#include <sys/quota.h>
-#include "lapi/quotactl.h"
#include "tst_test.h"
+#include "lapi/quotactl.h"
#ifdef HAVE_XFS_XQM_H
# include <xfs/xqm.h>
--
2.23.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread* [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem 2021-10-18 13:14 [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Yang Xu @ 2021-10-18 13:14 ` Yang Xu 2021-10-26 14:21 ` Cyril Hrubis 2021-10-18 13:14 ` [LTP] [PATCH v1 08/11] syscalls/quotaclt02, 5: Add quotactl_fd test variant Yang Xu ` (3 subsequent siblings) 4 siblings, 1 reply; 12+ messages in thread From: Yang Xu @ 2021-10-18 13:14 UTC (permalink / raw) To: ltp It uses two variants(quotactl and quotactl_fd). The difference for quotactl01 is that we don't use quotacheck command and quota info hidden in filesystem. Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> --- runtest/syscalls | 1 + testcases/kernel/syscalls/quotactl/.gitignore | 1 + .../kernel/syscalls/quotactl/quotactl08.c | 246 ++++++++++++++++++ .../kernel/syscalls/quotactl/quotactl_var.h | 29 +++ 4 files changed, 277 insertions(+) create mode 100644 testcases/kernel/syscalls/quotactl/quotactl08.c create mode 100644 testcases/kernel/syscalls/quotactl/quotactl_var.h diff --git a/runtest/syscalls b/runtest/syscalls index b19316805..cdeb3e142 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1073,6 +1073,7 @@ quotactl04 quotactl04 quotactl05 quotactl05 quotactl06 quotactl06 quotactl07 quotactl07 +quotactl08 quotactl08 read01 read01 read02 read02 diff --git a/testcases/kernel/syscalls/quotactl/.gitignore b/testcases/kernel/syscalls/quotactl/.gitignore index 8d2ef94d9..dab9b3420 100644 --- a/testcases/kernel/syscalls/quotactl/.gitignore +++ b/testcases/kernel/syscalls/quotactl/.gitignore @@ -5,3 +5,4 @@ /quotactl05 /quotactl06 /quotactl07 +/quotactl08 diff --git a/testcases/kernel/syscalls/quotactl/quotactl08.c b/testcases/kernel/syscalls/quotactl/quotactl08.c new file mode 100644 index 000000000..554a204b1 --- /dev/null +++ b/testcases/kernel/syscalls/quotactl/quotactl08.c @@ -0,0 +1,246 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved + * Author: Yang Xu <xuyang2018.jy@fujitsu.com> + */ + +/*\ + * [Description] + * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems + * without visible quota files(quota information is stored in hidden system inodes): + * + * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for user. + * + * 2 quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag + * for user. + * + * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag + * for user. + * + * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO + * flag for user. + * + * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO + * flag for user. + * + * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for user. + * + * 7) quotactl(2) succeeds to update quota usages with Q_SYNC flag for user. + * + * 8) quotactl(2) succeeds to get disk quota limit greater than or equal to + * ID with Q_GETNEXTQUOTA flag for user. + * + * 9) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for user. + * + * 10) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for group. + * + * 11) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag + * for group. + * + * 12) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag + * for group. + * + * 13) quotactl(2) succeeds to set information about quotafile with Q_SETINFO + * flag for group. + * + * 14) quotactl(2) succeeds to get information about quotafile with Q_GETINFO + * flag for group. + * + * 15) quotactl(2) succeeds to get quota format with Q_GETFMT flag for group. + * + * 16) quotactl(2) succeeds to update quota usages with Q_SYNC flag for group. + * + * 17) quotactl(2) succeeds to get disk quota limit greater than or equal to + * ID with Q_GETNEXTQUOTA flag for group. + * + * 18) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for group. + */ + +#include "config.h" +#include <errno.h> +#include <string.h> +#include <unistd.h> +#include <stdio.h> +#include "tst_test.h" +#include "lapi/quotactl.h" +#include "quotactl_var.h" + +#define MNTPOINT "mntpoint" +#define TESTFILE MNTPOINT "/testfile" + +static int32_t fmt_id = QFMT_VFS_V1; +static int test_id, fd = -1; +static struct dqblk set_dq = { + .dqb_bsoftlimit = 100, + .dqb_valid = QIF_BLIMITS +}; +static struct dqblk res_dq; + +static struct dqinfo set_qf = { + .dqi_bgrace = 80, + .dqi_valid = IIF_BGRACE +}; +static struct dqinfo res_qf; +static int32_t fmt_buf; +static int getnextquota_nsup; + +static struct if_nextdqblk res_ndq; + +static struct tcase { + int cmd; + int *id; + void *addr; + void *set_data; + void *res_data; + int sz; + char *des; + char *tname; +} tcases[] = { + {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, NULL, + NULL, NULL, 0, "turn on quota for user", + "QCMD(Q_QUOTAON, USRQUOTA)"}, + + {QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dq, + NULL, NULL, 0, "set disk quota limit for user", + "QCMD(Q_SETQUOTA, USRQUOTA)"}, + + {QCMD(Q_GETQUOTA, USRQUOTA), &test_id, &res_dq, + &set_dq.dqb_bsoftlimit, &res_dq.dqb_bsoftlimit, + sizeof(res_dq.dqb_bsoftlimit), "get disk quota limit for user", + "QCMD(Q_GETQUOTA, USRQUOTA)"}, + + {QCMD(Q_SETINFO, USRQUOTA), &test_id, &set_qf, + NULL, NULL, 0, "set information about quotafile for user", + "QCMD(Q_SETINFO, USRQUOTA)"}, + + {QCMD(Q_GETINFO, USRQUOTA), &test_id, &res_qf, + &set_qf.dqi_bgrace, &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace), + "get information about quotafile for user", + "QCMD(Q_GETINFO, USRQUOTA)"}, + + {QCMD(Q_GETFMT, USRQUOTA), &test_id, &fmt_buf, + &fmt_id, &fmt_buf, sizeof(fmt_buf), + "get quota format for user", + "QCMD(Q_GETFMT, USRQUOTA)"}, + + {QCMD(Q_SYNC, USRQUOTA), &test_id, &res_dq, + NULL, NULL, 0, "update quota usages for user", + "QCMD(Q_SYNC, USRQUOTA)"}, + + {QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_id, &res_ndq, + &test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id), + "get next disk quota limit for user", + "QCMD(Q_GETNEXTQUOTA, USRQUOTA)"}, + + {QCMD(Q_QUOTAOFF, USRQUOTA), &test_id, NULL, + NULL, NULL, 0, "turn off quota for user", + "QCMD(Q_QUOTAOFF, USRQUOTA)"}, + + {QCMD(Q_QUOTAON, GRPQUOTA), &fmt_id, NULL, + NULL, NULL, 0, "turn on quota for group", + "QCMD(Q_QUOTAON, GRPQUOTA)"}, + + {QCMD(Q_SETQUOTA, GRPQUOTA), &test_id, &set_dq, + NULL, NULL, 0, "set disk quota limit for group", + "QCMD(Q_SETQUOTA, GRPQUOTA)"}, + + {QCMD(Q_GETQUOTA, GRPQUOTA), &test_id, &res_dq, &set_dq.dqb_bsoftlimit, + &res_dq.dqb_bsoftlimit, sizeof(res_dq.dqb_bsoftlimit), + "set disk quota limit for group", + "QCMD(Q_GETQUOTA, GRPQUOTA)"}, + + {QCMD(Q_SETINFO, GRPQUOTA), &test_id, &set_qf, + NULL, NULL, 0, "set information about quotafile for group", + "QCMD(Q_SETINFO, GRPQUOTA)"}, + + {QCMD(Q_GETINFO, GRPQUOTA), &test_id, &res_qf, &set_qf.dqi_bgrace, + &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace), + "get information about quotafile for group", + "QCMD(Q_GETINFO, GRPQUOTA)"}, + + {QCMD(Q_GETFMT, GRPQUOTA), &test_id, &fmt_buf, + &fmt_id, &fmt_buf, sizeof(fmt_buf), "get quota format for group", + "QCMD(Q_GETFMT, GRPQUOTA)"}, + + {QCMD(Q_SYNC, GRPQUOTA), &test_id, &res_dq, + NULL, NULL, 0, "update quota usages for group", + "QCMD(Q_SYNC, GRPQUOTA)"}, + + {QCMD(Q_GETNEXTQUOTA, GRPQUOTA), &test_id, &res_ndq, + &test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id), + "get next disk quota limit for group", + "QCMD(Q_GETNEXTQUOTA, GRPQUOTA)"}, + + {QCMD(Q_QUOTAOFF, GRPQUOTA), &test_id, NULL, + NULL, NULL, 0, "turn off quota for group", + "QCMD(Q_QUOTAOFF, GRPQUOTA)"}, +}; + +static void setup(void) +{ + quotactl_info(); + + test_id = geteuid(); + + fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0666); + //tst_require_quota_support(tst_device->dev, fmt_id, NULL); + TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev, + test_id, (void *) &res_ndq)); + if (TST_ERR == EINVAL || TST_ERR == ENOSYS) + getnextquota_nsup = 1; +} + +static void cleanup(void) +{ + if (fd > -1) + SAFE_CLOSE(fd); +} + +static void verify_quota(unsigned int n) +{ + struct tcase *tc = &tcases[n]; + + res_dq.dqb_bsoftlimit = 0; + res_qf.dqi_igrace = 0; + fmt_buf = 0; + res_ndq.dqb_id = -1; + + tst_res(TINFO, "Test #%d: %s", n, tc->tname); + if ((tc->cmd == QCMD(Q_GETNEXTQUOTA, USRQUOTA) || + tc->cmd == QCMD(Q_GETNEXTQUOTA, GRPQUOTA)) && + getnextquota_nsup) { + tst_res(TCONF, "current system doesn't support this cmd"); + return; + } + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr)); + if (TST_RET == -1) { + tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des); + return; + } + + if (memcmp(tc->res_data, tc->set_data, tc->sz)) { + tst_res(TFAIL, "quotactl failed to %s", tc->des); + tst_res_hexd(TINFO, tc->res_data, tc->sz, "retval: "); + tst_res_hexd(TINFO, tc->set_data, tc->sz, "expected: "); + return; + } + + tst_res(TPASS, "quotactl succeeded to %s", tc->des); +} + +static struct tst_test test = { + .needs_root = 1, + .needs_kconfigs = (const char *[]) { + "CONFIG_QFMT_V2", + NULL + }, + .test = verify_quota, + .tcnt = ARRAY_SIZE(tcases), + .mount_device = 1, + .dev_fs_type = "ext4", + .dev_fs_opts = (const char *const []){"-O", "quota", NULL}, + .mntpoint = MNTPOINT, + .setup = setup, + .cleanup = cleanup, + .test_variants = 2, +}; diff --git a/testcases/kernel/syscalls/quotactl/quotactl_var.h b/testcases/kernel/syscalls/quotactl/quotactl_var.h new file mode 100644 index 000000000..27d57294c --- /dev/null +++ b/testcases/kernel/syscalls/quotactl/quotactl_var.h @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu <xuyang2018.jy@fujitsu.com> + */ + +#ifndef LTP_QUOTACTL_VAR_H +#define LTP_QUOTACTL_VAR_H + +#include "lapi/quotactl.h" + +#define TEST_VARIANTS 2 + +static int do_quotactl(int fd, int cmd, const char *special, int id, caddr_t addr) +{ + if (tst_variant == 0) + return quotactl(cmd, special, id, addr); + return quotactl_fd(fd, cmd, id, addr); +} + +static void quotactl_info(void) +{ + if (tst_variant == 0) + tst_res(TINFO, "Test quotactl()"); + else + tst_res(TINFO, "Test quotactl_fd()"); +} + +#endif /* LTP_QUOTACTL_VAR_H */ -- 2.23.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem 2021-10-18 13:14 ` [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem Yang Xu @ 2021-10-26 14:21 ` Cyril Hrubis 2021-10-27 3:04 ` xuyang2018.jy 0 siblings, 1 reply; 12+ messages in thread From: Cyril Hrubis @ 2021-10-26 14:21 UTC (permalink / raw) To: Yang Xu; +Cc: ltp On Mon, Oct 18, 2021 at 09:14:44PM +0800, Yang Xu wrote: > It uses two variants(quotactl and quotactl_fd). The difference for quotactl01 > is that we don't use quotacheck command and quota info hidden in filesystem. > > Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> > --- > runtest/syscalls | 1 + > testcases/kernel/syscalls/quotactl/.gitignore | 1 + > .../kernel/syscalls/quotactl/quotactl08.c | 246 ++++++++++++++++++ > .../kernel/syscalls/quotactl/quotactl_var.h | 29 +++ > 4 files changed, 277 insertions(+) > create mode 100644 testcases/kernel/syscalls/quotactl/quotactl08.c > create mode 100644 testcases/kernel/syscalls/quotactl/quotactl_var.h > > diff --git a/runtest/syscalls b/runtest/syscalls > index b19316805..cdeb3e142 100644 > --- a/runtest/syscalls > +++ b/runtest/syscalls > @@ -1073,6 +1073,7 @@ quotactl04 quotactl04 > quotactl05 quotactl05 > quotactl06 quotactl06 > quotactl07 quotactl07 > +quotactl08 quotactl08 > > read01 read01 > read02 read02 > diff --git a/testcases/kernel/syscalls/quotactl/.gitignore b/testcases/kernel/syscalls/quotactl/.gitignore > index 8d2ef94d9..dab9b3420 100644 > --- a/testcases/kernel/syscalls/quotactl/.gitignore > +++ b/testcases/kernel/syscalls/quotactl/.gitignore > @@ -5,3 +5,4 @@ > /quotactl05 > /quotactl06 > /quotactl07 > +/quotactl08 > diff --git a/testcases/kernel/syscalls/quotactl/quotactl08.c b/testcases/kernel/syscalls/quotactl/quotactl08.c > new file mode 100644 > index 000000000..554a204b1 > --- /dev/null > +++ b/testcases/kernel/syscalls/quotactl/quotactl08.c > @@ -0,0 +1,246 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved > + * Author: Yang Xu <xuyang2018.jy@fujitsu.com> > + */ > + > +/*\ > + * [Description] > + * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems > + * without visible quota files(quota information is stored in hidden system inodes): > + * > + * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for user. > + * > + * 2 quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag > + * for user. > + * > + * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag > + * for user. > + * > + * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO > + * flag for user. > + * > + * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO > + * flag for user. > + * > + * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for user. > + * > + * 7) quotactl(2) succeeds to update quota usages with Q_SYNC flag for user. > + * > + * 8) quotactl(2) succeeds to get disk quota limit greater than or equal to > + * ID with Q_GETNEXTQUOTA flag for user. > + * > + * 9) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for user. > + * > + * 10) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for group. > + * > + * 11) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag > + * for group. > + * > + * 12) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag > + * for group. > + * > + * 13) quotactl(2) succeeds to set information about quotafile with Q_SETINFO > + * flag for group. > + * > + * 14) quotactl(2) succeeds to get information about quotafile with Q_GETINFO > + * flag for group. > + * > + * 15) quotactl(2) succeeds to get quota format with Q_GETFMT flag for group. > + * > + * 16) quotactl(2) succeeds to update quota usages with Q_SYNC flag for group. > + * > + * 17) quotactl(2) succeeds to get disk quota limit greater than or equal to > + * ID with Q_GETNEXTQUOTA flag for group. > + * > + * 18) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for group. > + */ The same comments apply for this comment as well. > +#include "config.h" The config.h should ideally be included in the lapi/quotactl.h instead. > +#include <errno.h> > +#include <string.h> > +#include <unistd.h> > +#include <stdio.h> > +#include "tst_test.h" > +#include "lapi/quotactl.h" And this is included in the quotactl_var.h so no need to include it here as well. > +#include "quotactl_var.h" > + > +#define MNTPOINT "mntpoint" > +#define TESTFILE MNTPOINT "/testfile" > + > +static int32_t fmt_id = QFMT_VFS_V1; > +static int test_id, fd = -1; > +static struct dqblk set_dq = { > + .dqb_bsoftlimit = 100, > + .dqb_valid = QIF_BLIMITS > +}; > +static struct dqblk res_dq; > + > +static struct dqinfo set_qf = { > + .dqi_bgrace = 80, > + .dqi_valid = IIF_BGRACE > +}; > +static struct dqinfo res_qf; > +static int32_t fmt_buf; > +static int getnextquota_nsup; > + > +static struct if_nextdqblk res_ndq; > + > +static struct tcase { > + int cmd; > + int *id; > + void *addr; > + void *set_data; > + void *res_data; > + int sz; > + char *des; > + char *tname; > +} tcases[] = { > + {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, NULL, > + NULL, NULL, 0, "turn on quota for user", > + "QCMD(Q_QUOTAON, USRQUOTA)"}, > + > + {QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dq, > + NULL, NULL, 0, "set disk quota limit for user", > + "QCMD(Q_SETQUOTA, USRQUOTA)"}, > + > + {QCMD(Q_GETQUOTA, USRQUOTA), &test_id, &res_dq, > + &set_dq.dqb_bsoftlimit, &res_dq.dqb_bsoftlimit, > + sizeof(res_dq.dqb_bsoftlimit), "get disk quota limit for user", > + "QCMD(Q_GETQUOTA, USRQUOTA)"}, > + > + {QCMD(Q_SETINFO, USRQUOTA), &test_id, &set_qf, > + NULL, NULL, 0, "set information about quotafile for user", > + "QCMD(Q_SETINFO, USRQUOTA)"}, > + > + {QCMD(Q_GETINFO, USRQUOTA), &test_id, &res_qf, > + &set_qf.dqi_bgrace, &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace), > + "get information about quotafile for user", > + "QCMD(Q_GETINFO, USRQUOTA)"}, > + > + {QCMD(Q_GETFMT, USRQUOTA), &test_id, &fmt_buf, > + &fmt_id, &fmt_buf, sizeof(fmt_buf), > + "get quota format for user", > + "QCMD(Q_GETFMT, USRQUOTA)"}, > + > + {QCMD(Q_SYNC, USRQUOTA), &test_id, &res_dq, > + NULL, NULL, 0, "update quota usages for user", > + "QCMD(Q_SYNC, USRQUOTA)"}, > + > + {QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_id, &res_ndq, > + &test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id), > + "get next disk quota limit for user", > + "QCMD(Q_GETNEXTQUOTA, USRQUOTA)"}, > + > + {QCMD(Q_QUOTAOFF, USRQUOTA), &test_id, NULL, > + NULL, NULL, 0, "turn off quota for user", > + "QCMD(Q_QUOTAOFF, USRQUOTA)"}, > + > + {QCMD(Q_QUOTAON, GRPQUOTA), &fmt_id, NULL, > + NULL, NULL, 0, "turn on quota for group", > + "QCMD(Q_QUOTAON, GRPQUOTA)"}, > + > + {QCMD(Q_SETQUOTA, GRPQUOTA), &test_id, &set_dq, > + NULL, NULL, 0, "set disk quota limit for group", > + "QCMD(Q_SETQUOTA, GRPQUOTA)"}, > + > + {QCMD(Q_GETQUOTA, GRPQUOTA), &test_id, &res_dq, &set_dq.dqb_bsoftlimit, > + &res_dq.dqb_bsoftlimit, sizeof(res_dq.dqb_bsoftlimit), > + "set disk quota limit for group", > + "QCMD(Q_GETQUOTA, GRPQUOTA)"}, > + > + {QCMD(Q_SETINFO, GRPQUOTA), &test_id, &set_qf, > + NULL, NULL, 0, "set information about quotafile for group", > + "QCMD(Q_SETINFO, GRPQUOTA)"}, > + > + {QCMD(Q_GETINFO, GRPQUOTA), &test_id, &res_qf, &set_qf.dqi_bgrace, > + &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace), > + "get information about quotafile for group", > + "QCMD(Q_GETINFO, GRPQUOTA)"}, > + > + {QCMD(Q_GETFMT, GRPQUOTA), &test_id, &fmt_buf, > + &fmt_id, &fmt_buf, sizeof(fmt_buf), "get quota format for group", > + "QCMD(Q_GETFMT, GRPQUOTA)"}, > + > + {QCMD(Q_SYNC, GRPQUOTA), &test_id, &res_dq, > + NULL, NULL, 0, "update quota usages for group", > + "QCMD(Q_SYNC, GRPQUOTA)"}, > + > + {QCMD(Q_GETNEXTQUOTA, GRPQUOTA), &test_id, &res_ndq, > + &test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id), > + "get next disk quota limit for group", > + "QCMD(Q_GETNEXTQUOTA, GRPQUOTA)"}, > + > + {QCMD(Q_QUOTAOFF, GRPQUOTA), &test_id, NULL, > + NULL, NULL, 0, "turn off quota for group", > + "QCMD(Q_QUOTAOFF, GRPQUOTA)"}, > +}; > + > +static void setup(void) > +{ > + quotactl_info(); > + > + test_id = geteuid(); The test has .needs_root flag set, so as far as I can tell this will always return 0, or do I miss something? > + fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0666); ^ Trailing whitespace > + //tst_require_quota_support(tst_device->dev, fmt_id, NULL); Why do we have this here? > + TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev, > + test_id, (void *) &res_ndq)); > + if (TST_ERR == EINVAL || TST_ERR == ENOSYS) > + getnextquota_nsup = 1; > +} > + > +static void cleanup(void) > +{ > + if (fd > -1) > + SAFE_CLOSE(fd); > +} > + > +static void verify_quota(unsigned int n) > +{ > + struct tcase *tc = &tcases[n]; > + > + res_dq.dqb_bsoftlimit = 0; > + res_qf.dqi_igrace = 0; > + fmt_buf = 0; > + res_ndq.dqb_id = -1; > + > + tst_res(TINFO, "Test #%d: %s", n, tc->tname); > + if ((tc->cmd == QCMD(Q_GETNEXTQUOTA, USRQUOTA) || > + tc->cmd == QCMD(Q_GETNEXTQUOTA, GRPQUOTA)) && > + getnextquota_nsup) { > + tst_res(TCONF, "current system doesn't support this cmd"); > + return; > + } > + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr)); > + if (TST_RET == -1) { > + tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des); > + return; > + } > + > + if (memcmp(tc->res_data, tc->set_data, tc->sz)) { > + tst_res(TFAIL, "quotactl failed to %s", tc->des); > + tst_res_hexd(TINFO, tc->res_data, tc->sz, "retval: "); > + tst_res_hexd(TINFO, tc->set_data, tc->sz, "expected: "); > + return; > + } > + > + tst_res(TPASS, "quotactl succeeded to %s", tc->des); > +} > + > +static struct tst_test test = { > + .needs_root = 1, > + .needs_kconfigs = (const char *[]) { > + "CONFIG_QFMT_V2", > + NULL > + }, > + .test = verify_quota, > + .tcnt = ARRAY_SIZE(tcases), > + .mount_device = 1, > + .dev_fs_type = "ext4", > + .dev_fs_opts = (const char *const []){"-O", "quota", NULL}, > + .mntpoint = MNTPOINT, > + .setup = setup, > + .cleanup = cleanup, > + .test_variants = 2, > +}; > diff --git a/testcases/kernel/syscalls/quotactl/quotactl_var.h b/testcases/kernel/syscalls/quotactl/quotactl_var.h > new file mode 100644 > index 000000000..27d57294c > --- /dev/null > +++ b/testcases/kernel/syscalls/quotactl/quotactl_var.h > @@ -0,0 +1,29 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved. > + * Author: Yang Xu <xuyang2018.jy@fujitsu.com> > + */ > + > +#ifndef LTP_QUOTACTL_VAR_H > +#define LTP_QUOTACTL_VAR_H > + > +#include "lapi/quotactl.h" > + > +#define TEST_VARIANTS 2 > + > +static int do_quotactl(int fd, int cmd, const char *special, int id, caddr_t addr) > +{ > + if (tst_variant == 0) > + return quotactl(cmd, special, id, addr); > + return quotactl_fd(fd, cmd, id, addr); > +} > + > +static void quotactl_info(void) > +{ > + if (tst_variant == 0) > + tst_res(TINFO, "Test quotactl()"); > + else > + tst_res(TINFO, "Test quotactl_fd()"); > +} > +#endif /* LTP_QUOTACTL_VAR_H */ > -- > 2.23.0 > > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem 2021-10-26 14:21 ` Cyril Hrubis @ 2021-10-27 3:04 ` xuyang2018.jy 0 siblings, 0 replies; 12+ messages in thread From: xuyang2018.jy @ 2021-10-27 3:04 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp@lists.linux.it Hi Cyril > On Mon, Oct 18, 2021 at 09:14:44PM +0800, Yang Xu wrote: >> It uses two variants(quotactl and quotactl_fd). The difference for quotactl01 >> is that we don't use quotacheck command and quota info hidden in filesystem. >> >> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com> >> --- >> runtest/syscalls | 1 + >> testcases/kernel/syscalls/quotactl/.gitignore | 1 + >> .../kernel/syscalls/quotactl/quotactl08.c | 246 ++++++++++++++++++ >> .../kernel/syscalls/quotactl/quotactl_var.h | 29 +++ >> 4 files changed, 277 insertions(+) >> create mode 100644 testcases/kernel/syscalls/quotactl/quotactl08.c >> create mode 100644 testcases/kernel/syscalls/quotactl/quotactl_var.h >> >> diff --git a/runtest/syscalls b/runtest/syscalls >> index b19316805..cdeb3e142 100644 >> --- a/runtest/syscalls >> +++ b/runtest/syscalls >> @@ -1073,6 +1073,7 @@ quotactl04 quotactl04 >> quotactl05 quotactl05 >> quotactl06 quotactl06 >> quotactl07 quotactl07 >> +quotactl08 quotactl08 >> >> read01 read01 >> read02 read02 >> diff --git a/testcases/kernel/syscalls/quotactl/.gitignore b/testcases/kernel/syscalls/quotactl/.gitignore >> index 8d2ef94d9..dab9b3420 100644 >> --- a/testcases/kernel/syscalls/quotactl/.gitignore >> +++ b/testcases/kernel/syscalls/quotactl/.gitignore >> @@ -5,3 +5,4 @@ >> /quotactl05 >> /quotactl06 >> /quotactl07 >> +/quotactl08 >> diff --git a/testcases/kernel/syscalls/quotactl/quotactl08.c b/testcases/kernel/syscalls/quotactl/quotactl08.c >> new file mode 100644 >> index 000000000..554a204b1 >> --- /dev/null >> +++ b/testcases/kernel/syscalls/quotactl/quotactl08.c >> @@ -0,0 +1,246 @@ >> +// SPDX-License-Identifier: GPL-2.0-or-later >> +/* >> + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved >> + * Author: Yang Xu<xuyang2018.jy@fujitsu.com> >> + */ >> + >> +/*\ >> + * [Description] >> + * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems >> + * without visible quota files(quota information is stored in hidden system inodes): >> + * >> + * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for user. >> + * >> + * 2 quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag >> + * for user. >> + * >> + * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag >> + * for user. >> + * >> + * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO >> + * flag for user. >> + * >> + * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO >> + * flag for user. >> + * >> + * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for user. >> + * >> + * 7) quotactl(2) succeeds to update quota usages with Q_SYNC flag for user. >> + * >> + * 8) quotactl(2) succeeds to get disk quota limit greater than or equal to >> + * ID with Q_GETNEXTQUOTA flag for user. >> + * >> + * 9) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for user. >> + * >> + * 10) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for group. >> + * >> + * 11) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag >> + * for group. >> + * >> + * 12) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag >> + * for group. >> + * >> + * 13) quotactl(2) succeeds to set information about quotafile with Q_SETINFO >> + * flag for group. >> + * >> + * 14) quotactl(2) succeeds to get information about quotafile with Q_GETINFO >> + * flag for group. >> + * >> + * 15) quotactl(2) succeeds to get quota format with Q_GETFMT flag for group. >> + * >> + * 16) quotactl(2) succeeds to update quota usages with Q_SYNC flag for group. >> + * >> + * 17) quotactl(2) succeeds to get disk quota limit greater than or equal to >> + * ID with Q_GETNEXTQUOTA flag for group. >> + * >> + * 18) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for group. >> + */ > > The same comments apply for this comment as well. Ok. > >> +#include "config.h" > > The config.h should ideally be included in the lapi/quotactl.h instead. Will move. > >> +#include<errno.h> >> +#include<string.h> >> +#include<unistd.h> >> +#include<stdio.h> >> +#include "tst_test.h" >> +#include "lapi/quotactl.h" > > And this is included in the quotactl_var.h so no need to include it here > as well. OK. > >> +#include "quotactl_var.h" >> + >> +#define MNTPOINT "mntpoint" >> +#define TESTFILE MNTPOINT "/testfile" >> + >> +static int32_t fmt_id = QFMT_VFS_V1; >> +static int test_id, fd = -1; >> +static struct dqblk set_dq = { >> + .dqb_bsoftlimit = 100, >> + .dqb_valid = QIF_BLIMITS >> +}; >> +static struct dqblk res_dq; >> + >> +static struct dqinfo set_qf = { >> + .dqi_bgrace = 80, >> + .dqi_valid = IIF_BGRACE >> +}; >> +static struct dqinfo res_qf; >> +static int32_t fmt_buf; >> +static int getnextquota_nsup; >> + >> +static struct if_nextdqblk res_ndq; >> + >> +static struct tcase { >> + int cmd; >> + int *id; >> + void *addr; >> + void *set_data; >> + void *res_data; >> + int sz; >> + char *des; >> + char *tname; >> +} tcases[] = { >> + {QCMD(Q_QUOTAON, USRQUOTA),&fmt_id, NULL, >> + NULL, NULL, 0, "turn on quota for user", >> + "QCMD(Q_QUOTAON, USRQUOTA)"}, >> + >> + {QCMD(Q_SETQUOTA, USRQUOTA),&test_id,&set_dq, >> + NULL, NULL, 0, "set disk quota limit for user", >> + "QCMD(Q_SETQUOTA, USRQUOTA)"}, >> + >> + {QCMD(Q_GETQUOTA, USRQUOTA),&test_id,&res_dq, >> + &set_dq.dqb_bsoftlimit,&res_dq.dqb_bsoftlimit, >> + sizeof(res_dq.dqb_bsoftlimit), "get disk quota limit for user", >> + "QCMD(Q_GETQUOTA, USRQUOTA)"}, >> + >> + {QCMD(Q_SETINFO, USRQUOTA),&test_id,&set_qf, >> + NULL, NULL, 0, "set information about quotafile for user", >> + "QCMD(Q_SETINFO, USRQUOTA)"}, >> + >> + {QCMD(Q_GETINFO, USRQUOTA),&test_id,&res_qf, >> + &set_qf.dqi_bgrace,&res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace), >> + "get information about quotafile for user", >> + "QCMD(Q_GETINFO, USRQUOTA)"}, >> + >> + {QCMD(Q_GETFMT, USRQUOTA),&test_id,&fmt_buf, >> + &fmt_id,&fmt_buf, sizeof(fmt_buf), >> + "get quota format for user", >> + "QCMD(Q_GETFMT, USRQUOTA)"}, >> + >> + {QCMD(Q_SYNC, USRQUOTA),&test_id,&res_dq, >> + NULL, NULL, 0, "update quota usages for user", >> + "QCMD(Q_SYNC, USRQUOTA)"}, >> + >> + {QCMD(Q_GETNEXTQUOTA, USRQUOTA),&test_id,&res_ndq, >> + &test_id,&res_ndq.dqb_id, sizeof(res_ndq.dqb_id), >> + "get next disk quota limit for user", >> + "QCMD(Q_GETNEXTQUOTA, USRQUOTA)"}, >> + >> + {QCMD(Q_QUOTAOFF, USRQUOTA),&test_id, NULL, >> + NULL, NULL, 0, "turn off quota for user", >> + "QCMD(Q_QUOTAOFF, USRQUOTA)"}, >> + >> + {QCMD(Q_QUOTAON, GRPQUOTA),&fmt_id, NULL, >> + NULL, NULL, 0, "turn on quota for group", >> + "QCMD(Q_QUOTAON, GRPQUOTA)"}, >> + >> + {QCMD(Q_SETQUOTA, GRPQUOTA),&test_id,&set_dq, >> + NULL, NULL, 0, "set disk quota limit for group", >> + "QCMD(Q_SETQUOTA, GRPQUOTA)"}, >> + >> + {QCMD(Q_GETQUOTA, GRPQUOTA),&test_id,&res_dq,&set_dq.dqb_bsoftlimit, >> + &res_dq.dqb_bsoftlimit, sizeof(res_dq.dqb_bsoftlimit), >> + "set disk quota limit for group", >> + "QCMD(Q_GETQUOTA, GRPQUOTA)"}, >> + >> + {QCMD(Q_SETINFO, GRPQUOTA),&test_id,&set_qf, >> + NULL, NULL, 0, "set information about quotafile for group", >> + "QCMD(Q_SETINFO, GRPQUOTA)"}, >> + >> + {QCMD(Q_GETINFO, GRPQUOTA),&test_id,&res_qf,&set_qf.dqi_bgrace, >> + &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace), >> + "get information about quotafile for group", >> + "QCMD(Q_GETINFO, GRPQUOTA)"}, >> + >> + {QCMD(Q_GETFMT, GRPQUOTA),&test_id,&fmt_buf, >> + &fmt_id,&fmt_buf, sizeof(fmt_buf), "get quota format for group", >> + "QCMD(Q_GETFMT, GRPQUOTA)"}, >> + >> + {QCMD(Q_SYNC, GRPQUOTA),&test_id,&res_dq, >> + NULL, NULL, 0, "update quota usages for group", >> + "QCMD(Q_SYNC, GRPQUOTA)"}, >> + >> + {QCMD(Q_GETNEXTQUOTA, GRPQUOTA),&test_id,&res_ndq, >> + &test_id,&res_ndq.dqb_id, sizeof(res_ndq.dqb_id), >> + "get next disk quota limit for group", >> + "QCMD(Q_GETNEXTQUOTA, GRPQUOTA)"}, >> + >> + {QCMD(Q_QUOTAOFF, GRPQUOTA),&test_id, NULL, >> + NULL, NULL, 0, "turn off quota for group", >> + "QCMD(Q_QUOTAOFF, GRPQUOTA)"}, >> +}; >> + >> +static void setup(void) >> +{ >> + quotactl_info(); >> + >> + test_id = geteuid(); > > The test has .needs_root flag set, so as far as I can tell this will > always return 0, or do I miss something? Will remove. > >> + fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0666); > ^ > Trailing > whitespace OK. >> + //tst_require_quota_support(tst_device->dev, fmt_id, NULL); > > Why do we have this here? Will remove comment. Best Regards Yang Xu > >> + TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev, >> + test_id, (void *)&res_ndq)); >> + if (TST_ERR == EINVAL || TST_ERR == ENOSYS) >> + getnextquota_nsup = 1; >> +} >> + >> +static void cleanup(void) >> +{ >> + if (fd> -1) >> + SAFE_CLOSE(fd); >> +} >> + >> +static void verify_quota(unsigned int n) >> +{ >> + struct tcase *tc =&tcases[n]; >> + >> + res_dq.dqb_bsoftlimit = 0; >> + res_qf.dqi_igrace = 0; >> + fmt_buf = 0; >> + res_ndq.dqb_id = -1; >> + >> + tst_res(TINFO, "Test #%d: %s", n, tc->tname); >> + if ((tc->cmd == QCMD(Q_GETNEXTQUOTA, USRQUOTA) || >> + tc->cmd == QCMD(Q_GETNEXTQUOTA, GRPQUOTA))&& >> + getnextquota_nsup) { >> + tst_res(TCONF, "current system doesn't support this cmd"); >> + return; >> + } >> + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr)); >> + if (TST_RET == -1) { >> + tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des); >> + return; >> + } >> + >> + if (memcmp(tc->res_data, tc->set_data, tc->sz)) { >> + tst_res(TFAIL, "quotactl failed to %s", tc->des); >> + tst_res_hexd(TINFO, tc->res_data, tc->sz, "retval: "); >> + tst_res_hexd(TINFO, tc->set_data, tc->sz, "expected: "); >> + return; >> + } >> + >> + tst_res(TPASS, "quotactl succeeded to %s", tc->des); >> +} >> + >> +static struct tst_test test = { >> + .needs_root = 1, >> + .needs_kconfigs = (const char *[]) { >> + "CONFIG_QFMT_V2", >> + NULL >> + }, >> + .test = verify_quota, >> + .tcnt = ARRAY_SIZE(tcases), >> + .mount_device = 1, >> + .dev_fs_type = "ext4", >> + .dev_fs_opts = (const char *const []){"-O", "quota", NULL}, >> + .mntpoint = MNTPOINT, >> + .setup = setup, >> + .cleanup = cleanup, >> + .test_variants = 2, >> +}; >> diff --git a/testcases/kernel/syscalls/quotactl/quotactl_var.h b/testcases/kernel/syscalls/quotactl/quotactl_var.h >> new file mode 100644 >> index 000000000..27d57294c >> --- /dev/null >> +++ b/testcases/kernel/syscalls/quotactl/quotactl_var.h >> @@ -0,0 +1,29 @@ >> +// SPDX-License-Identifier: GPL-2.0-or-later >> +/* >> + * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved. >> + * Author: Yang Xu<xuyang2018.jy@fujitsu.com> >> + */ >> + >> +#ifndef LTP_QUOTACTL_VAR_H >> +#define LTP_QUOTACTL_VAR_H >> + >> +#include "lapi/quotactl.h" >> + >> +#define TEST_VARIANTS 2 >> + >> +static int do_quotactl(int fd, int cmd, const char *special, int id, caddr_t addr) >> +{ >> + if (tst_variant == 0) >> + return quotactl(cmd, special, id, addr); >> + return quotactl_fd(fd, cmd, id, addr); >> +} >> + >> +static void quotactl_info(void) >> +{ >> + if (tst_variant == 0) >> + tst_res(TINFO, "Test quotactl()"); >> + else >> + tst_res(TINFO, "Test quotactl_fd()"); >> +} >> +#endif /* LTP_QUOTACTL_VAR_H */ >> -- >> 2.23.0 >> >> >> -- >> Mailing list info: https://lists.linux.it/listinfo/ltp > -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH v1 08/11] syscalls/quotaclt02, 5: Add quotactl_fd test variant 2021-10-18 13:14 [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Yang Xu 2021-10-18 13:14 ` [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem Yang Xu @ 2021-10-18 13:14 ` Yang Xu 2021-10-26 14:23 ` Cyril Hrubis 2021-10-18 13:14 ` [LTP] [PATCH v1 09/11] syscalls/quotactl03: " Yang Xu ` (2 subsequent siblings) 4 siblings, 1 reply; 12+ messages in thread From: Yang Xu @ 2021-10-18 13:14 UTC (permalink / raw) To: ltp Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> --- .../kernel/syscalls/quotactl/quotactl02.c | 14 +++++++++++-- .../kernel/syscalls/quotactl/quotactl02.h | 20 ++++++++++--------- .../kernel/syscalls/quotactl/quotactl05.c | 14 +++++++++++-- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.c b/testcases/kernel/syscalls/quotactl/quotactl02.c index ad81ee7e5..40bd5bd8b 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl02.c +++ b/testcases/kernel/syscalls/quotactl/quotactl02.c @@ -121,11 +121,19 @@ static struct t_case { static void setup(void) { + quotactl_info(); test_id = geteuid(); + fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0666); check_support_cmd(USRQUOTA); check_support_cmd(GRPQUOTA); } +static void cleanup(void) +{ + if (fd > -1) + SAFE_CLOSE(fd); +} + static void verify_quota(unsigned int n) { struct t_case *tc = &tcases[n]; @@ -144,7 +152,7 @@ static void verify_quota(unsigned int n) return; } - TEST(quotactl(tc->cmd, tst_device->dev, test_id, tc->addr)); + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, test_id, tc->addr)); if (TST_RET == -1) { tst_res(TFAIL | TTERRNO, "quotactl() failed to %s", tc->des); return; @@ -166,9 +174,11 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .mount_device = 1, .dev_fs_type = "xfs", - .mntpoint = mntpoint, + .mntpoint = MNTPOINT, .mnt_data = "usrquota,grpquota", .setup = setup, + .cleanup = cleanup, + .test_variants = 2, }; #else TST_TEST_TCONF("System doesn't have <xfs/xqm.h>"); diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.h b/testcases/kernel/syscalls/quotactl/quotactl02.h index 37f3d7eb7..5b7c5ab32 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl02.h +++ b/testcases/kernel/syscalls/quotactl/quotactl02.h @@ -14,18 +14,20 @@ #include <stdio.h> #include "tst_test.h" #include "lapi/quotactl.h" +#include "quotactl_var.h" #ifdef HAVE_XFS_XQM_H # include <xfs/xqm.h> +#define MNTPOINT "mntpoint" +#define TESTFILE MNTPOINT "/testfile" static struct fs_disk_quota set_dquota = { .d_rtb_softlimit = 1000, .d_fieldmask = FS_DQ_RTBSOFT }; static uint32_t test_id; -static int x_getnextquota_nsup; +static int x_getnextquota_nsup, fd = -1; static int x_getstatv_nsup; -static const char mntpoint[] = "mnt_point"; void check_support_cmd(int quotatype) { @@ -37,12 +39,12 @@ void check_support_cmd(int quotatype) x_getnextquota_nsup = 0; x_getstatv_nsup = 0; - TEST(quotactl(QCMD(Q_XGETNEXTQUOTA, quotatype), tst_device->dev, + TEST(do_quotactl(fd, QCMD(Q_XGETNEXTQUOTA, quotatype), tst_device->dev, test_id, (void *) &resfs_dquota)); if (TST_ERR == EINVAL || TST_ERR == ENOSYS) x_getnextquota_nsup = 1; - TEST(quotactl(QCMD(Q_XGETQSTATV, quotatype), tst_device->dev, test_id, + TEST(do_quotactl(fd, QCMD(Q_XGETQSTATV, quotatype), tst_device->dev, test_id, (void *) &resfs_qstatv)); if (TST_ERR == EINVAL || TST_ERR == ENOSYS) x_getstatv_nsup = 1; @@ -53,7 +55,7 @@ void check_qoff(int subcmd, char *desp, int flag) int res; struct fs_quota_stat res_qstat; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstat); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_qstat); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs quota off status"); @@ -73,7 +75,7 @@ void check_qon(int subcmd, char *desp, int flag) int res; struct fs_quota_stat res_qstat; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstat); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_qstat); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs quota on status"); @@ -95,7 +97,7 @@ void check_qoffv(int subcmd, char *desp, int flag) .qs_version = FS_QSTATV_VERSION1, }; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstatv); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_qstatv); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs quota off stav"); @@ -117,7 +119,7 @@ void check_qonv(int subcmd, char *desp, int flag) .qs_version = FS_QSTATV_VERSION1 }; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstatv); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_qstatv); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs quota on statv"); @@ -139,7 +141,7 @@ void check_qlim(int subcmd, char *desp) res_dquota.d_rtb_softlimit = 0; - res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_dquota); + res = do_quotactl(fd, subcmd, tst_device->dev, test_id, (void *) &res_dquota); if (res == -1) { tst_res(TFAIL | TERRNO, "quotactl() failed to get xfs disk quota limits"); diff --git a/testcases/kernel/syscalls/quotactl/quotactl05.c b/testcases/kernel/syscalls/quotactl/quotactl05.c index fbc7f5924..7306623a0 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl05.c +++ b/testcases/kernel/syscalls/quotactl/quotactl05.c @@ -71,10 +71,18 @@ static struct t_case { static void setup(void) { + quotactl_info(); test_id = geteuid(); + fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0666); check_support_cmd(PRJQUOTA); } +static void cleanup(void) +{ + if (fd > -1) + SAFE_CLOSE(fd); +} + static void verify_quota(unsigned int n) { struct t_case *tc = &tcases[n]; @@ -94,7 +102,7 @@ static void verify_quota(unsigned int n) return; } - TEST(quotactl(tc->cmd, tst_device->dev, test_id, tc->addr)); + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, test_id, tc->addr)); if (TST_RET == -1) { tst_res(TFAIL | TTERRNO, "quotactl() failed to %s", tc->des); return; @@ -116,9 +124,11 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .mount_device = 1, .dev_fs_type = "xfs", - .mntpoint = mntpoint, + .mntpoint = MNTPOINT, .mnt_data = "prjquota", .setup = setup, + .cleanup = cleanup, + .test_variants = 2, }; #else -- 2.23.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v1 08/11] syscalls/quotaclt02, 5: Add quotactl_fd test variant 2021-10-18 13:14 ` [LTP] [PATCH v1 08/11] syscalls/quotaclt02, 5: Add quotactl_fd test variant Yang Xu @ 2021-10-26 14:23 ` Cyril Hrubis 0 siblings, 0 replies; 12+ messages in thread From: Cyril Hrubis @ 2021-10-26 14:23 UTC (permalink / raw) To: Yang Xu; +Cc: ltp Hi! > @@ -166,9 +174,11 @@ static struct tst_test test = { > .tcnt = ARRAY_SIZE(tcases), > .mount_device = 1, > .dev_fs_type = "xfs", > - .mntpoint = mntpoint, > + .mntpoint = MNTPOINT, > .mnt_data = "usrquota,grpquota", > .setup = setup, > + .cleanup = cleanup, > + .test_variants = 2, It may be a slightly cleaner to #define QUOTACTL_VARIANTS 2 in the quotactl_var.h and use it here. > }; > #else > TST_TEST_TCONF("System doesn't have <xfs/xqm.h>"); > diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.h b/testcases/kernel/syscalls/quotactl/quotactl02.h > index 37f3d7eb7..5b7c5ab32 100644 > --- a/testcases/kernel/syscalls/quotactl/quotactl02.h > +++ b/testcases/kernel/syscalls/quotactl/quotactl02.h > @@ -14,18 +14,20 @@ > #include <stdio.h> > #include "tst_test.h" > #include "lapi/quotactl.h" > +#include "quotactl_var.h" Here as well, no need to include the "lapi/quotactl.h" anymore. Other than that this patch looks good. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH v1 09/11] syscalls/quotactl03: Add quotactl_fd test variant 2021-10-18 13:14 [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Yang Xu 2021-10-18 13:14 ` [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem Yang Xu 2021-10-18 13:14 ` [LTP] [PATCH v1 08/11] syscalls/quotaclt02, 5: Add quotactl_fd test variant Yang Xu @ 2021-10-18 13:14 ` Yang Xu 2021-10-26 14:25 ` Cyril Hrubis 2021-10-18 13:14 ` [LTP] [PATCH v1 10/11] syscalls/quotactl04: " Yang Xu 2021-10-26 14:13 ` [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Cyril Hrubis 4 siblings, 1 reply; 12+ messages in thread From: Yang Xu @ 2021-10-18 13:14 UTC (permalink / raw) To: ltp Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> --- .../kernel/syscalls/quotactl/quotactl03.c | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c index 9711b7f07..019e7c646 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl03.c +++ b/testcases/kernel/syscalls/quotactl/quotactl03.c @@ -28,15 +28,18 @@ #include <unistd.h> #include <stdio.h> #include <sys/quota.h> - #include "tst_test.h" #include "lapi/quotactl.h" +#include "quotactl_var.h" #ifdef HAVE_XFS_XQM_H # include <xfs/xqm.h> -static const char mntpoint[] = "mnt_point"; +#define MNTPOINT "mnt_point" +#define TESTFILE MNTPOINT "/testfile" + static uint32_t test_id = 0xfffffffc; +static int fd = -1; static void verify_quota(void) { @@ -44,7 +47,7 @@ static void verify_quota(void) res_dquota.d_id = 1; - TEST(quotactl(QCMD(Q_XGETNEXTQUOTA, USRQUOTA), tst_device->dev, + TEST(do_quotactl(fd, QCMD(Q_XGETNEXTQUOTA, USRQUOTA), tst_device->dev, test_id, (void *)&res_dquota)); if (TST_RET != -1) { tst_res(TFAIL, "quotactl() found the next active ID: %u unexpectedly", @@ -63,6 +66,18 @@ static void verify_quota(void) tst_res(TPASS, "quotactl() failed with ENOENT as expected"); } +static void setup(void) +{ + quotactl_info(); + fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0666); +} + +static void cleanup(void) +{ + if (fd > -1) + SAFE_CLOSE(fd); +} + static struct tst_test test = { .needs_root = 1, .needs_kconfigs = (const char *[]) { @@ -72,8 +87,11 @@ static struct tst_test test = { .test_all = verify_quota, .mount_device = 1, .dev_fs_type = "xfs", - .mntpoint = mntpoint, - .mnt_data = "usrquota", + .mntpoint = MNTPOINT, + .mnt_data = "usrquota,grpquota", + .setup = setup, + .cleanup = cleanup, + .test_variants = 2, }; #else -- 2.23.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v1 09/11] syscalls/quotactl03: Add quotactl_fd test variant 2021-10-18 13:14 ` [LTP] [PATCH v1 09/11] syscalls/quotactl03: " Yang Xu @ 2021-10-26 14:25 ` Cyril Hrubis 0 siblings, 0 replies; 12+ messages in thread From: Cyril Hrubis @ 2021-10-26 14:25 UTC (permalink / raw) To: Yang Xu; +Cc: ltp Hi! Same two minor comments for the previous patch apply to this patch as well. Otherwise it looks good. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [LTP] [PATCH v1 10/11] syscalls/quotactl04: Add quotactl_fd test variant 2021-10-18 13:14 [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Yang Xu ` (2 preceding siblings ...) 2021-10-18 13:14 ` [LTP] [PATCH v1 09/11] syscalls/quotactl03: " Yang Xu @ 2021-10-18 13:14 ` Yang Xu 2021-10-26 14:26 ` Cyril Hrubis 2021-10-26 14:13 ` [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Cyril Hrubis 4 siblings, 1 reply; 12+ messages in thread From: Yang Xu @ 2021-10-18 13:14 UTC (permalink / raw) To: ltp Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> --- .../kernel/syscalls/quotactl/quotactl04.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c index e01657de5..010fa8fd6 100644 --- a/testcases/kernel/syscalls/quotactl/quotactl04.c +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com> + * Copyright (c) 2019-2021 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu <xuyang2018.jy@fujitsu.com> */ /*\ @@ -44,11 +44,14 @@ #include "tst_test.h" #include "lapi/quotactl.h" #include "tst_safe_stdio.h" +#include "quotactl_var.h" #define FMTID QFMT_VFS_V1 #define MNTPOINT "mntpoint" +#define TESTFILE MNTPOINT "/testfile" + static int32_t fmt_id = FMTID; -static int test_id, mount_flag; +static int test_id, mount_flag, fd = -1; static struct dqblk set_dq = { .dqb_bsoftlimit = 100, .dqb_valid = QIF_BLIMITS @@ -139,6 +142,7 @@ static void setup(void) const char *const fs_opts[] = {"-I 256", "-O quota,project", NULL}; int rc, major, minor, patch; + quotactl_info(); test_id = geteuid(); f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r"); rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch); @@ -149,10 +153,14 @@ static void setup(void) pclose(f); SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL); do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL); + fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0666); } static void cleanup(void) { + if (fd > -1) + SAFE_CLOSE(fd); + if (mount_flag && tst_umount(MNTPOINT)) tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT); } @@ -167,7 +175,7 @@ static void verify_quota(unsigned int n) tst_res(TINFO, "Test #%d: %s", n, tc->tname); - TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, tc->addr)); + TEST(do_quotactl(fd, tc->cmd, tst_device->dev, *tc->id, tc->addr)); if (TST_RET == -1) { tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des); return; @@ -200,5 +208,6 @@ static struct tst_test test = { .needs_cmds = (const char *[]) { "mkfs.ext4", NULL - } + }, + .test_variants = 2, }; -- 2.23.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v1 10/11] syscalls/quotactl04: Add quotactl_fd test variant 2021-10-18 13:14 ` [LTP] [PATCH v1 10/11] syscalls/quotactl04: " Yang Xu @ 2021-10-26 14:26 ` Cyril Hrubis 0 siblings, 0 replies; 12+ messages in thread From: Cyril Hrubis @ 2021-10-26 14:26 UTC (permalink / raw) To: Yang Xu; +Cc: ltp Hi! And here as well. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd 2021-10-18 13:14 [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Yang Xu ` (3 preceding siblings ...) 2021-10-18 13:14 ` [LTP] [PATCH v1 10/11] syscalls/quotactl04: " Yang Xu @ 2021-10-26 14:13 ` Cyril Hrubis 2021-10-27 2:58 ` xuyang2018.jy 4 siblings, 1 reply; 12+ messages in thread From: Cyril Hrubis @ 2021-10-26 14:13 UTC (permalink / raw) To: Yang Xu; +Cc: ltp Hi! > Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com> > --- > configure.ac | 1 + > include/lapi/quotactl.h | 16 +++++++++++++++- > testcases/kernel/syscalls/quotactl/quotactl01.c | 2 +- > testcases/kernel/syscalls/quotactl/quotactl04.c | 2 +- > testcases/kernel/syscalls/quotactl/quotactl07.c | 2 +- > 5 files changed, 19 insertions(+), 4 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 5bf3c52ec..859aa9857 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -122,6 +122,7 @@ AC_CHECK_FUNCS_ONCE([ \ > profil \ > pwritev \ > pwritev2 \ > + quotactl_fd \ > rand_r \ > readlinkat \ > recvmmsg \ > diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h > index 348b70b58..e265a6708 100644 > --- a/include/lapi/quotactl.h > +++ b/include/lapi/quotactl.h > @@ -1,6 +1,6 @@ > // SPDX-License-Identifier: GPL-2.0-or-later > /* > - * Copyright (c) 2017-2019 Fujitsu Ltd. > + * Copyright (c) 2017-2021 FUJITSU LIMITED. All rights reserved > * Author: Xiao Yang <yangx.jy@cn.fujitsu.com> > * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com> > */ > @@ -9,6 +9,20 @@ > #define LAPI_QUOTACTL_H__ > > #include <sys/quota.h> > +#include "lapi/syscalls.h" > + > +static inline void quotactl_fd_supported(void) > +{ > + /* allow the tests to fail early */ > + tst_syscall(__NR_quotactl_fd); > +} > + > +#ifndef HAVE_QUOTACTL_FD > +static inline int quotactl_fd(int fd, int cmd, int id, caddr_t addr) > +{ > + return tst_syscall(__NR_quotactl_fd, fd, cmd, id, addr); > +} > +#endif > > #ifdef HAVE_STRUCT_IF_NEXTDQBLK > # include <linux/quota.h> > diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c > index 4b791a03a..469c47437 100644 > --- a/testcases/kernel/syscalls/quotactl/quotactl01.c > +++ b/testcases/kernel/syscalls/quotactl/quotactl01.c > @@ -63,8 +63,8 @@ > #include <string.h> > #include <unistd.h> > #include <stdio.h> > -#include "lapi/quotactl.h" > #include "tst_test.h" > +#include "lapi/quotactl.h" > > #define USRPATH MNTPOINT "/aquota.user" > #define GRPPATH MNTPOINT "/aquota.group" > diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c > index ca6a94263..e01657de5 100644 > --- a/testcases/kernel/syscalls/quotactl/quotactl04.c > +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c > @@ -41,9 +41,9 @@ > #include <sys/stat.h> > #include <sys/mount.h> > #include "config.h" > +#include "tst_test.h" > #include "lapi/quotactl.h" > #include "tst_safe_stdio.h" > -#include "tst_test.h" > > #define FMTID QFMT_VFS_V1 > #define MNTPOINT "mntpoint" > diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c > index a55416f0e..f745e9b1c 100644 > --- a/testcases/kernel/syscalls/quotactl/quotactl07.c > +++ b/testcases/kernel/syscalls/quotactl/quotactl07.c > @@ -16,8 +16,8 @@ > #include <unistd.h> > #include <stdio.h> > #include <sys/quota.h> > -#include "lapi/quotactl.h" > #include "tst_test.h" > +#include "lapi/quotactl.h" > > #ifdef HAVE_XFS_XQM_H > # include <xfs/xqm.h> Unless it breaks compilation the part that shuffles the headers should go in a separate patch. Or at least it should have been described in the patch commit message... -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd 2021-10-26 14:13 ` [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Cyril Hrubis @ 2021-10-27 2:58 ` xuyang2018.jy 0 siblings, 0 replies; 12+ messages in thread From: xuyang2018.jy @ 2021-10-27 2:58 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp@lists.linux.it Hi Cyril > Hi! >> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com> >> --- >> configure.ac | 1 + >> include/lapi/quotactl.h | 16 +++++++++++++++- >> testcases/kernel/syscalls/quotactl/quotactl01.c | 2 +- >> testcases/kernel/syscalls/quotactl/quotactl04.c | 2 +- >> testcases/kernel/syscalls/quotactl/quotactl07.c | 2 +- >> 5 files changed, 19 insertions(+), 4 deletions(-) >> >> diff --git a/configure.ac b/configure.ac >> index 5bf3c52ec..859aa9857 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -122,6 +122,7 @@ AC_CHECK_FUNCS_ONCE([ \ >> profil \ >> pwritev \ >> pwritev2 \ >> + quotactl_fd \ >> rand_r \ >> readlinkat \ >> recvmmsg \ >> diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h >> index 348b70b58..e265a6708 100644 >> --- a/include/lapi/quotactl.h >> +++ b/include/lapi/quotactl.h >> @@ -1,6 +1,6 @@ >> // SPDX-License-Identifier: GPL-2.0-or-later >> /* >> - * Copyright (c) 2017-2019 Fujitsu Ltd. >> + * Copyright (c) 2017-2021 FUJITSU LIMITED. All rights reserved >> * Author: Xiao Yang<yangx.jy@cn.fujitsu.com> >> * Author: Yang Xu<xuyang2018.jy@cn.jujitsu.com> >> */ >> @@ -9,6 +9,20 @@ >> #define LAPI_QUOTACTL_H__ >> >> #include<sys/quota.h> >> +#include "lapi/syscalls.h" >> + >> +static inline void quotactl_fd_supported(void) >> +{ >> + /* allow the tests to fail early */ >> + tst_syscall(__NR_quotactl_fd); >> +} >> + >> +#ifndef HAVE_QUOTACTL_FD >> +static inline int quotactl_fd(int fd, int cmd, int id, caddr_t addr) >> +{ >> + return tst_syscall(__NR_quotactl_fd, fd, cmd, id, addr); >> +} >> +#endif >> >> #ifdef HAVE_STRUCT_IF_NEXTDQBLK >> # include<linux/quota.h> >> diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c >> index 4b791a03a..469c47437 100644 >> --- a/testcases/kernel/syscalls/quotactl/quotactl01.c >> +++ b/testcases/kernel/syscalls/quotactl/quotactl01.c >> @@ -63,8 +63,8 @@ >> #include<string.h> >> #include<unistd.h> >> #include<stdio.h> >> -#include "lapi/quotactl.h" >> #include "tst_test.h" >> +#include "lapi/quotactl.h" >> >> #define USRPATH MNTPOINT "/aquota.user" >> #define GRPPATH MNTPOINT "/aquota.group" >> diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c >> index ca6a94263..e01657de5 100644 >> --- a/testcases/kernel/syscalls/quotactl/quotactl04.c >> +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c >> @@ -41,9 +41,9 @@ >> #include<sys/stat.h> >> #include<sys/mount.h> >> #include "config.h" >> +#include "tst_test.h" >> #include "lapi/quotactl.h" >> #include "tst_safe_stdio.h" >> -#include "tst_test.h" >> >> #define FMTID QFMT_VFS_V1 >> #define MNTPOINT "mntpoint" >> diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c >> index a55416f0e..f745e9b1c 100644 >> --- a/testcases/kernel/syscalls/quotactl/quotactl07.c >> +++ b/testcases/kernel/syscalls/quotactl/quotactl07.c >> @@ -16,8 +16,8 @@ >> #include<unistd.h> >> #include<stdio.h> >> #include<sys/quota.h> >> -#include "lapi/quotactl.h" >> #include "tst_test.h" >> +#include "lapi/quotactl.h" >> >> #ifdef HAVE_XFS_XQM_H >> # include<xfs/xqm.h> > > Unless it breaks compilation the part that shuffles the headers should > go in a separate patch. Or at least it should have been described in the > patch commit message... Will add it in commit message. Best Regards Yang Xu > -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-10-27 3:04 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-10-18 13:14 [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Yang Xu 2021-10-18 13:14 ` [LTP] [PATCH v1 07/11] syscalls/quotactl08: Test quoatctl01 but quota info hidden in filesystem Yang Xu 2021-10-26 14:21 ` Cyril Hrubis 2021-10-27 3:04 ` xuyang2018.jy 2021-10-18 13:14 ` [LTP] [PATCH v1 08/11] syscalls/quotaclt02, 5: Add quotactl_fd test variant Yang Xu 2021-10-26 14:23 ` Cyril Hrubis 2021-10-18 13:14 ` [LTP] [PATCH v1 09/11] syscalls/quotactl03: " Yang Xu 2021-10-26 14:25 ` Cyril Hrubis 2021-10-18 13:14 ` [LTP] [PATCH v1 10/11] syscalls/quotactl04: " Yang Xu 2021-10-26 14:26 ` Cyril Hrubis 2021-10-26 14:13 ` [LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd Cyril Hrubis 2021-10-27 2:58 ` xuyang2018.jy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox