projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/voyager-2.6
[powerpc.git]
/
fs
/
sysfs
/
symlink.c
diff --git
a/fs/sysfs/symlink.c
b/fs/sysfs/symlink.c
index
d2eac3c
..
7b9c5bf
100644
(file)
--- a/
fs/sysfs/symlink.c
+++ b/
fs/sysfs/symlink.c
@@
-3,9
+3,11
@@
*/
#include <linux/fs.h>
*/
#include <linux/fs.h>
+#include <linux/mount.h>
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/namei.h>
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/namei.h>
+#include <asm/semaphore.h>
#include "sysfs.h"
#include "sysfs.h"
@@
-82,10
+84,19
@@
exit1:
*/
int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name)
{
*/
int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name)
{
- struct dentry *
dentry = kobj->dentry
;
+ struct dentry *
dentry = NULL
;
int error = -EEXIST;
int error = -EEXIST;
- BUG_ON(!kobj || !kobj->dentry || !name);
+ BUG_ON(!name);
+
+ if (!kobj) {
+ if (sysfs_mount && sysfs_mount->mnt_sb)
+ dentry = sysfs_mount->mnt_sb->s_root;
+ } else
+ dentry = kobj->dentry;
+
+ if (!dentry)
+ return -EFAULT;
mutex_lock(&dentry->d_inode->i_mutex);
if (!sysfs_dirent_exist(dentry->d_fsdata, name))
mutex_lock(&dentry->d_inode->i_mutex);
if (!sysfs_dirent_exist(dentry->d_fsdata, name))
@@
-170,7
+181,7
@@
static void sysfs_put_link(struct dentry *dentry, struct nameidata *nd, void *co
free_page((unsigned long)page);
}
free_page((unsigned long)page);
}
-struct inode_operations sysfs_symlink_inode_operations = {
+
const
struct inode_operations sysfs_symlink_inode_operations = {
.readlink = generic_readlink,
.follow_link = sysfs_follow_link,
.put_link = sysfs_put_link,
.readlink = generic_readlink,
.follow_link = sysfs_follow_link,
.put_link = sysfs_put_link,