fs_test: simplify open_filedev implementation
authorgkostka <kostka.grzegorz@gmail.com>
Wed, 30 Dec 2015 23:38:12 +0000 (00:38 +0100)
committergkostka <kostka.grzegorz@gmail.com>
Wed, 30 Dec 2015 23:38:12 +0000 (00:38 +0100)
fs_test/lwext4_generic.c
fs_test/lwext4_mbr.c
fs_test/lwext4_mkfs.c

index 21a4526e6dd5c6be0ef0b7f015fa9c43241b80d9..dc6023a4c5d478b7e2ed75e1ae19b6a57359f7ab 100644 (file)
@@ -148,6 +148,10 @@ static bool open_windows(void)
 #endif
 }
 
+static bool open_filedev(void)
+{
+       return winpart ? open_windows() : open_linux();
+}
 
 static bool parse_opt(int argc, char **argv)
 {
@@ -216,12 +220,9 @@ int main(int argc, char **argv)
        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;
        }
 
 
index 8c37c09cd86a505d9b8e8de01658317e0c3dc5ef..8c7602b60a9b6adcac010dd44bc0f4b9b61f6e4f 100644 (file)
@@ -93,15 +93,7 @@ static bool open_windows(void)
 
 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)
index b7ff601a0f09d3a63d15beb2af65f721a2e52963..aa7e1ef2b294e3574282b071d054daf588337350 100644 (file)
@@ -102,15 +102,7 @@ static bool open_windows(void)
 
 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)