From e97cabc18ba8811a74272385a13d160441ff5ca9 Mon Sep 17 00:00:00 2001 From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Mon, 16 Aug 2004 22:44:28 +0000 Subject: [PATCH] Modified/simplified the controller_type code done by Ed. git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@1865 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/CHANGELOG | 6 +++- sm5/atacmds.c | 13 +++++--- sm5/atacmds.cpp | 13 +++++--- sm5/os_freebsd.c | 8 ++--- sm5/os_freebsd.cpp | 8 ++--- sm5/os_freebsd.h | 8 ++--- sm5/os_linux.c | 34 ++++++++++----------- sm5/os_linux.cpp | 34 ++++++++++----------- sm5/os_linux.h | 8 ++--- sm5/smartctl.c | 63 +++++++++++++++++---------------------- sm5/smartctl.cpp | 63 +++++++++++++++++---------------------- sm5/smartd.c | 74 +++++++++++++++++++++++++++------------------- sm5/smartd.cpp | 74 +++++++++++++++++++++++++++------------------- sm5/smartd.h | 6 ++-- sm5/utility.h | 24 +++++---------- 15 files changed, 226 insertions(+), 210 deletions(-) diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index 632cd860f..44b5c6d97 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.446 2004/08/13 14:09:21 arvoreen Exp $ +$Id: CHANGELOG,v 1.447 2004/08/16 22:44:15 ballen4705 Exp $ The most recent version of this file is: http://cvs.sourceforge.net/viewcvs.py/smartmontools/sm5/CHANGELOG?sortby=date&view=markup @@ -29,6 +29,10 @@ NOTES FOR FUTURE RELEASES: see TODO file. <ADDITIONS TO THE CHANGE LOG SHOULD BE ADDED JUST BELOW HERE, PLEASE> + [BA] Additional modifications of Ed's controller scheme. Fixed + broken 3ware support under linux, problems with scanning + devices in smartd, and other small problems. + [EM] Minor change to FreeBSD inclusion of 'twe' include files. Add code to check if they exising in /usr/include/sys to use those in preference to ones added here diff --git a/sm5/atacmds.c b/sm5/atacmds.c index ab860f314..b2b8d4cd4 100644 --- a/sm5/atacmds.c +++ b/sm5/atacmds.c @@ -35,7 +35,7 @@ #include "extern.h" #include "utility.h" -const char *atacmds_c_cvsid="$Id: atacmds.c,v 1.159 2004/08/13 13:57:12 arvoreen Exp $" +const char *atacmds_c_cvsid="$Id: atacmds.c,v 1.160 2004/08/16 22:44:26 ballen4705 Exp $" ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID UTILITY_H_CVSID; // to hold onto exit code for atexit routine @@ -603,11 +603,16 @@ int smartcommandhandler(int device, smart_command_set command, int select, char errno=0; // now execute the command - if (con->controller_port) + switch (con->controller_type) { + case CONTROLLER_3WARE_678K: + case CONTROLLER_3WARE_678K_CHAR: + case CONTROLLER_3WARE_9000_CHAR: retval=escalade_command_interface(device, con->controller_port-1, con->controller_type, command, select, data); - else + break; + default: retval=ata_command_interface(device, command, select, data); - + } + // If reporting is enabled, say what output was produced by the command if (con->reportataioctl){ if (errno) diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp index cc9a19770..5c1ffd014 100644 --- a/sm5/atacmds.cpp +++ b/sm5/atacmds.cpp @@ -35,7 +35,7 @@ #include "extern.h" #include "utility.h" -const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.159 2004/08/13 13:57:12 arvoreen Exp $" +const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.160 2004/08/16 22:44:26 ballen4705 Exp $" ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID UTILITY_H_CVSID; // to hold onto exit code for atexit routine @@ -603,11 +603,16 @@ int smartcommandhandler(int device, smart_command_set command, int select, char errno=0; // now execute the command - if (con->controller_port) + switch (con->controller_type) { + case CONTROLLER_3WARE_678K: + case CONTROLLER_3WARE_678K_CHAR: + case CONTROLLER_3WARE_9000_CHAR: retval=escalade_command_interface(device, con->controller_port-1, con->controller_type, command, select, data); - else + break; + default: retval=ata_command_interface(device, command, select, data); - + } + // If reporting is enabled, say what output was produced by the command if (con->reportataioctl){ if (errno) diff --git a/sm5/os_freebsd.c b/sm5/os_freebsd.c index fa204bfaf..1cde13c0b 100644 --- a/sm5/os_freebsd.c +++ b/sm5/os_freebsd.c @@ -35,9 +35,9 @@ #include "utility.h" #include "os_freebsd.h" -static const char *filenameandversion="$Id: os_freebsd.c,v 1.39 2004/08/13 13:57:12 arvoreen Exp $"; +static const char *filenameandversion="$Id: os_freebsd.c,v 1.40 2004/08/16 22:44:26 ballen4705 Exp $"; -const char *os_XXXX_c_cvsid="$Id: os_freebsd.c,v 1.39 2004/08/13 13:57:12 arvoreen Exp $" \ +const char *os_XXXX_c_cvsid="$Id: os_freebsd.c,v 1.40 2004/08/16 22:44:26 ballen4705 Exp $" \ ATACMDS_H_CVSID CONFIG_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID; // to hold onto exit code for atexit routine @@ -117,7 +117,7 @@ int deviceopen (const char* dev, char* mode) { } } - if (parse_ok == CONTROLLER_3WARE) { + if (parse_ok == CONTROLLER_3WARE_678K_CHAR) { char buf[512]; sprintf(buf,"/dev/twe%d",fdchan->device); printf("Using %s, as control device\n", buf); @@ -815,7 +815,7 @@ static int parse_ata_chan_dev(const char * dev_name, struct freebsd_dev_channel return CONTROLLER_UNKNOWN; } } - return CONTROLLER_3WARE; + return CONTROLLER_3WARE_678K_CHAR; } // we failed to recognize any of the forms diff --git a/sm5/os_freebsd.cpp b/sm5/os_freebsd.cpp index 61ee5cb53..1bfc3a1ba 100644 --- a/sm5/os_freebsd.cpp +++ b/sm5/os_freebsd.cpp @@ -35,9 +35,9 @@ #include "utility.h" #include "os_freebsd.h" -static const char *filenameandversion="$Id: os_freebsd.cpp,v 1.39 2004/08/13 13:57:12 arvoreen Exp $"; +static const char *filenameandversion="$Id: os_freebsd.cpp,v 1.40 2004/08/16 22:44:26 ballen4705 Exp $"; -const char *os_XXXX_c_cvsid="$Id: os_freebsd.cpp,v 1.39 2004/08/13 13:57:12 arvoreen Exp $" \ +const char *os_XXXX_c_cvsid="$Id: os_freebsd.cpp,v 1.40 2004/08/16 22:44:26 ballen4705 Exp $" \ ATACMDS_H_CVSID CONFIG_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID; // to hold onto exit code for atexit routine @@ -117,7 +117,7 @@ int deviceopen (const char* dev, char* mode) { } } - if (parse_ok == CONTROLLER_3WARE) { + if (parse_ok == CONTROLLER_3WARE_678K_CHAR) { char buf[512]; sprintf(buf,"/dev/twe%d",fdchan->device); printf("Using %s, as control device\n", buf); @@ -815,7 +815,7 @@ static int parse_ata_chan_dev(const char * dev_name, struct freebsd_dev_channel return CONTROLLER_UNKNOWN; } } - return CONTROLLER_3WARE; + return CONTROLLER_3WARE_678K_CHAR; } // we failed to recognize any of the forms diff --git a/sm5/os_freebsd.h b/sm5/os_freebsd.h index 8d915c0a3..87d303930 100644 --- a/sm5/os_freebsd.h +++ b/sm5/os_freebsd.h @@ -24,7 +24,7 @@ #ifndef OS_FREEBSD_H_ #define OS_FREEBSD_H_ -#define OS_XXXX_H_CVSID "$Id: os_freebsd.h,v 1.11 2004/08/13 14:09:21 arvoreen Exp $\n" +#define OS_XXXX_H_CVSID "$Id: os_freebsd.h,v 1.12 2004/08/16 22:44:26 ballen4705 Exp $\n" struct freebsd_dev_channel { int channel; // the ATA channel to work with @@ -54,9 +54,9 @@ struct freebsd_dev_channel { /* The following definitions/macros/prototypes are used for three different interfaces, referred to as "the three cases" below. - THREE_WARE_678K -- 6000, 7000, and 8000 controllers via /dev/sd? - THREE_WARE_678K_CHAR -- 6000, 7000, and 8000 controllers via /dev/twe? - THREE_WARE_9000_CHAR -- 9000 controllers via /dev/twa? + CONTROLLER_3WARE_678K -- 6000, 7000, and 8000 controllers via /dev/sd? + CONTROLLER_3WARE_678K_CHAR -- 6000, 7000, and 8000 controllers via /dev/twe? + CONTROLLER_3WARE_9000_CHAR -- 9000 controllers via /dev/twa? */ diff --git a/sm5/os_linux.c b/sm5/os_linux.c index bad3d594f..28dbfd0ff 100644 --- a/sm5/os_linux.c +++ b/sm5/os_linux.c @@ -70,9 +70,9 @@ typedef unsigned long long u8; #define ARGUSED(x) ((void)(x)) -static const char *filenameandversion="$Id: os_linux.c,v 1.69 2004/08/13 13:57:12 arvoreen Exp $"; +static const char *filenameandversion="$Id: os_linux.c,v 1.70 2004/08/16 22:44:26 ballen4705 Exp $"; -const char *os_XXXX_c_cvsid="$Id: os_linux.c,v 1.69 2004/08/13 13:57:12 arvoreen Exp $" \ +const char *os_XXXX_c_cvsid="$Id: os_linux.c,v 1.70 2004/08/16 22:44:26 ballen4705 Exp $" \ ATACMDS_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID; // to hold onto exit code for atexit routine @@ -992,18 +992,18 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com memset(ioctl_buffer, 0, TW_IOCTL_BUFFER_SIZE); - if (escalade_type==THREE_WARE_9000_CHAR) { + if (escalade_type==CONTROLLER_3WARE_9000_CHAR) { tw_ioctl_apache = (TW_Ioctl_Buf_Apache *)ioctl_buffer; tw_ioctl_apache->driver_command.control_code = TW_IOCTL_FIRMWARE_PASS_THROUGH; tw_ioctl_apache->driver_command.buffer_length = 512; /* payload size */ passthru = (TW_Passthru *)&(tw_ioctl_apache->firmware_command.command.oldcommand); } - else if (escalade_type==THREE_WARE_678K_CHAR) { + else if (escalade_type==CONTROLLER_3WARE_678K_CHAR) { tw_ioctl_char = (TW_New_Ioctl *)ioctl_buffer; tw_ioctl_char->data_buffer_length = 512; passthru = (TW_Passthru *)&(tw_ioctl_char->firmware_command); } - else if (escalade_type==THREE_WARE_678K) { + else if (escalade_type==CONTROLLER_3WARE_678K) { tw_ioctl = (TW_Ioctl *)ioctl_buffer; tw_ioctl->cdb[0] = TW_IOCTL; tw_ioctl->opcode = TW_ATA_PASSTHRU; @@ -1058,7 +1058,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com // in dwords by 1 to account for the 64-bit single sgl 'address' // field. Note that this doesn't agree with the typedefs but it's // right (agree with kernel driver behavior/typedefs). - if (escalade_type==THREE_WARE_9000_CHAR && sizeof(long)==8) + if (escalade_type==CONTROLLER_3WARE_9000_CHAR && sizeof(long)==8) passthru->size++; } else { @@ -1090,9 +1090,9 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com passthru->sector_num = select; break; case WRITE_LOG: - if (escalade_type == THREE_WARE_9000_CHAR) + if (escalade_type == CONTROLLER_3WARE_9000_CHAR) memcpy((unsigned char *)tw_ioctl_apache->data_buffer, data, 512); - else if (escalade_type == THREE_WARE_678K_CHAR) + else if (escalade_type == CONTROLLER_3WARE_678K_CHAR) memcpy((unsigned char *)tw_ioctl_char->data_buffer, data, 512); else { // COMMAND NOT SUPPORTED VIA SCSI IOCTL INTERFACE @@ -1157,16 +1157,16 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com } // Now send the command down through an ioctl() - if (escalade_type==THREE_WARE_9000_CHAR) + if (escalade_type==CONTROLLER_3WARE_9000_CHAR) ioctlreturn=ioctl(fd, TW_IOCTL_FIRMWARE_PASS_THROUGH, tw_ioctl_apache); - else if (escalade_type==THREE_WARE_678K_CHAR) + else if (escalade_type==CONTROLLER_3WARE_678K_CHAR) ioctlreturn=ioctl(fd, TW_CMD_PACKET_WITH_DATA, tw_ioctl_char); else ioctlreturn=ioctl(fd, SCSI_IOCTL_SEND_COMMAND, tw_ioctl); // Deal with the different error cases if (ioctlreturn) { - if (THREE_WARE_678K==escalade_type && ((command==AUTO_OFFLINE || command==AUTOSAVE) && select)){ + if (CONTROLLER_3WARE_678K==escalade_type && ((command==AUTO_OFFLINE || command==AUTOSAVE) && select)){ // error here is probably a kernel driver whose version is too old printwarning(command); errno=ENOTSUP; @@ -1181,7 +1181,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com // - we are using the SCSI interface and this is a NON-READ-DATA command // For SCSI interface, note that we set passthru to a different // value after ioctl(). - if (THREE_WARE_678K==escalade_type) { + if (CONTROLLER_3WARE_678K==escalade_type) { if (readdata) passthru=NULL; else @@ -1207,9 +1207,9 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com // If this is a read data command, copy data to output buffer if (readdata) { - if (escalade_type==THREE_WARE_9000_CHAR) + if (escalade_type==CONTROLLER_3WARE_9000_CHAR) memcpy(data, (unsigned char *)tw_ioctl_apache->data_buffer, 512); - else if (escalade_type==THREE_WARE_678K_CHAR) + else if (escalade_type==CONTROLLER_3WARE_678K_CHAR) memcpy(data, (unsigned char *)tw_ioctl_char->data_buffer, 512); else memcpy(data, tw_output->output_data, 512); @@ -1234,7 +1234,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com return 1; // Any other values mean that something has gone wrong with the command - if (THREE_WARE_678K==escalade_type) { + if (CONTROLLER_3WARE_678K==escalade_type) { printwarning(command); errno=ENOSYS; return 0; @@ -1356,12 +1356,12 @@ int guess_device_type(const char * dev_name) { // form /dev/twa* if (!strncmp(lin_dev_3ware_9000_char, dev_name, strlen(lin_dev_3ware_9000_char))) - return THREE_WARE_9000_CHAR; + return CONTROLLER_3WARE_9000_CHAR; // form /dev/twe* if (!strncmp(lin_dev_3ware_678k_char, dev_name, strlen(lin_dev_3ware_678k_char))) - return THREE_WARE_678K_CHAR; + return CONTROLLER_3WARE_678K_CHAR; // we failed to recognize any of the forms return CONTROLLER_UNKNOWN; diff --git a/sm5/os_linux.cpp b/sm5/os_linux.cpp index 087939600..380b3a60c 100644 --- a/sm5/os_linux.cpp +++ b/sm5/os_linux.cpp @@ -70,9 +70,9 @@ typedef unsigned long long u8; #define ARGUSED(x) ((void)(x)) -static const char *filenameandversion="$Id: os_linux.cpp,v 1.69 2004/08/13 13:57:12 arvoreen Exp $"; +static const char *filenameandversion="$Id: os_linux.cpp,v 1.70 2004/08/16 22:44:26 ballen4705 Exp $"; -const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.69 2004/08/13 13:57:12 arvoreen Exp $" \ +const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.70 2004/08/16 22:44:26 ballen4705 Exp $" \ ATACMDS_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID; // to hold onto exit code for atexit routine @@ -992,18 +992,18 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com memset(ioctl_buffer, 0, TW_IOCTL_BUFFER_SIZE); - if (escalade_type==THREE_WARE_9000_CHAR) { + if (escalade_type==CONTROLLER_3WARE_9000_CHAR) { tw_ioctl_apache = (TW_Ioctl_Buf_Apache *)ioctl_buffer; tw_ioctl_apache->driver_command.control_code = TW_IOCTL_FIRMWARE_PASS_THROUGH; tw_ioctl_apache->driver_command.buffer_length = 512; /* payload size */ passthru = (TW_Passthru *)&(tw_ioctl_apache->firmware_command.command.oldcommand); } - else if (escalade_type==THREE_WARE_678K_CHAR) { + else if (escalade_type==CONTROLLER_3WARE_678K_CHAR) { tw_ioctl_char = (TW_New_Ioctl *)ioctl_buffer; tw_ioctl_char->data_buffer_length = 512; passthru = (TW_Passthru *)&(tw_ioctl_char->firmware_command); } - else if (escalade_type==THREE_WARE_678K) { + else if (escalade_type==CONTROLLER_3WARE_678K) { tw_ioctl = (TW_Ioctl *)ioctl_buffer; tw_ioctl->cdb[0] = TW_IOCTL; tw_ioctl->opcode = TW_ATA_PASSTHRU; @@ -1058,7 +1058,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com // in dwords by 1 to account for the 64-bit single sgl 'address' // field. Note that this doesn't agree with the typedefs but it's // right (agree with kernel driver behavior/typedefs). - if (escalade_type==THREE_WARE_9000_CHAR && sizeof(long)==8) + if (escalade_type==CONTROLLER_3WARE_9000_CHAR && sizeof(long)==8) passthru->size++; } else { @@ -1090,9 +1090,9 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com passthru->sector_num = select; break; case WRITE_LOG: - if (escalade_type == THREE_WARE_9000_CHAR) + if (escalade_type == CONTROLLER_3WARE_9000_CHAR) memcpy((unsigned char *)tw_ioctl_apache->data_buffer, data, 512); - else if (escalade_type == THREE_WARE_678K_CHAR) + else if (escalade_type == CONTROLLER_3WARE_678K_CHAR) memcpy((unsigned char *)tw_ioctl_char->data_buffer, data, 512); else { // COMMAND NOT SUPPORTED VIA SCSI IOCTL INTERFACE @@ -1157,16 +1157,16 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com } // Now send the command down through an ioctl() - if (escalade_type==THREE_WARE_9000_CHAR) + if (escalade_type==CONTROLLER_3WARE_9000_CHAR) ioctlreturn=ioctl(fd, TW_IOCTL_FIRMWARE_PASS_THROUGH, tw_ioctl_apache); - else if (escalade_type==THREE_WARE_678K_CHAR) + else if (escalade_type==CONTROLLER_3WARE_678K_CHAR) ioctlreturn=ioctl(fd, TW_CMD_PACKET_WITH_DATA, tw_ioctl_char); else ioctlreturn=ioctl(fd, SCSI_IOCTL_SEND_COMMAND, tw_ioctl); // Deal with the different error cases if (ioctlreturn) { - if (THREE_WARE_678K==escalade_type && ((command==AUTO_OFFLINE || command==AUTOSAVE) && select)){ + if (CONTROLLER_3WARE_678K==escalade_type && ((command==AUTO_OFFLINE || command==AUTOSAVE) && select)){ // error here is probably a kernel driver whose version is too old printwarning(command); errno=ENOTSUP; @@ -1181,7 +1181,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com // - we are using the SCSI interface and this is a NON-READ-DATA command // For SCSI interface, note that we set passthru to a different // value after ioctl(). - if (THREE_WARE_678K==escalade_type) { + if (CONTROLLER_3WARE_678K==escalade_type) { if (readdata) passthru=NULL; else @@ -1207,9 +1207,9 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com // If this is a read data command, copy data to output buffer if (readdata) { - if (escalade_type==THREE_WARE_9000_CHAR) + if (escalade_type==CONTROLLER_3WARE_9000_CHAR) memcpy(data, (unsigned char *)tw_ioctl_apache->data_buffer, 512); - else if (escalade_type==THREE_WARE_678K_CHAR) + else if (escalade_type==CONTROLLER_3WARE_678K_CHAR) memcpy(data, (unsigned char *)tw_ioctl_char->data_buffer, 512); else memcpy(data, tw_output->output_data, 512); @@ -1234,7 +1234,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com return 1; // Any other values mean that something has gone wrong with the command - if (THREE_WARE_678K==escalade_type) { + if (CONTROLLER_3WARE_678K==escalade_type) { printwarning(command); errno=ENOSYS; return 0; @@ -1356,12 +1356,12 @@ int guess_device_type(const char * dev_name) { // form /dev/twa* if (!strncmp(lin_dev_3ware_9000_char, dev_name, strlen(lin_dev_3ware_9000_char))) - return THREE_WARE_9000_CHAR; + return CONTROLLER_3WARE_9000_CHAR; // form /dev/twe* if (!strncmp(lin_dev_3ware_678k_char, dev_name, strlen(lin_dev_3ware_678k_char))) - return THREE_WARE_678K_CHAR; + return CONTROLLER_3WARE_678K_CHAR; // we failed to recognize any of the forms return CONTROLLER_UNKNOWN; diff --git a/sm5/os_linux.h b/sm5/os_linux.h index 3a193afde..24c5e92df 100644 --- a/sm5/os_linux.h +++ b/sm5/os_linux.h @@ -38,14 +38,14 @@ #ifndef OS_LINUX_H_ #define OS_LINUX_H_ -#define OS_XXXX_H_CVSID "$Id: os_linux.h,v 1.20 2004/07/14 20:32:18 ballen4705 Exp $\n" +#define OS_XXXX_H_CVSID "$Id: os_linux.h,v 1.21 2004/08/16 22:44:27 ballen4705 Exp $\n" /* The following definitions/macros/prototypes are used for three different interfaces, referred to as "the three cases" below. - THREE_WARE_678K -- 6000, 7000, and 8000 controllers via /dev/sd? - THREE_WARE_678K_CHAR -- 6000, 7000, and 8000 controllers via /dev/twe? - THREE_WARE_9000_CHAR -- 9000 controllers via /dev/twa? + CONTROLLER_3WARE_678K -- 6000, 7000, and 8000 controllers via /dev/sd? + CONTROLLER_3WARE_678K_CHAR -- 6000, 7000, and 8000 controllers via /dev/twe? + CONTROLLER_3WARE_9000_CHAR -- 9000 controllers via /dev/twa? */ // USED FOR ALL THREE CASES diff --git a/sm5/smartctl.c b/sm5/smartctl.c index 3d0d5440c..3cc41e929 100644 --- a/sm5/smartctl.c +++ b/sm5/smartctl.c @@ -51,7 +51,7 @@ extern const char *os_solaris_ata_s_cvsid; extern const char *int64_vc6_c_cvsid; #endif extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *scsiprint_c_cvsid, *utility_c_cvsid; -const char* smartctl_c_cvsid="$Id: smartctl.c,v 1.133 2004/08/16 00:57:29 ballen4705 Exp $" +const char* smartctl_c_cvsid="$Id: smartctl.c,v 1.134 2004/08/16 22:44:27 ballen4705 Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID; // This is a block containing all the "control variables". We declare @@ -819,51 +819,40 @@ int main (int argc, char **argv){ ParseOpts(argc,argv); device = argv[argc-1]; - - if (CONTROLLER_TYPE(con) == CONTROLLER_UNKNOWN) { - // user has not specified device type, so guess - con->controller_type = guess_device_type(device); - switch (CONTROLLER_TYPE(con)) { - case CONTROLLER_ATA: - case CONTROLLER_SCSI: - break; - case CONTROLLER_3WARE: - pout("Smartctl: you must use -d 3ware,N to specify which 3ware port to use.\n"); - UsageSummary(); - return FAILCMD; - default: - pout("Smartctl: please specify if this is an ATA or SCSI device with the -d option.\n"); - UsageSummary(); - return FAILCMD; - } + + // If use has specified 3ware controller, determine which interface + if (con->controller_type == CONTROLLER_3WARE) { + con->controller_type=guess_device_type(device); + if (con->controller_type!=CONTROLLER_3WARE_9000_CHAR && con->controller_type!=CONTROLLER_3WARE_678K_CHAR) + con->controller_type = CONTROLLER_3WARE_678K; } + + if (con->controller_type == CONTROLLER_UNKNOWN) + con->controller_type=guess_device_type(device); - if (con->controller_port) { - // figure out 3Ware type - if (CONTROLLER_SCSI == (con->controller_type = guess_device_type(device))) - con->controller_type=THREE_WARE_678K; + if (con->controller_type == CONTROLLER_UNKNOWN) { + pout("Smartctl: please specify device type with the -d option.\n"); + UsageSummary(); + return FAILCMD; } - + // set up mode for open() call. SCSI case is: - switch (CONTROLLER_TYPE(con)) { + switch (con->controller_type) { case CONTROLLER_SCSI: mode="SCSI"; break; case CONTROLLER_ATA: + case CONTROLLER_3WARE_678K: mode="ATA"; break; - case CONTROLLER_3WARE: - { - int type = CONTROLLER_TYPE(con); - if (type == THREE_WARE_9000_CHAR) - mode="ATA_3WARE_9000"; - else if (con->controller_type == THREE_WARE_678K_CHAR) - mode="ATA_3WARE_678K"; - else - mode="ATA"; - } + case CONTROLLER_3WARE_9000_CHAR: + mode="ATA_3WARE_9000"; + break; + case CONTROLLER_3WARE_678K_CHAR: + mode="ATA_3WARE_678K"; break; } + // open device - SCSI devices are opened (O_RDWR | O_NONBLOCK) so the // scsi generic device can be used (needs write permission for MODE // SELECT command) plus O_NONBLOCK to stop open hanging if media not @@ -880,9 +869,11 @@ int main (int argc, char **argv){ } // now call appropriate ATA or SCSI routine - switch (con->controller_type & CONTROLLER_MASK) { + switch (con->controller_type) { case CONTROLLER_ATA: - case CONTROLLER_3WARE: + case CONTROLLER_3WARE_678K: + case CONTROLLER_3WARE_9000_CHAR: + case CONTROLLER_3WARE_678K_CHAR: retval = ataPrintMain(fd); break; case CONTROLLER_SCSI: diff --git a/sm5/smartctl.cpp b/sm5/smartctl.cpp index af79849cf..05d2f4964 100644 --- a/sm5/smartctl.cpp +++ b/sm5/smartctl.cpp @@ -51,7 +51,7 @@ extern const char *os_solaris_ata_s_cvsid; extern const char *int64_vc6_c_cvsid; #endif extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *scsiprint_c_cvsid, *utility_c_cvsid; -const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.133 2004/08/16 00:57:29 ballen4705 Exp $" +const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.134 2004/08/16 22:44:27 ballen4705 Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID; // This is a block containing all the "control variables". We declare @@ -819,51 +819,40 @@ int main (int argc, char **argv){ ParseOpts(argc,argv); device = argv[argc-1]; - - if (CONTROLLER_TYPE(con) == CONTROLLER_UNKNOWN) { - // user has not specified device type, so guess - con->controller_type = guess_device_type(device); - switch (CONTROLLER_TYPE(con)) { - case CONTROLLER_ATA: - case CONTROLLER_SCSI: - break; - case CONTROLLER_3WARE: - pout("Smartctl: you must use -d 3ware,N to specify which 3ware port to use.\n"); - UsageSummary(); - return FAILCMD; - default: - pout("Smartctl: please specify if this is an ATA or SCSI device with the -d option.\n"); - UsageSummary(); - return FAILCMD; - } + + // If use has specified 3ware controller, determine which interface + if (con->controller_type == CONTROLLER_3WARE) { + con->controller_type=guess_device_type(device); + if (con->controller_type!=CONTROLLER_3WARE_9000_CHAR && con->controller_type!=CONTROLLER_3WARE_678K_CHAR) + con->controller_type = CONTROLLER_3WARE_678K; } + + if (con->controller_type == CONTROLLER_UNKNOWN) + con->controller_type=guess_device_type(device); - if (con->controller_port) { - // figure out 3Ware type - if (CONTROLLER_SCSI == (con->controller_type = guess_device_type(device))) - con->controller_type=THREE_WARE_678K; + if (con->controller_type == CONTROLLER_UNKNOWN) { + pout("Smartctl: please specify device type with the -d option.\n"); + UsageSummary(); + return FAILCMD; } - + // set up mode for open() call. SCSI case is: - switch (CONTROLLER_TYPE(con)) { + switch (con->controller_type) { case CONTROLLER_SCSI: mode="SCSI"; break; case CONTROLLER_ATA: + case CONTROLLER_3WARE_678K: mode="ATA"; break; - case CONTROLLER_3WARE: - { - int type = CONTROLLER_TYPE(con); - if (type == THREE_WARE_9000_CHAR) - mode="ATA_3WARE_9000"; - else if (con->controller_type == THREE_WARE_678K_CHAR) - mode="ATA_3WARE_678K"; - else - mode="ATA"; - } + case CONTROLLER_3WARE_9000_CHAR: + mode="ATA_3WARE_9000"; + break; + case CONTROLLER_3WARE_678K_CHAR: + mode="ATA_3WARE_678K"; break; } + // open device - SCSI devices are opened (O_RDWR | O_NONBLOCK) so the // scsi generic device can be used (needs write permission for MODE // SELECT command) plus O_NONBLOCK to stop open hanging if media not @@ -880,9 +869,11 @@ int main (int argc, char **argv){ } // now call appropriate ATA or SCSI routine - switch (con->controller_type & CONTROLLER_MASK) { + switch (con->controller_type) { case CONTROLLER_ATA: - case CONTROLLER_3WARE: + case CONTROLLER_3WARE_678K: + case CONTROLLER_3WARE_9000_CHAR: + case CONTROLLER_3WARE_678K_CHAR: retval = ataPrintMain(fd); break; case CONTROLLER_SCSI: diff --git a/sm5/smartd.c b/sm5/smartd.c index d8e99273a..195321350 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -108,7 +108,7 @@ int getdomainname(char *, int); /* no declaration in header files! */ extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid; -static const char *filenameandversion="$Id: smartd.c,v 1.332 2004/08/13 13:57:12 arvoreen Exp $"; +static const char *filenameandversion="$Id: smartd.c,v 1.333 2004/08/16 22:44:27 ballen4705 Exp $"; #ifdef NEED_SOLARIS_ATA_CODE extern const char *os_solaris_ata_s_cvsid; #endif @@ -118,7 +118,7 @@ extern const char *daemon_win32_c_cvsid, *hostname_win32_c_cvsid, *syslog_win32_ extern const char *int64_vc6_c_cvsid; #endif #endif -const char *smartd_c_cvsid="$Id: smartd.c,v 1.332 2004/08/13 13:57:12 arvoreen Exp $" +const char *smartd_c_cvsid="$Id: smartd.c,v 1.333 2004/08/16 22:44:27 ballen4705 Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID #ifdef DAEMON_WIN32_H_CVSID DAEMON_WIN32_H_CVSID @@ -688,8 +688,10 @@ void MailWarning(cfgfile *cfg, int which, char *fmt, ...){ exportenv(environ_strings[6], "SMARTD_ADDRESS", address); exportenv(environ_strings[7], "SMARTD_DEVICESTRING", cfg->name); - switch (CONTROLLER_TYPE(cfg)) { - case CONTROLLER_3WARE: + switch (cfg->controller_type) { + case CONTROLLER_3WARE_678K: + case CONTROLLER_3WARE_9000_CHAR: + case CONTROLLER_3WARE_678K_CHAR: { char *s,devicetype[16]; sprintf(devicetype, "3ware,%d", cfg->controller_port-1); @@ -1227,23 +1229,27 @@ int ATADeviceScan(cfgfile *cfg, int scanning){ char *name=cfg->name; int retainsmartdata=0; int retid; - char *mode="ATA"; + char *mode; // should we try to register this as an ATA device? - if ( !((CONTROLLER_TYPE(cfg) == CONTROLLER_ATA) || - (CONTROLLER_TYPE(cfg) == CONTROLLER_3WARE) || - (CONTROLLER_TYPE(cfg) == CONTROLLER_UNKNOWN))) + switch (cfg->controller_type) { + case CONTROLLER_ATA: + case CONTROLLER_3WARE_678K: + case CONTROLLER_UNKNOWN: + mode="ATA"; + break; + case CONTROLLER_3WARE_678K_CHAR: + mode="ATA_3WARE_678K"; + break; + case CONTROLLER_3WARE_9000_CHAR: + mode="ATA_3WARE_9000"; + break; + default: + // not a recognized ATA or SATA device. We should never enter + // this branch. return 1; - - // need to determine what type of 3ware controller - if (CONTROLLER_TYPE(cfg) == CONTROLLER_3WARE) { - if (THREE_WARE_TYPE(cfg)== THREE_WARE_9000_CHAR) - mode="ATA_3WARE_9000"; - - if (THREE_WARE_TYPE(cfg) == THREE_WARE_678K_CHAR) - mode="ATA_3WARE_678K"; } - + // open the device if ((fd=OpenDevice(name, mode, scanning))<0) // device open failed @@ -1493,8 +1499,9 @@ int ATADeviceScan(cfgfile *cfg, int scanning){ PrintOut(LOG_INFO,"Device: %s, is SMART capable. Adding to \"monitor\" list.\n",name); // record number of device, type of device, increment device count - cfg->controller_type = CONTROLLER_ATA;; - + if (cfg->controller_type == CONTROLLER_UNKNOWN) + cfg->controller_type=CONTROLLER_ATA;; + // close file descriptor CloseDevice(fd, name); return 0; @@ -1509,9 +1516,13 @@ static int SCSIDeviceScan(cfgfile *cfg, int scanning) { UINT8 tBuf[64]; // should we try to register this as a SCSI device? - if ( !((CONTROLLER_TYPE(cfg) == CONTROLLER_SCSI) || - (CONTROLLER_TYPE(cfg) == CONTROLLER_UNKNOWN))) + switch (con->controller_type) { + case CONTROLLER_SCSI: + case CONTROLLER_UNKNOWN: + break; + default: return 1; + } // open the device if ((fd = OpenDevice(device, "SCSI", scanning)) < 0) @@ -1990,10 +2001,10 @@ int ATACheckDevice(cfgfile *cfg){ if (cfg->mailwarn && cfg->mailwarn->emailtest) MailWarning(cfg, 0, "TEST EMAIL from smartd for device: %s", name); - if (cfg->controller_type == THREE_WARE_9000_CHAR) + if (cfg->controller_type == CONTROLLER_3WARE_9000_CHAR) mode="ATA_3WARE_9000"; - if (cfg->controller_type == THREE_WARE_678K_CHAR) + if (cfg->controller_type == CONTROLLER_3WARE_678K_CHAR) mode="ATA_3WARE_678K"; // if we can't open device, fail gracefully rather than hard -- @@ -2632,7 +2643,9 @@ int ParseToken(char *token,cfgfile *cfg){ } else { // determine type of escalade device from name of device cfg->controller_type = guess_device_type(name); - + if (cfg->controller_type!=CONTROLLER_3WARE_9000_CHAR && cfg->controller_type!=CONTROLLER_3WARE_678K_CHAR) + cfg->controller_type=CONTROLLER_3WARE_678K; + // NOTE: controller_port == disk number + 1 cfg->controller_port = i+1; } @@ -3018,7 +3031,8 @@ int ParseConfigLine(int entry, int lineno,char *line){ // Try and recognize if a IDE or SCSI device. These can be // overwritten by configuration file directives. - cfg->controller_type = guess_device_type(cfg->name); + if (cfg->controller_type==CONTROLLER_UNKNOWN) + cfg->controller_type = guess_device_type(cfg->name); // parse tokens one at a time from the file. while ((token=strtok(NULL,delim))){ @@ -3577,7 +3591,7 @@ int MakeConfigEntries(const char *type, int start){ } // ATA or SCSI? - if ( !strcmp(type,"ATA") ) + if (!strcmp(type,"ATA") ) cfg->controller_type = CONTROLLER_ATA; if (!strcmp(type,"SCSI") ) cfg->controller_type = CONTROLLER_SCSI; @@ -3644,8 +3658,8 @@ int ReadOrMakeConfigEntries(int *scanning){ // scan. Configuration file's first entry contains all options // that were set cfgfile *first=cfgentries[0]; - int doata = 1; - int doscsi= 1; + int doata = !(first->controller_type==CONTROLLER_SCSI); + int doscsi = !(first->controller_type==CONTROLLER_ATA); *scanning=1; @@ -3695,7 +3709,7 @@ void RegisterDevices(int scanning){ continue; // register ATA devices - if (CONTROLLER_TYPE(ent) == CONTROLLER_ATA){ + if (ent->controller_type!=CONTROLLER_SCSI){ if (ATADeviceScan(ent, scanning)) CanNotRegister(ent->name, "ATA", ent->lineno, scanning); else { @@ -3708,7 +3722,7 @@ void RegisterDevices(int scanning){ } // then register SCSI devices - if (CONTROLLER_TYPE(ent) == CONTROLLER_SCSI){ + if (ent->controller_type==CONTROLLER_SCSI || ent->controller_type==CONTROLLER_UNKNOWN){ int retscsi=0; #if SCSITIMEOUT diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index d7628cbc3..c2b77c915 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -108,7 +108,7 @@ int getdomainname(char *, int); /* no declaration in header files! */ extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid; -static const char *filenameandversion="$Id: smartd.cpp,v 1.332 2004/08/13 13:57:12 arvoreen Exp $"; +static const char *filenameandversion="$Id: smartd.cpp,v 1.333 2004/08/16 22:44:27 ballen4705 Exp $"; #ifdef NEED_SOLARIS_ATA_CODE extern const char *os_solaris_ata_s_cvsid; #endif @@ -118,7 +118,7 @@ extern const char *daemon_win32_c_cvsid, *hostname_win32_c_cvsid, *syslog_win32_ extern const char *int64_vc6_c_cvsid; #endif #endif -const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.332 2004/08/13 13:57:12 arvoreen Exp $" +const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.333 2004/08/16 22:44:27 ballen4705 Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID #ifdef DAEMON_WIN32_H_CVSID DAEMON_WIN32_H_CVSID @@ -688,8 +688,10 @@ void MailWarning(cfgfile *cfg, int which, char *fmt, ...){ exportenv(environ_strings[6], "SMARTD_ADDRESS", address); exportenv(environ_strings[7], "SMARTD_DEVICESTRING", cfg->name); - switch (CONTROLLER_TYPE(cfg)) { - case CONTROLLER_3WARE: + switch (cfg->controller_type) { + case CONTROLLER_3WARE_678K: + case CONTROLLER_3WARE_9000_CHAR: + case CONTROLLER_3WARE_678K_CHAR: { char *s,devicetype[16]; sprintf(devicetype, "3ware,%d", cfg->controller_port-1); @@ -1227,23 +1229,27 @@ int ATADeviceScan(cfgfile *cfg, int scanning){ char *name=cfg->name; int retainsmartdata=0; int retid; - char *mode="ATA"; + char *mode; // should we try to register this as an ATA device? - if ( !((CONTROLLER_TYPE(cfg) == CONTROLLER_ATA) || - (CONTROLLER_TYPE(cfg) == CONTROLLER_3WARE) || - (CONTROLLER_TYPE(cfg) == CONTROLLER_UNKNOWN))) + switch (cfg->controller_type) { + case CONTROLLER_ATA: + case CONTROLLER_3WARE_678K: + case CONTROLLER_UNKNOWN: + mode="ATA"; + break; + case CONTROLLER_3WARE_678K_CHAR: + mode="ATA_3WARE_678K"; + break; + case CONTROLLER_3WARE_9000_CHAR: + mode="ATA_3WARE_9000"; + break; + default: + // not a recognized ATA or SATA device. We should never enter + // this branch. return 1; - - // need to determine what type of 3ware controller - if (CONTROLLER_TYPE(cfg) == CONTROLLER_3WARE) { - if (THREE_WARE_TYPE(cfg)== THREE_WARE_9000_CHAR) - mode="ATA_3WARE_9000"; - - if (THREE_WARE_TYPE(cfg) == THREE_WARE_678K_CHAR) - mode="ATA_3WARE_678K"; } - + // open the device if ((fd=OpenDevice(name, mode, scanning))<0) // device open failed @@ -1493,8 +1499,9 @@ int ATADeviceScan(cfgfile *cfg, int scanning){ PrintOut(LOG_INFO,"Device: %s, is SMART capable. Adding to \"monitor\" list.\n",name); // record number of device, type of device, increment device count - cfg->controller_type = CONTROLLER_ATA;; - + if (cfg->controller_type == CONTROLLER_UNKNOWN) + cfg->controller_type=CONTROLLER_ATA;; + // close file descriptor CloseDevice(fd, name); return 0; @@ -1509,9 +1516,13 @@ static int SCSIDeviceScan(cfgfile *cfg, int scanning) { UINT8 tBuf[64]; // should we try to register this as a SCSI device? - if ( !((CONTROLLER_TYPE(cfg) == CONTROLLER_SCSI) || - (CONTROLLER_TYPE(cfg) == CONTROLLER_UNKNOWN))) + switch (con->controller_type) { + case CONTROLLER_SCSI: + case CONTROLLER_UNKNOWN: + break; + default: return 1; + } // open the device if ((fd = OpenDevice(device, "SCSI", scanning)) < 0) @@ -1990,10 +2001,10 @@ int ATACheckDevice(cfgfile *cfg){ if (cfg->mailwarn && cfg->mailwarn->emailtest) MailWarning(cfg, 0, "TEST EMAIL from smartd for device: %s", name); - if (cfg->controller_type == THREE_WARE_9000_CHAR) + if (cfg->controller_type == CONTROLLER_3WARE_9000_CHAR) mode="ATA_3WARE_9000"; - if (cfg->controller_type == THREE_WARE_678K_CHAR) + if (cfg->controller_type == CONTROLLER_3WARE_678K_CHAR) mode="ATA_3WARE_678K"; // if we can't open device, fail gracefully rather than hard -- @@ -2632,7 +2643,9 @@ int ParseToken(char *token,cfgfile *cfg){ } else { // determine type of escalade device from name of device cfg->controller_type = guess_device_type(name); - + if (cfg->controller_type!=CONTROLLER_3WARE_9000_CHAR && cfg->controller_type!=CONTROLLER_3WARE_678K_CHAR) + cfg->controller_type=CONTROLLER_3WARE_678K; + // NOTE: controller_port == disk number + 1 cfg->controller_port = i+1; } @@ -3018,7 +3031,8 @@ int ParseConfigLine(int entry, int lineno,char *line){ // Try and recognize if a IDE or SCSI device. These can be // overwritten by configuration file directives. - cfg->controller_type = guess_device_type(cfg->name); + if (cfg->controller_type==CONTROLLER_UNKNOWN) + cfg->controller_type = guess_device_type(cfg->name); // parse tokens one at a time from the file. while ((token=strtok(NULL,delim))){ @@ -3577,7 +3591,7 @@ int MakeConfigEntries(const char *type, int start){ } // ATA or SCSI? - if ( !strcmp(type,"ATA") ) + if (!strcmp(type,"ATA") ) cfg->controller_type = CONTROLLER_ATA; if (!strcmp(type,"SCSI") ) cfg->controller_type = CONTROLLER_SCSI; @@ -3644,8 +3658,8 @@ int ReadOrMakeConfigEntries(int *scanning){ // scan. Configuration file's first entry contains all options // that were set cfgfile *first=cfgentries[0]; - int doata = 1; - int doscsi= 1; + int doata = !(first->controller_type==CONTROLLER_SCSI); + int doscsi = !(first->controller_type==CONTROLLER_ATA); *scanning=1; @@ -3695,7 +3709,7 @@ void RegisterDevices(int scanning){ continue; // register ATA devices - if (CONTROLLER_TYPE(ent) == CONTROLLER_ATA){ + if (ent->controller_type!=CONTROLLER_SCSI){ if (ATADeviceScan(ent, scanning)) CanNotRegister(ent->name, "ATA", ent->lineno, scanning); else { @@ -3708,7 +3722,7 @@ void RegisterDevices(int scanning){ } // then register SCSI devices - if (CONTROLLER_TYPE(ent) == CONTROLLER_SCSI){ + if (ent->controller_type==CONTROLLER_SCSI || ent->controller_type==CONTROLLER_UNKNOWN){ int retscsi=0; #if SCSITIMEOUT diff --git a/sm5/smartd.h b/sm5/smartd.h index 3135aa14d..3f300004c 100644 --- a/sm5/smartd.h +++ b/sm5/smartd.h @@ -32,7 +32,7 @@ #ifndef SMARTD_H_CVSID -#define SMARTD_H_CVSID "$Id: smartd.h,v 1.72 2004/08/13 13:57:12 arvoreen Exp $\n" +#define SMARTD_H_CVSID "$Id: smartd.h,v 1.73 2004/08/16 22:44:28 ballen4705 Exp $\n" #endif // Configuration file @@ -168,8 +168,8 @@ typedef struct configfile_s { // REGISTERED AND WE LEARN ITS CAPABILITIES. int lineno; // Line number of entry in file char *name; // Device name (+ optional [3ware_disk_XX]) - unsigned char controller_type; // Controller type, ATA/SCSI/3Ware - unsigned char controller_port; // 1 + ATA disk # in 3ware controller + unsigned char controller_type; // Controller type, ATA/SCSI/3Ware/(more to come) + unsigned char controller_port; // 1 + (disk number in controller). 0 means controller only handles one disk. char smartcheck; // Check SMART status char usagefailed; // Check for failed Usage Attributes char prefail; // Track changes in Prefail Attributes diff --git a/sm5/utility.h b/sm5/utility.h index a2f5e988a..6eb824313 100644 --- a/sm5/utility.h +++ b/sm5/utility.h @@ -25,7 +25,7 @@ #ifndef UTILITY_H_ #define UTILITY_H_ -#define UTILITY_H_CVSID "$Id: utility.h,v 1.36 2004/08/16 00:57:29 ballen4705 Exp $\n" +#define UTILITY_H_CVSID "$Id: utility.h,v 1.37 2004/08/16 22:44:28 ballen4705 Exp $\n" #include <time.h> #include <sys/types.h> // for regex.h (according to POSIX) @@ -158,20 +158,12 @@ void MsecToText(unsigned int msec, char *txt); #define PRINT_OFF(control) {if (control->printing_switchable) control->dont_print=1;} // possible values for controller_type in extern.h -#define CONTROLLER_UNKNOWN 0x00 -#define CONTROLLER_ATA 0x10 -#define CONTROLLER_SCSI 0x20 -#define CONTROLLER_3WARE 0x30 - -#define CONTROLLER_MASK 0xF0 -#define CONTROLLER_TYPE(x) (x->controller_type & CONTROLLER_MASK) - -// 3Ware controller types -#define THREE_WARE_9000_CHAR (CONTROLLER_3WARE | 1) -#define THREE_WARE_678K (CONTROLLER_3WARE | 2) -#define THREE_WARE_678K_CHAR (CONTROLLER_3WARE | 3) -#define THREE_WARE_TYPE_MASK 0x0F - -#define THREE_WARE_TYPE(x) (x->controller_type & THREE_WARE_TYPE_MASK) +#define CONTROLLER_UNKNOWN 0x00 +#define CONTROLLER_ATA 0x01 +#define CONTROLLER_SCSI 0x02 +#define CONTROLLER_3WARE 0x03 // set by -d option, but converted to one of three types below +#define CONTROLLER_3WARE_678K 0x04 // NOT set by guess_device_type() +#define CONTROLLER_3WARE_9000_CHAR 0x05 // set by guess_device_type() +#define CONTROLLER_3WARE_678K_CHAR 0x06 // set by guess_device_type() #endif -- GitLab