Skip to content
Snippets Groups Projects
Select Git revision
  • f1f76f865b5f66db5b5c7f2d19874f2bb9b43b8d
  • master default protected
  • android-msm-bullhead-3.10-nougat_kgdb_less_changes
  • android-msm-bullhead-3.10-nougat_kgdb
  • android-msm-bullhead-3.10-nougat_klist
  • android-4.4
  • android-msm-vega-4.4-oreo-daydream
  • android-msm-wahoo-4.4-p-preview-5
  • android-msm-wahoo-4.4-pie
  • android-msm-marlin-3.18-p-preview-5
  • android-msm-marlin-3.18-pie
  • android-msm-wahoo-2018.07-oreo-m2
  • android-msm-wahoo-2018.07-oreo-m4
  • android-msm-wahoo-4.4-p-preview-4
  • android-msm-bullhead-3.10-oreo-m6
  • android-msm-angler-3.10-oreo-m6
  • android-msm-marlin-3.18-p-preview-4
  • android-msm-stargazer-3.18-oreo-wear-dr
  • android-msm-catshark-3.18-oreo-wear-dr
  • android-msm-wahoo-4.4-oreo-m2
  • android-msm-wahoo-4.4-oreo-m4
  • android-daydreamos-8.0.0_r0.5
  • android-8.1.0_r0.92
  • android-8.1.0_r0.91
  • android-daydreamos-8.0.0_r0.4
  • android-p-preview-5_r0.2
  • android-p-preview-5_r0.1
  • android-9.0.0_r0.5
  • android-9.0.0_r0.4
  • android-9.0.0_r0.2
  • android-9.0.0_r0.1
  • android-8.1.0_r0.81
  • android-8.1.0_r0.80
  • android-8.1.0_r0.78
  • android-8.1.0_r0.76
  • android-8.1.0_r0.75
  • android-8.1.0_r0.72
  • android-8.1.0_r0.70
  • android-p-preview-4_r0.2
  • android-p-preview-4_r0.1
  • android-wear-8.0.0_r0.30
41 results

devtmpfs.c

Blame
  • devtmpfs.c 7.62 KiB
    /*
     * devtmpfs - kernel-maintained tmpfs-based /dev
     *
     * Copyright (C) 2009, Kay Sievers <kay.sievers@vrfy.org>
     *
     * 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 the name of the
     * device, owned by root and have a default mode of 0600. Subsystems
     * can overwrite the default setting if needed.
     */
    
    #include <linux/kernel.h>
    #include <linux/syscalls.h>
    #include <linux/mount.h>
    #include <linux/device.h>
    #include <linux/genhd.h>
    #include <linux/namei.h>
    #include <linux/fs.h>
    #include <linux/shmem_fs.h>
    #include <linux/cred.h>
    #include <linux/sched.h>
    #include <linux/init_task.h>
    
    static struct vfsmount *dev_mnt;
    
    #if defined CONFIG_DEVTMPFS_MOUNT
    static int dev_mount = 1;
    #else
    static int dev_mount;
    #endif
    
    static DEFINE_MUTEX(dirlock);
    
    static int __init mount_param(char *str)
    {
    	dev_mount = simple_strtoul(str, NULL, 0);
    	return 1;
    }
    __setup("devtmpfs.mount=", mount_param);
    
    static int dev_get_sb(struct file_system_type *fs_type, int flags,
    		      const char *dev_name, void *data, struct vfsmount *mnt)
    {
    	return get_sb_single(fs_type, flags, data, shmem_fill_super, mnt);
    }
    
    static struct file_system_type dev_fs_type = {
    	.name = "devtmpfs",
    	.get_sb = dev_get_sb,
    	.kill_sb = kill_litter_super,
    };
    
    #ifdef CONFIG_BLOCK
    static inline int is_blockdev(struct device *dev)
    {
    	return dev->class == &block_class;
    }
    #else
    static inline int is_blockdev(struct device *dev) { return 0; }
    #endif
    
    static int dev_mkdir(const char *name, mode_t mode)
    {
    	struct nameidata nd;
    	struct dentry *dentry;
    	int err;