]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Allow more spare selection criteria
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index a3799733a4d9f11d65160b49c366caac79602bb4..8da7fd3e12a5dc9dd005182aa11d160b5bb5ea7b 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -361,6 +361,10 @@ struct createinfo {
        struct supertype *supertype;
 };
 
+struct spare_criteria {
+       unsigned long long min_size;
+};
+
 enum mode {
        ASSEMBLE=1,
        BUILD,
@@ -940,11 +944,13 @@ 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;
+        * 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
@@ -1415,6 +1421,8 @@ extern int Dump_metadata(char *dev, char *dir, struct context *c,
 extern int Restore_metadata(char *dev, char *dir, struct context *c,
                            struct supertype *st, int only);
 
+int md_array_valid(int fd);
+int md_array_active(int fd);
 int md_get_array_info(int fd, struct mdu_array_info_s *array);
 int md_set_array_info(int fd, struct mdu_array_info_s *array);
 int md_get_disk_info(int fd, struct mdu_disk_info_s *disk);
@@ -1432,6 +1440,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);
@@ -1484,7 +1494,6 @@ 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);
-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);
@@ -1504,7 +1513,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);
@@ -1533,7 +1542,7 @@ extern char *get_md_name(char *devnm);
 extern char DefaultConfFile[];
 
 extern int create_mddev(char *dev, char *name, int autof, int trustworthy,
-                       char *chosen);
+                       char *chosen, int block_udev);
 /* values for 'trustworthy' */
 #define        LOCAL   1
 #define        LOCAL_ANY 10
@@ -1567,6 +1576,8 @@ extern char *stat2kname(struct stat *st);
 extern char *fd2kname(int fd);
 extern char *stat2devnm(struct stat *st);
 extern char *fd2devnm(int fd);
+extern void udev_block(char *devnm);
+extern void udev_unblock(void);
 
 extern int in_initrd(void);