Author: mav
Date: Sat Sep 14 08:55:48 2013
New Revision: 255542
URL: http://svnweb.freebsd.org/changeset/base/255542

Log:
  MFC r252382 (by scottl), r252684 (by jkim):
  Introduce accessors for the ccb status word.  Convert one (of many more)
  modules to use it, will convert the others once the appropriate shed
  color is selected by consensus.

Modified:
  stable/9/sys/cam/cam_ccb.h
  stable/9/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/cam_ccb.h
==============================================================================
--- stable/9/sys/cam/cam_ccb.h  Sat Sep 14 08:45:15 2013        (r255541)
+++ stable/9/sys/cam/cam_ccb.h  Sat Sep 14 08:55:48 2013        (r255542)
@@ -1305,6 +1305,19 @@ cam_fill_smpio(struct ccb_smpio *smpio, 
        smpio->smp_response_len = smp_response_len;
 }
 
+static __inline void
+cam_set_ccbstatus(union ccb *ccb, cam_status status)
+{
+       ccb->ccb_h.status &= ~CAM_STATUS_MASK;
+       ccb->ccb_h.status |= status;
+}
+
+static __inline cam_status
+cam_ccb_status(union ccb *ccb)
+{
+       return ((cam_status)(ccb->ccb_h.status & CAM_STATUS_MASK));
+}
+
 void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended);
 
 __END_DECLS

Modified: stable/9/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- stable/9/sys/cam/scsi/scsi_xpt.c    Sat Sep 14 08:45:15 2013        
(r255541)
+++ stable/9/sys/cam/scsi/scsi_xpt.c    Sat Sep 14 08:55:48 2013        
(r255542)
@@ -975,7 +975,7 @@ proberequestdefaultnegotiation(struct ca
        cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
        cts.type = CTS_TYPE_USER_SETTINGS;
        xpt_action((union ccb *)&cts);
-       if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+       if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) {
                return;
        }
        cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
@@ -997,7 +997,7 @@ proberequestbackoff(struct cam_periph *p
        cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
        cts.type = CTS_TYPE_CURRENT_SETTINGS;
        xpt_action((union ccb *)&cts);
-       if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+       if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) {
                if (bootverbose) {
                        xpt_print(periph->path,
                            "failed to get current device settings\n");
@@ -1076,7 +1076,7 @@ proberequestbackoff(struct cam_periph *p
                cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
                cts.type = CTS_TYPE_CURRENT_SETTINGS;
                xpt_action((union ccb *)&cts);
-               if ((cts.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
+               if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) {
                        break;
                }
                CAM_DEBUG(periph->path, CAM_DEBUG_PROBE,
@@ -1106,7 +1106,7 @@ probedone(struct cam_periph *periph, uni
        switch (softc->action) {
        case PROBE_TUR:
        {
-               if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+               if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
 
                        if (cam_periph_error(done_ccb, 0,
                                             SF_NO_PRINT, NULL) == ERESTART)
@@ -1125,7 +1125,7 @@ probedone(struct cam_periph *periph, uni
        case PROBE_INQUIRY:
        case PROBE_FULL_INQUIRY:
        {
-               if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
+               if (cam_ccb_status(done_ccb) == CAM_REQ_CMP) {
                        struct scsi_inquiry_data *inq_buf;
                        u_int8_t periph_qual;
 
@@ -1243,7 +1243,7 @@ probedone(struct cam_periph *periph, uni
                nlun = scsi_4btoul(lp->length) / 8;
                maxlun = (csio->dxfer_len / 8) - 1;
 
-               if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+               if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
                        if (cam_periph_error(done_ccb, 0,
                            done_ccb->ccb_h.target_lun > 0 ?
                            SF_RETRY_UA|SF_QUIET_IR : SF_RETRY_UA,
@@ -1354,7 +1354,7 @@ probedone(struct cam_periph *periph, uni
 
                csio = &done_ccb->csio;
                mode_hdr = (struct scsi_mode_header_6 *)csio->data_ptr;
-               if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
+               if (cam_ccb_status(done_ccb) == CAM_REQ_CMP) {
                        struct scsi_control_page *page;
                        u_int8_t *offset;
 
@@ -1489,7 +1489,7 @@ probe_device_check:
                        /*
                         * Don't process the command as it was never sent
                         */
-               } else if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP
+               } else if (cam_ccb_status(done_ccb) == CAM_REQ_CMP
                        && (serial_buf->length > 0)) {
 
                        have_serialnum = 1;
@@ -1574,7 +1574,7 @@ probe_device_check:
        }
        case PROBE_TUR_FOR_NEGOTIATION:
        case PROBE_DV_EXIT:
-               if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+               if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
                        cam_periph_error(done_ccb, 0,
                            SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY, NULL);
                }
@@ -1625,7 +1625,7 @@ probe_device_check:
                struct scsi_inquiry_data *nbuf;
                struct ccb_scsiio *csio;
 
-               if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+               if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
                        cam_periph_error(done_ccb, 0,
                            SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY, NULL);
                }
@@ -1980,7 +1980,7 @@ scsi_scan_bus(struct cam_periph *periph,
 
                oldpath = request_ccb->ccb_h.path;
 
-               status = request_ccb->ccb_h.status & CAM_STATUS_MASK;
+               status = cam_ccb_status(request_ccb);
                /* Reuse the same CCB to query if a device was really found */
                scan_info = (scsi_scan_bus_info *)request_ccb->ccb_h.ppriv_ptr0;
                xpt_setup_ccb(&request_ccb->ccb_h, request_ccb->ccb_h.path,
@@ -2663,7 +2663,7 @@ scsi_set_transfer_settings(struct ccb_tr
                cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
                cur_cts.type = cts->type;
                xpt_action((union ccb *)&cur_cts);
-               if ((cur_cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+               if (cam_ccb_status((union ccb *)&cur_cts) != CAM_REQ_CMP) {
                        return;
                }
                cur_scsi = &cur_cts.proto_specific.scsi;
@@ -2947,7 +2947,7 @@ scsi_announce_periph(struct cam_periph *
        cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
        cts.type = CTS_TYPE_CURRENT_SETTINGS;
        xpt_action((union ccb*)&cts);
-       if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
+       if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP)
                return;
        /* Ask the SIM for its base transfer speed */
        xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "[email protected]"

Reply via email to