Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2004-2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <linux/compat.h> |
| 19 | #include <linux/init.h> |
| 20 | #include <linux/ioctl.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <linux/syscalls.h> |
| 22 | #include <linux/types.h> |
| 23 | #include <linux/fs.h> |
| 24 | #include <asm/uaccess.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include "xfs.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include "xfs_fs.h" |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 27 | #include "xfs_bit.h" |
| 28 | #include "xfs_log.h" |
| 29 | #include "xfs_inum.h" |
| 30 | #include "xfs_trans.h" |
| 31 | #include "xfs_sb.h" |
| 32 | #include "xfs_ag.h" |
| 33 | #include "xfs_dir2.h" |
| 34 | #include "xfs_dmapi.h" |
| 35 | #include "xfs_mount.h" |
| 36 | #include "xfs_bmap_btree.h" |
| 37 | #include "xfs_attr_sf.h" |
| 38 | #include "xfs_dir2_sf.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #include "xfs_vnode.h" |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 40 | #include "xfs_dinode.h" |
| 41 | #include "xfs_inode.h" |
| 42 | #include "xfs_itable.h" |
| 43 | #include "xfs_error.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include "xfs_dfrag.h" |
Christoph Hellwig | 739bfb2 | 2007-08-29 10:58:01 +1000 | [diff] [blame] | 45 | #include "xfs_vnodeops.h" |
David Chinner | a8272ce | 2007-11-23 16:28:09 +1100 | [diff] [blame] | 46 | #include "xfs_ioctl32.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
Eric Sandeen | 526c420 | 2005-09-05 08:25:06 +1000 | [diff] [blame] | 48 | #define _NATIVE_IOC(cmd, type) \ |
| 49 | _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type)) |
| 50 | |
sandeen@sandeen.net | ffae263 | 2008-11-25 21:20:07 -0600 | [diff] [blame^] | 51 | #ifdef BROKEN_X86_ALIGNMENT |
Eric Sandeen | 526c420 | 2005-09-05 08:25:06 +1000 | [diff] [blame] | 52 | STATIC unsigned long |
| 53 | xfs_ioctl32_flock( |
| 54 | unsigned long arg) |
| 55 | { |
sandeen@sandeen.net | ffae263 | 2008-11-25 21:20:07 -0600 | [diff] [blame^] | 56 | compat_xfs_flock64_t __user *p32 = (void __user *)arg; |
Eric Sandeen | 526c420 | 2005-09-05 08:25:06 +1000 | [diff] [blame] | 57 | xfs_flock64_t __user *p = compat_alloc_user_space(sizeof(*p)); |
| 58 | |
| 59 | if (copy_in_user(&p->l_type, &p32->l_type, sizeof(s16)) || |
| 60 | copy_in_user(&p->l_whence, &p32->l_whence, sizeof(s16)) || |
| 61 | copy_in_user(&p->l_start, &p32->l_start, sizeof(s64)) || |
| 62 | copy_in_user(&p->l_len, &p32->l_len, sizeof(s64)) || |
| 63 | copy_in_user(&p->l_sysid, &p32->l_sysid, sizeof(s32)) || |
| 64 | copy_in_user(&p->l_pid, &p32->l_pid, sizeof(u32)) || |
| 65 | copy_in_user(&p->l_pad, &p32->l_pad, 4*sizeof(u32))) |
| 66 | return -EFAULT; |
Nathan Scott | e0edd596 | 2006-03-29 08:55:47 +1000 | [diff] [blame] | 67 | |
Eric Sandeen | 526c420 | 2005-09-05 08:25:06 +1000 | [diff] [blame] | 68 | return (unsigned long)p; |
| 69 | } |
| 70 | |
Michal Marek | 547e00c | 2007-07-11 11:09:57 +1000 | [diff] [blame] | 71 | STATIC unsigned long xfs_ioctl32_geom_v1(unsigned long arg) |
| 72 | { |
| 73 | compat_xfs_fsop_geom_v1_t __user *p32 = (void __user *)arg; |
| 74 | xfs_fsop_geom_v1_t __user *p = compat_alloc_user_space(sizeof(*p)); |
| 75 | |
| 76 | if (copy_in_user(p, p32, sizeof(*p32))) |
| 77 | return -EFAULT; |
| 78 | return (unsigned long)p; |
| 79 | } |
| 80 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 81 | STATIC int xfs_inumbers_fmt_compat( |
| 82 | void __user *ubuffer, |
| 83 | const xfs_inogrp_t *buffer, |
| 84 | long count, |
| 85 | long *written) |
| 86 | { |
Al Viro | ad690ef | 2007-07-26 17:35:59 +0100 | [diff] [blame] | 87 | compat_xfs_inogrp_t __user *p32 = ubuffer; |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 88 | long i; |
| 89 | |
| 90 | for (i = 0; i < count; i++) { |
| 91 | if (put_user(buffer[i].xi_startino, &p32[i].xi_startino) || |
| 92 | put_user(buffer[i].xi_alloccount, &p32[i].xi_alloccount) || |
| 93 | put_user(buffer[i].xi_allocmask, &p32[i].xi_allocmask)) |
| 94 | return -EFAULT; |
| 95 | } |
| 96 | *written = count * sizeof(*p32); |
| 97 | return 0; |
| 98 | } |
| 99 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | #else |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 101 | #define xfs_inumbers_fmt_compat xfs_inumbers_fmt |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 102 | #endif |
| 103 | |
| 104 | /* XFS_IOC_FSBULKSTAT and friends */ |
| 105 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 106 | STATIC int xfs_bstime_store_compat( |
| 107 | compat_xfs_bstime_t __user *p32, |
| 108 | const xfs_bstime_t *p) |
| 109 | { |
| 110 | __s32 sec32; |
| 111 | |
| 112 | sec32 = p->tv_sec; |
| 113 | if (put_user(sec32, &p32->tv_sec) || |
| 114 | put_user(p->tv_nsec, &p32->tv_nsec)) |
| 115 | return -EFAULT; |
| 116 | return 0; |
| 117 | } |
| 118 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 119 | STATIC int xfs_bulkstat_one_fmt_compat( |
| 120 | void __user *ubuffer, |
| 121 | const xfs_bstat_t *buffer) |
| 122 | { |
| 123 | compat_xfs_bstat_t __user *p32 = ubuffer; |
| 124 | |
| 125 | if (put_user(buffer->bs_ino, &p32->bs_ino) || |
| 126 | put_user(buffer->bs_mode, &p32->bs_mode) || |
| 127 | put_user(buffer->bs_nlink, &p32->bs_nlink) || |
| 128 | put_user(buffer->bs_uid, &p32->bs_uid) || |
| 129 | put_user(buffer->bs_gid, &p32->bs_gid) || |
| 130 | put_user(buffer->bs_rdev, &p32->bs_rdev) || |
| 131 | put_user(buffer->bs_blksize, &p32->bs_blksize) || |
| 132 | put_user(buffer->bs_size, &p32->bs_size) || |
| 133 | xfs_bstime_store_compat(&p32->bs_atime, &buffer->bs_atime) || |
| 134 | xfs_bstime_store_compat(&p32->bs_mtime, &buffer->bs_mtime) || |
| 135 | xfs_bstime_store_compat(&p32->bs_ctime, &buffer->bs_ctime) || |
| 136 | put_user(buffer->bs_blocks, &p32->bs_blocks) || |
| 137 | put_user(buffer->bs_xflags, &p32->bs_xflags) || |
| 138 | put_user(buffer->bs_extsize, &p32->bs_extsize) || |
| 139 | put_user(buffer->bs_extents, &p32->bs_extents) || |
| 140 | put_user(buffer->bs_gen, &p32->bs_gen) || |
| 141 | put_user(buffer->bs_projid, &p32->bs_projid) || |
| 142 | put_user(buffer->bs_dmevmask, &p32->bs_dmevmask) || |
| 143 | put_user(buffer->bs_dmstate, &p32->bs_dmstate) || |
| 144 | put_user(buffer->bs_aextents, &p32->bs_aextents)) |
| 145 | return -EFAULT; |
| 146 | return sizeof(*p32); |
| 147 | } |
| 148 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 149 | /* copied from xfs_ioctl.c */ |
| 150 | STATIC int |
| 151 | xfs_ioc_bulkstat_compat( |
| 152 | xfs_mount_t *mp, |
| 153 | unsigned int cmd, |
| 154 | void __user *arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | { |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 156 | compat_xfs_fsop_bulkreq_t __user *p32 = (void __user *)arg; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | u32 addr; |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 158 | xfs_fsop_bulkreq_t bulkreq; |
| 159 | int count; /* # of records returned */ |
| 160 | xfs_ino_t inlast; /* last inode number */ |
| 161 | int done; |
| 162 | int error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 164 | /* done = 1 if there are more stats to get and if bulkstat */ |
| 165 | /* should be called again (unused here, but used in dmapi) */ |
| 166 | |
| 167 | if (!capable(CAP_SYS_ADMIN)) |
| 168 | return -EPERM; |
| 169 | |
| 170 | if (XFS_FORCED_SHUTDOWN(mp)) |
| 171 | return -XFS_ERROR(EIO); |
| 172 | |
| 173 | if (get_user(addr, &p32->lastip)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | return -EFAULT; |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 175 | bulkreq.lastip = compat_ptr(addr); |
| 176 | if (get_user(bulkreq.icount, &p32->icount) || |
| 177 | get_user(addr, &p32->ubuffer)) |
| 178 | return -EFAULT; |
| 179 | bulkreq.ubuffer = compat_ptr(addr); |
| 180 | if (get_user(addr, &p32->ocount)) |
| 181 | return -EFAULT; |
| 182 | bulkreq.ocount = compat_ptr(addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 184 | if (copy_from_user(&inlast, bulkreq.lastip, sizeof(__s64))) |
| 185 | return -XFS_ERROR(EFAULT); |
| 186 | |
| 187 | if ((count = bulkreq.icount) <= 0) |
| 188 | return -XFS_ERROR(EINVAL); |
| 189 | |
Lachlan McIlroy | cd57e59 | 2007-11-23 16:30:32 +1100 | [diff] [blame] | 190 | if (bulkreq.ubuffer == NULL) |
| 191 | return -XFS_ERROR(EINVAL); |
| 192 | |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 193 | if (cmd == XFS_IOC_FSINUMBERS) |
| 194 | error = xfs_inumbers(mp, &inlast, &count, |
| 195 | bulkreq.ubuffer, xfs_inumbers_fmt_compat); |
| 196 | else { |
| 197 | /* declare a var to get a warning in case the type changes */ |
| 198 | bulkstat_one_fmt_pf formatter = xfs_bulkstat_one_fmt_compat; |
| 199 | error = xfs_bulkstat(mp, &inlast, &count, |
| 200 | xfs_bulkstat_one, formatter, |
| 201 | sizeof(compat_xfs_bstat_t), bulkreq.ubuffer, |
| 202 | BULKSTAT_FG_QUICK, &done); |
| 203 | } |
| 204 | if (error) |
| 205 | return -error; |
| 206 | |
| 207 | if (bulkreq.ocount != NULL) { |
| 208 | if (copy_to_user(bulkreq.lastip, &inlast, |
| 209 | sizeof(xfs_ino_t))) |
| 210 | return -XFS_ERROR(EFAULT); |
| 211 | |
| 212 | if (copy_to_user(bulkreq.ocount, &count, sizeof(count))) |
| 213 | return -XFS_ERROR(EFAULT); |
| 214 | } |
| 215 | |
| 216 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | } |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 218 | |
Michal Marek | 1fa503d | 2007-07-11 11:10:09 +1000 | [diff] [blame] | 219 | STATIC unsigned long xfs_ioctl32_fshandle(unsigned long arg) |
| 220 | { |
| 221 | compat_xfs_fsop_handlereq_t __user *p32 = (void __user *)arg; |
| 222 | xfs_fsop_handlereq_t __user *p = compat_alloc_user_space(sizeof(*p)); |
| 223 | u32 addr; |
| 224 | |
| 225 | if (copy_in_user(&p->fd, &p32->fd, sizeof(__u32)) || |
| 226 | get_user(addr, &p32->path) || |
| 227 | put_user(compat_ptr(addr), &p->path) || |
| 228 | copy_in_user(&p->oflags, &p32->oflags, sizeof(__u32)) || |
| 229 | get_user(addr, &p32->ihandle) || |
| 230 | put_user(compat_ptr(addr), &p->ihandle) || |
| 231 | copy_in_user(&p->ihandlen, &p32->ihandlen, sizeof(__u32)) || |
| 232 | get_user(addr, &p32->ohandle) || |
| 233 | put_user(compat_ptr(addr), &p->ohandle) || |
| 234 | get_user(addr, &p32->ohandlen) || |
| 235 | put_user(compat_ptr(addr), &p->ohandlen)) |
| 236 | return -EFAULT; |
| 237 | |
| 238 | return (unsigned long)p; |
| 239 | } |
| 240 | |
Nathan Scott | d387039 | 2005-05-06 06:44:46 -0700 | [diff] [blame] | 241 | STATIC long |
Nathan Scott | e0edd596 | 2006-03-29 08:55:47 +1000 | [diff] [blame] | 242 | xfs_compat_ioctl( |
| 243 | int mode, |
| 244 | struct file *file, |
| 245 | unsigned cmd, |
| 246 | unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | { |
Josef "Jeff" Sipek | e678fb0 | 2006-12-08 02:36:49 -0800 | [diff] [blame] | 248 | struct inode *inode = file->f_path.dentry->d_inode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | int error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | |
| 251 | switch (cmd) { |
| 252 | case XFS_IOC_DIOINFO: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | case XFS_IOC_FSGEOMETRY: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | case XFS_IOC_FSGETXATTR: |
| 255 | case XFS_IOC_FSSETXATTR: |
| 256 | case XFS_IOC_FSGETXATTRA: |
| 257 | case XFS_IOC_FSSETDM: |
| 258 | case XFS_IOC_GETBMAP: |
| 259 | case XFS_IOC_GETBMAPA: |
| 260 | case XFS_IOC_GETBMAPX: |
| 261 | /* not handled |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | case XFS_IOC_FSSETDM_BY_HANDLE: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | case XFS_IOC_ATTRLIST_BY_HANDLE: |
| 264 | case XFS_IOC_ATTRMULTI_BY_HANDLE: |
| 265 | */ |
| 266 | case XFS_IOC_FSCOUNTS: |
| 267 | case XFS_IOC_SET_RESBLKS: |
| 268 | case XFS_IOC_GET_RESBLKS: |
| 269 | case XFS_IOC_FSGROWFSDATA: |
| 270 | case XFS_IOC_FSGROWFSLOG: |
| 271 | case XFS_IOC_FSGROWFSRT: |
| 272 | case XFS_IOC_FREEZE: |
| 273 | case XFS_IOC_THAW: |
| 274 | case XFS_IOC_GOINGDOWN: |
| 275 | case XFS_IOC_ERROR_INJECTION: |
| 276 | case XFS_IOC_ERROR_CLEARALL: |
| 277 | break; |
| 278 | |
sandeen@sandeen.net | ffae263 | 2008-11-25 21:20:07 -0600 | [diff] [blame^] | 279 | case XFS_IOC_GETXFLAGS_32: |
| 280 | case XFS_IOC_SETXFLAGS_32: |
| 281 | case XFS_IOC_GETVERSION_32: |
Eric Sandeen | bc58f9b | 2007-10-12 11:13:22 +1000 | [diff] [blame] | 282 | cmd = _NATIVE_IOC(cmd, long); |
| 283 | break; |
Eric Sandeen | 526c420 | 2005-09-05 08:25:06 +1000 | [diff] [blame] | 284 | #ifdef BROKEN_X86_ALIGNMENT |
| 285 | /* xfs_flock_t has wrong u32 vs u64 alignment */ |
| 286 | case XFS_IOC_ALLOCSP_32: |
| 287 | case XFS_IOC_FREESP_32: |
| 288 | case XFS_IOC_ALLOCSP64_32: |
| 289 | case XFS_IOC_FREESP64_32: |
| 290 | case XFS_IOC_RESVSP_32: |
| 291 | case XFS_IOC_UNRESVSP_32: |
| 292 | case XFS_IOC_RESVSP64_32: |
| 293 | case XFS_IOC_UNRESVSP64_32: |
| 294 | arg = xfs_ioctl32_flock(arg); |
| 295 | cmd = _NATIVE_IOC(cmd, struct xfs_flock64); |
| 296 | break; |
Michal Marek | 547e00c | 2007-07-11 11:09:57 +1000 | [diff] [blame] | 297 | case XFS_IOC_FSGEOMETRY_V1_32: |
| 298 | arg = xfs_ioctl32_geom_v1(arg); |
| 299 | cmd = _NATIVE_IOC(cmd, struct xfs_fsop_geom_v1); |
| 300 | break; |
Eric Sandeen | 526c420 | 2005-09-05 08:25:06 +1000 | [diff] [blame] | 301 | #else /* These are handled fine if no alignment issues */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | case XFS_IOC_ALLOCSP: |
| 303 | case XFS_IOC_FREESP: |
| 304 | case XFS_IOC_RESVSP: |
| 305 | case XFS_IOC_UNRESVSP: |
| 306 | case XFS_IOC_ALLOCSP64: |
| 307 | case XFS_IOC_FREESP64: |
| 308 | case XFS_IOC_RESVSP64: |
| 309 | case XFS_IOC_UNRESVSP64: |
Michal Marek | 547e00c | 2007-07-11 11:09:57 +1000 | [diff] [blame] | 310 | case XFS_IOC_FSGEOMETRY_V1: |
Eric Sandeen | 526c420 | 2005-09-05 08:25:06 +1000 | [diff] [blame] | 311 | break; |
| 312 | |
| 313 | /* xfs_bstat_t still has wrong u32 vs u64 alignment */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | case XFS_IOC_SWAPEXT: |
| 315 | break; |
| 316 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | #endif |
Michal Marek | faa63e9 | 2007-07-11 11:10:19 +1000 | [diff] [blame] | 318 | case XFS_IOC_FSBULKSTAT_32: |
| 319 | case XFS_IOC_FSBULKSTAT_SINGLE_32: |
| 320 | case XFS_IOC_FSINUMBERS_32: |
| 321 | cmd = _NATIVE_IOC(cmd, struct xfs_fsop_bulkreq); |
Christoph Hellwig | 739bfb2 | 2007-08-29 10:58:01 +1000 | [diff] [blame] | 322 | return xfs_ioc_bulkstat_compat(XFS_I(inode)->i_mount, |
Al Viro | ad690ef | 2007-07-26 17:35:59 +0100 | [diff] [blame] | 323 | cmd, (void __user*)arg); |
Michal Marek | 1fa503d | 2007-07-11 11:10:09 +1000 | [diff] [blame] | 324 | case XFS_IOC_FD_TO_HANDLE_32: |
| 325 | case XFS_IOC_PATH_TO_HANDLE_32: |
| 326 | case XFS_IOC_PATH_TO_FSHANDLE_32: |
| 327 | case XFS_IOC_OPEN_BY_HANDLE_32: |
| 328 | case XFS_IOC_READLINK_BY_HANDLE_32: |
| 329 | arg = xfs_ioctl32_fshandle(arg); |
| 330 | cmd = _NATIVE_IOC(cmd, struct xfs_fsop_handlereq); |
| 331 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | default: |
| 333 | return -ENOIOCTLCMD; |
| 334 | } |
| 335 | |
Christoph Hellwig | 739bfb2 | 2007-08-29 10:58:01 +1000 | [diff] [blame] | 336 | error = xfs_ioctl(XFS_I(inode), file, mode, cmd, (void __user *)arg); |
Christoph Hellwig | b3aea4e | 2007-08-29 11:44:37 +1000 | [diff] [blame] | 337 | xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | return error; |
| 339 | } |
| 340 | |
Nathan Scott | d387039 | 2005-05-06 06:44:46 -0700 | [diff] [blame] | 341 | long |
Nathan Scott | a50cd26 | 2006-03-14 14:06:18 +1100 | [diff] [blame] | 342 | xfs_file_compat_ioctl( |
Nathan Scott | e0edd596 | 2006-03-29 08:55:47 +1000 | [diff] [blame] | 343 | struct file *file, |
Nathan Scott | d387039 | 2005-05-06 06:44:46 -0700 | [diff] [blame] | 344 | unsigned cmd, |
| 345 | unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | { |
Nathan Scott | e0edd596 | 2006-03-29 08:55:47 +1000 | [diff] [blame] | 347 | return xfs_compat_ioctl(0, file, cmd, arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | } |
| 349 | |
Nathan Scott | d387039 | 2005-05-06 06:44:46 -0700 | [diff] [blame] | 350 | long |
Nathan Scott | a50cd26 | 2006-03-14 14:06:18 +1100 | [diff] [blame] | 351 | xfs_file_compat_invis_ioctl( |
Nathan Scott | e0edd596 | 2006-03-29 08:55:47 +1000 | [diff] [blame] | 352 | struct file *file, |
Nathan Scott | d387039 | 2005-05-06 06:44:46 -0700 | [diff] [blame] | 353 | unsigned cmd, |
| 354 | unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | { |
Nathan Scott | e0edd596 | 2006-03-29 08:55:47 +1000 | [diff] [blame] | 356 | return xfs_compat_ioctl(IO_INVIS, file, cmd, arg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | } |