]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Fix readding of a readwrite drive into a writemostly array
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index a1a12bc70c01c076bd2008e220c876de94a4fb5f..6a36f43c9771e15a258f287dd8448cd930a23296 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -64,6 +64,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 #define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
 #endif
 
+#define DEFAULT_CHUNK 512
 #define DEFAULT_BITMAP_CHUNK 4096
 #define DEFAULT_BITMAP_DELAY 5
 #define DEFAULT_MAX_WRITE_BEHIND 256
@@ -311,6 +312,7 @@ enum special_options {
        Bitmap,
        RebuildMapOpt,
        InvalidBackup,
+       UdevRules,
 };
 
 /* structures read from config file */
@@ -505,7 +507,8 @@ extern int save_stripes(int *source, unsigned long long *offsets,
 extern int restore_stripes(int *dest, unsigned long long *offsets,
                           int raid_disks, int chunk_size, int level, int layout,
                           int source, unsigned long long read_offset,
-                          unsigned long long start, unsigned long long length);
+                          unsigned long long start, unsigned long long length,
+                          char *src_buf);
 
 #ifndef Sendmail
 #define Sendmail "/usr/lib/sendmail -t"
@@ -614,6 +617,7 @@ extern struct superswitch {
         * (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.
+        * *info is zeroed out before data is added.
         */
        void (*getinfo_super)(struct supertype *st, struct mdinfo *info, char *map);
        struct mdinfo *(*getinfo_super_disks)(struct supertype *st);
@@ -642,6 +646,8 @@ extern struct superswitch {
         *   linear-grow-new - add a new device to a linear array, but don't
         *                   change the size: so superblock still matches
         *   linear-grow-update - now change the size of the array.
+        *   writemostly - set the WriteMostly1 bit in the superblock devflags
+        *   readwrite - clear the WriteMostly1 bit in the superblock devflags
         */
        int (*update_super)(struct supertype *st, struct mdinfo *info,
                            char *update,
@@ -699,7 +705,7 @@ extern struct superswitch {
         */
        int (*validate_geometry)(struct supertype *st, int level, int layout,
                                 int raiddisks,
-                                int chunk, unsigned long long size,
+                                int *chunk, unsigned long long size,
                                 char *subdev, unsigned long long *freesize,
                                 int verbose);
 
@@ -718,7 +724,8 @@ 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 delta_disks, char *backup, char *dev,
+                            int verbose); /* optional */
        int (*manage_reshape)( /* optional */
                int afd, struct mdinfo *sra, struct reshape *reshape,
                struct supertype *st, unsigned long blocks,
@@ -781,6 +788,9 @@ extern struct superswitch {
         */
        const char *(*get_disk_controller_domain)(const char *path);
 
+       /* for external backup area */
+       int (*recover_backup)(struct supertype *st, struct mdinfo *info);
+
        int swapuuid; /* true if uuid is bigending rather than hostendian */
        int external;
        const char *name; /* canonical metadata name */
@@ -824,7 +834,11 @@ struct supertype {
        int container_dev;    /* devnum of container */
        void *sb;
        void *info;
-
+       int ignore_hw_compat; /* used to inform metadata handlers that it should ignore
+                                HW/firmware related incompatability to load metadata.
+                                Used when examining metadata to display content of disk
+                                when user has no hw/firmare compatible system.
+                             */
        struct metadata_update *updates;
        struct metadata_update **update_tail;
 
@@ -998,14 +1012,15 @@ extern int Manage_runstop(char *devname, int fd, int runstop, int quiet);
 extern int Manage_resize(char *devname, int fd, long long size, int raid_disks);
 extern int Manage_subdevs(char *devname, int fd,
                          struct mddev_dev *devlist, int verbose, int test,
-                         char *update);
+                         char *update, int force);
 extern int autodetect(void);
 extern int Grow_Add_device(char *devname, int fd, char *newdev);
 extern int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int write_behind, int force);
 extern int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        long long size,
                        int level, char *layout_str, int chunksize, int raid_disks,
-                       int force);
+                       struct mddev_dev *devlist,
+                       int assume_clean, int force);
 extern int Grow_restart(struct supertype *st, struct mdinfo *info,
                        int *fdlist, int cnt, char *backup_file, int verbose);
 extern int Grow_continue(int mdfd, struct supertype *st,
@@ -1061,6 +1076,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);
 
@@ -1074,11 +1090,14 @@ extern int parse_layout_faulty(char *layout);
 extern int check_ext2(int fd, char *name);
 extern int check_reiser(int fd, char *name);
 extern int check_raid(int fd, char *name);
-extern int check_partitions(int fd, char *dname, unsigned long long freesize);
+extern int check_partitions(int fd, char *dname,
+                           unsigned long long freesize,
+                           unsigned long long size);
 
 extern int get_mdp_major(void);
 extern int dev_open(char *dev, int flags);
 extern int open_dev(int devnum);
+extern int open_dev_flags(int devnum, int flags);
 extern int open_dev_excl(int devnum);
 extern int is_standard(char *dev, int *nump);
 extern int same_dev(char *one, char *two);
@@ -1118,13 +1137,15 @@ extern int ask(char *mesg);
 extern unsigned long long get_component_size(int fd);
 extern void remove_partitions(int fd);
 extern int test_partition(int fd);
+extern int test_partition_from_id(dev_t id);
 extern unsigned long long calc_array_size(int level, int raid_disks, int layout,
                                   int chunksize, unsigned long long devsize);
 extern int flush_metadata_updates(struct supertype *st);
 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);
+                                     char *chosen_name, int verbose,
+                                     char *backup_file);
 extern struct mdinfo *container_choose_spares(struct supertype *st,
                                              unsigned long long min_size,
                                              struct domainlist *domlist,
@@ -1161,7 +1182,6 @@ extern int open_mddev(char *dev, int report_errors);
 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, char *subarray, struct supertype *st, int quiet);
 extern struct superswitch *version_to_superswitch(char *vers);
 
@@ -1175,6 +1195,7 @@ 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);
+void abort_reshape(struct mdinfo *sra);
 
 extern char *devnum2devname(int num);
 extern void fmt_devname(char *name, int num);
@@ -1326,3 +1347,5 @@ static inline int xasprintf(char **strp, const char *fmt, ...) {
 #define PATH_MAX       4096
 #endif
 
+#define PROCESS_DELAYED -2
+#define PROCESS_PENDING -3