From 7c6e2d362c19f01e6d6c8be59d83a89722032884 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 28 Nov 2013 14:54:14 -0500 Subject: sysfs, kernfs: replace sysfs_dirent->s_dir.kobj and ->s_attr.[bin_]attr with ->priv A directory sysfs_dirent points to the associated kobj. A regular or bin file points to the associated [bin_]attribute. This patch replaces sysfs_dirent->s_dir.kobj and ->s_attr.[bin_]attr with void * ->priv. This is to prepare for kernfs interface so that sysfs can specify the private data in the same way for directories and files. This lower debuggability but not by much - the whole thing was overlaid in a union anyway. If debuggability becomes an issue, we can later add ->priv accessors which explicitly check for the sysfs_dirent type and performs casting. This patch doesn't introduce any behavior difference. Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/sysfs.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'fs/sysfs/sysfs.h') diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 2abccfdd932e..a6f3fa3f02fe 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h @@ -17,8 +17,6 @@ struct sysfs_open_dirent; /* type-specific structures for sysfs_dirent->s_* union members */ struct sysfs_elem_dir { - struct kobject *kobj; - unsigned long subdirs; /* children rbtree starts here and goes through sd->s_rb */ struct rb_root children; @@ -29,10 +27,6 @@ struct sysfs_elem_symlink { }; struct sysfs_elem_attr { - union { - struct attribute *attr; - struct bin_attribute *bin_attr; - }; struct sysfs_open_dirent *open; }; @@ -74,6 +68,8 @@ struct sysfs_dirent { struct sysfs_elem_attr s_attr; }; + void *priv; + unsigned short s_flags; umode_t s_mode; unsigned int s_ino; @@ -103,7 +99,7 @@ static inline unsigned int sysfs_type(struct sysfs_dirent *sd) #define sysfs_dirent_init_lockdep(sd) \ do { \ - struct attribute *attr = sd->s_attr.attr; \ + struct attribute *attr = sd->priv; \ struct lock_class_key *key = attr->key; \ if (!key) \ key = &attr->skey; \ @@ -114,10 +110,11 @@ do { \ /* Test for attributes that want to ignore lockdep for read-locking */ static inline bool sysfs_ignore_lockdep(struct sysfs_dirent *sd) { + struct attribute *attr = sd->priv; int type = sysfs_type(sd); return (type == SYSFS_KOBJ_ATTR || type == SYSFS_KOBJ_BIN_ATTR) && - sd->s_attr.attr->ignore_lockdep; + attr->ignore_lockdep; } #else -- cgit v1.2.3-70-g09d2