From 3df761a89f92b2b567b21bc6aa2a8f7d8aa651c6 Mon Sep 17 00:00:00 2001 From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Tue, 18 Nov 2003 16:53:00 +0000 Subject: [PATCH] Added enable/disable block for autosave (GLTSD bit). Half is a stub -- Doug needs to fill it in with corresponding enable GLTSD bit function. git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@1255 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/scsiprint.c | 16 ++++++++++++++-- sm5/scsiprint.cpp | 16 ++++++++++++++-- sm5/smartd.c | 15 ++++++++++++++- sm5/smartd.cpp | 15 ++++++++++++++- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/sm5/scsiprint.c b/sm5/scsiprint.c index e7a88dbb8..4e0d285cb 100644 --- a/sm5/scsiprint.c +++ b/sm5/scsiprint.c @@ -40,7 +40,7 @@ #define GBUF_SIZE 65535 -const char* scsiprint_c_cvsid="$Id: scsiprint.c,v 1.64 2003/11/18 13:47:40 dpgilbert Exp $" +const char* scsiprint_c_cvsid="$Id: scsiprint.c,v 1.65 2003/11/18 16:53:00 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 @@ -832,7 +832,19 @@ int scsiPrintMain(int fd) if (scsiSmartDisable(fd)) failuretest(MANDATORY_CMD,returnval |= FAILSMART); } - + + if (con->smartautosaveenable) { + if (scsiClearControlGLTSD(fd, modese_len)) { + pout("Enable autosave (clear GLTSD bit) failed\n"); + failuretest(OPTIONAL_CMD,returnval |= FAILSMART); + } + } + + if (con->smartautosavedisable) { + // Doug, this is where we should have a corresponding disable + // GLTSD -- mimic structure just above, please + } + if (con->checksmart) { scsiGetSupportedLogPages(fd); checkedSupportedLogPages = 1; diff --git a/sm5/scsiprint.cpp b/sm5/scsiprint.cpp index 5e48bb641..5afcd5605 100644 --- a/sm5/scsiprint.cpp +++ b/sm5/scsiprint.cpp @@ -40,7 +40,7 @@ #define GBUF_SIZE 65535 -const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.64 2003/11/18 13:47:40 dpgilbert Exp $" +const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.65 2003/11/18 16:53:00 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 @@ -832,7 +832,19 @@ int scsiPrintMain(int fd) if (scsiSmartDisable(fd)) failuretest(MANDATORY_CMD,returnval |= FAILSMART); } - + + if (con->smartautosaveenable) { + if (scsiClearControlGLTSD(fd, modese_len)) { + pout("Enable autosave (clear GLTSD bit) failed\n"); + failuretest(OPTIONAL_CMD,returnval |= FAILSMART); + } + } + + if (con->smartautosavedisable) { + // Doug, this is where we should have a corresponding disable + // GLTSD -- mimic structure just above, please + } + if (con->checksmart) { scsiGetSupportedLogPages(fd); checkedSupportedLogPages = 1; diff --git a/sm5/smartd.c b/sm5/smartd.c index b9bd4e076..ab5f6c59c 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.242 2003/11/18 13:49:43 dpgilbert Exp $" +const char *smartd_c_cvsid="$Id: smartd.c,v 1.243 2003/11/18 16:53:00 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; @@ -1105,6 +1105,19 @@ static int SCSIDeviceScan(cfgfile *cfg) { } } + // disable autosave (set GLTSD bit) + if (cfg->autosave==1){ + // Doug, fill in by following the pattern immediately below + } + + // or enable autosave (clear GLTSD bit) + if (cfg->autosave==2){ + if (scsiClearControlGLTSD(fd, cfg->modese_len)) + PrintOut(LOG_INFO,"Device: %s, could not enable autosave (clear GLTSD bit).\n",device); + else + PrintOut(LOG_INFO,"Device: %s, enabled autosave (clear GLTSD bit).\n",device); + } + // tell user we are registering device PrintOut(LOG_INFO, "Device: %s, is SMART capable. Adding to \"monitor\" list.\n", device); diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index bb19ea9d0..3da077254 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.242 2003/11/18 13:49:43 dpgilbert Exp $" +const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.243 2003/11/18 16:53:00 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; @@ -1105,6 +1105,19 @@ static int SCSIDeviceScan(cfgfile *cfg) { } } + // disable autosave (set GLTSD bit) + if (cfg->autosave==1){ + // Doug, fill in by following the pattern immediately below + } + + // or enable autosave (clear GLTSD bit) + if (cfg->autosave==2){ + if (scsiClearControlGLTSD(fd, cfg->modese_len)) + PrintOut(LOG_INFO,"Device: %s, could not enable autosave (clear GLTSD bit).\n",device); + else + PrintOut(LOG_INFO,"Device: %s, enabled autosave (clear GLTSD bit).\n",device); + } + // tell user we are registering device PrintOut(LOG_INFO, "Device: %s, is SMART capable. Adding to \"monitor\" list.\n", device); -- GitLab