Path: blob/master/drivers/android/binder/rust_binder_internal.h
29519 views
/* SPDX-License-Identifier: GPL-2.0 */1/* rust_binder_internal.h2*3* This file contains internal data structures used by Rust Binder. Mostly,4* these are type definitions used only by binderfs or things that Rust Binder5* define and export to binderfs.6*7* It does not include things exported by binderfs to Rust Binder since this8* file is not included as input to bindgen.9*10* Copyright (C) 2025 Google LLC.11*/1213#ifndef _LINUX_RUST_BINDER_INTERNAL_H14#define _LINUX_RUST_BINDER_INTERNAL_H1516#define RUST_BINDERFS_SUPER_MAGIC 0x6c6f6f711718#include <linux/seq_file.h>19#include <uapi/linux/android/binder.h>20#include <uapi/linux/android/binderfs.h>2122/*23* The internal data types in the Rust Binder driver are opaque to C, so we use24* void pointer typedefs for these types.25*/26typedef void *rust_binder_context;2728/**29* struct binder_device - information about a binder device node30* @minor: the minor number used by this device31* @ctx: the Rust Context used by this device, or null for binder-control32*33* This is used as the private data for files directly in binderfs, but not34* files in the binder_logs subdirectory. This struct owns a refcount on `ctx`35* and the entry for `minor` in `binderfs_minors`. For binder-control `ctx` is36* null.37*/38struct binder_device {39int minor;40rust_binder_context ctx;41};4243int rust_binder_stats_show(struct seq_file *m, void *unused);44int rust_binder_state_show(struct seq_file *m, void *unused);45int rust_binder_transactions_show(struct seq_file *m, void *unused);46int rust_binder_proc_show(struct seq_file *m, void *pid);4748extern const struct file_operations rust_binder_fops;49rust_binder_context rust_binder_new_context(char *name);50void rust_binder_remove_context(rust_binder_context device);5152/**53* binderfs_mount_opts - mount options for binderfs54* @max: maximum number of allocatable binderfs binder devices55* @stats_mode: enable binder stats in binderfs.56*/57struct binderfs_mount_opts {58int max;59int stats_mode;60};6162/**63* binderfs_info - information about a binderfs mount64* @ipc_ns: The ipc namespace the binderfs mount belongs to.65* @control_dentry: This records the dentry of this binderfs mount66* binder-control device.67* @root_uid: uid that needs to be used when a new binder device is68* created.69* @root_gid: gid that needs to be used when a new binder device is70* created.71* @mount_opts: The mount options in use.72* @device_count: The current number of allocated binder devices.73* @proc_log_dir: Pointer to the directory dentry containing process-specific74* logs.75*/76struct binderfs_info {77struct ipc_namespace *ipc_ns;78struct dentry *control_dentry;79kuid_t root_uid;80kgid_t root_gid;81struct binderfs_mount_opts mount_opts;82int device_count;83struct dentry *proc_log_dir;84};8586#endif /* _LINUX_RUST_BINDER_INTERNAL_H */878889