]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Add device files created with --auto to list of known device files.
authorNeil Brown <neilb@suse.de>
Tue, 14 Jun 2005 00:15:04 +0000 (00:15 +0000)
committerNeil Brown <neilb@suse.de>
Tue, 14 Jun 2005 00:15:04 +0000 (00:15 +0000)
Description...

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
ChangeLog
mdadm.h
mdopen.c
util.c

index fbde4eccb06f1e872810a0399c8a2c929931988e..42d7069c9675af81d674590924934fe6804d40bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,9 @@ Changes Prior to 1.12.0 release
        stable aspect of the array
     -   Allow --force with --grow so '-Gfn1' works (on raid1)
     -   Make --examine --brief report spares= properly.
+    -   When device files are made with "--assemble --auto",
+       add them to the list of known device name, so that 
+       assembling stacked devices has a better chance of working.
        
 Changes Prior to 1.11.0 release
     -   Fix embarassing bug which causes --add to always fail.
diff --git a/mdadm.h b/mdadm.h
index 8542f5705f6ec5c944728f56b0ee27c8387c633d..d8a36a4763cbb04282a9274d724583a461665e8c 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -154,6 +154,19 @@ extern mapping_t r5layout[], pers[], modes[], faultylayout[];
 
 extern char *map_dev(int major, int minor);
 
+#ifdef UCLIBC
+  struct FTW {};
+# define FTW_PHYS 1
+#else
+# define  __USE_XOPEN_EXTENDED
+# include <ftw.h>
+# ifdef __dietlibc__
+#  define FTW_PHYS 1
+# endif
+#endif
+
+extern int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s);
+
 
 extern int Manage_ro(char *devname, int fd, int readonly);
 extern int Manage_runstop(char *devname, int fd, int runstop, int quiet);
index 721d74ae042053f905ebcc2a9443dfea4449b34f..9309fbd2f1a165224608883c624ecc667ad5e20f 100644 (file)
--- a/mdopen.c
+++ b/mdopen.c
@@ -66,6 +66,8 @@ void make_parts(char *dev, int cnt)
                mknod(name, S_IFBLK | 0600, makedev(major, minor+i));
                chown(name, stb2.st_uid, stb2.st_gid);
                chmod(name, stb2.st_mode & 07777);
+               stat(name, &stb2);
+               add_dev(name, &stb2, 0, NULL);
        }
 }
 
@@ -205,6 +207,8 @@ int open_mddev(char *dev, int autof)
                                chown(dev, stb.st_uid, stb.st_gid);
                                chmod(dev, stb.st_mode & 07777);
                        }
+                       stat(dev, &stb);
+                       add_dev(dev, &stb, 0, NULL);
                        make_parts(dev,autof);
                }
        }
diff --git a/util.c b/util.c
index a7dc7c77674de93cfb4614d1cbf4816afa713785..e5b7256ee8694614720961f49508aaf159843293 100644 (file)
--- a/util.c
+++ b/util.c
@@ -443,6 +443,9 @@ struct devmap {
 int devlist_ready = 0;
 
 #ifdef UCLIBC
+int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
+{
+}
 char *map_dev(int major, int minor)
 {
 #if 0
@@ -452,15 +455,19 @@ char *map_dev(int major, int minor)
        return NULL;
 }
 #else
-#define  __USE_XOPEN_EXTENDED
-#include <ftw.h>
 
+#ifdef __dietlibc__
+int add_dev_1(const char *name, const struct stat *stb, int flag)
+{
+       return add_dev(name, stb, flag, NULL);
+}
+int nftw(const char *path, int (*han)(const char *name, const struct stat *stb, int flag, struct FTW *s), int nopenfd, int flags)
+{
+       ftw(path, add_dev_1, nopenfd);
+}
+#endif
 
-#ifndef __dietlibc__
 int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
-#else
-int add_dev(const char *name, const struct stat *stb, int flag)
-#endif
 {
     if ((stb->st_mode&S_IFMT)== S_IFBLK) {
        char *n = strdup(name);
@@ -488,11 +495,7 @@ char *map_dev(int major, int minor)
        struct devmap *p;
        char *std = NULL, *nonstd=NULL;
        if (!devlist_ready) {
-#ifndef __dietlibc__
                nftw("/dev", add_dev, 10, FTW_PHYS);
-#else
-               ftw("/dev", add_dev, 10);
-#endif
                devlist_ready=1;
        }