diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/device.h | 12 | ||||
| -rw-r--r-- | include/linux/firmware.h | 1 | ||||
| -rw-r--r-- | include/linux/kobject.h | 38 | ||||
| -rw-r--r-- | include/linux/kref.h | 1 | ||||
| -rw-r--r-- | include/linux/lockdep.h | 8 | ||||
| -rw-r--r-- | include/linux/netlink.h | 4 | ||||
| -rw-r--r-- | include/linux/ramfs.h | 2 | ||||
| -rw-r--r-- | include/linux/sysfs.h | 26 |
8 files changed, 83 insertions, 9 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 241b96bcd7ad..7bb9f426f3e6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
| 23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 24 | #include <linux/pm.h> | 24 | #include <linux/pm.h> |
| 25 | #include <linux/semaphore.h> | ||
| 26 | #include <asm/atomic.h> | 25 | #include <asm/atomic.h> |
| 27 | #include <asm/device.h> | 26 | #include <asm/device.h> |
| 28 | 27 | ||
| @@ -203,6 +202,9 @@ struct class { | |||
| 203 | int (*suspend)(struct device *dev, pm_message_t state); | 202 | int (*suspend)(struct device *dev, pm_message_t state); |
| 204 | int (*resume)(struct device *dev); | 203 | int (*resume)(struct device *dev); |
| 205 | 204 | ||
| 205 | const struct kobj_ns_type_operations *ns_type; | ||
| 206 | const void *(*namespace)(struct device *dev); | ||
| 207 | |||
| 206 | const struct dev_pm_ops *pm; | 208 | const struct dev_pm_ops *pm; |
| 207 | 209 | ||
| 208 | struct class_private *p; | 210 | struct class_private *p; |
| @@ -404,7 +406,7 @@ struct device { | |||
| 404 | const char *init_name; /* initial name of the device */ | 406 | const char *init_name; /* initial name of the device */ |
| 405 | struct device_type *type; | 407 | struct device_type *type; |
| 406 | 408 | ||
| 407 | struct semaphore sem; /* semaphore to synchronize calls to | 409 | struct mutex mutex; /* mutex to synchronize calls to |
| 408 | * its driver. | 410 | * its driver. |
| 409 | */ | 411 | */ |
| 410 | 412 | ||
| @@ -514,17 +516,17 @@ static inline bool device_async_suspend_enabled(struct device *dev) | |||
| 514 | 516 | ||
| 515 | static inline void device_lock(struct device *dev) | 517 | static inline void device_lock(struct device *dev) |
| 516 | { | 518 | { |
| 517 | down(&dev->sem); | 519 | mutex_lock(&dev->mutex); |
| 518 | } | 520 | } |
| 519 | 521 | ||
| 520 | static inline int device_trylock(struct device *dev) | 522 | static inline int device_trylock(struct device *dev) |
| 521 | { | 523 | { |
| 522 | return down_trylock(&dev->sem); | 524 | return mutex_trylock(&dev->mutex); |
| 523 | } | 525 | } |
| 524 | 526 | ||
| 525 | static inline void device_unlock(struct device *dev) | 527 | static inline void device_unlock(struct device *dev) |
| 526 | { | 528 | { |
| 527 | up(&dev->sem); | 529 | mutex_unlock(&dev->mutex); |
| 528 | } | 530 | } |
| 529 | 531 | ||
| 530 | void driver_init(void); | 532 | void driver_init(void); |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 043811f0d277..53d1e6c4f848 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | struct firmware { | 12 | struct firmware { |
| 13 | size_t size; | 13 | size_t size; |
| 14 | const u8 *data; | 14 | const u8 *data; |
| 15 | struct page **pages; | ||
| 15 | }; | 16 | }; |
| 16 | 17 | ||
| 17 | struct device; | 18 | struct device; |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 3950d3c2850d..cf343a852534 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,42 @@ 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 | /* | ||
| 140 | * Namespace types which are used to tag kobjects and sysfs entries. | ||
| 141 | * Network namespace will likely be the first. | ||
| 142 | */ | ||
| 143 | enum kobj_ns_type { | ||
| 144 | KOBJ_NS_TYPE_NONE = 0, | ||
| 145 | KOBJ_NS_TYPE_NET, | ||
| 146 | KOBJ_NS_TYPES | ||
| 147 | }; | ||
| 148 | |||
| 149 | struct sock; | ||
| 150 | |||
| 151 | /* | ||
| 152 | * Callbacks so sysfs can determine namespaces | ||
| 153 | * @current_ns: return calling task's namespace | ||
| 154 | * @netlink_ns: return namespace to which a sock belongs (right?) | ||
| 155 | * @initial_ns: return the initial namespace (i.e. init_net_ns) | ||
| 156 | */ | ||
| 157 | struct kobj_ns_type_operations { | ||
| 158 | enum kobj_ns_type type; | ||
| 159 | const void *(*current_ns)(void); | ||
| 160 | const void *(*netlink_ns)(struct sock *sk); | ||
| 161 | const void *(*initial_ns)(void); | ||
| 162 | }; | ||
| 163 | |||
| 164 | int kobj_ns_type_register(const struct kobj_ns_type_operations *ops); | ||
| 165 | int kobj_ns_type_registered(enum kobj_ns_type type); | ||
| 166 | const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent); | ||
| 167 | const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj); | ||
| 168 | |||
| 169 | const void *kobj_ns_current(enum kobj_ns_type type); | ||
| 170 | const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk); | ||
| 171 | const void *kobj_ns_initial(enum kobj_ns_type type); | ||
| 172 | void kobj_ns_exit(enum kobj_ns_type type, const void *ns); | ||
| 173 | |||
| 174 | |||
| 137 | /** | 175 | /** |
| 138 | * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. | 176 | * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. |
| 139 | * | 177 | * |
diff --git a/include/linux/kref.h b/include/linux/kref.h index baf4b9e4b194..6cc38fc07ab7 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h | |||
| @@ -21,7 +21,6 @@ struct kref { | |||
| 21 | atomic_t refcount; | 21 | atomic_t refcount; |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | void kref_set(struct kref *kref, int num); | ||
| 25 | void kref_init(struct kref *kref); | 24 | void kref_init(struct kref *kref); |
| 26 | void kref_get(struct kref *kref); | 25 | void kref_get(struct kref *kref); |
| 27 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); | 26 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index a03977a96d7e..06aed8305bf3 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
| @@ -44,6 +44,8 @@ struct lock_class_key { | |||
| 44 | struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; | 44 | struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | extern struct lock_class_key __lockdep_no_validate__; | ||
| 48 | |||
| 47 | #define LOCKSTAT_POINTS 4 | 49 | #define LOCKSTAT_POINTS 4 |
| 48 | 50 | ||
| 49 | /* | 51 | /* |
| @@ -270,6 +272,9 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, | |||
| 270 | #define lockdep_set_subclass(lock, sub) \ | 272 | #define lockdep_set_subclass(lock, sub) \ |
| 271 | lockdep_init_map(&(lock)->dep_map, #lock, \ | 273 | lockdep_init_map(&(lock)->dep_map, #lock, \ |
| 272 | (lock)->dep_map.key, sub) | 274 | (lock)->dep_map.key, sub) |
| 275 | |||
| 276 | #define lockdep_set_novalidate_class(lock) \ | ||
| 277 | lockdep_set_class(lock, &__lockdep_no_validate__) | ||
| 273 | /* | 278 | /* |
| 274 | * Compare locking classes | 279 | * Compare locking classes |
| 275 | */ | 280 | */ |
| @@ -354,6 +359,9 @@ static inline void lockdep_on(void) | |||
| 354 | #define lockdep_set_class_and_subclass(lock, key, sub) \ | 359 | #define lockdep_set_class_and_subclass(lock, key, sub) \ |
| 355 | do { (void)(key); } while (0) | 360 | do { (void)(key); } while (0) |
| 356 | #define lockdep_set_subclass(lock, sub) do { } while (0) | 361 | #define lockdep_set_subclass(lock, sub) do { } while (0) |
| 362 | |||
| 363 | #define lockdep_set_novalidate_class(lock) do { } while (0) | ||
| 364 | |||
| 357 | /* | 365 | /* |
| 358 | * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP | 366 | * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP |
| 359 | * case since the result is not well defined and the caller should rather | 367 | * case since the result is not well defined and the caller should rather |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 6eaca5e1e8ca..59d066936ab9 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -188,6 +188,10 @@ extern int netlink_has_listeners(struct sock *sk, unsigned int group); | |||
| 188 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); | 188 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); |
| 189 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, | 189 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, |
| 190 | __u32 group, gfp_t allocation); | 190 | __u32 group, gfp_t allocation); |
| 191 | extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, | ||
| 192 | __u32 pid, __u32 group, gfp_t allocation, | ||
| 193 | int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), | ||
| 194 | void *filter_data); | ||
| 191 | extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); | 195 | extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); |
| 192 | extern int netlink_register_notifier(struct notifier_block *nb); | 196 | extern int netlink_register_notifier(struct notifier_block *nb); |
| 193 | extern int netlink_unregister_notifier(struct notifier_block *nb); | 197 | extern int netlink_unregister_notifier(struct notifier_block *nb); |
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h index 4e768dda87b0..8600508c77a6 100644 --- a/include/linux/ramfs.h +++ b/include/linux/ramfs.h | |||
| @@ -20,4 +20,6 @@ extern const struct file_operations ramfs_file_operations; | |||
| 20 | extern const struct vm_operations_struct generic_file_vm_ops; | 20 | extern const struct vm_operations_struct generic_file_vm_ops; |
| 21 | extern int __init init_rootfs(void); | 21 | extern int __init init_rootfs(void); |
| 22 | 22 | ||
| 23 | int ramfs_fill_super(struct super_block *sb, void *data, int silent); | ||
| 24 | |||
| 23 | #endif | 25 | #endif |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index f0496b3d1811..f2694eb4dd3d 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | struct kobject; | 21 | struct kobject; |
| 22 | struct module; | 22 | struct module; |
| 23 | enum kobj_ns_type; | ||
| 23 | 24 | ||
| 24 | /* FIXME | 25 | /* FIXME |
| 25 | * The *owner field is no longer used. | 26 | * The *owner field is no longer used. |
| @@ -86,17 +87,18 @@ struct attribute_group { | |||
| 86 | 87 | ||
| 87 | #define attr_name(_attr) (_attr).attr.name | 88 | #define attr_name(_attr) (_attr).attr.name |
| 88 | 89 | ||
| 90 | struct file; | ||
| 89 | struct vm_area_struct; | 91 | struct vm_area_struct; |
| 90 | 92 | ||
| 91 | struct bin_attribute { | 93 | struct bin_attribute { |
| 92 | struct attribute attr; | 94 | struct attribute attr; |
| 93 | size_t size; | 95 | size_t size; |
| 94 | void *private; | 96 | void *private; |
| 95 | ssize_t (*read)(struct kobject *, struct bin_attribute *, | 97 | ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, |
| 96 | char *, loff_t, size_t); | 98 | char *, loff_t, size_t); |
| 97 | ssize_t (*write)(struct kobject *, struct bin_attribute *, | 99 | ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *, |
| 98 | char *, loff_t, size_t); | 100 | char *, loff_t, size_t); |
| 99 | int (*mmap)(struct kobject *, struct bin_attribute *attr, | 101 | int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, |
| 100 | struct vm_area_struct *vma); | 102 | struct vm_area_struct *vma); |
| 101 | }; | 103 | }; |
| 102 | 104 | ||
| @@ -154,6 +156,9 @@ void sysfs_remove_link(struct kobject *kobj, const char *name); | |||
| 154 | int sysfs_rename_link(struct kobject *kobj, struct kobject *target, | 156 | int sysfs_rename_link(struct kobject *kobj, struct kobject *target, |
| 155 | const char *old_name, const char *new_name); | 157 | const char *old_name, const char *new_name); |
| 156 | 158 | ||
| 159 | void sysfs_delete_link(struct kobject *dir, struct kobject *targ, | ||
| 160 | const char *name); | ||
| 161 | |||
| 157 | int __must_check sysfs_create_group(struct kobject *kobj, | 162 | int __must_check sysfs_create_group(struct kobject *kobj, |
| 158 | const struct attribute_group *grp); | 163 | const struct attribute_group *grp); |
| 159 | int sysfs_update_group(struct kobject *kobj, | 164 | int sysfs_update_group(struct kobject *kobj, |
| @@ -168,10 +173,15 @@ void sysfs_remove_file_from_group(struct kobject *kobj, | |||
| 168 | void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); | 173 | void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); |
| 169 | void sysfs_notify_dirent(struct sysfs_dirent *sd); | 174 | void sysfs_notify_dirent(struct sysfs_dirent *sd); |
| 170 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, | 175 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, |
| 176 | const void *ns, | ||
| 171 | const unsigned char *name); | 177 | const unsigned char *name); |
| 172 | struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); | 178 | struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); |
| 173 | void sysfs_put(struct sysfs_dirent *sd); | 179 | void sysfs_put(struct sysfs_dirent *sd); |
| 174 | void sysfs_printk_last_file(void); | 180 | void sysfs_printk_last_file(void); |
| 181 | |||
| 182 | /* Called to clear a ns tag when it is no longer valid */ | ||
| 183 | void sysfs_exit_ns(enum kobj_ns_type type, const void *tag); | ||
| 184 | |||
| 175 | int __must_check sysfs_init(void); | 185 | int __must_check sysfs_init(void); |
| 176 | 186 | ||
| 177 | #else /* CONFIG_SYSFS */ | 187 | #else /* CONFIG_SYSFS */ |
| @@ -264,6 +274,11 @@ static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, | |||
| 264 | return 0; | 274 | return 0; |
| 265 | } | 275 | } |
| 266 | 276 | ||
| 277 | static inline void sysfs_delete_link(struct kobject *k, struct kobject *t, | ||
| 278 | const char *name) | ||
| 279 | { | ||
| 280 | } | ||
| 281 | |||
| 267 | static inline int sysfs_create_group(struct kobject *kobj, | 282 | static inline int sysfs_create_group(struct kobject *kobj, |
| 268 | const struct attribute_group *grp) | 283 | const struct attribute_group *grp) |
| 269 | { | 284 | { |
| @@ -301,6 +316,7 @@ static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) | |||
| 301 | } | 316 | } |
| 302 | static inline | 317 | static inline |
| 303 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, | 318 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, |
| 319 | const void *ns, | ||
| 304 | const unsigned char *name) | 320 | const unsigned char *name) |
| 305 | { | 321 | { |
| 306 | return NULL; | 322 | return NULL; |
| @@ -313,6 +329,10 @@ static inline void sysfs_put(struct sysfs_dirent *sd) | |||
| 313 | { | 329 | { |
| 314 | } | 330 | } |
| 315 | 331 | ||
| 332 | static inline void sysfs_exit_ns(int type, const void *tag) | ||
| 333 | { | ||
| 334 | } | ||
| 335 | |||
| 316 | static inline int __must_check sysfs_init(void) | 336 | static inline int __must_check sysfs_init(void) |
| 317 | { | 337 | { |
| 318 | return 0; | 338 | return 0; |
