Commit 302e4407 authored by ballen4705's avatar ballen4705
Browse files

Changed names of CVSid strings and CVSID macros to reflect file names. This

makes it easier to understand which should be included and how they work.
Also added a new pair of files, utility.[ch].  These should be used for
general-purpose utility functions that are not specific to either ATA or SCSI,
or to smartd or smartctl.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@448 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 01b921a6
......@@ -2,7 +2,7 @@
#
# Home page: http://smartmontools.sourceforge.net
#
# $Id: Makefile,v 1.44 2003/01/14 13:07:40 ballen4705 Exp $
# $Id: Makefile,v 1.45 2003/01/16 15:28:57 ballen4705 Exp $
#
# Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
#
......@@ -40,7 +40,8 @@ LDFLAGS = # -s
releasefiles=atacmds.c atacmds.h ataprint.c ataprint.h CHANGELOG COPYING extern.h Makefile\
README scsicmds.c scsicmds.h scsiprint.c scsiprint.h smartctl.8 smartctl.c smartctl.h\
smartd.8 smartd.c smartd.h smartd.initd TODO WARNINGS VERSION smartd.conf smartd.conf.5
smartd.8 smartd.c smartd.h smartd.initd TODO WARNINGS VERSION smartd.conf smartd.conf.5\
utility.c utility.h
counter=$(shell cat VERSION)
newcounter=$(shell ./add )
......@@ -51,27 +52,31 @@ all: smartd smartctl
@echo -e "\n\nSmartd can now use a configuration file /etc/smartd.conf. Do:\n\n\tman ./smartctl.8\n\tman ./smartd.8\n\tman ./smartd.conf.5\n"
@echo -e "to read the manual pages now. Unless you do a \"make install\" the manual pages won't be installed.\n"
smartctl: smartctl.c atacmds.o ataprint.o scsicmds.o scsiprint.o \
smartctl: smartctl.c atacmds.o ataprint.o scsicmds.o scsiprint.o utility.o\
smartctl.h atacmds.h ataprint.h scsicmds.h scsiprint.h extern.h VERSION Makefile
$(CC) -DSMARTMONTOOLS_VERSION=$(counter) -o smartctl $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) smartctl.c \
atacmds.o scsicmds.o ataprint.o scsiprint.o
atacmds.o ataprint.o scsicmds.o scsiprint.o utility.o
smartd: smartd.c atacmds.o ataprint.o scsicmds.o \
smartd: smartd.c atacmds.o ataprint.o scsicmds.o utility.o\
smartd.h atacmds.h ataprint.h scsicmds.h extern.h VERSION Makefile
$(CC) -DSMARTMONTOOLS_VERSION=$(counter) -o smartd $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) smartd.c \
scsicmds.o atacmds.o ataprint.o
atacmds.o ataprint.o scsicmds.o utility.o
atacmds.o: atacmds.h atacmds.c Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) -c atacmds.c
ataprint.o: ataprint.c atacmds.h ataprint.h smartctl.h extern.h Makefile
ataprint.o: ataprint.c atacmds.h ataprint.h smartctl.h extern.h utility.h Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) -c ataprint.c
scsicmds.o: scsicmds.c scsicmds.h Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) -c scsicmds.c
scsiprint.o: scsiprint.c extern.h scsicmds.h scsiprint.h smartctl.h Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) -c scsiprint.c
scsiprint.o: scsiprint.c extern.h scsicmds.h scsiprint.h smartctl.h utility.h Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) -c scsiprint.c
utility.o: utility.c utility.h Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) -c utility.c
# This extracts the configuration file directives from smartd.8 and
# inserts them into smartd.conf.5
......
......@@ -29,7 +29,7 @@
#include <stdlib.h>
#include "atacmds.h"
const char *CVSid1="$Id: atacmds.c,v 1.50 2003/01/13 12:49:06 ballen4705 Exp $" CVSID1;
const char *atacmds_c_cvsid="$Id: atacmds.c,v 1.51 2003/01/16 15:28:57 ballen4705 Exp $" ATACMDS_H_CVSID;
// 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
......
......@@ -29,7 +29,7 @@
#include <stdlib.h>
#include "atacmds.h"
const char *CVSid1="$Id: atacmds.cpp,v 1.50 2003/01/13 12:49:06 ballen4705 Exp $" CVSID1;
const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.51 2003/01/16 15:28:57 ballen4705 Exp $" ATACMDS_H_CVSID;
// 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
......
......@@ -25,8 +25,8 @@
#ifndef _ATACMDS_H_
#define _ATACMDS_H_
#ifndef CVSID1
#define CVSID1 "$Id: atacmds.h,v 1.30 2003/01/04 17:34:16 pjwilliams Exp $\n"
#ifndef ATACMDS_H_CVSID
#define ATACMDS_H_CVSID "$Id: atacmds.h,v 1.31 2003/01/16 15:28:57 ballen4705 Exp $\n"
#endif
// These are the major and minor versions for smartd and smartctl
......
......@@ -25,14 +25,14 @@
#include <ctype.h>
#include <stdio.h>
#include <syslog.h>
#include <time.h>
#include "atacmds.h"
#include "ataprint.h"
#include "smartctl.h"
#include "extern.h"
#include "utility.h"
const char *CVSid2="$Id: ataprint.c,v 1.54 2003/01/14 20:04:07 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID6;
const char *ataprint_c_cvsid="$Id: ataprint.c,v 1.55 2003/01/16 15:28:57 ballen4705 Exp $"
ATACMDS_H_CVSID ATAPRINT_H_CVSID EXTERN_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
// for passing global control variables
extern atamainctrl *con;
......@@ -64,13 +64,11 @@ void printswap(char *in, unsigned int n){
return;
}
void ataPrintDriveInfo (struct hd_driveid *drive){
int version;
const char *description;
char unknown[64];
char unknown[64], timedatetz[64];
unsigned short minorrev;
time_t tval;
// print out model, serial # and firmware versions (byte-swap ASCI strings)
pout("Device Model: ");
......@@ -101,10 +99,10 @@ void ataPrintDriveInfo (struct hd_driveid *drive){
pout("ATA Version is: %d\n",(int)abs(version));
pout("ATA Standard is: %s\n",description);
// print current time and date
tval=time(NULL);
pout("Local Time is: %s", ctime(&tval));
// print current time and date and timezone
dateandtimezone(timedatetz);
pout("Local Time is: %s\n", timedatetz);
if (version>=3)
return;
......
......@@ -25,14 +25,14 @@
#include <ctype.h>
#include <stdio.h>
#include <syslog.h>
#include <time.h>
#include "atacmds.h"
#include "ataprint.h"
#include "smartctl.h"
#include "extern.h"
#include "utility.h"
const char *CVSid2="$Id: ataprint.cpp,v 1.54 2003/01/14 20:04:07 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID6;
const char *ataprint_c_cvsid="$Id: ataprint.cpp,v 1.55 2003/01/16 15:28:57 ballen4705 Exp $"
ATACMDS_H_CVSID ATAPRINT_H_CVSID EXTERN_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
// for passing global control variables
extern atamainctrl *con;
......@@ -64,13 +64,11 @@ void printswap(char *in, unsigned int n){
return;
}
void ataPrintDriveInfo (struct hd_driveid *drive){
int version;
const char *description;
char unknown[64];
char unknown[64], timedatetz[64];
unsigned short minorrev;
time_t tval;
// print out model, serial # and firmware versions (byte-swap ASCI strings)
pout("Device Model: ");
......@@ -101,10 +99,10 @@ void ataPrintDriveInfo (struct hd_driveid *drive){
pout("ATA Version is: %d\n",(int)abs(version));
pout("ATA Standard is: %s\n",description);
// print current time and date
tval=time(NULL);
pout("Local Time is: %s", ctime(&tval));
// print current time and date and timezone
dateandtimezone(timedatetz);
pout("Local Time is: %s\n", timedatetz);
if (version>=3)
return;
......
......@@ -25,8 +25,8 @@
#ifndef _SMART_PRINT_H_
#define _SMART_PRINT_H_
#ifndef CVSID2
#define CVSID2 "$Id: ataprint.h,v 1.14 2002/10/30 10:18:37 ballen4705 Exp $\n"
#ifndef ATAPRINT_H_CVSID
#define ATAPRINT_H_CVSID "$Id: ataprint.h,v 1.15 2003/01/16 15:28:57 ballen4705 Exp $\n"
#endif
#include <stdio.h>
......
......@@ -26,8 +26,8 @@
#define _EXTERN_H_
#ifndef CVSID3
#define CVSID3 "$Id: extern.h,v 1.12 2003/01/03 17:25:12 ballen4705 Exp $\n"
#ifndef EXTERN_H_CVSID
#define EXTERN_H_CVSID "$Id: extern.h,v 1.13 2003/01/16 15:28:57 ballen4705 Exp $\n"
#endif
// Block used for global control/communications. If you need more
......
......@@ -32,7 +32,7 @@
/* #include <scsi/scsi_ioctl.h> bypass for now */
#include "scsicmds.h"
const char *CVSid3="$Id: scsicmds.c,v 1.17 2003/01/04 01:37:48 dpgilbert Exp $" CVSID4;
const char *scsicmds_c_cvsid="$Id: scsicmds.c,v 1.18 2003/01/16 15:28:57 ballen4705 Exp $" SCSICMDS_H_CVSID;
static int send_scsi_cmd(int device, int cmnd_len, void * io_hdr)
{
......
......@@ -32,7 +32,7 @@
/* #include <scsi/scsi_ioctl.h> bypass for now */
#include "scsicmds.h"
const char *CVSid3="$Id: scsicmds.cpp,v 1.17 2003/01/04 01:37:48 dpgilbert Exp $" CVSID4;
const char *scsicmds_c_cvsid="$Id: scsicmds.cpp,v 1.18 2003/01/16 15:28:57 ballen4705 Exp $" SCSICMDS_H_CVSID;
static int send_scsi_cmd(int device, int cmnd_len, void * io_hdr)
{
......
......@@ -26,8 +26,8 @@
#ifndef SCSICMDS_H_
#define SCSICMDS_H_
#ifndef CVSID4
#define CVSID4 "$Id: scsicmds.h,v 1.9 2003/01/04 01:37:48 dpgilbert Exp $\n"
#ifndef SCSICMDS_H_CVSID
#define SCSICMDS_H_CVSID "$Id: scsicmds.h,v 1.10 2003/01/16 15:28:57 ballen4705 Exp $\n"
#endif
/* #define SCSI_DEBUG 1 */ /* Comment out to disable command debugging */
......
......@@ -28,17 +28,17 @@
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include "smartctl.h"
#include "extern.h"
#include "scsicmds.h"
#include "scsiprint.h"
#include "extern.h"
#include "smartctl.h"
#include "utility.h"
#define GBUF_SIZE 65535
const char* CVSid4="$Id: scsiprint.c,v 1.18 2003/01/12 10:30:53 ballen4705 Exp $"
CVSID3 CVSID4 CVSID5 CVSID6;
const char* scsiprint_c_cvsid="$Id: scsiprint.c,v 1.19 2003/01/16 15:28:57 ballen4705 Exp $"
EXTERN_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
// control block which points to external global control variables
extern atamainctrl *con;
......@@ -325,7 +325,7 @@ void scsiGetDriveInfo ( int device)
char manufacturer[9];
char product[17];
char revision[5];
time_t tval;
char timedatetz[64];
UINT8 smartsupport;
......@@ -347,9 +347,9 @@ void scsiGetDriveInfo ( int device)
revision[4] = '\0';
printf("Device: %s %s Version: %s\n", manufacturer, product, revision);
// print current time and date
tval=time(NULL);
printf("Local Time is: %s", ctime(&tval));
// print current time and date and timezone
dateandtimezone(timedatetz);
printf("Local Time is: %s\n", timedatetz);
if ( scsiSmartSupport( device, (UINT8 *) &smartsupport) != 0)
{
......
......@@ -28,17 +28,17 @@
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include "smartctl.h"
#include "extern.h"
#include "scsicmds.h"
#include "scsiprint.h"
#include "extern.h"
#include "smartctl.h"
#include "utility.h"
#define GBUF_SIZE 65535
const char* CVSid4="$Id: scsiprint.cpp,v 1.18 2003/01/12 10:30:53 ballen4705 Exp $"
CVSID3 CVSID4 CVSID5 CVSID6;
const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.19 2003/01/16 15:28:57 ballen4705 Exp $"
EXTERN_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
// control block which points to external global control variables
extern atamainctrl *con;
......@@ -325,7 +325,7 @@ void scsiGetDriveInfo ( int device)
char manufacturer[9];
char product[17];
char revision[5];
time_t tval;
char timedatetz[64];
UINT8 smartsupport;
......@@ -347,9 +347,9 @@ void scsiGetDriveInfo ( int device)
revision[4] = '\0';
printf("Device: %s %s Version: %s\n", manufacturer, product, revision);
// print current time and date
tval=time(NULL);
printf("Local Time is: %s", ctime(&tval));
// print current time and date and timezone
dateandtimezone(timedatetz);
printf("Local Time is: %s\n", timedatetz);
if ( scsiSmartSupport( device, (UINT8 *) &smartsupport) != 0)
{
......
......@@ -27,8 +27,8 @@
#ifndef SCSI_PRINT_H_
#define SCSI_PRINT_H_
#ifndef CVSID5
#define CVSID5 "$Id: scsiprint.h,v 1.8 2002/11/17 05:57:32 ballen4705 Exp $\n"
#ifndef SCSIPRINT_H_CVSID
#define SCSIPRINT_H_CVSID "$Id: scsiprint.h,v 1.9 2003/01/16 15:28:57 ballen4705 Exp $\n"
#endif
void scsiPrintMain(char *device, int fd);
......
......@@ -34,21 +34,22 @@
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include "smartctl.h"
#include "atacmds.h"
#include "ataprint.h"
#include "extern.h"
#include "scsicmds.h"
#include "scsiprint.h"
#include "extern.h"
#include "smartctl.h"
extern const char *CVSid1, *CVSid2, *CVSid3, *CVSid4;
const char* CVSid5="$Id: smartctl.c,v 1.47 2003/01/07 19:47:24 pjwilliams Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID5 CVSID6;
extern const char *atacmds_c_cvsid, *ataprint_c_cvsid, *scsicmds_c_cvsid, *scsiprint_c_cvsid, *utility_c_cvsid;
const char* smartctl_c_cvsid="$Id: smartctl.c,v 1.48 2003/01/16 15:28:57 ballen4705 Exp $"
ATACMDS_H_CVSID ATAPRINT_H_CVSID EXTERN_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID;
// This is a block containing all the "control variables". We declare
// this globally in this file, and externally in other files.
atamainctrl *con=NULL;
void printslogan(){
pout("smartctl version %d.%d-%d Copyright (C) 2002 Bruce Allen\n",
(int)RELEASE_MAJOR, (int)RELEASE_MINOR, (int)SMARTMONTOOLS_VERSION);
......@@ -64,15 +65,17 @@ void printcopy(){
pout("under the terms of the GNU General Public License Version 2.\n");
pout("See http://www.gnu.org for further details.\n\n");
pout("CVS version IDs of files used to build this code are:\n");
printone(out,CVSid1);
printone(out,atacmds_c_cvsid);
pout("%s",out);
printone(out,ataprint_c_cvsid);
pout("%s",out);
printone(out,CVSid2);
printone(out,scsicmds_c_cvsid);
pout("%s",out);
printone(out,CVSid3);
printone(out,scsiprint_c_cvsid);
pout("%s",out);
printone(out,CVSid4);
printone(out,smartctl_c_cvsid);
pout("%s",out);
printone(out,CVSid5);
printone(out,utility_c_cvsid);
pout("%s",out);
return;
}
......
......@@ -34,21 +34,22 @@
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include "smartctl.h"
#include "atacmds.h"
#include "ataprint.h"
#include "extern.h"
#include "scsicmds.h"
#include "scsiprint.h"
#include "extern.h"
#include "smartctl.h"
extern const char *CVSid1, *CVSid2, *CVSid3, *CVSid4;
const char* CVSid5="$Id: smartctl.cpp,v 1.47 2003/01/07 19:47:24 pjwilliams Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID5 CVSID6;
extern const char *atacmds_c_cvsid, *ataprint_c_cvsid, *scsicmds_c_cvsid, *scsiprint_c_cvsid, *utility_c_cvsid;
const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.48 2003/01/16 15:28:57 ballen4705 Exp $"
ATACMDS_H_CVSID ATAPRINT_H_CVSID EXTERN_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID;
// This is a block containing all the "control variables". We declare
// this globally in this file, and externally in other files.
atamainctrl *con=NULL;
void printslogan(){
pout("smartctl version %d.%d-%d Copyright (C) 2002 Bruce Allen\n",
(int)RELEASE_MAJOR, (int)RELEASE_MINOR, (int)SMARTMONTOOLS_VERSION);
......@@ -64,15 +65,17 @@ void printcopy(){
pout("under the terms of the GNU General Public License Version 2.\n");
pout("See http://www.gnu.org for further details.\n\n");
pout("CVS version IDs of files used to build this code are:\n");
printone(out,CVSid1);
printone(out,atacmds_c_cvsid);
pout("%s",out);
printone(out,ataprint_c_cvsid);
pout("%s",out);
printone(out,CVSid2);
printone(out,scsicmds_c_cvsid);
pout("%s",out);
printone(out,CVSid3);
printone(out,scsiprint_c_cvsid);
pout("%s",out);
printone(out,CVSid4);
printone(out,smartctl_c_cvsid);
pout("%s",out);
printone(out,CVSid5);
printone(out,utility_c_cvsid);
pout("%s",out);
return;
}
......
......@@ -25,8 +25,8 @@
#ifndef __SMARTCTL_H_
#define __SMARTCTL_H_
#ifndef CVSID6
#define CVSID6 "$Id: smartctl.h,v 1.15 2002/12/19 00:05:19 pjwilliams Exp $\n"
#ifndef SMARTCTL_H_CVSID
#define SMARTCTL_H_CVSID "$Id: smartctl.h,v 1.16 2003/01/16 15:28:57 ballen4705 Exp $\n"
#endif
/* Boolean Values */
......
......@@ -42,16 +42,15 @@
#include <getopt.h>
#endif
#include "atacmds.h"
#include "scsicmds.h"
#include "smartd.h"
#include "ataprint.h"
#include "extern.h"
#include "scsicmds.h"
#include "smartd.h"
// CVS ID strings
extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.c,v 1.96 2003/01/12 10:23:29 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
extern const char *atacmds_c_cvsid, *ataprint_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid;
const char *smartd_c_cvsid="$Id: smartd.c,v 1.97 2003/01/16 15:28:57 ballen4705 Exp $"
ATACMDS_H_CVSID ATAPRINT_H_CVSID EXTERN_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID;
// global variable used for control of printing, passing arguments, etc.
atamainctrl *con=NULL;
......@@ -1413,12 +1412,17 @@ void PrintCopyleft(void){
printhead();
printout(LOG_INFO,copyleftstring);
printout(LOG_INFO,"CVS version IDs of files used to build this code are:\n");
printone(out,CVSid1);
printone(out,atacmds_c_cvsid);
printout(LOG_INFO,"%s",out);
printone(out,ataprint_c_cvsid);
printout(LOG_INFO,"%s",out);
printone(out,CVSid2);
printone(out,scsicmds_c_cvsid);
printout(LOG_INFO,"%s",out);
printone(out,CVSid6);
printone(out,smartd_c_cvsid);
printout(LOG_INFO,"%s",out);
printone(out,utility_c_cvsid);
printout(LOG_INFO,"%s",out);
}
// Parses input line, prints usage message and
......
......@@ -42,16 +42,15 @@
#include <getopt.h>
#endif
#include "atacmds.h"
#include "scsicmds.h"
#include "smartd.h"
#include "ataprint.h"
#include "extern.h"
#include "scsicmds.h"
#include "smartd.h"
// CVS ID strings
extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.cpp,v 1.96 2003/01/12 10:23:29 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
extern const char *atacmds_c_cvsid, *ataprint_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid;
const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.97 2003/01/16 15:28:57 ballen4705 Exp $"
ATACMDS_H_CVSID ATAPRINT_H_CVSID EXTERN_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID;
// global variable used for control of printing, passing arguments, etc.
atamainctrl *con=NULL;
......@@ -1413,12 +1412,17 @@ void PrintCopyleft(void){
printhead();
printout(LOG_INFO,copyleftstring);
printout(LOG_INFO,"CVS version IDs of files used to build this code are:\n");
printone(out,CVSid1);
printone(out,atacmds_c_cvsid);
printout(LOG_INFO,"%s",out);
printone(out,ataprint_c_cvsid);
printout(LOG_INFO,"%s",out);
printone(out,CVSid2);
printone(out,scsicmds_c_cvsid);
printout(LOG_INFO,"%s",out);
printone(out,CVSid6);
printone(out,smartd_c_cvsid);
printout(LOG_INFO,"%s",out);
printone(out,utility_c_cvsid);
printout(LOG_INFO,"%s",out);
}
// Parses input line, prints usage message and
......
......@@ -22,8 +22,8 @@
*
*/
#ifndef CVSID7
#define CVSID7 "$Id: smartd.h,v 1.25 2003/01/03 17:25:13 ballen4705 Exp $\n"
#ifndef SMARTD_H_CVSID
#define SMARTD_H_CVSID "$Id: smartd.h,v 1.26 2003/01/16 15:28:58 ballen4705 Exp $\n"
#endif
// Configuration file
......
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