blob: 94ce027e28e3df8edac1609318604b0d74877266 [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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/compat.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/ioctl.h>
Christoph Hellwig62e194e2009-01-19 02:03:03 +010020#include <linux/mount.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090021#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <asm/uaccess.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include "xfs.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "xfs_fs.h"
Dave Chinnera4fbe6a2013-10-23 10:51:50 +110025#include "xfs_format.h"
Dave Chinner239880e2013-10-23 10:50:10 +110026#include "xfs_log_format.h"
27#include "xfs_trans_resv.h"
Michal Marekfaa63e92007-07-11 11:10:19 +100028#include "xfs_sb.h"
29#include "xfs_ag.h"
Michal Marekfaa63e92007-07-11 11:10:19 +100030#include "xfs_mount.h"
Michal Marekfaa63e92007-07-11 11:10:19 +100031#include "xfs_inode.h"
32#include "xfs_itable.h"
33#include "xfs_error.h"
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060034#include "xfs_fsops.h"
sandeen@sandeen.net471d5912008-11-25 21:20:10 -060035#include "xfs_alloc.h"
36#include "xfs_rtalloc.h"
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -060037#include "xfs_attr.h"
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060038#include "xfs_ioctl.h"
David Chinnera8272ce2007-11-23 16:28:09 +110039#include "xfs_ioctl32.h"
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000040#include "xfs_trace.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Eric Sandeen526c4202005-09-05 08:25:06 +100042#define _NATIVE_IOC(cmd, type) \
43 _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
44
sandeen@sandeen.netffae2632008-11-25 21:20:07 -060045#ifdef BROKEN_X86_ALIGNMENT
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060046STATIC int
47xfs_compat_flock64_copyin(
48 xfs_flock64_t *bf,
49 compat_xfs_flock64_t __user *arg32)
Eric Sandeen526c4202005-09-05 08:25:06 +100050{
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060051 if (get_user(bf->l_type, &arg32->l_type) ||
52 get_user(bf->l_whence, &arg32->l_whence) ||
53 get_user(bf->l_start, &arg32->l_start) ||
54 get_user(bf->l_len, &arg32->l_len) ||
55 get_user(bf->l_sysid, &arg32->l_sysid) ||
56 get_user(bf->l_pid, &arg32->l_pid) ||
57 copy_from_user(bf->l_pad, &arg32->l_pad, 4*sizeof(u32)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +100058 return -EFAULT;
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060059 return 0;
Eric Sandeen526c4202005-09-05 08:25:06 +100060}
61
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060062STATIC int
63xfs_compat_ioc_fsgeometry_v1(
64 struct xfs_mount *mp,
65 compat_xfs_fsop_geom_v1_t __user *arg32)
Michal Marek547e00c2007-07-11 11:09:57 +100066{
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060067 xfs_fsop_geom_t fsgeo;
68 int error;
Michal Marek547e00c2007-07-11 11:09:57 +100069
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060070 error = xfs_fs_geometry(mp, &fsgeo, 3);
71 if (error)
Dave Chinner24513372014-06-25 14:58:08 +100072 return error;
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060073 /* The 32-bit variant simply has some padding at the end */
74 if (copy_to_user(arg32, &fsgeo, sizeof(struct compat_xfs_fsop_geom_v1)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +100075 return -EFAULT;
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060076 return 0;
Michal Marek547e00c2007-07-11 11:09:57 +100077}
78
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -060079STATIC int
sandeen@sandeen.net471d5912008-11-25 21:20:10 -060080xfs_compat_growfs_data_copyin(
81 struct xfs_growfs_data *in,
82 compat_xfs_growfs_data_t __user *arg32)
83{
84 if (get_user(in->newblocks, &arg32->newblocks) ||
85 get_user(in->imaxpct, &arg32->imaxpct))
Eric Sandeenb474c7a2014-06-22 15:04:54 +100086 return -EFAULT;
sandeen@sandeen.net471d5912008-11-25 21:20:10 -060087 return 0;
88}
89
90STATIC int
91xfs_compat_growfs_rt_copyin(
92 struct xfs_growfs_rt *in,
93 compat_xfs_growfs_rt_t __user *arg32)
94{
95 if (get_user(in->newblocks, &arg32->newblocks) ||
96 get_user(in->extsize, &arg32->extsize))
Eric Sandeenb474c7a2014-06-22 15:04:54 +100097 return -EFAULT;
sandeen@sandeen.net471d5912008-11-25 21:20:10 -060098 return 0;
99}
100
101STATIC int
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600102xfs_inumbers_fmt_compat(
103 void __user *ubuffer,
Jie Liu549fa002014-07-24 12:11:47 +1000104 const struct xfs_inogrp *buffer,
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600105 long count,
106 long *written)
Michal Marekfaa63e92007-07-11 11:10:19 +1000107{
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600108 compat_xfs_inogrp_t __user *p32 = ubuffer;
109 long i;
Michal Marekfaa63e92007-07-11 11:10:19 +1000110
111 for (i = 0; i < count; i++) {
112 if (put_user(buffer[i].xi_startino, &p32[i].xi_startino) ||
113 put_user(buffer[i].xi_alloccount, &p32[i].xi_alloccount) ||
114 put_user(buffer[i].xi_allocmask, &p32[i].xi_allocmask))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000115 return -EFAULT;
Michal Marekfaa63e92007-07-11 11:10:19 +1000116 }
117 *written = count * sizeof(*p32);
118 return 0;
119}
120
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121#else
Michal Marekfaa63e92007-07-11 11:10:19 +1000122#define xfs_inumbers_fmt_compat xfs_inumbers_fmt
sandeen@sandeen.nete5d412f2008-11-25 21:20:17 -0600123#endif /* BROKEN_X86_ALIGNMENT */
Michal Marekfaa63e92007-07-11 11:10:19 +1000124
sandeen@sandeen.nete94fc4a2008-11-25 21:20:09 -0600125STATIC int
126xfs_ioctl32_bstime_copyin(
127 xfs_bstime_t *bstime,
128 compat_xfs_bstime_t __user *bstime32)
129{
130 compat_time_t sec32; /* tv_sec differs on 64 vs. 32 */
131
132 if (get_user(sec32, &bstime32->tv_sec) ||
133 get_user(bstime->tv_nsec, &bstime32->tv_nsec))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000134 return -EFAULT;
sandeen@sandeen.nete94fc4a2008-11-25 21:20:09 -0600135 bstime->tv_sec = sec32;
136 return 0;
137}
138
139/* xfs_bstat_t has differing alignment on intel, & bstime_t sizes everywhere */
140STATIC int
141xfs_ioctl32_bstat_copyin(
142 xfs_bstat_t *bstat,
143 compat_xfs_bstat_t __user *bstat32)
144{
145 if (get_user(bstat->bs_ino, &bstat32->bs_ino) ||
146 get_user(bstat->bs_mode, &bstat32->bs_mode) ||
147 get_user(bstat->bs_nlink, &bstat32->bs_nlink) ||
148 get_user(bstat->bs_uid, &bstat32->bs_uid) ||
149 get_user(bstat->bs_gid, &bstat32->bs_gid) ||
150 get_user(bstat->bs_rdev, &bstat32->bs_rdev) ||
151 get_user(bstat->bs_blksize, &bstat32->bs_blksize) ||
152 get_user(bstat->bs_size, &bstat32->bs_size) ||
153 xfs_ioctl32_bstime_copyin(&bstat->bs_atime, &bstat32->bs_atime) ||
154 xfs_ioctl32_bstime_copyin(&bstat->bs_mtime, &bstat32->bs_mtime) ||
155 xfs_ioctl32_bstime_copyin(&bstat->bs_ctime, &bstat32->bs_ctime) ||
156 get_user(bstat->bs_blocks, &bstat32->bs_size) ||
157 get_user(bstat->bs_xflags, &bstat32->bs_size) ||
158 get_user(bstat->bs_extsize, &bstat32->bs_extsize) ||
159 get_user(bstat->bs_extents, &bstat32->bs_extents) ||
160 get_user(bstat->bs_gen, &bstat32->bs_gen) ||
Arkadiusz Mi?kiewicz67430992010-09-26 06:10:18 +0000161 get_user(bstat->bs_projid_lo, &bstat32->bs_projid_lo) ||
162 get_user(bstat->bs_projid_hi, &bstat32->bs_projid_hi) ||
Dave Chinnerb1d6cc02014-10-02 09:17:58 +1000163 get_user(bstat->bs_forkoff, &bstat32->bs_forkoff) ||
sandeen@sandeen.nete94fc4a2008-11-25 21:20:09 -0600164 get_user(bstat->bs_dmevmask, &bstat32->bs_dmevmask) ||
165 get_user(bstat->bs_dmstate, &bstat32->bs_dmstate) ||
166 get_user(bstat->bs_aextents, &bstat32->bs_aextents))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000167 return -EFAULT;
sandeen@sandeen.nete94fc4a2008-11-25 21:20:09 -0600168 return 0;
169}
170
Michal Marekfaa63e92007-07-11 11:10:19 +1000171/* XFS_IOC_FSBULKSTAT and friends */
172
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600173STATIC int
174xfs_bstime_store_compat(
175 compat_xfs_bstime_t __user *p32,
176 const xfs_bstime_t *p)
Michal Marekfaa63e92007-07-11 11:10:19 +1000177{
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600178 __s32 sec32;
Michal Marekfaa63e92007-07-11 11:10:19 +1000179
180 sec32 = p->tv_sec;
181 if (put_user(sec32, &p32->tv_sec) ||
182 put_user(p->tv_nsec, &p32->tv_nsec))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000183 return -EFAULT;
Michal Marekfaa63e92007-07-11 11:10:19 +1000184 return 0;
185}
186
sandeen@sandeen.net65fbaf22008-11-25 21:20:12 -0600187/* Return 0 on success or positive error (to xfs_bulkstat()) */
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600188STATIC int
189xfs_bulkstat_one_fmt_compat(
Michal Marekfaa63e92007-07-11 11:10:19 +1000190 void __user *ubuffer,
sandeen@sandeen.net65fbaf22008-11-25 21:20:12 -0600191 int ubsize,
192 int *ubused,
Michal Marekfaa63e92007-07-11 11:10:19 +1000193 const xfs_bstat_t *buffer)
194{
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600195 compat_xfs_bstat_t __user *p32 = ubuffer;
Michal Marekfaa63e92007-07-11 11:10:19 +1000196
sandeen@sandeen.net65fbaf22008-11-25 21:20:12 -0600197 if (ubsize < sizeof(*p32))
Dave Chinner24513372014-06-25 14:58:08 +1000198 return -ENOMEM;
sandeen@sandeen.net65fbaf22008-11-25 21:20:12 -0600199
200 if (put_user(buffer->bs_ino, &p32->bs_ino) ||
201 put_user(buffer->bs_mode, &p32->bs_mode) ||
202 put_user(buffer->bs_nlink, &p32->bs_nlink) ||
203 put_user(buffer->bs_uid, &p32->bs_uid) ||
204 put_user(buffer->bs_gid, &p32->bs_gid) ||
205 put_user(buffer->bs_rdev, &p32->bs_rdev) ||
206 put_user(buffer->bs_blksize, &p32->bs_blksize) ||
207 put_user(buffer->bs_size, &p32->bs_size) ||
Michal Marekfaa63e92007-07-11 11:10:19 +1000208 xfs_bstime_store_compat(&p32->bs_atime, &buffer->bs_atime) ||
209 xfs_bstime_store_compat(&p32->bs_mtime, &buffer->bs_mtime) ||
210 xfs_bstime_store_compat(&p32->bs_ctime, &buffer->bs_ctime) ||
sandeen@sandeen.net65fbaf22008-11-25 21:20:12 -0600211 put_user(buffer->bs_blocks, &p32->bs_blocks) ||
212 put_user(buffer->bs_xflags, &p32->bs_xflags) ||
213 put_user(buffer->bs_extsize, &p32->bs_extsize) ||
214 put_user(buffer->bs_extents, &p32->bs_extents) ||
215 put_user(buffer->bs_gen, &p32->bs_gen) ||
216 put_user(buffer->bs_projid, &p32->bs_projid) ||
Arkadiusz Mi?kiewicz67430992010-09-26 06:10:18 +0000217 put_user(buffer->bs_projid_hi, &p32->bs_projid_hi) ||
Dave Chinnerb1d6cc02014-10-02 09:17:58 +1000218 put_user(buffer->bs_forkoff, &p32->bs_forkoff) ||
sandeen@sandeen.net65fbaf22008-11-25 21:20:12 -0600219 put_user(buffer->bs_dmevmask, &p32->bs_dmevmask) ||
220 put_user(buffer->bs_dmstate, &p32->bs_dmstate) ||
Michal Marekfaa63e92007-07-11 11:10:19 +1000221 put_user(buffer->bs_aextents, &p32->bs_aextents))
Dave Chinner24513372014-06-25 14:58:08 +1000222 return -EFAULT;
sandeen@sandeen.net65fbaf22008-11-25 21:20:12 -0600223 if (ubused)
224 *ubused = sizeof(*p32);
225 return 0;
Michal Marekfaa63e92007-07-11 11:10:19 +1000226}
227
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -0600228STATIC int
229xfs_bulkstat_one_compat(
230 xfs_mount_t *mp, /* mount point for filesystem */
231 xfs_ino_t ino, /* inode number to get data for */
232 void __user *buffer, /* buffer to place output in */
233 int ubsize, /* size of buffer */
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -0600234 int *ubused, /* bytes used by me */
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -0600235 int *stat) /* BULKSTAT_RV_... */
236{
237 return xfs_bulkstat_one_int(mp, ino, buffer, ubsize,
Dave Chinner7b6259e2010-06-24 11:35:17 +1000238 xfs_bulkstat_one_fmt_compat,
Christoph Hellwig7dce11d2010-06-23 18:11:11 +1000239 ubused, stat);
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -0600240}
241
Michal Marekfaa63e92007-07-11 11:10:19 +1000242/* copied from xfs_ioctl.c */
243STATIC int
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -0600244xfs_compat_ioc_bulkstat(
245 xfs_mount_t *mp,
246 unsigned int cmd,
247 compat_xfs_fsop_bulkreq_t __user *p32)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 u32 addr;
Michal Marekfaa63e92007-07-11 11:10:19 +1000250 xfs_fsop_bulkreq_t bulkreq;
251 int count; /* # of records returned */
252 xfs_ino_t inlast; /* last inode number */
253 int done;
254 int error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255
Michal Marekfaa63e92007-07-11 11:10:19 +1000256 /* done = 1 if there are more stats to get and if bulkstat */
257 /* should be called again (unused here, but used in dmapi) */
258
259 if (!capable(CAP_SYS_ADMIN))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000260 return -EPERM;
Michal Marekfaa63e92007-07-11 11:10:19 +1000261
262 if (XFS_FORCED_SHUTDOWN(mp))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000263 return -EIO;
Michal Marekfaa63e92007-07-11 11:10:19 +1000264
265 if (get_user(addr, &p32->lastip))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000266 return -EFAULT;
Michal Marekfaa63e92007-07-11 11:10:19 +1000267 bulkreq.lastip = compat_ptr(addr);
268 if (get_user(bulkreq.icount, &p32->icount) ||
269 get_user(addr, &p32->ubuffer))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000270 return -EFAULT;
Michal Marekfaa63e92007-07-11 11:10:19 +1000271 bulkreq.ubuffer = compat_ptr(addr);
272 if (get_user(addr, &p32->ocount))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000273 return -EFAULT;
Michal Marekfaa63e92007-07-11 11:10:19 +1000274 bulkreq.ocount = compat_ptr(addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275
Michal Marekfaa63e92007-07-11 11:10:19 +1000276 if (copy_from_user(&inlast, bulkreq.lastip, sizeof(__s64)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000277 return -EFAULT;
Michal Marekfaa63e92007-07-11 11:10:19 +1000278
279 if ((count = bulkreq.icount) <= 0)
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000280 return -EINVAL;
Michal Marekfaa63e92007-07-11 11:10:19 +1000281
Lachlan McIlroycd57e592007-11-23 16:30:32 +1100282 if (bulkreq.ubuffer == NULL)
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000283 return -EINVAL;
Lachlan McIlroycd57e592007-11-23 16:30:32 +1100284
sandeen@sandeen.netaf819d22008-11-25 21:20:13 -0600285 if (cmd == XFS_IOC_FSINUMBERS_32) {
Michal Marekfaa63e92007-07-11 11:10:19 +1000286 error = xfs_inumbers(mp, &inlast, &count,
287 bulkreq.ubuffer, xfs_inumbers_fmt_compat);
sandeen@sandeen.netaf819d22008-11-25 21:20:13 -0600288 } else if (cmd == XFS_IOC_FSBULKSTAT_SINGLE_32) {
289 int res;
290
291 error = xfs_bulkstat_one_compat(mp, inlast, bulkreq.ubuffer,
Dave Chinner8d2a5e62012-03-07 04:50:19 +0000292 sizeof(compat_xfs_bstat_t), NULL, &res);
sandeen@sandeen.netaf819d22008-11-25 21:20:13 -0600293 } else if (cmd == XFS_IOC_FSBULKSTAT_32) {
Michal Marekfaa63e92007-07-11 11:10:19 +1000294 error = xfs_bulkstat(mp, &inlast, &count,
Christoph Hellwig7dce11d2010-06-23 18:11:11 +1000295 xfs_bulkstat_one_compat, sizeof(compat_xfs_bstat_t),
296 bulkreq.ubuffer, &done);
sandeen@sandeen.netaf819d22008-11-25 21:20:13 -0600297 } else
Dave Chinner24513372014-06-25 14:58:08 +1000298 error = -EINVAL;
Michal Marekfaa63e92007-07-11 11:10:19 +1000299 if (error)
Dave Chinner24513372014-06-25 14:58:08 +1000300 return error;
Michal Marekfaa63e92007-07-11 11:10:19 +1000301
302 if (bulkreq.ocount != NULL) {
303 if (copy_to_user(bulkreq.lastip, &inlast,
304 sizeof(xfs_ino_t)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000305 return -EFAULT;
Michal Marekfaa63e92007-07-11 11:10:19 +1000306
307 if (copy_to_user(bulkreq.ocount, &count, sizeof(count)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000308 return -EFAULT;
Michal Marekfaa63e92007-07-11 11:10:19 +1000309 }
310
311 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312}
Michal Marekfaa63e92007-07-11 11:10:19 +1000313
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600314STATIC int
315xfs_compat_handlereq_copyin(
316 xfs_fsop_handlereq_t *hreq,
317 compat_xfs_fsop_handlereq_t __user *arg32)
Michal Marek1fa503d2007-07-11 11:10:09 +1000318{
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600319 compat_xfs_fsop_handlereq_t hreq32;
Michal Marek1fa503d2007-07-11 11:10:09 +1000320
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600321 if (copy_from_user(&hreq32, arg32, sizeof(compat_xfs_fsop_handlereq_t)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000322 return -EFAULT;
Michal Marek1fa503d2007-07-11 11:10:09 +1000323
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600324 hreq->fd = hreq32.fd;
325 hreq->path = compat_ptr(hreq32.path);
326 hreq->oflags = hreq32.oflags;
327 hreq->ihandle = compat_ptr(hreq32.ihandle);
328 hreq->ihandlen = hreq32.ihandlen;
329 hreq->ohandle = compat_ptr(hreq32.ohandle);
330 hreq->ohandlen = compat_ptr(hreq32.ohandlen);
331
332 return 0;
Michal Marek1fa503d2007-07-11 11:10:09 +1000333}
334
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100335STATIC struct dentry *
336xfs_compat_handlereq_to_dentry(
337 struct file *parfilp,
338 compat_xfs_fsop_handlereq_t *hreq)
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600339{
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100340 return xfs_handle_to_dentry(parfilp,
341 compat_ptr(hreq->ihandle), hreq->ihandlen);
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600342}
343
344STATIC int
345xfs_compat_attrlist_by_handle(
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100346 struct file *parfilp,
347 void __user *arg)
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600348{
349 int error;
350 attrlist_cursor_kern_t *cursor;
351 compat_xfs_fsop_attrlist_handlereq_t al_hreq;
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100352 struct dentry *dentry;
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600353 char *kbuf;
354
355 if (!capable(CAP_SYS_ADMIN))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000356 return -EPERM;
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600357 if (copy_from_user(&al_hreq, arg,
358 sizeof(compat_xfs_fsop_attrlist_handlereq_t)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000359 return -EFAULT;
Dan Carpenter31978b52013-10-31 21:00:10 +0300360 if (al_hreq.buflen < sizeof(struct attrlist) ||
361 al_hreq.buflen > XATTR_LIST_MAX)
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000362 return -EINVAL;
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600363
364 /*
365 * Reject flags, only allow namespaces.
366 */
367 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000368 return -EINVAL;
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600369
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100370 dentry = xfs_compat_handlereq_to_dentry(parfilp, &al_hreq.hreq);
371 if (IS_ERR(dentry))
372 return PTR_ERR(dentry);
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600373
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100374 error = -ENOMEM;
Dave Chinnerfdd3cce2013-09-02 20:53:00 +1000375 kbuf = kmem_zalloc_large(al_hreq.buflen, KM_SLEEP);
376 if (!kbuf)
377 goto out_dput;
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600378
379 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
Dave Chinner24513372014-06-25 14:58:08 +1000380 error = xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen,
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600381 al_hreq.flags, cursor);
382 if (error)
383 goto out_kfree;
384
385 if (copy_to_user(compat_ptr(al_hreq.buffer), kbuf, al_hreq.buflen))
386 error = -EFAULT;
387
Dave Chinnerfdd3cce2013-09-02 20:53:00 +1000388out_kfree:
389 kmem_free(kbuf);
390out_dput:
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100391 dput(dentry);
392 return error;
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600393}
394
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600395STATIC int
396xfs_compat_attrmulti_by_handle(
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100397 struct file *parfilp,
398 void __user *arg)
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600399{
400 int error;
401 compat_xfs_attr_multiop_t *ops;
402 compat_xfs_fsop_attrmulti_handlereq_t am_hreq;
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100403 struct dentry *dentry;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600404 unsigned int i, size;
Dave Chinnera9273ca2010-01-20 10:47:48 +1100405 unsigned char *attr_name;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600406
407 if (!capable(CAP_SYS_ADMIN))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000408 return -EPERM;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600409 if (copy_from_user(&am_hreq, arg,
410 sizeof(compat_xfs_fsop_attrmulti_handlereq_t)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000411 return -EFAULT;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600412
Zhitong Wangfda168c2010-03-23 09:51:22 +1100413 /* overflow check */
414 if (am_hreq.opcount >= INT_MAX / sizeof(compat_xfs_attr_multiop_t))
415 return -E2BIG;
416
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100417 dentry = xfs_compat_handlereq_to_dentry(parfilp, &am_hreq.hreq);
418 if (IS_ERR(dentry))
419 return PTR_ERR(dentry);
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600420
Dave Chinner24513372014-06-25 14:58:08 +1000421 error = -E2BIG;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600422 size = am_hreq.opcount * sizeof(compat_xfs_attr_multiop_t);
423 if (!size || size > 16 * PAGE_SIZE)
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100424 goto out_dput;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600425
Li Zefan0e639bd2009-04-08 15:08:04 +0800426 ops = memdup_user(compat_ptr(am_hreq.ops), size);
427 if (IS_ERR(ops)) {
From: Tuomas Tynkkynenb28fd7b2014-05-05 17:30:20 +1000428 error = -PTR_ERR(ops);
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100429 goto out_dput;
Li Zefan0e639bd2009-04-08 15:08:04 +0800430 }
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600431
Dave Chinner24513372014-06-25 14:58:08 +1000432 error = -ENOMEM;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600433 attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL);
434 if (!attr_name)
435 goto out_kfree_ops;
436
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600437 error = 0;
438 for (i = 0; i < am_hreq.opcount; i++) {
Dave Chinnera9273ca2010-01-20 10:47:48 +1100439 ops[i].am_error = strncpy_from_user((char *)attr_name,
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600440 compat_ptr(ops[i].am_attrname),
441 MAXNAMELEN);
442 if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
Dave Chinner24513372014-06-25 14:58:08 +1000443 error = -ERANGE;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600444 if (ops[i].am_error < 0)
445 break;
446
447 switch (ops[i].am_opcode) {
448 case ATTR_OP_GET:
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100449 ops[i].am_error = xfs_attrmulti_attr_get(
450 dentry->d_inode, attr_name,
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600451 compat_ptr(ops[i].am_attrvalue),
452 &ops[i].am_length, ops[i].am_flags);
453 break;
454 case ATTR_OP_SET:
Al Viroa561be72011-11-23 11:57:51 -0500455 ops[i].am_error = mnt_want_write_file(parfilp);
Christoph Hellwig62e194e2009-01-19 02:03:03 +0100456 if (ops[i].am_error)
457 break;
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100458 ops[i].am_error = xfs_attrmulti_attr_set(
459 dentry->d_inode, attr_name,
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600460 compat_ptr(ops[i].am_attrvalue),
461 ops[i].am_length, ops[i].am_flags);
Al Viro2a79f172011-12-09 08:06:57 -0500462 mnt_drop_write_file(parfilp);
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600463 break;
464 case ATTR_OP_REMOVE:
Al Viroa561be72011-11-23 11:57:51 -0500465 ops[i].am_error = mnt_want_write_file(parfilp);
Christoph Hellwig62e194e2009-01-19 02:03:03 +0100466 if (ops[i].am_error)
467 break;
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100468 ops[i].am_error = xfs_attrmulti_attr_remove(
469 dentry->d_inode, attr_name,
470 ops[i].am_flags);
Al Viro2a79f172011-12-09 08:06:57 -0500471 mnt_drop_write_file(parfilp);
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600472 break;
473 default:
Dave Chinner24513372014-06-25 14:58:08 +1000474 ops[i].am_error = -EINVAL;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600475 }
476 }
477
478 if (copy_to_user(compat_ptr(am_hreq.ops), ops, size))
Dave Chinner24513372014-06-25 14:58:08 +1000479 error = -EFAULT;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600480
481 kfree(attr_name);
482 out_kfree_ops:
483 kfree(ops);
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100484 out_dput:
485 dput(dentry);
Dave Chinner24513372014-06-25 14:58:08 +1000486 return error;
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600487}
488
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600489STATIC int
490xfs_compat_fssetdm_by_handle(
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100491 struct file *parfilp,
492 void __user *arg)
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600493{
494 int error;
495 struct fsdmidata fsd;
496 compat_xfs_fsop_setdm_handlereq_t dmhreq;
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100497 struct dentry *dentry;
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600498
499 if (!capable(CAP_MKNOD))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000500 return -EPERM;
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600501 if (copy_from_user(&dmhreq, arg,
502 sizeof(compat_xfs_fsop_setdm_handlereq_t)))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000503 return -EFAULT;
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600504
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100505 dentry = xfs_compat_handlereq_to_dentry(parfilp, &dmhreq.hreq);
506 if (IS_ERR(dentry))
507 return PTR_ERR(dentry);
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600508
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100509 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) {
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000510 error = -EPERM;
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600511 goto out;
512 }
513
514 if (copy_from_user(&fsd, compat_ptr(dmhreq.data), sizeof(fsd))) {
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000515 error = -EFAULT;
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600516 goto out;
517 }
518
Dave Chinner24513372014-06-25 14:58:08 +1000519 error = xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask,
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600520 fsd.fsd_dmstate);
521
522out:
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100523 dput(dentry);
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600524 return error;
525}
526
Christoph Hellwig4d4be482008-12-09 04:47:33 -0500527long
528xfs_file_compat_ioctl(
529 struct file *filp,
530 unsigned cmd,
531 unsigned long p)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532{
Al Viro496ad9a2013-01-23 17:07:38 -0500533 struct inode *inode = file_inode(filp);
Christoph Hellwig4d4be482008-12-09 04:47:33 -0500534 struct xfs_inode *ip = XFS_I(inode);
535 struct xfs_mount *mp = ip->i_mount;
536 void __user *arg = (void __user *)p;
537 int ioflags = 0;
538 int error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539
Christoph Hellwig4d4be482008-12-09 04:47:33 -0500540 if (filp->f_mode & FMODE_NOCMTIME)
Dave Chinnerb92cc59f62014-08-04 13:28:20 +1000541 ioflags |= XFS_IO_INVIS;
Christoph Hellwig4d4be482008-12-09 04:47:33 -0500542
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000543 trace_xfs_file_compat_ioctl(ip);
Christoph Hellwig4d4be482008-12-09 04:47:33 -0500544
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 switch (cmd) {
sandeen@sandeen.nete5d412f2008-11-25 21:20:17 -0600546 /* No size or alignment issues on any arch */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547 case XFS_IOC_DIOINFO:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 case XFS_IOC_FSGEOMETRY:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 case XFS_IOC_FSGETXATTR:
550 case XFS_IOC_FSSETXATTR:
551 case XFS_IOC_FSGETXATTRA:
552 case XFS_IOC_FSSETDM:
553 case XFS_IOC_GETBMAP:
554 case XFS_IOC_GETBMAPA:
555 case XFS_IOC_GETBMAPX:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556 case XFS_IOC_FSCOUNTS:
557 case XFS_IOC_SET_RESBLKS:
558 case XFS_IOC_GET_RESBLKS:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 case XFS_IOC_FSGROWFSLOG:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560 case XFS_IOC_GOINGDOWN:
561 case XFS_IOC_ERROR_INJECTION:
562 case XFS_IOC_ERROR_CLEARALL:
Christoph Hellwig4d4be482008-12-09 04:47:33 -0500563 return xfs_file_ioctl(filp, cmd, p);
sandeen@sandeen.nete5d412f2008-11-25 21:20:17 -0600564#ifndef BROKEN_X86_ALIGNMENT
565 /* These are handled fine if no alignment issues */
566 case XFS_IOC_ALLOCSP:
567 case XFS_IOC_FREESP:
568 case XFS_IOC_RESVSP:
569 case XFS_IOC_UNRESVSP:
570 case XFS_IOC_ALLOCSP64:
571 case XFS_IOC_FREESP64:
572 case XFS_IOC_RESVSP64:
573 case XFS_IOC_UNRESVSP64:
574 case XFS_IOC_FSGEOMETRY_V1:
575 case XFS_IOC_FSGROWFSDATA:
576 case XFS_IOC_FSGROWFSRT:
Dave Chinner44722352010-08-24 12:02:11 +1000577 case XFS_IOC_ZERO_RANGE:
Christoph Hellwig4d4be482008-12-09 04:47:33 -0500578 return xfs_file_ioctl(filp, cmd, p);
sandeen@sandeen.nete5d412f2008-11-25 21:20:17 -0600579#else
Eric Sandeen526c4202005-09-05 08:25:06 +1000580 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:
Christoph Hellwig8c1fdd02011-04-21 13:21:03 +0000587 case XFS_IOC_UNRESVSP64_32:
588 case XFS_IOC_ZERO_RANGE_32: {
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600589 struct xfs_flock64 bf;
590
591 if (xfs_compat_flock64_copyin(&bf, arg))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000592 return -EFAULT;
Eric Sandeen526c4202005-09-05 08:25:06 +1000593 cmd = _NATIVE_IOC(cmd, struct xfs_flock64);
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600594 return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf);
595 }
Michal Marek547e00c2007-07-11 11:09:57 +1000596 case XFS_IOC_FSGEOMETRY_V1_32:
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600597 return xfs_compat_ioc_fsgeometry_v1(mp, arg);
sandeen@sandeen.net471d5912008-11-25 21:20:10 -0600598 case XFS_IOC_FSGROWFSDATA_32: {
599 struct xfs_growfs_data in;
600
601 if (xfs_compat_growfs_data_copyin(&in, arg))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000602 return -EFAULT;
Jan Karad9457dc2012-06-12 16:20:39 +0200603 error = mnt_want_write_file(filp);
604 if (error)
605 return error;
sandeen@sandeen.net471d5912008-11-25 21:20:10 -0600606 error = xfs_growfs_data(mp, &in);
Jan Karad9457dc2012-06-12 16:20:39 +0200607 mnt_drop_write_file(filp);
Dave Chinner24513372014-06-25 14:58:08 +1000608 return error;
sandeen@sandeen.net471d5912008-11-25 21:20:10 -0600609 }
610 case XFS_IOC_FSGROWFSRT_32: {
611 struct xfs_growfs_rt in;
612
613 if (xfs_compat_growfs_rt_copyin(&in, arg))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000614 return -EFAULT;
Jan Karad9457dc2012-06-12 16:20:39 +0200615 error = mnt_want_write_file(filp);
616 if (error)
617 return error;
sandeen@sandeen.net471d5912008-11-25 21:20:10 -0600618 error = xfs_growfs_rt(mp, &in);
Jan Karad9457dc2012-06-12 16:20:39 +0200619 mnt_drop_write_file(filp);
Dave Chinner24513372014-06-25 14:58:08 +1000620 return error;
sandeen@sandeen.net471d5912008-11-25 21:20:10 -0600621 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700622#endif
sandeen@sandeen.nete5d412f2008-11-25 21:20:17 -0600623 /* long changes size, but xfs only copiese out 32 bits */
624 case XFS_IOC_GETXFLAGS_32:
625 case XFS_IOC_SETXFLAGS_32:
626 case XFS_IOC_GETVERSION_32:
627 cmd = _NATIVE_IOC(cmd, long);
Christoph Hellwig4d4be482008-12-09 04:47:33 -0500628 return xfs_file_ioctl(filp, cmd, p);
Christoph Hellwig37258672009-09-01 14:03:08 -0400629 case XFS_IOC_SWAPEXT_32: {
sandeen@sandeen.nete5d412f2008-11-25 21:20:17 -0600630 struct xfs_swapext sxp;
631 struct compat_xfs_swapext __user *sxu = arg;
632
633 /* Bulk copy in up to the sx_stat field, then copy bstat */
634 if (copy_from_user(&sxp, sxu,
635 offsetof(struct xfs_swapext, sx_stat)) ||
636 xfs_ioctl32_bstat_copyin(&sxp.sx_stat, &sxu->sx_stat))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000637 return -EFAULT;
Jan Karad9457dc2012-06-12 16:20:39 +0200638 error = mnt_want_write_file(filp);
639 if (error)
640 return error;
Dave Chinnera133d952013-08-12 20:49:48 +1000641 error = xfs_ioc_swapext(&sxp);
Jan Karad9457dc2012-06-12 16:20:39 +0200642 mnt_drop_write_file(filp);
Dave Chinner24513372014-06-25 14:58:08 +1000643 return error;
sandeen@sandeen.nete5d412f2008-11-25 21:20:17 -0600644 }
Michal Marekfaa63e92007-07-11 11:10:19 +1000645 case XFS_IOC_FSBULKSTAT_32:
646 case XFS_IOC_FSBULKSTAT_SINGLE_32:
647 case XFS_IOC_FSINUMBERS_32:
sandeen@sandeen.net2ee4fa52008-11-25 21:20:11 -0600648 return xfs_compat_ioc_bulkstat(mp, cmd, arg);
Michal Marek1fa503d2007-07-11 11:10:09 +1000649 case XFS_IOC_FD_TO_HANDLE_32:
650 case XFS_IOC_PATH_TO_HANDLE_32:
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600651 case XFS_IOC_PATH_TO_FSHANDLE_32: {
652 struct xfs_fsop_handlereq hreq;
653
654 if (xfs_compat_handlereq_copyin(&hreq, arg))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000655 return -EFAULT;
Michal Marek1fa503d2007-07-11 11:10:09 +1000656 cmd = _NATIVE_IOC(cmd, struct xfs_fsop_handlereq);
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600657 return xfs_find_handle(cmd, &hreq);
658 }
659 case XFS_IOC_OPEN_BY_HANDLE_32: {
660 struct xfs_fsop_handlereq hreq;
661
662 if (xfs_compat_handlereq_copyin(&hreq, arg))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000663 return -EFAULT;
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100664 return xfs_open_by_handle(filp, &hreq);
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600665 }
666 case XFS_IOC_READLINK_BY_HANDLE_32: {
667 struct xfs_fsop_handlereq hreq;
668
669 if (xfs_compat_handlereq_copyin(&hreq, arg))
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000670 return -EFAULT;
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100671 return xfs_readlink_by_handle(filp, &hreq);
sandeen@sandeen.netd5547f92008-11-25 21:20:08 -0600672 }
sandeen@sandeen.netebeecd22008-11-25 21:20:14 -0600673 case XFS_IOC_ATTRLIST_BY_HANDLE_32:
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100674 return xfs_compat_attrlist_by_handle(filp, arg);
sandeen@sandeen.net28750972008-11-25 21:20:15 -0600675 case XFS_IOC_ATTRMULTI_BY_HANDLE_32:
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100676 return xfs_compat_attrmulti_by_handle(filp, arg);
sandeen@sandeen.net710d62a2008-11-25 21:20:16 -0600677 case XFS_IOC_FSSETDM_BY_HANDLE_32:
Christoph Hellwigab596ad2009-01-19 02:02:57 +0100678 return xfs_compat_fssetdm_by_handle(filp, arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 default:
Eric Sandeenb474c7a2014-06-22 15:04:54 +1000680 return -ENOIOCTLCMD;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682}