diff options
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c index b922d4801c87..43e468ee5993 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -400,6 +400,14 @@ static ssize_t disk_removable_show(struct device *dev, | |||
400 | (disk->flags & GENHD_FL_REMOVABLE ? 1 : 0)); | 400 | (disk->flags & GENHD_FL_REMOVABLE ? 1 : 0)); |
401 | } | 401 | } |
402 | 402 | ||
403 | static ssize_t disk_ro_show(struct device *dev, | ||
404 | struct device_attribute *attr, char *buf) | ||
405 | { | ||
406 | struct gendisk *disk = dev_to_disk(dev); | ||
407 | |||
408 | return sprintf(buf, "%d\n", disk->policy ? 1 : 0); | ||
409 | } | ||
410 | |||
403 | static ssize_t disk_size_show(struct device *dev, | 411 | static ssize_t disk_size_show(struct device *dev, |
404 | struct device_attribute *attr, char *buf) | 412 | struct device_attribute *attr, char *buf) |
405 | { | 413 | { |
@@ -472,6 +480,7 @@ static ssize_t disk_fail_store(struct device *dev, | |||
472 | 480 | ||
473 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); | 481 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); |
474 | static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); | 482 | static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); |
483 | static DEVICE_ATTR(ro, S_IRUGO, disk_ro_show, NULL); | ||
475 | static DEVICE_ATTR(size, S_IRUGO, disk_size_show, NULL); | 484 | static DEVICE_ATTR(size, S_IRUGO, disk_size_show, NULL); |
476 | static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); | 485 | static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); |
477 | static DEVICE_ATTR(stat, S_IRUGO, disk_stat_show, NULL); | 486 | static DEVICE_ATTR(stat, S_IRUGO, disk_stat_show, NULL); |
@@ -483,6 +492,7 @@ static struct device_attribute dev_attr_fail = | |||
483 | static struct attribute *disk_attrs[] = { | 492 | static struct attribute *disk_attrs[] = { |
484 | &dev_attr_range.attr, | 493 | &dev_attr_range.attr, |
485 | &dev_attr_removable.attr, | 494 | &dev_attr_removable.attr, |
495 | &dev_attr_ro.attr, | ||
486 | &dev_attr_size.attr, | 496 | &dev_attr_size.attr, |
487 | &dev_attr_capability.attr, | 497 | &dev_attr_capability.attr, |
488 | &dev_attr_stat.attr, | 498 | &dev_attr_stat.attr, |