logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

md_u.h (4147B)


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