Add a "device_index" label to all sysctls under dev.$driver.$index.

This way it becomes possible to graph a property for all instances of a
single driver. For example, graphing the number of packets across all
USB controllers, the amount of dropped packets on all NICs, etc.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8775
This commit is contained in:
Ed Schouten 2016-12-14 13:03:01 +00:00
parent 3fd335bcc7
commit ae15715360

View File

@ -288,10 +288,10 @@ device_sysctl_init(device_t dev)
return;
devclass_sysctl_init(dc);
sysctl_ctx_init(&dev->sysctl_ctx);
dev->sysctl_tree = SYSCTL_ADD_NODE(&dev->sysctl_ctx,
dev->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&dev->sysctl_ctx,
SYSCTL_CHILDREN(dc->sysctl_tree), OID_AUTO,
dev->nameunit + strlen(dc->name),
CTLFLAG_RD, NULL, "");
CTLFLAG_RD, NULL, "", "device_index");
SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree),
OID_AUTO, "%desc", CTLTYPE_STRING | CTLFLAG_RD,
dev, DEVICE_SYSCTL_DESC, device_sysctl_handler, "A",