On Thu, Aug 15, 2019 at 02:04:06PM -0700, Omar Sandoval wrote:
>  #define BTRFS_IOC_SEND_32 _IOW(BTRFS_IOCTL_MAGIC, 38, \
>                              struct btrfs_ioctl_send_args_32)
> +
> +struct btrfs_ioctl_compressed_pwrite_args_32 {
> +     __u64 offset;           /* in */
> +     __u32 compressed_len;   /* in */
> +     __u32 orig_len;         /* in */
> +     __u32 compress_type;    /* in */
> +     __u32 reserved[9];
> +     compat_uptr_t buf;      /* in */
> +} __attribute__ ((__packed__));
> +
> +#define BTRFS_IOC_COMPRESSED_PWRITE_32 _IOW(BTRFS_IOCTL_MAGIC, 63, \
> +                              struct btrfs_ioctl_compressed_pwrite_args_32)

Note that the _32 is a workaround for a mistake in the send ioctl
definitions that slipped trhough. Any pointer in the structure changes
the ioctl number on 32bit and 64bit.

But as the raw data ioctl is new there's point to copy the mistake. The
alignment and width can be forced eg. like

> +     void __user *buf;       /* in */

        union {
                void __user *buf;
                __u64 __buf_alignment;
        };

This allows to user buf as a buffer without casts to a intermediate
type.

Reply via email to