diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-03-30 14:31:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-21 12:37:31 -0400 |
commit | bc451f2058238013e1cdf4acd443c01734d332f0 (patch) | |
tree | 16a1ca2f762edcfbda8f2a4afb6763ba7b090271 /include | |
parent | ba514a57f5c38d9d79ea15e75059e07f49238726 (diff) |
kobj: Add basic infrastructure for dealing with namespaces.
Move complete knowledge of namespaces into the kobject layer
so we can use that information when reporting kobjects to
userspace.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 3 | ||||
-rw-r--r-- | include/linux/kobject.h | 26 |
2 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 6f9619190aaf..7bb9f426f3e6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -202,6 +202,9 @@ struct class { | |||
202 | int (*suspend)(struct device *dev, pm_message_t state); | 202 | int (*suspend)(struct device *dev, pm_message_t state); |
203 | int (*resume)(struct device *dev); | 203 | int (*resume)(struct device *dev); |
204 | 204 | ||
205 | const struct kobj_ns_type_operations *ns_type; | ||
206 | const void *(*namespace)(struct device *dev); | ||
207 | |||
205 | const struct dev_pm_ops *pm; | 208 | const struct dev_pm_ops *pm; |
206 | 209 | ||
207 | struct class_private *p; | 210 | struct class_private *p; |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 3950d3c2850d..d9456f69904f 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -108,6 +108,8 @@ struct kobj_type { | |||
108 | void (*release)(struct kobject *kobj); | 108 | void (*release)(struct kobject *kobj); |
109 | const struct sysfs_ops *sysfs_ops; | 109 | const struct sysfs_ops *sysfs_ops; |
110 | struct attribute **default_attrs; | 110 | struct attribute **default_attrs; |
111 | const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); | ||
112 | const void *(*namespace)(struct kobject *kobj); | ||
111 | }; | 113 | }; |
112 | 114 | ||
113 | struct kobj_uevent_env { | 115 | struct kobj_uevent_env { |
@@ -134,6 +136,30 @@ struct kobj_attribute { | |||
134 | 136 | ||
135 | extern const struct sysfs_ops kobj_sysfs_ops; | 137 | extern const struct sysfs_ops kobj_sysfs_ops; |
136 | 138 | ||
139 | enum kobj_ns_type { | ||
140 | KOBJ_NS_TYPE_NONE = 0, | ||
141 | KOBJ_NS_TYPES | ||
142 | }; | ||
143 | |||
144 | struct sock; | ||
145 | struct kobj_ns_type_operations { | ||
146 | enum kobj_ns_type type; | ||
147 | const void *(*current_ns)(void); | ||
148 | const void *(*netlink_ns)(struct sock *sk); | ||
149 | const void *(*initial_ns)(void); | ||
150 | }; | ||
151 | |||
152 | int kobj_ns_type_register(const struct kobj_ns_type_operations *ops); | ||
153 | int kobj_ns_type_registered(enum kobj_ns_type type); | ||
154 | const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent); | ||
155 | const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj); | ||
156 | |||
157 | const void *kobj_ns_current(enum kobj_ns_type type); | ||
158 | const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk); | ||
159 | const void *kobj_ns_initial(enum kobj_ns_type type); | ||
160 | void kobj_ns_exit(enum kobj_ns_type type, const void *ns); | ||
161 | |||
162 | |||
137 | /** | 163 | /** |
138 | * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. | 164 | * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. |
139 | * | 165 | * |