Re: [PATCH v4] mmc: Add ioctl to let userspace apps send ACMDs

Arnd Bergmann
2011-04-12T23:00:54Z

On Tuesday 12 April 2011, Michał Mirosław wrote:
> > + unsigned int cmd_timeout_ms;
> > + __u64 data_ptr; /* DAT buffer */
>
> This will be more natural if you have an anonymous union here:
> union {
> __u64 data_ptr_
> void *data_ptr;
> };

No, that really does not work. It's important for all members of the ioctl data
structure to have a fixed size, independent of the size of long or pointer.

If you do a union, the pointer ends up in the first 32 bits of the 64 bit member,
which does not work on big-endian architectures. It also doesn't work on 31
bit architectures, although that is a minor worry here.

Arnd