]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Manage.c
add CFLAGS to mdassemble build and fix a couple of non-returning functions
[thirdparty/mdadm.git] / Manage.c
index 4cf40e10d04ae56cc697339d275f28e24baab115..660580b9c4ed247a75534b8758f25e8ba5770bf3 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -1,7 +1,7 @@
 /*
  * mdadm - manage Linux "md" devices aka RAID arrays.
  *
- * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au>
+ * Copyright (C) 2001-2006 Neil Brown <neilb@suse.de>
  *
  *
  *    This program is free software; you can redistribute it and/or modify
@@ -249,9 +249,9 @@ int Manage_subdevs(char *devname, int fd,
                                                continue;
                                        if ((disc.state & 4)==0) continue; /* sync */
                                        /* Looks like a good device to try */
-                                       dev = map_dev(disc.major, disc.minor);
+                                       dev = map_dev(disc.major, disc.minor, 1);
                                        if (!dev) continue;
-                                       dfd = open(dev, O_RDONLY);
+                                       dfd = dev_open(dev, O_RDONLY);
                                        if (dfd < 0) continue;
                                        if (st->ss->load_super(st, dfd, &dsuper, NULL)) {
                                                close(dfd);
@@ -278,8 +278,7 @@ int Manage_subdevs(char *devname, int fd,
                                                 * based reconstruct is possible
                                                 */
                                                struct mdinfo mdi;
-                                               struct mddev_ident_s ident;
-                                               st->ss->getinfo_super(&mdi, &ident, osuper);
+                                               st->ss->getinfo_super(&mdi, osuper);
                                                disc.major = major(stb.st_rdev);
                                                disc.minor = minor(stb.st_rdev);
                                                disc.number = mdi.disk.number;
@@ -288,7 +287,7 @@ int Manage_subdevs(char *devname, int fd,
                                                if (ioctl(fd, ADD_NEW_DISK, &disc) == 0) {
                                                        if (verbose >= 0)
                                                                fprintf(stderr, Name ": re-added %s\n", dv->devname);
-                                                       return 0;
+                                                       continue;
                                                }
                                                /* fall back on normal-add */
                                        }
@@ -342,6 +341,8 @@ int Manage_subdevs(char *devname, int fd,
                                                break;
                                        }
                        }
+                       if (dv->writemostly)
+                               disc.state |= (1 << MD_DISK_WRITEMOSTLY);
                        if (ioctl(fd,ADD_NEW_DISK, &disc)) {
                                fprintf(stderr, Name ": add new device failed for %s as %d: %s\n",
                                        dv->devname, j, strerror(errno));