]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Pass subarray arg explicitly to ->update_subarray.
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index 08e454404bccb3494bc8789d1f9d3f97c42c767a..25bc6230eadf8273af0da36bc69bc5ab7e30eae8 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -355,7 +355,7 @@ struct mdstat_ent {
        char            *level;
        char            *pattern; /* U or up, _ for down */
        int             percent; /* -1 if no resync */
-       int             resync; /* 1 if resync, 0 if recovery */
+       int             resync; /* 3 if check, 2 if reshape, 1 if resync, 0 if recovery */
        int             devcnt;
        int             raid_disks;
        int             chunk_size;
@@ -534,8 +534,12 @@ extern struct superswitch {
         * The particular device should be:
         *   The last device added by add_to_super
         *   The device the metadata was loaded from by load_super
+        * If 'map' is present, then it is an array raid_disks long
+        * (raid_disk must already be set and correct) and it is filled
+        * with 1 for slots that are thought to be active and 0 for slots which
+        * appear to be failed/missing.
         */
-       void (*getinfo_super)(struct supertype *st, struct mdinfo *info);
+       void (*getinfo_super)(struct supertype *st, struct mdinfo *info, char *map);
 
        /* Check if the given metadata is flagged as belonging to "this"
         * host.  0 for 'no', 1 for 'yes', -1 for "Don't record homehost"
@@ -617,7 +621,7 @@ extern struct superswitch {
                                 char *subdev, unsigned long long *freesize,
                                 int verbose);
 
-       struct mdinfo *(*container_content)(struct supertype *st);
+       struct mdinfo *(*container_content)(struct supertype *st, char *subarray);
        /* Allow a metadata handler to override mdadm's default layouts */
        int (*default_layout)(int level); /* optional */
        /* query the supertype for default chunk size */
@@ -625,7 +629,8 @@ extern struct superswitch {
        /* Permit subarray's to be deleted from inactive containers */
        int (*kill_subarray)(struct supertype *st); /* optional */
        /* Permit subarray's to be modified */
-       int (*update_subarray)(struct supertype *st, char *update, mddev_ident_t ident); /* optional */
+       int (*update_subarray)(struct supertype *st, char *subarray,
+                              char *update, mddev_ident_t ident); /* optional */
 
 /* for mdmon */
        int (*open_new)(struct supertype *c, struct active_array *a,
@@ -728,8 +733,12 @@ struct supertype {
 
 };
 
-extern struct supertype *super_by_fd(int fd);
-extern struct supertype *guess_super(int fd);
+extern struct supertype *super_by_fd(int fd, char **subarray);
+enum guess_types { guess_any, guess_array, guess_partitions };
+extern struct supertype *guess_super_type(int fd, enum guess_types guess_type);
+static inline struct supertype *guess_super(int fd) {
+       return guess_super_type(fd, guess_any);
+}
 extern struct supertype *dup_super(struct supertype *st);
 extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
 extern void get_one_disk(int mdfd, mdu_array_info_t *ainf,
@@ -753,7 +762,7 @@ struct dev_policy {
        char *value;
 };
 
-extern char pol_act[], pol_domain[], pol_metadata[];
+extern char pol_act[], pol_domain[], pol_metadata[], pol_auto[];
 
 /* iterate over the sublist starting at list, having the same
  * 'name' as 'list', and matching the given metadata (Where
@@ -786,9 +795,12 @@ extern char rule_path[], rule_type[];
 extern char type_part[], type_disk[];
 
 extern void policyline(char *line, char *type);
+extern void policy_add(char *type, ...);
 extern void policy_free(void);
 
+extern struct dev_policy *path_policy(char *path, char *type);
 extern struct dev_policy *disk_policy(struct mdinfo *disk);
+extern struct dev_policy *devnum_policy(int dev);
 extern void dev_policy_free(struct dev_policy *p);
 
 extern void pol_new(struct dev_policy **pol, char *name, char *val, char *metadata);
@@ -954,7 +966,7 @@ extern int parse_auto(char *str, char *msg, int config);
 extern mddev_ident_t conf_get_ident(char *dev);
 extern mddev_dev_t conf_get_devs(void);
 extern int conf_test_dev(char *devname);
-extern int conf_test_metadata(const char *version, int is_homehost);
+extern int conf_test_metadata(const char *version, struct dev_policy *pol, int is_homehost);
 extern struct createinfo *conf_get_create_info(void);
 extern void set_conffile(char *file);
 extern char *conf_get_mailaddr(void);
@@ -979,6 +991,7 @@ extern char *fname_from_uuid(struct supertype *st,
 extern unsigned long calc_csum(void *super, int bytes);
 extern int enough(int level, int raid_disks, int layout, int clean,
                   char *avail, int avail_disks);
+extern int enough_fd(int fd);
 extern int ask(char *mesg);
 extern unsigned long long get_component_size(int fd);
 extern void remove_partitions(int fd);
@@ -1020,7 +1033,7 @@ extern int open_container(int fd);
 extern int is_container_member(struct mdstat_ent *ent, char *devname);
 extern int is_subarray_active(char *subarray, char *devname);
 int is_container_active(char *devname);
-extern int open_subarray(char *dev, struct supertype *st, int quiet);
+extern int open_subarray(char *dev, char *subarray, struct supertype *st, int quiet);
 extern struct superswitch *version_to_superswitch(char *vers);
 
 extern int mdmon_running(int devnum);