From 646c8351f41f36f357a9475c8c7303f191a9ee94 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 4 Nov 2012 14:49:38 +0100 Subject: [PATCH] hdd_menu: wait for HDD to be mounted by mdev after format --- src/gui/hdd_menu.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 9a1156f6b..bc96c17a1 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -649,6 +650,20 @@ _remount: fprintf(f, "/sbin/hotplug\n"); fclose(f); } +#else + /* mounting is asynchronous via mdev, so wait for the directory to appear */ + for (int i = 0; i < 20; i++) { + struct statfs s; + if (::statfs(dst, &s) == 0) { + if (s.f_type == 0xEF53) /* EXT3_SUPER_MAGIC */ + break; + if (s.f_type == 0x52654973) /* REISERFS_SUPER_MAGIC */ + break; + } + if (i == 0) + printf("CHDDFmtExec: waiting for %s to be mounted\n", dst); + sleep(1); + } #endif if(!res) {