xfs_ioctl32.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. * Copyright (c) 2004-2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_IOCTL32_H__
  19. #define __XFS_IOCTL32_H__
  20. #include <linux/compat.h>
  21. /*
  22. * on 32-bit arches, ioctl argument structures may have different sizes
  23. * and/or alignment. We define compat structures which match the
  24. * 32-bit sizes/alignments here, and their associated ioctl numbers.
  25. *
  26. * xfs_ioctl32.c contains routines to copy these structures in and out.
  27. */
  28. /* stock kernel-level ioctls we support */
  29. #define XFS_IOC_GETXFLAGS_32 FS_IOC32_GETFLAGS
  30. #define XFS_IOC_SETXFLAGS_32 FS_IOC32_SETFLAGS
  31. #define XFS_IOC_GETVERSION_32 FS_IOC32_GETVERSION
  32. /*
  33. * On intel, even if sizes match, alignment and/or padding may differ.
  34. */
  35. #if defined(CONFIG_IA64) || defined(CONFIG_X86_64)
  36. #define BROKEN_X86_ALIGNMENT
  37. #define __compat_packed __attribute__((packed))
  38. #else
  39. #define __compat_packed
  40. #endif
  41. typedef struct compat_xfs_bstime {
  42. compat_time_t tv_sec; /* seconds */
  43. __s32 tv_nsec; /* and nanoseconds */
  44. } compat_xfs_bstime_t;
  45. typedef struct compat_xfs_bstat {
  46. __u64 bs_ino; /* inode number */
  47. __u16 bs_mode; /* type and mode */
  48. __u16 bs_nlink; /* number of links */
  49. __u32 bs_uid; /* user id */
  50. __u32 bs_gid; /* group id */
  51. __u32 bs_rdev; /* device value */
  52. __s32 bs_blksize; /* block size */
  53. __s64 bs_size; /* file size */
  54. compat_xfs_bstime_t bs_atime; /* access time */
  55. compat_xfs_bstime_t bs_mtime; /* modify time */
  56. compat_xfs_bstime_t bs_ctime; /* inode change time */
  57. int64_t bs_blocks; /* number of blocks */
  58. __u32 bs_xflags; /* extended flags */
  59. __s32 bs_extsize; /* extent size */
  60. __s32 bs_extents; /* number of extents */
  61. __u32 bs_gen; /* generation count */
  62. __u16 bs_projid_lo; /* lower part of project id */
  63. #define bs_projid bs_projid_lo /* (previously just bs_projid) */
  64. __u16 bs_forkoff; /* inode fork offset in bytes */
  65. __u16 bs_projid_hi; /* high part of project id */
  66. unsigned char bs_pad[10]; /* pad space, unused */
  67. __u32 bs_dmevmask; /* DMIG event mask */
  68. __u16 bs_dmstate; /* DMIG state info */
  69. __u16 bs_aextents; /* attribute number of extents */
  70. } __compat_packed compat_xfs_bstat_t;
  71. typedef struct compat_xfs_fsop_bulkreq {
  72. compat_uptr_t lastip; /* last inode # pointer */
  73. __s32 icount; /* count of entries in buffer */
  74. compat_uptr_t ubuffer; /* user buffer for inode desc. */
  75. compat_uptr_t ocount; /* output count pointer */
  76. } compat_xfs_fsop_bulkreq_t;
  77. #define XFS_IOC_FSBULKSTAT_32 \
  78. _IOWR('X', 101, struct compat_xfs_fsop_bulkreq)
  79. #define XFS_IOC_FSBULKSTAT_SINGLE_32 \
  80. _IOWR('X', 102, struct compat_xfs_fsop_bulkreq)
  81. #define XFS_IOC_FSINUMBERS_32 \
  82. _IOWR('X', 103, struct compat_xfs_fsop_bulkreq)
  83. typedef struct compat_xfs_fsop_handlereq {
  84. __u32 fd; /* fd for FD_TO_HANDLE */
  85. compat_uptr_t path; /* user pathname */
  86. __u32 oflags; /* open flags */
  87. compat_uptr_t ihandle; /* user supplied handle */
  88. __u32 ihandlen; /* user supplied length */
  89. compat_uptr_t ohandle; /* user buffer for handle */
  90. compat_uptr_t ohandlen; /* user buffer length */
  91. } compat_xfs_fsop_handlereq_t;
  92. #define XFS_IOC_PATH_TO_FSHANDLE_32 \
  93. _IOWR('X', 104, struct compat_xfs_fsop_handlereq)
  94. #define XFS_IOC_PATH_TO_HANDLE_32 \
  95. _IOWR('X', 105, struct compat_xfs_fsop_handlereq)
  96. #define XFS_IOC_FD_TO_HANDLE_32 \
  97. _IOWR('X', 106, struct compat_xfs_fsop_handlereq)
  98. #define XFS_IOC_OPEN_BY_HANDLE_32 \
  99. _IOWR('X', 107, struct compat_xfs_fsop_handlereq)
  100. #define XFS_IOC_READLINK_BY_HANDLE_32 \
  101. _IOWR('X', 108, struct compat_xfs_fsop_handlereq)
  102. /* The bstat field in the swapext struct needs translation */
  103. typedef struct compat_xfs_swapext {
  104. __int64_t sx_version; /* version */
  105. __int64_t sx_fdtarget; /* fd of target file */
  106. __int64_t sx_fdtmp; /* fd of tmp file */
  107. xfs_off_t sx_offset; /* offset into file */
  108. xfs_off_t sx_length; /* leng from offset */
  109. char sx_pad[16]; /* pad space, unused */
  110. compat_xfs_bstat_t sx_stat; /* stat of target b4 copy */
  111. } __compat_packed compat_xfs_swapext_t;
  112. #define XFS_IOC_SWAPEXT_32 _IOWR('X', 109, struct compat_xfs_swapext)
  113. typedef struct compat_xfs_fsop_attrlist_handlereq {
  114. struct compat_xfs_fsop_handlereq hreq; /* handle interface structure */
  115. struct xfs_attrlist_cursor pos; /* opaque cookie, list offset */
  116. __u32 flags; /* which namespace to use */
  117. __u32 buflen; /* length of buffer supplied */
  118. compat_uptr_t buffer; /* returned names */
  119. } __compat_packed compat_xfs_fsop_attrlist_handlereq_t;
  120. /* Note: actually this is read/write */
  121. #define XFS_IOC_ATTRLIST_BY_HANDLE_32 \
  122. _IOW('X', 122, struct compat_xfs_fsop_attrlist_handlereq)
  123. /* am_opcodes defined in xfs_fs.h */
  124. typedef struct compat_xfs_attr_multiop {
  125. __u32 am_opcode;
  126. __s32 am_error;
  127. compat_uptr_t am_attrname;
  128. compat_uptr_t am_attrvalue;
  129. __u32 am_length;
  130. __u32 am_flags;
  131. } compat_xfs_attr_multiop_t;
  132. typedef struct compat_xfs_fsop_attrmulti_handlereq {
  133. struct compat_xfs_fsop_handlereq hreq; /* handle interface structure */
  134. __u32 opcount;/* count of following multiop */
  135. /* ptr to compat_xfs_attr_multiop */
  136. compat_uptr_t ops; /* attr_multi data */
  137. } compat_xfs_fsop_attrmulti_handlereq_t;
  138. #define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \
  139. _IOW('X', 123, struct compat_xfs_fsop_attrmulti_handlereq)
  140. typedef struct compat_xfs_fsop_setdm_handlereq {
  141. struct compat_xfs_fsop_handlereq hreq; /* handle information */
  142. /* ptr to struct fsdmidata */
  143. compat_uptr_t data; /* DMAPI data */
  144. } compat_xfs_fsop_setdm_handlereq_t;
  145. #define XFS_IOC_FSSETDM_BY_HANDLE_32 \
  146. _IOW('X', 121, struct compat_xfs_fsop_setdm_handlereq)
  147. #ifdef BROKEN_X86_ALIGNMENT
  148. /* on ia32 l_start is on a 32-bit boundary */
  149. typedef struct compat_xfs_flock64 {
  150. __s16 l_type;
  151. __s16 l_whence;
  152. __s64 l_start __attribute__((packed));
  153. /* len == 0 means until end of file */
  154. __s64 l_len __attribute__((packed));
  155. __s32 l_sysid;
  156. __u32 l_pid;
  157. __s32 l_pad[4]; /* reserve area */
  158. } compat_xfs_flock64_t;
  159. #define XFS_IOC_ALLOCSP_32 _IOW('X', 10, struct compat_xfs_flock64)
  160. #define XFS_IOC_FREESP_32 _IOW('X', 11, struct compat_xfs_flock64)
  161. #define XFS_IOC_ALLOCSP64_32 _IOW('X', 36, struct compat_xfs_flock64)
  162. #define XFS_IOC_FREESP64_32 _IOW('X', 37, struct compat_xfs_flock64)
  163. #define XFS_IOC_RESVSP_32 _IOW('X', 40, struct compat_xfs_flock64)
  164. #define XFS_IOC_UNRESVSP_32 _IOW('X', 41, struct compat_xfs_flock64)
  165. #define XFS_IOC_RESVSP64_32 _IOW('X', 42, struct compat_xfs_flock64)
  166. #define XFS_IOC_UNRESVSP64_32 _IOW('X', 43, struct compat_xfs_flock64)
  167. #define XFS_IOC_ZERO_RANGE_32 _IOW('X', 57, struct compat_xfs_flock64)
  168. typedef struct compat_xfs_fsop_geom_v1 {
  169. __u32 blocksize; /* filesystem (data) block size */
  170. __u32 rtextsize; /* realtime extent size */
  171. __u32 agblocks; /* fsblocks in an AG */
  172. __u32 agcount; /* number of allocation groups */
  173. __u32 logblocks; /* fsblocks in the log */
  174. __u32 sectsize; /* (data) sector size, bytes */
  175. __u32 inodesize; /* inode size in bytes */
  176. __u32 imaxpct; /* max allowed inode space(%) */
  177. __u64 datablocks; /* fsblocks in data subvolume */
  178. __u64 rtblocks; /* fsblocks in realtime subvol */
  179. __u64 rtextents; /* rt extents in realtime subvol*/
  180. __u64 logstart; /* starting fsblock of the log */
  181. unsigned char uuid[16]; /* unique id of the filesystem */
  182. __u32 sunit; /* stripe unit, fsblocks */
  183. __u32 swidth; /* stripe width, fsblocks */
  184. __s32 version; /* structure version */
  185. __u32 flags; /* superblock version flags */
  186. __u32 logsectsize; /* log sector size, bytes */
  187. __u32 rtsectsize; /* realtime sector size, bytes */
  188. __u32 dirblocksize; /* directory block size, bytes */
  189. } __attribute__((packed)) compat_xfs_fsop_geom_v1_t;
  190. #define XFS_IOC_FSGEOMETRY_V1_32 \
  191. _IOR('X', 100, struct compat_xfs_fsop_geom_v1)
  192. typedef struct compat_xfs_inogrp {
  193. __u64 xi_startino; /* starting inode number */
  194. __s32 xi_alloccount; /* # bits set in allocmask */
  195. __u64 xi_allocmask; /* mask of allocated inodes */
  196. } __attribute__((packed)) compat_xfs_inogrp_t;
  197. /* These growfs input structures have padding on the end, so must translate */
  198. typedef struct compat_xfs_growfs_data {
  199. __u64 newblocks; /* new data subvol size, fsblocks */
  200. __u32 imaxpct; /* new inode space percentage limit */
  201. } __attribute__((packed)) compat_xfs_growfs_data_t;
  202. typedef struct compat_xfs_growfs_rt {
  203. __u64 newblocks; /* new realtime size, fsblocks */
  204. __u32 extsize; /* new realtime extent size, fsblocks */
  205. } __attribute__((packed)) compat_xfs_growfs_rt_t;
  206. #define XFS_IOC_FSGROWFSDATA_32 _IOW('X', 110, struct compat_xfs_growfs_data)
  207. #define XFS_IOC_FSGROWFSRT_32 _IOW('X', 112, struct compat_xfs_growfs_rt)
  208. #endif /* BROKEN_X86_ALIGNMENT */
  209. #endif /* __XFS_IOCTL32_H__ */