Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Dec 2016 12:53:33 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310052 - in head/sys/cam: ata nvme scsi
Message-ID:  <201612141253.uBECrXZ1012688@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Wed Dec 14 12:53:33 2016
New Revision: 310052
URL: https://svnweb.freebsd.org/changeset/base/310052

Log:
  Add label annotations to CAM sysctls.
  
  Under kern.cam we have certain sysctls that are per-device, such as the
  ones under kern.cam.ada.[0-9]+.*. Add a "device_index" label annotation
  to such sysctls, so that the Prometheus metrics exporter will give all
  of those metrics the same name. The device number will be added to the
  metric name as the "device_index" label.
  
  Reviewed by:	cem
  Differential Revision:	https://reviews.freebsd.org/D8775

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/ata/ata_pmp.c
  head/sys/cam/nvme/nvme_da.c
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_sa.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Wed Dec 14 12:47:34 2016	(r310051)
+++ head/sys/cam/ata/ata_da.c	Wed Dec 14 12:53:33 2016	(r310052)
@@ -1394,9 +1394,9 @@ adasysctlinit(void *context, int pending
 
 	sysctl_ctx_init(&softc->sysctl_ctx);
 	softc->flags |= ADA_FLAG_SCTX_INIT;
-	softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
+	softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
 		SYSCTL_STATIC_CHILDREN(_kern_cam_ada), OID_AUTO, tmpstr2,
-		CTLFLAG_RD, 0, tmpstr);
+		CTLFLAG_RD, 0, tmpstr, "device_index");
 	if (softc->sysctl_tree == NULL) {
 		printf("adasysctlinit: unable to allocate sysctl tree\n");
 		cam_periph_release(periph);

Modified: head/sys/cam/ata/ata_pmp.c
==============================================================================
--- head/sys/cam/ata/ata_pmp.c	Wed Dec 14 12:47:34 2016	(r310051)
+++ head/sys/cam/ata/ata_pmp.c	Wed Dec 14 12:53:33 2016	(r310052)
@@ -350,9 +350,9 @@ pmpsysctlinit(void *context, int pending
 
 	sysctl_ctx_init(&softc->sysctl_ctx);
 	softc->flags |= PMP_FLAG_SCTX_INIT;
-	softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
+	softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
 		SYSCTL_STATIC_CHILDREN(_kern_cam_pmp), OID_AUTO, tmpstr2,
-		CTLFLAG_RD, 0, tmpstr);
+		CTLFLAG_RD, 0, tmpstr, "device_index");
 	if (softc->sysctl_tree == NULL) {
 		printf("pmpsysctlinit: unable to allocate sysctl tree\n");
 		cam_periph_release(periph);

Modified: head/sys/cam/nvme/nvme_da.c
==============================================================================
--- head/sys/cam/nvme/nvme_da.c	Wed Dec 14 12:47:34 2016	(r310051)
+++ head/sys/cam/nvme/nvme_da.c	Wed Dec 14 12:53:33 2016	(r310052)
@@ -608,9 +608,9 @@ ndasysctlinit(void *context, int pending
 
 	sysctl_ctx_init(&softc->sysctl_ctx);
 	softc->flags |= NDA_FLAG_SCTX_INIT;
-	softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
+	softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
 		SYSCTL_STATIC_CHILDREN(_kern_cam_nda), OID_AUTO, tmpstr2,
-		CTLFLAG_RD, 0, tmpstr);
+		CTLFLAG_RD, 0, tmpstr, "device_index");
 	if (softc->sysctl_tree == NULL) {
 		printf("ndasysctlinit: unable to allocate sysctl tree\n");
 		cam_periph_release(periph);

Modified: head/sys/cam/scsi/scsi_cd.c
==============================================================================
--- head/sys/cam/scsi/scsi_cd.c	Wed Dec 14 12:47:34 2016	(r310051)
+++ head/sys/cam/scsi/scsi_cd.c	Wed Dec 14 12:53:33 2016	(r310052)
@@ -481,9 +481,9 @@ cdsysctlinit(void *context, int pending)
 
 	sysctl_ctx_init(&softc->sysctl_ctx);
 	softc->flags |= CD_FLAG_SCTX_INIT;
-	softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
+	softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
 		SYSCTL_STATIC_CHILDREN(_kern_cam_cd), OID_AUTO,
-		tmpstr2, CTLFLAG_RD, 0, tmpstr);
+		tmpstr2, CTLFLAG_RD, 0, tmpstr, "device_index");
 
 	if (softc->sysctl_tree == NULL) {
 		printf("cdsysctlinit: unable to allocate sysctl tree\n");

Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c	Wed Dec 14 12:47:34 2016	(r310051)
+++ head/sys/cam/scsi/scsi_da.c	Wed Dec 14 12:53:33 2016	(r310052)
@@ -1924,9 +1924,9 @@ dasysctlinit(void *context, int pending)
 
 	sysctl_ctx_init(&softc->sysctl_ctx);
 	softc->flags |= DA_FLAG_SCTX_INIT;
-	softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
+	softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
 		SYSCTL_STATIC_CHILDREN(_kern_cam_da), OID_AUTO, tmpstr2,
-		CTLFLAG_RD, 0, tmpstr);
+		CTLFLAG_RD, 0, tmpstr, "device_index");
 	if (softc->sysctl_tree == NULL) {
 		printf("dasysctlinit: unable to allocate sysctl tree\n");
 		cam_periph_release(periph);

Modified: head/sys/cam/scsi/scsi_sa.c
==============================================================================
--- head/sys/cam/scsi/scsi_sa.c	Wed Dec 14 12:47:34 2016	(r310051)
+++ head/sys/cam/scsi/scsi_sa.c	Wed Dec 14 12:53:33 2016	(r310052)
@@ -2308,9 +2308,9 @@ sasysctlinit(void *context, int pending)
 
 	sysctl_ctx_init(&softc->sysctl_ctx);
 	softc->flags |= SA_FLAG_SCTX_INIT;
-	softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
+	softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
 	    SYSCTL_STATIC_CHILDREN(_kern_cam_sa), OID_AUTO, tmpstr2,
-                    CTLFLAG_RD, 0, tmpstr);
+	    CTLFLAG_RD, 0, tmpstr, "device_index");
 	if (softc->sysctl_tree == NULL)
 		goto bailout;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612141253.uBECrXZ1012688>