[LTP] [PATCH 2/2] syscalls/quotactl: Remove tst_require_quota_support

Yang Xu xuyang2018.jy@fujitsu.com
Wed Mar 16 04:32:26 CET 2022


Since we have check quota support on ext4/xfs by using needs_drivers or
needs_kconfigs, we don't need this api any more.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 include/tst_fs.h                              | 15 ---------
 lib/tst_supported_fs_types.c                  | 32 -------------------
 .../kernel/syscalls/quotactl/quotactl01.c     |  2 --
 .../kernel/syscalls/quotactl/quotactl04.c     | 25 ++-------------
 .../kernel/syscalls/quotactl/quotactl06.c     |  2 --
 5 files changed, 2 insertions(+), 74 deletions(-)

diff --git a/include/tst_fs.h b/include/tst_fs.h
index 3bab9da8b..bc6692bd4 100644
--- a/include/tst_fs.h
+++ b/include/tst_fs.h
@@ -197,21 +197,6 @@ const char **tst_get_supported_fs_types(const char *const *skiplist);
  */
 int tst_fs_in_skiplist(const char *fs_type, const char *const *skiplist);
 
-/*
- * Check whether device supports FS quotas. Negative return value means that
- * quotas appear to be broken.
- */
-int tst_check_quota_support(const char *device, int format, char *quotafile);
-
-/*
- * Check for quota support and terminate the test with appropriate exit status
- * if quotas are not supported or broken.
- */
-#define tst_require_quota_support(dev, fmt, qfile) \
-	tst_require_quota_support_(__FILE__, __LINE__, (dev), (fmt), (qfile))
-void tst_require_quota_support_(const char *file, const int lineno,
-	const char *device, int format, char *quotafile);
-
 /*
  * Creates and writes to files on given path until write fails with ENOSPC
  */
diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
index 23e5ce877..9726d193a 100644
--- a/lib/tst_supported_fs_types.c
+++ b/lib/tst_supported_fs_types.c
@@ -173,35 +173,3 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)
 
 	return fs_types;
 }
-
-int tst_check_quota_support(const char *device, int format, char *quotafile)
-{
-	const long ret = quotactl(QCMD(Q_QUOTAON, USRQUOTA), device, format,
-				  quotafile);
-
-	/* Not supported */
-
-	if (ret == -1 && errno == ESRCH)
-		return 0;
-
-	/* Broken */
-	if (ret)
-		return -1;
-
-	quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), device, 0, 0);
-	return 1;
-}
-
-void tst_require_quota_support_(const char *file, const int lineno,
-	const char *device, int format, char *quotafile)
-{
-	int status = tst_check_quota_support(device, format, quotafile);
-
-	if (!status) {
-		tst_brk_(file, lineno, TCONF,
-			"Kernel or device does not support FS quotas");
-	}
-
-	if (status < 0)
-		tst_brk_(file, lineno, TBROK|TERRNO, "FS quotas are broken");
-}
diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
index 63f6e9181..c14228e35 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl01.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
@@ -166,8 +166,6 @@ static void setup(void)
 	if (access(GRPPATH, F_OK) == -1)
 		tst_brk(TFAIL | TERRNO, "group quotafile didn't exist");
 
-	tst_require_quota_support(tst_device->dev, fmt_id, usrpath);
-
 	TEST(quotactl(QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev,
 		test_id, (void *) &res_ndq));
 	if (TST_ERR == EINVAL || TST_ERR == ENOSYS)
diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
index 3eb6e4a34..a57e6be60 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl04.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -96,35 +96,14 @@ static struct tcase {
 
 };
 
-static void do_mount(const char *source, const char *target,
-	const char *filesystemtype, unsigned long mountflags,
-	const void *data)
-{
-	TEST(mount(source, target, filesystemtype, mountflags, data));
-
-	if (TST_RET == -1 && TST_ERR == ESRCH)
-		tst_brk(TCONF, "Kernel or device does not support FS quotas");
-
-	if (TST_RET == -1) {
-		tst_brk(TBROK | TTERRNO, "mount(%s, %s, %s, %lu, %p) failed",
-			source, target, filesystemtype, mountflags, data);
-	}
-
-	if (TST_RET) {
-		tst_brk(TBROK | TTERRNO, "mount(%s, %s, %s, %lu, %p) failed",
-			source, target, filesystemtype, mountflags, data);
-	}
-
-	mount_flag = 1;
-}
-
 static void setup(void)
 {
 	const char *const fs_opts[] = {"-I 256", "-O quota,project", NULL};
 
 	quotactl_info();
 	SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
-	do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
+	SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
+	mount_flag = 1;
 	fd = SAFE_OPEN(MNTPOINT, O_RDONLY);
 
 	TEST(do_quotactl(fd, QCMD(Q_GETNEXTQUOTA, PRJQUOTA), tst_device->dev,
diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
index feb475022..ae8d7faca 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl06.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
@@ -189,8 +189,6 @@ static void setup(void)
 	if (access(USRPATH, F_OK) == -1)
 		tst_brk(TBROK | TERRNO, "user quotafile didn't exist");
 
-	tst_require_quota_support(tst_device->dev, fmt_id, usrpath);
-
 	SAFE_MKDIR(TESTDIR1, 0666);
 
 	TEST(quotactl(QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev,
-- 
2.23.0





More information about the ltp mailing list