Skip to contentSkip to conversation

mount/mount05.c: format the device when necessary

PATCH Superseded DAN LI 2 participants 2 messages Aug 26, 2013 – Aug 27, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

DAN LI

author
#0 lore raw

PATCH 1/1 mount/mount05.c: format the device when necessary

Format the device only when "-D device" & "-T type" are specified.

---
 testcases/kernel/syscalls/mount/mount05.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/mount/mount05.c +4 -2
index 4b2a07c..b4be67b 100644
@@ -113,7 +113,6 @@ int main(int argc, char *argv[])
 void setup(void)
 {
 	tst_require_root(NULL);
-	tst_mkfs(NULL, device, fstype, NULL);
 
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
@@ -122,9 +121,12 @@ void setup(void)
 	SAFE_MKDIR(cleanup, mntpoint_src, DIR_MODE);
 	SAFE_MKDIR(cleanup, mntpoint_des, DIR_MODE);
 
-	if (dflag && tflag)
+	if (dflag && tflag) {
+		tst_mkfs(NULL, device, fstype, NULL);
+
 		if (mount(device, mntpoint_src, fs_type, 0, NULL) == -1)
 			tst_brkm(TBROK | TERRNO, cleanup, "mount failed");
+	}
 
 	SAFE_FILE_PRINTF(cleanup, file_src, "TEST FILE");
 
Signature · 12 lines
1.8.1

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 21 lines · DAN LI

Format the device only when "-D device" & "-T type" are specified.

---
 testcases/kernel/syscalls/mount/mount05.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/mount/mount05.c +0 -1
index 4b2a07c..b4be67b 100644
@@ -113,7 +113,6 @@ int main(int argc, char *argv[])
 void setup(void)
 {
 	tst_require_root(NULL);
-	tst_mkfs(NULL, device, fstype, NULL);
 
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 

testcases/kernel/syscalls/mount/mount05.c void setup(void) · line 124

Quoted 5 lines
testcases/kernel/syscalls/mount/mount05.c +1 -1
@@ -122,9 +121,12 @@ void setup(void)
 	SAFE_MKDIR(cleanup, mntpoint_src, DIR_MODE);
 	SAFE_MKDIR(cleanup, mntpoint_des, DIR_MODE);
 
-	if (dflag && tflag)
+	if (dflag && tflag) {

If "-T" option is not specified, the default fs_type is "ext2", then we can also format the device.

testcases/kernel/syscalls/mount/mount05.c void setup(void) · line 125

Quoted 1 line
testcases/kernel/syscalls/mount/mount05.c +1 -0
+		tst_mkfs(NULL, device, fstype, NULL);

And here "fstype" should be changed to "fs_type", right?

Thanks,
Wanlong Gao

testcases/kernel/syscalls/mount/mount05.c void setup(void) · line 132

Quoted 7 lines
testcases/kernel/syscalls/mount/mount05.c +2 -0
+
 		if (mount(device, mntpoint_src, fs_type, 0, NULL) == -1)
 			tst_brkm(TBROK | TERRNO, cleanup, "mount failed");
+	}
 
 	SAFE_FILE_PRINTF(cleanup, file_src, "TEST FILE");
 

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list