linux/drivers/base/devtmpfs.c

// SPDX-License-Identifier: GPL-2.0
/*
 * devtmpfs - kernel-maintained tmpfs-based /dev
 *
 * Copyright (C) 2009, Kay Sievers <[email protected]>
 *
 * During bootup, before any driver core device is registered,
 * devtmpfs, a tmpfs-based filesystem is created. Every driver-core
 * device which requests a device node, will add a node in this
 * filesystem.
 * By default, all devices are named after the name of the device,
 * owned by root and have a default mode of 0600. Subsystems can
 * overwrite the default setting if needed.
 */

#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/syscalls.h>
#include <linux/mount.h>
#include <linux/device.h>
#include <linux/blkdev.h>
#include <linux/namei.h>
#include <linux/fs.h>
#include <linux/shmem_fs.h>
#include <linux/ramfs.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/kthread.h>
#include <linux/init_syscalls.h>
#include <uapi/linux/mount.h>
#include "base.h"

#ifdef CONFIG_DEVTMPFS_SAFE
#define DEVTMPFS_MFLAGS
#else
#define DEVTMPFS_MFLAGS
#endif

static struct task_struct *thread;

static int __initdata mount_dev = IS_ENABLED();

static DEFINE_SPINLOCK(req_lock);

static struct req {} *requests;

static int __init mount_param(char *str)
{}
__setup();

static struct vfsmount *mnt;

static struct dentry *public_dev_mount(struct file_system_type *fs_type, int flags,
		      const char *dev_name, void *data)
{}

static struct file_system_type internal_fs_type =;

static struct file_system_type dev_fs_type =;

static int devtmpfs_submit_req(struct req *req, const char *tmp)
{}

int devtmpfs_create_node(struct device *dev)
{}

int devtmpfs_delete_node(struct device *dev)
{}

static int dev_mkdir(const char *name, umode_t mode)
{}

static int create_path(const char *nodepath)
{}

static int handle_create(const char *nodename, umode_t mode, kuid_t uid,
			 kgid_t gid, struct device *dev)
{}

static int dev_rmdir(const char *name)
{}

static int delete_path(const char *nodepath)
{}

static int dev_mynode(struct device *dev, struct inode *inode, struct kstat *stat)
{}

static int handle_remove(const char *nodename, struct device *dev)
{}

/*
 * If configured, or requested by the commandline, devtmpfs will be
 * auto-mounted after the kernel mounted the root filesystem.
 */
int __init devtmpfs_mount(void)
{}

static __initdata DECLARE_COMPLETION(setup_done);

static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid,
		  struct device *dev)
{}

static void __noreturn devtmpfs_work_loop(void)
{}

static noinline int __init devtmpfs_setup(void *p)
{}

/*
 * The __ref is because devtmpfs_setup needs to be __init for the routines it
 * calls.  That call is done while devtmpfs_init, which is marked __init,
 * synchronously waits for it to complete.
 */
static int __ref devtmpfsd(void *p)
{}

/*
 * Create devtmpfs instance, driver-core devices will add their device
 * nodes here.
 */
int __init devtmpfs_init(void)
{}