162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2004-2005 Silicon Graphics, Inc. 462306a36Sopenharmony_ci * All Rights Reserved. 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci#ifndef __XFS_IOCTL32_H__ 762306a36Sopenharmony_ci#define __XFS_IOCTL32_H__ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/compat.h> 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci/* 1262306a36Sopenharmony_ci * on 32-bit arches, ioctl argument structures may have different sizes 1362306a36Sopenharmony_ci * and/or alignment. We define compat structures which match the 1462306a36Sopenharmony_ci * 32-bit sizes/alignments here, and their associated ioctl numbers. 1562306a36Sopenharmony_ci * 1662306a36Sopenharmony_ci * xfs_ioctl32.c contains routines to copy these structures in and out. 1762306a36Sopenharmony_ci */ 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/* stock kernel-level ioctls we support */ 2062306a36Sopenharmony_ci#define XFS_IOC_GETVERSION_32 FS_IOC32_GETVERSION 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci/* 2362306a36Sopenharmony_ci * On intel, even if sizes match, alignment and/or padding may differ. 2462306a36Sopenharmony_ci */ 2562306a36Sopenharmony_ci#if defined(CONFIG_IA64) || defined(CONFIG_X86_64) 2662306a36Sopenharmony_ci#define BROKEN_X86_ALIGNMENT 2762306a36Sopenharmony_ci#define __compat_packed __attribute__((packed)) 2862306a36Sopenharmony_ci#else 2962306a36Sopenharmony_ci#define __compat_packed 3062306a36Sopenharmony_ci#endif 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_citypedef struct compat_xfs_bstime { 3362306a36Sopenharmony_ci old_time32_t tv_sec; /* seconds */ 3462306a36Sopenharmony_ci __s32 tv_nsec; /* and nanoseconds */ 3562306a36Sopenharmony_ci} compat_xfs_bstime_t; 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_cistruct compat_xfs_bstat { 3862306a36Sopenharmony_ci __u64 bs_ino; /* inode number */ 3962306a36Sopenharmony_ci __u16 bs_mode; /* type and mode */ 4062306a36Sopenharmony_ci __u16 bs_nlink; /* number of links */ 4162306a36Sopenharmony_ci __u32 bs_uid; /* user id */ 4262306a36Sopenharmony_ci __u32 bs_gid; /* group id */ 4362306a36Sopenharmony_ci __u32 bs_rdev; /* device value */ 4462306a36Sopenharmony_ci __s32 bs_blksize; /* block size */ 4562306a36Sopenharmony_ci __s64 bs_size; /* file size */ 4662306a36Sopenharmony_ci compat_xfs_bstime_t bs_atime; /* access time */ 4762306a36Sopenharmony_ci compat_xfs_bstime_t bs_mtime; /* modify time */ 4862306a36Sopenharmony_ci compat_xfs_bstime_t bs_ctime; /* inode change time */ 4962306a36Sopenharmony_ci int64_t bs_blocks; /* number of blocks */ 5062306a36Sopenharmony_ci __u32 bs_xflags; /* extended flags */ 5162306a36Sopenharmony_ci __s32 bs_extsize; /* extent size */ 5262306a36Sopenharmony_ci __s32 bs_extents; /* number of extents */ 5362306a36Sopenharmony_ci __u32 bs_gen; /* generation count */ 5462306a36Sopenharmony_ci __u16 bs_projid_lo; /* lower part of project id */ 5562306a36Sopenharmony_ci#define bs_projid bs_projid_lo /* (previously just bs_projid) */ 5662306a36Sopenharmony_ci __u16 bs_forkoff; /* inode fork offset in bytes */ 5762306a36Sopenharmony_ci __u16 bs_projid_hi; /* high part of project id */ 5862306a36Sopenharmony_ci unsigned char bs_pad[10]; /* pad space, unused */ 5962306a36Sopenharmony_ci __u32 bs_dmevmask; /* DMIG event mask */ 6062306a36Sopenharmony_ci __u16 bs_dmstate; /* DMIG state info */ 6162306a36Sopenharmony_ci __u16 bs_aextents; /* attribute number of extents */ 6262306a36Sopenharmony_ci} __compat_packed; 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_cistruct compat_xfs_fsop_bulkreq { 6562306a36Sopenharmony_ci compat_uptr_t lastip; /* last inode # pointer */ 6662306a36Sopenharmony_ci __s32 icount; /* count of entries in buffer */ 6762306a36Sopenharmony_ci compat_uptr_t ubuffer; /* user buffer for inode desc. */ 6862306a36Sopenharmony_ci compat_uptr_t ocount; /* output count pointer */ 6962306a36Sopenharmony_ci}; 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci#define XFS_IOC_FSBULKSTAT_32 \ 7262306a36Sopenharmony_ci _IOWR('X', 101, struct compat_xfs_fsop_bulkreq) 7362306a36Sopenharmony_ci#define XFS_IOC_FSBULKSTAT_SINGLE_32 \ 7462306a36Sopenharmony_ci _IOWR('X', 102, struct compat_xfs_fsop_bulkreq) 7562306a36Sopenharmony_ci#define XFS_IOC_FSINUMBERS_32 \ 7662306a36Sopenharmony_ci _IOWR('X', 103, struct compat_xfs_fsop_bulkreq) 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_citypedef struct compat_xfs_fsop_handlereq { 7962306a36Sopenharmony_ci __u32 fd; /* fd for FD_TO_HANDLE */ 8062306a36Sopenharmony_ci compat_uptr_t path; /* user pathname */ 8162306a36Sopenharmony_ci __u32 oflags; /* open flags */ 8262306a36Sopenharmony_ci compat_uptr_t ihandle; /* user supplied handle */ 8362306a36Sopenharmony_ci __u32 ihandlen; /* user supplied length */ 8462306a36Sopenharmony_ci compat_uptr_t ohandle; /* user buffer for handle */ 8562306a36Sopenharmony_ci compat_uptr_t ohandlen; /* user buffer length */ 8662306a36Sopenharmony_ci} compat_xfs_fsop_handlereq_t; 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define XFS_IOC_PATH_TO_FSHANDLE_32 \ 8962306a36Sopenharmony_ci _IOWR('X', 104, struct compat_xfs_fsop_handlereq) 9062306a36Sopenharmony_ci#define XFS_IOC_PATH_TO_HANDLE_32 \ 9162306a36Sopenharmony_ci _IOWR('X', 105, struct compat_xfs_fsop_handlereq) 9262306a36Sopenharmony_ci#define XFS_IOC_FD_TO_HANDLE_32 \ 9362306a36Sopenharmony_ci _IOWR('X', 106, struct compat_xfs_fsop_handlereq) 9462306a36Sopenharmony_ci#define XFS_IOC_OPEN_BY_HANDLE_32 \ 9562306a36Sopenharmony_ci _IOWR('X', 107, struct compat_xfs_fsop_handlereq) 9662306a36Sopenharmony_ci#define XFS_IOC_READLINK_BY_HANDLE_32 \ 9762306a36Sopenharmony_ci _IOWR('X', 108, struct compat_xfs_fsop_handlereq) 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci/* The bstat field in the swapext struct needs translation */ 10062306a36Sopenharmony_cistruct compat_xfs_swapext { 10162306a36Sopenharmony_ci int64_t sx_version; /* version */ 10262306a36Sopenharmony_ci int64_t sx_fdtarget; /* fd of target file */ 10362306a36Sopenharmony_ci int64_t sx_fdtmp; /* fd of tmp file */ 10462306a36Sopenharmony_ci xfs_off_t sx_offset; /* offset into file */ 10562306a36Sopenharmony_ci xfs_off_t sx_length; /* leng from offset */ 10662306a36Sopenharmony_ci char sx_pad[16]; /* pad space, unused */ 10762306a36Sopenharmony_ci struct compat_xfs_bstat sx_stat; /* stat of target b4 copy */ 10862306a36Sopenharmony_ci} __compat_packed; 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define XFS_IOC_SWAPEXT_32 _IOWR('X', 109, struct compat_xfs_swapext) 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_citypedef struct compat_xfs_fsop_attrlist_handlereq { 11362306a36Sopenharmony_ci struct compat_xfs_fsop_handlereq hreq; /* handle interface structure */ 11462306a36Sopenharmony_ci struct xfs_attrlist_cursor pos; /* opaque cookie, list offset */ 11562306a36Sopenharmony_ci __u32 flags; /* which namespace to use */ 11662306a36Sopenharmony_ci __u32 buflen; /* length of buffer supplied */ 11762306a36Sopenharmony_ci compat_uptr_t buffer; /* returned names */ 11862306a36Sopenharmony_ci} __compat_packed compat_xfs_fsop_attrlist_handlereq_t; 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci/* Note: actually this is read/write */ 12162306a36Sopenharmony_ci#define XFS_IOC_ATTRLIST_BY_HANDLE_32 \ 12262306a36Sopenharmony_ci _IOW('X', 122, struct compat_xfs_fsop_attrlist_handlereq) 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci/* am_opcodes defined in xfs_fs.h */ 12562306a36Sopenharmony_citypedef struct compat_xfs_attr_multiop { 12662306a36Sopenharmony_ci __u32 am_opcode; 12762306a36Sopenharmony_ci __s32 am_error; 12862306a36Sopenharmony_ci compat_uptr_t am_attrname; 12962306a36Sopenharmony_ci compat_uptr_t am_attrvalue; 13062306a36Sopenharmony_ci __u32 am_length; 13162306a36Sopenharmony_ci __u32 am_flags; 13262306a36Sopenharmony_ci} compat_xfs_attr_multiop_t; 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_citypedef struct compat_xfs_fsop_attrmulti_handlereq { 13562306a36Sopenharmony_ci struct compat_xfs_fsop_handlereq hreq; /* handle interface structure */ 13662306a36Sopenharmony_ci __u32 opcount;/* count of following multiop */ 13762306a36Sopenharmony_ci /* ptr to compat_xfs_attr_multiop */ 13862306a36Sopenharmony_ci compat_uptr_t ops; /* attr_multi data */ 13962306a36Sopenharmony_ci} compat_xfs_fsop_attrmulti_handlereq_t; 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci#define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \ 14262306a36Sopenharmony_ci _IOW('X', 123, struct compat_xfs_fsop_attrmulti_handlereq) 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci#ifdef BROKEN_X86_ALIGNMENT 14562306a36Sopenharmony_citypedef struct compat_xfs_fsop_geom_v1 { 14662306a36Sopenharmony_ci __u32 blocksize; /* filesystem (data) block size */ 14762306a36Sopenharmony_ci __u32 rtextsize; /* realtime extent size */ 14862306a36Sopenharmony_ci __u32 agblocks; /* fsblocks in an AG */ 14962306a36Sopenharmony_ci __u32 agcount; /* number of allocation groups */ 15062306a36Sopenharmony_ci __u32 logblocks; /* fsblocks in the log */ 15162306a36Sopenharmony_ci __u32 sectsize; /* (data) sector size, bytes */ 15262306a36Sopenharmony_ci __u32 inodesize; /* inode size in bytes */ 15362306a36Sopenharmony_ci __u32 imaxpct; /* max allowed inode space(%) */ 15462306a36Sopenharmony_ci __u64 datablocks; /* fsblocks in data subvolume */ 15562306a36Sopenharmony_ci __u64 rtblocks; /* fsblocks in realtime subvol */ 15662306a36Sopenharmony_ci __u64 rtextents; /* rt extents in realtime subvol*/ 15762306a36Sopenharmony_ci __u64 logstart; /* starting fsblock of the log */ 15862306a36Sopenharmony_ci unsigned char uuid[16]; /* unique id of the filesystem */ 15962306a36Sopenharmony_ci __u32 sunit; /* stripe unit, fsblocks */ 16062306a36Sopenharmony_ci __u32 swidth; /* stripe width, fsblocks */ 16162306a36Sopenharmony_ci __s32 version; /* structure version */ 16262306a36Sopenharmony_ci __u32 flags; /* superblock version flags */ 16362306a36Sopenharmony_ci __u32 logsectsize; /* log sector size, bytes */ 16462306a36Sopenharmony_ci __u32 rtsectsize; /* realtime sector size, bytes */ 16562306a36Sopenharmony_ci __u32 dirblocksize; /* directory block size, bytes */ 16662306a36Sopenharmony_ci} __attribute__((packed)) compat_xfs_fsop_geom_v1_t; 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci#define XFS_IOC_FSGEOMETRY_V1_32 \ 16962306a36Sopenharmony_ci _IOR('X', 100, struct compat_xfs_fsop_geom_v1) 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_cistruct compat_xfs_inogrp { 17262306a36Sopenharmony_ci __u64 xi_startino; /* starting inode number */ 17362306a36Sopenharmony_ci __s32 xi_alloccount; /* # bits set in allocmask */ 17462306a36Sopenharmony_ci __u64 xi_allocmask; /* mask of allocated inodes */ 17562306a36Sopenharmony_ci} __attribute__((packed)); 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci/* These growfs input structures have padding on the end, so must translate */ 17862306a36Sopenharmony_citypedef struct compat_xfs_growfs_data { 17962306a36Sopenharmony_ci __u64 newblocks; /* new data subvol size, fsblocks */ 18062306a36Sopenharmony_ci __u32 imaxpct; /* new inode space percentage limit */ 18162306a36Sopenharmony_ci} __attribute__((packed)) compat_xfs_growfs_data_t; 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_citypedef struct compat_xfs_growfs_rt { 18462306a36Sopenharmony_ci __u64 newblocks; /* new realtime size, fsblocks */ 18562306a36Sopenharmony_ci __u32 extsize; /* new realtime extent size, fsblocks */ 18662306a36Sopenharmony_ci} __attribute__((packed)) compat_xfs_growfs_rt_t; 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci#define XFS_IOC_FSGROWFSDATA_32 _IOW('X', 110, struct compat_xfs_growfs_data) 18962306a36Sopenharmony_ci#define XFS_IOC_FSGROWFSRT_32 _IOW('X', 112, struct compat_xfs_growfs_rt) 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci#endif /* BROKEN_X86_ALIGNMENT */ 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci#endif /* __XFS_IOCTL32_H__ */ 194