Skip to content
Snippets Groups Projects
Commit e1708fc5 authored by sxzzsf's avatar sxzzsf
Browse files

enhanced param checking for hpt

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2255 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent e1b9dd95
Branches
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef EXTERN_H_ #ifndef EXTERN_H_
#define EXTERN_H_ #define EXTERN_H_
#define EXTERN_H_CVSID "$Id: extern.h,v 1.46 2006/09/12 00:21:51 dpgilbert Exp $\n" #define EXTERN_H_CVSID "$Id: extern.h,v 1.47 2006/09/15 08:03:52 sxzzsf Exp $\n"
// Possible values for fixfirmwarebug. If use has NOT specified -F at // Possible values for fixfirmwarebug. If use has NOT specified -F at
// all, then value is 0. // all, then value is 0.
...@@ -94,7 +94,7 @@ typedef struct smartmonctrl_s { ...@@ -94,7 +94,7 @@ typedef struct smartmonctrl_s {
unsigned char controller_type; unsigned char controller_type;
// For 3Ware controllers, nonzero value is 1 plus the disk number // For 3Ware controllers, nonzero value is 1 plus the disk number
unsigned char controller_port; unsigned char controller_port;
// combined controller/channle/pmport for highpoint raid controller // combined controller/channle/pmport for highpoint rocketraid controller
unsigned char hpt_data[3]; unsigned char hpt_data[3];
unsigned char ignorepresets; unsigned char ignorepresets;
unsigned char showpresets; unsigned char showpresets;
......
.ig .ig
Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
$Id: smartctl.8.in,v 1.82 2006/09/11 05:29:27 sxzzsf Exp $ $Id: smartctl.8.in,v 1.83 2006/09/15 08:03:52 sxzzsf Exp $
This program is free software; you can redistribute it and/or modify it 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 under the terms of the GNU General Public License as published by the Free
...@@ -282,7 +282,8 @@ controller id, the integer M is the channel number, and the integer N is the ...@@ -282,7 +282,8 @@ controller id, the integer M is the channel number, and the integer N is the
PMPort number if it is available. The allowed values of L are from 1 to 4 PMPort number if it is available. The allowed values of L are from 1 to 4
inclusive, M are from 1 to 8 inclusive and N from 1 to 4 if PMPort available. inclusive, M are from 1 to 8 inclusive and N from 1 to 4 if PMPort available.
Note that the /dev/sda-z form should be the device node which stands for Note that the /dev/sda-z form should be the device node which stands for
the disks derived from the HighPoint RocketRAID controllers the disks derived from the HighPoint RocketRAID controllers. And also
these values are limited by the model of the HighPoint RocketRAID controller.
.B HighPoint RocketRAID controllers are currently ONLY supported under Linux. .B HighPoint RocketRAID controllers are currently ONLY supported under Linux.
...@@ -1351,7 +1352,7 @@ these documents may be found in the References section of the ...@@ -1351,7 +1352,7 @@ these documents may be found in the References section of the
.SH .SH
CVS ID OF THIS PAGE: CVS ID OF THIS PAGE:
$Id: smartctl.8.in,v 1.82 2006/09/11 05:29:27 sxzzsf Exp $ $Id: smartctl.8.in,v 1.83 2006/09/15 08:03:52 sxzzsf Exp $
.\" Local Variables: .\" Local Variables:
.\" mode: nroff .\" mode: nroff
.\" End: .\" End:
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
extern const char *os_solaris_ata_s_cvsid; extern const char *os_solaris_ata_s_cvsid;
#endif #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; 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.153 2006/09/12 00:24:01 dpgilbert Exp $" const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.154 2006/09/15 08:03:52 sxzzsf 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; 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 // This is a block containing all the "control variables". We declare
...@@ -411,7 +411,7 @@ void ParseOpts (int argc, char** argv){ ...@@ -411,7 +411,7 @@ void ParseOpts (int argc, char** argv){
if(optarg[i] == '/') { if(optarg[i] == '/') {
slash++; slash++;
if(slash == 3) { if(slash == 3) {
sprintf(extraerror, "Option -d hpt,L/M/N supports 2-3 items\n"); sprintf(extraerror, "Option '-d hpt,L/M/N' supports 2-3 items\n");
badarg = TRUE; badarg = TRUE;
break; break;
} }
...@@ -428,18 +428,27 @@ void ParseOpts (int argc, char** argv){ ...@@ -428,18 +428,27 @@ void ParseOpts (int argc, char** argv){
break; break;
} }
} }
if (badarg != TRUE && slash != 0) { if (slash == 0) {
if(con->hpt_data[0]==0){ sprintf(extraerror, "Option '-d hpt,L/M/N' requires 2-3 items\n");
sprintf(extraerror, "Option -d hpt,L/M/N: no/invalid controller id L supplied\n"); badarg = TRUE;
} else if (badarg != TRUE) {
if (con->hpt_data[0]==0 || con->hpt_data[0]>8){
sprintf(extraerror, "Option '-d hpt,L/M/N' no/invalid controller id L supplied\n");
badarg = TRUE;
}
if (con->hpt_data[1]==0 || con->hpt_data[1]>8){
sprintf(extraerror, "Option '-d hpt,L/M/N' no/invalid channel number M supplied\n");
badarg = TRUE; badarg = TRUE;
} }
if(con->hpt_data[1]==0){ if (slash==2) {
sprintf(extraerror, "Option -d hpt,L/M/N: no/invalid channel number M supplied\n"); if ( con->hpt_data[2]==0 || con->hpt_data[2]>15) {
sprintf(extraerror, "Option '-d hpt,L/M/N' no/invalid pmport number N supplied\n");
badarg = TRUE; badarg = TRUE;
} }
if(con->hpt_data[2]==0) } else {
con->hpt_data[2]=1; con->hpt_data[2]=1;
} }
}
} else { } else {
// look for RAID-type device // look for RAID-type device
int i; int i;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment