sysfs: rename sysfs_dirent->s_type to s_flags and make room for flags
Rename sysfs_dirent->s_type to s_flags, pack type into lower eight
bits and reserve the rest for flags. sysfs_type() can used to access
the type. All existing sd->s_type accesses are converted to use
sysfs_type(). While at it, type test is changed to equality test
instead of bit-and test where appropriate.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 63daa06..ee3a5d9 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -242,7 +242,7 @@
dput(dentry);
/* XXX: unpin if directory, this will go away soon */
- if (sd->s_type & SYSFS_DIR)
+ if (sysfs_type(sd) == SYSFS_DIR)
dput(dentry);
/* adjust nlink and update timestamp */
@@ -254,7 +254,7 @@
inode->i_ctime = curtime;
drop_nlink(inode);
- if (sd->s_type & SYSFS_DIR)
+ if (sysfs_type(sd) == SYSFS_DIR)
drop_nlink(inode);
mutex_unlock(&inode->i_mutex);
@@ -267,7 +267,7 @@
mutex_lock(&inode->i_mutex);
inode->i_ctime = inode->i_mtime = curtime;
- if (sd->s_type & SYSFS_DIR)
+ if (sysfs_type(sd) == SYSFS_DIR)
drop_nlink(inode);
mutex_unlock(&inode->i_mutex);
@@ -293,7 +293,7 @@
for (pos = &parent_sd->s_children; *pos; pos = &(*pos)->s_sibling) {
sd = *pos;
- if (!sd->s_type)
+ if (!sysfs_type(sd))
continue;
if (!strcmp(sd->s_name, name)) {
*pos = sd->s_sibling;