]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.c
Incremental: fix setting of 'autof' flag.
[thirdparty/mdadm.git] / mdadm.c
diff --git a/mdadm.c b/mdadm.c
index b4b503dd288b1b70ec27419350d0b9d385aaf284..af9627d545307a4c485ec344d77247c5d941a5a4 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -199,7 +199,8 @@ int main(int argc, char *argv[])
                case 'G': newmode = GROW;
                        shortopt = short_bitmap_options;
                        break;
-               case 'I': newmode = INCREMENTAL; break;
+               case 'I': newmode = INCREMENTAL;
+                       shortopt = short_bitmap_auto_options; break;
                case AutoDetect:
                        newmode = AUTODETECT; break;
 
@@ -359,6 +360,12 @@ int main(int argc, char *argv[])
                        writemostly = 1;
                        continue;
 
+               case O(MANAGE,'w'):
+                       /* clear write-mostly for following devices */
+                       writemostly = 2;
+                       continue;
+
+
                case O(GROW,'z'):
                case O(CREATE,'z'): /* size */
                        if (size >= 0) {
@@ -511,6 +518,7 @@ int main(int argc, char *argv[])
 
                case O(CREATE,'a'):
                case O(BUILD,'a'):
+               case O(INCREMENTAL,'a'):
                case O(ASSEMBLE,'a'): /* auto-creation of device node */
                        autof = parse_auto(optarg, "--auto flag", 0);
                        continue;
@@ -702,7 +710,7 @@ int main(int argc, char *argv[])
                        test = 1;
                        continue;
                case O(MONITOR,'y'): /* log messages to syslog */
-                       openlog("mdadm", 0, SYSLOG_FACILITY);
+                       openlog("mdadm", LOG_PID, SYSLOG_FACILITY);
                        dosyslog = 1;
                        continue;
 
@@ -743,21 +751,6 @@ int main(int argc, char *argv[])
                        runstop = -1;
                        continue;
 
-               case O(MANAGE,'o'):
-                       if (readonly < 0) {
-                               fprintf(stderr, Name ": Cannot have both readonly and readwrite\n");
-                               exit(2);
-                       }
-                       readonly = 1;
-                       continue;
-               case O(MANAGE,'w'):
-                       if (readonly > 0) {
-                               fprintf(stderr, Name ": Cannot have both readwrite and readonly.\n");
-                               exit(2);
-                       }
-                       readonly = -1;
-                       continue;
-
                case O(MISC,'Q'):
                case O(MISC,'D'):
                case O(MISC,'E'):
@@ -1098,11 +1091,12 @@ int main(int argc, char *argv[])
                                int acnt;
                                ident.autof = autof;
                                do {
+                                       mddev_dev_t devlist = conf_get_devs();
                                        acnt = 0;
                                        do {
                                                rv2 = Assemble(ss, NULL, -1,
                                                               &ident,
-                                                              NULL, NULL,
+                                                              devlist, NULL,
                                                               readonly, runstop, NULL, homehost, verbose-quiet, force);
                                                if (rv2==0) {
                                                        cnt++;
@@ -1136,7 +1130,8 @@ int main(int argc, char *argv[])
                                if (cnt == 0 && rv == 0) {
                                        fprintf(stderr, Name ": No arrays found in config file or automatically\n");
                                        rv = 1;
-                               }
+                               } else if (cnt)
+                                       rv = 0;
                        } else if (cnt == 0 && rv == 0) {
                                fprintf(stderr, Name ": No arrays found in config file\n");
                                rv = 1;
@@ -1151,7 +1146,7 @@ int main(int argc, char *argv[])
                        break;
                }
                if (raiddisks == 0) {
-                       fprintf(stderr, Name ": no raid-disks specified.\n");
+                       fprintf(stderr, Name ": no raid-devices specified.\n");
                        rv = 1;
                        break;
                }
@@ -1175,7 +1170,7 @@ int main(int argc, char *argv[])
                        break;
                }
                if (raiddisks == 0) {
-                       fprintf(stderr, Name ": no raid-disks specified.\n");
+                       fprintf(stderr, Name ": no raid-devices specified.\n");
                        rv = 1;
                        break;
                }
@@ -1200,7 +1195,9 @@ int main(int argc, char *argv[])
                        }
                        if (brief && verbose)
                                brief = 2;
-                       rv = Examine(devlist, scan?(verbose>1?0:verbose+1):brief, scan, SparcAdjust, ss, homehost);
+                       rv = Examine(devlist, scan?(verbose>1?0:verbose+1):brief,
+                                    export, scan,
+                                    SparcAdjust, ss, homehost);
                } else {
                        if (devlist == NULL) {
                                if (devmode=='D' && scan) {