blob: 2f824aa889f3cb5dbc1bca425c6d1df7bf8f2d4b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
3 Copyright (C) 1998 Ingo Molnar
4
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)
8 any later version.
9
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.
13*/
14
15#ifndef _MD_U_H
16#define _MD_U_H
17
18/* ioctls */
19
20/* status */
21#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
22#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
23#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
24#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
25#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
NeilBrown32a76272005-06-21 17:17:14 -070026#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28/* configuration */
29#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
30#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
31#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
32#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
33#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
34#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
35#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
36#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
37#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
38#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
39#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
NeilBrown32a76272005-06-21 17:17:14 -070040#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42/* usage */
43#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
Adrian Bunkfbedac02006-10-03 01:15:44 -070044/* 0x31 was START_ARRAY */
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
46#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
47#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
48
NeilBrown8b2b5c22009-03-31 14:27:03 +110049/* 63 partitions with the alternate major number (mdp) */
50#define MdpMinorShift 6
51#ifdef __KERNEL__
52extern int mdp_major;
53#endif
54
Linus Torvalds1da177e2005-04-16 15:20:36 -070055typedef struct mdu_version_s {
56 int major;
57 int minor;
58 int patchlevel;
59} mdu_version_t;
60
61typedef struct mdu_array_info_s {
62 /*
63 * Generic constant information
64 */
65 int major_version;
66 int minor_version;
67 int patch_version;
68 int ctime;
69 int level;
70 int size;
71 int nr_disks;
72 int raid_disks;
73 int md_minor;
74 int not_persistent;
75
76 /*
77 * Generic state information
78 */
79 int utime; /* 0 Superblock update time */
80 int state; /* 1 State bits (clean, ...) */
81 int active_disks; /* 2 Number of currently active disks */
82 int working_disks; /* 3 Number of working disks */
83 int failed_disks; /* 4 Number of failed disks */
84 int spare_disks; /* 5 Number of spare disks */
85
86 /*
87 * Personality information
88 */
89 int layout; /* 0 the array's physical layout */
90 int chunk_size; /* 1 chunk size in bytes */
91
92} mdu_array_info_t;
93
NeilBrown8b2b5c22009-03-31 14:27:03 +110094/* non-obvious values for 'level' */
95#define LEVEL_MULTIPATH (-4)
96#define LEVEL_LINEAR (-1)
97#define LEVEL_FAULTY (-5)
98
99/* we need a value for 'no level specified' and 0
100 * means 'raid0', so we need something else. This is
101 * for internal use only
102 */
103#define LEVEL_NONE (-1000000)
104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105typedef struct mdu_disk_info_s {
106 /*
107 * configuration/status of one particular disk
108 */
109 int number;
110 int major;
111 int minor;
112 int raid_disk;
113 int state;
114
115} mdu_disk_info_t;
116
117typedef struct mdu_start_info_s {
118 /*
119 * configuration/status of one particular disk
120 */
121 int major;
122 int minor;
123 int raid_disk;
124 int state;
125
126} mdu_start_info_t;
127
NeilBrown32a76272005-06-21 17:17:14 -0700128typedef struct mdu_bitmap_file_s
129{
130 char pathname[4096];
131} mdu_bitmap_file_t;
132
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133typedef struct mdu_param_s
134{
135 int personality; /* 1,2,3,4 */
136 int chunk_size; /* in bytes */
137 int max_fault; /* unused for now */
138} mdu_param_t;
139
140#endif
141