summaryrefslogtreecommitdiff
path: root/include/linux/usb
diff options
context:
space:
mode:
authorHemant Kumar <hemantk@codeaurora.org>2016-05-02 10:57:12 -0700
committerKyle Yan <kyan@codeaurora.org>2016-06-10 15:14:01 -0700
commitff1259b38e88824ec1c8208091e475c55d6f8204 (patch)
treea7a64b39aa32f639f5123d54da13c6e235348d9f /include/linux/usb
parent78ece44dc6d8c93e1f5ba4b87a20a7ea08d7a6be (diff)
USB: gadget: Implement COMPAT_IOCTL for ioctls
32-bit userspace calling into 64-bit kernel cause different ioctl codes to get generated. The different ioctl code gets generated because sizeof is used on mtp and accessory structures which is different for 32/64 compilation. Because of this, 64-bit kernel can never execute the right ioctl command. Implement compat_ioctl to handle such execution environment. Change-Id: I26cc10986e28a28eab6f3c65f28f4d2b808112d9 Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/f_mtp.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/usb/f_mtp.h b/include/linux/usb/f_mtp.h
index 4e8417791bea..8def1431f03e 100644
--- a/include/linux/usb/f_mtp.h
+++ b/include/linux/usb/f_mtp.h
@@ -19,5 +19,35 @@
#define __LINUX_USB_F_MTP_H
#include <uapi/linux/usb/f_mtp.h>
+#include <linux/ioctl.h>
+#ifdef CONFIG_COMPAT
+#include <linux/compat.h>
+#endif
+#ifdef __KERNEL__
+
+#ifdef CONFIG_COMPAT
+struct __compat_mtp_file_range {
+ compat_int_t fd;
+ compat_loff_t offset;
+ int64_t length;
+ uint16_t command;
+ uint32_t transaction_id;
+};
+
+struct __compat_mtp_event {
+ compat_size_t length;
+ compat_caddr_t data;
+};
+
+#define COMPAT_MTP_SEND_FILE _IOW('M', 0, \
+ struct __compat_mtp_file_range)
+#define COMPAT_MTP_RECEIVE_FILE _IOW('M', 1, \
+ struct __compat_mtp_file_range)
+#define COMPAT_MTP_SEND_EVENT _IOW('M', 3, \
+ struct __compat_mtp_event)
+#define COMPAT_MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, \
+ struct __compat_mtp_file_range)
+#endif
+#endif
#endif /* __LINUX_USB_F_MTP_H */