From ec04b3501fd8d534b0ae133223b01171273620c8 Mon Sep 17 00:00:00 2001 From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Wed, 19 Nov 2003 19:38:19 +0000 Subject: [PATCH] Backed out premature self-testing and scheduling code from smartd. git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@1262 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/smartd.c | 108 +------------------------------------------------ sm5/smartd.cpp | 108 +------------------------------------------------ sm5/smartd.h | 6 +-- 3 files changed, 3 insertions(+), 219 deletions(-) diff --git a/sm5/smartd.c b/sm5/smartd.c index 818857086..a5ebf5fb0 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -65,7 +65,7 @@ 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; -const char *smartd_c_cvsid="$Id: smartd.c,v 1.245 2003/11/19 07:50:39 ballen4705 Exp $" +const char *smartd_c_cvsid="$Id: smartd.c,v 1.246 2003/11/19 19:38:16 ballen4705 Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID; @@ -1600,9 +1600,6 @@ void printoutvaliddirectiveargs(int priority, char d) { char *s=NULL; switch (d) { - case 's': - PrintOut(priority, "S,n or L,n or S,n,m-p or L,n,m-p withh n,m,p integers"); - break; case 'd': PrintOut(priority, "ata, scsi, removable, 3ware,N"); break; @@ -1666,61 +1663,6 @@ int GetInteger(char *arg, char *name, char *token, int lineno, char *configfile, return val; } -#define SCHEDULE_SELFTESTS 0 - -#if SCHEDULE_SELFTESTS -char ParseTestTime(char *arg, int *dt, int *range) { - char null='\0'; - char *endptr1, *endptr2,*endptr3; - - // check that pointer is not null - if (!arg) - return null; - - // that first character is L or S - if (arg[0]!='L' && arg[0]!='S') - return null; - - // that second character is comma - if (arg[1]!=',') - return null; - - if (!arg[2]) - return null; - - // that third character is a number - *dt=strtol(arg+2, &endptr1, 10); - - if (!endptr1[0]) - // we read a number, and nothing follows - return arg[0]; - - if (endptr1==arg+2 || endptr1[0] != ',') - return null; - - if (!endptr1[1]) - return null; - - range[0]=strtol(endptr1+1,&endptr2, 10); - - if (!endptr2[0]) - return null; - - if (endptr2==endptr1+1 || endptr2[0] !='-') - return null; - - if (!endptr2[1]) - return null; - - range[1]=strtol(endptr2+1,&endptr3, 10); - - if (*endptr3) - return null; - - return arg[0]+32; -} -#endif - // This function returns 1 if it has correctly parsed one token (and // any arguments), else zero if no tokens remain. It returns -1 if an // error was encountered. @@ -1890,54 +1832,6 @@ int ParseToken(char *token,cfgfile *cfg){ badarg = 1; } break; -#if SCHEDULE_SELFTESTS - case 's': - // scheduled self-testing interval, times - if ((arg = strtok(NULL, delim)) == NULL) { - missingarg = 1; - } else { - int dt, range[2]={0,24}; - char type=ParseTestTime(arg, &dt, range); - - if (!type) - badarg=1; - else { - int shortform=type=='L' || type=='S'; - if (type=='l' || type=='s') - type -=32; - - if (dt<1 || dt>65535) { - PrintOut(LOG_CRIT, - "File %s line %d (drive %s): Directive %s %c,n%s\n" - "schedules a self-test n hours after the last one, where 1 <= n <= 65535.\n" - "You have: %s %s so n=%d.\n", - configfile, lineno, name, token, type, shortform?"":",m-p", token, arg, dt); - return -1; - } - - if (!shortform && (range[0]<0 || range[1]>24 || range[0]>=range[1])) { - PrintOut(LOG_CRIT, - "File %s line %d (drive %s): Directive %s %c,n,m-p\n" - "schedules a self-test in the time between m hours after midnight\n" - "and p hours after midnight, where 0 <= m <= 23 and 1 <= p <= 24 and m < p.\n" - "You have: %s %s so m=%d and p=%d.\n", - configfile, lineno, name, token, type, token, arg, range[0], range[1]); - return -1; - } - if (type=='S') { - cfg->runshort=dt; - cfg->runshorttime[0]=range[0]; - cfg->runshorttime[1]=range[1]; - } - else { - cfg->runlong=dt; - cfg->runlongtime[0]=range[0]; - cfg->runlongtime[1]=range[1]; - } - } - } - break; -#endif case 'M': // email warning option if ((arg = strtok(NULL, delim)) == NULL) { diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 5be0ffac6..015885311 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -65,7 +65,7 @@ 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; -const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.245 2003/11/19 07:50:39 ballen4705 Exp $" +const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.246 2003/11/19 19:38:16 ballen4705 Exp $" ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID; @@ -1600,9 +1600,6 @@ void printoutvaliddirectiveargs(int priority, char d) { char *s=NULL; switch (d) { - case 's': - PrintOut(priority, "S,n or L,n or S,n,m-p or L,n,m-p withh n,m,p integers"); - break; case 'd': PrintOut(priority, "ata, scsi, removable, 3ware,N"); break; @@ -1666,61 +1663,6 @@ int GetInteger(char *arg, char *name, char *token, int lineno, char *configfile, return val; } -#define SCHEDULE_SELFTESTS 0 - -#if SCHEDULE_SELFTESTS -char ParseTestTime(char *arg, int *dt, int *range) { - char null='\0'; - char *endptr1, *endptr2,*endptr3; - - // check that pointer is not null - if (!arg) - return null; - - // that first character is L or S - if (arg[0]!='L' && arg[0]!='S') - return null; - - // that second character is comma - if (arg[1]!=',') - return null; - - if (!arg[2]) - return null; - - // that third character is a number - *dt=strtol(arg+2, &endptr1, 10); - - if (!endptr1[0]) - // we read a number, and nothing follows - return arg[0]; - - if (endptr1==arg+2 || endptr1[0] != ',') - return null; - - if (!endptr1[1]) - return null; - - range[0]=strtol(endptr1+1,&endptr2, 10); - - if (!endptr2[0]) - return null; - - if (endptr2==endptr1+1 || endptr2[0] !='-') - return null; - - if (!endptr2[1]) - return null; - - range[1]=strtol(endptr2+1,&endptr3, 10); - - if (*endptr3) - return null; - - return arg[0]+32; -} -#endif - // This function returns 1 if it has correctly parsed one token (and // any arguments), else zero if no tokens remain. It returns -1 if an // error was encountered. @@ -1890,54 +1832,6 @@ int ParseToken(char *token,cfgfile *cfg){ badarg = 1; } break; -#if SCHEDULE_SELFTESTS - case 's': - // scheduled self-testing interval, times - if ((arg = strtok(NULL, delim)) == NULL) { - missingarg = 1; - } else { - int dt, range[2]={0,24}; - char type=ParseTestTime(arg, &dt, range); - - if (!type) - badarg=1; - else { - int shortform=type=='L' || type=='S'; - if (type=='l' || type=='s') - type -=32; - - if (dt<1 || dt>65535) { - PrintOut(LOG_CRIT, - "File %s line %d (drive %s): Directive %s %c,n%s\n" - "schedules a self-test n hours after the last one, where 1 <= n <= 65535.\n" - "You have: %s %s so n=%d.\n", - configfile, lineno, name, token, type, shortform?"":",m-p", token, arg, dt); - return -1; - } - - if (!shortform && (range[0]<0 || range[1]>24 || range[0]>=range[1])) { - PrintOut(LOG_CRIT, - "File %s line %d (drive %s): Directive %s %c,n,m-p\n" - "schedules a self-test in the time between m hours after midnight\n" - "and p hours after midnight, where 0 <= m <= 23 and 1 <= p <= 24 and m < p.\n" - "You have: %s %s so m=%d and p=%d.\n", - configfile, lineno, name, token, type, token, arg, range[0], range[1]); - return -1; - } - if (type=='S') { - cfg->runshort=dt; - cfg->runshorttime[0]=range[0]; - cfg->runshorttime[1]=range[1]; - } - else { - cfg->runlong=dt; - cfg->runlongtime[0]=range[0]; - cfg->runlongtime[1]=range[1]; - } - } - } - break; -#endif case 'M': // email warning option if ((arg = strtok(NULL, delim)) == NULL) { diff --git a/sm5/smartd.h b/sm5/smartd.h index 4975b6e81..da9ca0068 100644 --- a/sm5/smartd.h +++ b/sm5/smartd.h @@ -27,7 +27,7 @@ #ifndef SMARTD_H_CVSID -#define SMARTD_H_CVSID "$Id: smartd.h,v 1.60 2003/11/19 07:50:39 ballen4705 Exp $\n" +#define SMARTD_H_CVSID "$Id: smartd.h,v 1.61 2003/11/19 19:38:19 ballen4705 Exp $\n" #endif // Configuration file @@ -167,10 +167,6 @@ typedef struct configfile_s { char showpresets; // Show database entry for this device char removable; // Device may disappear (not be present) unsigned char selflogcount; // total number of self-test errors - unsigned short runshort; // interval to run short self test on - unsigned short runlong; // interval to run long self test on - signed char runshorttime[2]; // 1+start/stop time run for short tests - signed char runlongtime[2]; // 1+start/stop time run for short tests unsigned char notused1[3]; // for packing alignment unsigned short selfloghour; // lifetime hours of last self-test error char *emailcmdline; // Program for sending mail (or NULL) -- GitLab