svn commit: r208896 - head/sys/cam/scsi

Matt Jacob mjacob at FreeBSD.org
Mon Jun 7 17:41:35 UTC 2010


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);
 }
 


More information about the svn-src-all mailing list