1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3 md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
4 Copyright (C) 1998 Ingo Molnar
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
16 * Different major versions are not compatible.
17 * Different minor versions are only downward compatible.
18 * Different patchlevel versions are downward and upward compatible.
20 #define MD_MAJOR_VERSION 0
21 #define MD_MINOR_VERSION 90
23 * MD_PATCHLEVEL_VERSION indicates kernel functionality.
24 * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
25 * and major_version/minor_version accordingly
26 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
27 * in the super status byte
28 * >=3 means that bitmap superblock version 4 is supported, which uses
29 * little-ending representation rather than host-endian
31 #define MD_PATCHLEVEL_VERSION 3
36 #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
37 #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
38 #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
39 #define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
40 #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
43 #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
44 #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
45 #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
46 #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
47 #define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
48 #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
49 #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
50 #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
51 #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
52 #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
53 #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
54 #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
57 #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
58 /* 0x31 was START_ARRAY */
59 #define STOP_ARRAY _IO (MD_MAJOR, 0x32)
60 #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
61 #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
62 #define CLUSTERED_DISK_NACK _IO (MD_MAJOR, 0x35)
64 /* 63 partitions with the alternate major number (mdp) */
65 #define MdpMinorShift 6
67 typedef struct mdu_version_s
{
73 typedef struct mdu_array_info_s
{
75 * Generic constant information
89 * Generic state information
91 unsigned int utime
; /* 0 Superblock update time */
92 int state
; /* 1 State bits (clean, ...) */
93 int active_disks
; /* 2 Number of currently active disks */
94 int working_disks
; /* 3 Number of working disks */
95 int failed_disks
; /* 4 Number of failed disks */
96 int spare_disks
; /* 5 Number of spare disks */
99 * Personality information
101 int layout
; /* 0 the array's physical layout */
102 int chunk_size
; /* 1 chunk size in bytes */
106 /* we need a value for 'no level specified' and 0
107 * means 'raid0', so we need something else. This is
108 * for internal use only
110 #define LEVEL_NONE (-1000000)
112 typedef struct mdu_disk_info_s
{
114 * configuration/status of one particular disk
124 typedef struct mdu_start_info_s
{
126 * configuration/status of one particular disk
135 typedef struct mdu_bitmap_file_s
140 typedef struct mdu_param_s
142 int personality
; /* 1,2,3,4 */
143 int chunk_size
; /* in bytes */
144 int max_fault
; /* unused for now */
147 #endif /* _UAPI_MD_U_H */