smartmontools  SVN Rev 4325
Utility to control and monitor storage systems with "S.M.A.R.T."
Classes | Macros | Typedefs | Enumerations | Functions | Variables
knowndrives.cpp File Reference
#include "config.h"
#include "int64.h"
#include <stdio.h>
#include "atacmds.h"
#include "knowndrives.h"
#include "utility.h"
#include <stdexcept>
#include "drivedb.h"
Include dependency graph for knowndrives.cpp:

Go to the source code of this file.

Classes

class  drive_database
 Drive database class. More...
 
class  stdin_iterator
 
struct  token_info
 

Macros

#define MODEL_STRING_LENGTH   40
 
#define FIRMWARE_STRING_LENGTH   8
 
#define TABLEPRINTWIDTH   19
 

Typedefs

typedef stdin_iterator parse_ptr
 

Enumerations

enum  dbentry_type { DBENTRY_ATA_DEFAULT, DBENTRY_ATA, DBENTRY_USB }
 

Functions

static dbentry_type get_modelfamily_type (const char *modelfamily)
 
static dbentry_type get_dbentry_type (const drive_settings *dbentry)
 
static bool compile (regular_expression &regex, const char *pattern)
 
static bool match (const char *pattern, const char *str)
 
static const drive_settingslookup_drive (const char *model, const char *firmware)
 
static bool parse_db_presets (const char *presets, ata_vendor_attr_defs *defs, firmwarebug_defs *firmwarebugs, std::string *type)
 
static bool parse_default_presets (const char *presets, ata_vendor_attr_defs &defs)
 
static bool parse_presets (const char *presets, ata_vendor_attr_defs &defs, firmwarebug_defs &firmwarebugs)
 
static bool parse_usb_type (const char *presets, std::string &type)
 
static void parse_usb_names (const char *names, usb_dev_info &info)
 
int lookup_usb_device (int vendor_id, int product_id, int bcd_device, usb_dev_info &info, usb_dev_info &info2)
 
static int showonepreset (const drive_settings *dbentry)
 
int showallpresets ()
 
int showmatchingpresets (const char *model, const char *firmware)
 
void show_presets (const ata_identify_device *drive)
 
const drive_settingslookup_drive_apply_presets (const ata_identify_device *drive, ata_vendor_attr_defs &defs, firmwarebug_defs &firmwarebugs)
 
static parse_ptr skip_white (parse_ptr src, const char *path, int &line)
 
static parse_ptr get_token (parse_ptr src, token_info &token, const char *path, int &line)
 
static bool parse_drive_database (parse_ptr src, drive_database &db, const char *path)
 
bool read_drive_database (const char *path)
 
const char * get_drivedb_path_add ()
 
static bool read_default_drive_databases ()
 
static bool init_default_attr_defs ()
 
bool init_drive_database (bool use_default_db)
 
const ata_vendor_attr_defsget_default_attr_defs ()
 

Variables

const char * knowndrives_cpp_cvsid
 
const drive_settings builtin_knowndrives []
 
const unsigned builtin_knowndrives_size
 
static drive_database knowndrives
 The drive database. More...
 
static ata_vendor_attr_defs default_attr_defs
 

Macro Definition Documentation

#define FIRMWARE_STRING_LENGTH   8

Definition at line 39 of file knowndrives.cpp.

#define MODEL_STRING_LENGTH   40

Definition at line 38 of file knowndrives.cpp.

#define TABLEPRINTWIDTH   19

Definition at line 40 of file knowndrives.cpp.

Typedef Documentation

Definition at line 631 of file knowndrives.cpp.

Enumeration Type Documentation

Enumerator
DBENTRY_ATA_DEFAULT 
DBENTRY_ATA 
DBENTRY_USB 

Definition at line 144 of file knowndrives.cpp.

Function Documentation

static bool compile ( regular_expression regex,
const char *  pattern 
)
static

Definition at line 167 of file knowndrives.cpp.

static dbentry_type get_dbentry_type ( const drive_settings dbentry)
inlinestatic

Definition at line 161 of file knowndrives.cpp.

