]> git.neil.brown.name Git - mdadm.git/blob - md_u.h
mdctl-v0.2
[mdadm.git] / md_u.h
1 /*
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)
26
27 /* configuration */
28 #define CLEAR_ARRAY             _IO (MD_MAJOR, 0x20)
29 #define ADD_NEW_DISK            _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
30 #define HOT_REMOVE_DISK         _IO (MD_MAJOR, 0x22)
31 #define SET_ARRAY_INFO          _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
32 #define SET_DISK_INFO           _IO (MD_MAJOR, 0x24)
33 #define WRITE_RAID_INFO         _IO (MD_MAJOR, 0x25)
34 #define UNPROTECT_ARRAY         _IO (MD_MAJOR, 0x26)
35 #define PROTECT_ARRAY           _IO (MD_MAJOR, 0x27)
36 #define HOT_ADD_DISK            _IO (MD_MAJOR, 0x28)
37 #define SET_DISK_FAULTY         _IO (MD_MAJOR, 0x29)
38
39 /* usage */
40 #define RUN_ARRAY               _IOW (MD_MAJOR, 0x30, mdu_param_t)
41 #define START_ARRAY             _IO (MD_MAJOR, 0x31)
42 #define STOP_ARRAY              _IO (MD_MAJOR, 0x32)
43 #define STOP_ARRAY_RO           _IO (MD_MAJOR, 0x33)
44 #define RESTART_ARRAY_RW        _IO (MD_MAJOR, 0x34)
45
46 typedef struct mdu_version_s {
47         int major;
48         int minor;
49         int patchlevel;
50 } mdu_version_t;
51
52 typedef struct mdu_array_info_s {
53         /*
54          * Generic constant information
55          */
56         int major_version;
57         int minor_version;
58         int patch_version;
59         int ctime;
60         int level;
61         int size;
62         int nr_disks;
63         int raid_disks;
64         int md_minor;
65         int not_persistent;
66
67         /*
68          * Generic state information
69          */
70         int utime;              /*  0 Superblock update time                  */
71         int state;              /*  1 State bits (clean, ...)                 */
72         int active_disks;       /*  2 Number of currently active disks        */
73         int working_disks;      /*  3 Number of working disks                 */
74         int failed_disks;       /*  4 Number of failed disks                  */
75         int spare_disks;        /*  5 Number of spare disks                   */
76
77         /*
78          * Personality information
79          */
80         int layout;             /*  0 the array's physical layout             */
81         int chunk_size; /*  1 chunk size in bytes                     */
82
83 } mdu_array_info_t;
84
85 typedef struct mdu_disk_info_s {
86         /*
87          * configuration/status of one particular disk
88          */
89         int number;
90         int major;
91         int minor;
92         int raid_disk;
93         int state;
94
95 } mdu_disk_info_t;
96
97 typedef struct mdu_start_info_s {
98         /*
99          * configuration/status of one particular disk
100          */
101         int major;
102         int minor;
103         int raid_disk;
104         int state;
105
106 } mdu_start_info_t;
107
108 typedef struct mdu_param_s
109 {
110         int                     personality;    /* 1,2,3,4 */
111         int                     chunk_size;     /* in bytes */
112         int                     max_fault;      /* unused for now */
113 } mdu_param_t;
114
115 #endif 
116