cregit-Linux how code gets into the kernel

Release 4.18 fs/sysfs/mount.c

Directory: fs/sysfs
// SPDX-License-Identifier: GPL-2.0
/*
 * fs/sysfs/symlink.c - operations for initializing and mounting sysfs
 *
 * Copyright (c) 2001-3 Patrick Mochel
 * Copyright (c) 2007 SUSE Linux Products GmbH
 * Copyright (c) 2007 Tejun Heo <teheo@suse.de>
 *
 * Please see Documentation/filesystems/sysfs.txt for more information.
 */

#include <linux/fs.h>
#include <linux/magic.h>
#include <linux/mount.h>
#include <linux/init.h>
#include <linux/user_namespace.h>

#include "sysfs.h"


static struct kernfs_root *sysfs_root;

struct kernfs_node *sysfs_root_kn;


static struct dentry *sysfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { struct dentry *root; void *ns; bool new_sb = false; if (!(flags & SB_KERNMOUNT)) { if (!kobj_ns_current_may_mount(KOBJ_NS_TYPE_NET)) return ERR_PTR(-EPERM); } ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); root = kernfs_mount_ns(fs_type, flags, sysfs_root, SYSFS_MAGIC, &new_sb, ns); if (!new_sb) kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); else if (!IS_ERR(root)) root->d_sb->s_iflags |= SB_I_USERNS_VISIBLE; return root; }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann4133.61%535.71%
Tejun Heo3931.97%214.29%
Patrick Mochel1915.57%17.14%
Al Viro119.02%214.29%
Li Zefan86.56%17.14%
Jianyu Zhan21.64%17.14%
Andries E. Brouwer10.82%17.14%
Linus Torvalds10.82%17.14%
Total122100.00%14100.00%


static void sysfs_kill_sb(struct super_block *sb) { void *ns = (void *)kernfs_super_ns(sb); kernfs_kill_sb(sb); kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); }

Contributors

PersonTokensPropCommitsCommitProp
Tejun Heo2672.22%266.67%
Eric W. Biedermann1027.78%133.33%
Total36100.00%3100.00%

static struct file_system_type sysfs_fs_type = { .name = "sysfs", .mount = sysfs_mount, .kill_sb = sysfs_kill_sb, .fs_flags = FS_USERNS_MOUNT, };
int __init sysfs_init(void) { int err; sysfs_root = kernfs_create_root(NULL, KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK, NULL); if (IS_ERR(sysfs_root)) return PTR_ERR(sysfs_root); sysfs_root_kn = sysfs_root->kn; err = register_filesystem(&sysfs_fs_type); if (err) { kernfs_destroy_root(sysfs_root); return err; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Tejun Heo5278.79%777.78%
Patrick Mochel1116.67%111.11%
Peter Zijlstra34.55%111.11%
Total66100.00%9100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Tejun Heo12544.33%1035.71%
Eric W. Biedermann6021.28%621.43%
Patrick Mochel5720.21%13.57%
Al Viro134.61%27.14%
Li Zefan82.84%13.57%
Jianyu Zhan51.77%13.57%
Andrew Morton31.06%13.57%
Peter Zijlstra31.06%13.57%
David S. Miller31.06%13.57%
Greg Kroah-Hartman20.71%13.57%
Qinghuang Feng10.35%13.57%
Linus Torvalds10.35%13.57%
Andries E. Brouwer10.35%13.57%
Total282100.00%28100.00%
Directory: fs/sysfs
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.