]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Add nodes option while creating md
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index c0726bff5b068f914cdc45688c7105eaa111820c..9d5580192b5f111f77ae131f3d5b304d1da0883d 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -180,6 +180,8 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
+extern const char Name[];
+
 /* general information that might be extracted from a superblock */
 struct mdinfo {
        mdu_array_info_t        array;
@@ -258,11 +260,10 @@ struct createinfo {
        int     mode;
        int     symlinks;
        int     names;
+       int     bblist;
        struct supertype *supertype;
 };
 
-#define Name "mdadm"
-
 enum mode {
        ASSEMBLE=1,
        BUILD,
@@ -343,6 +344,7 @@ enum special_options {
        Dump,
        Restore,
        Action,
+       Nodes,
 };
 
 enum prefix_standard {
@@ -417,6 +419,7 @@ struct context {
        char    *backup_file;
        int     invalid_backup;
        char    *action;
+       int     nodes;
 };
 
 struct shape {
@@ -929,7 +932,10 @@ extern struct superswitch {
        void (*sync_metadata)(struct supertype *st);
        void (*process_update)(struct supertype *st,
                               struct metadata_update *update);
-       void (*prepare_update)(struct supertype *st,
+       /* Prepare updates allocates extra memory that might be
+        * needed.  If the update cannot be understood,  return 0.
+        */
+       int (*prepare_update)(struct supertype *st,
                               struct metadata_update *update);
 
        /* activate_spare will check if the array is degraded and, if it
@@ -960,6 +966,9 @@ extern struct superswitch {
        /* for external backup area */
        int (*recover_backup)(struct supertype *st, struct mdinfo *info);
 
+       /* validate container after assemble */
+       int (*validate_container)(struct mdinfo *info);
+
        int swapuuid; /* true if uuid is bigending rather than hostendian */
        int external;
        const char *name; /* canonical metadata name */
@@ -1022,6 +1031,7 @@ struct supertype {
                         */
        int devcnt;
        int retry_soon;
+       int nodes;
 
        struct mdinfo *devs;
 
@@ -1276,6 +1286,7 @@ extern int check_partitions(int fd, char *dname,
                            unsigned long long size);
 
 extern int get_mdp_major(void);
+extern int get_maj_min(char *dev, int *major, int *minor);
 extern int dev_open(char *dev, int flags);
 extern int open_dev(char *devnm);
 extern void reopen_mddev(int mdfd);
@@ -1432,9 +1443,13 @@ static inline char *to_subarray(struct mdstat_ent *ent, char *container)
 
 #ifdef DEBUG
 #define dprintf(fmt, arg...) \
+       fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##arg)
+#define dprintf_cont(fmt, arg...) \
        fprintf(stderr, fmt, ##arg)
 #else
 #define dprintf(fmt, arg...) \
+        ({ if (0) fprintf(stderr, "%s: %s: " fmt, Name, __func__, ##arg); 0; })
+#define dprintf_cont(fmt, arg...) \
         ({ if (0) fprintf(stderr, fmt, ##arg); 0; })
 #endif
 #include <assert.h>
@@ -1449,7 +1464,11 @@ static inline int xasprintf(char **strp, const char *fmt, ...) {
        return ret;
 }
 
-#define pr_err(fmt ...) fprintf(stderr, Name ": " fmt)
+#ifdef DEBUG
+#define pr_err(fmt, args...) fprintf(stderr, "%s: %s: "fmt, Name, __func__, ##args)
+#else
+#define pr_err(fmt, args...) fprintf(stderr, "%s: "fmt, Name, ##args)
+#endif
 #define cont_err(fmt ...) fprintf(stderr, "       " fmt)
 
 void *xmalloc(size_t len);