[CFT][PATCH 08/10] sysfs: Add support for permanently empty directories.
gregkh at linuxfoundation.org
Thu May 14 20:31:31 UTC 2015
On Thu, May 14, 2015 at 12:35:02PM -0500, Eric W. Biederman wrote:
> Add two functions sysfs_create_empty_dir and sysfs_remove_empty_dir
> that hang a permanently empty directory off of a kobject or remove
> a permanently emptpy directory hanging from a kobject. Export
> these new functions so modular filesystems can use them.
> As all permanently empty directories are, are names and used
> for mouting other filesystems this seems like the right abstraction.
That sentence doesn't make much sense, cut and paste?
> Cc: stable at vger.kernel.org
> Signed-off-by: "Eric W. Biederman" <ebiederm at xmission.com>
> fs/sysfs/dir.c | 34 ++++++++++++++++++++++++++++++++++
> include/linux/sysfs.h | 16 ++++++++++++++++
> 2 files changed, 50 insertions(+)
> diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
> index 0b45ff42f374..8244741474d7 100644
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -121,3 +121,37 @@ int sysfs_move_dir_ns(struct kobject *kobj, struct kobject *new_parent_kobj,
> return kernfs_rename_ns(kn, new_parent, kn->name, new_ns);
> + * sysfs_create_empty_dir - create an always empty directory
> + * @parent_kobj: kobject that will contain this always empty directory
> + * @name: The name of the always empty directory to add
> + */
> +int sysfs_create_empty_dir(struct kobject *parent_kobj, const char *name)
As this really is just a mount point, how about we be explicit with
this and call the function:
That makes more sense in the long run, otherwise if you just want to
create an empty directory in sysfs, you can do so without making an
"empty" kobject and some people might do that accidentally in the
future. This makes it more obvious as to what is going on.
More information about the Containers