21 #include <linux/slab.h>
22 #include <asm/uaccess.h>
46 #define _NATIVE_IOC(cmd, type) \
47 _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
49 #ifdef BROKEN_X86_ALIGNMENT
51 xfs_compat_flock64_copyin(
53 compat_xfs_flock64_t __user *arg32)
67 xfs_compat_ioc_fsgeometry_v1(
69 compat_xfs_fsop_geom_v1_t __user *arg32)
78 if (
copy_to_user(arg32, &fsgeo,
sizeof(
struct compat_xfs_fsop_geom_v1)))
84 xfs_compat_growfs_data_copyin(
86 compat_xfs_growfs_data_t __user *arg32)
95 xfs_compat_growfs_rt_copyin(
97 compat_xfs_growfs_rt_t __user *arg32)
107 void __user *ubuffer,
112 compat_xfs_inogrp_t
__user *p32 = ubuffer;
115 for (i = 0; i <
count; i++) {
116 if (
put_user(buffer[i].xi_startino, &p32[i].xi_startino) ||
117 put_user(buffer[i].xi_alloccount, &p32[i].xi_alloccount) ||
118 put_user(buffer[i].xi_allocmask, &p32[i].xi_allocmask))
121 *written = count *
sizeof(*p32);
126 #define xfs_inumbers_fmt_compat xfs_inumbers_fmt
136 if (
get_user(sec32, &bstime32->tv_sec) ||
184 if (
put_user(sec32, &p32->tv_sec) ||
193 void __user *ubuffer,
200 if (ubsize <
sizeof(*p32))
219 put_user(buffer->bs_projid, &p32->bs_projid) ||
226 *ubused =
sizeof(*p32);
264 if (XFS_FORCED_SHUTDOWN(mp))
269 bulkreq.
lastip = compat_ptr(addr);
273 bulkreq.
ubuffer = compat_ptr(addr);
276 bulkreq.
ocount = compat_ptr(addr);
281 if ((count = bulkreq.
icount) <= 0)
326 hreq->
fd = hreq32.
fd;
327 hreq->
path = compat_ptr(hreq32.
path);
339 struct file *parfilp,
348 struct file *parfilp,
373 return PTR_ERR(dentry);
382 al_hreq.
flags, cursor);
398 struct file *parfilp,
405 unsigned int i,
size;
420 return PTR_ERR(dentry);
429 error = PTR_ERR(ops);
438 for (i = 0; i < am_hreq.
opcount; i++) {
440 compat_ptr(ops[i].am_attrname),
442 if (ops[i].am_error == 0 || ops[i].am_error ==
MAXNAMELEN)
444 if (ops[i].am_error < 0)
447 switch (ops[i].am_opcode) {
451 compat_ptr(ops[i].am_attrvalue),
452 &ops[i].am_length, ops[i].am_flags);
460 compat_ptr(ops[i].am_attrvalue),
461 ops[i].am_length, ops[i].am_flags);
491 struct file *parfilp,
507 return PTR_ERR(dentry);
534 struct xfs_inode *
ip = XFS_I(inode);
535 struct xfs_mount *mp = ip->i_mount;
543 trace_xfs_file_compat_ioctl(ip);
564 #ifndef BROKEN_X86_ALIGNMENT
580 case XFS_IOC_ALLOCSP_32:
581 case XFS_IOC_FREESP_32:
582 case XFS_IOC_ALLOCSP64_32:
583 case XFS_IOC_FREESP64_32:
584 case XFS_IOC_RESVSP_32:
585 case XFS_IOC_UNRESVSP_32:
586 case XFS_IOC_RESVSP64_32:
587 case XFS_IOC_UNRESVSP64_32:
588 case XFS_IOC_ZERO_RANGE_32: {
591 if (xfs_compat_flock64_copyin(&bf, arg))
596 case XFS_IOC_FSGEOMETRY_V1_32:
597 return xfs_compat_ioc_fsgeometry_v1(mp, arg);
598 case XFS_IOC_FSGROWFSDATA_32: {
601 if (xfs_compat_growfs_data_copyin(&in, arg))
610 case XFS_IOC_FSGROWFSRT_32: {
613 if (xfs_compat_growfs_rt_copyin(&in, arg))