From: Linda Xie <lxiep@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: scheel@us.ibm.com, wortman@us.ibm.com, Greg KH <gregkh@us.ibm.com>
Subject: PATCPATCH -- add unlimited name lengths support to sysfs
Date: Tue, 16 Dec 2003 17:07:22 -0600 [thread overview]
Message-ID: <3FDF902A.4000903@us.ltcfwd.linux.ibm.com> (raw)
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) = '/';
}
}
next reply other threads:[~2003-12-16 23:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-16 23:07 Linda Xie [this message]
2003-12-16 23:14 ` PATCPATCH -- add unlimited name lengths support to sysfs 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FDF902A.4000903@us.ltcfwd.linux.ibm.com \
--to=lxiep@us.ibm.com \
--cc=gregkh@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=scheel@us.ibm.com \
--cc=wortman@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.