1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef _LINUX_BINDER_INTERNAL_H
4 #define _LINUX_BINDER_INTERNAL_H
6 #include <linux/export.h>
8 #include <linux/list.h>
9 #include <linux/miscdevice.h>
10 #include <linux/mutex.h>
11 #include <linux/refcount.h>
12 #include <linux/stddef.h>
13 #include <linux/types.h>
14 #include <linux/uidgid.h>
16 struct binder_context
{
17 struct binder_node
*binder_context_mgr_node
;
18 struct mutex context_mgr_node_lock
;
19 kuid_t binder_context_mgr_uid
;
24 * struct binder_device - information about a binder device node
25 * @hlist: list of binder devices (only used for devices requested via
26 * CONFIG_ANDROID_BINDER_DEVICES)
27 * @miscdev: information about a binder character device node
28 * @context: binder context information
29 * @binderfs_inode: This is the inode of the root dentry of the super block
30 * belonging to a binderfs mount.
32 struct binder_device
{
33 struct hlist_node hlist
;
34 struct miscdevice miscdev
;
35 struct binder_context context
;
36 struct inode
*binderfs_inode
;
41 * binderfs_mount_opts - mount options for binderfs
42 * @max: maximum number of allocatable binderfs binder devices
43 * @stats_mode: enable binder stats in binderfs.
45 struct binderfs_mount_opts
{
51 * binderfs_info - information about a binderfs mount
52 * @ipc_ns: The ipc namespace the binderfs mount belongs to.
53 * @control_dentry: This records the dentry of this binderfs mount
54 * binder-control device.
55 * @root_uid: uid that needs to be used when a new binder device is
57 * @root_gid: gid that needs to be used when a new binder device is
59 * @mount_opts: The mount options in use.
60 * @device_count: The current number of allocated binder devices.
61 * @proc_log_dir: Pointer to the directory dentry containing process-specific
64 struct binderfs_info
{
65 struct ipc_namespace
*ipc_ns
;
66 struct dentry
*control_dentry
;
69 struct binderfs_mount_opts mount_opts
;
71 struct dentry
*proc_log_dir
;
74 extern const struct file_operations binder_fops
;
76 extern char *binder_devices_param
;
78 #ifdef CONFIG_ANDROID_BINDERFS
79 extern bool is_binderfs_device(const struct inode
*inode
);
80 extern struct dentry
*binderfs_create_file(struct dentry
*dir
, const char *name
,
81 const struct file_operations
*fops
,
83 extern void binderfs_remove_file(struct dentry
*dentry
);
85 static inline bool is_binderfs_device(const struct inode
*inode
)
89 static inline struct dentry
*binderfs_create_file(struct dentry
*dir
,
91 const struct file_operations
*fops
,
96 static inline void binderfs_remove_file(struct dentry
*dentry
) {}
99 #ifdef CONFIG_ANDROID_BINDERFS
100 extern int __init
init_binderfs(void);
102 static inline int __init
init_binderfs(void)
108 int binder_stats_show(struct seq_file
*m
, void *unused
);
109 DEFINE_SHOW_ATTRIBUTE(binder_stats
);
111 int binder_state_show(struct seq_file
*m
, void *unused
);
112 DEFINE_SHOW_ATTRIBUTE(binder_state
);
114 int binder_transactions_show(struct seq_file
*m
, void *unused
);
115 DEFINE_SHOW_ATTRIBUTE(binder_transactions
);
117 int binder_transaction_log_show(struct seq_file
*m
, void *unused
);
118 DEFINE_SHOW_ATTRIBUTE(binder_transaction_log
);
120 struct binder_transaction_log_entry
{
132 int return_error_line
;
133 uint32_t return_error
;
134 uint32_t return_error_param
;
135 char context_name
[BINDERFS_MAX_NAME
+ 1];
138 struct binder_transaction_log
{
141 struct binder_transaction_log_entry entry
[32];
144 extern struct binder_transaction_log binder_transaction_log
;
145 extern struct binder_transaction_log binder_transaction_log_failed
;
146 #endif /* _LINUX_BINDER_INTERNAL_H */