From: Cyril H. <su...@li...> - 2013-10-15 12:51:14
|
The branch, master, has been updated via e2ecf28cbbcb99ff5ff576ad0c1ce7145d28bf76 (commit) from 9ca9633cb75c407a81b98673891982b2e0702b29 (commit) - Log ----------------------------------------------------------------- commit e2ecf28cbbcb99ff5ff576ad0c1ce7145d28bf76 Author: Cyril Hrubis <ch...@su...> Date: Tue Oct 15 14:33:58 2013 +0200 syscalls: mount: Simplify the -T param handling. Signed-off-by: Cyril Hrubis <ch...@su...> ----------------------------------------------------------------------- Summary of changes: testcases/kernel/syscalls/mount/mount03.c | 16 ++++------------ testcases/kernel/syscalls/mount/mount05.c | 17 +++++------------ 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/testcases/kernel/syscalls/mount/mount03.c b/testcases/kernel/syscalls/mount/mount03.c index a3721d7..f8a3083 100644 --- a/testcases/kernel/syscalls/mount/mount03.c +++ b/testcases/kernel/syscalls/mount/mount03.c @@ -56,19 +56,15 @@ static int test_rwflag(int, int); char *TCID = "mount03"; int TST_TOTAL = 7; -#define DEFAULT_FSTYPE "ext2" #define TEMP_FILE "temp_file" #define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) #define DIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP| \ S_IXGRP|S_IROTH|S_IXOTH) #define SUID_MODE (S_ISUID|S_IRUSR|S_IXUSR|S_IXGRP|S_IXOTH) -static const char *fs_type = "ext2"; - static const char mntpoint[] = "mntpoint"; -static char *fstype; +static char *fstype = "ext2"; static char *device; -static int tflag; static int dflag; static int fildes; @@ -88,7 +84,7 @@ long rwflags[] = { }; static option_t options[] = { - {"T:", &tflag, &fstype}, + {"T:", NULL, &fstype}, {"D:", &dflag, &device}, {NULL, NULL, NULL} }; @@ -108,10 +104,6 @@ int main(int argc, char *argv[]) "you must specify the device used for mounting with -D " "option"); - if (tflag) - fs_type = fstype; - - if (STD_COPIES != 1) { tst_resm(TINFO, "-c option has no effect for this testcase - " "%s doesn't allow running more than one instance " @@ -127,7 +119,7 @@ int main(int argc, char *argv[]) for (i = 0; i < TST_TOTAL; ++i) { - TEST(mount(device, mntpoint, fs_type, rwflags[i], + TEST(mount(device, mntpoint, fstype, rwflags[i], NULL)); if (TEST_RETURN != 0) { @@ -274,7 +266,7 @@ int test_rwflag(int i, int cnt) case 4: /* Validate MS_REMOUNT flag of mount call */ - TEST(mount(device, mntpoint, fs_type, MS_REMOUNT, NULL)); + TEST(mount(device, mntpoint, fstype, MS_REMOUNT, NULL)); if (TEST_RETURN != 0) { tst_resm(TWARN | TTERRNO, "mount(2) failed to remount"); return 1; diff --git a/testcases/kernel/syscalls/mount/mount05.c b/testcases/kernel/syscalls/mount/mount05.c index fb5a385..6c1ccfd 100644 --- a/testcases/kernel/syscalls/mount/mount05.c +++ b/testcases/kernel/syscalls/mount/mount05.c @@ -43,11 +43,8 @@ int TST_TOTAL = 1; #define DIR_MODE (S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP) -static const char *fs_type = "ext2"; - -static int tflag; static int dflag; -static char *fstype; +static char *fstype = "ext2"; static char *device; static const char file_src[] = "mnt_src/tstfile"; static const char file_des[] = "mnt_des/tstfile"; @@ -55,7 +52,7 @@ static const char mntpoint_src[] = "mnt_src"; static const char mntpoint_des[] = "mnt_des"; static option_t options[] = { - {"T:", &tflag, &fstype}, + {"T:", NULL, &fstype}, {"D:", &dflag, &device}, {NULL, NULL, NULL}, }; @@ -69,9 +66,6 @@ int main(int argc, char *argv[]) if (msg != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); - if (tflag) - fs_type = fstype; - if (STD_COPIES != 1) { tst_resm(TINFO, "-c option has no effect for this testcase - " "%s doesn't allow running more than one instance " @@ -85,7 +79,7 @@ int main(int argc, char *argv[]) tst_count = 0; - TEST(mount(mntpoint_src, mntpoint_des, fs_type, MS_BIND, NULL)); + TEST(mount(mntpoint_src, mntpoint_des, fstype, MS_BIND, NULL)); if (TEST_RETURN != 0) { tst_resm(TFAIL | TTERRNO, "mount(2) failed"); @@ -106,7 +100,6 @@ int main(int argc, char *argv[]) } cleanup(); - tst_exit(); } @@ -122,9 +115,9 @@ void setup(void) SAFE_MKDIR(cleanup, mntpoint_des, DIR_MODE); if (dflag) { - tst_mkfs(NULL, device, fs_type, NULL); + tst_mkfs(NULL, device, fstype, NULL); - if (mount(device, mntpoint_src, fs_type, 0, NULL) == -1) + if (mount(device, mntpoint_src, fstype, 0, NULL) == -1) tst_brkm(TBROK | TERRNO, cleanup, "mount failed"); } hooks/post-receive -- ltp |