]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - knowndrives.h
Merge commit 'upstream/5.38+svn2993'
[mirror_smartmontools-debian.git] / knowndrives.h
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 *
7 * Copyright (C) 2003-8 Philip Williams, Bruce Allen
8 * Copyright (C) 2008 Christian Franke <smartmontools-support@lists.sourceforge.net>
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
24 #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h 2975 2009-10-29 22:52:38Z chrfranke $\n"
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
30 * device. Set to "" if no info (apart from device id)
31 * known.
32 * modelregexp POSIX regular expression to match the model of a device.
33 * This should never be "".
34 * firmwareregexp POSIX regular expression to match a devices's firmware
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
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.
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.
44 */
45 struct drive_settings {
46 const char * modelfamily;
47 const char * modelregexp;
48 const char * firmwareregexp;
49 const char * warningmsg;
50 const char * presets;
51 };
52
53 // Searches knowndrives[] for a drive with the given model number and firmware
54 // string.
55 const drive_settings * lookup_drive(const char * model, const char * firmware);
56
57 // Shows the presets (if any) that are available for the given drive.
58 void show_presets(const ata_identify_device * drive, bool fix_swapped_id);
59
60 // Shows all presets for drives in knowndrives[].
61 // Returns #syntax errors.
62 int showallpresets();
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
71 // con. Returns false if drive not recognized.
72 bool apply_presets(const ata_identify_device * drive, ata_vendor_attr_defs & defs,
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();
80
81 #endif