From owner-svn-src-head@FreeBSD.ORG Mon Jun 7 17:41:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48BFE1065670; Mon, 7 Jun 2010 17:41:35 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 370A38FC19; Mon, 7 Jun 2010 17:41:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o57HfYQo047137; Mon, 7 Jun 2010 17:41:34 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o57HfYCF047135; Mon, 7 Jun 2010 17:41:34 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201006071741.o57HfYCF047135@svn.freebsd.org> From: Matt Jacob Date: Mon, 7 Jun 2010 17:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208896 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 07 Jun 2010 17:41:35 -0000 Author: mjacob Date: Mon Jun 7 17:41:34 2010 New Revision: 208896 URL: http://svn.freebsd.org/changeset/base/208896 Log: Do a minor amount of stylifying. Also, get a Fibre Channel WWPN if one exists for a da unit and create a sysctl OID for it. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Jun 7 17:39:36 2010 (r208895) +++ head/sys/cam/scsi/scsi_da.c Mon Jun 7 17:41:34 2010 (r208896) @@ -130,6 +130,7 @@ struct da_softc { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; struct callout sendordered_c; + uint64_t wwpn; }; struct da_quirk_entry { @@ -1099,14 +1100,38 @@ dasysctlinit(void *context, int pending) } /* - * Now register the sysctl handler, so the user can the value on + * Now register the sysctl handler, so the user can change the value on * the fly. */ - SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree), + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, &softc->minimum_cmd_size, 0, dacmdsizesysctl, "I", "Minimum CDB size"); + /* + * Add some addressing info. + */ + memset(&cts, 0, sizeof (cts)); + xpt_setup_ccb(&cts.ccb_h, periph->path, /*priority*/1); + cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; + cts.type = CTS_TYPE_CURRENT_SETTINGS; + cam_periph_lock(periph); + xpt_action((union ccb *)&cts); + cam_periph_unlock(periph); + if (cts.ccb_h.status != CAM_REQ_CMP) { + cam_periph_release(periph); + return; + } + if (cts.protocol == PROTO_SCSI && cts.transport == XPORT_FC) { + struct ccb_trans_settings_fc *fc = &cts.xport_specific.fc; + if (fc->valid & CTS_FC_VALID_WWPN) { + softc->wwpn = fc->wwpn; + SYSCTL_ADD_XLONG(&softc->sysctl_ctx, + SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "wwpn", CTLTYPE_QUAD | CTLFLAG_RD, + &softc->wwpn, "World Wide Port Name"); + } + } cam_periph_release(periph); }