]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - config.c
Change way of printing name of a process
[thirdparty/mdadm.git] / config.c
index edadf02a6859a19e83f176b8f7e6b76d62963625..909f83f4a4fb840cf5c77ec3fd796d83e08a67f6 100644 (file)
--- a/config.c
+++ b/config.c
@@ -187,6 +187,7 @@ struct createinfo createinfo = {
        .autof = 2, /* by default, create devices with standard names */
        .symlinks = 1,
        .names = 0, /* By default, stick with numbered md devices. */
+       .bblist = 1, /* Use a bad block list by default */
 #ifdef DEBIAN
        .gid = 6, /* disk */
        .mode = 0660,
@@ -306,6 +307,10 @@ static void createline(char *line)
                        createinfo.names = 1;
                else if  (strncasecmp(w, "names=no", 11) == 0)
                        createinfo.names = 0;
+               else if  (strncasecmp(w, "bbl=no", 11) == 0)
+                       createinfo.bblist = 0;
+               else if  (strncasecmp(w, "bbl=yes", 11) == 0)
+                       createinfo.bblist = 1;
                else {
                        pr_err("unrecognised word on CREATE line: %s\n",
                                w);
@@ -575,6 +580,7 @@ void autoline(char *line)
 
        if (auto_seen)
                return;
+       auto_seen = 1;
 
        /* Parse the 'auto' line creating policy statements for the 'auto' policy.
         *
@@ -602,6 +608,24 @@ void autoline(char *line)
         * been seen gets an appropriate auto= entry.
         */
 
+       /* If environment variable MDADM_CONF_AUTO is defined, then
+        * it is prepended to the auto line.  This allow a script
+        * to easily disable some metadata types.
+        */
+       w = getenv("MDADM_CONF_AUTO");
+       if (w && *w) {
+               char *l = xstrdup(w);
+               char *head = line;
+               w = strtok(l, " \t");
+               while (w) {
+                       char *nw = dl_strdup(w);
+                       dl_insert(head, nw);
+                       head = nw;
+                       w = strtok(NULL, " \t");
+               }
+               free(l);
+       }
+
        for (super_cnt = 0; superlist[super_cnt]; super_cnt++)
                ;
        seen = xcalloc(super_cnt, 1);
@@ -783,6 +807,7 @@ void load_conffile(void)
 {
        FILE *f;
        char *confdir = NULL;
+       char *head;
 
        if (loaded)
                return;
@@ -824,6 +849,14 @@ void load_conffile(void)
                        }
                }
        }
+       /* If there was no AUTO line, process an empty line
+        * now so that the MDADM_CONF_AUTO env var gets processed.
+        */
+       head = dl_strdup("AUTO");
+       dl_init(head);
+       autoline(head);
+       free_line(head);
+
        loaded = 1;
 }