diff options
| author | Martijn Coenen <maco@google.com> | 2017-02-03 17:40:52 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-10 10:00:01 -0500 |
| commit | def95c73567dfacb22900cd0c4f01caff39e4c9e (patch) | |
| tree | 51170d04c159795218cba54d99a4cec8d3c97462 /include/uapi/linux/android | |
| parent | 7980240b6d63e0694f5023c29cbc648fafdf3e23 (diff) | |
binder: Add support for file-descriptor arrays
This patch introduces a new binder_fd_array object,
that allows us to support one or more file descriptors
embedded in a buffer that is scatter-gathered.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Martijn Coenen <maco@google.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Dmitry Shmidt <dimitrysh@google.com>
Cc: Rom Lemarchand <romlem@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Martijn Coenen <maco@google.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/uapi/linux/android')
| -rw-r--r-- | include/uapi/linux/android/binder.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index f3ef6e2634ba..51f891fb1b18 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h | |||
| @@ -33,6 +33,7 @@ enum { | |||
| 33 | BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), | 33 | BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), |
| 34 | BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), | 34 | BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), |
| 35 | BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), | 35 | BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), |
| 36 | BINDER_TYPE_FDA = B_PACK_CHARS('f', 'd', 'a', B_TYPE_LARGE), | ||
| 36 | BINDER_TYPE_PTR = B_PACK_CHARS('p', 't', '*', B_TYPE_LARGE), | 37 | BINDER_TYPE_PTR = B_PACK_CHARS('p', 't', '*', B_TYPE_LARGE), |
| 37 | }; | 38 | }; |
| 38 | 39 | ||
| @@ -129,6 +130,33 @@ enum { | |||
| 129 | BINDER_BUFFER_FLAG_HAS_PARENT = 0x01, | 130 | BINDER_BUFFER_FLAG_HAS_PARENT = 0x01, |
| 130 | }; | 131 | }; |
| 131 | 132 | ||
| 133 | /* struct binder_fd_array_object - object describing an array of fds in a buffer | ||
| 134 | * @hdr: common header structure | ||
| 135 | * @num_fds: number of file descriptors in the buffer | ||
| 136 | * @parent: index in offset array to buffer holding the fd array | ||
| 137 | * @parent_offset: start offset of fd array in the buffer | ||
| 138 | * | ||
| 139 | * A binder_fd_array object represents an array of file | ||
| 140 | * descriptors embedded in a binder_buffer_object. It is | ||
| 141 | * different from a regular binder_buffer_object because it | ||
| 142 | * describes a list of file descriptors to fix up, not an opaque | ||
| 143 | * blob of memory, and hence the kernel needs to treat it differently. | ||
| 144 | * | ||
| 145 | * An example of how this would be used is with Android's | ||
| 146 | * native_handle_t object, which is a struct with a list of integers | ||
| 147 | * and a list of file descriptors. The native_handle_t struct itself | ||
| 148 | * will be represented by a struct binder_buffer_objct, whereas the | ||
| 149 | * embedded list of file descriptors is represented by a | ||
| 150 | * struct binder_fd_array_object with that binder_buffer_object as | ||
| 151 | * a parent. | ||
| 152 | */ | ||
| 153 | struct binder_fd_array_object { | ||
| 154 | struct binder_object_header hdr; | ||
| 155 | binder_size_t num_fds; | ||
| 156 | binder_size_t parent; | ||
| 157 | binder_size_t parent_offset; | ||
| 158 | }; | ||
| 159 | |||
| 132 | /* | 160 | /* |
| 133 | * On 64-bit platforms where user code may run in 32-bits the driver must | 161 | * On 64-bit platforms where user code may run in 32-bits the driver must |
| 134 | * translate the buffer (and local binder) addresses appropriately. | 162 | * translate the buffer (and local binder) addresses appropriately. |
