xfs_ioctl32.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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_GETVERSION_32 FS_IOC32_GETVERSION
  18. /*
  19. * On intel, even if sizes match, alignment and/or padding may differ.
  20. */
  21. #if defined(CONFIG_IA64) || defined(CONFIG_X86_64)
  22. #define BROKEN_X86_ALIGNMENT
  23. #define __compat_packed __attribute__((packed))
  24. #else
  25. #define __compat_packed
  26. #endif
  27. typedef struct compat_xfs_bstime {
  28. old_time32_t tv_sec; /* seconds */
  29. __s32 tv_nsec; /* and nanoseconds */
  30. } compat_xfs_bstime_t;
  31. struct compat_xfs_bstat {
  32. __u64 bs_ino; /* inode number */
  33. __u16 bs_mode; /* type and mode */
  34. __u16 bs_nlink; /* number of links */
  35. __u32 bs_uid; /* user id */
  36. __u32 bs_gid; /* group id */
  37. __u32 bs_rdev; /* device value */
  38. __s32 bs_blksize; /* block size */
  39. __s64 bs_size; /* file size */
  40. compat_xfs_bstime_t bs_atime; /* access time */
  41. compat_xfs_bstime_t bs_mtime; /* modify time */
  42. compat_xfs_bstime_t bs_ctime; /* inode change time */
  43. int64_t bs_blocks; /* number of blocks */
  44. __u32 bs_xflags; /* extended flags */
  45. __s32 bs_extsize; /* extent size */
  46. __s32 bs_extents; /* number of extents */
  47. __u32 bs_gen; /* generation count */
  48. __u16 bs_projid_lo; /* lower part of project id */
  49. #define bs_projid bs_projid_lo /* (previously just bs_projid) */
  50. __u16 bs_forkoff; /* inode fork offset in bytes */
  51. __u16 bs_projid_hi; /* high part of project id */
  52. unsigned char bs_pad[10]; /* pad space, unused */
  53. __u32 bs_dmevmask; /* DMIG event mask */
  54. __u16 bs_dmstate; /* DMIG state info */
  55. __u16 bs_aextents; /* attribute number of extents */
  56. } __compat_packed;
  57. struct compat_xfs_fsop_bulkreq {
  58. compat_uptr_t lastip; /* last inode # pointer */
  59. __s32 icount; /* count of entries in buffer */
  60. compat_uptr_t ubuffer; /* user buffer for inode desc. */
  61. compat_uptr_t ocount; /* output count pointer */
  62. };
  63. #define XFS_IOC_FSBULKSTAT_32 \
  64. _IOWR('X', 101, struct compat_xfs_fsop_bulkreq)
  65. #define XFS_IOC_FSBULKSTAT_SINGLE_32 \
  66. _IOWR('X', 102, struct compat_xfs_fsop_bulkreq)
  67. #define XFS_IOC_FSINUMBERS_32 \
  68. _IOWR('X', 103, struct compat_xfs_fsop_bulkreq)
  69. typedef struct compat_xfs_fsop_handlereq {
  70. __u32 fd; /* fd for FD_TO_HANDLE */
  71. compat_uptr_t path; /* user pathname */
  72. __u32 oflags; /* open flags */
  73. compat_uptr_t ihandle; /* user supplied handle */
  74. __u32 ihandlen; /* user supplied length */
  75. compat_uptr_t ohandle; /* user buffer for handle */
  76. compat_uptr_t ohandlen; /* user buffer length */
  77. } compat_xfs_fsop_handlereq_t;
  78. #define XFS_IOC_PATH_TO_FSHANDLE_32 \
  79. _IOWR('X', 104, struct compat_xfs_fsop_handlereq)
  80. #define XFS_IOC_PATH_TO_HANDLE_32 \
  81. _IOWR('X', 105, struct compat_xfs_fsop_handlereq)
  82. #define XFS_IOC_FD_TO_HANDLE_32 \
  83. _IOWR('X', 106, struct compat_xfs_fsop_handlereq)
  84. #define XFS_IOC_OPEN_BY_HANDLE_32 \
  85. _IOWR('X', 107, struct compat_xfs_fsop_handlereq)
  86. #define XFS_IOC_READLINK_BY_HANDLE_32 \
  87. _IOWR('X', 108, struct compat_xfs_fsop_handlereq)
  88. /* The bstat field in the swapext struct needs translation */
  89. struct compat_xfs_swapext {
  90. int64_t sx_version; /* version */
  91. int64_t sx_fdtarget; /* fd of target file */
  92. int64_t sx_fdtmp; /* fd of tmp file */
  93. xfs_off_t sx_offset; /* offset into file */
  94. xfs_off_t sx_length; /* leng from offset */
  95. char sx_pad[16]; /* pad space, unused */
  96. struct compat_xfs_bstat sx_stat; /* stat of target b4 copy */
  97. } __compat_packed;
  98. #define XFS_IOC_SWAPEXT_32 _IOWR('X', 109, struct compat_xfs_swapext)
  99. typedef struct compat_xfs_fsop_attrlist_handlereq {
  100. struct compat_xfs_fsop_handlereq hreq; /* handle interface structure */
  101. struct xfs_attrlist_cursor pos; /* opaque cookie, list offset */
  102. __u32 flags; /* which namespace to use */
  103. __u32 buflen; /* length of buffer supplied */
  104. compat_uptr_t buffer; /* returned names */
  105. } __compat_packed compat_xfs_fsop_attrlist_handlereq_t;
  106. /* Note: actually this is read/write */
  107. #define XFS_IOC_ATTRLIST_BY_HANDLE_32 \
  108. _IOW('X', 122, struct compat_xfs_fsop_attrlist_handlereq)
  109. /* am_opcodes defined in xfs_fs.h */
  110. typedef struct compat_xfs_attr_multiop {
  111. __u32 am_opcode;
  112. __s32 am_error;
  113. compat_uptr_t am_attrname;
  114. compat_uptr_t am_attrvalue;
  115. __u32 am_length;
  116. __u32 am_flags;
  117. } compat_xfs_attr_multiop_t;
  118. typedef struct compat_xfs_fsop_attrmulti_handlereq {
  119. struct compat_xfs_fsop_handlereq hreq; /* handle interface structure */
  120. __u32 opcount;/* count of following multiop */
  121. /* ptr to compat_xfs_attr_multiop */
  122. compat_uptr_t ops; /* attr_multi data */
  123. } compat_xfs_fsop_attrmulti_handlereq_t;
  124. #define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \
  125. _IOW('X', 123, struct compat_xfs_fsop_attrmulti_handlereq)
  126. #ifdef BROKEN_X86_ALIGNMENT
  127. typedef struct compat_xfs_fsop_geom_v1 {
  128. __u32 blocksize; /* filesystem (data) block size */
  129. __u32 rtextsize; /* realtime extent size */
  130. __u32 agblocks; /* fsblocks in an AG */
  131. __u32 agcount; /* number of allocation groups */
  132. __u32 logblocks; /* fsblocks in the log */
  133. __u32 sectsize; /* (data) sector size, bytes */
  134. __u32 inodesize; /* inode size in bytes */
  135. __u32 imaxpct; /* max allowed inode space(%) */
  136. __u64 datablocks; /* fsblocks in data subvolume */
  137. __u64 rtblocks; /* fsblocks in realtime subvol */
  138. __u64 rtextents; /* rt extents in realtime subvol*/
  139. __u64 logstart; /* starting fsblock of the log */
  140. unsigned char uuid[16]; /* unique id of the filesystem */
  141. __u32 sunit; /* stripe unit, fsblocks */
  142. __u32 swidth; /* stripe width, fsblocks */
  143. __s32 version; /* structure version */
  144. __u32 flags; /* superblock version flags */
  145. __u32 logsectsize; /* log sector size, bytes */
  146. __u32 rtsectsize; /* realtime sector size, bytes */
  147. __u32 dirblocksize; /* directory block size, bytes */
  148. } __attribute__((packed)) compat_xfs_fsop_geom_v1_t;
  149. #define XFS_IOC_FSGEOMETRY_V1_32 \
  150. _IOR('X', 100, struct compat_xfs_fsop_geom_v1)
  151. struct compat_xfs_inogrp {
  152. __u64 xi_startino; /* starting inode number */
  153. __s32 xi_alloccount; /* # bits set in allocmask */
  154. __u64 xi_allocmask; /* mask of allocated inodes */
  155. } __attribute__((packed));
  156. /* These growfs input structures have padding on the end, so must translate */
  157. typedef struct compat_xfs_growfs_data {
  158. __u64 newblocks; /* new data subvol size, fsblocks */
  159. __u32 imaxpct; /* new inode space percentage limit */
  160. } __attribute__((packed)) compat_xfs_growfs_data_t;
  161. typedef struct compat_xfs_growfs_rt {
  162. __u64 newblocks; /* new realtime size, fsblocks */
  163. __u32 extsize; /* new realtime extent size, fsblocks */
  164. } __attribute__((packed)) compat_xfs_growfs_rt_t;
  165. #define XFS_IOC_FSGROWFSDATA_32 _IOW('X', 110, struct compat_xfs_growfs_data)
  166. #define XFS_IOC_FSGROWFSRT_32 _IOW('X', 112, struct compat_xfs_growfs_rt)
  167. #endif /* BROKEN_X86_ALIGNMENT */
  168. #endif /* __XFS_IOCTL32_H__ */