Linux Audio

Check our new training course

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