md_u.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. #define CLUSTERED_DISK_NACK _IO (MD_MAJOR, 0x35)
  58. /* 63 partitions with the alternate major number (mdp) */
  59. #define MdpMinorShift 6
  60. typedef struct mdu_version_s {
  61. int major;
  62. int minor;
  63. int patchlevel;
  64. } mdu_version_t;
  65. typedef struct mdu_array_info_s {
  66. /*
  67. * Generic constant information
  68. */
  69. int major_version;
  70. int minor_version;
  71. int patch_version;
  72. int ctime;
  73. int level;
  74. int size;
  75. int nr_disks;
  76. int raid_disks;
  77. int md_minor;
  78. int not_persistent;
  79. /*
  80. * Generic state information
  81. */
  82. int utime; /* 0 Superblock update time */
  83. int state; /* 1 State bits (clean, ...) */
  84. int active_disks; /* 2 Number of currently active disks */
  85. int working_disks; /* 3 Number of working disks */
  86. int failed_disks; /* 4 Number of failed disks */
  87. int spare_disks; /* 5 Number of spare disks */
  88. /*
  89. * Personality information
  90. */
  91. int layout; /* 0 the array's physical layout */
  92. int chunk_size; /* 1 chunk size in bytes */
  93. } mdu_array_info_t;
  94. /* non-obvious values for 'level' */
  95. #define LEVEL_MULTIPATH (-4)
  96. #define LEVEL_LINEAR (-1)
  97. #define LEVEL_FAULTY (-5)
  98. /* we need a value for 'no level specified' and 0
  99. * means 'raid0', so we need something else. This is
  100. * for internal use only
  101. */
  102. #define LEVEL_NONE (-1000000)
  103. typedef struct mdu_disk_info_s {
  104. /*
  105. * configuration/status of one particular disk
  106. */
  107. int number;
  108. int major;
  109. int minor;
  110. int raid_disk;
  111. int state;
  112. } mdu_disk_info_t;
  113. typedef struct mdu_start_info_s {
  114. /*
  115. * configuration/status of one particular disk
  116. */
  117. int major;
  118. int minor;
  119. int raid_disk;
  120. int state;
  121. } mdu_start_info_t;
  122. typedef struct mdu_bitmap_file_s
  123. {
  124. char pathname[4096];
  125. } mdu_bitmap_file_t;
  126. typedef struct mdu_param_s
  127. {
  128. int personality; /* 1,2,3,4 */
  129. int chunk_size; /* in bytes */
  130. int max_fault; /* unused for now */
  131. } mdu_param_t;
  132. #endif /* _UAPI_MD_U_H */