hdd_menu: wait for HDD to be mounted by mdev after format

This commit is contained in:
Stefan Seyfried
2012-11-04 14:49:38 +01:00
parent 09498d8231
commit 646c8351f4

View File

@@ -35,6 +35,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/swap.h>
#include <sys/vfs.h>
#include <dirent.h>
#include <dlfcn.h>
#include <sys/mount.h>
@@ -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) {