]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Provide a mdstat_ent to subarray helper
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index daaf628d90e6989882303e33dd15a0843cf2c6b1..a44bb2a98a21cef296d49e074f006c13d4a9d456 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -548,7 +548,7 @@ extern struct superswitch {
         * appear to be failed/missing.
         */
        void (*getinfo_super)(struct supertype *st, struct mdinfo *info, char *map);
-
+       struct mdinfo *(*getinfo_super_disks)(struct supertype *st);
        /* Check if the given metadata is flagged as belonging to "this"
         * host.  0 for 'no', 1 for 'yes', -1 for "Don't record homehost"
         */
@@ -608,6 +608,7 @@ extern struct superswitch {
        int (*load_container)(struct supertype *st, int fd, char *devname);
        struct supertype * (*match_metadata_desc)(char *arg);
        __u64 (*avail_size)(struct supertype *st, __u64 size);
+       unsigned long long (*min_acceptable_spare_size)(struct supertype *st);
        int (*add_internal_bitmap)(struct supertype *st, int *chunkp,
                                   int delay, int write_behind,
                                   unsigned long long size, int may_change, int major);
@@ -681,6 +682,21 @@ extern struct superswitch {
         */
        struct mdinfo *(*activate_spare)(struct active_array *a,
                                         struct metadata_update **updates);
+       /*
+        * Return statically allocated string that represents metadata specific
+        * controller domain of the disk. The domain is used in disk domain
+        * matching functions. Disks belong to the same domain if the they have
+        * the same domain from mdadm.conf and belong the same metadata domain.
+        * Returning NULL or not providing this handler means that metadata
+        * does not distinguish the differences between disks that belong to
+        * different controllers. They are in the domain specified by
+        * configuration file (mdadm.conf).
+        * In case when the metadata has the notion of domains based on disk
+        * it shall return NULL for disks that do not belong to the controller
+        * the supported domains. Such disks will form another domain and won't
+        * be mixed with supported ones.
+        */
+       const char *(*get_disk_controller_domain)(const char *path);
 
        int swapuuid; /* true if uuid is bigending rather than hostendian */
        int external;
@@ -767,7 +783,7 @@ struct dev_policy {
                         * name and metadata can be compared by address equality.
                         */
        const char *metadata;
-       char *value;
+       const char *value;
 };
 
 extern char pol_act[], pol_domain[], pol_metadata[], pol_auto[];
@@ -811,7 +827,8 @@ 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);
+//extern void pol_new(struct dev_policy **pol, char *name, char *val, char *metadata);
+extern void pol_add(struct dev_policy **pol, char *name, char *val, char *metadata);
 extern struct dev_policy *pol_find(struct dev_policy *pol, char *name);
 
 enum policy_action {
@@ -832,16 +849,19 @@ extern int disk_action_allows(struct mdinfo *disk, const char *metadata,
 
 struct domainlist {
        struct domainlist *next;
-       char *dom;
+       const char *dom;
 };
 
 extern int domain_test(struct domainlist *dom, struct dev_policy *pol,
                       const char *metadata);
 extern struct domainlist *domain_from_array(struct mdinfo *mdi,
                                            const char *metadata);
+extern void domainlist_add_dev(struct domainlist **dom, int devnum,
+                              const char *metadata);
 extern void domain_free(struct domainlist *dl);
 extern void domain_merge(struct domainlist **domp, struct dev_policy *pol,
                         const char *metadata);
+void domain_add(struct domainlist **domp, char *domain);
 
 extern void policy_save_path(char *id_path, struct map_ent *array);
 extern int policy_check_path(struct mdinfo *disk, struct map_ent *array);
@@ -1090,6 +1110,11 @@ static inline int is_subarray(char *vers)
        return (*vers == '/' || *vers == '-');
 }
 
+static inline char *to_subarray(struct mdstat_ent *ent, char *container)
+{
+       return &ent->metadata_version[10+strlen(container)+1];
+}
+
 #ifdef DEBUG
 #define dprintf(fmt, arg...) \
        fprintf(stderr, fmt, ##arg)