Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003    md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
0004           Copyright (C) 1998 Ingo Molnar
0005       
0006    This program is free software; you can redistribute it and/or modify
0007    it under the terms of the GNU General Public License as published by
0008    the Free Software Foundation; either version 2, or (at your option)
0009    any later version.
0010    
0011    You should have received a copy of the GNU General Public License
0012    (for example /usr/src/linux/COPYING); if not, write to the Free
0013    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
0014 */
0015 
0016 #ifndef _UAPI_MD_U_H
0017 #define _UAPI_MD_U_H
0018 
0019 /*
0020  * Different major versions are not compatible.
0021  * Different minor versions are only downward compatible.
0022  * Different patchlevel versions are downward and upward compatible.
0023  */
0024 #define MD_MAJOR_VERSION                0
0025 #define MD_MINOR_VERSION                90
0026 /*
0027  * MD_PATCHLEVEL_VERSION indicates kernel functionality.
0028  * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
0029  *     and major_version/minor_version accordingly
0030  * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
0031  *     in the super status byte
0032  * >=3 means that bitmap superblock version 4 is supported, which uses
0033  *     little-ending representation rather than host-endian
0034  */
0035 #define MD_PATCHLEVEL_VERSION           3
0036 
0037 /* ioctls */
0038 
0039 /* status */
0040 #define RAID_VERSION        _IOR (MD_MAJOR, 0x10, mdu_version_t)
0041 #define GET_ARRAY_INFO      _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
0042 #define GET_DISK_INFO       _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
0043 #define RAID_AUTORUN        _IO (MD_MAJOR, 0x14)
0044 #define GET_BITMAP_FILE     _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
0045 
0046 /* configuration */
0047 #define CLEAR_ARRAY     _IO (MD_MAJOR, 0x20)
0048 #define ADD_NEW_DISK        _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
0049 #define HOT_REMOVE_DISK     _IO (MD_MAJOR, 0x22)
0050 #define SET_ARRAY_INFO      _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
0051 #define SET_DISK_INFO       _IO (MD_MAJOR, 0x24)
0052 #define WRITE_RAID_INFO     _IO (MD_MAJOR, 0x25)
0053 #define UNPROTECT_ARRAY     _IO (MD_MAJOR, 0x26)
0054 #define PROTECT_ARRAY       _IO (MD_MAJOR, 0x27)
0055 #define HOT_ADD_DISK        _IO (MD_MAJOR, 0x28)
0056 #define SET_DISK_FAULTY     _IO (MD_MAJOR, 0x29)
0057 #define HOT_GENERATE_ERROR  _IO (MD_MAJOR, 0x2a)
0058 #define SET_BITMAP_FILE     _IOW (MD_MAJOR, 0x2b, int)
0059 
0060 /* usage */
0061 #define RUN_ARRAY       _IOW (MD_MAJOR, 0x30, mdu_param_t)
0062 /*  0x31 was START_ARRAY  */
0063 #define STOP_ARRAY      _IO (MD_MAJOR, 0x32)
0064 #define STOP_ARRAY_RO       _IO (MD_MAJOR, 0x33)
0065 #define RESTART_ARRAY_RW    _IO (MD_MAJOR, 0x34)
0066 #define CLUSTERED_DISK_NACK _IO (MD_MAJOR, 0x35)
0067 
0068 /* 63 partitions with the alternate major number (mdp) */
0069 #define MdpMinorShift 6
0070 
0071 typedef struct mdu_version_s {
0072     int major;
0073     int minor;
0074     int patchlevel;
0075 } mdu_version_t;
0076 
0077 typedef struct mdu_array_info_s {
0078     /*
0079      * Generic constant information
0080      */
0081     int major_version;
0082     int minor_version;
0083     int patch_version;
0084     unsigned int ctime;
0085     int level;
0086     int size;
0087     int nr_disks;
0088     int raid_disks;
0089     int md_minor;
0090     int not_persistent;
0091 
0092     /*
0093      * Generic state information
0094      */
0095     unsigned int utime; /*  0 Superblock update time              */
0096     int state;      /*  1 State bits (clean, ...)             */
0097     int active_disks;   /*  2 Number of currently active disks        */
0098     int working_disks;  /*  3 Number of working disks             */
0099     int failed_disks;   /*  4 Number of failed disks              */
0100     int spare_disks;    /*  5 Number of spare disks           */
0101 
0102     /*
0103      * Personality information
0104      */
0105     int layout;     /*  0 the array's physical layout         */
0106     int chunk_size; /*  1 chunk size in bytes             */
0107 
0108 } mdu_array_info_t;
0109 
0110 /* non-obvious values for 'level' */
0111 #define LEVEL_MULTIPATH     (-4)
0112 #define LEVEL_LINEAR        (-1)
0113 #define LEVEL_FAULTY        (-5)
0114 
0115 /* we need a value for 'no level specified' and 0
0116  * means 'raid0', so we need something else.  This is
0117  * for internal use only
0118  */
0119 #define LEVEL_NONE      (-1000000)
0120 
0121 typedef struct mdu_disk_info_s {
0122     /*
0123      * configuration/status of one particular disk
0124      */
0125     int number;
0126     int major;
0127     int minor;
0128     int raid_disk;
0129     int state;
0130 
0131 } mdu_disk_info_t;
0132 
0133 typedef struct mdu_start_info_s {
0134     /*
0135      * configuration/status of one particular disk
0136      */
0137     int major;
0138     int minor;
0139     int raid_disk;
0140     int state;
0141 
0142 } mdu_start_info_t;
0143 
0144 typedef struct mdu_bitmap_file_s
0145 {
0146     char pathname[4096];
0147 } mdu_bitmap_file_t;
0148 
0149 typedef struct mdu_param_s
0150 {
0151     int         personality;    /* 1,2,3,4 */
0152     int         chunk_size; /* in bytes */
0153     int         max_fault;  /* unused for now */
0154 } mdu_param_t;
0155 
0156 #endif /* _UAPI_MD_U_H */