]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.h
Fix wrong bitmap output for cluster raid
[thirdparty/mdadm.git] / mdadm.h
diff --git a/mdadm.h b/mdadm.h
index 840a3597ad9f4fd598cea61654d12d96e7bbafaf..355c455630f095e2bc902f87314758de334a8a23 100755 (executable)
--- a/mdadm.h
+++ b/mdadm.h
@@ -139,20 +139,20 @@ struct dlm_lksb {
  * and there is no standard conversion function so... */
 /* And dietlibc doesn't think byteswap is ok, so.. */
 /*  #include <byteswap.h> */
-#define bswap_16(x) (((x) & 0x00ffU) << 8 | \
-                    ((x) & 0xff00U) >> 8)
-#define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
-                    ((x) & 0xff000000U) >> 24 | \
-                    ((x) & 0x0000ff00U) << 8  | \
-                    ((x) & 0x00ff0000U) >> 8)
-#define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
-                    ((x) & 0xff00000000000000ULL) >> 56 | \
-                    ((x) & 0x000000000000ff00ULL) << 40 | \
-                    ((x) & 0x00ff000000000000ULL) >> 40 | \
-                    ((x) & 0x0000000000ff0000ULL) << 24 | \
-                    ((x) & 0x0000ff0000000000ULL) >> 24 | \
-                    ((x) & 0x00000000ff000000ULL) << 8 | \
-                    ((x) & 0x000000ff00000000ULL) >> 8)
+#define __mdadm_bswap_16(x) (((x) & 0x00ffU) << 8 | \
+                            ((x) & 0xff00U) >> 8)
+#define __mdadm_bswap_32(x) (((x) & 0x000000ffU) << 24 | \
+                            ((x) & 0xff000000U) >> 24 | \
+                            ((x) & 0x0000ff00U) << 8  | \
+                            ((x) & 0x00ff0000U) >> 8)
+#define __mdadm_bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
+                            ((x) & 0xff00000000000000ULL) >> 56 | \
+                            ((x) & 0x000000000000ff00ULL) << 40 | \
+                            ((x) & 0x00ff000000000000ULL) >> 40 | \
+                            ((x) & 0x0000000000ff0000ULL) << 24 | \
+                            ((x) & 0x0000ff0000000000ULL) >> 24 | \
+                            ((x) & 0x00000000ff000000ULL) << 8 |  \
+                            ((x) & 0x000000ff00000000ULL) >> 8)
 
 #if !defined(__KLIBC__)
 #if BYTE_ORDER == LITTLE_ENDIAN
@@ -163,19 +163,19 @@ struct dlm_lksb {
 #define __le32_to_cpu(_x) (unsigned int)(_x)
 #define __le64_to_cpu(_x) (unsigned long long)(_x)
 
-#define        __cpu_to_be16(_x) bswap_16(_x)
-#define __cpu_to_be32(_x) bswap_32(_x)
-#define __cpu_to_be64(_x) bswap_64(_x)
-#define        __be16_to_cpu(_x) bswap_16(_x)
-#define __be32_to_cpu(_x) bswap_32(_x)
-#define __be64_to_cpu(_x) bswap_64(_x)
+#define        __cpu_to_be16(_x) __mdadm_bswap_16(_x)
+#define __cpu_to_be32(_x) __mdadm_bswap_32(_x)
+#define __cpu_to_be64(_x) __mdadm_bswap_64(_x)
+#define        __be16_to_cpu(_x) __mdadm_bswap_16(_x)
+#define __be32_to_cpu(_x) __mdadm_bswap_32(_x)
+#define __be64_to_cpu(_x) __mdadm_bswap_64(_x)
 #elif BYTE_ORDER == BIG_ENDIAN
-#define        __cpu_to_le16(_x) bswap_16(_x)
-#define __cpu_to_le32(_x) bswap_32(_x)
-#define __cpu_to_le64(_x) bswap_64(_x)
-#define        __le16_to_cpu(_x) bswap_16(_x)
-#define __le32_to_cpu(_x) bswap_32(_x)
-#define __le64_to_cpu(_x) bswap_64(_x)
+#define        __cpu_to_le16(_x) __mdadm_bswap_16(_x)
+#define __cpu_to_le32(_x) __mdadm_bswap_32(_x)
+#define __cpu_to_le64(_x) __mdadm_bswap_64(_x)
+#define        __le16_to_cpu(_x) __mdadm_bswap_16(_x)
+#define __le32_to_cpu(_x) __mdadm_bswap_32(_x)
+#define __le64_to_cpu(_x) __mdadm_bswap_64(_x)
 
 #define        __cpu_to_be16(_x) (unsigned int)(_x)
 #define __cpu_to_be32(_x) (unsigned int)(_x)
@@ -305,6 +305,9 @@ struct mdinfo {
        #define DS_REMOVE       1024
        #define DS_UNBLOCK      2048
        int prev_state, curr_state, next_state;
+
+       /* info read from sysfs */
+       char            sysfs_array_state[20];
 };
 
 struct createinfo {
@@ -367,6 +370,7 @@ enum special_options {
        ManageOpt,
        Add,
        AddSpare,
+       AddJournal,
        Remove,
        Fail,
        Replace,
@@ -588,6 +592,7 @@ enum sysfs_read_flags {
        GET_SIZE        = (1 << 22),
        GET_STATE       = (1 << 23),
        GET_ERROR       = (1 << 24),
+       GET_ARRAY_STATE = (1 << 25),
 };
 
 /* If fd >= 0, get the array it is open on,
@@ -815,7 +820,8 @@ extern struct superswitch {
         *   readwrite - clear the WriteMostly1 bit in the superblock devflags
         *   no-bitmap - clear any record that a bitmap is present.
         *   bbl       - add a bad-block-log if possible
-        *   no-bbl    - remove and bad-block-log is it is empty.
+        *   no-bbl    - remove any bad-block-log is it is empty.
+        *   force-no-bbl - remove any bad-block-log even if empty.
         *   revert-reshape - If a reshape is in progress, modify metadata so
         *                    it will resume going in the opposite direction.
         */
@@ -898,7 +904,7 @@ extern struct superswitch {
        /* Seek 'fd' to start of write-intent-bitmap.  Must be an
         * md-native format bitmap
         */
-       void (*locate_bitmap)(struct supertype *st, int fd);
+       int (*locate_bitmap)(struct supertype *st, int fd, int node_num);
        /* if add_internal_bitmap succeeded for existing array, this
         * writes it out.
         */
@@ -1509,9 +1515,9 @@ struct dlm_hooks {
 };
 
 extern int get_cluster_name(char **name);
-extern int is_clustered(struct supertype *st);
-extern int cluster_get_dlmlock(struct supertype *st, int *lockid);
-extern int cluster_release_dlmlock(struct supertype *st, int lockid);
+extern int dlm_funs_ready(void);
+extern int cluster_get_dlmlock(int *lockid);
+extern int cluster_release_dlmlock(int lockid);
 extern void set_dlm_hooks(void);
 
 #define _ROUND_UP(val, base)   (((val) + (base) - 1) & ~(base - 1))