diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 33113300edd9ab0291d4a752a2167e12587a0c3e..c9c759af480e64aa563ce241deb2ef4bf912b5bc 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.8 2002/10/17 04:10:44 ballen4705 Exp $
+$Id: CHANGELOG,v 1.9 2002/10/20 19:40:23 ballen4705 Exp $
 
 Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
@@ -21,6 +21,71 @@ Research Center), Jack Baskin School of Engineering, University of
 California, Santa Cruz. http://ssrc.soe.ucsc.edu/
 
 
+NOTES FOR NEXT RELEASE:
+
+    Next release: handle extended error and self-test logs gracefully.
+    Parse and print attribute flag meanings
+
+
+smartmontools-5.0-11
+
+
+    smartctl now handles all possible choices of "multiple options"
+    gracefully.  It goes through the following phases of operation,
+    in order: INFORMATION, ENABLE/DISABLE, DISPLAY DATA, RUN/ABORT TESTS.
+    Documentation has bee updated to explain the different phases of
+    operation.  Control flow through ataPrintMain()
+    simplified.
+
+    Modified Makefile to automatically tag CVS archive on issuance of
+    a release
+
+    Modified drive detection so minor device ID code showing ATA-3 rev
+    0 (no SMART) is known to not be SMART capable.
+
+    Now verify the checksum of the device ID data structure, and of the
+    attributes threshold structure.  Before neither of these
+    structures had their checksums verified.
+
+    New behavior vis-a-vis checksums.  If they are wrong, we log
+    warning messages to stdout, stderr, and syslog, but carry on
+    anyway.  All functions now call a checksumwarning routine if the
+    checksum doesn't vanish as it should.
+
+    Changed Read Hard Disk Identity function to get fresh info from
+    the disk on each call rather than to use the values that were read
+    upon boot-up into the BIOS.  This is the biggest change in this
+    release.  The ioctl(device, HDIO_GET_IDENTITY, buf ) call should
+    be avoided in such code.  Note that if people get garbled strings
+    for the model, serial no and firmware versions of their drives,
+    then blame goes here (the BIOS does the byte swapping for you,
+    apparently!)
+    
+    Function ataSmartSupport now looks at correct bits in drive
+    identity structure to verify first that these bits are valid,
+    before using them.
+    
+    Function ataIsSmartEnabled() written which uses the Drive ID state
+    information to tell if SMART is enabled or not.  We'll carry this
+    along for the moment without using it.
+
+    Function ataDoesSmartWork() guaranteed to work if the device
+    supports SMART.
+
+    Replace some numbers by #define MACROS
+
+    Wrote Function TestTime to return test time associated with each
+    different type of test.
+
+    Thinking of the future, have added a new function called
+    ataSmartStatus2().  Eventually when I understand how to use the
+    TASKFILE API and am sure that this works correctly, it will
+    replace ataSmartStatus().  This queries the drive directly to
+    see if the SMART status is OK, rather than comparing thresholds to
+    attribute values ourselves. But I need to get some drives that fail
+    their SMART status to check it.
+
+
 smartmontools-5.0-10
     Removed extraneous space before printing in some error messages
     Fixed additional typos in documentation
diff --git a/sm5/Makefile b/sm5/Makefile
index aa5074381f7eace9f4d58fdd70fd7688b5ecef4e..e7c4fbc89992ecc7d5ba088e537d55adb5d6f8ba 100644
--- a/sm5/Makefile
+++ b/sm5/Makefile
@@ -2,7 +2,7 @@
 #
 # Home page: http://smartmontools.sourceforge.net
 #
-# $Id: Makefile,v 1.18 2002/10/17 04:33:48 ballen4705 Exp $
+# $Id: Makefile,v 1.19 2002/10/20 19:40:23 ballen4705 Exp $
 #
 # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 # 
@@ -92,6 +92,5 @@ release: $(releasefiles)
 	mv /usr/src/redhat/SRPMS/$(pkgname)*rpm .
 	rm -f /usr/src/redhat/SOURCES/$(pkgname).tar.gz
 	. cvs-script && cvs commit -m "release $(counter)"
+	. cvs-script && cvs tag "RELEASE_5_0_$(counter)"
 	echo `hostname` | grep -q ballen && echo $(newcounter) > VERSION
-
-
diff --git a/sm5/TODO b/sm5/TODO
index 364078c399876389cddd9f18c0134a2a2531678c..cbd0c7c4028c68e63de92737d35eccc5cc667b59 100644
--- a/sm5/TODO
+++ b/sm5/TODO
@@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net
 
 Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
-$Id: TODO,v 1.7 2002/10/15 14:24:26 ballen4705 Exp $
+$Id: TODO,v 1.8 2002/10/20 19:40:23 ballen4705 Exp $
 
 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
@@ -49,3 +49,6 @@ int ataSmartStatus (int device ) is broken -- see comments in code.
 SCSI code in smartd leaves file descriptors open if SMART not supported..
 
 Fix lots of syntax like if (a != 0)
