From: ebiederm@xmission.com (Eric W. Biederman)
To: Greg Kroah-Hartman <gregkh@suse.de>, David Miller <davem@davemloft.net>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
Tejun Heo <htejun@gmail.com>, Jay Vosburgh <fubar@us.ibm.com>,
Andy Gospodarek <andy@greyhouse.net>
Subject: [PATCH 4/5] sysfs: Remove support for tagged directories with untagged members.
Date: Thu, 13 Oct 2011 01:01:34 -0700 [thread overview]
Message-ID: <m1ehyh9v6p.fsf_-_@fess.ebiederm.org> (raw)
In-Reply-To: <m1mxd59vfa.fsf_-_@fess.ebiederm.org> (Eric W. Biederman's message of "Thu, 13 Oct 2011 00:56:25 -0700")
Now that /sys/class/net/bonding_masters is implemented as a tagged sysfs
file we can remove support for untagged files in tagged directories.
This change removes any ambiguity of what a NULL namespace value
means. A NULL namespace parameter after this patch means
that we are talking about an untagged sysfs dirent.
This makes the sysfs code much less prone to mistakes when during
maintenance.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
fs/sysfs/dir.c | 6 +++---
fs/sysfs/inode.c | 2 --
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index ea9120a..352d26d 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -543,7 +543,7 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
struct sysfs_dirent *sd;
for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) {
- if (ns && sd->s_ns && (sd->s_ns != ns))
+ if (sd->s_ns != ns)
continue;
if (!strcmp(sd->s_name, name))
return sd;
@@ -885,7 +885,7 @@ static struct sysfs_dirent *sysfs_dir_pos(const void *ns,
while (pos && (ino > pos->s_ino))
pos = pos->s_sibling;
}
- while (pos && pos->s_ns && pos->s_ns != ns)
+ while (pos && pos->s_ns != ns)
pos = pos->s_sibling;
return pos;
}
@@ -896,7 +896,7 @@ static struct sysfs_dirent *sysfs_dir_next_pos(const void *ns,
pos = sysfs_dir_pos(ns, parent_sd, ino, pos);
if (pos)
pos = pos->s_sibling;
- while (pos && pos->s_ns && pos->s_ns != ns)
+ while (pos && pos->s_ns != ns)
pos = pos->s_sibling;
return pos;
}
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index e3f091a..527f0cc 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -336,8 +336,6 @@ int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const void *ns, const cha
sysfs_addrm_start(&acxt, dir_sd);
sd = sysfs_find_dirent(dir_sd, ns, name);
- if (sd && (sd->s_ns != ns))
- sd = NULL;
if (sd)
sysfs_remove_one(&acxt, sd);
--
1.7.2.5
next prev parent reply other threads:[~2011-10-13 8:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-13 7:47 [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Eric W. Biederman
2011-10-13 7:53 ` [PATCH 1/5] sysfs: Implement support for tagged files in sysfs Eric W. Biederman
2011-10-13 7:55 ` [PATCH 2/5] class: Implement support for class attrs in tagged sysfs directories Eric W. Biederman
2011-10-13 7:56 ` [PATCH 3/5] bonding: Use a per netns implementation of /sys/class/net/bonding_masters Eric W. Biederman
2011-10-13 8:01 ` Eric W. Biederman [this message]
2011-10-13 8:02 ` [PATCH 5/5] sysfs: Reject with a warning invalid uses of tagged directories Eric W. Biederman
2011-10-13 17:25 ` [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Greg KH
2011-10-19 4:09 ` David Miller
2011-10-19 13:27 ` Eric W. Biederman
2011-10-19 22:49 ` David Miller
2011-10-19 14:36 ` 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=m1ehyh9v6p.fsf_-_@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=gregkh@suse.de \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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