sysfs: Pass super_block to sysfs_get_inode
[safe/jmp/linux-2.6] / fs / sysfs / sysfs.h
index bb7723c..7593d71 100644 (file)
@@ -66,8 +66,8 @@ struct sysfs_dirent {
        };
 
        unsigned int            s_flags;
+       unsigned short          s_mode;
        ino_t                   s_ino;
-       umode_t                 s_mode;
        struct sysfs_inode_attrs *s_iattr;
 };
 
@@ -79,6 +79,7 @@ struct sysfs_dirent {
 #define SYSFS_KOBJ_BIN_ATTR            0x0004
 #define SYSFS_KOBJ_LINK                        0x0008
 #define SYSFS_COPY_NAME                        (SYSFS_DIR | SYSFS_KOBJ_LINK)
+#define SYSFS_ACTIVE_REF               (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR)
 
 #define SYSFS_FLAG_MASK                        ~SYSFS_TYPE_MASK
 #define SYSFS_FLAG_REMOVED             0x0200
@@ -91,9 +92,12 @@ static inline unsigned int sysfs_type(struct sysfs_dirent *sd)
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 #define sysfs_dirent_init_lockdep(sd)                          \
 do {                                                           \
-       static struct lock_class_key __key;                     \
+       struct attribute *attr = sd->s_attr.attr;               \
+       struct lock_class_key *key = attr->key;                 \
+       if (!key)                                               \
+               key = &attr->skey;                              \
                                                                \
-       lockdep_init_map(&sd->dep_map, "s_active", &__key, 0);  \
+       lockdep_init_map(&sd->dep_map, "s_active", key, 0);     \
 } while(0)
 #else
 #define sysfs_dirent_init_lockdep(sd) do {} while(0)
@@ -168,7 +172,7 @@ static inline void __sysfs_put(struct sysfs_dirent *sd)
 /*
  * inode.c
  */
-struct inode *sysfs_get_inode(struct sysfs_dirent *sd);
+struct inode *sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd);
 void sysfs_delete_inode(struct inode *inode);
 int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr *iattr);
 int sysfs_permission(struct inode *inode, int mask);