xfs
[Top] [All Lists]

Re: [PATCH 1/2 v2] convert xfs_getbmap to take formatter functions

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH 1/2 v2] convert xfs_getbmap to take formatter functions
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Sat, 25 Oct 2008 16:27:43 -0400
Cc: xfs-oss <xfs@xxxxxxxxxxx>
In-reply-to: <49032017.6070408@xxxxxxxxxxx>
References: <49031E81.7040807@xxxxxxxxxxx> <49032017.6070408@xxxxxxxxxxx>
User-agent: Mutt/1.5.18 (2008-05-17)
> +int xfs_getbmapx_format(void __user **ap, struct getbmapx *bmv, int *filled)
> +{
> +     *filled = 0;
> +     if (copy_to_user(*ap, bmv, sizeof(struct getbmapx)))
> +             return XFS_ERROR(EFAULT);
> +
> +     *ap += sizeof(struct getbmapx);
> +     *filled = 1;
> +     return 0;
> +}
> +
> +int xfs_getbmap_format(void __user **ap, struct getbmapx *bmv, int *filled)
> +{
> +     *filled = 0;
> +     /* copy only getbmap portion (not getbmapx) */
> +     if (copy_to_user(*ap, bmv, sizeof(struct getbmap)))
> +             return XFS_ERROR(EFAULT);
> +
> +     *ap += sizeof(struct getbmap);
> +     *filled = 1;
> +     return 0;
> +}

Probably makes sense to have these two helpers in xfs_ioctl.c, where
they are used, similar to how fiemap is implemented.

<Prev in Thread] Current Thread [Next in Thread>