aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/genhd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/genhd.c')
-rw-r--r--drivers/block/genhd.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c
index d42840cc0d1d..486ce1fdeb8c 100644
--- a/drivers/block/genhd.c
+++ b/drivers/block/genhd.c
@@ -337,10 +337,30 @@ static ssize_t disk_attr_show(struct kobject *kobj, struct attribute *attr,
337 return ret; 337 return ret;
338} 338}
339 339
340static ssize_t disk_attr_store(struct kobject * kobj, struct attribute * attr,
341 const char *page, size_t count)
342{
343 struct gendisk *disk = to_disk(kobj);
344 struct disk_attribute *disk_attr =
345 container_of(attr,struct disk_attribute,attr);
346 ssize_t ret = 0;
347
348 if (disk_attr->store)
349 ret = disk_attr->store(disk, page, count);
350 return ret;
351}
352
340static struct sysfs_ops disk_sysfs_ops = { 353static struct sysfs_ops disk_sysfs_ops = {
341 .show = &disk_attr_show, 354 .show = &disk_attr_show,
355 .store = &disk_attr_store,
342}; 356};
343 357
358static ssize_t disk_uevent_store(struct gendisk * disk,
359 const char *buf, size_t count)
360{
361 kobject_hotplug(&disk->kobj, KOBJ_ADD);
362 return count;
363}
344static ssize_t disk_dev_read(struct gendisk * disk, char *page) 364static ssize_t disk_dev_read(struct gendisk * disk, char *page)
345{ 365{
346 dev_t base = MKDEV(disk->major, disk->first_minor); 366 dev_t base = MKDEV(disk->major, disk->first_minor);
@@ -382,6 +402,10 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page)
382 jiffies_to_msecs(disk_stat_read(disk, io_ticks)), 402 jiffies_to_msecs(disk_stat_read(disk, io_ticks)),
383 jiffies_to_msecs(disk_stat_read(disk, time_in_queue))); 403 jiffies_to_msecs(disk_stat_read(disk, time_in_queue)));
384} 404}
405static struct disk_attribute disk_attr_uevent = {
406 .attr = {.name = "uevent", .mode = S_IWUSR },
407 .store = disk_uevent_store
408};
385static struct disk_attribute disk_attr_dev = { 409static struct disk_attribute disk_attr_dev = {
386 .attr = {.name = "dev", .mode = S_IRUGO }, 410 .attr = {.name = "dev", .mode = S_IRUGO },
387 .show = disk_dev_read 411 .show = disk_dev_read
@@ -404,6 +428,7 @@ static struct disk_attribute disk_attr_stat = {
404}; 428};
405 429
406static struct attribute * default_attrs[] = { 430static struct attribute * default_attrs[] = {
431 &disk_attr_uevent.attr,
407 &disk_attr_dev.attr, 432 &disk_attr_dev.attr,
408 &disk_attr_range.attr, 433 &disk_attr_range.attr,
409 &disk_attr_removable.attr, 434 &disk_attr_removable.attr,