diff options
author | Tejun Heo <tj@kernel.org> | 2013-09-11 22:29:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-26 18:34:38 -0400 |
commit | cfec0bc835c84d3d3723d4955587f05a94879b26 (patch) | |
tree | 18c1239d9113ebc30ca037b1a0025b95ffb7c405 | |
parent | 388975cccaaf11abd47525f664c76891c440481a (diff) |
sysfs: @name comes before @ns
Some internal sysfs functions which take explicit namespace argument
are weird in that they place the optional @ns in front of @name which
is contrary to the established convention. This is confusing and
error-prone especially as @ns and @name may be interchanged without
causing compilation warning.
Swap the positions of @name and @ns in the following internal
functions.
sysfs_find_dirent()
sysfs_rename()
sysfs_hash_and_remove()
sysfs_name_hash()
sysfs_name_compare()
create_dir()
This patch doesn't introduce any functional changes.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Kay Sievers <kay@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/sysfs/bin.c | 2 | ||||
-rw-r--r-- | fs/sysfs/dir.c | 45 | ||||
-rw-r--r-- | fs/sysfs/file.c | 10 | ||||
-rw-r--r-- | fs/sysfs/group.c | 12 | ||||
-rw-r--r-- | fs/sysfs/inode.c | 6 | ||||
-rw-r--r-- | fs/sysfs/symlink.c | 6 | ||||
-rw-r--r-- | fs/sysfs/sysfs.h | 10 |
7 files changed, 46 insertions, 45 deletions
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index c590cabd57bb..d49e6ca3345b 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -497,6 +497,6 @@ EXPORT_SYMBOL_GPL(sysfs_create_bin_file); | |||
497 | void sysfs_remove_bin_file(struct kobject *kobj, | 497 | void sysfs_remove_bin_file(struct kobject *kobj, |
498 | const struct bin_attribute *attr) | 498 | const struct bin_attribute *attr) |
499 | { | 499 | { |
500 | sysfs_hash_and_remove(kobj->sd, NULL, attr->attr.name); | 500 | sysfs_hash_and_remove(kobj->sd, attr->attr.name, NULL); |
501 | } | 501 | } |
502 | EXPORT_SYMBOL_GPL(sysfs_remove_bin_file); | 502 | EXPORT_SYMBOL_GPL(sysfs_remove_bin_file); |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index fee19d16e4a2..d23e66dfba74 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -35,12 +35,12 @@ static DEFINE_IDA(sysfs_ino_ida); | |||
35 | 35 | ||
36 | /** | 36 | /** |
37 | * sysfs_name_hash | 37 | * sysfs_name_hash |
38 | * @ns: Namespace tag to hash | ||
39 | * @name: Null terminated string to hash | 38 | * @name: Null terminated string to hash |
39 | * @ns: Namespace tag to hash | ||
40 | * | 40 | * |
41 | * Returns 31 bit hash of ns + name (so it fits in an off_t ) | 41 | * Returns 31 bit hash of ns + name (so it fits in an off_t ) |
42 | */ | 42 | */ |
43 | static unsigned int sysfs_name_hash(const void *ns, const char *name) | 43 | static unsigned int sysfs_name_hash(const char *name, const void *ns) |
44 | { | 44 | { |
45 | unsigned long hash = init_name_hash(); | 45 | unsigned long hash = init_name_hash(); |
46 | unsigned int len = strlen(name); | 46 | unsigned int len = strlen(name); |
@@ -56,8 +56,8 @@ static unsigned int sysfs_name_hash(const void *ns, const char *name) | |||
56 | return hash; | 56 | return hash; |
57 | } | 57 | } |
58 | 58 | ||
59 | static int sysfs_name_compare(unsigned int hash, const void *ns, | 59 | static int sysfs_name_compare(unsigned int hash, const char *name, |
60 | const char *name, const struct sysfs_dirent *sd) | 60 | const void *ns, const struct sysfs_dirent *sd) |
61 | { | 61 | { |
62 | if (hash != sd->s_hash) | 62 | if (hash != sd->s_hash) |
63 | return hash - sd->s_hash; | 63 | return hash - sd->s_hash; |
@@ -69,7 +69,7 @@ static int sysfs_name_compare(unsigned int hash, const void *ns, | |||
69 | static int sysfs_sd_compare(const struct sysfs_dirent *left, | 69 | static int sysfs_sd_compare(const struct sysfs_dirent *left, |
70 | const struct sysfs_dirent *right) | 70 | const struct sysfs_dirent *right) |
71 | { | 71 | { |
72 | return sysfs_name_compare(left->s_hash, left->s_ns, left->s_name, | 72 | return sysfs_name_compare(left->s_hash, left->s_name, left->s_ns, |
73 | right); | 73 | right); |
74 | } | 74 | } |
75 | 75 | ||
@@ -451,7 +451,7 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | |||
451 | struct sysfs_inode_attrs *ps_iattr; | 451 | struct sysfs_inode_attrs *ps_iattr; |
452 | int ret; | 452 | int ret; |
453 | 453 | ||
454 | sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name); | 454 | sd->s_hash = sysfs_name_hash(sd->s_name, sd->s_ns); |
455 | sd->s_parent = sysfs_get(acxt->parent_sd); | 455 | sd->s_parent = sysfs_get(acxt->parent_sd); |
456 | 456 | ||
457 | ret = sysfs_link_sibling(sd); | 457 | ret = sysfs_link_sibling(sd); |
@@ -596,6 +596,7 @@ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) | |||
596 | * sysfs_find_dirent - find sysfs_dirent with the given name | 596 | * sysfs_find_dirent - find sysfs_dirent with the given name |
597 | * @parent_sd: sysfs_dirent to search under | 597 | * @parent_sd: sysfs_dirent to search under |
598 | * @name: name to look for | 598 | * @name: name to look for |
599 | * @ns: the namespace tag to use | ||
599 | * | 600 | * |
600 | * Look for sysfs_dirent with name @name under @parent_sd. | 601 | * Look for sysfs_dirent with name @name under @parent_sd. |
601 | * | 602 | * |
@@ -606,19 +607,19 @@ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) | |||
606 | * Pointer to sysfs_dirent if found, NULL if not. | 607 | * Pointer to sysfs_dirent if found, NULL if not. |
607 | */ | 608 | */ |
608 | struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, | 609 | struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, |
609 | const void *ns, | 610 | const unsigned char *name, |
610 | const unsigned char *name) | 611 | const void *ns) |
611 | { | 612 | { |
612 | struct rb_node *node = parent_sd->s_dir.children.rb_node; | 613 | struct rb_node *node = parent_sd->s_dir.children.rb_node; |
613 | unsigned int hash; | 614 | unsigned int hash; |
614 | 615 | ||
615 | hash = sysfs_name_hash(ns, name); | 616 | hash = sysfs_name_hash(name, ns); |
616 | while (node) { | 617 | while (node) { |
617 | struct sysfs_dirent *sd; | 618 | struct sysfs_dirent *sd; |
618 | int result; | 619 | int result; |
619 | 620 | ||
620 | sd = to_sysfs_dirent(node); | 621 | sd = to_sysfs_dirent(node); |
621 | result = sysfs_name_compare(hash, ns, name, sd); | 622 | result = sysfs_name_compare(hash, name, ns, sd); |
622 | if (result < 0) | 623 | if (result < 0) |
623 | node = node->rb_left; | 624 | node = node->rb_left; |
624 | else if (result > 0) | 625 | else if (result > 0) |
@@ -651,7 +652,7 @@ struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, | |||
651 | struct sysfs_dirent *sd; | 652 | struct sysfs_dirent *sd; |
652 | 653 | ||
653 | mutex_lock(&sysfs_mutex); | 654 | mutex_lock(&sysfs_mutex); |
654 | sd = sysfs_find_dirent(parent_sd, ns, name); | 655 | sd = sysfs_find_dirent(parent_sd, name, ns); |
655 | sysfs_get(sd); | 656 | sysfs_get(sd); |
656 | mutex_unlock(&sysfs_mutex); | 657 | mutex_unlock(&sysfs_mutex); |
657 | 658 | ||
@@ -660,7 +661,8 @@ struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, | |||
660 | EXPORT_SYMBOL_GPL(sysfs_get_dirent_ns); | 661 | EXPORT_SYMBOL_GPL(sysfs_get_dirent_ns); |
661 | 662 | ||
662 | static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd, | 663 | static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd, |
663 | const void *ns, const char *name, struct sysfs_dirent **p_sd) | 664 | const char *name, const void *ns, |
665 | struct sysfs_dirent **p_sd) | ||
664 | { | 666 | { |
665 | umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; | 667 | umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; |
666 | struct sysfs_addrm_cxt acxt; | 668 | struct sysfs_addrm_cxt acxt; |
@@ -691,7 +693,7 @@ static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd, | |||
691 | int sysfs_create_subdir(struct kobject *kobj, const char *name, | 693 | int sysfs_create_subdir(struct kobject *kobj, const char *name, |
692 | struct sysfs_dirent **p_sd) | 694 | struct sysfs_dirent **p_sd) |
693 | { | 695 | { |
694 | return create_dir(kobj, kobj->sd, NULL, name, p_sd); | 696 | return create_dir(kobj, kobj->sd, name, NULL, p_sd); |
695 | } | 697 | } |
696 | 698 | ||
697 | /** | 699 | /** |
@@ -714,7 +716,7 @@ int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) | |||
714 | if (!parent_sd) | 716 | if (!parent_sd) |
715 | return -ENOENT; | 717 | return -ENOENT; |
716 | 718 | ||
717 | error = create_dir(kobj, parent_sd, ns, kobject_name(kobj), &sd); | 719 | error = create_dir(kobj, parent_sd, kobject_name(kobj), ns, &sd); |
718 | if (!error) | 720 | if (!error) |
719 | kobj->sd = sd; | 721 | kobj->sd = sd; |
720 | return error; | 722 | return error; |
@@ -735,7 +737,7 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry, | |||
735 | if (parent_sd->s_flags & SYSFS_FLAG_HAS_NS) | 737 | if (parent_sd->s_flags & SYSFS_FLAG_HAS_NS) |
736 | ns = sysfs_info(dir->i_sb)->ns; | 738 | ns = sysfs_info(dir->i_sb)->ns; |
737 | 739 | ||
738 | sd = sysfs_find_dirent(parent_sd, ns, dentry->d_name.name); | 740 | sd = sysfs_find_dirent(parent_sd, dentry->d_name.name, ns); |
739 | 741 | ||
740 | /* no such entry */ | 742 | /* no such entry */ |
741 | if (!sd) { | 743 | if (!sd) { |
@@ -823,9 +825,8 @@ void sysfs_remove_dir(struct kobject *kobj) | |||
823 | __sysfs_remove_dir(sd); | 825 | __sysfs_remove_dir(sd); |
824 | } | 826 | } |
825 | 827 | ||
826 | int sysfs_rename(struct sysfs_dirent *sd, | 828 | int sysfs_rename(struct sysfs_dirent *sd, struct sysfs_dirent *new_parent_sd, |
827 | struct sysfs_dirent *new_parent_sd, const void *new_ns, | 829 | const char *new_name, const void *new_ns) |
828 | const char *new_name) | ||
829 | { | 830 | { |
830 | int error; | 831 | int error; |
831 | 832 | ||
@@ -837,7 +838,7 @@ int sysfs_rename(struct sysfs_dirent *sd, | |||
837 | goto out; /* nothing to rename */ | 838 | goto out; /* nothing to rename */ |
838 | 839 | ||
839 | error = -EEXIST; | 840 | error = -EEXIST; |
840 | if (sysfs_find_dirent(new_parent_sd, new_ns, new_name)) | 841 | if (sysfs_find_dirent(new_parent_sd, new_name, new_ns)) |
841 | goto out; | 842 | goto out; |
842 | 843 | ||
843 | /* rename sysfs_dirent */ | 844 | /* rename sysfs_dirent */ |
@@ -858,7 +859,7 @@ int sysfs_rename(struct sysfs_dirent *sd, | |||
858 | sysfs_get(new_parent_sd); | 859 | sysfs_get(new_parent_sd); |
859 | sysfs_put(sd->s_parent); | 860 | sysfs_put(sd->s_parent); |
860 | sd->s_ns = new_ns; | 861 | sd->s_ns = new_ns; |
861 | sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name); | 862 | sd->s_hash = sysfs_name_hash(sd->s_name, sd->s_ns); |
862 | sd->s_parent = new_parent_sd; | 863 | sd->s_parent = new_parent_sd; |
863 | sysfs_link_sibling(sd); | 864 | sysfs_link_sibling(sd); |
864 | 865 | ||
@@ -873,7 +874,7 @@ int sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name, | |||
873 | { | 874 | { |
874 | struct sysfs_dirent *parent_sd = kobj->sd->s_parent; | 875 | struct sysfs_dirent *parent_sd = kobj->sd->s_parent; |
875 | 876 | ||
876 | return sysfs_rename(kobj->sd, parent_sd, new_ns, new_name); | 877 | return sysfs_rename(kobj->sd, parent_sd, new_name, new_ns); |
877 | } | 878 | } |
878 | 879 | ||
879 | int sysfs_move_dir_ns(struct kobject *kobj, struct kobject *new_parent_kobj, | 880 | int sysfs_move_dir_ns(struct kobject *kobj, struct kobject *new_parent_kobj, |
@@ -886,7 +887,7 @@ int sysfs_move_dir_ns(struct kobject *kobj, struct kobject *new_parent_kobj, | |||
886 | new_parent_sd = new_parent_kobj && new_parent_kobj->sd ? | 887 | new_parent_sd = new_parent_kobj && new_parent_kobj->sd ? |
887 | new_parent_kobj->sd : &sysfs_root; | 888 | new_parent_kobj->sd : &sysfs_root; |
888 | 889 | ||
889 | return sysfs_rename(sd, new_parent_sd, new_ns, sd->s_name); | 890 | return sysfs_rename(sd, new_parent_sd, sd->s_name, new_ns); |
890 | } | 891 | } |
891 | 892 | ||
892 | /* Relationship between s_mode and the DT_xxx types */ | 893 | /* Relationship between s_mode and the DT_xxx types */ |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 0f3214a70985..4697019fafa3 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -466,9 +466,9 @@ void sysfs_notify(struct kobject *k, const char *dir, const char *attr) | |||
466 | mutex_lock(&sysfs_mutex); | 466 | mutex_lock(&sysfs_mutex); |
467 | 467 | ||
468 | if (sd && dir) | 468 | if (sd && dir) |
469 | sd = sysfs_find_dirent(sd, NULL, dir); | 469 | sd = sysfs_find_dirent(sd, dir, NULL); |
470 | if (sd && attr) | 470 | if (sd && attr) |
471 | sd = sysfs_find_dirent(sd, NULL, attr); | 471 | sd = sysfs_find_dirent(sd, attr, NULL); |
472 | if (sd) | 472 | if (sd) |
473 | sysfs_notify_dirent(sd); | 473 | sysfs_notify_dirent(sd); |
474 | 474 | ||
@@ -594,7 +594,7 @@ int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, | |||
594 | mutex_lock(&sysfs_mutex); | 594 | mutex_lock(&sysfs_mutex); |
595 | 595 | ||
596 | rc = -ENOENT; | 596 | rc = -ENOENT; |
597 | sd = sysfs_find_dirent(kobj->sd, NULL, attr->name); | 597 | sd = sysfs_find_dirent(kobj->sd, attr->name, NULL); |
598 | if (!sd) | 598 | if (!sd) |
599 | goto out; | 599 | goto out; |
600 | 600 | ||
@@ -621,7 +621,7 @@ void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, | |||
621 | { | 621 | { |
622 | struct sysfs_dirent *dir_sd = kobj->sd; | 622 | struct sysfs_dirent *dir_sd = kobj->sd; |
623 | 623 | ||
624 | sysfs_hash_and_remove(dir_sd, ns, attr->name); | 624 | sysfs_hash_and_remove(dir_sd, attr->name, ns); |
625 | } | 625 | } |
626 | EXPORT_SYMBOL_GPL(sysfs_remove_file_ns); | 626 | EXPORT_SYMBOL_GPL(sysfs_remove_file_ns); |
627 | 627 | ||
@@ -649,7 +649,7 @@ void sysfs_remove_file_from_group(struct kobject *kobj, | |||
649 | else | 649 | else |
650 | dir_sd = sysfs_get(kobj->sd); | 650 | dir_sd = sysfs_get(kobj->sd); |
651 | if (dir_sd) { | 651 | if (dir_sd) { |
652 | sysfs_hash_and_remove(dir_sd, NULL, attr->name); | 652 | sysfs_hash_and_remove(dir_sd, attr->name, NULL); |
653 | sysfs_put(dir_sd); | 653 | sysfs_put(dir_sd); |
654 | } | 654 | } |
655 | } | 655 | } |
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 21102158ca33..2dae55c4f7dc 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c | |||
@@ -26,7 +26,7 @@ static void remove_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, | |||
26 | 26 | ||
27 | if (grp->attrs) | 27 | if (grp->attrs) |
28 | for (attr = grp->attrs; *attr; attr++) | 28 | for (attr = grp->attrs; *attr; attr++) |
29 | sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); | 29 | sysfs_hash_and_remove(dir_sd, (*attr)->name, NULL); |
30 | if (grp->bin_attrs) | 30 | if (grp->bin_attrs) |
31 | for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) | 31 | for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) |
32 | sysfs_remove_bin_file(kobj, *bin_attr); | 32 | sysfs_remove_bin_file(kobj, *bin_attr); |
@@ -49,8 +49,8 @@ static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, | |||
49 | * re-adding (if required) the file. | 49 | * re-adding (if required) the file. |
50 | */ | 50 | */ |
51 | if (update) | 51 | if (update) |
52 | sysfs_hash_and_remove(dir_sd, NULL, | 52 | sysfs_hash_and_remove(dir_sd, (*attr)->name, |
53 | (*attr)->name); | 53 | NULL); |
54 | if (grp->is_visible) { | 54 | if (grp->is_visible) { |
55 | mode = grp->is_visible(kobj, *attr, i); | 55 | mode = grp->is_visible(kobj, *attr, i); |
56 | if (!mode) | 56 | if (!mode) |
@@ -270,7 +270,7 @@ int sysfs_merge_group(struct kobject *kobj, | |||
270 | error = sysfs_add_file(dir_sd, *attr, SYSFS_KOBJ_ATTR); | 270 | error = sysfs_add_file(dir_sd, *attr, SYSFS_KOBJ_ATTR); |
271 | if (error) { | 271 | if (error) { |
272 | while (--i >= 0) | 272 | while (--i >= 0) |
273 | sysfs_hash_and_remove(dir_sd, NULL, (*--attr)->name); | 273 | sysfs_hash_and_remove(dir_sd, (*--attr)->name, NULL); |
274 | } | 274 | } |
275 | sysfs_put(dir_sd); | 275 | sysfs_put(dir_sd); |
276 | 276 | ||
@@ -292,7 +292,7 @@ void sysfs_unmerge_group(struct kobject *kobj, | |||
292 | dir_sd = sysfs_get_dirent(kobj->sd, grp->name); | 292 | dir_sd = sysfs_get_dirent(kobj->sd, grp->name); |
293 | if (dir_sd) { | 293 | if (dir_sd) { |
294 | for (attr = grp->attrs; *attr; ++attr) | 294 | for (attr = grp->attrs; *attr; ++attr) |
295 | sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); | 295 | sysfs_hash_and_remove(dir_sd, (*attr)->name, NULL); |
296 | sysfs_put(dir_sd); | 296 | sysfs_put(dir_sd); |
297 | } | 297 | } |
298 | } | 298 | } |
@@ -335,7 +335,7 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name, | |||
335 | 335 | ||
336 | dir_sd = sysfs_get_dirent(kobj->sd, group_name); | 336 | dir_sd = sysfs_get_dirent(kobj->sd, group_name); |
337 | if (dir_sd) { | 337 | if (dir_sd) { |
338 | sysfs_hash_and_remove(dir_sd, NULL, link_name); | 338 | sysfs_hash_and_remove(dir_sd, link_name, NULL); |
339 | sysfs_put(dir_sd); | 339 | sysfs_put(dir_sd); |
340 | } | 340 | } |
341 | } | 341 | } |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 963f910c8034..07193d720d92 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -314,8 +314,8 @@ void sysfs_evict_inode(struct inode *inode) | |||
314 | sysfs_put(sd); | 314 | sysfs_put(sd); |
315 | } | 315 | } |
316 | 316 | ||
317 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const void *ns, | 317 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name, |
318 | const char *name) | 318 | const void *ns) |
319 | { | 319 | { |
320 | struct sysfs_addrm_cxt acxt; | 320 | struct sysfs_addrm_cxt acxt; |
321 | struct sysfs_dirent *sd; | 321 | struct sysfs_dirent *sd; |
@@ -328,7 +328,7 @@ int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const void *ns, | |||
328 | 328 | ||
329 | sysfs_addrm_start(&acxt, dir_sd); | 329 | sysfs_addrm_start(&acxt, dir_sd); |
330 | 330 | ||
331 | sd = sysfs_find_dirent(dir_sd, ns, name); | 331 | sd = sysfs_find_dirent(dir_sd, name, ns); |
332 | if (sd) | 332 | if (sd) |
333 | sysfs_remove_one(&acxt, sd); | 333 | sysfs_remove_one(&acxt, sd); |
334 | 334 | ||
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index c96b31a16485..88c8bc5e8911 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -144,7 +144,7 @@ void sysfs_delete_link(struct kobject *kobj, struct kobject *targ, | |||
144 | if (targ->sd) | 144 | if (targ->sd) |
145 | ns = targ->sd->s_ns; | 145 | ns = targ->sd->s_ns; |
146 | spin_unlock(&sysfs_assoc_lock); | 146 | spin_unlock(&sysfs_assoc_lock); |
147 | sysfs_hash_and_remove(kobj->sd, ns, name); | 147 | sysfs_hash_and_remove(kobj->sd, name, ns); |
148 | } | 148 | } |
149 | 149 | ||
150 | /** | 150 | /** |
@@ -161,7 +161,7 @@ void sysfs_remove_link(struct kobject *kobj, const char *name) | |||
161 | else | 161 | else |
162 | parent_sd = kobj->sd; | 162 | parent_sd = kobj->sd; |
163 | 163 | ||
164 | sysfs_hash_and_remove(parent_sd, NULL, name); | 164 | sysfs_hash_and_remove(parent_sd, name, NULL); |
165 | } | 165 | } |
166 | EXPORT_SYMBOL_GPL(sysfs_remove_link); | 166 | EXPORT_SYMBOL_GPL(sysfs_remove_link); |
167 | 167 | ||
@@ -201,7 +201,7 @@ int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *targ, | |||
201 | if (sd->s_symlink.target_sd->s_dir.kobj != targ) | 201 | if (sd->s_symlink.target_sd->s_dir.kobj != targ) |
202 | goto out; | 202 | goto out; |
203 | 203 | ||
204 | result = sysfs_rename(sd, parent_sd, new_ns, new); | 204 | result = sysfs_rename(sd, parent_sd, new, new_ns); |
205 | 205 | ||
206 | out: | 206 | out: |
207 | sysfs_put(sd); | 207 | sysfs_put(sd); |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 6faacafda777..ee44fde199d0 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -162,8 +162,8 @@ void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); | |||
162 | void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); | 162 | void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); |
163 | 163 | ||
164 | struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, | 164 | struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, |
165 | const void *ns, | 165 | const unsigned char *name, |
166 | const unsigned char *name); | 166 | const void *ns); |
167 | struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type); | 167 | struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type); |
168 | 168 | ||
169 | void release_sysfs_dirent(struct sysfs_dirent *sd); | 169 | void release_sysfs_dirent(struct sysfs_dirent *sd); |
@@ -173,7 +173,7 @@ int sysfs_create_subdir(struct kobject *kobj, const char *name, | |||
173 | void sysfs_remove_subdir(struct sysfs_dirent *sd); | 173 | void sysfs_remove_subdir(struct sysfs_dirent *sd); |
174 | 174 | ||
175 | int sysfs_rename(struct sysfs_dirent *sd, struct sysfs_dirent *new_parent_sd, | 175 | int sysfs_rename(struct sysfs_dirent *sd, struct sysfs_dirent *new_parent_sd, |
176 | const void *ns, const char *new_name); | 176 | const char *new_name, const void *new_ns); |
177 | 177 | ||
178 | static inline struct sysfs_dirent *__sysfs_get(struct sysfs_dirent *sd) | 178 | static inline struct sysfs_dirent *__sysfs_get(struct sysfs_dirent *sd) |
179 | { | 179 | { |
@@ -204,8 +204,8 @@ int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
204 | struct kstat *stat); | 204 | struct kstat *stat); |
205 | int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, | 205 | int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
206 | size_t size, int flags); | 206 | size_t size, int flags); |
207 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const void *ns, | 207 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name, |
208 | const char *name); | 208 | const void *ns); |
209 | int sysfs_inode_init(void); | 209 | int sysfs_inode_init(void); |
210 | 210 | ||
211 | /* | 211 | /* |