diff options
author | Neil Brown <neilb@suse.de> | 2006-06-26 15:10:48 +1000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-06-26 15:10:48 +1000 |
commit | 45e878bba6b490bf204db824be71f070689c8737 (patch) | |
tree | 195397cfc3d4529edb80412cc7b1d506a8d3f529 /util.c | |
parent | 08110d41bc376e0a5724ab54b72a8793d03a79c0 (diff) | |
download | mdadm-45e878bba6b490bf204db824be71f070689c8737.tar.gz mdadm-45e878bba6b490bf204db824be71f070689c8737.tar.xz mdadm-45e878bba6b490bf204db824be71f070689c8737.zip |
Improve ftw handling.
If not 'ftw' is available, still allow openning of devices by dev number.
More recent version of uclibc support nftw, so add support to check
for that.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 50 |
1 files changed, 22 insertions, 28 deletions
@@ -354,32 +354,6 @@ struct devmap { } *devlist = NULL; int devlist_ready = 0; -#ifdef UCLIBC -int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s) -{ - return 0; -} -char *map_dev(int major, int minor, int create) -{ -#if 0 - fprintf(stderr, "Warning - fail to map %d,%d to a device name\n", - major, minor); -#endif - return NULL; -} -#else - -#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) -{ - return ftw(path, add_dev_1, nopenfd); -} -#endif - int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s) { struct stat st; @@ -404,6 +378,28 @@ int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s) return 0; } +#ifndef HAVE_NFTW +#ifdef HAVE_FTW +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) +{ + return ftw(path, add_dev_1, nopenfd); +} +#else +int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s) +{ + return 0; +} +int nftw(const char *path, int (*han)(const char *name, const struct stat *stb, int flag, struct FTW *s), int nopenfd, int flags) +{ + return 0; +} +#endif /* HAVE_FTW */ +#endif /* HAVE_NFTW */ + /* * Find a block device with the right major/minor number. * If we find multiple names, choose the shortest. @@ -464,8 +460,6 @@ char *map_dev(int major, int minor, int create) return nonstd ? nonstd : std; } -#endif - unsigned long calc_csum(void *super, int bytes) { unsigned long long newcsum = 0; |