const ata_vendor_attr_defs& get_default_attr_defs ( )

Definition at line 971 of file knowndrives.cpp.

const char* get_drivedb_path_add ( )

Definition at line 872 of file knowndrives.cpp.

static dbentry_type get_modelfamily_type ( const char *  modelfamily)
static

Definition at line 151 of file knowndrives.cpp.

static parse_ptr get_token ( parse_ptr  src,
token_info token,
const char *  path,
int &  line 
)
static

Definition at line 690 of file knowndrives.cpp.

static bool init_default_attr_defs ( )
static

Definition at line 927 of file knowndrives.cpp.

bool init_drive_database ( bool  use_default_db)

Definition at line 962 of file knowndrives.cpp.

static const drive_settings* lookup_drive ( const char *  model,
const char *  firmware 
)
static

Definition at line 191 of file knowndrives.cpp.

const drive_settings* lookup_drive_apply_presets ( const ata_identify_device drive,
ata_vendor_attr_defs defs,
firmwarebug_defs firmwarebugs 
)

Definition at line 562 of file knowndrives.cpp.

int lookup_usb_device ( int  vendor_id,
int  product_id,
int  bcd_device,
usb_dev_info info,
usb_dev_info info2 
)

Definition at line 292 of file knowndrives.cpp.

static bool match ( const char *  pattern,
const char *  str 
)
static

Definition at line 179 of file knowndrives.cpp.

static bool parse_db_presets ( const char *  presets,
ata_vendor_attr_defs defs,
firmwarebug_defs firmwarebugs,
std::string *  type 
)
static

Definition at line 222 of file knowndrives.cpp.

static bool parse_default_presets ( const char *  presets,
ata_vendor_attr_defs defs 
)
inlinestatic

Definition at line 258 of file knowndrives.cpp.

static bool parse_drive_database ( parse_ptr  src,
drive_database db,
const char *  path 
)
static

Definition at line 748 of file knowndrives.cpp.

static bool parse_presets ( const char *  presets,
ata_vendor_attr_defs defs,
firmwarebug_defs firmwarebugs 
)
inlinestatic

Definition at line 265 of file knowndrives.cpp.

static void parse_usb_names ( const char *  names,
usb_dev_info info 
)
static

Definition at line 279 of file knowndrives.cpp.

static bool parse_usb_type ( const char *  presets,
std::string &  type 
)
inlinestatic

Definition at line 273 of file knowndrives.cpp.

static bool read_default_drive_databases ( )
static

Definition at line 898 of file knowndrives.cpp.

bool read_drive_database ( const char *  path)

Definition at line 856 of file knowndrives.cpp.

void show_presets ( const ata_identify_device drive)

Definition at line 528 of file knowndrives.cpp.

int showallpresets ( )

Definition at line 470 of file knowndrives.cpp.

int showmatchingpresets ( const char *  model,
const char *  firmware 
)

Definition at line 495 of file knowndrives.cpp.

static int showonepreset ( const drive_settings dbentry)
static

Definition at line 348 of file knowndrives.cpp.

static parse_ptr skip_white ( parse_ptr  src,
const char *  path,
int &  line 
)
static

Definition at line 634 of file knowndrives.cpp.

Variable Documentation

const drive_settings builtin_knowndrives[]

Definition at line 49 of file knowndrives.cpp.

const unsigned builtin_knowndrives_size
Initial value:
=
const drive_settings builtin_knowndrives[]
Definition: knowndrives.cpp:49

Definition at line 53 of file knowndrives.cpp.

ata_vendor_attr_defs default_attr_defs
static

Definition at line 924 of file knowndrives.cpp.

drive_database knowndrives
static

The drive database.

Definition at line 141 of file knowndrives.cpp.

const char* knowndrives_cpp_cvsid
Initial value:
= "$Id: knowndrives.cpp 4208 2016-01-22 19:45:35Z chrfranke $"
#define KNOWNDRIVES_H_CVSID
Definition: knowndrives.h:22

Definition at line 35 of file knowndrives.cpp.