md_u.h 4.3 KB

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