xfs_ioctl32.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. extern long xfs_file_compat_ioctl(struct file *, unsigned, unsigned long);
  22. extern long xfs_file_compat_invis_ioctl(struct file *, unsigned, unsigned long);
  23. /*
  24. * on 32-bit arches, ioctl argument structures may have different sizes
  25. * and/or alignment. We define compat structures which match the
  26. * 32-bit sizes/alignments here, and their associated ioctl numbers.
  27. *
  28. * xfs_ioctl32.c contains routines to copy these structures in and out.
  29. */
  30. /* stock kernel-level ioctls we support */
  31. #define XFS_IOC_GETXFLAGS_32 FS_IOC32_GETFLAGS
  32. #define XFS_IOC_SETXFLAGS_32 FS_IOC32_SETFLAGS
  33. #define XFS_IOC_GETVERSION_32 FS_IOC32_GETVERSION
  34. /*
  35. * On intel, even if sizes match, alignment and/or padding may differ.
  36. */
  37. #if defined(CONFIG_IA64) || defined(CONFIG_X86_64)
  38. #define BROKEN_X86_ALIGNMENT
  39. #define __compat_packed __attribute__((packed))
  40. #else
  41. #define __compat_packed
  42. #endif
  43. typedef struct compat_xfs_bstime {
  44. compat_time_t tv_sec; /* seconds */
  45. __s32 tv_nsec; /* and nanoseconds */
  46. } compat_xfs_bstime_t;
  47. typedef struct compat_xfs_bstat {
  48. __u64 bs_ino; /* inode number */
  49. __u16 bs_mode; /* type and mode */
  50. __u16 bs_nlink; /* number of links */
  51. __u32 bs_uid; /* user id */
  52. __u32 bs_gid; /* group id */
  53. __u32 bs_rdev; /* device value */
  54. __s32 bs_blksize; /* block size */
  55. __s64 bs_size; /* file size */
  56. compat_xfs_bstime_t bs_atime; /* access time */
  57. compat_xfs_bstime_t bs_mtime; /* modify time */
  58. compat_xfs_bstime_t bs_ctime; /* inode change time */
  59. int64_t bs_blocks; /* number of blocks */
  60. __u32 bs_xflags; /* extended flags */
  61. __s32 bs_extsize; /* extent size */
  62. __s32 bs_extents; /* number of extents */
  63. __u32 bs_gen; /* generation count */
  64. __u16 bs_projid; /* project id */
  65. unsigned char bs_pad[14]; /* pad space, unused */
  66. __u32 bs_dmevmask; /* DMIG event mask */
  67. __u16 bs_dmstate; /* DMIG state info */
  68. __u16 bs_aextents; /* attribute number of extents */
  69. } __compat_packed compat_xfs_bstat_t;
  70. typedef struct compat_xfs_fsop_bulkreq {
  71. compat_uptr_t lastip; /* last inode # pointer */
  72. __s32 icount; /* count of entries in buffer */
  73. compat_uptr_t ubuffer; /* user buffer for inode desc. */
  74. compat_uptr_t ocount; /* output count pointer */
  75. } compat_xfs_fsop_bulkreq_t;
  76. #define XFS_IOC_FSBULKSTAT_32 \
  77. _IOWR('X', 101, struct compat_xfs_fsop_bulkreq)
  78. #define XFS_IOC_FSBULKSTAT_SINGLE_32 \
  79. _IOWR('X', 102, struct compat_xfs_fsop_bulkreq)
  80. #define XFS_IOC_FSINUMBERS_32 \
  81. _IOWR('X', 103, struct compat_xfs_fsop_bulkreq)
  82. typedef struct compat_xfs_fsop_handlereq {
  83. __u32 fd; /* fd for FD_TO_HANDLE */
  84. compat_uptr_t path; /* user pathname */
  85. __u32 oflags; /* open flags */
  86. compat_uptr_t ihandle; /* user supplied handle */
  87. __u32 ihandlen; /* user supplied length */
  88. compat_uptr_t ohandle; /* user buffer for handle */
  89. compat_uptr_t ohandlen; /* user buffer length */
  90. } compat_xfs_fsop_handlereq_t;
  91. #define XFS_IOC_PATH_TO_FSHANDLE_32 \
  92. _IOWR('X', 104, struct compat_xfs_fsop_handlereq)
  93. #define XFS_IOC_PATH_TO_HANDLE_32 \
  94. _IOWR('X', 105, struct compat_xfs_fsop_handlereq)
  95. #define XFS_IOC_FD_TO_HANDLE_32 \
  96. _IOWR('X', 106, struct compat_xfs_fsop_handlereq)
  97. #define XFS_IOC_OPEN_BY_HANDLE_32 \
  98. _IOWR('X', 107, struct compat_xfs_fsop_handlereq)
  99. #define XFS_IOC_READLINK_BY_HANDLE_32 \
  100. _IOWR('X', 108, struct compat_xfs_fsop_handlereq)
  101. /* The bstat field in the swapext struct needs translation */
  102. typedef struct compat_xfs_swapext {
  103. __int64_t sx_version; /* version */
  104. __int64_t sx_fdtarget; /* fd of target file */
  105. __int64_t sx_fdtmp; /* fd of tmp file */
  106. xfs_off_t sx_offset; /* offset into file */
  107. xfs_off_t sx_length; /* leng from offset */
  108. char sx_pad[16]; /* pad space, unused */
  109. compat_xfs_bstat_t sx_stat; /* stat of target b4 copy */
  110. } __compat_packed compat_xfs_swapext_t;
  111. #define XFS_IOC_SWAPEXT_32 _IOWR('X', 109, struct compat_xfs_swapext)
  112. #ifdef BROKEN_X86_ALIGNMENT
  113. /* on ia32 l_start is on a 32-bit boundary */
  114. typedef struct compat_xfs_flock64 {
  115. __s16 l_type;
  116. __s16 l_whence;
  117. __s64 l_start __attribute__((packed));
  118. /* len == 0 means until end of file */
  119. __s64 l_len __attribute__((packed));
  120. __s32 l_sysid;
  121. __u32 l_pid;
  122. __s32 l_pad[4]; /* reserve area */
  123. } compat_xfs_flock64_t;
  124. #define XFS_IOC_ALLOCSP_32 _IOW('X', 10, struct compat_xfs_flock64)
  125. #define XFS_IOC_FREESP_32 _IOW('X', 11, struct compat_xfs_flock64)
  126. #define XFS_IOC_ALLOCSP64_32 _IOW('X', 36, struct compat_xfs_flock64)
  127. #define XFS_IOC_FREESP64_32 _IOW('X', 37, struct compat_xfs_flock64)
  128. #define XFS_IOC_RESVSP_32 _IOW('X', 40, struct compat_xfs_flock64)
  129. #define XFS_IOC_UNRESVSP_32 _IOW('X', 41, struct compat_xfs_flock64)
  130. #define XFS_IOC_RESVSP64_32 _IOW('X', 42, struct compat_xfs_flock64)
  131. #define XFS_IOC_UNRESVSP64_32 _IOW('X', 43, struct compat_xfs_flock64)
  132. typedef struct compat_xfs_fsop_geom_v1 {
  133. __u32 blocksize; /* filesystem (data) block size */
  134. __u32 rtextsize; /* realtime extent size */
  135. __u32 agblocks; /* fsblocks in an AG */
  136. __u32 agcount; /* number of allocation groups */
  137. __u32 logblocks; /* fsblocks in the log */
  138. __u32 sectsize; /* (data) sector size, bytes */
  139. __u32 inodesize; /* inode size in bytes */
  140. __u32 imaxpct; /* max allowed inode space(%) */
  141. __u64 datablocks; /* fsblocks in data subvolume */
  142. __u64 rtblocks; /* fsblocks in realtime subvol */
  143. __u64 rtextents; /* rt extents in realtime subvol*/
  144. __u64 logstart; /* starting fsblock of the log */
  145. unsigned char uuid[16]; /* unique id of the filesystem */
  146. __u32 sunit; /* stripe unit, fsblocks */
  147. __u32 swidth; /* stripe width, fsblocks */
  148. __s32 version; /* structure version */
  149. __u32 flags; /* superblock version flags */
  150. __u32 logsectsize; /* log sector size, bytes */
  151. __u32 rtsectsize; /* realtime sector size, bytes */
  152. __u32 dirblocksize; /* directory block size, bytes */
  153. } __attribute__((packed)) compat_xfs_fsop_geom_v1_t;
  154. #define XFS_IOC_FSGEOMETRY_V1_32 \
  155. _IOR('X', 100, struct compat_xfs_fsop_geom_v1)
  156. typedef struct compat_xfs_inogrp {
  157. __u64 xi_startino; /* starting inode number */
  158. __s32 xi_alloccount; /* # bits set in allocmask */
  159. __u64 xi_allocmask; /* mask of allocated inodes */
  160. } __attribute__((packed)) compat_xfs_inogrp_t;
  161. #endif /* BROKEN_X86_ALIGNMENT */
  162. #endif /* __XFS_IOCTL32_H__ */