[LTP] [PATCH v2 13/13] syscalls/quotactl: Move common code into quotactl_syscal_var.h

Yang Xu xuyang2018.jy@fujitsu.com
Wed Oct 27 14:29:30 CEST 2021


Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/quotactl/quotactl02.h           | 5 +----
 testcases/kernel/syscalls/quotactl/quotactl03.c           | 4 ----
 testcases/kernel/syscalls/quotactl/quotactl04.c           | 4 +---
 testcases/kernel/syscalls/quotactl/quotactl07.c           | 5 -----
 testcases/kernel/syscalls/quotactl/quotactl08.c           | 5 +----
 testcases/kernel/syscalls/quotactl/quotactl09.c           | 4 +---
 testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h | 4 ++++
 7 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.h b/testcases/kernel/syscalls/quotactl/quotactl02.h
index faee5d282..145ce7039 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl02.h
+++ b/testcases/kernel/syscalls/quotactl/quotactl02.h
@@ -17,15 +17,12 @@
 #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, fd = -1;
+static int x_getnextquota_nsup;
 static int x_getstatv_nsup;
 
 void check_support_cmd(int quotatype)
diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c
index 0c4c50b42..d13bc694b 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl03.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl03.c
@@ -34,11 +34,7 @@
 #ifdef HAVE_XFS_XQM_H
 # include <xfs/xqm.h>
 
-#define MNTPOINT	"mnt_point"
-#define TESTFILE	MNTPOINT "/testfile"
-
 static uint32_t test_id = 0xfffffffc;
-static int fd = -1;
 
 static void verify_quota(void)
 {
diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
index 4dc68c2ae..50ba445ca 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl04.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -32,11 +32,9 @@
 #include "quotactl_syscall_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, fd = -1;
+static int test_id, mount_flag;
 static struct dqblk set_dq = {
 	.dqb_bsoftlimit = 100,
 	.dqb_valid = QIF_BLIMITS
diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c
index d29a56ee4..6e8c3ecee 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl07.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl07.c
@@ -21,11 +21,6 @@
 #ifdef HAVE_XFS_XQM_H
 # include <xfs/xqm.h>
 
-#define MNTPOINT    "mntpoint"
-#define TESTFILE MNTPOINT "/testfile"
-
-static int fd = -1;
-
 /* Include a valid quota type to avoid other EINVAL error */
 static unsigned int invalid_type = XFS_GROUP_QUOTA << 1 | XFS_USER_QUOTA;
 
diff --git a/testcases/kernel/syscalls/quotactl/quotactl08.c b/testcases/kernel/syscalls/quotactl/quotactl08.c
index 6912378f1..e37a474d2 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl08.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl08.c
@@ -40,11 +40,8 @@
 #include "quotactl_syscall_var.h"
 #include "tst_safe_stdio.h"
 
-#define MNTPOINT	"mntpoint"
-#define TESTFILE	MNTPOINT "/testfile"
-
 static int32_t fmt_id = QFMT_VFS_V1;
-static int test_id, fd = -1;
+static int test_id;
 static struct dqblk set_dq = {
 	.dqb_bsoftlimit = 100,
 	.dqb_valid = QIF_BLIMITS
diff --git a/testcases/kernel/syscalls/quotactl/quotactl09.c b/testcases/kernel/syscalls/quotactl/quotactl09.c
index 1a3a7005d..e7aad7b9b 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl09.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl09.c
@@ -27,11 +27,9 @@
 #include "tst_safe_stdio.h"
 
 #define OPTION_INVALID 999
-#define MNTPOINT "mntpoint"
-#define TESTFILE MNTPOINT "/testfile"
 
 static int32_t fmt_id = QFMT_VFS_V1;
-static int test_id, fd = -1;
+static int test_id;
 static int getnextquota_nsup;
 
 static struct if_nextdqblk res_ndq;
diff --git a/testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h b/testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h
index 92a7c45db..bf2b06ffe 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h
+++ b/testcases/kernel/syscalls/quotactl/quotactl_syscall_var.h
@@ -10,6 +10,10 @@
 #include "lapi/quotactl.h"
 
 #define QUOTACTL_SYSCALL_VARIANTS 2
+#define MNTPOINT "mntpoint"
+#define TESTFILE MNTPOINT "/testfile"
+
+static int fd = -1;
 
 static int do_quotactl(int fd, int cmd, const char *special, int id, caddr_t addr)
 {
-- 
2.23.0



More information about the ltp mailing list