From 4e322a621814db6eb003f42fbdf79ca6f312a4ee Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 28 Oct 2009 11:57:46 +0100 Subject: [PATCH] =?utf8?q?Bug=2024772=20=E2=80=94=20Allow=20simulated=20SM?= =?utf8?q?ART=20data=20on=20non-SMART=20devices?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit DriveAtaSmartRefreshData(): Defer the "device supports SMART" test until after evaluating the "simulate" option, and set DriveAtaSmartIsAvailable property when simulate is given. With this, SMART data blobs can be used with non-SMART or virtual devices, too. Signed-off-by: David Zeuthen --- src/device.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/device.c b/src/device.c index d5467f3..a1e0b7a 100644 --- a/src/device.c +++ b/src/device.c @@ -8817,12 +8817,6 @@ device_drive_ata_smart_refresh_data_authorized_cb (Daemon *daemon, daemon_local_get_uid (device->priv->daemon, &caller_uid, context); - if (!device->priv->drive_ata_smart_is_available) - { - throw_error (context, ERROR_FAILED, "Device does not support ATA SMART"); - goto out; - } - simuldata = NULL; nowakeup = FALSE; for (n = 0; options[n] != NULL; n++) @@ -8838,6 +8832,7 @@ device_drive_ata_smart_refresh_data_authorized_cb (Daemon *daemon, } } simuldata = (const char *) options[n] + 9; + device_set_drive_ata_smart_is_available (device, TRUE); } else if (strcmp (options[n], "nowakeup") == 0) { @@ -8845,6 +8840,12 @@ device_drive_ata_smart_refresh_data_authorized_cb (Daemon *daemon, } } + if (!device->priv->drive_ata_smart_is_available) + { + throw_error (context, ERROR_FAILED, "Device does not support ATA SMART"); + goto out; + } + if (simuldata != NULL) { n = 0; @@ -8881,12 +8882,6 @@ device_drive_ata_smart_refresh_data (Device *device, { const gchar *action_id; - if (!device->priv->drive_ata_smart_is_available) - { - throw_error (context, ERROR_FAILED, "Device does not support ATA SMART"); - goto out; - } - action_id = NULL; if (context != NULL) { @@ -8904,7 +8899,6 @@ device_drive_ata_smart_refresh_data (Device *device, g_strdupv (options), g_strfreev); - out: return TRUE; } -- 2.7.4