]> 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 06:37:57 +0000 (06:37 +0000)
committerNeil Brown <neilb@suse.de>
Tue, 14 Jun 2005 06:37:57 +0000 (06:37 +0000)
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
mdadm.h
mdopen.c
util.c

diff --git a/mdadm.h b/mdadm.h
index 41e6702c999c3df13d0d3f42ff13a56950735bc0..bb124776069c9194eb9d0e36db1c8927b6a582de 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -200,6 +200,19 @@ struct supertype {
 extern struct supertype *super_by_version(int vers, int minor);
 extern struct supertype *guess_super(int fd);
 
+#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 f3f6446219e793e92861e6aa8d29130aacfdf62a..4445b1609ee901c79ad50ebb28fd185fa37221ea 100644 (file)
--- a/util.c
+++ b/util.c
@@ -313,6 +313,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
@@ -322,15 +325,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);
@@ -358,11 +365,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;
        }