Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


md_u.h
001: /*
002:    md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
003:           Copyright (C) 1998 Ingo Molnar
004:           
005:    This program is free software; you can redistribute it and/or modify
006:    it under the terms of the GNU General Public License as published by
007:    the Free Software Foundation; either version 2, or (at your option)
008:    any later version.
009:    
010:    You should have received a copy of the GNU General Public License
011:    (for example /usr/src/linux/COPYING); if not, write to the Free
012:    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
013: */
014: 
015: #ifndef _MD_U_H
016: #define _MD_U_H
017: 
018: /*
019:  * Different major versions are not compatible.
020:  * Different minor versions are only downward compatible.
021:  * Different patchlevel versions are downward and upward compatible.
022:  */
023: #define MD_MAJOR_VERSION                0
024: #define MD_MINOR_VERSION                90
025: /*
026:  * MD_PATCHLEVEL_VERSION indicates kernel functionality.
027:  * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
028:  *     and major_version/minor_version accordingly
029:  * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
030:  *     in the super status byte
031:  * >=3 means that bitmap superblock version 4 is supported, which uses
032:  *     little-ending representation rather than host-endian
033:  */
034: #define MD_PATCHLEVEL_VERSION           3
035: 
036: /* ioctls */
037: 
038: /* status */
039: #define RAID_VERSION            _IOR (MD_MAJOR, 0x10, mdu_version_t)
040: #define GET_ARRAY_INFO          _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
041: #define GET_DISK_INFO           _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
042: #define PRINT_RAID_DEBUG        _IO (MD_MAJOR, 0x13)
043: #define RAID_AUTORUN            _IO (MD_MAJOR, 0x14)
044: #define GET_BITMAP_FILE         _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
045: 
046: /* configuration */
047: #define CLEAR_ARRAY             _IO (MD_MAJOR, 0x20)
048: #define ADD_NEW_DISK            _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
049: #define HOT_REMOVE_DISK         _IO (MD_MAJOR, 0x22)
050: #define SET_ARRAY_INFO          _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
051: #define SET_DISK_INFO           _IO (MD_MAJOR, 0x24)
052: #define WRITE_RAID_INFO         _IO (MD_MAJOR, 0x25)
053: #define UNPROTECT_ARRAY         _IO (MD_MAJOR, 0x26)
054: #define PROTECT_ARRAY           _IO (MD_MAJOR, 0x27)
055: #define HOT_ADD_DISK            _IO (MD_MAJOR, 0x28)
056: #define SET_DISK_FAULTY         _IO (MD_MAJOR, 0x29)
057: #define HOT_GENERATE_ERROR      _IO (MD_MAJOR, 0x2a)
058: #define SET_BITMAP_FILE         _IOW (MD_MAJOR, 0x2b, int)
059: 
060: /* usage */
061: #define RUN_ARRAY               _IOW (MD_MAJOR, 0x30, mdu_param_t)
062: /*  0x31 was START_ARRAY  */
063: #define STOP_ARRAY              _IO (MD_MAJOR, 0x32)
064: #define STOP_ARRAY_RO           _IO (MD_MAJOR, 0x33)
065: #define RESTART_ARRAY_RW        _IO (MD_MAJOR, 0x34)
066: 
067: /* 63 partitions with the alternate major number (mdp) */
068: #define MdpMinorShift 6
069: 
070: typedef struct mdu_version_s {
071:         int major;
072:         int minor;
073:         int patchlevel;
074: } mdu_version_t;
075: 
076: typedef struct mdu_array_info_s {
077:         /*
078:          * Generic constant information
079:          */
080:         int major_version;
081:         int minor_version;
082:         int patch_version;
083:         int ctime;
084:         int level;
085:         int size;
086:         int nr_disks;
087:         int raid_disks;
088:         int md_minor;
089:         int not_persistent;
090: 
091:         /*
092:          * Generic state information
093:          */
094:         int utime;              /*  0 Superblock update time                  */
095:         int state;              /*  1 State bits (clean, ...)                 */
096:         int active_disks;       /*  2 Number of currently active disks        */
097:         int working_disks;      /*  3 Number of working disks                 */
098:         int failed_disks;       /*  4 Number of failed disks                  */
099:         int spare_disks;        /*  5 Number of spare disks                   */
100: 
101:         /*
102:          * Personality information
103:          */
104:         int layout;             /*  0 the array's physical layout             */
105:         int chunk_size; /*  1 chunk size in bytes                     */
106: 
107: } mdu_array_info_t;
108: 
109: /* non-obvious values for 'level' */
110: #define LEVEL_MULTIPATH         (-4)
111: #define LEVEL_LINEAR            (-1)
112: #define LEVEL_FAULTY            (-5)
113: 
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
117:  */
118: #define LEVEL_NONE              (-1000000)
119: 
120: typedef struct mdu_disk_info_s {
121:         /*
122:          * configuration/status of one particular disk
123:          */
124:         int number;
125:         int major;
126:         int minor;
127:         int raid_disk;
128:         int state;
129: 
130: } mdu_disk_info_t;
131: 
132: typedef struct mdu_start_info_s {
133:         /*
134:          * configuration/status of one particular disk
135:          */
136:         int major;
137:         int minor;
138:         int raid_disk;
139:         int state;
140: 
141: } mdu_start_info_t;
142: 
143: typedef struct mdu_bitmap_file_s
144: {
145:         char pathname[4096];
146: } mdu_bitmap_file_t;
147: 
148: typedef struct mdu_param_s
149: {
150:         int                     personality;    /* 1,2,3,4 */
151:         int                     chunk_size;     /* in bytes */
152:         int                     max_fault;      /* unused for now */
153: } mdu_param_t;
154: 
155: #endif 
156: 
157: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/