shithub: lwext4

Download patch

ref: ba407e042e22ed6ed567aa8dd4365da84bff0449
parent: 45764c06a8ed8b23c5e0961976d7deefd57fcd73
author: gkostka <kostka.grzegorz@gmail.com>
date: Wed Dec 30 19:38:12 EST 2015

fs_test: simplify open_filedev implementation

--- a/fs_test/lwext4_generic.c
+++ b/fs_test/lwext4_generic.c
@@ -148,6 +148,10 @@
 #endif
 }
 
+static bool open_filedev(void)
+{
+	return winpart ? open_windows() : open_linux();
+}
 
 static bool parse_opt(int argc, char **argv)
 {
@@ -216,12 +220,9 @@
 	printf("\trw count: %d\n", rw_count);
 	printf("\tcache mode: %s\n", cache_mode ? "dynamic" : "static");
 
-	if (winpart) {
-		if (!open_windows())
-			return EXIT_FAILURE;
-	} else {
-		if (!open_linux())
-			return EXIT_FAILURE;
+	if (!open_filedev()) {
+		printf("open_filedev error\n");
+		return EXIT_FAILURE;
 	}
 
 
--- a/fs_test/lwext4_mbr.c
+++ b/fs_test/lwext4_mbr.c
@@ -93,15 +93,7 @@
 
 static bool open_filedev(void)
 {
-	if (winpart) {
-		if (!open_windows())
-			return false;
-	} else {
-		if (!open_linux())
-			return false;
-	}
-
-	return true;
+	return winpart ? open_windows() : open_linux();
 }
 
 static bool parse_opt(int argc, char **argv)
--- a/fs_test/lwext4_mkfs.c
+++ b/fs_test/lwext4_mkfs.c
@@ -102,15 +102,7 @@
 
 static bool open_filedev(void)
 {
-	if (winpart) {
-		if (!open_windows())
-			return false;
-	} else {
-		if (!open_linux())
-			return false;
-	}
-
-	return true;
+	return winpart ? open_windows() : open_linux();
 }
 
 static bool parse_opt(int argc, char **argv)