lkml.org 
[lkml]   [2003]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: PATCPATCH -- add unlimited name lengths support to sysfs
On Wed, Dec 17, 2003 at 02:27:57PM -0600, Linda Xie wrote:
> 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.

Well if a kobject only uses the .name field, .k_name will point to it
(see kobject_add()), so the kobject_name() call will work in the above
case (as it should always do.) Actually that if (p->k_name) statement
will always be true because of this fact :)
This lets people like the edd driver which does:
snprintf(edev->kobj.name, EDD_DEVICE_NAME_SIZE, "int13_dev%02x", edd[i].device);
still work properly. Ideally, callers like this should change to use
the kobject_set_name() function, but there's no rush.

thanks,

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

\
 
 \ /
  Last update: 2005-03-22 13:59    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site