]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
IMSM/DDF: don't recognised these metadata on partitions.
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index 27ef69378d69b030e5c1d17f829e7e64ff9d3035..d9d17b09d2834eb9781e29d1ccc8b94ee5803b9b 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -68,6 +68,29 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 #define DEFAULT_BITMAP_DELAY 5
 #define DEFAULT_MAX_WRITE_BEHIND 256
 
+/* VAR_RUN is where pid and socket files used for communicating
+ * with mdmon normally live.  It should be /var/run, but if
+ * it is too hard to remount /var/run as read-only rather than
+ * unmounting it at shutdown time, then it should be
+ * redefined to some place that comfortably persists until
+ * final shutdown, possibly in /dev if that is a tmpfs.
+ * Note: VAR_RUN does not need to be writable at shutdown,
+ * only during boot when "mdmon --takeover" is run.
+ */
+#ifndef VAR_RUN
+#define VAR_RUN "/var/run/mdadm"
+#endif /* VAR_RUN */
+/* ALT_RUN should be somewhere that persists across the pivotroot
+ * from early boot to late boot.
+ * If you don't have /lib/init/rw you might want to use /dev/.something
+ */
+#ifndef ALT_RUN
+#define ALT_RUN "/lib/init/rw/mdadm"
+#endif /* ALT_RUN */
+#ifndef ALT_MAPFILE
+#define ALT_MAPFILE "map"
+#endif /* ALT_MAPFILE */
+
 #include       "md_u.h"
 #include       "md_p.h"
 #include       "bitmap.h"
@@ -129,6 +152,22 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 #endif /* __KLIBC__ */
 
 
+/*
+ * min()/max()/clamp() macros that also do
+ * strict type-checking.. See the
+ * "unnecessary" pointer comparison.
+ */
+#define min(x, y) ({                            \
+       typeof(x) _min1 = (x);                  \
+       typeof(y) _min2 = (y);                  \
+       (void) (&_min1 == &_min2);              \
+       _min1 < _min2 ? _min1 : _min2; })
+
+#define max(x, y) ({                            \
+       typeof(x) _max1 = (x);                  \
+       typeof(y) _max2 = (y);                  \
+       (void) (&_max1 == &_max2);              \
+       _max1 > _max2 ? _max1 : _max2; })
 
 /* general information that might be extracted from a superblock */
 struct mdinfo {
@@ -276,6 +315,10 @@ typedef struct mddev_ident_s {
        char    *member;        /* subarray within a container */
 
        struct mddev_ident_s *next;
+       union {
+               /* fields needed by different users of this structure */
+               int assembled;  /* set when assembly succeeds */
+       };
 } *mddev_ident_t;
 
 /* List of device names - wildcards expanded */
@@ -329,6 +372,7 @@ struct map_ent {
 };
 extern int map_update(struct map_ent **mpp, int devnum, char *metadata,
                      int uuid[4], char *path);
+extern void map_remove(struct map_ent **map, int devnum);
 extern struct map_ent *map_by_uuid(struct map_ent **map, int uuid[4]);
 extern struct map_ent *map_by_devnum(struct map_ent **map, int devnum);
 extern struct map_ent *map_by_name(struct map_ent **map, char *name);
@@ -791,6 +835,7 @@ 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 get_mdp_major(void);
 extern int dev_open(char *dev, int flags);
@@ -803,7 +848,7 @@ extern int parse_auto(char *str, char *msg, int config);
 extern mddev_ident_t conf_get_ident(char *dev);
 extern mddev_dev_t conf_get_devs(void);
 extern int conf_test_dev(char *devname);
-extern int conf_test_metadata(const char *version);
+extern int conf_test_metadata(const char *version, int is_homehost);
 extern struct createinfo *conf_get_create_info(void);
 extern void set_conffile(char *file);
 extern char *conf_get_mailaddr(void);
@@ -831,6 +876,7 @@ extern int enough(int level, int raid_disks, int layout, int clean,
 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 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);
@@ -842,6 +888,7 @@ extern int assemble_container_content(struct supertype *st, int mdfd,
 extern int add_disk(int mdfd, struct supertype *st,
                    struct mdinfo *sra, struct mdinfo *info);
 extern int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info);
+unsigned long long min_recovery_start(struct mdinfo *array);
 
 extern char *human_size(long long bytes);
 extern char *human_size_brief(long long bytes);
@@ -859,13 +906,15 @@ extern int create_mddev(char *dev, char *name, int autof, int trustworthy,
                        char *chosen);
 /* values for 'trustworthy' */
 #define        LOCAL   1
+#define        LOCAL_ANY 10
 #define        FOREIGN 2
 #define        METADATA 3
 extern int open_mddev(char *dev, int report_errors);
 extern int open_container(int fd);
 
+extern char *pid_dir;
 extern int mdmon_running(int devnum);
-extern int signal_mdmon(int devnum);
+extern int mdmon_pid(int devnum);
 extern int check_env(char *name);
 extern __u32 random32(void);
 extern int start_mdmon(int devnum);
@@ -1005,3 +1054,10 @@ static inline int xasprintf(char **strp, const char *fmt, ...) {
 #define ALGORITHM_PARITY_0_6           20
 #define ALGORITHM_PARITY_N_6           ALGORITHM_PARITY_N
 
+/* Define PATH_MAX in case we don't use glibc or standard library does
+ * not have PATH_MAX defined. Assume max path length is 4K characters.
+ */
+#ifndef PATH_MAX
+#define PATH_MAX       4096
+#endif
+