linux/drivers/android/binderfs.c

// SPDX-License-Identifier: GPL-2.0

#include <linux/compiler_types.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/fsnotify.h>
#include <linux/gfp.h>
#include <linux/idr.h>
#include <linux/init.h>
#include <linux/ipc_namespace.h>
#include <linux/kdev_t.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/namei.h>
#include <linux/magic.h>
#include <linux/major.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/mount.h>
#include <linux/fs_parser.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/spinlock_types.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <linux/user_namespace.h>
#include <linux/xarray.h>
#include <uapi/linux/android/binder.h>
#include <uapi/linux/android/binderfs.h>

#include "binder_internal.h"

#define FIRST_INODE
#define SECOND_INODE
#define INODE_OFFSET
#define BINDERFS_MAX_MINOR
/* Ensure that the initial ipc namespace always has devices available. */
#define BINDERFS_MAX_MINOR_CAPPED

static dev_t binderfs_dev;
static DEFINE_MUTEX(binderfs_minors_mutex);
static DEFINE_IDA(binderfs_minors);

enum binderfs_param {};

enum binderfs_stats_mode {};

struct binder_features {};

static const struct constant_table binderfs_param_stats[] =;

static const struct fs_parameter_spec binderfs_fs_parameters[] =;

static struct binder_features binder_features =;

static inline struct binderfs_info *BINDERFS_SB(const struct super_block *sb)
{}

bool is_binderfs_device(const struct inode *inode)
{}

/**
 * binderfs_binder_device_create - allocate inode from super block of a
 *                                 binderfs mount
 * @ref_inode: inode from which the super block will be taken
 * @userp:     buffer to copy information about new device for userspace to
 * @req:       struct binderfs_device as copied from userspace
 *
 * This function allocates a new binder_device and reserves a new minor
 * number for it.
 * Minor numbers are limited and tracked globally in binderfs_minors. The
 * function will stash a struct binder_device for the specific binder
 * device in i_private of the inode.
 * It will go on to allocate a new inode from the super block of the
 * filesystem mount, stash a struct binder_device in its i_private field
 * and attach a dentry to that inode.
 *
 * Return: 0 on success, negative errno on failure
 */
static int binderfs_binder_device_create(struct inode *ref_inode,
					 struct binderfs_device __user *userp,
					 struct binderfs_device *req)
{}

/**
 * binder_ctl_ioctl - handle binder device node allocation requests
 *
 * The request handler for the binder-control device. All requests operate on
 * the binderfs mount the binder-control device resides in:
 * - BINDER_CTL_ADD
 *   Allocate a new binder device.
 *
 * Return: %0 on success, negative errno on failure.
 */
static long binder_ctl_ioctl(struct file *file, unsigned int cmd,
			     unsigned long arg)
{}

static void binderfs_evict_inode(struct inode *inode)
{}

static int binderfs_fs_context_parse_param(struct fs_context *fc,
					   struct fs_parameter *param)
{}

static int binderfs_fs_context_reconfigure(struct fs_context *fc)
{}

static int binderfs_show_options(struct seq_file *seq, struct dentry *root)
{}

static const struct super_operations binderfs_super_ops =;

static inline bool is_binderfs_control_device(const struct dentry *dentry)
{}

static int binderfs_rename(struct mnt_idmap *idmap,
			   struct inode *old_dir, struct dentry *old_dentry,
			   struct inode *new_dir, struct dentry *new_dentry,
			   unsigned int flags)
{}

static int binderfs_unlink(struct inode *dir, struct dentry *dentry)
{}

static const struct file_operations binder_ctl_fops =;

/**
 * binderfs_binder_ctl_create - create a new binder-control device
 * @sb: super block of the binderfs mount
 *
 * This function creates a new binder-control device node in the binderfs mount
 * referred to by @sb.
 *
 * Return: 0 on success, negative errno on failure
 */
static int binderfs_binder_ctl_create(struct super_block *sb)
{}

static const struct inode_operations binderfs_dir_inode_operations =;

static struct inode *binderfs_make_inode(struct super_block *sb, int mode)
{}

static struct dentry *binderfs_create_dentry(struct dentry *parent,
					     const char *name)
{}

void binderfs_remove_file(struct dentry *dentry)
{}

struct dentry *binderfs_create_file(struct dentry *parent, const char *name,
				    const struct file_operations *fops,
				    void *data)
{}

static struct dentry *binderfs_create_dir(struct dentry *parent,
					  const char *name)
{}

static int binder_features_show(struct seq_file *m, void *unused)
{}
DEFINE_SHOW_ATTRIBUTE();

static int init_binder_features(struct super_block *sb)
{}

static int init_binder_logs(struct super_block *sb)
{}

static int binderfs_fill_super(struct super_block *sb, struct fs_context *fc)
{}

static int binderfs_fs_context_get_tree(struct fs_context *fc)
{}

static void binderfs_fs_context_free(struct fs_context *fc)
{}

static const struct fs_context_operations binderfs_fs_context_ops =;

static int binderfs_init_fs_context(struct fs_context *fc)
{}

static void binderfs_kill_super(struct super_block *sb)
{}

static struct file_system_type binder_fs_type =;

int __init init_binderfs(void)
{}