]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.c
DDF: provide simple detail_super() implementation.
[thirdparty/mdadm.git] / mdadm.c
diff --git a/mdadm.c b/mdadm.c
index a46a716b29617014aeb6aab83698ce465467f3e5..f6f5b53af5279134908e0e962c75cf7f6cf1bae2 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -1,7 +1,7 @@
 /*
  * mdadm - manage Linux "md" devices aka RAID arrays.
  *
- * Copyright (C) 2001-2012 Neil Brown <neilb@suse.de>
+ * Copyright (C) 2001-2013 Neil Brown <neilb@suse.de>
  *
  *
  *    This program is free software; you can redistribute it and/or modify
@@ -116,13 +116,6 @@ int main(int argc, char *argv[])
        ident.container = NULL;
        ident.member = NULL;
 
-       /*
-        * set first char of argv[0] to @. This is used by
-        * systemd to signal that the task was launched from
-        * initrd/initramfs and should be preserved during shutdown
-        */
-       argv[0][0] = '@';
-
        while ((option_index = -1) ,
               (opt=getopt_long(argc, argv,
                                shortopt, long_options,
@@ -194,6 +187,7 @@ int main(int argc, char *argv[])
                        break;
                case 'a':
                case Add:
+               case AddSpare:
                case 'r':
                case Remove:
                case Replace:
@@ -922,6 +916,9 @@ int main(int argc, char *argv[])
                case O(MANAGE,Add): /* add a drive */
                        devmode = 'a';
                        continue;
+               case O(MANAGE,AddSpare): /* add drive - never re-add */
+                       devmode = 'S';
+                       continue;
                case O(MANAGE,ReAdd):
                        devmode = 'A';
                        continue;
@@ -1300,7 +1297,7 @@ int main(int argc, char *argv[])
                if (!rv && c.readonly < 0)
                        rv = Manage_ro(devlist->devname, mdfd, c.readonly);
                if (!rv && c.runstop > 0)
-                       rv = Manage_run(devlist->devname, mdfd, c.verbose);
+                       rv = Manage_run(devlist->devname, mdfd, &c);
                if (!rv && c.runstop < 0)
                        rv = Manage_stop(devlist->devname, mdfd, c.verbose, 0);
                break;
@@ -1534,6 +1531,11 @@ int main(int argc, char *argv[])
                        RebuildMap();
                }
                if (c.scan) {
+                       rv = 1;
+                       if (devlist) {
+                               pr_err("In --incremental mode, a device cannot be given with --scan.\n");
+                               break;
+                       }
                        if (c.runstop <= 0) {
                                pr_err("--incremental --scan meaningless without --run.\n");
                                break;
@@ -1542,7 +1544,7 @@ int main(int argc, char *argv[])
                                pr_err("--incremental --scan --fail not supported.\n");
                                break;
                        }
-                       rv = IncrementalScan(c.verbose);
+                       rv = IncrementalScan(&c, NULL);
                }
                if (!devlist) {
                        if (!rebuild_map && !c.scan) {
@@ -1551,16 +1553,16 @@ int main(int argc, char *argv[])
                        }
                        break;
                }
-               if (devlist->next) {
-                       pr_err("--incremental can only handle one device.\n");
-                       rv = 1;
-                       break;
-               }
-               if (devmode == 'f')
+               if (devmode == 'f') {
+                       if (devlist->next) {
+                               pr_err("'--incremental --fail' can only handle one device.\n");
+                               rv = 1;
+                               break;
+                       }
                        rv = IncrementalRemove(devlist->devname, remove_path,
                                               c.verbose);
-               else
-                       rv = Incremental(devlist->devname, &c, ss);
+               else
+                       rv = Incremental(devlist, &c, ss);
                break;
        case AUTODETECT:
                autodetect();
@@ -1811,7 +1813,8 @@ static int misc_list(struct mddev_dev *devlist,
                if (mdfd>=0) {
                        switch(dv->disposition) {
                        case 'R':
-                               rv |= Manage_run(dv->devname, mdfd, c->verbose); break;
+                               c->runstop = 1;
+                               rv |= Manage_run(dv->devname, mdfd, c); break;
                        case 'S':
                                rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0); break;
                        case 'o':