From: Tejun Heo <htejun@gmail.com>
To: ebiederm@xmission.com, cornelia.huck@de.ibm.com, greg@kroah.com,
stern@rowland.harvard.edu, kay.sievers@vrfy.org,
linux-kernel@vger.kernel.org, htejun@gmail.com
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 12/15] sysfs: make sysfs_root a regular directory dirent
Date: Thu, 20 Sep 2007 16:05:12 +0900 [thread overview]
Message-ID: <11902719122289-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11902719091692-git-send-email-htejun@gmail.com>
sysfs_root is different from a regular directory dirent in that it's
of type SYSFS_ROOT and doesn't have a name. These differences aren't
used by anybody and only adds to complexity. Make sysfs_root a
regular directory dirent.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
fs/sysfs/inode.c | 5 -----
fs/sysfs/mount.c | 3 ++-
fs/sysfs/sysfs.h | 9 ++++-----
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index b6ac4e6..c40fb9f 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -157,11 +157,6 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
/* initialize inode according to type */
switch (sysfs_type(sd)) {
- case SYSFS_ROOT:
- inode->i_op = &sysfs_dir_inode_operations;
- inode->i_fop = &sysfs_dir_operations;
- inc_nlink(inode); /* directory, account for "." */
- break;
case SYSFS_DIR:
inode->i_op = &sysfs_dir_inode_operations;
inode->i_fop = &sysfs_dir_operations;
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 28bf359..465902c 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -24,8 +24,9 @@ static const struct super_operations sysfs_ops = {
};
struct sysfs_dirent sysfs_root = {
+ .s_name = "",
.s_count = ATOMIC_INIT(1),
- .s_flags = SYSFS_ROOT,
+ .s_flags = SYSFS_DIR,
.s_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
.s_ino = 1,
};
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 2a68bfa..60405a6 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -48,11 +48,10 @@ struct sysfs_dirent {
#define SD_DEACTIVATED_BIAS INT_MIN
#define SYSFS_TYPE_MASK 0x00ff
-#define SYSFS_ROOT 0x0001
-#define SYSFS_DIR 0x0002
-#define SYSFS_KOBJ_ATTR 0x0004
-#define SYSFS_KOBJ_BIN_ATTR 0x0008
-#define SYSFS_KOBJ_LINK 0x0020
+#define SYSFS_DIR 0x0001
+#define SYSFS_KOBJ_ATTR 0x0002
+#define SYSFS_KOBJ_BIN_ATTR 0x0004
+#define SYSFS_KOBJ_LINK 0x0008
#define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK)
#define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK
--
1.5.0.3
next prev parent reply other threads:[~2007-09-20 7:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-20 7:05 [PATCHSET 1/4] sysfs: misc updates Tejun Heo
2007-09-20 7:05 ` [PATCH 01/15] sysfs: kill SYSFS_FLAG_REMOVED Tejun Heo
2007-09-25 21:32 ` Greg KH
2007-09-20 7:05 ` [PATCH 02/15] sysfs: fix comments of sysfs_add/remove_one() Tejun Heo
2007-09-20 7:05 ` [PATCH 05/15] sysfs: kill sysfs_update_file() Tejun Heo
2007-09-20 7:05 ` [PATCH 08/15] sysfs: kill unnecessary NULL pointer check in sysfs_release() Tejun Heo
2007-09-20 7:05 ` [PATCH 09/15] sysfs: make bin attr open get active reference of parent too Tejun Heo
2007-09-20 7:05 ` [PATCH 07/15] sysfs: kill unnecessary sysfs_get() in open paths Tejun Heo
2007-09-20 7:05 ` [PATCH 04/15] sysfs: clean up header files Tejun Heo
2007-09-20 7:05 ` [PATCH 03/15] sysfs: fix sysfs_chmod_file() such that it updates sd->s_mode too Tejun Heo
2007-09-20 7:05 ` [PATCH 06/15] sysfs: reposition sysfs_dirent->s_mode Tejun Heo
2007-09-20 7:05 ` [PATCH 11/15] sysfs: open code sysfs_attach_dentry() Tejun Heo
2007-09-20 7:05 ` [PATCH 10/15] sysfs: make s_elem an anonymous union Tejun Heo
2007-09-20 7:05 ` [PATCH 14/15] sysfs: implement sysfs_open_dirent Tejun Heo
2007-09-20 7:05 ` Tejun Heo [this message]
2007-09-20 7:05 ` [PATCH 13/15] sysfs: move sysfs_dirent->s_children into sysfs_dirent->s_dir Tejun Heo
2007-09-20 7:05 ` [PATCH 15/15] sysfs: move sysfs file poll implementation to sysfs_open_dirent Tejun Heo
2007-09-26 11:04 ` [PATCHSET 1/4] sysfs: misc updates Cornelia Huck
2007-09-26 15:19 ` 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=11902719122289-git-send-email-htejun@gmail.com \
--to=htejun@gmail.com \
--cc=cornelia.huck@de.ibm.com \
--cc=ebiederm@xmission.com \
--cc=greg@kroah.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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.