lkml.org 
[lkml]   [2012]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 1/3] sysfs: Compact sysfs_dirent s_flags into a byte.

In an effort to keep sysfs_dirent small used the smallest
basic type I can for sysfs s_flags.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
fs/sysfs/sysfs.h | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 6289a00..c76c932 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -76,7 +76,7 @@ struct sysfs_dirent {
struct sysfs_elem_bin_attr s_bin_attr;
};

- unsigned short s_flags;
+ unsigned char s_flags;
umode_t s_mode;
unsigned int s_ino;
struct sysfs_inode_attrs *s_iattr;
@@ -84,7 +84,7 @@ struct sysfs_dirent {

#define SD_DEACTIVATED_BIAS INT_MIN

-#define SYSFS_TYPE_MASK 0x00ff
+#define SYSFS_TYPE_MASK 0x000f
#define SYSFS_DIR 0x0001
#define SYSFS_KOBJ_ATTR 0x0002
#define SYSFS_KOBJ_BIN_ATTR 0x0004
@@ -93,11 +93,11 @@ struct sysfs_dirent {
#define SYSFS_ACTIVE_REF (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR)

/* identify any namespace tag on sysfs_dirents */
-#define SYSFS_NS_TYPE_MASK 0xf00
-#define SYSFS_NS_TYPE_SHIFT 8
+#define SYSFS_NS_TYPE_MASK 0x70
+#define SYSFS_NS_TYPE_SHIFT 4

#define SYSFS_FLAG_MASK ~(SYSFS_NS_TYPE_MASK|SYSFS_TYPE_MASK)
-#define SYSFS_FLAG_REMOVED 0x02000
+#define SYSFS_FLAG_REMOVED 0x080

static inline unsigned int sysfs_type(struct sysfs_dirent *sd)
{
--
1.7.2.5


\
 
 \ /
  Last update: 2012-03-08 22:33    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site