1 diff -u mdadm-1.2.0/mdadm.h mdadm-1.2.0-/mdadm.h
2 --- mdadm-1.2.0/mdadm.h Tue Mar 11 03:29:58 2003
3 +++ mdadm-1.2.0-/mdadm.h Thu May 22 22:06:13 2003
6 #define __USE_LARGEFILE64
8 -extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
10 #include <sys/types.h>
16 +#define __KERNEL_STRICT_NAMES
18 #include <linux/kdev_t.h>
19 /*#include <linux/fs.h> */
20 #include <sys/mount.h>
21 Only in mdadm-1.2.0-: mdadm.h.orig
22 diff -u mdadm-1.2.0/util.c mdadm-1.2.0-/util.c
23 --- mdadm-1.2.0/util.c Tue Feb 11 23:50:49 2003
24 +++ mdadm-1.2.0-/util.c Thu May 22 22:09:03 2003
28 #include <sys/utsname.h>
32 * Parse a 128 bit uuid in 4 integers
35 * convert a major/minor pair for a block device into a name in /dev, if possible.
36 * On the first call, walk /dev collecting name.
37 - * Put them in a simple linked listfor now.
42 - struct devmap *next;
45 int devlist_ready = 0;
49 -char *map_dev(int major, int minor)
50 +void collect_devs(const char *name)
53 - fprintf(stderr, "Warning - fail to map %d,%d to a device name\n",
59 -#define __USE_XOPEN_EXTENDED
63 -int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)
65 - if ((stb->st_mode&S_IFMT)== S_IFBLK) {
66 - char *n = strdup(name);
67 - struct devmap *dm = malloc(sizeof(*dm));
69 - dm->major = MAJOR(stb->st_rdev);
70 - dm->minor = MINOR(stb->st_rdev);
76 + int n = strlen(name);
86 + while ((e = readdir(d))) {
87 + stat(e->d_name, &st);
88 + if (strcmp(e->d_name, ".") == 0 || strcmp(e->d_name, "..") == 0)
90 + if (!S_ISDIR(st.st_mode) && !S_ISBLK(st.st_mode))
92 + cur = malloc(n + strlen(e->d_name) + 2);
95 + strcpy(cur + n + 1, e->d_name);
96 + if (S_ISDIR(st.st_mode)) {
98 + if (!S_ISLNK(st.st_mode))
103 + major = MAJOR(st.st_rdev) & 0xff;
104 + minor = MINOR(st.st_rdev) & 0xff;
106 + if (devlist[major] == NULL)
107 + devlist[major] = calloc(sizeof(char*), 256);
108 + /* shortest name wins, this can be quite usable
109 + * with devfs and devfsd (/dev/hdaX links)
111 + if (devlist[major][minor] &&
112 + strlen(devlist[major][minor]) < strlen(cur))
115 + free(devlist[major][minor]);
116 + devlist[major][minor] = cur;
126 char *map_dev(int major, int minor)
129 if (!devlist_ready) {
130 - nftw("/dev", add_dev, 10, FTW_PHYS);
131 + collect_devs("/dev");
135 - for (p=devlist; p; p=p->next)
136 - if (p->major == major &&
142 + if (devlist[major])
143 + return devlist[major][minor];
150 int calc_sb_csum(mdp_super_t *super)
152 unsigned int oldcsum = super->sb_csum;
154 if (strncmp(name, "/dev/.tmp.md", 12)==0)
159 +long long lseek64(int fd, long long off, int w)
163 + llseek(fd, off >> 32, off & 0xffffffff, &res, w);
168 Only in mdadm-1.2.0-: util.c.orig
169 Only in mdadm-1.2.0-: util.c.rej