]>
Commit | Line | Data |
---|---|---|
832b75ed GG |
1 | /* |
2 | * knowndrives.h | |
3 | * | |
4 | * Home page of code is: http://smartmontools.sourceforge.net | |
5 | * Address of support mailing list: smartmontools-support@lists.sourceforge.net | |
6 | * | |
34ad0c5f | 7 | * Copyright (C) 2003-8 Philip Williams, Bruce Allen |
2127e193 | 8 | * Copyright (C) 2008 Christian Franke <smartmontools-support@lists.sourceforge.net> |
832b75ed GG |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2, or (at your option) | |
13 | * any later version. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * (for example COPYING); if not, write to the Free | |
17 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
18 | * | |
19 | */ | |
20 | ||
21 | #ifndef KNOWNDRIVES_H_ | |
22 | #define KNOWNDRIVES_H_ | |
23 | ||
2127e193 | 24 | #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h,v 1.23 2009/04/16 21:24:08 chrfranke Exp $\n" |
832b75ed GG |
25 | |
26 | /* Structure used to store settings for specific drives in knowndrives[]. The | |
27 | * elements are used in the following ways: | |
28 | * | |
29 | * modelfamily Informal string about the model family/series of a | |
2127e193 | 30 | * device. Set to "" if no info (apart from device id) |
832b75ed GG |
31 | * known. |
32 | * modelregexp POSIX regular expression to match the model of a device. | |
2127e193 | 33 | * This should never be "". |
832b75ed | 34 | * firmwareregexp POSIX regular expression to match a devices's firmware |
2127e193 GI |
35 | * version. This is optional and should be "" if it is not |
36 | * to be used. If it is nonempty then it will be used to | |
832b75ed GG |
37 | * narrow the set of devices matched by modelregexp. |
38 | * warningmsg A message that may be displayed for matching drives. For | |
39 | * example, to inform the user that they may need to apply a | |
40 | * firmware patch. | |
2127e193 GI |
41 | * presets String with vendor-specific attribute ('-v') and firmware |
42 | * bug fix ('-F') options. Same syntax as in smartctl command | |
43 | * line. The user's own settings override these. | |
832b75ed | 44 | */ |
2127e193 | 45 | struct drive_settings { |
4d59bff9 GG |
46 | const char * modelfamily; |
47 | const char * modelregexp; | |
48 | const char * firmwareregexp; | |
49 | const char * warningmsg; | |
2127e193 GI |
50 | const char * presets; |
51 | }; | |
832b75ed GG |
52 | |
53 | // Searches knowndrives[] for a drive with the given model number and firmware | |
54 | // string. | |
2127e193 | 55 | const drive_settings * lookup_drive(const char * model, const char * firmware); |
832b75ed GG |
56 | |
57 | // Shows the presets (if any) that are available for the given drive. | |
2127e193 | 58 | void show_presets(const ata_identify_device * drive, bool fix_swapped_id); |
832b75ed GG |
59 | |
60 | // Shows all presets for drives in knowndrives[]. | |
2127e193 GI |
61 | // Returns #syntax errors. |
62 | int showallpresets(); | |
832b75ed GG |
63 | |
64 | // Shows all matching presets for a drive in knowndrives[]. | |
65 | // Returns # matching entries. | |
66 | int showmatchingpresets(const char *model, const char *firmware); | |
67 | ||
68 | // Sets preset vendor attribute options in opts by finding the entry | |
69 | // (if any) for the given drive in knowndrives[]. Values that have | |
70 | // already been set in opts will not be changed. Also sets options in | |
2127e193 GI |
71 | // con. Returns false if drive not recognized. |
72 | bool apply_presets(const ata_identify_device * drive, unsigned char * opts, | |
73 | unsigned char & fix_firmwarebug, bool fix_swapped_id); | |
74 | ||
75 | // Read drive database from file. | |
76 | bool read_drive_database(const char * path); | |
77 | ||
78 | // Read drive databases from standard places. | |
79 | bool read_default_drive_databases(); | |
832b75ed GG |
80 | |
81 | #endif |