diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:13:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:13:47 -0400 |
commit | 53baaaa9682c230410a057263d1ce2922f43ddc4 (patch) | |
tree | f5cced5622130f780d76953b284a631c3d226488 /fs/sysfs/symlink.c | |
parent | f10140fbe5f97ecfeda986a12d0f1bad75642779 (diff) | |
parent | 3f9787046ea37a26170dc4439efa21f8d23a9978 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (79 commits)
arm: bus_id -> dev_name() and dev_set_name() conversions
sparc64: fix up bus_id changes in sparc core code
3c59x: handle pci_name() being const
MTD: handle pci_name() being const
HP iLO driver
sysdev: Convert the x86 mce tolerant sysdev attribute to generic attribute
sysdev: Add utility functions for simple int/ulong variable sysdev attributes
sysdev: Pass the attribute to the low level sysdev show/store function
driver core: Suppress sysfs warnings for device_rename().
kobject: Transmit return value of call_usermodehelper() to caller
sysfs-rules.txt: reword API stability statement
debugfs: Implement debugfs_remove_recursive()
HOWTO: change email addresses of James in HOWTO
always enable FW_LOADER unless EMBEDDED=y
uio-howto.tmpl: use unique output names
uio-howto.tmpl: use standard copyright/legal markings
sysfs: don't call notify_change
sysdev: fix debugging statements in registration code.
kobject: should use kobject_put() in kset-example
kobject: reorder kobject to save space on 64 bit builds
...
Diffstat (limited to 'fs/sysfs/symlink.c')
-rw-r--r-- | fs/sysfs/symlink.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index 817f5966edca..a3ba217fbe74 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -19,13 +19,8 @@ | |||
19 | 19 | ||
20 | #include "sysfs.h" | 20 | #include "sysfs.h" |
21 | 21 | ||
22 | /** | 22 | static int sysfs_do_create_link(struct kobject *kobj, struct kobject *target, |
23 | * sysfs_create_link - create symlink between two objects. | 23 | const char *name, int warn) |
24 | * @kobj: object whose directory we're creating the link in. | ||
25 | * @target: object we're pointing to. | ||
26 | * @name: name of the symlink. | ||
27 | */ | ||
28 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) | ||
29 | { | 24 | { |
30 | struct sysfs_dirent *parent_sd = NULL; | 25 | struct sysfs_dirent *parent_sd = NULL; |
31 | struct sysfs_dirent *target_sd = NULL; | 26 | struct sysfs_dirent *target_sd = NULL; |
@@ -65,7 +60,10 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char | |||
65 | target_sd = NULL; /* reference is now owned by the symlink */ | 60 | target_sd = NULL; /* reference is now owned by the symlink */ |
66 | 61 | ||
67 | sysfs_addrm_start(&acxt, parent_sd); | 62 | sysfs_addrm_start(&acxt, parent_sd); |
68 | error = sysfs_add_one(&acxt, sd); | 63 | if (warn) |
64 | error = sysfs_add_one(&acxt, sd); | ||
65 | else | ||
66 | error = __sysfs_add_one(&acxt, sd); | ||
69 | sysfs_addrm_finish(&acxt); | 67 | sysfs_addrm_finish(&acxt); |
70 | 68 | ||
71 | if (error) | 69 | if (error) |
@@ -80,6 +78,33 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char | |||
80 | } | 78 | } |
81 | 79 | ||
82 | /** | 80 | /** |
81 | * sysfs_create_link - create symlink between two objects. | ||
82 | * @kobj: object whose directory we're creating the link in. | ||
83 | * @target: object we're pointing to. | ||
84 | * @name: name of the symlink. | ||
85 | */ | ||
86 | int sysfs_create_link(struct kobject *kobj, struct kobject *target, | ||
87 | const char *name) | ||
88 | { | ||
89 | return sysfs_do_create_link(kobj, target, name, 1); | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * sysfs_create_link_nowarn - create symlink between two objects. | ||
94 | * @kobj: object whose directory we're creating the link in. | ||
95 | * @target: object we're pointing to. | ||
96 | * @name: name of the symlink. | ||
97 | * | ||
98 | * This function does the same as sysf_create_link(), but it | ||
99 | * doesn't warn if the link already exists. | ||
100 | */ | ||
101 | int sysfs_create_link_nowarn(struct kobject *kobj, struct kobject *target, | ||
102 | const char *name) | ||
103 | { | ||
104 | return sysfs_do_create_link(kobj, target, name, 0); | ||
105 | } | ||
106 | |||
107 | /** | ||
83 | * sysfs_remove_link - remove symlink in object's directory. | 108 | * sysfs_remove_link - remove symlink in object's directory. |
84 | * @kobj: object we're acting for. | 109 | * @kobj: object we're acting for. |
85 | * @name: name of the symlink to remove. | 110 | * @name: name of the symlink to remove. |