xfs_ioctl32.h 8.5 KB

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