smartmontools SVN Rev 3317
Utility to control and monitor storage systems with "S.M.A.R.T."
knowndrives.h
Go to the documentation of this file.
00001 /*
00002  * knowndrives.h
00003  *
00004  * Home page of code is: http://smartmontools.sourceforge.net
00005  * Address of support mailing list: smartmontools-support@lists.sourceforge.net
00006  *
00007  * Copyright (C) 2003-11 Philip Williams, Bruce Allen
00008  * Copyright (C) 2008-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
00017  *
00018  */
00019 
00020 #ifndef KNOWNDRIVES_H_
00021 #define KNOWNDRIVES_H_
00022 
00023 #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 3597 2012-09-04 21:10:37Z chrfranke $\n"
00024 
00025 // Structure to store drive database entries, see drivedb.h for a description.
00026 struct drive_settings {
00027   const char * modelfamily;
00028   const char * modelregexp;
00029   const char * firmwareregexp;
00030   const char * warningmsg;
00031   const char * presets;
00032 };
00033 
00034 // info returned by lookup_usb_device()
00035 struct usb_dev_info
00036 {
00037   std::string usb_device; // Device name, empty if unknown
00038   std::string usb_bridge; // USB bridge name, empty if unknown
00039   std::string usb_type;   // Type string ('-d' option).
00040 };
00041 
00042 // Search drivedb for USB device with vendor:product ID.
00043 int lookup_usb_device(int vendor_id, int product_id, int bcd_device,
00044                       usb_dev_info & info, usb_dev_info & info2);
00045 
00046 // Shows the presets (if any) that are available for the given drive.
00047 void show_presets(const ata_identify_device * drive);
00048 
00049 // Shows all presets for drives in knowndrives[].
00050 // Returns #syntax errors.
00051 int showallpresets();
00052 
00053 // Shows all matching presets for a drive in knowndrives[].
00054 // Returns # matching entries.
00055 int showmatchingpresets(const char *model, const char *firmware);
00056 
00057 // Searches drive database and sets preset vendor attribute
00058 // options in defs and firmwarebugs.
00059 // Values that have already been set will not be changed.
00060 // Returns pointer to database entry or nullptr if none found.
00061 const drive_settings * lookup_drive_apply_presets(
00062   const ata_identify_device * drive, ata_vendor_attr_defs & defs,
00063   firmwarebug_defs & firmwarebugs);
00064 
00065 // Get path for additional database file
00066 const char * get_drivedb_path_add();
00067 
00068 #ifdef SMARTMONTOOLS_DRIVEDBDIR
00069 // Get path for default database file
00070 const char * get_drivedb_path_default();
00071 #endif
00072 
00073 // Read drive database from file.
00074 bool read_drive_database(const char * path);
00075 
00076 // Read drive databases from standard places.
00077 bool read_default_drive_databases();
00078 
00079 #endif