Home | History | Annotate | Download | only in raid
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ****************************************************************************
     11  ****************************************************************************/
     12 #ifndef _MD_P_H
     13 #define _MD_P_H
     14 
     15 #define MD_RESERVED_BYTES (64 * 1024)
     16 #define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
     17 #define MD_RESERVED_BLOCKS (MD_RESERVED_BYTES / BLOCK_SIZE)
     18 
     19 #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS)
     20 #define MD_NEW_SIZE_BLOCKS(x) ((x & ~(MD_RESERVED_BLOCKS - 1)) - MD_RESERVED_BLOCKS)
     21 
     22 #define MD_SB_BYTES 4096
     23 #define MD_SB_WORDS (MD_SB_BYTES / 4)
     24 #define MD_SB_BLOCKS (MD_SB_BYTES / BLOCK_SIZE)
     25 #define MD_SB_SECTORS (MD_SB_BYTES / 512)
     26 
     27 #define MD_SB_GENERIC_OFFSET 0
     28 #define MD_SB_PERSONALITY_OFFSET 64
     29 #define MD_SB_DISKS_OFFSET 128
     30 #define MD_SB_DESCRIPTOR_OFFSET 992
     31 
     32 #define MD_SB_GENERIC_CONSTANT_WORDS 32
     33 #define MD_SB_GENERIC_STATE_WORDS 32
     34 #define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS)
     35 #define MD_SB_PERSONALITY_WORDS 64
     36 #define MD_SB_DESCRIPTOR_WORDS 32
     37 #define MD_SB_DISKS 27
     38 #define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS)
     39 #define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS)
     40 #define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS)
     41 
     42 #define MD_DISK_FAULTY 0
     43 #define MD_DISK_ACTIVE 1
     44 #define MD_DISK_SYNC 2
     45 #define MD_DISK_REMOVED 3
     46 
     47 #define MD_DISK_WRITEMOSTLY 9
     48 
     49 typedef struct mdp_device_descriptor_s {
     50  __u32 number;
     51  __u32 major;
     52  __u32 minor;
     53  __u32 raid_disk;
     54  __u32 state;
     55  __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5];
     56 } mdp_disk_t;
     57 
     58 #define MD_SB_MAGIC 0xa92b4efc
     59 
     60 #define MD_SB_CLEAN 0
     61 #define MD_SB_ERRORS 1
     62 
     63 #define MD_SB_BITMAP_PRESENT 8
     64 
     65 typedef struct mdp_superblock_s {
     66 
     67  __u32 md_magic;
     68  __u32 major_version;
     69  __u32 minor_version;
     70  __u32 patch_version;
     71  __u32 gvalid_words;
     72  __u32 set_uuid0;
     73  __u32 ctime;
     74  __u32 level;
     75  __u32 size;
     76  __u32 nr_disks;
     77  __u32 raid_disks;
     78  __u32 md_minor;
     79  __u32 not_persistent;
     80  __u32 set_uuid1;
     81  __u32 set_uuid2;
     82  __u32 set_uuid3;
     83  __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16];
     84 
     85  __u32 utime;
     86  __u32 state;
     87  __u32 active_disks;
     88  __u32 working_disks;
     89  __u32 failed_disks;
     90  __u32 spare_disks;
     91  __u32 sb_csum;
     92 #ifdef __BIG_ENDIAN
     93  __u32 events_hi;
     94  __u32 events_lo;
     95  __u32 cp_events_hi;
     96  __u32 cp_events_lo;
     97 #else
     98  __u32 events_lo;
     99  __u32 events_hi;
    100  __u32 cp_events_lo;
    101  __u32 cp_events_hi;
    102 #endif
    103  __u32 recovery_cp;
    104 
    105  __u64 reshape_position;
    106  __u32 new_level;
    107  __u32 delta_disks;
    108  __u32 new_layout;
    109  __u32 new_chunk;
    110  __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18];
    111 
    112  __u32 layout;
    113  __u32 chunk_size;
    114  __u32 root_pv;
    115  __u32 root_block;
    116  __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4];
    117 
    118  mdp_disk_t disks[MD_SB_DISKS];
    119 
    120  __u32 reserved[MD_SB_RESERVED_WORDS];
    121 
    122  mdp_disk_t this_disk;
    123 
    124 } mdp_super_t;
    125 
    126 #define WriteMostly1 1
    127 
    128 #define MD_FEATURE_BITMAP_OFFSET 1
    129 #define MD_FEATURE_RECOVERY_OFFSET 2
    130 #define MD_FEATURE_RESHAPE_ACTIVE 4
    131 
    132 #define MD_FEATURE_ALL (1|2|4)
    133 
    134 #endif
    135 
    136