usb: ftp: fix the bug of ftp ioctrl args problem with 32bit userspace on 64bit platforms
[firefly-linux-kernel-4.4.55.git] / include / uapi / linux / usb / f_mtp.h
1 /*
2  * Gadget Function Driver for MTP
3  *
4  * Copyright (C) 2010 Google, Inc.
5  * Author: Mike Lockwood <lockwood@android.com>
6  *
7  * This software is licensed under the terms of the GNU General Public
8  * License version 2, as published by the Free Software Foundation, and
9  * may be copied, distributed, and modified under those terms.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  */
17
18 #ifndef _UAPI_LINUX_USB_F_MTP_H
19 #define _UAPI_LINUX_USB_F_MTP_H
20
21 #include <linux/ioctl.h>
22 #include <linux/types.h>
23
24 struct mtp_file_range {
25         /* file descriptor for file to transfer */
26         int                     fd;
27         /* offset in file for start of transfer */
28         loff_t          offset;
29         /* number of bytes to transfer */
30         int64_t         length;
31         /* MTP command ID for data header,
32          * used only for MTP_SEND_FILE_WITH_HEADER
33          */
34         uint16_t        command;
35         /* MTP transaction ID for data header,
36          * used only for MTP_SEND_FILE_WITH_HEADER
37          */
38         uint32_t        transaction_id;
39 };
40
41 /* support of 32bit userspace on 64bit platforms */
42 #ifdef CONFIG_COMPAT
43 struct mtp_event {
44         /* size of the event */
45         int32_t         length;
46         /* event data to send */
47         compat_uptr_t           data;
48 };
49 #else
50 struct mtp_event {
51         /* size of the event */
52         size_t          length;
53         /* event data to send */
54         void            *data;
55 };
56 #endif
57
58 /* Sends the specified file range to the host */
59 #define MTP_SEND_FILE              _IOW('M', 0, struct mtp_file_range)
60 /* Receives data from the host and writes it to a file.
61  * The file is created if it does not exist.
62  */
63 #define MTP_RECEIVE_FILE           _IOW('M', 1, struct mtp_file_range)
64 /* Sends an event to the host via the interrupt endpoint */
65 #define MTP_SEND_EVENT             _IOW('M', 3, struct mtp_event)
66 /* Sends the specified file range to the host,
67  * with a 12 byte MTP data packet header at the beginning.
68  */
69 #define MTP_SEND_FILE_WITH_HEADER  _IOW('M', 4, struct mtp_file_range)
70
71 #endif /* _UAPI_LINUX_USB_F_MTP_H */