Author: ken
Date: Wed Mar 18 20:52:34 2015
New Revision: 280230
URL: https://svnweb.freebsd.org/changeset/base/280230

Log:
  Fix a couple of problems in the sa(4) media type reports.
  
  The only drives I have discovered so far that support medium type
  reports are newer HP LTO (LTO-5 and LTO-6) drives.  IBM drives
  only support the density reports.
  
  sys/cam/scsi/scsi_sa.h:
        The number of possible density codes in the medium type
        report is 9, not 8.  This caused problems parsing all of
        the medium type report after this point in the structure.
  
  usr.bin/mt/mt.c:
        Run the density codes returned in the medium type report
        through denstostring(), just like the primary and secondary
        density codes in the density report.  This will print the
        density code in hex, and give a text description if it
        is available.
  
  Thanks to Rudolf Cejka for doing extensive testing with HP LTO drives
  and Bacula and discovering these problems.
  
  Tested by:    Rudolf Cejka <cejkar at fit.vutbr.cz>
  Sponsored by: Spectra Logic
  MFC after:    4 days

Modified:
  head/sys/cam/scsi/scsi_sa.h
  head/usr.bin/mt/mt.c

Modified: head/sys/cam/scsi/scsi_sa.h
==============================================================================
--- head/sys/cam/scsi/scsi_sa.h Wed Mar 18 20:40:42 2015        (r280229)
+++ head/sys/cam/scsi/scsi_sa.h Wed Mar 18 20:52:34 2015        (r280230)
@@ -477,7 +477,7 @@ struct scsi_medium_type_data {
        u_int8_t length[2];
 #define        SMTD_DEFAULT_LENGTH     52
        u_int8_t num_density_codes;
-       u_int8_t primary_density_codes[8];
+       u_int8_t primary_density_codes[9];
        u_int8_t media_width[2];
        u_int8_t medium_length[2];
        u_int8_t reserved2[2];

Modified: head/usr.bin/mt/mt.c
==============================================================================
--- head/usr.bin/mt/mt.c        Wed Mar 18 20:40:42 2015        (r280229)
+++ head/usr.bin/mt/mt.c        Wed Mar 18 20:52:34 2015        (r280230)
@@ -1406,9 +1406,9 @@ mt_print_density_entry(struct mt_status_
                                continue;
                }
                if ((strcmp(entry->entry_name, "primary_density_code") == 0)
-                || (strcmp(entry->entry_name, "secondary_density_code") == 0)){
+                || (strcmp(entry->entry_name, "secondary_density_code") == 0)
+                || (strcmp(entry->entry_name, "density_code") == 0)) {
 
-                       /* XXX KDM this should really be unsigned */
                        printf("%*s%s (%s): %s\n", indent, "", entry->desc ?
                            entry->desc : "", entry->entry_name,
                            denstostring(entry->value_unsigned));
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to