diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:40:20 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:40:20 -0400 |
| commit | dc690d8ef842b464f1c429a376ca16cb8dbee6ae (patch) | |
| tree | 77955849af5a15755f5e55e24ae4b9c520583a72 /include/linux | |
| parent | 57399ec9077a4b962b81037aaa279fab52f5e989 (diff) | |
| parent | 91a6902958f052358899f58683d44e36228d85c2 (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (61 commits)
sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
sysfs: make directory dentries and inodes reclaimable
sysfs: implement sysfs_get_dentry()
sysfs: move sysfs_drop_dentry() to dir.c and make it static
sysfs: restructure add/remove paths and fix inode update
sysfs: use sysfs_mutex to protect the sysfs_dirent tree
sysfs: consolidate sysfs spinlocks
sysfs: make kobj point to sysfs_dirent instead of dentry
sysfs: implement sysfs_find_dirent() and sysfs_get_dirent()
sysfs: implement SYSFS_FLAG_REMOVED flag
sysfs: rename sysfs_dirent->s_type to s_flags and make room for flags
sysfs: make sysfs_drop_dentry() access inodes using ilookup()
sysfs: Fix oops in sysfs_drop_dentry on x86_64
sysfs: use singly-linked list for sysfs_dirent tree
sysfs: slim down sysfs_dirent->s_active
sysfs: move s_active functions to fs/sysfs/dir.c
sysfs: fix root sysfs_dirent -> root dentry association
sysfs: use iget_locked() instead of new_inode()
sysfs: reorganize sysfs_new_indoe() and sysfs_create()
sysfs: fix parent refcounting during rename and move
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/debugfs.h | 9 | ||||
| -rw-r--r-- | include/linux/device.h | 5 | ||||
| -rw-r--r-- | include/linux/dmi.h | 8 | ||||
| -rw-r--r-- | include/linux/idr.h | 29 | ||||
| -rw-r--r-- | include/linux/kobject.h | 9 | ||||
| -rw-r--r-- | include/linux/pm.h | 5 | ||||
| -rw-r--r-- | include/linux/sysdev.h | 3 | ||||
| -rw-r--r-- | include/linux/sysfs.h | 43 |
8 files changed, 80 insertions, 31 deletions
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 5a9c49534d08..104e51e20e14 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
| @@ -38,6 +38,9 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, | |||
| 38 | 38 | ||
| 39 | void debugfs_remove(struct dentry *dentry); | 39 | void debugfs_remove(struct dentry *dentry); |
| 40 | 40 | ||
| 41 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | ||
| 42 | struct dentry *new_dir, const char *new_name); | ||
| 43 | |||
| 41 | struct dentry *debugfs_create_u8(const char *name, mode_t mode, | 44 | struct dentry *debugfs_create_u8(const char *name, mode_t mode, |
| 42 | struct dentry *parent, u8 *value); | 45 | struct dentry *parent, u8 *value); |
| 43 | struct dentry *debugfs_create_u16(const char *name, mode_t mode, | 46 | struct dentry *debugfs_create_u16(const char *name, mode_t mode, |
| @@ -85,6 +88,12 @@ static inline struct dentry *debugfs_create_symlink(const char *name, | |||
| 85 | static inline void debugfs_remove(struct dentry *dentry) | 88 | static inline void debugfs_remove(struct dentry *dentry) |
| 86 | { } | 89 | { } |
| 87 | 90 | ||
| 91 | static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | ||
| 92 | struct dentry *new_dir, char *new_name) | ||
| 93 | { | ||
| 94 | return ERR_PTR(-ENODEV); | ||
| 95 | } | ||
| 96 | |||
| 88 | static inline struct dentry *debugfs_create_u8(const char *name, mode_t mode, | 97 | static inline struct dentry *debugfs_create_u8(const char *name, mode_t mode, |
| 89 | struct dentry *parent, | 98 | struct dentry *parent, |
| 90 | u8 *value) | 99 | u8 *value) |
diff --git a/include/linux/device.h b/include/linux/device.h index 2e1a2988b7e1..be2debed70d2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -238,7 +238,6 @@ extern int __must_check class_device_create_file(struct class_device *, | |||
| 238 | * @devt: for internal use by the driver core only. | 238 | * @devt: for internal use by the driver core only. |
| 239 | * @node: for internal use by the driver core only. | 239 | * @node: for internal use by the driver core only. |
| 240 | * @kobj: for internal use by the driver core only. | 240 | * @kobj: for internal use by the driver core only. |
| 241 | * @devt_attr: for internal use by the driver core only. | ||
| 242 | * @groups: optional additional groups to be created | 241 | * @groups: optional additional groups to be created |
| 243 | * @dev: if set, a symlink to the struct device is created in the sysfs | 242 | * @dev: if set, a symlink to the struct device is created in the sysfs |
| 244 | * directory for this struct class device. | 243 | * directory for this struct class device. |
| @@ -263,8 +262,6 @@ struct class_device { | |||
| 263 | struct kobject kobj; | 262 | struct kobject kobj; |
| 264 | struct class * class; /* required */ | 263 | struct class * class; /* required */ |
| 265 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 264 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
| 266 | struct class_device_attribute *devt_attr; | ||
| 267 | struct class_device_attribute uevent_attr; | ||
| 268 | struct device * dev; /* not necessary, but nice to have */ | 265 | struct device * dev; /* not necessary, but nice to have */ |
| 269 | void * class_data; /* class-specific data */ | 266 | void * class_data; /* class-specific data */ |
| 270 | struct class_device *parent; /* parent of this child device, if there is one */ | 267 | struct class_device *parent; /* parent of this child device, if there is one */ |
| @@ -419,8 +416,6 @@ struct device { | |||
| 419 | struct device_type *type; | 416 | struct device_type *type; |
| 420 | unsigned is_registered:1; | 417 | unsigned is_registered:1; |
| 421 | unsigned uevent_suppress:1; | 418 | unsigned uevent_suppress:1; |
| 422 | struct device_attribute uevent_attr; | ||
| 423 | struct device_attribute *devt_attr; | ||
| 424 | 419 | ||
| 425 | struct semaphore sem; /* semaphore to synchronize calls to | 420 | struct semaphore sem; /* semaphore to synchronize calls to |
| 426 | * its driver. | 421 | * its driver. |
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 904bf3d2d90b..b8ac7b01c45e 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
| @@ -12,9 +12,17 @@ enum dmi_field { | |||
| 12 | DMI_PRODUCT_NAME, | 12 | DMI_PRODUCT_NAME, |
| 13 | DMI_PRODUCT_VERSION, | 13 | DMI_PRODUCT_VERSION, |
| 14 | DMI_PRODUCT_SERIAL, | 14 | DMI_PRODUCT_SERIAL, |
| 15 | DMI_PRODUCT_UUID, | ||
| 15 | DMI_BOARD_VENDOR, | 16 | DMI_BOARD_VENDOR, |
| 16 | DMI_BOARD_NAME, | 17 | DMI_BOARD_NAME, |
| 17 | DMI_BOARD_VERSION, | 18 | DMI_BOARD_VERSION, |
| 19 | DMI_BOARD_SERIAL, | ||
| 20 | DMI_BOARD_ASSET_TAG, | ||
| 21 | DMI_CHASSIS_VENDOR, | ||
| 22 | DMI_CHASSIS_TYPE, | ||
| 23 | DMI_CHASSIS_VERSION, | ||
| 24 | DMI_CHASSIS_SERIAL, | ||
| 25 | DMI_CHASSIS_ASSET_TAG, | ||
| 18 | DMI_STRING_MAX, | 26 | DMI_STRING_MAX, |
| 19 | }; | 27 | }; |
| 20 | 28 | ||
diff --git a/include/linux/idr.h b/include/linux/idr.h index 826803449db7..915572fa030b 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
| @@ -83,4 +83,33 @@ void idr_remove(struct idr *idp, int id); | |||
| 83 | void idr_destroy(struct idr *idp); | 83 | void idr_destroy(struct idr *idp); |
| 84 | void idr_init(struct idr *idp); | 84 | void idr_init(struct idr *idp); |
| 85 | 85 | ||
| 86 | |||
| 87 | /* | ||
| 88 | * IDA - IDR based id allocator, use when translation from id to | ||
| 89 | * pointer isn't necessary. | ||
| 90 | */ | ||
| 91 | #define IDA_CHUNK_SIZE 128 /* 128 bytes per chunk */ | ||
| 92 | #define IDA_BITMAP_LONGS (128 / sizeof(long) - 1) | ||
| 93 | #define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8) | ||
| 94 | |||
| 95 | struct ida_bitmap { | ||
| 96 | long nr_busy; | ||
| 97 | unsigned long bitmap[IDA_BITMAP_LONGS]; | ||
| 98 | }; | ||
| 99 | |||
| 100 | struct ida { | ||
| 101 | struct idr idr; | ||
| 102 | struct ida_bitmap *free_bitmap; | ||
| 103 | }; | ||
| 104 | |||
| 105 | #define IDA_INIT(name) { .idr = IDR_INIT(name), .free_bitmap = NULL, } | ||
| 106 | #define DEFINE_IDA(name) struct ida name = IDA_INIT(name) | ||
| 107 | |||
| 108 | int ida_pre_get(struct ida *ida, gfp_t gfp_mask); | ||
| 109 | int ida_get_new_above(struct ida *ida, int starting_id, int *p_id); | ||
| 110 | int ida_get_new(struct ida *ida, int *p_id); | ||
| 111 | void ida_remove(struct ida *ida, int id); | ||
| 112 | void ida_destroy(struct ida *ida); | ||
| 113 | void ida_init(struct ida *ida); | ||
| 114 | |||
| 86 | #endif /* __IDR_H__ */ | 115 | #endif /* __IDR_H__ */ |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index c288e41ba331..06cbf41d32d2 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -55,7 +55,7 @@ struct kobject { | |||
| 55 | struct kobject * parent; | 55 | struct kobject * parent; |
| 56 | struct kset * kset; | 56 | struct kset * kset; |
| 57 | struct kobj_type * ktype; | 57 | struct kobj_type * ktype; |
| 58 | struct dentry * dentry; | 58 | struct sysfs_dirent * sd; |
| 59 | wait_queue_head_t poll; | 59 | wait_queue_head_t poll; |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| @@ -71,13 +71,14 @@ extern void kobject_init(struct kobject *); | |||
| 71 | extern void kobject_cleanup(struct kobject *); | 71 | extern void kobject_cleanup(struct kobject *); |
| 72 | 72 | ||
| 73 | extern int __must_check kobject_add(struct kobject *); | 73 | extern int __must_check kobject_add(struct kobject *); |
| 74 | extern int __must_check kobject_shadow_add(struct kobject *, struct dentry *); | 74 | extern int __must_check kobject_shadow_add(struct kobject *kobj, |
| 75 | struct sysfs_dirent *shadow_parent); | ||
| 75 | extern void kobject_del(struct kobject *); | 76 | extern void kobject_del(struct kobject *); |
| 76 | 77 | ||
| 77 | extern int __must_check kobject_rename(struct kobject *, const char *new_name); | 78 | extern int __must_check kobject_rename(struct kobject *, const char *new_name); |
| 78 | extern int __must_check kobject_shadow_rename(struct kobject *kobj, | 79 | extern int __must_check kobject_shadow_rename(struct kobject *kobj, |
| 79 | struct dentry *new_parent, | 80 | struct sysfs_dirent *new_parent, |
| 80 | const char *new_name); | 81 | const char *new_name); |
| 81 | extern int __must_check kobject_move(struct kobject *, struct kobject *); | 82 | extern int __must_check kobject_move(struct kobject *, struct kobject *); |
| 82 | 83 | ||
| 83 | extern int __must_check kobject_register(struct kobject *); | 84 | extern int __must_check kobject_register(struct kobject *); |
diff --git a/include/linux/pm.h b/include/linux/pm.h index b2c4fde4e994..273781c82e4d 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -267,15 +267,10 @@ struct dev_pm_info { | |||
| 267 | unsigned can_wakeup:1; | 267 | unsigned can_wakeup:1; |
| 268 | #ifdef CONFIG_PM | 268 | #ifdef CONFIG_PM |
| 269 | unsigned should_wakeup:1; | 269 | unsigned should_wakeup:1; |
| 270 | pm_message_t prev_state; | ||
| 271 | void * saved_state; | ||
| 272 | struct device * pm_parent; | ||
| 273 | struct list_head entry; | 270 | struct list_head entry; |
| 274 | #endif | 271 | #endif |
| 275 | }; | 272 | }; |
| 276 | 273 | ||
| 277 | extern void device_pm_set_parent(struct device * dev, struct device * parent); | ||
| 278 | |||
| 279 | extern int device_power_down(pm_message_t state); | 274 | extern int device_power_down(pm_message_t state); |
| 280 | extern void device_power_up(void); | 275 | extern void device_power_up(void); |
| 281 | extern void device_resume(void); | 276 | extern void device_resume(void); |
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index e699ab279c2c..e285746588d6 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
| @@ -101,8 +101,7 @@ struct sysdev_attribute { | |||
| 101 | 101 | ||
| 102 | #define _SYSDEV_ATTR(_name,_mode,_show,_store) \ | 102 | #define _SYSDEV_ATTR(_name,_mode,_show,_store) \ |
| 103 | { \ | 103 | { \ |
| 104 | .attr = { .name = __stringify(_name), .mode = _mode, \ | 104 | .attr = { .name = __stringify(_name), .mode = _mode }, \ |
| 105 | .owner = THIS_MODULE }, \ | ||
| 106 | .show = _show, \ | 105 | .show = _show, \ |
| 107 | .store = _store, \ | 106 | .store = _store, \ |
| 108 | } | 107 | } |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 7d5d1ec95c2e..be8228e50a27 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -19,10 +19,15 @@ struct kobject; | |||
| 19 | struct module; | 19 | struct module; |
| 20 | struct nameidata; | 20 | struct nameidata; |
| 21 | struct dentry; | 21 | struct dentry; |
| 22 | struct sysfs_dirent; | ||
| 22 | 23 | ||
| 24 | /* FIXME | ||
| 25 | * The *owner field is no longer used, but leave around | ||
| 26 | * until the tree gets cleaned up fully. | ||
| 27 | */ | ||
| 23 | struct attribute { | 28 | struct attribute { |
| 24 | const char * name; | 29 | const char * name; |
| 25 | struct module * owner; | 30 | struct module * owner; |
| 26 | mode_t mode; | 31 | mode_t mode; |
| 27 | }; | 32 | }; |
| 28 | 33 | ||
| @@ -39,14 +44,14 @@ struct attribute_group { | |||
| 39 | */ | 44 | */ |
| 40 | 45 | ||
| 41 | #define __ATTR(_name,_mode,_show,_store) { \ | 46 | #define __ATTR(_name,_mode,_show,_store) { \ |
| 42 | .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ | 47 | .attr = {.name = __stringify(_name), .mode = _mode }, \ |
| 43 | .show = _show, \ | 48 | .show = _show, \ |
| 44 | .store = _store, \ | 49 | .store = _store, \ |
| 45 | } | 50 | } |
| 46 | 51 | ||
| 47 | #define __ATTR_RO(_name) { \ | 52 | #define __ATTR_RO(_name) { \ |
| 48 | .attr = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE }, \ | 53 | .attr = { .name = __stringify(_name), .mode = 0444 }, \ |
| 49 | .show = _name##_show, \ | 54 | .show = _name##_show, \ |
| 50 | } | 55 | } |
| 51 | 56 | ||
| 52 | #define __ATTR_NULL { .attr = { .name = NULL } } | 57 | #define __ATTR_NULL { .attr = { .name = NULL } } |
| @@ -59,8 +64,10 @@ struct bin_attribute { | |||
| 59 | struct attribute attr; | 64 | struct attribute attr; |
| 60 | size_t size; | 65 | size_t size; |
| 61 | void *private; | 66 | void *private; |
| 62 | ssize_t (*read)(struct kobject *, char *, loff_t, size_t); | 67 | ssize_t (*read)(struct kobject *, struct bin_attribute *, |
| 63 | ssize_t (*write)(struct kobject *, char *, loff_t, size_t); | 68 | char *, loff_t, size_t); |
| 69 | ssize_t (*write)(struct kobject *, struct bin_attribute *, | ||
| 70 | char *, loff_t, size_t); | ||
| 64 | int (*mmap)(struct kobject *, struct bin_attribute *attr, | 71 | int (*mmap)(struct kobject *, struct bin_attribute *attr, |
| 65 | struct vm_area_struct *vma); | 72 | struct vm_area_struct *vma); |
| 66 | }; | 73 | }; |
| @@ -70,12 +77,16 @@ struct sysfs_ops { | |||
| 70 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); | 77 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); |
| 71 | }; | 78 | }; |
| 72 | 79 | ||
| 80 | #define SYSFS_TYPE_MASK 0x00ff | ||
| 73 | #define SYSFS_ROOT 0x0001 | 81 | #define SYSFS_ROOT 0x0001 |
| 74 | #define SYSFS_DIR 0x0002 | 82 | #define SYSFS_DIR 0x0002 |
| 75 | #define SYSFS_KOBJ_ATTR 0x0004 | 83 | #define SYSFS_KOBJ_ATTR 0x0004 |
| 76 | #define SYSFS_KOBJ_BIN_ATTR 0x0008 | 84 | #define SYSFS_KOBJ_BIN_ATTR 0x0008 |
| 77 | #define SYSFS_KOBJ_LINK 0x0020 | 85 | #define SYSFS_KOBJ_LINK 0x0020 |
| 78 | #define SYSFS_NOT_PINNED (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR | SYSFS_KOBJ_LINK) | 86 | #define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) |
| 87 | |||
| 88 | #define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK | ||
| 89 | #define SYSFS_FLAG_REMOVED 0x0100 | ||
| 79 | 90 | ||
| 80 | #ifdef CONFIG_SYSFS | 91 | #ifdef CONFIG_SYSFS |
| 81 | 92 | ||
| @@ -83,13 +94,14 @@ extern int sysfs_schedule_callback(struct kobject *kobj, | |||
| 83 | void (*func)(void *), void *data, struct module *owner); | 94 | void (*func)(void *), void *data, struct module *owner); |
| 84 | 95 | ||
| 85 | extern int __must_check | 96 | extern int __must_check |
| 86 | sysfs_create_dir(struct kobject *, struct dentry *); | 97 | sysfs_create_dir(struct kobject *kobj, struct sysfs_dirent *shadow_parent_sd); |
| 87 | 98 | ||
| 88 | extern void | 99 | extern void |
| 89 | sysfs_remove_dir(struct kobject *); | 100 | sysfs_remove_dir(struct kobject *); |
| 90 | 101 | ||
| 91 | extern int __must_check | 102 | extern int __must_check |
| 92 | sysfs_rename_dir(struct kobject *, struct dentry *, const char *new_name); | 103 | sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd, |
| 104 | const char *new_name); | ||
| 93 | 105 | ||
| 94 | extern int __must_check | 106 | extern int __must_check |
| 95 | sysfs_move_dir(struct kobject *, struct kobject *); | 107 | sysfs_move_dir(struct kobject *, struct kobject *); |
| @@ -129,8 +141,8 @@ void sysfs_notify(struct kobject * k, char *dir, char *attr); | |||
| 129 | 141 | ||
| 130 | extern int sysfs_make_shadowed_dir(struct kobject *kobj, | 142 | extern int sysfs_make_shadowed_dir(struct kobject *kobj, |
| 131 | void * (*follow_link)(struct dentry *, struct nameidata *)); | 143 | void * (*follow_link)(struct dentry *, struct nameidata *)); |
| 132 | extern struct dentry *sysfs_create_shadow_dir(struct kobject *kobj); | 144 | extern struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj); |
| 133 | extern void sysfs_remove_shadow_dir(struct dentry *dir); | 145 | extern void sysfs_remove_shadow_dir(struct sysfs_dirent *shadow_sd); |
| 134 | 146 | ||
| 135 | extern int __must_check sysfs_init(void); | 147 | extern int __must_check sysfs_init(void); |
| 136 | 148 | ||
| @@ -142,7 +154,8 @@ static inline int sysfs_schedule_callback(struct kobject *kobj, | |||
| 142 | return -ENOSYS; | 154 | return -ENOSYS; |
| 143 | } | 155 | } |
| 144 | 156 | ||
| 145 | static inline int sysfs_create_dir(struct kobject * k, struct dentry *shadow) | 157 | static inline int sysfs_create_dir(struct kobject *kobj, |
| 158 | struct sysfs_dirent *shadow_parent_sd) | ||
| 146 | { | 159 | { |
| 147 | return 0; | 160 | return 0; |
| 148 | } | 161 | } |
| @@ -152,9 +165,9 @@ static inline void sysfs_remove_dir(struct kobject * k) | |||
| 152 | ; | 165 | ; |
| 153 | } | 166 | } |
| 154 | 167 | ||
| 155 | static inline int sysfs_rename_dir(struct kobject * k, | 168 | static inline int sysfs_rename_dir(struct kobject *kobj, |
| 156 | struct dentry *new_parent, | 169 | struct sysfs_dirent *new_parent_sd, |
| 157 | const char *new_name) | 170 | const char *new_name) |
| 158 | { | 171 | { |
| 159 | return 0; | 172 | return 0; |
| 160 | } | 173 | } |
