aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kobject.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-07-31 06:15:08 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:51:03 -0400
commit90bc61359de0148f8627073d68a22edc7ed9893d (patch)
treeb054bf0cb9bda41dab498086216f4c0253b2c5ed /lib/kobject.c
parent869512ab5ab93e5e82ad7d4aaf4ed098d23bfc3f (diff)
sysfs: Remove first pass at shadow directory support
While shadow directories appear to be a good idea, the current scheme of controlling their creation and destruction outside of sysfs appears to be a locking and maintenance nightmare in the face of sysfs directories dynamically coming and going. Which can now occur for directories containing network devices when CONFIG_SYSFS_DEPRECATED is not set. This patch removes everything from the initial shadow directory support that allowed the shadow directory creation to be controlled at a higher level. So except for a few bits of sysfs_rename_dir everything from commit b592fcfe7f06c15ec11774b5be7ce0de3aa86e73 is now gone. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib/kobject.c')
-rw-r--r--lib/kobject.c44
1 files changed, 6 insertions, 38 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 10ae2ebeaf96..e8181d3cec34 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -44,11 +44,11 @@ static int populate_dir(struct kobject * kobj)
44 return error; 44 return error;
45} 45}
46 46
47static int create_dir(struct kobject *kobj, struct sysfs_dirent *shadow_parent) 47static int create_dir(struct kobject * kobj)
48{ 48{
49 int error = 0; 49 int error = 0;
50 if (kobject_name(kobj)) { 50 if (kobject_name(kobj)) {
51 error = sysfs_create_dir(kobj, shadow_parent); 51 error = sysfs_create_dir(kobj);
52 if (!error) { 52 if (!error) {
53 if ((error = populate_dir(kobj))) 53 if ((error = populate_dir(kobj)))
54 sysfs_remove_dir(kobj); 54 sysfs_remove_dir(kobj);
@@ -157,12 +157,11 @@ static void unlink(struct kobject * kobj)
157} 157}
158 158
159/** 159/**
160 * kobject_shadow_add - add an object to the hierarchy. 160 * kobject_add - add an object to the hierarchy.
161 * @kobj: object. 161 * @kobj: object.
162 * @shadow_parent: sysfs directory to add to.
163 */ 162 */
164 163
165int kobject_shadow_add(struct kobject *kobj, struct sysfs_dirent *shadow_parent) 164int kobject_add(struct kobject * kobj)
166{ 165{
167 int error = 0; 166 int error = 0;
168 struct kobject * parent; 167 struct kobject * parent;
@@ -194,7 +193,7 @@ int kobject_shadow_add(struct kobject *kobj, struct sysfs_dirent *shadow_parent)
194 kobj->parent = parent; 193 kobj->parent = parent;
195 } 194 }
196 195
197 error = create_dir(kobj, shadow_parent); 196 error = create_dir(kobj);
198 if (error) { 197 if (error) {
199 /* unlink does the kobject_put() for us */ 198 /* unlink does the kobject_put() for us */
200 unlink(kobj); 199 unlink(kobj);
@@ -216,16 +215,6 @@ int kobject_shadow_add(struct kobject *kobj, struct sysfs_dirent *shadow_parent)
216} 215}
217 216
218/** 217/**
219 * kobject_add - add an object to the hierarchy.
220 * @kobj: object.
221 */
222int kobject_add(struct kobject * kobj)
223{
224 return kobject_shadow_add(kobj, NULL);
225}
226
227
228/**
229 * kobject_register - initialize and add an object. 218 * kobject_register - initialize and add an object.
230 * @kobj: object in question. 219 * @kobj: object in question.
231 */ 220 */
@@ -334,7 +323,7 @@ int kobject_rename(struct kobject * kobj, const char *new_name)
334 /* Note : if we want to send the new name alone, not the full path, 323 /* Note : if we want to send the new name alone, not the full path,
335 * we could probably use kobject_name(kobj); */ 324 * we could probably use kobject_name(kobj); */
336 325
337 error = sysfs_rename_dir(kobj, kobj->parent->sd, new_name); 326 error = sysfs_rename_dir(kobj, new_name);
338 327
339 /* This function is mostly/only used for network interface. 328 /* This function is mostly/only used for network interface.
340 * Some hotplug package track interfaces by their name and 329 * Some hotplug package track interfaces by their name and
@@ -351,27 +340,6 @@ out:
351} 340}
352 341
353/** 342/**
354 * kobject_rename - change the name of an object
355 * @kobj: object in question.
356 * @new_parent: object's new parent
357 * @new_name: object's new name
358 */
359
360int kobject_shadow_rename(struct kobject *kobj,
361 struct sysfs_dirent *new_parent, const char *new_name)
362{
363 int error = 0;
364
365 kobj = kobject_get(kobj);
366 if (!kobj)
367 return -EINVAL;
368 error = sysfs_rename_dir(kobj, new_parent, new_name);
369 kobject_put(kobj);
370
371 return error;
372}
373
374/**
375 * kobject_move - move object to another parent 343 * kobject_move - move object to another parent
376 * @kobj: object in question. 344 * @kobj: object in question.
377 * @new_parent: object's new parent (can be NULL) 345 * @new_parent: object's new parent (can be NULL)