]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdassemble.c
Create: support --readonly flag.
[thirdparty/mdadm.git] / mdassemble.c
index cf83795789158a28e41f441dac40dd060f067681..f3b01202ebc24b272c8ba8c724da24401dc2551a 100644 (file)
 #include "mdadm.h"
 #include "md_p.h"
 
-/* from readme.c */
-mapping_t pers[] = {
-       { "linear", -1},
-       { "raid0", 0},
-       { "0", 0},
-       { "stripe", 0},
-       { "raid1", 1},
-       { "1", 1},
-       { "mirror", 1},
-       { "raid4", 4},
-       { "4", 4},
-       { "raid5", 5},
-       { "5", 5},
-       { "multipath", -4},
-       { "mp", -4},
-       { "raid6", 6},
-       { "6", 6},
-       { "raid10", 10},
-       { "10", 10},
-       { NULL, 0}
-};
-
 #ifndef MDASSEMBLE_AUTO
 /* from mdopen.c */
 int open_mddev(char *dev, int report_errors/*unused*/)
 {
        int mdfd = open(dev, O_RDWR);
        if (mdfd < 0)
-               fprintf(stderr, Name ": error opening %s: %s\n",
+               pr_err("error opening %s: %s\n",
                        dev, strerror(errno));
        else if (md_get_version(mdfd) <= 0) {
-               fprintf(stderr, Name ": %s does not appear to be an md device\n",
+               pr_err("%s does not appear to be an md device\n",
                        dev);
                close(mdfd);
                mdfd = -1;
@@ -88,9 +66,9 @@ int verbose = 0;
 int force = 0;
 
 int main(int argc, char *argv[]) {
-       mddev_ident_t array_list =  conf_get_ident(NULL);
+       struct mddev_ident *array_list =  conf_get_ident(NULL);
        if (!array_list) {
-               fprintf(stderr, Name ": No arrays found in config file\n");
+               pr_err("No arrays found in config file\n");
                rv = 1;
        } else
                for (; array_list; array_list = array_list->next) {
@@ -105,9 +83,9 @@ int main(int argc, char *argv[]) {
                        if (mdfd >= 0)
                                close(mdfd);
                        rv |= Assemble(array_list->st, array_list->devname,
-                                      array_list, NULL, NULL,
+                                      array_list, NULL, NULL, 0,
                                       readonly, runstop, NULL, NULL, 0,
-                                      verbose, force);
+                                      verbose, force, 1);
                }
        return rv;
 }