History

binder: use enum for binder ioctls

All of the other constants in this file are defined using enums, so make the constants more consistent by defining the ioctls in an enum as well. This is necessary for Rust Binder since the _IO macros are too complicated for bindgen to see that they expand to integer constants. Replacing the #defines with an enum forces bindgen to evaluate them properly, which allows us to access them from Rust. I originally intended to include this change in the first patch of the Rust Binder patchset [1], but at plumbers Carlos Llamas told me that this change has been discussed previously [2] and suggested that I send it upstream separately.

Alice Ryhl committed 2 years ago

Commit 36347831 parent d6673781 file · +16 −14Browse files

Showing the changes to include/uapi/linux/android (1 of 1 file). Show all

Unified · Split

include/uapi/linux/android/binder.h+16−14
@@ -251,20 +251,22 @@ struct binder_extended_error { · 250 unmodified lines
251 __s32 param;251 __s32 param;
252};252};
253 253
254#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)254enum {
255#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)255 BINDER_WRITE_READ = _IOWR('b', 1, struct binder_write_read),
256#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)256 BINDER_SET_IDLE_TIMEOUT = _IOW('b', 3, __s64),
257#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)257 BINDER_SET_MAX_THREADS = _IOW('b', 5, __u32),
258#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)258 BINDER_SET_IDLE_PRIORITY = _IOW('b', 6, __s32),
259#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)259 BINDER_SET_CONTEXT_MGR = _IOW('b', 7, __s32),
260#define BINDER_VERSION _IOWR('b', 9, struct binder_version)260 BINDER_THREAD_EXIT = _IOW('b', 8, __s32),
261#define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info)261 BINDER_VERSION = _IOWR('b', 9, struct binder_version),
262#define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref)262 BINDER_GET_NODE_DEBUG_INFO = _IOWR('b', 11, struct binder_node_debug_info),
263#define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object)263 BINDER_GET_NODE_INFO_FOR_REF = _IOWR('b', 12, struct binder_node_info_for_ref),
264#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info)264 BINDER_SET_CONTEXT_MGR_EXT = _IOW('b', 13, struct flat_binder_object),
265#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info)265 BINDER_FREEZE = _IOW('b', 14, struct binder_freeze_info),
266#define BINDER_ENABLE_ONEWAY_SPAM_DETECTION _IOW('b', 16, __u32)266 BINDER_GET_FROZEN_INFO = _IOWR('b', 15, struct binder_frozen_status_info),
267#define BINDER_GET_EXTENDED_ERROR _IOWR('b', 17, struct binder_extended_error)267 BINDER_ENABLE_ONEWAY_SPAM_DETECTION = _IOW('b', 16, __u32),
268 BINDER_GET_EXTENDED_ERROR = _IOWR('b', 17, struct binder_extended_error),
269};
268 270
269/*271/*
270 * NOTE: Two special error codes you should check for when calling272 * NOTE: Two special error codes you should check for when calling

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t