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