@@ -834,6 +834,22 @@ static void rdac_bus_detach( struct scsi_device *sdev )
kfree(h);
}
+static int rdac_state(struct scsi_device *sdev)
+{
+ struct rdac_dh_data *h = sdev->handler_data;
+ int access_state = SCSI_ACCESS_STATE_OPTIMAL;
+
+ if (h->lun_state == RDAC_LUN_UNOWNED)
+ access_state = SCSI_ACCESS_STATE_ACTIVE;
+ if (h->state == RDAC_STATE_PASSIVE)
+ access_state = SCSI_ACCESS_STATE_PASSIVE;
+
+ if (h->preferred == RDAC_PREFERRED)
+ access_state |= SCSI_ACCESS_STATE_PREFERRED;
+
+ return access_state;
+}
+
static struct scsi_device_handler rdac_dh = {
.name = RDAC_NAME,
.module = THIS_MODULE,
@@ -842,6 +858,7 @@ static struct scsi_device_handler rdac_dh = {
.attach = rdac_bus_attach,
.detach = rdac_bus_detach,
.activate = rdac_activate,
+ .state = rdac_state,
};
static int __init rdac_init(void)
Add a 'state' callback to display the current LUN access state to sysfs. Signed-off-by: Hannes Reinecke <hare@suse.de> --- drivers/scsi/device_handler/scsi_dh_rdac.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)