Author: ken
Date: Thu Feb 26 20:46:16 2015
New Revision: 279329
URL: https://svnweb.freebsd.org/changeset/base/279329

Log:
  MFC r278964:
  
  The __FreeBSD_version was changed to 1001510 to be appropriate for
  stable/10.
  
  I will followup with a commit to mpr(4) and mps(4) in head to reflect
  the stable/10 __FreeBSD_version and merge the change back to stable/10.
  
    ------------------------------------------------------------------------
    r278964 | ken | 2015-02-18 11:30:19 -0700 (Wed, 18 Feb 2015) | 46 lines
  
    Make sure that the flags for the XPT_DEV_ADVINFO CCB are initialized
    properly.
  
    If there is garbage in the flags field, it can sometimes include a
    set CDAI_FLAG_STORE flag, which may cause either an error or
    perhaps result in overwriting the field that was intended to be
    read.
  
    sys/cam/cam_ccb.h:
        Add a new flag to the XPT_DEV_ADVINFO CCB, CDAI_FLAG_NONE,
        that callers can use to set the flags field when no store
        is desired.
  
    sys/cam/scsi/scsi_enc_ses.c:
        In ses_setphyspath_callback(), explicitly set the
        XPT_DEV_ADVINFO flags to CDAI_FLAG_NONE when fetching the
        physical path information.  Instead of ORing in the
        CDAI_FLAG_STORE flag when storing the physical path, set
        the flags field to CDAI_FLAG_STORE.
  
    sys/cam/scsi/scsi_sa.c:
        Set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE when
        fetching extended inquiry information.
  
    sys/cam/scsi/scsi_da.c:
        When storing extended READ CAPACITY information, set the
        XPT_DEV_ADVINFO flags field to CDAI_FLAG_STORE instead of
        ORing it into a field that isn't initialized.
  
    sys/dev/mpr/mpr_sas.c,
    sys/dev/mps/mps_sas.c:
        When fetching extended READ CAPACITY information, set the
        XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE instead of
        setting it to 0.
  
    sbin/camcontrol/camcontrol.c:
        When fetching a device ID, set the XPT_DEV_ADVINFO flags
        field to CDAI_FLAG_NONE instead of 0.
  
    sys/sys/param.h:
        Bump __FreeBSD_version to 1100061 for the new XPT_DEV_ADVINFO
        CCB flag, CDAI_FLAG_NONE.
  
    Sponsored by:       Spectra Logic

Modified:
  stable/10/sbin/camcontrol/camcontrol.c
  stable/10/sys/cam/cam_ccb.h
  stable/10/sys/cam/scsi/scsi_da.c
  stable/10/sys/cam/scsi/scsi_enc_ses.c
  stable/10/sys/dev/mpr/mpr_sas.c
  stable/10/sys/dev/mps/mps_sas.c
  stable/10/sys/sys/param.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/camcontrol.c
==============================================================================
--- stable/10/sbin/camcontrol/camcontrol.c      Thu Feb 26 20:02:29 2015        
(r279328)
+++ stable/10/sbin/camcontrol/camcontrol.c      Thu Feb 26 20:46:16 2015        
(r279329)
@@ -7404,7 +7404,7 @@ getdevid(struct cam_devitem *item)
 retry:
        ccb->ccb_h.func_code = XPT_DEV_ADVINFO;
        ccb->ccb_h.flags = CAM_DIR_IN;
-       ccb->cdai.flags = 0;
+       ccb->cdai.flags = CDAI_FLAG_NONE;
        ccb->cdai.buftype = CDAI_TYPE_SCSI_DEVID;
        ccb->cdai.bufsiz = item->device_id_len;
        if (item->device_id_len != 0)

