Select Git revision
knowndrives.cpp 50.18 KiB
/*
* knowndrives.cpp
*
* Home page of code is: http://smartmontools.sourceforge.net
* Address of support mailing list: smartmontools-support@lists.sourceforge.net
*
* Copyright (C) 2003-8 Philip Williams, Bruce Allen
* Copyright (C) 2008 Christian Franke <smartmontools-support@lists.sourceforge.net>
*
* 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 "config.h"
#include "int64.h"
#include <stdio.h>
#include "atacmds.h"
#include "extern.h"
#include "knowndrives.h"
#include "utility.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _WIN32
#include <io.h> // access()
#endif
#include <stdexcept>
const char *knowndrives_c_cvsid="$Id: knowndrives.cpp,v 1.191 2009/01/11 13:24:53 manfred99 Exp $"
ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID UTILITY_H_CVSID;
#define MODEL_STRING_LENGTH 40
#define FIRMWARE_STRING_LENGTH 8
#define TABLEPRINTWIDTH 19
/* 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
// Starting with CVS version 1.179 of this file, the regular expressions
// for drive model and firmware must match the full string. The effect of
// "^FULLSTRING$" is identical to "FULLSTRING". The special characters '^'
// and '$' are no longer required, but still allowed. The form ".*SUBSTRING.*"
// can be used if substring match is desired.
static const drive_settings builtin_knowndrives[] = {
// BEGIN drivedb.h (DO NOT DELETE - used by Makefile)
{ "Apple SSD SM128",
"APPLE SSD SM128",
"", "", ""
},
{ "Asus-Phison SSD",
"ASUS-PHISON SSD",
"", "", ""