From: Mark Fasheh <mark.fasheh@oracle.com>
To: Greg KH <gregkh@suse.de>
Cc: ocfs2-devel@oss.oracle.com,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Mark Fasheh <mark.fasheh@oracle.com>
Subject: [PATCH 1/2] sysfs: Allow removal of symlinks in the sysfs root
Date: Mon, 4 Feb 2008 11:07:41 -0800 [thread overview]
Message-ID: <1202152062-28370-2-git-send-email-mark.fasheh@oracle.com> (raw)
In-Reply-To: <1202152062-28370-1-git-send-email-mark.fasheh@oracle.com>
Allow callers of sysfs_remove_link() to pass a NULL kobj, in which case
sysfs_root will be used as the parent directory. This allows us to tear down
top level symlinks created via sysfs_create_link(), which already has
similar handling of a NULL parent object.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
---
fs/sysfs/symlink.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index 5f66c44..817f596 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -87,7 +87,14 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char
void sysfs_remove_link(struct kobject * kobj, const char * name)
{
- sysfs_hash_and_remove(kobj->sd, name);
+ struct sysfs_dirent *parent_sd = NULL;
+
+ if (!kobj)
+ parent_sd = &sysfs_root;
+ else
+ parent_sd = kobj->sd;
+
+ sysfs_hash_and_remove(parent_sd, name);
}
static int sysfs_get_target_path(struct sysfs_dirent *parent_sd,
--
1.5.3.6
next prev parent reply other threads:[~2008-02-04 19:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-04 19:07 [PATCH 0/2] Move /sys/o2cb to /sys/fs/o2cb Mark Fasheh
2008-02-04 19:07 ` Mark Fasheh [this message]
2008-02-04 19:07 ` [PATCH 2/2] ocfs2: " Mark Fasheh
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=1202152062-28370-2-git-send-email-mark.fasheh@oracle.com \
--to=mark.fasheh@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=ocfs2-devel@oss.oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®