]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Detail: adding sync status for cluster device
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index 705bd9b53b3ae28e9cd403640a81e4705d4d467e..399478b86c1ab07ef2e48146341bd51c1cf6788d 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -45,10 +45,8 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 #include       <errno.h>
 #include       <string.h>
 #include       <syslog.h>
-#ifdef __GLIBC__
 /* Newer glibc requires sys/sysmacros.h directly for makedev() */
 #include       <sys/sysmacros.h>
-#endif
 #ifdef __dietlibc__
 #include       <strings.h>
 /* dietlibc has deprecated random and srandom!! */
@@ -191,6 +189,36 @@ struct dlm_lksb {
 #endif
 #endif /* __KLIBC__ */
 
+/*
+ * Partially stolen from include/linux/unaligned/packed_struct.h
+ */
+struct __una_u16 { __u16 x; } __attribute__ ((packed));
+struct __una_u32 { __u32 x; } __attribute__ ((packed));
+
+static inline __u16 __get_unaligned16(const void *p)
+{
+       const struct __una_u16 *ptr = (const struct __una_u16 *)p;
+       return ptr->x;
+}
+
+static inline __u32 __get_unaligned32(const void *p)
+{
+       const struct __una_u32 *ptr = (const struct __una_u32 *)p;
+       return ptr->x;
+}
+
+static inline void __put_unaligned16(__u16 val, void *p)
+{
+       struct __una_u16 *ptr = (struct __una_u16 *)p;
+       ptr->x = val;
+}
+
+static inline void __put_unaligned32(__u32 val, void *p)
+{
+       struct __una_u32 *ptr = (struct __una_u32 *)p;
+       ptr->x = val;
+}
+
 /*
   * Check at compile time that something is of a particular type.
   * Always evaluates to 1 so you may use it easily in comparisons.
@@ -345,6 +373,7 @@ struct mdinfo {
                ARRAY_ACTIVE,
                ARRAY_WRITE_PENDING,
                ARRAY_ACTIVE_IDLE,
+               ARRAY_BROKEN,
                ARRAY_UNKNOWN_STATE,
        } array_state;
        struct md_bb bb;
@@ -412,6 +441,7 @@ enum special_options {
        NoSharing,
        HelpOptions,
        Brief,
+       NoDevices,
        ManageOpt,
        Add,
        AddSpare,
@@ -522,6 +552,7 @@ struct context {
        int     runstop;
        int     verbose;
        int     brief;
+       int     no_devices;
        int     force;
        char    *homehost;
        int     require_homehost;
@@ -647,6 +678,7 @@ enum sysfs_read_flags {
        GET_ERROR       = (1 << 24),
        GET_ARRAY_STATE = (1 << 25),
        GET_CONSISTENCY_POLICY  = (1 << 26),
+       GET_DEVS_ALL    = (1 << 27),
 };
 
 /* If fd >= 0, get the array it is open on,
@@ -731,7 +763,8 @@ extern int restore_stripes(int *dest, unsigned long long *offsets,
 
 extern char *map_num(mapping_t *map, int num);
 extern int map_name(mapping_t *map, char *name);
-extern mapping_t r5layout[], r6layout[], pers[], modes[], faultylayout[];
+extern mapping_t r0layout[], r5layout[], r6layout[],
+       pers[], modes[], faultylayout[];
 extern mapping_t consistency_policies[], sysfs_array_states[];
 
 extern char *map_dev_preferred(int major, int minor, int create,
@@ -815,8 +848,9 @@ extern struct superswitch {
        /* Used to report details of an active array.
         * ->load_super was possibly given a 'component' string.
         */
-       void (*detail_super)(struct supertype *st, char *homehost);
-       void (*brief_detail_super)(struct supertype *st);
+       void (*detail_super)(struct supertype *st, char *homehost,
+                            char *subarray);
+       void (*brief_detail_super)(struct supertype *st, char *subarray);
        void (*export_detail_super)(struct supertype *st);
 
        /* Optional: platform hardware / firmware details */
@@ -1004,7 +1038,8 @@ extern struct superswitch {
        /* query the supertype for default geometry */
        void (*default_geometry)(struct supertype *st, int *level, int *layout, int *chunk); /* optional */
        /* Permit subarray's to be deleted from inactive containers */
-       int (*kill_subarray)(struct supertype *st); /* optional */
+       int (*kill_subarray)(struct supertype *st,
+                            char *subarray_id); /* optional */
        /* Permit subarray's to be modified */
        int (*update_subarray)(struct supertype *st, char *subarray,
                               char *update, struct mddev_ident *ident); /* optional */
@@ -1291,6 +1326,9 @@ void domain_add(struct domainlist **domp, char *domain);
 extern void policy_save_path(char *id_path, struct map_ent *array);
 extern int policy_check_path(struct mdinfo *disk, struct map_ent *array);
 
+extern void sysfs_rules_apply(char *devnm, struct mdinfo *dev);
+extern void sysfsline(char *line);
+
 #if __GNUC__ < 3
 struct stat64;
 #endif
@@ -1722,6 +1760,11 @@ char *xstrdup(const char *str);
 #define makedev(M,m) (((M)<<8) | (m))
 #endif
 
+enum r0layout {
+       RAID0_ORIG_LAYOUT = 1,
+       RAID0_ALT_MULTIZONE_LAYOUT = 2,
+};
+
 /* for raid4/5/6 */
 #define ALGORITHM_LEFT_ASYMMETRIC      0
 #define ALGORITHM_RIGHT_ASYMMETRIC     1
@@ -1772,7 +1815,8 @@ char *xstrdup(const char *str);
 #define RESYNC_NONE -1
 #define RESYNC_DELAYED -2
 #define RESYNC_PENDING -3
-#define RESYNC_UNKNOWN -4
+#define RESYNC_REMOTE  -4
+#define RESYNC_UNKNOWN -5
 
 /* When using "GET_DISK_INFO" it isn't certain how high
  * we need to check.  So we impose an absolute limit of