ocfs2_ioctl.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. /* Codes for ocfs2_info_request */
  127. enum ocfs2_info_type {
  128. OCFS2_INFO_CLUSTERSIZE = 1,
  129. OCFS2_INFO_BLOCKSIZE,
  130. OCFS2_INFO_MAXSLOTS,
  131. OCFS2_INFO_LABEL,
  132. OCFS2_INFO_UUID,
  133. OCFS2_INFO_FS_FEATURES,
  134. OCFS2_INFO_JOURNAL_SIZE,
  135. OCFS2_INFO_NUM_TYPES
  136. };
  137. /* Flags for struct ocfs2_info_request */
  138. /* Filled by the caller */
  139. #define OCFS2_INFO_FL_NON_COHERENT (0x00000001) /* Cluster coherency not
  140. required. This is a hint.
  141. It is up to ocfs2 whether
  142. the request can be fulfilled
  143. without locking. */
  144. /* Filled by ocfs2 */
  145. #define OCFS2_INFO_FL_FILLED (0x40000000) /* Filesystem understood
  146. this request and
  147. filled in the answer */
  148. #define OCFS2_INFO_FL_ERROR (0x80000000) /* Error happened during
  149. request handling. */
  150. #define OCFS2_IOC_INFO _IOR('o', 5, struct ocfs2_info)
  151. #endif /* OCFS2_IOCTL_H */