]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
Wait for name to appear after create/assemble etc.
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 1736d70791c8ce5d145f6c01516384f4c19adb30..8845a0fb09bc452d6851c15d346c00eee4a8e5dd 100644 (file)
--- a/util.c
+++ b/util.c
@@ -842,6 +842,18 @@ int same_dev(char *one, char *two)
        return st1.st_rdev == st2.st_rdev;
 }
 
+void wait_for(char *dev)
+{
+       int i;
+
+       for (i=0 ; i<25 ; i++) {
+               struct stat stb;
+               if (stat(dev, &stb) == 0)
+                       return;
+               usleep(200000);
+       }
+}
+
 struct superswitch *superlist[] = { &super0, &super1, &super_ddf, &super_imsm, NULL };
 
 #if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)