diff options
author | Horst Hummel <horst.hummel@de.ibm.com> | 2005-05-01 11:58:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-01 11:58:59 -0400 |
commit | f24acd4503270ed4c842c8fef0b71105285e0a06 (patch) | |
tree | 9125df60bf98ddcd8197bf479e8a48d22f51af14 /drivers/s390/block/dasd_devmap.c | |
parent | e8f0641ef74eaa71ed9aa9d19c4b741c2143d752 (diff) |
[PATCH] s390: dasd readonly attribute
The independent read-only flags in devmap, dasd_device and gendisk are not
kept in sync. Use one bit per feature in the dasd driver and keep that bit in
sync with the gendisk bit.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index ad1841a96c87..1aedc48e5f85 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * functions may not be called from interrupt context. In particular | 11 | * functions may not be called from interrupt context. In particular |
12 | * dasd_get_device is a no-no from interrupt context. | 12 | * dasd_get_device is a no-no from interrupt context. |
13 | * | 13 | * |
14 | * $Revision: 1.37 $ | 14 | * $Revision: 1.40 $ |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
@@ -513,14 +513,6 @@ dasd_create_device(struct ccw_device *cdev) | |||
513 | if (!devmap->device) { | 513 | if (!devmap->device) { |
514 | devmap->device = device; | 514 | devmap->device = device; |
515 | device->devindex = devmap->devindex; | 515 | device->devindex = devmap->devindex; |
516 | if (devmap->features & DASD_FEATURE_READONLY) | ||
517 | set_bit(DASD_FLAG_RO, &device->flags); | ||
518 | else | ||
519 | clear_bit(DASD_FLAG_RO, &device->flags); | ||
520 | if (devmap->features & DASD_FEATURE_USEDIAG) | ||
521 | set_bit(DASD_FLAG_USE_DIAG, &device->flags); | ||
522 | else | ||
523 | clear_bit(DASD_FLAG_USE_DIAG, &device->flags); | ||
524 | get_device(&cdev->dev); | 516 | get_device(&cdev->dev); |
525 | device->cdev = cdev; | 517 | device->cdev = cdev; |
526 | rc = 0; | 518 | rc = 0; |
@@ -651,14 +643,8 @@ dasd_ro_store(struct device *dev, const char *buf, size_t count) | |||
651 | devmap->features |= DASD_FEATURE_READONLY; | 643 | devmap->features |= DASD_FEATURE_READONLY; |
652 | else | 644 | else |
653 | devmap->features &= ~DASD_FEATURE_READONLY; | 645 | devmap->features &= ~DASD_FEATURE_READONLY; |
654 | if (devmap->device) { | 646 | if (devmap->device && devmap->device->gdp) |
655 | if (devmap->device->gdp) | 647 | set_disk_ro(devmap->device->gdp, ro_flag); |
656 | set_disk_ro(devmap->device->gdp, ro_flag); | ||
657 | if (ro_flag) | ||
658 | set_bit(DASD_FLAG_RO, &devmap->device->flags); | ||
659 | else | ||
660 | clear_bit(DASD_FLAG_RO, &devmap->device->flags); | ||
661 | } | ||
662 | spin_unlock(&dasd_devmap_lock); | 648 | spin_unlock(&dasd_devmap_lock); |
663 | return count; | 649 | return count; |
664 | } | 650 | } |
@@ -739,6 +725,45 @@ static struct attribute_group dasd_attr_group = { | |||
739 | .attrs = dasd_attrs, | 725 | .attrs = dasd_attrs, |
740 | }; | 726 | }; |
741 | 727 | ||
728 | /* | ||
729 | * Return value of the specified feature. | ||
730 | */ | ||
731 | int | ||
732 | dasd_get_feature(struct ccw_device *cdev, int feature) | ||
733 | { | ||
734 | struct dasd_devmap *devmap; | ||
735 | |||
736 | devmap = dasd_find_busid(cdev->dev.bus_id); | ||
737 | if (IS_ERR(devmap)) | ||
738 | return (int) PTR_ERR(devmap); | ||
739 | |||
740 | return ((devmap->features & feature) != 0); | ||
741 | } | ||
742 | |||
743 | /* | ||
744 | * Set / reset given feature. | ||
745 | * Flag indicates wether to set (!=0) or the reset (=0) the feature. | ||
746 | */ | ||
747 | int | ||
748 | dasd_set_feature(struct ccw_device *cdev, int feature, int flag) | ||
749 | { | ||
750 | struct dasd_devmap *devmap; | ||
751 | |||
752 | devmap = dasd_find_busid(cdev->dev.bus_id); | ||
753 | if (IS_ERR(devmap)) | ||
754 | return (int) PTR_ERR(devmap); | ||
755 | |||
756 | spin_lock(&dasd_devmap_lock); | ||
757 | if (flag) | ||
758 | devmap->features |= feature; | ||
759 | else | ||
760 | devmap->features &= ~feature; | ||
761 | |||
762 | spin_unlock(&dasd_devmap_lock); | ||
763 | return 0; | ||
764 | } | ||
765 | |||
766 | |||
742 | int | 767 | int |
743 | dasd_add_sysfs_files(struct ccw_device *cdev) | 768 | dasd_add_sysfs_files(struct ccw_device *cdev) |
744 | { | 769 | { |