Select Git revision
ataprint.cpp
ataprint.cpp 81.84 KiB
/*
* ataprint.cpp
*
* Home page of code is: http://smartmontools.sourceforge.net
*
* Copyright (C) 2002-9 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2008-9 Christian Franke <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
*
* 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.
*
* This code was originally developed as a Senior Thesis by Michael Cornwell
* at the Concurrent Systems Laboratory (now part of the Storage Systems
* Research Center), Jack Baskin School of Engineering, University of
* California, Santa Cruz. http://ssrc.soe.ucsc.edu/
*
*/
#include "config.h"
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif // #ifdef HAVE_LOCALE_H
#include "int64.h"
#include "atacmdnames.h"
#include "atacmds.h"
#include "dev_interface.h"
#include "ataprint.h"
#include "smartctl.h"
#include "extern.h"
#include "utility.h"
#include "knowndrives.h"
const char *ataprint_c_cvsid="$Id: ataprint.cpp,v 1.211 2009/06/13 14:56:20 chrfranke Exp $"
ATACMDNAMES_H_CVSID ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
// for passing global control variables
extern smartmonctrl *con;
static const char * infofound(const char *output) {
return (*output ? output : "[No Information Found]");
}
/* For the given Command Register (CR) and Features Register (FR), attempts
* to construct a string that describes the contents of the Status
* Register (ST) and Error Register (ER). The caller passes the string
* buffer and the return value is a pointer to this string. If the
* meanings of the flags of the error register are not known for the given
* command then it returns NULL.
*
* The meanings of the flags of the error register for all commands are
* described in the ATA spec and could all be supported here in theory.
* Currently, only a few commands are supported (those that have been seen
* to produce errors). If many more are to be added then this function
* should probably be redesigned.
*/