Module hdd::drivedb [] [src]

Use this module to match hard drive and SMART values it returns against smartmontools database.

Example

use hdd::drivedb;
use hdd::drivedb::vendor_attribute;

// look for version updated with `update-smart-drivedb(8)` first
let drivedb = drivedb::load("/var/lib/smartmontools/drivedb/drivedb.h").or(
    drivedb::load("/usr/share/smartmontools/drivedb.h")
)?;

// extra attribute definitions that user might give
let user_attributes = vec!["9,minutes"]
    .into_iter()
    .map(|attr| vendor_attribute::parse(attr).unwrap())
    .collect();

// TODO: issue ATA IDENTIFY DEVICE cmd and parse the answer here
let id = unimplemented!();

let dbentry = drivedb::match_entry(
    &id,
    &drivedb,
    user_attributes,
);

if let Some(warn) = dbentry.warning {
    println!("WARNING: {}", warn);
}

Reexports

pub use self::vendor_attribute::Attribute;

Modules

vendor_attribute

Module to parse and manipulate attribute descriptions.

Structs

Entry

drivedb.h entry

Match

Matching drivedb entry, with parsed attribute presets and without irrelevant regexes.

Enums

Error

Functions

load

Opens file, parses its content and returns it as a Vec of entries.

match_entry

Matches given ATA IDENTIFY DEVICE response id against drive database db.