X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=ioctl.h;h=709e996f401c32fc625106fc15f105ba1fe7f835;hb=dc06cda3d6afb4fad5ddfd1508a33f79c2e68efb;hp=dafb756b632deeb3549cc66f74f6ad80097bdb28;hpb=bbda9a2892351ab14c90824c4c7b15c11c640512;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/ioctl.h b/ioctl.h index dafb756..709e996 100644 --- a/ioctl.h +++ b/ioctl.h @@ -25,11 +25,17 @@ extern "C" { #include #include +#include #ifndef __user #define __user #endif +/* We don't want to include entire kerncompat.h */ +#ifndef BUILD_ASSERT +#define BUILD_ASSERT(x) +#endif + #define BTRFS_IOCTL_MAGIC 0x94 #define BTRFS_VOL_NAME_MAX 255 @@ -635,8 +641,8 @@ struct btrfs_ioctl_send_args { __u64 reserved[4]; /* in */ }; /* - * Size of structure depends on pointer width, was not caught. Kernel handles - * pointer width differences transparently + * Size of structure depends on pointer width, was not caught in the early + * days. Kernel handles pointer width differences transparently. */ BUILD_ASSERT(sizeof(__u64 *) == 8 ? sizeof(struct btrfs_ioctl_send_args) == 72 @@ -644,6 +650,28 @@ BUILD_ASSERT(sizeof(__u64 *) == 8 ? sizeof(struct btrfs_ioctl_send_args) == 68 : 0)); +/* + * Different pointer width leads to structure size change. Kernel should accept + * both ioctl values (derived from the structures) for backward compatibility. + * Size of this structure is same on 32bit and 64bit though. + * + * NOTE: do not use in your code, this is for testing only + */ +struct btrfs_ioctl_send_args_64 { + __s64 send_fd; /* in */ + __u64 clone_sources_count; /* in */ + union { + __u64 __user *clone_sources; /* in */ + __u64 __clone_sources_alignment; + }; + __u64 parent_root; /* in */ + __u64 flags; /* in */ + __u64 reserved[4]; /* in */ +} __attribute__((packed)); +BUILD_ASSERT(sizeof(struct btrfs_ioctl_send_args_64) == 72); + +#define BTRFS_IOC_SEND_64_COMPAT_DEFINED 1 + /* Error codes as returned by the kernel */ enum btrfs_err_code { notused, @@ -761,6 +789,11 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code) struct btrfs_ioctl_received_subvol_args_32) #endif +#ifdef BTRFS_IOC_SEND_64_COMPAT_DEFINED +#define BTRFS_IOC_SEND_64 _IOW(BTRFS_IOCTL_MAGIC, 38, \ + struct btrfs_ioctl_send_args_64) +#endif + #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args) #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \ struct btrfs_ioctl_vol_args)