diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 13:48:32 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 13:48:32 -0400 |
| commit | d6fb1db02e02aea98f2d7e121fd30e24c84639d6 (patch) | |
| tree | 865546f0388c40d52cf98febe2c6d21039915ea2 /fs/sysfs/sysfs.h | |
| parent | b4e6b09738fde057ce885703705f71cc953d0512 (diff) | |
| parent | a1b3f594dc5faab91d3a218c7019e9b5edd9fe1a (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (38 commits)
net: Expose all network devices in a namespaces in sysfs
hotplug: netns aware uevent_helper
kobj: Send hotplug events in the proper namespace.
netlink: Implment netlink_broadcast_filtered
net/sysfs: Fix the bitrot in network device kobject namespace support
netns: Teach network device kobjects which namespace they are in.
kobject: Send hotplug events in all network namespaces
driver-core: fix Typo in drivers/base/core.c for CONFIG_MODULE
pci: check caps from sysfs file open to read device dependent config space
sysfs: add struct file* to bin_attr callbacks
sysfs: Remove usage of S_BIAS to avoid merge conflict with the vfs tree
sysfs: Don't use enums in inline function declaration.
sysfs-namespaces: add a high-level Documentation file
sysfs: Comment sysfs directory tagging logic
driver core: Implement ns directory support for device classes.
sysfs: Implement sysfs_delete_link
sysfs: Add support for tagged directories with untagged members.
sysfs: Implement sysfs tagged directory support.
kobj: Add basic infrastructure for dealing with namespaces.
sysfs: Remove double free sysfs_get_sb
...
Diffstat (limited to 'fs/sysfs/sysfs.h')
| -rw-r--r-- | fs/sysfs/sysfs.h | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 30f5a44fb5d3..6a13105b5594 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
| @@ -58,6 +58,7 @@ struct sysfs_dirent { | |||
| 58 | struct sysfs_dirent *s_sibling; | 58 | struct sysfs_dirent *s_sibling; |
| 59 | const char *s_name; | 59 | const char *s_name; |
| 60 | 60 | ||
| 61 | const void *s_ns; /* namespace tag */ | ||
| 61 | union { | 62 | union { |
| 62 | struct sysfs_elem_dir s_dir; | 63 | struct sysfs_elem_dir s_dir; |
| 63 | struct sysfs_elem_symlink s_symlink; | 64 | struct sysfs_elem_symlink s_symlink; |
| @@ -81,14 +82,27 @@ struct sysfs_dirent { | |||
| 81 | #define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) | 82 | #define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) |
| 82 | #define SYSFS_ACTIVE_REF (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR) | 83 | #define SYSFS_ACTIVE_REF (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR) |
| 83 | 84 | ||
| 84 | #define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK | 85 | /* identify any namespace tag on sysfs_dirents */ |
| 85 | #define SYSFS_FLAG_REMOVED 0x0200 | 86 | #define SYSFS_NS_TYPE_MASK 0xff00 |
| 87 | #define SYSFS_NS_TYPE_SHIFT 8 | ||
| 88 | |||
| 89 | #define SYSFS_FLAG_MASK ~(SYSFS_NS_TYPE_MASK|SYSFS_TYPE_MASK) | ||
| 90 | #define SYSFS_FLAG_REMOVED 0x020000 | ||
| 86 | 91 | ||
| 87 | static inline unsigned int sysfs_type(struct sysfs_dirent *sd) | 92 | static inline unsigned int sysfs_type(struct sysfs_dirent *sd) |
| 88 | { | 93 | { |
| 89 | return sd->s_flags & SYSFS_TYPE_MASK; | 94 | return sd->s_flags & SYSFS_TYPE_MASK; |
| 90 | } | 95 | } |
| 91 | 96 | ||
| 97 | /* | ||
| 98 | * Return any namespace tags on this dirent. | ||
| 99 | * enum kobj_ns_type is defined in linux/kobject.h | ||
| 100 | */ | ||
| 101 | static inline enum kobj_ns_type sysfs_ns_type(struct sysfs_dirent *sd) | ||
| 102 | { | ||
| 103 | return (sd->s_flags & SYSFS_NS_TYPE_MASK) >> SYSFS_NS_TYPE_SHIFT; | ||
| 104 | } | ||
| 105 | |||
| 92 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 106 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 93 | #define sysfs_dirent_init_lockdep(sd) \ | 107 | #define sysfs_dirent_init_lockdep(sd) \ |
| 94 | do { \ | 108 | do { \ |
| @@ -114,6 +128,16 @@ struct sysfs_addrm_cxt { | |||
| 114 | /* | 128 | /* |
| 115 | * mount.c | 129 | * mount.c |
| 116 | */ | 130 | */ |
| 131 | |||
| 132 | /* | ||
| 133 | * Each sb is associated with a set of namespace tags (i.e. | ||
| 134 | * the network namespace of the task which mounted this sysfs | ||
| 135 | * instance). | ||
| 136 | */ | ||
| 137 | struct sysfs_super_info { | ||
| 138 | const void *ns[KOBJ_NS_TYPES]; | ||
| 139 | }; | ||
| 140 | #define sysfs_info(SB) ((struct sysfs_super_info *)(SB->s_fs_info)) | ||
| 117 | extern struct sysfs_dirent sysfs_root; | 141 | extern struct sysfs_dirent sysfs_root; |
| 118 | extern struct kmem_cache *sysfs_dir_cachep; | 142 | extern struct kmem_cache *sysfs_dir_cachep; |
| 119 | 143 | ||
| @@ -137,8 +161,10 @@ void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); | |||
| 137 | void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); | 161 | void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); |
| 138 | 162 | ||
| 139 | struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, | 163 | struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, |
| 164 | const void *ns, | ||
| 140 | const unsigned char *name); | 165 | const unsigned char *name); |
| 141 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, | 166 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, |
| 167 | const void *ns, | ||
| 142 | const unsigned char *name); | 168 | const unsigned char *name); |
| 143 | struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type); | 169 | struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type); |
| 144 | 170 | ||
| @@ -149,7 +175,7 @@ int sysfs_create_subdir(struct kobject *kobj, const char *name, | |||
| 149 | void sysfs_remove_subdir(struct sysfs_dirent *sd); | 175 | void sysfs_remove_subdir(struct sysfs_dirent *sd); |
| 150 | 176 | ||
| 151 | int sysfs_rename(struct sysfs_dirent *sd, | 177 | int sysfs_rename(struct sysfs_dirent *sd, |
| 152 | struct sysfs_dirent *new_parent_sd, const char *new_name); | 178 | struct sysfs_dirent *new_parent_sd, const void *ns, const char *new_name); |
| 153 | 179 | ||
| 154 | static inline struct sysfs_dirent *__sysfs_get(struct sysfs_dirent *sd) | 180 | static inline struct sysfs_dirent *__sysfs_get(struct sysfs_dirent *sd) |
| 155 | { | 181 | { |
| @@ -179,7 +205,7 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); | |||
| 179 | int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); | 205 | int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); |
| 180 | int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, | 206 | int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
| 181 | size_t size, int flags); | 207 | size_t size, int flags); |
| 182 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name); | 208 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const void *ns, const char *name); |
| 183 | int sysfs_inode_init(void); | 209 | int sysfs_inode_init(void); |
| 184 | 210 | ||
| 185 | /* | 211 | /* |
