Commit 3bc7bc06 authored by ballen4705's avatar ballen4705
Browse files

Fixed errors that Bruno pointed out stopped the 2.2 kernel compilation


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@144 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 588c4598
......@@ -30,7 +30,7 @@
#include <stdlib.h>
#include "atacmds.h"
const char *CVSid1="$Id: atacmds.c,v 1.28 2002/10/26 19:33:39 ballen4705 Exp $" CVSID1;
const char *CVSid1="$Id: atacmds.c,v 1.29 2002/10/26 19:59:01 ballen4705 Exp $" CVSID1;
// These Drive Identity tables are taken from hdparm 5.2, and are also
// given in the ATA/ATAPI specs for the IDENTIFY DEVICE command. Note
......@@ -132,7 +132,7 @@ void checksumwarning(const char *string){
// state information, and for example the checksum is usually
// wrong. The replacement function follows afterwards
#if (0)
int ataReadHDIdentity ( int device, struct hd_driveid *buf){
int ataReadHDIdentity (int device, struct hd_driveid *buf){
if (ioctl(device, HDIO_GET_IDENTITY, buf)){
perror ("ATA GET HD Failed");
return -1;
......@@ -199,17 +199,17 @@ int ataReadHDIdentity (int device, struct hd_driveid *buf){
// describing which revision. Note that Revision 0 of ATA-3 does NOT
// support SMART. For this one case we return -3 rather than +3 as
// the version number. See notes above.
int ataVersionInfo (const char** description, struct hd_driveid drive){
unsigned short major,minor;
int ataVersionInfo (const char** description, struct hd_driveid drive, unsigned short *minor){
unsigned short major;
int i;
// get major and minor ATA revision numbers
#ifdef __NEW_HD_DRIVE_ID
major=drive.major_rev_num;
minor=drive.minor_rev_num;
*minor=drive.minor_rev_num;
#else
major=drive.word80;
minor=drive.word81;
*minor=drive.word81;
#endif
// First check if device has ANY ATA version information in it
......@@ -219,10 +219,10 @@ int ataVersionInfo (const char** description, struct hd_driveid drive){
}
// The minor revision number has more information - try there first
if (minor && (minor<=MINOR_MAX)){
int std = actual_ver[minor];
if (*minor && (*minor<=MINOR_MAX)){
int std = actual_ver[*minor];
if (std) {
*description=minor_str[minor];
*description=minor_str[*minor];
return std;
}
}
......@@ -530,7 +530,7 @@ int ataSmartStatus2(int device){
// Should be fixed by putting in a call to code
// that compares smart data to thresholds.
int ataSmartStatus2(int device){
return ataSmartStatus(device)
return ataSmartStatus(device);
}
#endif
......
......@@ -30,7 +30,7 @@
#include <stdlib.h>
#include "atacmds.h"
const char *CVSid1="$Id: atacmds.cpp,v 1.28 2002/10/26 19:33:39 ballen4705 Exp $" CVSID1;
const char *CVSid1="$Id: atacmds.cpp,v 1.29 2002/10/26 19:59:01 ballen4705 Exp $" CVSID1;
// These Drive Identity tables are taken from hdparm 5.2, and are also
// given in the ATA/ATAPI specs for the IDENTIFY DEVICE command. Note
......@@ -132,7 +132,7 @@ void checksumwarning(const char *string){
// state information, and for example the checksum is usually
// wrong. The replacement function follows afterwards
#if (0)
int ataReadHDIdentity ( int device, struct hd_driveid *buf){
int ataReadHDIdentity (int device, struct hd_driveid *buf){
if (ioctl(device, HDIO_GET_IDENTITY, buf)){
perror ("ATA GET HD Failed");
return -1;
......@@ -199,17 +199,17 @@ int ataReadHDIdentity (int device, struct hd_driveid *buf){
// describing which revision. Note that Revision 0 of ATA-3 does NOT
// support SMART. For this one case we return -3 rather than +3 as
// the version number. See notes above.
int ataVersionInfo (const char** description, struct hd_driveid drive){
unsigned short major,minor;
int ataVersionInfo (const char** description, struct hd_driveid drive, unsigned short *minor){
unsigned short major;
int i;
// get major and minor ATA revision numbers
#ifdef __NEW_HD_DRIVE_ID
major=drive.major_rev_num;
minor=drive.minor_rev_num;
*minor=drive.minor_rev_num;
#else
major=drive.word80;
minor=drive.word81;
*minor=drive.word81;
#endif
// First check if device has ANY ATA version information in it
......@@ -219,10 +219,10 @@ int ataVersionInfo (const char** description, struct hd_driveid drive){
}
// The minor revision number has more information - try there first
if (minor && (minor<=MINOR_MAX)){
int std = actual_ver[minor];
if (*minor && (*minor<=MINOR_MAX)){
int std = actual_ver[*minor];
if (std) {
*description=minor_str[minor];
*description=minor_str[*minor];
return std;
}
}
......@@ -530,7 +530,7 @@ int ataSmartStatus2(int device){
// Should be fixed by putting in a call to code
// that compares smart data to thresholds.
int ataSmartStatus2(int device){
return ataSmartStatus(device)
return ataSmartStatus(device);
}
#endif
......
......@@ -26,7 +26,7 @@
#define _ATACMDS_H_
#ifndef CVSID1
#define CVSID1 "$Id: atacmds.h,v 1.19 2002/10/26 19:33:39 ballen4705 Exp $\n"
#define CVSID1 "$Id: atacmds.h,v 1.20 2002/10/26 19:59:01 ballen4705 Exp $\n"
#endif
// These are the major and minor versions for smartd and smartctl
......@@ -314,7 +314,7 @@ int ataSmartSelfTestAbort (int device);
// Returns the latest compatibility of ATA/ATAPI Version the device
// supports. Returns -1 if Version command is not supported
int ataVersionInfo (const char **description, struct hd_driveid drive);
int ataVersionInfo (const char **description, struct hd_driveid drive, unsigned short *minor);
// If SMART supported, this is guaranteed to return 1 if SMART is enabled, else 0.
......
......@@ -28,7 +28,7 @@
#include "smartctl.h"
#include "extern.h"
const char *CVSid4="$Id: ataprint.c,v 1.33 2002/10/24 09:54:02 ballen4705 Exp $"
const char *CVSid4="$Id: ataprint.c,v 1.34 2002/10/26 19:59:01 ballen4705 Exp $"
CVSID2 CVSID3 CVSID6;
// Function for printing ASCII byte-swapped strings, skipping white
......@@ -63,6 +63,7 @@ void ataPrintDriveInfo (struct hd_driveid drive){
int version;
const char *description;
char unknown[64];
unsigned short minorrev;
// print out model, serial # and firmware versions (byte-swap ASCI strings)
pout("Device Model: ");
......@@ -75,11 +76,11 @@ void ataPrintDriveInfo (struct hd_driveid drive){
printswap(drive.fw_rev,8);
// now get ATA version info
version=ataVersionInfo(&description,drive);
version=ataVersionInfo(&description,drive, &minorrev);
// unrecognized minor revision code
if (!description){
sprintf(unknown,"Unrecognized. Minor revision code: 0x%02x",drive.minor_rev_num);
sprintf(unknown,"Unrecognized. Minor revision code: 0x%02x",minorrev);
description=unknown;
}
......@@ -104,67 +105,59 @@ void ataPrintDriveInfo (struct hd_driveid drive){
/* void PrintSmartOfflineStatus ( struct ata_smart_values data)
prints verbose value Off-line data collection status byte */
void PrintSmartOfflineStatus ( struct ata_smart_values data)
{
pout ("Off-line data collection status: ");
switch (data.offline_data_collection_status){
case 0x00:
case 0x80:
pout ("(0x%02x)\tOffline data collection activity was\n\t\t\t\t\t",
data.offline_data_collection_status);
pout("never started.\n");
break;
case 0x01:
case 0x81:
pout ("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
break;
case 0x02:
case 0x82:
pout ("(0x%02x)\tOffline data collection activity \n\t\t\t\t\t",
data.offline_data_collection_status);
pout ("completed without error.\n");
break;
case 0x03:
case 0x83:
pout ("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
break;
case 0x04:
case 0x84:
pout ("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout ("suspended by an interrupting command from host.\n");
break;
case 0x05:
case 0x85:
pout ("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout ("aborted by an interrupting command from host.\n");
break;
case 0x06:
case 0x86:
pout ("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout ("aborted by the device with a fatal error.\n");
break;
default:
if ( ((data.offline_data_collection_status >= 0x07) &&
(data.offline_data_collection_status <= 0x3f)) ||
((data.offline_data_collection_status >= 0xc0) &&
(data.offline_data_collection_status <= 0xff)) )
{
pout ("(0x%02x)\tVendor Specific.\n",
data.offline_data_collection_status);
}
else
{
pout ("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
}
}
void PrintSmartOfflineStatus(struct ata_smart_values data){
pout("Off-line data collection status: ");
switch(data.offline_data_collection_status){
case 0x00:
case 0x80:
pout("(0x%02x)\tOffline data collection activity was\n\t\t\t\t\t",
data.offline_data_collection_status);
pout("never started.\n");
break;
case 0x01:
case 0x81:
pout("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
break;
case 0x02:
case 0x82:
pout("(0x%02x)\tOffline data collection activity \n\t\t\t\t\t",
data.offline_data_collection_status);
pout("completed without error.\n");
break;
case 0x03:
case 0x83:
pout("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
break;
case 0x04:
case 0x84:
pout("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout("suspended by an interrupting command from host.\n");
break;
case 0x05:
case 0x85:
pout("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout("aborted by an interrupting command from host.\n");
break;
case 0x06:
case 0x86:
pout("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout("aborted by the device with a fatal error.\n");
break;
default:
if ( ((data.offline_data_collection_status >= 0x07) &&
(data.offline_data_collection_status <= 0x3f)) ||
((data.offline_data_collection_status >= 0xc0) &&
(data.offline_data_collection_status <= 0xff)) )
pout("(0x%02x)\tVendor Specific.\n",data.offline_data_collection_status);
else
pout("(0x%02x)\tReserved.\n",data.offline_data_collection_status);
}
}
......@@ -237,11 +230,10 @@ void PrintSmartSelfExecStatus ( struct ata_smart_values data)
void PrintSmartTotalTimeCompleteOffline ( struct ata_smart_values data)
{
pout ("Total time to complete off-line \n");
pout ("data collection: \t\t (%4d) seconds.\n",
data.total_time_to_complete_off_line);
void PrintSmartTotalTimeCompleteOffline ( struct ata_smart_values data){
pout("Total time to complete off-line \n");
pout("data collection: \t\t (%4d) seconds.\n",
data.total_time_to_complete_off_line);
}
......
......@@ -28,7 +28,7 @@
#include "smartctl.h"
#include "extern.h"
const char *CVSid4="$Id: ataprint.cpp,v 1.33 2002/10/24 09:54:02 ballen4705 Exp $"
const char *CVSid4="$Id: ataprint.cpp,v 1.34 2002/10/26 19:59:01 ballen4705 Exp $"
CVSID2 CVSID3 CVSID6;
// Function for printing ASCII byte-swapped strings, skipping white
......@@ -63,6 +63,7 @@ void ataPrintDriveInfo (struct hd_driveid drive){
int version;
const char *description;
char unknown[64];
unsigned short minorrev;
// print out model, serial # and firmware versions (byte-swap ASCI strings)
pout("Device Model: ");
......@@ -75,11 +76,11 @@ void ataPrintDriveInfo (struct hd_driveid drive){
printswap(drive.fw_rev,8);
// now get ATA version info
version=ataVersionInfo(&description,drive);
version=ataVersionInfo(&description,drive, &minorrev);
// unrecognized minor revision code
if (!description){
sprintf(unknown,"Unrecognized. Minor revision code: 0x%02x",drive.minor_rev_num);
sprintf(unknown,"Unrecognized. Minor revision code: 0x%02x",minorrev);
description=unknown;
}
......@@ -104,67 +105,59 @@ void ataPrintDriveInfo (struct hd_driveid drive){
/* void PrintSmartOfflineStatus ( struct ata_smart_values data)
prints verbose value Off-line data collection status byte */
void PrintSmartOfflineStatus ( struct ata_smart_values data)
{
pout ("Off-line data collection status: ");
switch (data.offline_data_collection_status){
case 0x00:
case 0x80:
pout ("(0x%02x)\tOffline data collection activity was\n\t\t\t\t\t",
data.offline_data_collection_status);
pout("never started.\n");
break;
case 0x01:
case 0x81:
pout ("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
break;
case 0x02:
case 0x82:
pout ("(0x%02x)\tOffline data collection activity \n\t\t\t\t\t",
data.offline_data_collection_status);
pout ("completed without error.\n");
break;
case 0x03:
case 0x83:
pout ("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
break;
case 0x04:
case 0x84:
pout ("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout ("suspended by an interrupting command from host.\n");
break;
case 0x05:
case 0x85:
pout ("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout ("aborted by an interrupting command from host.\n");
break;
case 0x06:
case 0x86:
pout ("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout ("aborted by the device with a fatal error.\n");
break;
default:
if ( ((data.offline_data_collection_status >= 0x07) &&
(data.offline_data_collection_status <= 0x3f)) ||
((data.offline_data_collection_status >= 0xc0) &&
(data.offline_data_collection_status <= 0xff)) )
{
pout ("(0x%02x)\tVendor Specific.\n",
data.offline_data_collection_status);
}
else
{
pout ("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
}
}
void PrintSmartOfflineStatus(struct ata_smart_values data){
pout("Off-line data collection status: ");
switch(data.offline_data_collection_status){
case 0x00:
case 0x80:
pout("(0x%02x)\tOffline data collection activity was\n\t\t\t\t\t",
data.offline_data_collection_status);
pout("never started.\n");
break;
case 0x01:
case 0x81:
pout("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
break;
case 0x02:
case 0x82:
pout("(0x%02x)\tOffline data collection activity \n\t\t\t\t\t",
data.offline_data_collection_status);
pout("completed without error.\n");
break;
case 0x03:
case 0x83:
pout("(0x%02x)\tReserved.\n",
data.offline_data_collection_status);
break;
case 0x04:
case 0x84:
pout("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout("suspended by an interrupting command from host.\n");
break;
case 0x05:
case 0x85:
pout("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout("aborted by an interrupting command from host.\n");
break;
case 0x06:
case 0x86:
pout("(0x%02x)\tOffline data collection activity was \n\t\t\t\t\t",
data.offline_data_collection_status);
pout("aborted by the device with a fatal error.\n");
break;
default:
if ( ((data.offline_data_collection_status >= 0x07) &&
(data.offline_data_collection_status <= 0x3f)) ||
((data.offline_data_collection_status >= 0xc0) &&
(data.offline_data_collection_status <= 0xff)) )
pout("(0x%02x)\tVendor Specific.\n",data.offline_data_collection_status);
else
pout("(0x%02x)\tReserved.\n",data.offline_data_collection_status);
}
}
......@@ -237,11 +230,10 @@ void PrintSmartSelfExecStatus ( struct ata_smart_values data)
void PrintSmartTotalTimeCompleteOffline ( struct ata_smart_values data)
{
pout ("Total time to complete off-line \n");
pout ("data collection: \t\t (%4d) seconds.\n",
data.total_time_to_complete_off_line);
void PrintSmartTotalTimeCompleteOffline ( struct ata_smart_values data){
pout("Total time to complete off-line \n");
pout("data collection: \t\t (%4d) seconds.\n",
data.total_time_to_complete_off_line);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment