Author: joerg
Date: Wed Nov 12 09:35:57 2008
New Revision: 184867
URL: http://svn.freebsd.org/changeset/base/184867

Log:
  (MFC r184484)
  When running a "chio return" operation using a physical source unit
  rather than a voltag name, do not set the CESR_VOLTAGS flags in the
  CHIOGSTATUS command requesting the current status.  As voltags are an
  optional feature that must be handled as "reserved" by media changers
  not implementing the feature, always setting CESR_VOLTAGS resulted in
  the command being aborted with an `Invalid field in CDB', and
  consequently the "chio return" failed, for media changers that do not
  support voltags.
  
  Approved by:  re (kib)

Modified:
  stable/7/bin/chio/   (props changed)
  stable/7/bin/chio/chio.c

Modified: stable/7/bin/chio/chio.c
==============================================================================
--- stable/7/bin/chio/chio.c    Wed Nov 12 09:04:44 2008        (r184866)
+++ stable/7/bin/chio/chio.c    Wed Nov 12 09:35:57 2008        (r184867)
@@ -69,7 +69,7 @@ static        const char *bits_to_string(ces_st
 
 static void find_element(char *, uint16_t *, uint16_t *);
 static struct changer_element_status *get_element_status
-          (unsigned int, unsigned int);
+          (unsigned int, unsigned int, int);
 
 static int do_move(const char *, int, char **);
 static int do_exchange(const char *, int, char **);
@@ -969,7 +969,8 @@ do_return(const char *cname, int argc, c
        ++argv; --argc;
 
        /* Get the status */
-       ces = get_element_status((unsigned int)type, (unsigned int)element);
+       ces = get_element_status((unsigned int)type, (unsigned int)element,
+           CHET_VT == type);
 
        if (NULL == ces)
                errx(1, "%s: null element status pointer", cname);
@@ -1004,7 +1005,7 @@ usage:
  * should free() it when done.
  */
 static struct changer_element_status *
-get_element_status(unsigned int type, unsigned int element)
+get_element_status(unsigned int type, unsigned int element, int use_voltags)
 {
        struct changer_element_status_request cesr;
        struct changer_element_status *ces;
@@ -1020,7 +1021,8 @@ get_element_status(unsigned int type, un
        cesr.cesr_element_type = (uint16_t)type;
        cesr.cesr_element_base = (uint16_t)element;
        cesr.cesr_element_count = 1;            /* Only this one element */
-       cesr.cesr_flags |= CESR_VOLTAGS;        /* Grab voltags as well */
+       if (use_voltags)
+               cesr.cesr_flags |= CESR_VOLTAGS; /* Grab voltags as well */
        cesr.cesr_element_status = ces;
 
        if (ioctl(changer_fd, CHIOGSTATUS, (char *)&cesr) == -1) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to