2 md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
3 Copyright (C) 1998 Ingo Molnar
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 You should have received a copy of the GNU General Public License
11 (for example /usr/src/linux/COPYING); if not, write to the Free
12 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * Different major versions are not compatible.
20 * Different minor versions are only downward compatible.
21 * Different patchlevel versions are downward and upward compatible.
23 #define MD_MAJOR_VERSION 0
24 #define MD_MINOR_VERSION 90
26 * MD_PATCHLEVEL_VERSION indicates kernel functionality.
27 * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
28 * and major_version/minor_version accordingly
29 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
30 * in the super status byte
31 * >=3 means that bitmap superblock version 4 is supported, which uses
32 * little-ending representation rather than host-endian
34 #define MD_PATCHLEVEL_VERSION 3
39 #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
40 #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
41 #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
42 #define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
43 #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
46 #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
47 #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
48 #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
49 #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
50 #define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
51 #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
52 #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
53 #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
54 #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
55 #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
56 #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
57 #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
60 #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
61 /* 0x31 was START_ARRAY */
62 #define STOP_ARRAY _IO (MD_MAJOR, 0x32)
63 #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
64 #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
65 #define CLUSTERED_DISK_NACK _IO (MD_MAJOR, 0x35)
67 /* 63 partitions with the alternate major number (mdp) */
68 #define MdpMinorShift 6
70 typedef struct mdu_version_s
{
76 typedef struct mdu_array_info_s
{
78 * Generic constant information
92 * Generic state information
94 unsigned int utime
; /* 0 Superblock update time */
95 int state
; /* 1 State bits (clean, ...) */
96 int active_disks
; /* 2 Number of currently active disks */
97 int working_disks
; /* 3 Number of working disks */
98 int failed_disks
; /* 4 Number of failed disks */
99 int spare_disks
; /* 5 Number of spare disks */
102 * Personality information
104 int layout
; /* 0 the array's physical layout */
105 int chunk_size
; /* 1 chunk size in bytes */
109 /* non-obvious values for 'level' */
110 #define LEVEL_MULTIPATH (-4)
111 #define LEVEL_LINEAR (-1)
112 #define LEVEL_FAULTY (-5)
114 /* we need a value for 'no level specified' and 0
115 * means 'raid0', so we need something else. This is
116 * for internal use only
118 #define LEVEL_NONE (-1000000)
120 typedef struct mdu_disk_info_s
{
122 * configuration/status of one particular disk
132 typedef struct mdu_start_info_s
{
134 * configuration/status of one particular disk
143 typedef struct mdu_bitmap_file_s
148 typedef struct mdu_param_s
150 int personality
; /* 1,2,3,4 */
151 int chunk_size
; /* in bytes */
152 int max_fault
; /* unused for now */
155 #endif /* _UAPI_MD_U_H */