aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-10-01 08:49:43 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:51 -0400
commita7fd67062efc5b0fc9a61368c607fa92d1d57f9e (patch)
tree8b91f198640608bd99f4e4764394e5134220abcf /include/linux
parentd8539d81aeee4dbdc0624a798321e822fb2df7ae (diff)
[PATCH] add sysfs attr to re-emit device hotplug event
A "coldplug + udevstart" can be simple like this: for i in /sys/block/*/*/uevent; do echo 1 > $i; done for i in /sys/class/*/*/uevent; do echo 1 > $i; done for i in /sys/bus/*/devices/*/uevent; do echo 1 > $i; done Signed-off-by: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device.h57
-rw-r--r--include/linux/genhd.h1
2 files changed, 29 insertions, 29 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index a53a822c4d16..e86a580b72e1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -190,6 +190,18 @@ struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store)
190extern int class_create_file(struct class *, const struct class_attribute *); 190extern int class_create_file(struct class *, const struct class_attribute *);
191extern void class_remove_file(struct class *, const struct class_attribute *); 191extern void class_remove_file(struct class *, const struct class_attribute *);
192 192
193struct class_device_attribute {
194 struct attribute attr;
195 ssize_t (*show)(struct class_device *, char * buf);
196 ssize_t (*store)(struct class_device *, const char * buf, size_t count);
197};
198
199#define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \
200struct class_device_attribute class_device_attr_##_name = \
201 __ATTR(_name,_mode,_show,_store)
202
203extern int class_device_create_file(struct class_device *,
204 const struct class_device_attribute *);
193 205
194struct class_device { 206struct class_device {
195 struct list_head node; 207 struct list_head node;
@@ -198,6 +210,7 @@ struct class_device {
198 struct class * class; /* required */ 210 struct class * class; /* required */
199 dev_t devt; /* dev_t, creates the sysfs "dev" */ 211 dev_t devt; /* dev_t, creates the sysfs "dev" */
200 struct class_device_attribute *devt_attr; 212 struct class_device_attribute *devt_attr;
213 struct class_device_attribute uevent_attr;
201 struct device * dev; /* not necessary, but nice to have */ 214 struct device * dev; /* not necessary, but nice to have */
202 void * class_data; /* class-specific data */ 215 void * class_data; /* class-specific data */
203 216
@@ -228,18 +241,6 @@ extern int class_device_rename(struct class_device *, char *);
228extern struct class_device * class_device_get(struct class_device *); 241extern struct class_device * class_device_get(struct class_device *);
229extern void class_device_put(struct class_device *); 242extern void class_device_put(struct class_device *);
230 243
231struct class_device_attribute {
232 struct attribute attr;
233 ssize_t (*show)(struct class_device *, char * buf);
234 ssize_t (*store)(struct class_device *, const char * buf, size_t count);
235};
236
237#define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \
238struct class_device_attribute class_device_attr_##_name = \
239 __ATTR(_name,_mode,_show,_store)
240
241extern int class_device_create_file(struct class_device *,
242 const struct class_device_attribute *);
243extern void class_device_remove_file(struct class_device *, 244extern void class_device_remove_file(struct class_device *,
244 const struct class_device_attribute *); 245 const struct class_device_attribute *);
245extern int class_device_create_bin_file(struct class_device *, 246extern int class_device_create_bin_file(struct class_device *,
@@ -266,6 +267,20 @@ extern struct class_device *class_device_create(struct class *cls, dev_t devt,
266extern void class_device_destroy(struct class *cls, dev_t devt); 267extern void class_device_destroy(struct class *cls, dev_t devt);
267 268
268 269
270/* interface for exporting device attributes */
271struct device_attribute {
272 struct attribute attr;
273 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
274 char *buf);
275 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
276 const char *buf, size_t count);
277};
278
279#define DEVICE_ATTR(_name,_mode,_show,_store) \
280struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
281
282extern int device_create_file(struct device *device, struct device_attribute * entry);
283extern void device_remove_file(struct device * dev, struct device_attribute * attr);
269struct device { 284struct device {
270 struct klist klist_children; 285 struct klist klist_children;
271 struct klist_node knode_parent; /* node in sibling list */ 286 struct klist_node knode_parent; /* node in sibling list */
@@ -275,6 +290,7 @@ struct device {
275 290
276 struct kobject kobj; 291 struct kobject kobj;
277 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 292 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
293 struct device_attribute uevent_attr;
278 294
279 struct semaphore sem; /* semaphore to synchronize calls to 295 struct semaphore sem; /* semaphore to synchronize calls to
280 * its driver. 296 * its driver.
@@ -343,23 +359,6 @@ extern int device_attach(struct device * dev);
343extern void driver_attach(struct device_driver * drv); 359extern void driver_attach(struct device_driver * drv);
344 360
345 361
346/* driverfs interface for exporting device attributes */
347
348struct device_attribute {
349 struct attribute attr;
350 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
351 char *buf);
352 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
353 const char *buf, size_t count);
354};
355
356#define DEVICE_ATTR(_name,_mode,_show,_store) \
357struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
358
359
360extern int device_create_file(struct device *device, struct device_attribute * entry);
361extern void device_remove_file(struct device * dev, struct device_attribute * attr);
362
363/* 362/*
364 * Platform "fixup" functions - allow the platform to have their say 363 * Platform "fixup" functions - allow the platform to have their say
365 * about devices and actions that the general device layer doesn't 364 * about devices and actions that the general device layer doesn't
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 01796c41c951..78af34840c69 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -132,6 +132,7 @@ struct gendisk {
132struct disk_attribute { 132struct disk_attribute {
133 struct attribute attr; 133 struct attribute attr;
134 ssize_t (*show)(struct gendisk *, char *); 134 ssize_t (*show)(struct gendisk *, char *);
135 ssize_t (*store)(struct gendisk *, const char *, size_t);
135}; 136};
136 137
137/* 138/*