From: David Chinner <dgc@sgi.com>
To: Michal Marek <mmarek@suse.cz>
Cc: xfs@oss.sgi.com, linux-kernel@vger.kernel.org
Subject: Re: [patch 2/3] Fix XFS_IOC_*_TO_HANDLE and XFS_IOC_{OPEN,READLINK}_BY_HANDLE in compat mode
Date: Thu, 31 May 2007 12:36:40 +1000 [thread overview]
Message-ID: <20070531023640.GI85884050@sgi.com> (raw)
In-Reply-To: <20070530143043.611931865@suse.cz>
On Wed, May 30, 2007 at 02:59:56PM +0200, Michal Marek wrote:
> 32bit struct xfs_fsop_handlereq has different size and offsets (due to
> pointers). TODO: case XFS_IOC_{FSSETDM,ATTRLIST,ATTRMULTI}_BY_HANDLE
> still not handled.
>
> Signed-off-by: Michal Marek <mmarek@suse.cz>
> ---
> fs/xfs/linux-2.6/xfs_ioctl32.c | 63 +++++++++++++++++++++++++++++++++++++----
> 1 file changed, 58 insertions(+), 5 deletions(-)
>
> --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl32.c
> +++ linux-2.6/fs/xfs/linux-2.6/xfs_ioctl32.c
> @@ -139,6 +139,44 @@ xfs_ioctl32_bulkstat(
> }
> #endif
>
> +typedef struct xfs_fsop_handlereq32 {
xfs_fsop_handlereq_32
> + __u32 fd; /* fd for FD_TO_HANDLE */
> + compat_uptr_t path; /* user pathname */
> + __u32 oflags; /* open flags */
> + compat_uptr_t ihandle; /* user supplied handle */
> + __u32 ihandlen; /* user supplied length */
> + compat_uptr_t ohandle; /* user buffer for handle */
> + compat_uptr_t ohandlen; /* user buffer length */
> +} xfs_fsop_handlereq32_t;
xfs_fsop_handlereq_32_t
Add a empty line here...
> +#define XFS_IOC_PATH_TO_FSHANDLE_32 _IOWR('X', 104, struct xfs_fsop_handlereq32)
> +#define XFS_IOC_PATH_TO_HANDLE_32 _IOWR('X', 105, struct xfs_fsop_handlereq32)
> +#define XFS_IOC_FD_TO_HANDLE_32 _IOWR('X', 106, struct xfs_fsop_handlereq32)
> +#define XFS_IOC_OPEN_BY_HANDLE_32 _IOWR('X', 107, struct xfs_fsop_handlereq32)
> +#define XFS_IOC_READLINK_BY_HANDLE_32 _IOWR('X', 108, struct xfs_fsop_handlereq32)
Looks kinda whitespacey here - it's mixing spaces and tabs....
> +STATIC unsigned long xfs_ioctl32_fshandle(unsigned long arg)
> +{
> + xfs_fsop_handlereq32_t __user *p32 = (void __user *)arg;
> + xfs_fsop_handlereq_t __user *p = compat_alloc_user_space(sizeof(*p));
> + u32 addr;
> +
> + if (copy_in_user(&p->fd, &p32->fd, sizeof(__u32)) ||
> + get_user(addr, &p32->path) ||
> + put_user(compat_ptr(addr), &p->path) ||
> + copy_in_user(&p->oflags, &p32->oflags, sizeof(__u32)) ||
> + get_user(addr, &p32->ihandle) ||
> + put_user(compat_ptr(addr), &p->ihandle) ||
> + copy_in_user(&p->ihandlen, &p32->ihandlen, sizeof(__u32)) ||
> + get_user(addr, &p32->ohandle) ||
> + put_user(compat_ptr(addr), &p->ohandle) ||
> + get_user(addr, &p32->ohandlen) ||
> + put_user(compat_ptr(addr), &p->ohandlen))
> + return -EFAULT;
> +
> + return (unsigned long)p;
> +}
> +
> +
> STATIC long
> xfs_compat_ioctl(
> int mode,
> @@ -164,12 +202,7 @@ xfs_compat_ioctl(
> case XFS_IOC_GETBMAPA:
> case XFS_IOC_GETBMAPX:
> /* not handled
> - case XFS_IOC_FD_TO_HANDLE:
> - case XFS_IOC_PATH_TO_HANDLE:
> - case XFS_IOC_PATH_TO_FSHANDLE:
> - case XFS_IOC_OPEN_BY_HANDLE:
> case XFS_IOC_FSSETDM_BY_HANDLE:
> - case XFS_IOC_READLINK_BY_HANDLE:
> case XFS_IOC_ATTRLIST_BY_HANDLE:
> case XFS_IOC_ATTRMULTI_BY_HANDLE:
> */
> @@ -226,6 +259,26 @@ xfs_compat_ioctl(
> arg = xfs_ioctl32_bulkstat(arg);
> break;
> #endif
> + case XFS_IOC_FD_TO_HANDLE_32:
> + arg = xfs_ioctl32_fshandle(arg);
> + cmd = XFS_IOC_FD_TO_HANDLE;
> + break;
> + case XFS_IOC_PATH_TO_HANDLE_32:
> + arg = xfs_ioctl32_fshandle(arg);
> + cmd = XFS_IOC_PATH_TO_HANDLE;
> + break;
> + case XFS_IOC_PATH_TO_FSHANDLE_32:
> + arg = xfs_ioctl32_fshandle(arg);
> + cmd = XFS_IOC_PATH_TO_FSHANDLE;
> + break;
> + case XFS_IOC_OPEN_BY_HANDLE_32:
> + arg = xfs_ioctl32_fshandle(arg);
> + cmd = XFS_IOC_OPEN_BY_HANDLE;
> + break;
> + case XFS_IOC_READLINK_BY_HANDLE_32:
> + arg = xfs_ioctl32_fshandle(arg);
> + cmd = XFS_IOC_READLINK_BY_HANDLE;
> + break;
+ case XFS_IOC_FD_TO_HANDLE_32:
+ case XFS_IOC_PATH_TO_HANDLE_32:
+ case XFS_IOC_PATH_TO_FSHANDLE_32:
+ case XFS_IOC_OPEN_BY_HANDLE_32:
+ case XFS_IOC_READLINK_BY_HANDLE_32:
+ arg = xfs_ioctl32_fshandle(arg);
+ cmd = _NATIVE_IOC(cmd, struct xfs_fsop_handlereq);
+ break;
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
next prev parent reply other threads:[~2007-05-31 2:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-30 12:59 [patch 0/3] Fix for XFS compat ioctls Michal Marek
2007-05-30 12:59 ` [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode Michal Marek
2007-05-30 17:05 ` Chris Wedgwood
2007-05-30 21:48 ` Arnd Bergmann
2007-05-31 8:10 ` Michal Marek
2007-05-31 2:30 ` David Chinner
2007-05-31 7:22 ` Timothy Shimmin
2007-05-31 13:26 ` David Chinner
2007-06-01 4:39 ` Timothy Shimmin
2007-06-04 14:56 ` Christoph Hellwig
2007-05-30 12:59 ` [patch 2/3] Fix XFS_IOC_*_TO_HANDLE and XFS_IOC_{OPEN,READLINK}_BY_HANDLE " Michal Marek
2007-05-31 2:36 ` David Chinner [this message]
2007-05-30 12:59 ` [patch 3/3] Fix XFS_IOC_FSBULKSTAT{,_SINGLE} and XFS_IOC_FSINUMBERS " Michal Marek
2007-05-31 6:37 ` David Chinner
2007-05-31 8:52 ` Michal Marek
2007-05-31 13:03 ` David Chinner
2007-05-31 7:06 ` Arnd Bergmann
-- strict thread matches above, loose matches on Subject: below --
2007-06-19 13:25 [patch 0/3] Fix for XFS compat ioctls (try2) mmarek
2007-06-19 13:25 ` [patch 2/3] Fix XFS_IOC_*_TO_HANDLE and XFS_IOC_{OPEN,READLINK}_BY_HANDLE in compat mode mmarek
2007-06-28 3:07 ` David Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070531023640.GI85884050@sgi.com \
--to=dgc@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.