W dniu 20 kwietnia 2011 19:31 użytkownik Michał Mirosław
<[email protected]> napisał:
> 2011/4/14 John Calixto <[email protected]>:
> [...]
>
>> + /* DAT buffer */
>> + __u32 data_ptr_size; /* size of the *pointer* */
>> + __u64 data_ptr;
>
> So... again... What's the problem with anonymous union of pointer and u64?
>
> Example implementation:
>
> struct mmc_ioc_cmd {
> ...
> union {
> void __user *data_ptr;
> __u64 __data_ptr_storage;
> };
> };
>
Hmm. This might be even better:
static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
struct mmc_ioc_cmd blk;
if (cmd != MMC_IOC_CMD)
return -EINVAL;
copy_from_user((void __user *)arg, &blk) ...
#ifdef CONFIG_COMPAT
if (is_compat_task())
blk.data_ptr = compat_ptr(*(u32 *)&blk.data_ptr);
#endif
return mmc_blk_ioctl_cmd(bdev, &blk);
}
[no compat_ioctl needed]
Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html