Commit 1bba486f authored by (no author)'s avatar (no author)
Browse files

This commit was manufactured by cvs2svn to create tag

'RELEASE_5_1_11'.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/tags/RELEASE_5_1_11@737 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent d9ddb5fd
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no
# Put CVS lock files in this directory rather than directly in the repository.
#LockDir=/var/lock/cvs
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
# history file, or a subset as needed (ie `TMAR' logs all write operations)
#LogHistory=TOFEWGCMAR
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.
# The "loginfo" file controls where "cvs commit" log information
# is sent. The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT. If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter. The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators. The format
# characters are:
#
# s = file name
# V = old version number (pre-checkin)
# v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
^sm5$ /cvsroot/sitedocs/CVSROOT/cvstools/syncmail -u %{sVv} smartmontools-cvs@lists.sourceforge.net
^www$ /cvsroot/sitedocs/CVSROOT/cvstools/syncmail -u %{sVv} ballen4705@users.sourceforge.net
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4-> file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
# The "verifymsg" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.
This diff is collapsed.
This diff is collapsed.
/*
* knowndrives.c
*
* Home page of code is: http://smartmontools.sourceforge.net
* Address of support mailing list: smartmontools-support@lists.sourceforge.net
*
* Copyright (C) 2003 Philip Williams, Bruce Allen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* You should have received a copy of the GNU General Public License
* (for example COPYING); if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <stdio.h>
#include <regex.h>
#include "atacmds.h"
#include "ataprint.h"
#include "knowndrives.h"
#include "utility.h"
const char *knowndrives_c_cvsid="$Id: knowndrives.cpp,v 1.22 2003/05/07 13:52:58 knan Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID KNOWNDRIVES_H_CVSID UTILITY_H_CVSID;
#define MODEL_STRING_LENGTH 40
#define FIRMWARE_STRING_LENGTH 8
#define TABLEPRINTWIDTH 19
// See vendorattributeargs[] array in atacmds.c for definitions.
#define PRESET_9_MINUTES { 9, 1 }
#define PRESET_9_TEMP { 9, 2 }
#define PRESET_9_SECONDS { 9, 3 }
#define PRESET_9_HALFMINUTES { 9, 4 }
#define PRESET_194_10XCELSIUS { 194, 1 }
#define PRESET_194_UNKNOWN { 194, 2 }
#define PRESET_200_WRITEERRORCOUNT { 200, 1 }
#define PRESET_220_TEMP { 220, 1 }
/* Arrays of preset vendor-specific attribute options for use in
* knowndrives[]. */
// These two are common to several models.
const unsigned char vendoropts_9_minutes[][2] = {
PRESET_9_MINUTES,
{0,0}
};
const unsigned char vendoropts_9_seconds[][2] = {
PRESET_9_SECONDS,
{0,0}
};
const unsigned char vendoropts_Maxtor_4D080H4[][2] = {
PRESET_9_MINUTES,
PRESET_194_UNKNOWN,
{0,0}
};
const unsigned char vendoropts_Fujitsu_MHS2020AT[][2] = {
PRESET_200_WRITEERRORCOUNT,
{0,0}
};
const unsigned char vendoropts_Samsung_SV4012H[][2] = {
PRESET_9_HALFMINUTES,
{0,0}
};
const unsigned char vendoropts_Samsung_SV1204H[][2] = {
PRESET_9_HALFMINUTES,
PRESET_194_10XCELSIUS,
{0,0}
};
/* Special-purpose functions for use in knowndrives[]. */
void specialpurpose_reverse_samsung(smartmonctrl *con)
{
con->fixfirmwarebug = FIX_SAMSUNG;
}
/* Table of settings for known drives terminated by an element containing all
* zeros. The drivesettings structure is described in knowndrives.h. Note
* that lookupdrive() will search knowndrives[] from the start to end or
* until it finds the first match, so the order in knowndrives[] is important
* for distinct entries that could match the same drive. */
// Note that the table just below uses EXTENDED REGULAR EXPRESSIONS.
// A good on-line reference for these is:
// http://www.zeus.com/extra/docsystem/docroot/apps/web/docs/modules/access/regex.html
const drivesettings knowndrives[] = {
{ // IBM Deskstar 60GXP series
"IC35L0[12346]0AVER07",
".*",
"IBM Deskstar 60GXP drives may need upgraded SMART firmware.\n"
"Please see http://www.geocities.com/dtla_update/index.html#rel",
NULL, NULL, NULL
},
{ // IBM Deskstar 40GV & 75GXP series
"(IBM-)?DTLA-30[57]0[123467][05]$",
".*",
"IBM Deskstar 40GV and 75GXP drives may need upgraded SMART firmware.\n"
"Please see http://www.geocities.com/dtla_update/",
NULL, NULL, NULL
},
{ // Fujitsu MPE3204AT
"^FUJITSU MPE3204AT$",
".*", // Tested on ED-03-04
NULL,
vendoropts_9_seconds,
NULL, NULL
},
{ // Fujitsu MPD3130AT
"^FUJITSU MPD3130AT$",
".*", // Tested on DD-04-47
NULL,
vendoropts_9_seconds,
NULL, NULL
},
{ // Fujitsu MHS2020AT
"^FUJITSU MHS2020AT$",
".*", // Tested on 8004
NULL,
vendoropts_Fujitsu_MHS2020AT,
NULL, NULL
},
{ // Samsung SV4012H (known firmware)
"^SAMSUNG SV4012H$",
"^RM100-08",
NULL,
vendoropts_Samsung_SV4012H,
specialpurpose_reverse_samsung,
"Fixes byte order in some SMART data (same as -F)"
},
{ // Samsung SV4012H (all other firmware)
"^SAMSUNG SV4012H$",
".*",
"Contact developers; may need -F disabled",
vendoropts_Samsung_SV4012H,
specialpurpose_reverse_samsung,
"Fixes byte order in some SMART data (same as -F)"
},
{ // Samsung SV1204H (known firmware)
"^SAMSUNG SV1204H$",
"^RK100-1[3-5]$",
NULL,
vendoropts_Samsung_SV1204H,
specialpurpose_reverse_samsung,
"Fixes byte order in some SMART data (same as -F)"
},
{ //Samsung SV1204H (all other firmware)
"^SAMSUNG SV1204H$",
".*",
"Contact developers; may need -F disabled",
vendoropts_Samsung_SV1204H,
specialpurpose_reverse_samsung,
"Fixes byte order in some SMART data (same as -F)"
},
{ // Samsung ALL OTHER DRIVES
"^SAMSUNG.*",
".*",
"Contact developers; may need -F enabled.\n",
NULL, NULL, NULL
},
{ // Maxtor 6L080J4 and 4K080H4
"^MAXTOR (6L080J4|4K080H4)$",
".*",
NULL, NULL, NULL, NULL
},
{ // Maxtor 4D080H4
"^Maxtor 4D080H4$",
".*",
NULL,
vendoropts_Maxtor_4D080H4,
NULL, NULL
},
{ // Maxtor 4R080J0
"^Maxtor 4R080J0$",
".*",
NULL,
vendoropts_9_minutes,
NULL, NULL
},
{ // Maxtor 6Y120P0 (known firmware)
"^Maxtor 6Y120P0$",
"^YAR41VW0$",
NULL,
vendoropts_9_minutes,
NULL, NULL
},
{ // Maxtor 6Y120P0 (any other firmware)
"^Maxtor 6Y120P0$",
".*",
"Contact developers; may need -v 9,minutes enabled.\n",
NULL,
NULL, NULL
},
{ // HITACHI_DK23BA-20
"^HITACHI_DK23BA-20$",
".*",
NULL,
vendoropts_9_minutes,
NULL, NULL
},
{ // IBM GXP-180
"^IC35L120AVV207-0$",
".*",
NULL, NULL, NULL, NULL
},
{
// IBM Deskstar 120GXP [Phil -- use for testing]
"^IC35L060AVVA07-0$",
".*",
NULL,
NULL,
NULL,
NULL,
},
{
// TOSHIBA MK6021GAS [Bruce -- use for testing on laptop]
"^TOSHIBA MK6021GAS$",
".*",
NULL,
NULL,
NULL,
NULL,
},
/*------------------------------------------------------------
* End of table. Do not add entries below this marker.
*------------------------------------------------------------ */
{NULL, NULL, NULL, NULL, NULL}
};
// Searches knowndrives[] for a drive with the given model number and firmware
// string. If either the drive's model or firmware strings are not set by the
// manufacturer then values of NULL may be used. Returns the index of the
// first match in knowndrives[] or -1 if no match if found.
int lookupdrive(const char *model, const char *firmware)
{
regex_t regex;
int i, index;
const char *empty = "";
model = model ? model : empty;
firmware = firmware ? firmware : empty;
for (i = 0, index = -1; index == -1 && knowndrives[i].modelregexp; i++) {
// Attempt to compile regular expression.
if (compileregex(&regex, knowndrives[i].modelregexp, REG_EXTENDED))
goto CONTINUE;
// Check whether model matches the regular expression in knowndrives[i].
if (!regexec(&regex, model, 0, NULL, 0)) {
// model matches, now check firmware.
if (!knowndrives[i].firmwareregexp)
// The firmware regular expression in knowndrives[i] is NULL, which is
// considered a match.
index = i;
else {
// Compare firmware against the regular expression in knowndrives[i].
regfree(&regex); // Recycle regex.
if (compileregex(&regex, knowndrives[i].firmwareregexp, REG_EXTENDED))
goto CONTINUE;
if (!regexec(&regex, firmware, 0, NULL, 0))
index = i;
}
}
CONTINUE:
regfree(&regex);
}
return index;
}
// Shows all presets for drives in knowndrives[].
void showonepreset(const drivesettings *drivetable){
const unsigned char (* presets)[2] = drivetable->vendoropts;
int first_preset = 1;
// Basic error check
if (!drivetable || !drivetable->modelregexp){
pout("Null known drive table pointer. Please report\n"
"this error to smartmontools developers.\n");
return;
}
// print model and firmware regular expressions
pout("%-*s %s\n", TABLEPRINTWIDTH, "MODEL REGEXP:", drivetable->modelregexp);
pout("%-*s %s\n", TABLEPRINTWIDTH, "FIRMWARE REGEXP:", drivetable->firmwareregexp ?
drivetable->firmwareregexp : "");
// if there are any presets, then show them
if (presets && (*presets)[0]) while (1) {
char out[64];
const int attr = (*presets)[0], val = (*presets)[1];
// if we are at the end of the attribute list, break out
if (!attr)
break;
ataPrintSmartAttribName(out, attr, val);
// Use leading zeros instead of spaces so that everything lines up.
out[0] = (out[0] == ' ') ? '0' : out[0];
out[1] = (out[1] == ' ') ? '0' : out[1];
pout("%-*s %s\n", TABLEPRINTWIDTH, first_preset ? "ATTRIBUTE OPTIONS:" : "", out);
first_preset = 0;
presets++;
}
else
pout("%-*s %s\n", TABLEPRINTWIDTH, "ATTRIBUTE OPTIONS:", "None preset; no -v options are required.");
// Is a special purpose function defined? If so, describe it
if (drivetable->specialpurpose){
pout("%-*s ", TABLEPRINTWIDTH, "OTHER PRESETS:");
pout("%s\n", drivetable->functiondesc ?
drivetable->functiondesc : "A special purpose function "
"is defined for this drive");
}
// Print any special warnings
if (drivetable->warningmsg){
pout("%-*s ", TABLEPRINTWIDTH, "WARNINGS:");
pout("%s\n", drivetable->warningmsg);
}
return;
}
void showallpresets(void){
int i;
// loop over all entries in the knowndrives[] table, printing them
// out in a nice format
for (i=0; knowndrives[i].modelregexp; i++){
showonepreset(&knowndrives[i]);
pout("\n");
}
return;
}
// Shows the presets (if any) that are available for the given drive.
void showpresets(const struct hd_driveid *drive){
int i;
char model[MODEL_STRING_LENGTH+1], firmware[FIRMWARE_STRING_LENGTH+1];
// get the drive's model/firmware strings
formatdriveidstring(model, drive->model, MODEL_STRING_LENGTH);
formatdriveidstring(firmware, drive->fw_rev, FIRMWARE_STRING_LENGTH);
// and search to see if they match values in the table
if ((i = lookupdrive(model, firmware)) < 0) {
// no matches found
pout("No presets are defined for this drive. Its identity strings:\n"
"MODEL: %s\n"
"FIRMWARE: %s\n"
"do not match any of the known regular expressions.\n"
"Use -P showall to list all known regular expressions.\n",
model, firmware);
return;
}
// We found a matching drive. Print out all information about it.
pout("Drive found in smartmontools Database. Drive identity strings:\n"
"%-*s %s\n"
"%-*s %s\n"
"match smartmontools Drive Database entry:\n",
TABLEPRINTWIDTH, "MODEL:", model, TABLEPRINTWIDTH, "FIRMWARE:", firmware);
showonepreset(&knowndrives[i]);
return;
}
// Sets preset vendor attribute options in opts by finding the entry
// (if any) for the given drive in knowndrives[]. Values that have
// already been set in opts will not be changed. Returns <0 if drive
// not recognized else index >=0 into drive database.
int applypresets(const struct hd_driveid *drive, unsigned char opts[256],
smartmonctrl *con) {
int i;
char model[MODEL_STRING_LENGTH+1], firmware[FIRMWARE_STRING_LENGTH+1];
// get the drive's model/firmware strings
formatdriveidstring(model, drive->model, MODEL_STRING_LENGTH);
formatdriveidstring(firmware, drive->fw_rev, FIRMWARE_STRING_LENGTH);
// Look up the drive in knowndrives[] and check vendoropts is non-NULL.
if ((i = lookupdrive(model, firmware)) >= 0 && knowndrives[i].vendoropts) {
const unsigned char (* presets)[2];
// For each attribute in list of attribute/val pairs...
presets = knowndrives[i].vendoropts;
while (1) {
const int attr = (*presets)[0];
const int val = (*presets)[1];
if (!attr)
break;
// ... set attribute if user hasn't already done so.
if (!opts[attr])
opts[attr] = val;
presets++;
}