md_u.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 _MD_U_H
  13. #define _MD_U_H
  14. /* ioctls */
  15. /* status */
  16. #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
  17. #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
  18. #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
  19. #define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
  20. #define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
  21. #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
  22. /* configuration */
  23. #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
  24. #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
  25. #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
  26. #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
  27. #define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
  28. #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
  29. #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
  30. #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
  31. #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
  32. #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
  33. #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
  34. #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
  35. /* usage */
  36. #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
  37. /* 0x31 was START_ARRAY */
  38. #define STOP_ARRAY _IO (MD_MAJOR, 0x32)
  39. #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
  40. #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
  41. /* 63 partitions with the alternate major number (mdp) */
  42. #define MdpMinorShift 6
  43. #ifdef __KERNEL__
  44. extern int mdp_major;
  45. #endif
  46. typedef struct mdu_version_s {
  47. int major;
  48. int minor;
  49. int patchlevel;
  50. } mdu_version_t;
  51. typedef struct mdu_array_info_s {
  52. /*
  53. * Generic constant information
  54. */
  55. int major_version;
  56. int minor_version;
  57. int patch_version;
  58. int ctime;
  59. int level;
  60. int size;
  61. int nr_disks;
  62. int raid_disks;
  63. int md_minor;
  64. int not_persistent;
  65. /*
  66. * Generic state information
  67. */
  68. int utime; /* 0 Superblock update time */
  69. int state; /* 1 State bits (clean, ...) */
  70. int active_disks; /* 2 Number of currently active disks */
  71. int working_disks; /* 3 Number of working disks */
  72. int failed_disks; /* 4 Number of failed disks */
  73. int spare_disks; /* 5 Number of spare disks */
  74. /*
  75. * Personality information
  76. */
  77. int layout; /* 0 the array's physical layout */
  78. int chunk_size; /* 1 chunk size in bytes */
  79. } mdu_array_info_t;
  80. /* non-obvious values for 'level' */
  81. #define LEVEL_MULTIPATH (-4)
  82. #define LEVEL_LINEAR (-1)
  83. #define LEVEL_FAULTY (-5)
  84. /* we need a value for 'no level specified' and 0
  85. * means 'raid0', so we need something else. This is
  86. * for internal use only
  87. */
  88. #define LEVEL_NONE (-1000000)
  89. typedef struct mdu_disk_info_s {
  90. /*
  91. * configuration/status of one particular disk
  92. */
  93. int number;
  94. int major;
  95. int minor;
  96. int raid_disk;
  97. int state;
  98. } mdu_disk_info_t;
  99. typedef struct mdu_start_info_s {
  100. /*
  101. * configuration/status of one particular disk
  102. */
  103. int major;
  104. int minor;
  105. int raid_disk;
  106. int state;
  107. } mdu_start_info_t;
  108. typedef struct mdu_bitmap_file_s
  109. {
  110. char pathname[4096];
  111. } mdu_bitmap_file_t;
  112. typedef struct mdu_param_s
  113. {
  114. int personality; /* 1,2,3,4 */
  115. int chunk_size; /* in bytes */
  116. int max_fault; /* unused for now */
  117. } mdu_param_t;
  118. #endif