]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
Add a "device_index" label to all sysctls under dev.$driver.$index.
authored <ed@FreeBSD.org>
Wed, 14 Dec 2016 13:03:01 +0000 (13:03 +0000)
committered <ed@FreeBSD.org>
Wed, 14 Dec 2016 13:03:01 +0000 (13:03 +0000)
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

sys/kern/subr_bus.c

index 91dc30b9109d2ba330430dbd18184c7bc5fd325a..cf3cd47fe9cecd9378d49067ab5d432e80efea37 100644 (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",