]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Dynamic hot-plug udev rules for policies
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index 73db7ecb3d08216490cb3ad05f33becd9d217ebe..369118c7bac13929468768a1dc37a9e7c4442bf9 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -311,6 +311,7 @@ enum special_options {
        Bitmap,
        RebuildMapOpt,
        InvalidBackup,
+       UdevRules,
 };
 
 /* structures read from config file */
@@ -401,6 +402,7 @@ extern void mdstat_wait(int seconds);
 extern void mdstat_wait_fd(int fd, const sigset_t *sigmask);
 extern int mddev_busy(int devnum);
 extern struct mdstat_ent *mdstat_by_component(char *name);
+extern struct mdstat_ent *mdstat_by_subdev(char *subdev, int container);
 
 struct map_ent {
        struct map_ent *next;
@@ -491,7 +493,8 @@ extern int reshape_open_backup_file(char *backup,
                                    char *devname,
                                    long blocks,
                                    int *fdlist,
-                                   unsigned long long *offsets);
+                                   unsigned long long *offsets,
+                                   int restart);
 extern unsigned long compute_backup_blocks(int nchunk, int ochunk,
                                           unsigned int ndata, unsigned int odata);
 
@@ -520,6 +523,31 @@ extern char *map_dev(int major, int minor, int create);
 struct active_array;
 struct metadata_update;
 
+
+/* 'struct reshape' records the intermediate states
+ * a general reshape.
+ * The starting geometry is converted to the 'before' geometry
+ * by at most an atomic level change. They could be the same.
+ * Similarly the 'after' geometry is converted to the final
+ * geometry by at most a level change.
+ * Note that 'before' and 'after' must have the same level.
+ * 'blocks' is the minimum number of sectors for a reshape unit.
+ * This will be a multiple of the stripe size in each of the
+ * 'before' and 'after' geometries.
+ * If 'blocks' is 0, no restriping is necessary.
+ */
+struct reshape {
+       int level;
+       int parity; /* number of parity blocks/devices */
+       struct {
+               int layout;
+               int data_disks;
+       } before, after;
+       unsigned long long backup_blocks;
+       unsigned long long stripes; /* number of old stripes that comprise 'blocks'*/
+       unsigned long long new_size; /* New size of array in sectors */
+};
+
 /* A superswitch provides entry point the a metadata handler.
  *
  * The super_switch primarily operates on some "metadata" that
@@ -692,7 +720,11 @@ extern struct superswitch {
        int (*reshape_super)(struct supertype *st, long long size, int level,
                             int layout, int chunksize, int raid_disks,
                             char *backup, char *dev, int verbose); /* optional */
-       int (*manage_reshape)(struct supertype *st, char *backup); /* optional */
+       int (*manage_reshape)( /* optional */
+               int afd, struct mdinfo *sra, struct reshape *reshape,
+               struct supertype *st, unsigned long blocks,
+               int *fds, unsigned long long *offsets,
+               int dests, int *destfd, unsigned long long *destoffsets);
 
 /* for mdmon */
        int (*open_new)(struct supertype *c, struct active_array *a,
@@ -763,6 +795,9 @@ struct metadata_update {
        int     len;
        char    *buf;
        void    *space; /* allocated space that monitor will use */
+       void    **space_list; /* list of allocated spaces that monitor can
+                              * use or that it returned.
+                              */
        struct metadata_update *next;
 };
 
@@ -1027,6 +1062,7 @@ extern int CreateBitmap(char *filename, int force, char uuid[16],
                        unsigned long long array_size,
                        int major);
 extern int ExamineBitmap(char *filename, int brief, struct supertype *st);
+extern int Write_rules(char *rule_name);
 extern int bitmap_update_uuid(int fd, int *uuid, int swap);
 extern unsigned long bitmap_sectors(struct bitmap_super_s *bsb);
 
@@ -1070,7 +1106,7 @@ extern int experimental(void);
 extern void free_line(char *line);
 extern int match_oneof(char *devices, char *devname);
 extern void uuid_from_super(int uuid[4], mdp_super_t *super);
-extern const int uuid_match_any[4];
+extern const int uuid_zero[4];
 extern int same_uuid(int a[4], int b[4], int swapuuid);
 extern void copy_uuid(void *a, int b[4], int swapuuid);
 extern char *__fname_from_uuid(int id[4], int swap, char *buf, char sep);
@@ -1091,7 +1127,12 @@ extern void append_metadata_update(struct supertype *st, void *buf, int len);
 extern int assemble_container_content(struct supertype *st, int mdfd,
                                      struct mdinfo *content, int runstop,
                                      char *chosen_name, int verbose);
-
+extern struct mdinfo *container_choose_spares(struct supertype *st,
+                                             unsigned long long min_size,
+                                             struct domainlist *domlist,
+                                             char *spare_group,
+                                             const char *metadata, int get_one);
+extern int move_spare(char *from_devname, char *to_devname, dev_t devid);
 extern int add_disk(int mdfd, struct supertype *st,
                    struct mdinfo *sra, struct mdinfo *info);
 extern int remove_disk(int mdfd, struct supertype *st,
@@ -1132,6 +1173,11 @@ extern int check_env(char *name);
 extern __u32 random32(void);
 extern int start_mdmon(int devnum);
 
+extern int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
+                        struct supertype *st, unsigned long stripes,
+                        int *fds, unsigned long long *offsets,
+                        int dests, int *destfd, unsigned long long *destoffsets);
+
 extern char *devnum2devname(int num);
 extern void fmt_devname(char *name, int num);
 extern int devname2devnum(char *name);