1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef _LINUX_BINDER_INTERNAL_H
4 #define _LINUX_BINDER_INTERNAL_H
5 
6 #include <linux/export.h>
7 #include <linux/fs.h>
8 #include <linux/list.h>
9 #include <linux/miscdevice.h>
10 #include <linux/mutex.h>
11 #include <linux/stddef.h>
12 #include <linux/types.h>
13 #include <linux/uidgid.h>
14 
15 struct binder_context {
16 	struct binder_node *binder_context_mgr_node;
17 	struct mutex context_mgr_node_lock;
18 	kuid_t binder_context_mgr_uid;
19 	const char *name;
20 };
21 
22 /**
23  * struct binder_device - information about a binder device node
24  * @hlist:          list of binder devices (only used for devices requested via
25  *                  CONFIG_ANDROID_BINDER_DEVICES)
26  * @miscdev:        information about a binder character device node
27  * @context:        binder context information
28  * @binderfs_inode: This is the inode of the root dentry of the super block
29  *                  belonging to a binderfs mount.
30  */
31 struct binder_device {
32 	struct hlist_node hlist;
33 	struct miscdevice miscdev;
34 	struct binder_context context;
35 	struct inode *binderfs_inode;
36 };
37 
38 extern const struct file_operations binder_fops;
39 
40 #ifdef CONFIG_ANDROID_BINDERFS
41 extern bool is_binderfs_device(const struct inode *inode);
42 #else
43 static inline bool is_binderfs_device(const struct inode *inode)
44 {
45 	return false;
46 }
47 #endif
48 
49 #ifdef CONFIG_ANDROID_BINDERFS
50 extern int __init init_binderfs(void);
51 #else
52 static inline int __init init_binderfs(void)
53 {
54 	return 0;
55 }
56 #endif
57 
58 #endif /* _LINUX_BINDER_INTERNAL_H */
59