Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9bb4882 authored by Eric W. Biederman's avatar Eric W. Biederman
Browse files

sysfs: Create mountpoints with sysfs_create_mount_point



This allows for better documentation in the code and
it allows for a simpler and fully correct version of
fs_fully_visible to be written.

The mount points converted and their filesystems are:
/sys/hypervisor/s390/       s390_hypfs
/sys/kernel/config/         configfs
/sys/kernel/debug/          debugfs
/sys/firmware/efi/efivars/  efivarfs
/sys/fs/fuse/connections/   fusectl
/sys/fs/pstore/             pstore
/sys/kernel/tracing/        tracefs
/sys/fs/cgroup/             cgroup
/sys/kernel/security/       securityfs
/sys/fs/selinux/            selinuxfs
/sys/fs/smackfs/            smackfs

Cc: stable@vger.kernel.org
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 87d2846f
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -456,8 +456,6 @@ static const struct super_operations hypfs_s_ops = {
	.show_options	= hypfs_show_options,
};

static struct kobject *s390_kobj;

static int __init hypfs_init(void)
{
	int rc;
@@ -481,18 +479,16 @@ static int __init hypfs_init(void)
		rc = -ENODATA;
		goto fail_hypfs_sprp_exit;
	}
	s390_kobj = kobject_create_and_add("s390", hypervisor_kobj);
	if (!s390_kobj) {
		rc = -ENOMEM;
	rc = sysfs_create_mount_point(hypervisor_kobj, "s390");
	if (rc)
		goto fail_hypfs_diag0c_exit;
	}
	rc = register_filesystem(&hypfs_type);
	if (rc)
		goto fail_filesystem;
	return 0;

fail_filesystem:
	kobject_put(s390_kobj);
	sysfs_remove_mount_point(hypervisor_kobj, "s390");
fail_hypfs_diag0c_exit:
	hypfs_diag0c_exit();
fail_hypfs_sprp_exit:
@@ -510,7 +506,7 @@ static int __init hypfs_init(void)
static void __exit hypfs_exit(void)
{
	unregister_filesystem(&hypfs_type);
	kobject_put(s390_kobj);
	sysfs_remove_mount_point(hypervisor_kobj, "s390");
	hypfs_diag0c_exit();
	hypfs_sprp_exit();
	hypfs_vm_exit();
+2 −4
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ static int __init parse_efi_cmdline(char *str)
early_param("efi", parse_efi_cmdline);

static struct kobject *efi_kobj;
static struct kobject *efivars_kobj;

/*
 * Let's not leave out systab information that snuck into
@@ -212,10 +211,9 @@ static int __init efisubsys_init(void)
		goto err_remove_group;

	/* and the standard mountpoint for efivarfs */
	efivars_kobj = kobject_create_and_add("efivars", efi_kobj);
	if (!efivars_kobj) {
	error = sysfs_create_mount_point(efi_kobj, "efivars");
	if (error) {
		pr_err("efivars: Subsystem registration failed.\n");
		error = -ENOMEM;
		goto err_remove_group;
	}

+4 −6
Original line number Diff line number Diff line
@@ -129,8 +129,6 @@ void configfs_release_fs(void)
}


static struct kobject *config_kobj;

static int __init configfs_init(void)
{
	int err = -ENOMEM;
@@ -141,8 +139,8 @@ static int __init configfs_init(void)
	if (!configfs_dir_cachep)
		goto out;

	config_kobj = kobject_create_and_add("config", kernel_kobj);
	if (!config_kobj)
	err = sysfs_create_mount_point(kernel_kobj, "config");
	if (err)
		goto out2;

	err = register_filesystem(&configfs_fs_type);
@@ -152,7 +150,7 @@ static int __init configfs_init(void)
	return 0;
out3:
	pr_err("Unable to register filesystem!\n");
	kobject_put(config_kobj);
	sysfs_remove_mount_point(kernel_kobj, "config");
out2:
	kmem_cache_destroy(configfs_dir_cachep);
	configfs_dir_cachep = NULL;
@@ -163,7 +161,7 @@ static int __init configfs_init(void)
static void __exit configfs_exit(void)
{
	unregister_filesystem(&configfs_fs_type);
	kobject_put(config_kobj);
	sysfs_remove_mount_point(kernel_kobj, "config");
	kmem_cache_destroy(configfs_dir_cachep);
	configfs_dir_cachep = NULL;
}
+4 −7
Original line number Diff line number Diff line
@@ -716,20 +716,17 @@ bool debugfs_initialized(void)
}
EXPORT_SYMBOL_GPL(debugfs_initialized);


static struct kobject *debug_kobj;

static int __init debugfs_init(void)
{
	int retval;

	debug_kobj = kobject_create_and_add("debug", kernel_kobj);
	if (!debug_kobj)
		return -EINVAL;
	retval = sysfs_create_mount_point(kernel_kobj, "debug");
	if (retval)
		return retval;

	retval = register_filesystem(&debug_fs_type);
	if (retval)
		kobject_put(debug_kobj);
		sysfs_remove_mount_point(kernel_kobj, "debug");
	else
		debugfs_registered = true;

+3 −6
Original line number Diff line number Diff line
@@ -1238,7 +1238,6 @@ static void fuse_fs_cleanup(void)
}

static struct kobject *fuse_kobj;
static struct kobject *connections_kobj;

static int fuse_sysfs_init(void)
{
@@ -1250,11 +1249,9 @@ static int fuse_sysfs_init(void)
		goto out_err;
	}

	connections_kobj = kobject_create_and_add("connections", fuse_kobj);
	if (!connections_kobj) {
		err = -ENOMEM;
	err = sysfs_create_mount_point(fuse_kobj, "connections");
	if (err)
		goto out_fuse_unregister;
	}

	return 0;

@@ -1266,7 +1263,7 @@ static int fuse_sysfs_init(void)

static void fuse_sysfs_cleanup(void)
{
	kobject_put(connections_kobj);
	sysfs_remove_mount_point(fuse_kobj, "connections");
	kobject_put(fuse_kobj);
}

Loading