+
+Pass pointer to big structures like "device" and smartval, not the
+whole 2kB of data!
diff --git a/sm5/VERSION b/sm5/VERSION
index f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2..b4de3947675361a7770d29b8982c407b0ec6b2a0 100644
--- a/sm5/VERSION
+++ b/sm5/VERSION
@@ -1 +1 @@
-10
+11
diff --git a/sm5/atacmds.c b/sm5/atacmds.c
index 7189e8ecd8c5e59d2ca8e8b2071cd78bb0c9372f..510cece4d7af6f84158c43320691381d3c0b6b12 100644
--- a/sm5/atacmds.c
+++ b/sm5/atacmds.c
@@ -1,4 +1,4 @@
-//  $Id: atacmds.c,v 1.9 2002/10/20 19:22:02 ballen4705 Exp $
+//  $Id: atacmds.c,v 1.10 2002/10/20 19:40:23 ballen4705 Exp $
 /*
  * atacmds.c
  * 
@@ -126,7 +126,7 @@ void checksumwarning(const char *string){
 // wrong. The replacement function follows afterwards
 #if (0)
 int ataReadHDIdentity ( int device, struct hd_driveid *buf){
-  if (ioctl(device, HDIO_GET_IDENTITY, buf )){ 
+  if (ioctl(device, HDIO_GET_IDENTITY, buf)){ 
     perror ("ATA GET HD Failed");
     return -1; 
   }
@@ -148,17 +148,13 @@ int ataReadHDIdentity (int device, struct hd_driveid *buf){
   // copy data into driveid structure
   memcpy(buf,parms+HDIO_DRIVE_CMD_HDR_SIZE,sizeof(*buf));
   
-  // If driveid structure contains a checksum, then compute it, and
-  // issue a warning message if something is wrong.  I prefer this
-  // rather than simply exiting at this point, though that is another
-  // option.
-
   // Note -- the declaration that appears in
   // /usr/include/linux/hdregs.h: short words160_255[95], is WRONG.
   // It should say: short words160_255[96]. I have written to Andre
   // Hedrick about this on Oct 17 2002.  Please remove this comment
   // once the fix has made it into the stock kernel tree.
   if ((buf->words160_255[95] & 0x00ff) == 0x00a5){
+    // Device identity structure contains a checksum
     unsigned char cksum=0;
     int i;
 
@@ -312,7 +308,7 @@ int ataReadErrorLog (int device, struct ata_smart_errorlog *data){
     {WIN_SMART, 0x01, SMART_READ_LOG_SECTOR, 1,};
   
   // get data from device
-  if (ioctl(device,HDIO_DRIVE_CMD,&buf)) {
+  if (ioctl(device,HDIO_DRIVE_CMD,buf)) {
     perror ("SMART Error Log Read failed");
     return -1;
   }
@@ -375,38 +371,33 @@ int ataSetSmartThresholds ( int device, struct ata_smart_thresholds *data){
   return 0;
 }
 
-
 int ataEnableSmart (int device ){	
   unsigned char parms[4] = {WIN_SMART, 1, SMART_ENABLE, 0};
   
-  if (ioctl ( device , HDIO_DRIVE_CMD,  &parms )){
+  if (ioctl (device, HDIO_DRIVE_CMD, parms)){
     perror ("SMART Enable failed");
     return -1;
   }
-  
   return 0;
 }
 
-
 int ataDisableSmart (int device ){	
   unsigned char parms[4] = {WIN_SMART, 1, SMART_DISABLE, 0};
   
-  if (ioctl(device , HDIO_DRIVE_CMD, parms )){
+  if (ioctl(device, HDIO_DRIVE_CMD, parms)){
     perror ("SMART Disable failed");
     return -1;
-  }
-  
+  }  
   return 0;
 }
 
 int ataEnableAutoSave(int device){
   unsigned char parms[4] = {WIN_SMART, 241, SMART_AUTOSAVE, 0};
   
-  if (ioctl(device , HDIO_DRIVE_CMD,  parms )){
+  if (ioctl(device, HDIO_DRIVE_CMD, parms)){
     perror ("SMART Enable Auto-save failed");
     return -1;
   }
-  
   return 0;
 }
 
@@ -417,7 +408,6 @@ int ataDisableAutoSave(int device){
     perror ("SMART Disable Auto-save failed");
     return -1;
   }
-  
   return 0;
 }
 
@@ -431,7 +421,6 @@ int ataEnableAutoOffline (int device ){
     perror ("SMART Enable Automatic Offline failed");
     return -1;
   }
-  
   return 0;
 }
 
@@ -443,7 +432,6 @@ int ataDisableAutoOffline (int device ){
     perror ("SMART Disable Automatic Offline failed");
     return -1;
   }
-  
   return 0;
 }
 
@@ -491,7 +479,7 @@ int ataSmartStatus2(int device){
   parms[4]=normal_cyl_lo;
   parms[5]=normal_cyl_hi;
 
-  if (ioctl(device,HDIO_DRIVE_TASK,&parms)){
+  if (ioctl(device,HDIO_DRIVE_TASK,parms)){
     perror ("SMART Status command failed.");
     return -1;
   }
diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp
index 45e9a820dda258e1df780553c72f07c77c34724b..088f2c0332395de90095a67ea95d37d26b31195a 100644
--- a/sm5/atacmds.cpp
+++ b/sm5/atacmds.cpp
@@ -1,4 +1,4 @@
-//  $Id: atacmds.cpp,v 1.9 2002/10/20 19:22:02 ballen4705 Exp $
+//  $Id: atacmds.cpp,v 1.10 2002/10/20 19:40:23 ballen4705 Exp $
 /*
  * atacmds.c
  * 
@@ -126,7 +126,7 @@ void checksumwarning(const char *string){
 // wrong. The replacement function follows afterwards
 #if (0)
 int ataReadHDIdentity ( int device, struct hd_driveid *buf){
-  if (ioctl(device, HDIO_GET_IDENTITY, buf )){ 
+  if (ioctl(device, HDIO_GET_IDENTITY, buf)){ 
     perror ("ATA GET HD Failed");
     return -1; 
   }
@@ -148,17 +148,13 @@ int ataReadHDIdentity (int device, struct hd_driveid *buf){
   // copy data into driveid structure
   memcpy(buf,parms+HDIO_DRIVE_CMD_HDR_SIZE,sizeof(*buf));
   
-  // If driveid structure contains a checksum, then compute it, and
-  // issue a warning message if something is wrong.  I prefer this
-  // rather than simply exiting at this point, though that is another
-  // option.
-
   // Note -- the declaration that appears in
   // /usr/include/linux/hdregs.h: short words160_255[95], is WRONG.
   // It should say: short words160_255[96]. I have written to Andre
   // Hedrick about this on Oct 17 2002.  Please remove this comment
   // once the fix has made it into the stock kernel tree.
   if ((buf->words160_255[95] & 0x00ff) == 0x00a5){
+    // Device identity structure contains a checksum
     unsigned char cksum=0;
     int i;
 
@@ -312,7 +308,7 @@ int ataReadErrorLog (int device, struct ata_smart_errorlog *data){
     {WIN_SMART, 0x01, SMART_READ_LOG_SECTOR, 1,};
   
   // get data from device
-  if (ioctl(device,HDIO_DRIVE_CMD,&buf)) {
+  if (ioctl(device,HDIO_DRIVE_CMD,buf)) {
     perror ("SMART Error Log Read failed");
     return -1;
   }
@@ -375,38 +371,33 @@ int ataSetSmartThresholds ( int device, struct ata_smart_thresholds *data){
   return 0;
 }
 
-
 int ataEnableSmart (int device ){	
   unsigned char parms[4] = {WIN_SMART, 1, SMART_ENABLE, 0};
   
-  if (ioctl ( device , HDIO_DRIVE_CMD,  &parms )){
+  if (ioctl (device, HDIO_DRIVE_CMD, parms)){
     perror ("SMART Enable failed");
     return -1;
   }
-  
   return 0;
 }
 
-
 int ataDisableSmart (int device ){	
   unsigned char parms[4] = {WIN_SMART, 1, SMART_DISABLE, 0};
   
-  if (ioctl(device , HDIO_DRIVE_CMD, parms )){
+  if (ioctl(device, HDIO_DRIVE_CMD, parms)){
     perror ("SMART Disable failed");
     return -1;
-  }
-  
+  }  
   return 0;
 }
 
 int ataEnableAutoSave(int device){
   unsigned char parms[4] = {WIN_SMART, 241, SMART_AUTOSAVE, 0};
   
-  if (ioctl(device , HDIO_DRIVE_CMD,  parms )){
+  if (ioctl(device, HDIO_DRIVE_CMD, parms)){
     perror ("SMART Enable Auto-save failed");
     return -1;
   }
-  
   return 0;
 }
 
@@ -417,7 +408,6 @@ int ataDisableAutoSave(int device){
     perror ("SMART Disable Auto-save failed");
     return -1;
   }
-  
   return 0;
 }
 
@@ -431,7 +421,6 @@ int ataEnableAutoOffline (int device ){
     perror ("SMART Enable Automatic Offline failed");
     return -1;
   }
-  
   return 0;
 }
 
@@ -443,7 +432,6 @@ int ataDisableAutoOffline (int device ){
     perror ("SMART Disable Automatic Offline failed");
     return -1;
   }
-  
   return 0;
 }
 
@@ -491,7 +479,7 @@ int ataSmartStatus2(int device){
   parms[4]=normal_cyl_lo;
   parms[5]=normal_cyl_hi;
 
-  if (ioctl(device,HDIO_DRIVE_TASK,&parms)){
+  if (ioctl(device,HDIO_DRIVE_TASK,parms)){
     perror ("SMART Status command failed.");
     return -1;
   }