diff options
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index 5b91335e97dd..87163fb9746b 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -141,6 +141,50 @@ xfs_ioctl32_bulkstat( | |||
141 | } | 141 | } |
142 | #endif | 142 | #endif |
143 | 143 | ||
144 | typedef struct compat_xfs_fsop_handlereq { | ||
145 | __u32 fd; /* fd for FD_TO_HANDLE */ | ||
146 | compat_uptr_t path; /* user pathname */ | ||
147 | __u32 oflags; /* open flags */ | ||
148 | compat_uptr_t ihandle; /* user supplied handle */ | ||
149 | __u32 ihandlen; /* user supplied length */ | ||
150 | compat_uptr_t ohandle; /* user buffer for handle */ | ||
151 | compat_uptr_t ohandlen; /* user buffer length */ | ||
152 | } compat_xfs_fsop_handlereq_t; | ||
153 | |||
154 | #define XFS_IOC_PATH_TO_FSHANDLE_32 \ | ||
155 | _IOWR('X', 104, struct compat_xfs_fsop_handlereq) | ||
156 | #define XFS_IOC_PATH_TO_HANDLE_32 \ | ||
157 | _IOWR('X', 105, struct compat_xfs_fsop_handlereq) | ||
158 | #define XFS_IOC_FD_TO_HANDLE_32 \ | ||
159 | _IOWR('X', 106, struct compat_xfs_fsop_handlereq) | ||
160 | #define XFS_IOC_OPEN_BY_HANDLE_32 \ | ||
161 | _IOWR('X', 107, struct compat_xfs_fsop_handlereq) | ||
162 | #define XFS_IOC_READLINK_BY_HANDLE_32 \ | ||
163 | _IOWR('X', 108, struct compat_xfs_fsop_handlereq) | ||
164 | |||
165 | STATIC unsigned long xfs_ioctl32_fshandle(unsigned long arg) | ||
166 | { | ||
167 | compat_xfs_fsop_handlereq_t __user *p32 = (void __user *)arg; | ||
168 | xfs_fsop_handlereq_t __user *p = compat_alloc_user_space(sizeof(*p)); | ||
169 | u32 addr; | ||
170 | |||
171 | if (copy_in_user(&p->fd, &p32->fd, sizeof(__u32)) || | ||
172 | get_user(addr, &p32->path) || | ||
173 | put_user(compat_ptr(addr), &p->path) || | ||
174 | copy_in_user(&p->oflags, &p32->oflags, sizeof(__u32)) || | ||
175 | get_user(addr, &p32->ihandle) || | ||
176 | put_user(compat_ptr(addr), &p->ihandle) || | ||
177 | copy_in_user(&p->ihandlen, &p32->ihandlen, sizeof(__u32)) || | ||
178 | get_user(addr, &p32->ohandle) || | ||
179 | put_user(compat_ptr(addr), &p->ohandle) || | ||
180 | get_user(addr, &p32->ohandlen) || | ||
181 | put_user(compat_ptr(addr), &p->ohandlen)) | ||
182 | return -EFAULT; | ||
183 | |||
184 | return (unsigned long)p; | ||
185 | } | ||
186 | |||
187 | |||
144 | STATIC long | 188 | STATIC long |
145 | xfs_compat_ioctl( | 189 | xfs_compat_ioctl( |
146 | int mode, | 190 | int mode, |
@@ -166,12 +210,7 @@ xfs_compat_ioctl( | |||
166 | case XFS_IOC_GETBMAPA: | 210 | case XFS_IOC_GETBMAPA: |
167 | case XFS_IOC_GETBMAPX: | 211 | case XFS_IOC_GETBMAPX: |
168 | /* not handled | 212 | /* not handled |
169 | case XFS_IOC_FD_TO_HANDLE: | ||
170 | case XFS_IOC_PATH_TO_HANDLE: | ||
171 | case XFS_IOC_PATH_TO_FSHANDLE: | ||
172 | case XFS_IOC_OPEN_BY_HANDLE: | ||
173 | case XFS_IOC_FSSETDM_BY_HANDLE: | 213 | case XFS_IOC_FSSETDM_BY_HANDLE: |
174 | case XFS_IOC_READLINK_BY_HANDLE: | ||
175 | case XFS_IOC_ATTRLIST_BY_HANDLE: | 214 | case XFS_IOC_ATTRLIST_BY_HANDLE: |
176 | case XFS_IOC_ATTRMULTI_BY_HANDLE: | 215 | case XFS_IOC_ATTRMULTI_BY_HANDLE: |
177 | */ | 216 | */ |
@@ -228,6 +267,14 @@ xfs_compat_ioctl( | |||
228 | arg = xfs_ioctl32_bulkstat(arg); | 267 | arg = xfs_ioctl32_bulkstat(arg); |
229 | break; | 268 | break; |
230 | #endif | 269 | #endif |
270 | case XFS_IOC_FD_TO_HANDLE_32: | ||
271 | case XFS_IOC_PATH_TO_HANDLE_32: | ||
272 | case XFS_IOC_PATH_TO_FSHANDLE_32: | ||
273 | case XFS_IOC_OPEN_BY_HANDLE_32: | ||
274 | case XFS_IOC_READLINK_BY_HANDLE_32: | ||
275 | arg = xfs_ioctl32_fshandle(arg); | ||
276 | cmd = _NATIVE_IOC(cmd, struct xfs_fsop_handlereq); | ||
277 | break; | ||
231 | default: | 278 | default: |
232 | return -ENOIOCTLCMD; | 279 | return -ENOIOCTLCMD; |
233 | } | 280 | } |