diff options
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c index b922d4801c87..9074f384b097 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -189,6 +189,7 @@ void add_disk(struct gendisk *disk) | |||
189 | disk->minors, NULL, exact_match, exact_lock, disk); | 189 | disk->minors, NULL, exact_match, exact_lock, disk); |
190 | register_disk(disk); | 190 | register_disk(disk); |
191 | blk_register_queue(disk); | 191 | blk_register_queue(disk); |
192 | blk_register_filter(disk); | ||
192 | 193 | ||
193 | bdi = &disk->queue->backing_dev_info; | 194 | bdi = &disk->queue->backing_dev_info; |
194 | bdi_register_dev(bdi, MKDEV(disk->major, disk->first_minor)); | 195 | bdi_register_dev(bdi, MKDEV(disk->major, disk->first_minor)); |
@@ -200,6 +201,7 @@ EXPORT_SYMBOL(del_gendisk); /* in partitions/check.c */ | |||
200 | 201 | ||
201 | void unlink_gendisk(struct gendisk *disk) | 202 | void unlink_gendisk(struct gendisk *disk) |
202 | { | 203 | { |
204 | blk_unregister_filter(disk); | ||
203 | sysfs_remove_link(&disk->dev.kobj, "bdi"); | 205 | sysfs_remove_link(&disk->dev.kobj, "bdi"); |
204 | bdi_unregister(&disk->queue->backing_dev_info); | 206 | bdi_unregister(&disk->queue->backing_dev_info); |
205 | blk_unregister_queue(disk); | 207 | blk_unregister_queue(disk); |
@@ -400,6 +402,14 @@ static ssize_t disk_removable_show(struct device *dev, | |||
400 | (disk->flags & GENHD_FL_REMOVABLE ? 1 : 0)); | 402 | (disk->flags & GENHD_FL_REMOVABLE ? 1 : 0)); |
401 | } | 403 | } |
402 | 404 | ||
405 | static ssize_t disk_ro_show(struct device *dev, | ||
406 | struct device_attribute *attr, char *buf) | ||
407 | { | ||
408 | struct gendisk *disk = dev_to_disk(dev); | ||
409 | |||
410 | return sprintf(buf, "%d\n", disk->policy ? 1 : 0); | ||
411 | } | ||
412 | |||
403 | static ssize_t disk_size_show(struct device *dev, | 413 | static ssize_t disk_size_show(struct device *dev, |
404 | struct device_attribute *attr, char *buf) | 414 | struct device_attribute *attr, char *buf) |
405 | { | 415 | { |
@@ -472,6 +482,7 @@ static ssize_t disk_fail_store(struct device *dev, | |||
472 | 482 | ||
473 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); | 483 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); |
474 | static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); | 484 | static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); |
485 | static DEVICE_ATTR(ro, S_IRUGO, disk_ro_show, NULL); | ||
475 | static DEVICE_ATTR(size, S_IRUGO, disk_size_show, NULL); | 486 | static DEVICE_ATTR(size, S_IRUGO, disk_size_show, NULL); |
476 | static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); | 487 | static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); |
477 | static DEVICE_ATTR(stat, S_IRUGO, disk_stat_show, NULL); | 488 | static DEVICE_ATTR(stat, S_IRUGO, disk_stat_show, NULL); |
@@ -483,6 +494,7 @@ static struct device_attribute dev_attr_fail = | |||
483 | static struct attribute *disk_attrs[] = { | 494 | static struct attribute *disk_attrs[] = { |
484 | &dev_attr_range.attr, | 495 | &dev_attr_range.attr, |
485 | &dev_attr_removable.attr, | 496 | &dev_attr_removable.attr, |
497 | &dev_attr_ro.attr, | ||
486 | &dev_attr_size.attr, | 498 | &dev_attr_size.attr, |
487 | &dev_attr_capability.attr, | 499 | &dev_attr_capability.attr, |
488 | &dev_attr_stat.attr, | 500 | &dev_attr_stat.attr, |