Release 4.18 fs/sysfs/mount.c
// 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
| Person | Tokens | Prop | Commits | CommitProp |
| Eric W. Biedermann | 41 | 33.61% | 5 | 35.71% |
| Tejun Heo | 39 | 31.97% | 2 | 14.29% |
| Patrick Mochel | 19 | 15.57% | 1 | 7.14% |
| Al Viro | 11 | 9.02% | 2 | 14.29% |
| Li Zefan | 8 | 6.56% | 1 | 7.14% |
| Jianyu Zhan | 2 | 1.64% | 1 | 7.14% |
| Andries E. Brouwer | 1 | 0.82% | 1 | 7.14% |
| Linus Torvalds | 1 | 0.82% | 1 | 7.14% |
| Total | 122 | 100.00% | 14 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
| Tejun Heo | 26 | 72.22% | 2 | 66.67% |
| Eric W. Biedermann | 10 | 27.78% | 1 | 33.33% |
| Total | 36 | 100.00% | 3 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
| Tejun Heo | 52 | 78.79% | 7 | 77.78% |
| Patrick Mochel | 11 | 16.67% | 1 | 11.11% |
| Peter Zijlstra | 3 | 4.55% | 1 | 11.11% |
| Total | 66 | 100.00% | 9 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
| Tejun Heo | 125 | 44.33% | 10 | 35.71% |
| Eric W. Biedermann | 60 | 21.28% | 6 | 21.43% |
| Patrick Mochel | 57 | 20.21% | 1 | 3.57% |
| Al Viro | 13 | 4.61% | 2 | 7.14% |
| Li Zefan | 8 | 2.84% | 1 | 3.57% |
| Jianyu Zhan | 5 | 1.77% | 1 | 3.57% |
| Andrew Morton | 3 | 1.06% | 1 | 3.57% |
| Peter Zijlstra | 3 | 1.06% | 1 | 3.57% |
| David S. Miller | 3 | 1.06% | 1 | 3.57% |
| Greg Kroah-Hartman | 2 | 0.71% | 1 | 3.57% |
| Qinghuang Feng | 1 | 0.35% | 1 | 3.57% |
| Linus Torvalds | 1 | 0.35% | 1 | 3.57% |
| Andries E. Brouwer | 1 | 0.35% | 1 | 3.57% |
| Total | 282 | 100.00% | 28 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.