Modified: stable/10/sys/cam/cam_ccb.h
==============================================================================
--- stable/10/sys/cam/cam_ccb.h Thu Feb 26 20:02:29 2015        (r279328)
+++ stable/10/sys/cam/cam_ccb.h Thu Feb 26 20:46:16 2015        (r279329)
@@ -1145,6 +1145,7 @@ struct ccb_eng_exec {     /* This structure 
 struct ccb_dev_advinfo {
        struct ccb_hdr ccb_h;
        uint32_t flags;
+#define        CDAI_FLAG_NONE          0x0     /* No flags set */
 #define        CDAI_FLAG_STORE         0x1     /* If set, action becomes store 
*/
        uint32_t buftype;               /* IN: Type of data being requested */
        /* NB: buftype is interpreted on a per-transport basis */

Modified: stable/10/sys/cam/scsi/scsi_da.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_da.c    Thu Feb 26 20:02:29 2015        
(r279328)
+++ stable/10/sys/cam/scsi/scsi_da.c    Thu Feb 26 20:46:16 2015        
(r279329)
@@ -3784,7 +3784,7 @@ dasetgeom(struct cam_periph *periph, uin
                xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
                cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
                cdai.buftype = CDAI_TYPE_RCAPLONG;
-               cdai.flags |= CDAI_FLAG_STORE;
+               cdai.flags = CDAI_FLAG_STORE;
                cdai.bufsiz = rcap_len;
                cdai.buf = (uint8_t *)rcaplong;
                xpt_action((union ccb *)&cdai);

Modified: stable/10/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_enc_ses.c       Thu Feb 26 20:02:29 2015        
(r279328)
+++ stable/10/sys/cam/scsi/scsi_enc_ses.c       Thu Feb 26 20:46:16 2015        
(r279329)
@@ -1007,7 +1007,7 @@ ses_setphyspath_callback(enc_softc_t *en
        xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL);
        cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
        cdai.buftype = CDAI_TYPE_PHYS_PATH;
-       cdai.flags = 0;
+       cdai.flags = CDAI_FLAG_NONE;
        cdai.bufsiz = MAXPATHLEN;
        cdai.buf = old_physpath;
        xpt_action((union ccb *)&cdai);
@@ -1019,7 +1019,7 @@ ses_setphyspath_callback(enc_softc_t *en
                xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL);
                cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
                cdai.buftype = CDAI_TYPE_PHYS_PATH;
-               cdai.flags |= CDAI_FLAG_STORE;
+               cdai.flags = CDAI_FLAG_STORE;
                cdai.bufsiz = sbuf_len(args->physpath);
                cdai.buf = sbuf_data(args->physpath);
                xpt_action((union ccb *)&cdai);

Modified: stable/10/sys/dev/mpr/mpr_sas.c
==============================================================================
--- stable/10/sys/dev/mpr/mpr_sas.c     Thu Feb 26 20:02:29 2015        
(r279328)
+++ stable/10/sys/dev/mpr/mpr_sas.c     Thu Feb 26 20:46:16 2015        
(r279329)
@@ -3084,7 +3084,11 @@ mprsas_async(void *callback_arg, uint32_
                cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
                cdai.ccb_h.flags = CAM_DIR_IN;
                cdai.buftype = CDAI_TYPE_RCAPLONG;
+#if __FreeBSD_version >= 1100061
+               cdai.flags = CDAI_FLAG_NONE;
+#else
                cdai.flags = 0;
+#endif
                cdai.bufsiz = sizeof(rcap_buf);
                cdai.buf = (uint8_t *)&rcap_buf;
                xpt_action((union ccb *)&cdai);

Modified: stable/10/sys/dev/mps/mps_sas.c
==============================================================================
--- stable/10/sys/dev/mps/mps_sas.c     Thu Feb 26 20:02:29 2015        
(r279328)
+++ stable/10/sys/dev/mps/mps_sas.c     Thu Feb 26 20:46:16 2015        
(r279329)
@@ -3237,7 +3237,11 @@ mpssas_async(void *callback_arg, uint32_
                cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
                cdai.ccb_h.flags = CAM_DIR_IN;
                cdai.buftype = CDAI_TYPE_RCAPLONG;
+#if __FreeBSD_version >= 1100061
+               cdai.flags = CDAI_FLAG_NONE;
+#else
                cdai.flags = 0;
+#endif
                cdai.bufsiz = sizeof(rcap_buf);
                cdai.buf = (uint8_t *)&rcap_buf;
                xpt_action((union ccb *)&cdai);

Modified: stable/10/sys/sys/param.h
==============================================================================
--- stable/10/sys/sys/param.h   Thu Feb 26 20:02:29 2015        (r279328)
+++ stable/10/sys/sys/param.h   Thu Feb 26 20:46:16 2015        (r279329)
@@ -58,7 +58,7 @@
  *             in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1001509      /* Master, propagated to newvers */
+#define __FreeBSD_version 1001510      /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
_______________________________________________
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