From owner-svn-src-head@FreeBSD.ORG Sat Jun 29 17:49:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 80FD8415; Sat, 29 Jun 2013 17:49:00 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 62E5E1E92; Sat, 29 Jun 2013 17:49:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5THn0GM054551; Sat, 29 Jun 2013 17:49:00 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5THn0iB054549; Sat, 29 Jun 2013 17:49:00 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201306291749.r5THn0iB054549@svn.freebsd.org> From: Scott Long Date: Sat, 29 Jun 2013 17:49:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252382 - in head/sys/cam: . scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2013 17:49:00 -0000 Author: scottl Date: Sat Jun 29 17:48:59 2013 New Revision: 252382 URL: http://svnweb.freebsd.org/changeset/base/252382 Log: 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. Obtained from: Netflix MFC after: 3 days Modified: head/sys/cam/cam_ccb.h head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Sat Jun 29 16:49:00 2013 (r252381) +++ head/sys/cam/cam_ccb.h Sat Jun 29 17:48:59 2013 (r252382) @@ -1296,6 +1296,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 (ccb->ccb_h.status & CAM_STATUS_MASK); +} + void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended); __END_DECLS Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Sat Jun 29 16:49:00 2013 (r252381) +++ head/sys/cam/scsi/scsi_xpt.c Sat Jun 29 17:48:59 2013 (r252382) @@ -974,7 +974,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; @@ -996,7 +996,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"); @@ -1075,7 +1075,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, @@ -1105,7 +1105,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) { @@ -1128,7 +1128,7 @@ out: 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; @@ -1246,7 +1246,7 @@ out: 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, @@ -1357,7 +1357,7 @@ out: 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; @@ -1492,7 +1492,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; @@ -1577,7 +1577,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); } @@ -1628,7 +1628,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); } @@ -1984,7 +1984,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, @@ -2667,7 +2667,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; @@ -2951,7 +2951,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);