Skip to content

Commit fd20956

Browse files
ojedaintel-lab-lkp
authored andcommitted
binder: convert BINDER_* ioctl #defines into an enum
bindgen (a tool which generates the "raw" C bindings for Rust) only works (so far) with "simple" C `#define`s. In order to avoid having to manually maintain these constants in the (potential) Rust side, this patch converts them into an `enum`. There may be support in the future for expanding macros that end up in a "numeric" one: rust-lang/rust-bindgen#753. Co-developed-by: Wedson Almeida Filho <[email protected]> Signed-off-by: Wedson Almeida Filho <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 42226c9 commit fd20956

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

include/uapi/linux/android/binder.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,21 @@ struct binder_frozen_status_info {
236236
__u32 async_recv;
237237
};
238238

239-
#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
240-
#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
241-
#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
242-
#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)
243-
#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
244-
#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
245-
#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
246-
#define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info)
247-
#define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref)
248-
#define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object)
249-
#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info)
250-
#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info)
251-
#define BINDER_ENABLE_ONEWAY_SPAM_DETECTION _IOW('b', 16, __u32)
239+
enum {
240+
BINDER_WRITE_READ = _IOWR('b', 1, struct binder_write_read),
241+
BINDER_SET_IDLE_TIMEOUT = _IOW('b', 3, __s64),
242+
BINDER_SET_MAX_THREADS = _IOW('b', 5, __u32),
243+
BINDER_SET_IDLE_PRIORITY = _IOW('b', 6, __s32),
244+
BINDER_SET_CONTEXT_MGR = _IOW('b', 7, __s32),
245+
BINDER_THREAD_EXIT = _IOW('b', 8, __s32),
246+
BINDER_VERSION = _IOWR('b', 9, struct binder_version),
247+
BINDER_GET_NODE_DEBUG_INFO = _IOWR('b', 11, struct binder_node_debug_info),
248+
BINDER_GET_NODE_INFO_FOR_REF = _IOWR('b', 12, struct binder_node_info_for_ref),
249+
BINDER_SET_CONTEXT_MGR_EXT = _IOW('b', 13, struct flat_binder_object),
250+
BINDER_FREEZE = _IOW('b', 14, struct binder_freeze_info),
251+
BINDER_GET_FROZEN_INFO = _IOWR('b', 15, struct binder_frozen_status_info),
252+
BINDER_ENABLE_ONEWAY_SPAM_DETECTION = _IOW('b', 16, __u32),
253+
};
252254

253255
/*
254256
* NOTE: Two special error codes you should check for when calling

0 commit comments

Comments
 (0)