Re: PATCPATCH -- add unlimited name lengths support to sysfs

From: Linda Xie
Date: Wed Dec 17 2003 - 15:24:28 EST


Greg KH wrote:
On Tue, Dec 16, 2003 at 05:07:22PM -0600, Linda Xie wrote:

diff -Nru a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
--- a/fs/sysfs/symlink.c Sun Dec 14 21:19:29 2003
+++ b/fs/sysfs/symlink.c Sun Dec 14 21:19:29 2003
@@ -42,7 +42,10 @@
struct kobject * p = kobj;
int length = 1;
do {
- length += strlen(p->name) + 1;
+ if (p->k_name)
+ length += strlen(p->k_name) + 1;
+ else
+ length += strlen(p->name) + 1;


Shouldn't this just be:
length += strlen(kobject_name(p)) + 1;


That is correct. But here is my concern: Some of the callers of sysfs_create_link()
set p->name instead of p->k_name. So for them, the length calculated using kobject_name(p) will be incorrect. Correct me if I am wrong.

Thanks,

Linda


@@ -54,11 +57,20 @@

--length;
for (p = kobj; p; p = p->parent) {
- int cur = strlen(p->name);
-
+ int cur;
+ char *name;
+
+ if (p->k_name) {
+ cur = strlen(p->k_name);
+ name = p->k_name;
+ }
+ else {
+ cur = strlen(p->name);
+ name = p->name;
+ }


Same here, just use kobject_name() to get the proper pointer.

thanks,

greg k-h


Thanks,

Linda

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/