root/include/uapi/linux/raid/md_u.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
   2 /*
   3    md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
   4           Copyright (C) 1998 Ingo Molnar
   5           
   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)
   9    any later version.
  10    
  11    You should have received a copy of the GNU General Public License
  12    (for example /usr/src/linux/COPYING); if not, write to the Free
  13    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
  14 */
  15 
  16 #ifndef _UAPI_MD_U_H
  17 #define _UAPI_MD_U_H
  18 
  19 /*
  20  * Different major versions are not compatible.
  21  * Different minor versions are only downward compatible.
  22  * Different patchlevel versions are downward and upward compatible.
  23  */
  24 #define MD_MAJOR_VERSION                0
  25 #define MD_MINOR_VERSION                90
  26 /*
  27  * MD_PATCHLEVEL_VERSION indicates kernel functionality.
  28  * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
  29  *     and major_version/minor_version accordingly
  30  * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
  31  *     in the super status byte
  32  * >=3 means that bitmap superblock version 4 is supported, which uses
  33  *     little-ending representation rather than host-endian
  34  */
  35 #define MD_PATCHLEVEL_VERSION           3
  36 
  37 /* ioctls */
  38 
  39 /* status */
  40 #define RAID_VERSION            _IOR (MD_MAJOR, 0x10, mdu_version_t)
  41 #define GET_ARRAY_INFO          _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
  42 #define GET_DISK_INFO           _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
  43 #define RAID_AUTORUN            _IO (MD_MAJOR, 0x14)
  44 #define GET_BITMAP_FILE         _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
  45 
  46 /* configuration */
  47 #define CLEAR_ARRAY             _IO (MD_MAJOR, 0x20)
  48 #define ADD_NEW_DISK            _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
  49 #define HOT_REMOVE_DISK         _IO (MD_MAJOR, 0x22)
  50 #define SET_ARRAY_INFO          _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
  51 #define SET_DISK_INFO           _IO (MD_MAJOR, 0x24)
  52 #define WRITE_RAID_INFO         _IO (MD_MAJOR, 0x25)
  53 #define UNPROTECT_ARRAY         _IO (MD_MAJOR, 0x26)
  54 #define PROTECT_ARRAY           _IO (MD_MAJOR, 0x27)
  55 #define HOT_ADD_DISK            _IO (MD_MAJOR, 0x28)
  56 #define SET_DISK_FAULTY         _IO (MD_MAJOR, 0x29)
  57 #define HOT_GENERATE_ERROR      _IO (MD_MAJOR, 0x2a)
  58 #define SET_BITMAP_FILE         _IOW (MD_MAJOR, 0x2b, int)
  59 
  60 /* usage */
  61 #define RUN_ARRAY               _IOW (MD_MAJOR, 0x30, mdu_param_t)
  62 /*  0x31 was START_ARRAY  */
  63 #define STOP_ARRAY              _IO (MD_MAJOR, 0x32)
  64 #define STOP_ARRAY_RO           _IO (MD_MAJOR, 0x33)
  65 #define RESTART_ARRAY_RW        _IO (MD_MAJOR, 0x34)
  66 #define CLUSTERED_DISK_NACK     _IO (MD_MAJOR, 0x35)
  67 
  68 /* 63 partitions with the alternate major number (mdp) */
  69 #define MdpMinorShift 6
  70 
  71 typedef struct mdu_version_s {
  72         int major;
  73         int minor;
  74         int patchlevel;
  75 } mdu_version_t;
  76 
  77 typedef struct mdu_array_info_s {
  78         /*
  79          * Generic constant information
  80          */
  81         int major_version;
  82         int minor_version;
  83         int patch_version;
  84         unsigned int ctime;
  85         int level;
  86         int size;
  87         int nr_disks;
  88         int raid_disks;
  89         int md_minor;
  90         int not_persistent;
  91 
  92         /*
  93          * Generic state information
  94          */
  95         unsigned int utime;     /*  0 Superblock update time                  */
  96         int state;              /*  1 State bits (clean, ...)                 */
  97         int active_disks;       /*  2 Number of currently active disks        */
  98         int working_disks;      /*  3 Number of working disks                 */
  99         int failed_disks;       /*  4 Number of failed disks                  */
 100         int spare_disks;        /*  5 Number of spare disks                   */
 101 
 102         /*
 103          * Personality information
 104          */
 105         int layout;             /*  0 the array's physical layout             */
 106         int chunk_size; /*  1 chunk size in bytes                     */
 107 
 108 } mdu_array_info_t;
 109 
 110 /* non-obvious values for 'level' */
 111 #define LEVEL_MULTIPATH         (-4)
 112 #define LEVEL_LINEAR            (-1)
 113 #define LEVEL_FAULTY            (-5)
 114 
 115 /* we need a value for 'no level specified' and 0
 116  * means 'raid0', so we need something else.  This is
 117  * for internal use only
 118  */
 119 #define LEVEL_NONE              (-1000000)
 120 
 121 typedef struct mdu_disk_info_s {
 122         /*
 123          * configuration/status of one particular disk
 124          */
 125         int number;
 126         int major;
 127         int minor;
 128         int raid_disk;
 129         int state;
 130 
 131 } mdu_disk_info_t;
 132 
 133 typedef struct mdu_start_info_s {
 134         /*
 135          * configuration/status of one particular disk
 136          */
 137         int major;
 138         int minor;
 139         int raid_disk;
 140         int state;
 141 
 142 } mdu_start_info_t;
 143 
 144 typedef struct mdu_bitmap_file_s
 145 {
 146         char pathname[4096];
 147 } mdu_bitmap_file_t;
 148 
 149 typedef struct mdu_param_s
 150 {
 151         int                     personality;    /* 1,2,3,4 */
 152         int                     chunk_size;     /* in bytes */
 153         int                     max_fault;      /* unused for now */
 154 } mdu_param_t;
 155 
 156 #endif /* _UAPI_MD_U_H */

/* [<][>][^][v][top][bottom][index][help] */