diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/dir.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 0b45ff42f374..94374e435025 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, | |||
121 | 121 | ||
122 | return kernfs_rename_ns(kn, new_parent, kn->name, new_ns); | 122 | return kernfs_rename_ns(kn, new_parent, kn->name, new_ns); |
123 | } | 123 | } |
124 | |||
125 | /** | ||
126 | * sysfs_create_mount_point - create an always empty directory | ||
127 | * @parent_kobj: kobject that will contain this always empty directory | ||
128 | * @name: The name of the always empty directory to add | ||
129 | */ | ||
130 | int sysfs_create_mount_point(struct kobject *parent_kobj, const char *name) | ||
131 | { | ||
132 | struct kernfs_node *kn, *parent = parent_kobj->sd; | ||
133 | |||
134 | kn = kernfs_create_empty_dir(parent, name); | ||
135 | if (IS_ERR(kn)) { | ||
136 | if (PTR_ERR(kn) == -EEXIST) | ||
137 | sysfs_warn_dup(parent, name); | ||
138 | return PTR_ERR(kn); | ||
139 | } | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | EXPORT_SYMBOL_GPL(sysfs_create_mount_point); | ||
144 | |||
145 | /** | ||
146 | * sysfs_remove_mount_point - remove an always empty directory. | ||
147 | * @parent_kobj: kobject that will contain this always empty directory | ||
148 | * @name: The name of the always empty directory to remove | ||
149 | * | ||
150 | */ | ||
151 | void sysfs_remove_mount_point(struct kobject *parent_kobj, const char *name) | ||
152 | { | ||
153 | struct kernfs_node *parent = parent_kobj->sd; | ||
154 | |||
155 | kernfs_remove_by_name_ns(parent, name, NULL); | ||
156 | } | ||
157 | EXPORT_SYMBOL_GPL(sysfs_remove_mount_point); | ||