public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PATCPATCH -- add unlimited name lengths support to sysfs
@ 2003-12-16 23:07 Linda Xie
  2003-12-16 23:14 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Linda Xie @ 2003-12-16 23:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: scheel, wortman, Greg KH

Hi All,

In the development of RPA PCI Hot Plug Controller driver, I have found 
it is needed to create some kernel objects which have more than 20 
(KOBJECT_NAME_SIZE) charaters in their name strings. At a later time the 
names will be used for creating some symlinks. The attached patch adds 
unlimited name lengths support to sysfs symlink.c.

  Comments are welcome.

Linda


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;
  		p = p->parent;
  	} while (p);
  	return length;
@@ -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;
+		}
  		/* back up enough to print this bus id with '/' */
  		length -= cur;
-		strncpy(buffer + length,p->name,cur);
+		strncpy(buffer + length,name,cur);
  		*(buffer + --length) = '/';
  	}
  }


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-02-02 23:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-16 23:07 PATCPATCH -- add unlimited name lengths support to sysfs Linda Xie
2003-12-16 23:14 ` Greg KH
2003-12-17 20:27   ` Linda Xie
2003-12-17 20:41     ` Greg KH
2003-12-18  2:23       ` Linda Xie
2004-02-02 23:26         ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox