From owner-svn-src-stable@FreeBSD.ORG Wed Jun 6 11:40:17 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4ED0D10656EA; Wed, 6 Jun 2012 11:40:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F6858FC20; Wed, 6 Jun 2012 11:40:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56BeGWO011199; Wed, 6 Jun 2012 11:40:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56BeGXV011197; Wed, 6 Jun 2012 11:40:16 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206061140.q56BeGXV011197@svn.freebsd.org> From: Alexander Motin Date: Wed, 6 Jun 2012 11:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236674 - stable/8/sys/cam/scsi X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 11:40:17 -0000 Author: mav Date: Wed Jun 6 11:40:16 2012 New Revision: 236674 URL: http://svn.freebsd.org/changeset/base/236674 Log: MFC r208896, r208900 (by mjacob): 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: stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Wed Jun 6 10:56:59 2012 (r236673) +++ stable/8/sys/cam/scsi/scsi_da.c Wed Jun 6 11:40:16 2012 (r236674) @@ -136,6 +136,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 { @@ -1312,6 +1313,7 @@ dasysctlinit(void *context, int pending) struct cam_periph *periph; struct da_softc *softc; char tmpstr[80], tmpstr2[80]; + struct ccb_trans_settings cts; periph = (struct cam_periph *)context; /* @@ -1338,14 +1340,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); }