summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-05-07 02:07:35 +0200
committerLennart Poettering <lennart@poettering.net>2009-05-07 02:07:35 +0200
commit4575df30a94c94ab151b2ba1cb964f3e0037e4e6 (patch)
tree04e02f5d16a182f0d2d8023aefa8cebdcc357cbd
parentb5ea0622d20806e20e84f9a3a216040561a13287 (diff)
if the ID_ATA_SMART_ACCESS udev env var is set for a device read the access method from it
-rw-r--r--atasmart.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/atasmart.c b/atasmart.c
index 0d71926..d11ab08 100644
--- a/atasmart.c
+++ b/atasmart.c
@@ -2275,6 +2275,7 @@ static int disk_find_type(SkDisk *d, dev_t devnum) {
struct udev *udev;
struct udev_device *dev = NULL, *usb;
int r = -1;
+ const char *a;
assert(d);
@@ -2288,6 +2289,27 @@ static int disk_find_type(SkDisk *d, dev_t devnum) {
goto finish;
}
+ if ((a = udev_device_get_property_value(dev, "ID_ATA_SMART_ACCESS"))) {
+ unsigned u;
+
+ for (u = 0; u < _SK_DISK_TYPE_MAX; u++) {
+ const char *t;
+
+ if (!(t = disk_type_to_prefix_string(u)))
+ continue;
+
+ if (!strcmp(a, t)) {
+ d->type = u;
+ r = 0;
+ goto finish;
+ }
+ }
+
+ d->type = SK_DISK_TYPE_NONE;
+ r = 0;
+ goto finish;
+ }
+
if ((usb = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device"))) {
const char *product, *vendor;
uint32_t pid, vid;