]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Add sector size as spare selection criterion
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index 07ee9635e7959fc7a1615a3731ecb4dbdc7985db..ec0a39e8b6e7051bed8551e56aff37d552b80139 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -361,6 +361,11 @@ struct createinfo {
        struct supertype *supertype;
 };
 
+struct spare_criteria {
+       unsigned long long min_size;
+       unsigned int sector_size;
+};
+
 enum mode {
        ASSEMBLE=1,
        BUILD,
@@ -940,11 +945,14 @@ extern struct superswitch {
         */
        __u64 (*avail_size)(struct supertype *st, __u64 size,
                            unsigned long long data_offset);
-       /* This is similar to 'avail_size' in purpose, but is used for
-        * containers for which there is no 'component size' to compare.
-        * This reports that whole-device size which is a minimum
+       /*
+        * Return spare criteria for array:
+        * - minimum disk size can be used in array;
+        * - sector size can be used in array.
+        * Return values: 0 - for success and -EINVAL on error.
         */
-       unsigned long long (*min_acceptable_spare_size)(struct supertype *st);
+       int (*get_spare_criteria)(struct supertype *st,
+                                 struct spare_criteria *sc);
        /* Find somewhere to put a bitmap - possibly auto-size it - and
         * update the metadata to record this.  The array may be newly
         * created, in which case data_size may be updated, or it might
@@ -1183,6 +1191,7 @@ extern int get_dev_size(int fd, char *dname, unsigned long long *sizep);
 extern int get_dev_sector_size(int fd, char *dname, unsigned int *sectsizep);
 extern int must_be_container(int fd);
 extern int dev_size_from_id(dev_t id, unsigned long long *size);
+extern int dev_sector_size_from_id(dev_t id, unsigned int *size);
 void wait_for(char *dev, int fd);
 
 /*
@@ -1434,6 +1443,8 @@ extern int check_raid(int fd, char *name);
 extern int check_partitions(int fd, char *dname,
                            unsigned long long freesize,
                            unsigned long long size);
+extern int fstat_is_blkdev(int fd, char *devname, dev_t *rdev);
+extern int stat_is_blkdev(char *devname, dev_t *rdev);
 
 extern int get_mdp_major(void);
 extern int get_maj_min(char *dev, int *major, int *minor);
@@ -1505,7 +1516,7 @@ extern int assemble_container_content(struct supertype *st, int mdfd,
 #define        INCR_ALREADY    4
 #define        INCR_YES        8
 extern struct mdinfo *container_choose_spares(struct supertype *st,
-                                             unsigned long long min_size,
+                                             struct spare_criteria *criteria,
                                              struct domainlist *domlist,
                                              char *spare_group,
                                              const char *metadata, int get_one);