]>
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 | * | |
7 | * Copyright (C) 2003-6 Philip Williams, Bruce Allen | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License as published by | |
11 | * the Free Software Foundation; either version 2, or (at your option) | |
12 | * any later version. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * (for example COPYING); if not, write to the Free | |
16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
17 | * | |
18 | */ | |
19 | ||
20 | #ifndef KNOWNDRIVES_H_ | |
21 | #define KNOWNDRIVES_H_ | |
22 | ||
4d59bff9 | 23 | #define KNOWNDRIVES_H_CVSID "$Id: knowndrives.h,v 1.17 2006/08/09 20:40:19 chrfranke Exp $\n" |
832b75ed GG |
24 | |
25 | /* Structure used to store settings for specific drives in knowndrives[]. The | |
26 | * elements are used in the following ways: | |
27 | * | |
28 | * modelfamily Informal string about the model family/series of a | |
29 | * device. Set to NULL if no info (apart from device id) | |
30 | * known. | |
31 | * modelregexp POSIX regular expression to match the model of a device. | |
32 | * This should never be NULL (except to terminate the | |
33 | * knowndrives array). | |
34 | * firmwareregexp POSIX regular expression to match a devices's firmware | |
35 | * version. This is optional and should be NULL if it is not | |
36 | * to be used. If it is non-NULL 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 | * vendoropts Pointer to first element of an array of vendor-specific | |
42 | * option attribute/value pairs that should be set for a | |
43 | * matching device unless the user has requested otherwise. | |
44 | * The user's own settings override these. The array should | |
45 | * be terminated with the entry {0,0}. | |
46 | * specialpurpose Pointer to a function that defines some additional action | |
47 | * that may be taken for matching devices. | |
48 | * functiondesc A description of the effect of the specialpurpose | |
49 | * function. Used by showpresets() and showallpresets() to | |
50 | * make the output more informative. | |
51 | */ | |
52 | typedef struct drivesettings_s { | |
4d59bff9 GG |
53 | const char * modelfamily; |
54 | const char * modelregexp; | |
55 | const char * firmwareregexp; | |
56 | const char * warningmsg; | |
57 | const unsigned char (* vendoropts)[2]; | |
58 | void (* specialpurpose)(smartmonctrl *); | |
59 | const char * functiondesc; | |
832b75ed GG |
60 | } drivesettings; |
61 | ||
62 | /* Table of settings for known drives. Defined in knowndrives.c. */ | |
63 | extern const drivesettings knowndrives[]; | |
64 | ||
65 | // Searches knowndrives[] for a drive with the given model number and firmware | |
66 | // string. | |
67 | int lookupdrive(const char *model, const char *firmware); | |
68 | ||
69 | // Shows the presets (if any) that are available for the given drive. | |
70 | void showpresets(const struct ata_identify_device *drive); | |
71 | ||
72 | // Shows all presets for drives in knowndrives[]. | |
73 | // Returns <0 on syntax error in regular expressions. | |
74 | int showallpresets(void); | |
75 | ||
76 | // Shows all matching presets for a drive in knowndrives[]. | |
77 | // Returns # matching entries. | |
78 | int showmatchingpresets(const char *model, const char *firmware); | |
79 | ||
80 | // Sets preset vendor attribute options in opts by finding the entry | |
81 | // (if any) for the given drive in knowndrives[]. Values that have | |
82 | // already been set in opts will not be changed. Also sets options in | |
83 | // con. Returns <0 if drive not recognized else index of drive in | |
84 | // database. | |
85 | int applypresets(const struct ata_identify_device *drive, unsigned char **opts, | |
86 | smartmonctrl *con); | |
87 | ||
88 | #endif |