svn commit: r236674 - stable/8/sys/cam/scsi
Alexander Motin
mav at FreeBSD.org
Wed Jun 6 11:40:17 UTC 2012
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);
}
More information about the svn-src-all
mailing list