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

Eric Sandeen
2008-10-25T20:28:53Z

Christoph Hellwig wrote:
>> +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.
>

Ok, that makes sense. Will change that & the other suggestions.

(I did run sparse once, but made changes after that and forgot to re-run...)

-Eric