ocfs2_ioctl.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /* -*- mode: c; c-basic-offset: 8; -*-
  2. * vim: noexpandtab sw=8 ts=8 sts=0:
  3. *
  4. * ocfs2_ioctl.h
  5. *
  6. * Defines OCFS2 ioctls.
  7. *
  8. * Copyright (C) 2010 Oracle. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public
  12. * License, version 2, as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. */
  19. #ifndef OCFS2_IOCTL_H
  20. #define OCFS2_IOCTL_H
  21. /*
  22. * ioctl commands
  23. */
  24. #define OCFS2_IOC_GETFLAGS FS_IOC_GETFLAGS
  25. #define OCFS2_IOC_SETFLAGS FS_IOC_SETFLAGS
  26. #define OCFS2_IOC32_GETFLAGS FS_IOC32_GETFLAGS
  27. #define OCFS2_IOC32_SETFLAGS FS_IOC32_SETFLAGS
  28. /*
  29. * Space reservation / allocation / free ioctls and argument structure
  30. * are designed to be compatible with XFS.
  31. *
  32. * ALLOCSP* and FREESP* are not and will never be supported, but are
  33. * included here for completeness.
  34. */
  35. struct ocfs2_space_resv {
  36. __s16 l_type;
  37. __s16 l_whence;
  38. __s64 l_start;
  39. __s64 l_len; /* len == 0 means until end of file */
  40. __s32 l_sysid;
  41. __u32 l_pid;
  42. __s32 l_pad[4]; /* reserve area */
  43. };
  44. #define OCFS2_IOC_ALLOCSP _IOW ('X', 10, struct ocfs2_space_resv)
  45. #define OCFS2_IOC_FREESP _IOW ('X', 11, struct ocfs2_space_resv)
  46. #define OCFS2_IOC_RESVSP _IOW ('X', 40, struct ocfs2_space_resv)
  47. #define OCFS2_IOC_UNRESVSP _IOW ('X', 41, struct ocfs2_space_resv)
  48. #define OCFS2_IOC_ALLOCSP64 _IOW ('X', 36, struct ocfs2_space_resv)
  49. #define OCFS2_IOC_FREESP64 _IOW ('X', 37, struct ocfs2_space_resv)
  50. #define OCFS2_IOC_RESVSP64 _IOW ('X', 42, struct ocfs2_space_resv)
  51. #define OCFS2_IOC_UNRESVSP64 _IOW ('X', 43, struct ocfs2_space_resv)
  52. /* Used to pass group descriptor data when online resize is done */
  53. struct ocfs2_new_group_input {
  54. __u64 group; /* Group descriptor's blkno. */
  55. __u32 clusters; /* Total number of clusters in this group */
  56. __u32 frees; /* Total free clusters in this group */
  57. __u16 chain; /* Chain for this group */
  58. __u16 reserved1;
  59. __u32 reserved2;
  60. };
  61. #define OCFS2_IOC_GROUP_EXTEND _IOW('o', 1, int)
  62. #define OCFS2_IOC_GROUP_ADD _IOW('o', 2,struct ocfs2_new_group_input)
  63. #define OCFS2_IOC_GROUP_ADD64 _IOW('o', 3,struct ocfs2_new_group_input)
  64. /* Used to pass 2 file names to reflink. */
  65. struct reflink_arguments {
  66. __u64 old_path;
  67. __u64 new_path;
  68. __u64 preserve;
  69. };
  70. #define OCFS2_IOC_REFLINK _IOW('o', 4, struct reflink_arguments)
  71. /* Following definitions dedicated for ocfs2_info_request ioctls. */
  72. #define OCFS2_INFO_MAX_REQUEST (50)
  73. #define OCFS2_TEXT_UUID_LEN (OCFS2_VOL_UUID_LEN * 2)
  74. /* Magic number of all requests */
  75. #define OCFS2_INFO_MAGIC (0x4F32494E)
  76. /*
  77. * Always try to separate info request into small pieces to
  78. * guarantee the backward&forward compatibility.
  79. */
  80. struct ocfs2_info {
  81. __u64 oi_requests; /* Array of __u64 pointers to requests */
  82. __u32 oi_count; /* Number of requests in info_requests */
  83. __u32 oi_pad;
  84. };
  85. struct ocfs2_info_request {
  86. /*00*/ __u32 ir_magic; /* Magic number */
  87. __u32 ir_code; /* Info request code */
  88. __u32 ir_size; /* Size of request */
  89. __u32 ir_flags; /* Request flags */
  90. /*10*/ /* Request specific fields */
  91. };
  92. struct ocfs2_info_clustersize {
  93. struct ocfs2_info_request ic_req;
  94. __u32 ic_clustersize;
  95. __u32 ic_pad;
  96. };
  97. struct ocfs2_info_blocksize {
  98. struct ocfs2_info_request ib_req;
  99. __u32 ib_blocksize;
  100. __u32 ib_pad;
  101. };
  102. struct ocfs2_info_maxslots {
  103. struct ocfs2_info_request im_req;
  104. __u32 im_max_slots;
  105. __u32 im_pad;
  106. };
  107. struct ocfs2_info_label {
  108. struct ocfs2_info_request il_req;
  109. __u8 il_label[OCFS2_MAX_VOL_LABEL_LEN];
  110. } __attribute__ ((packed));
  111. struct ocfs2_info_uuid {
  112. struct ocfs2_info_request iu_req;
  113. __u8 iu_uuid_str[OCFS2_TEXT_UUID_LEN + 1];
  114. } __attribute__ ((packed));
  115. struct ocfs2_info_fs_features {
  116. struct ocfs2_info_request if_req;
  117. __u32 if_compat_features;
  118. __u32 if_incompat_features;
  119. __u32 if_ro_compat_features;
  120. __u32 if_pad;
  121. };
  122. struct ocfs2_info_journal_size {
  123. struct ocfs2_info_request ij_req;
  124. __u64 ij_journal_size;
  125. };
  126. struct ocfs2_info_freeinode {
  127. struct ocfs2_info_request ifi_req;
  128. struct ocfs2_info_local_freeinode {
  129. __u64 lfi_total;
  130. __u64 lfi_free;
  131. } ifi_stat[OCFS2_MAX_SLOTS];
  132. __u32 ifi_slotnum; /* out */
  133. __u32 ifi_pad;
  134. };
  135. #define OCFS2_INFO_MAX_HIST (32)
  136. struct ocfs2_info_freefrag {
  137. struct ocfs2_info_request iff_req;
  138. struct ocfs2_info_freefrag_stats { /* (out) */
  139. struct ocfs2_info_free_chunk_list {
  140. __u32 fc_chunks[OCFS2_INFO_MAX_HIST];
  141. __u32 fc_clusters[OCFS2_INFO_MAX_HIST];
  142. } ffs_fc_hist;
  143. __u32 ffs_clusters;
  144. __u32 ffs_free_clusters;
  145. __u32 ffs_free_chunks;
  146. __u32 ffs_free_chunks_real;
  147. __u32 ffs_min; /* Minimum free chunksize in clusters */
  148. __u32 ffs_max;
  149. __u32 ffs_avg;
  150. __u32 ffs_pad;
  151. } iff_ffs;
  152. __u32 iff_chunksize; /* chunksize in clusters(in) */
  153. __u32 iff_pad;
  154. };
  155. /* Codes for ocfs2_info_request */
  156. enum ocfs2_info_type {
  157. OCFS2_INFO_CLUSTERSIZE = 1,
  158. OCFS2_INFO_BLOCKSIZE,
  159. OCFS2_INFO_MAXSLOTS,
  160. OCFS2_INFO_LABEL,
  161. OCFS2_INFO_UUID,
  162. OCFS2_INFO_FS_FEATURES,
  163. OCFS2_INFO_JOURNAL_SIZE,
  164. OCFS2_INFO_FREEINODE,
  165. OCFS2_INFO_FREEFRAG,
  166. OCFS2_INFO_NUM_TYPES
  167. };
  168. /* Flags for struct ocfs2_info_request */
  169. /* Filled by the caller */
  170. #define OCFS2_INFO_FL_NON_COHERENT (0x00000001) /* Cluster coherency not
  171. required. This is a hint.
  172. It is up to ocfs2 whether
  173. the request can be fulfilled
  174. without locking. */
  175. /* Filled by ocfs2 */
  176. #define OCFS2_INFO_FL_FILLED (0x40000000) /* Filesystem understood
  177. this request and
  178. filled in the answer */
  179. #define OCFS2_INFO_FL_ERROR (0x80000000) /* Error happened during
  180. request handling. */
  181. #define OCFS2_IOC_INFO _IOR('o', 5, struct ocfs2_info)
  182. struct ocfs2_move_extents {
  183. /* All values are in bytes */
  184. /* in */
  185. __u64 me_start; /* Virtual start in the file to move */
  186. __u64 me_len; /* Length of the extents to be moved */
  187. __u64 me_goal; /* Physical offset of the goal,
  188. it's in block unit */
  189. __u64 me_threshold; /* Maximum distance from goal or threshold
  190. for auto defragmentation */
  191. __u64 me_flags; /* Flags for the operation:
  192. * - auto defragmentation.
  193. * - refcount,xattr cases.
  194. */
  195. /* out */
  196. __u64 me_moved_len; /* Moved/defraged length */
  197. __u64 me_new_offset; /* Resulting physical location */
  198. __u32 me_reserved[2]; /* Reserved for futhure */
  199. };
  200. #define OCFS2_MOVE_EXT_FL_AUTO_DEFRAG (0x00000001) /* Kernel manages to
  201. claim new clusters
  202. as the goal place
  203. for extents moving */
  204. #define OCFS2_MOVE_EXT_FL_PART_DEFRAG (0x00000002) /* Allow partial extent
  205. moving, is to make
  206. movement less likely
  207. to fail, may make fs
  208. even more fragmented */
  209. #define OCFS2_MOVE_EXT_FL_COMPLETE (0x00000004) /* Move or defragmenation
  210. completely gets done.
  211. */
  212. #define OCFS2_IOC_MOVE_EXT _IOW('o', 6, struct ocfs2_move_extents)
  213. #endif /* OCFS2_IOCTL_H */