commit c82d42f5c85805344c6976708087682bc266cbf7 Author: Ryota Ozaki Date: Wed Nov 20 10:37:38 2024 +0900 vio9p: export tag via sysctl diff --git a/sys/dev/pci/vio9p.c b/sys/dev/pci/vio9p.c index 27c09b540a71..1a693c271590 100644 --- a/sys/dev/pci/vio9p.c +++ b/sys/dev/pci/vio9p.c @@ -482,6 +482,7 @@ vio9p_attach(device_t parent, device_t self, void *aux) struct vio9p_softc *sc = device_private(self); struct virtio_softc *vsc = device_private(parent); int error; + const struct sysctlnode *node; if (virtio_child(vsc) != NULL) { aprint_normal(": child already attached for %s; " @@ -546,6 +547,15 @@ vio9p_attach(device_t parent, device_t self, void *aux) vio9p_read_config(sc); aprint_normal_dev(self, "tagged as %s\n", sc->sc_tag); + sysctl_createv(NULL, 0, NULL, &node, 0, CTLTYPE_NODE, + "vio9p", SYSCTL_DESCR("VirtIO 9p status"), + NULL, 0, NULL, 0, + CTL_HW, CTL_CREATE, CTL_EOL); + sysctl_createv(NULL, 0, NULL, NULL, 0, CTLTYPE_STRING, + "tag", SYSCTL_DESCR("VirtIO 9p tag value"), + NULL, 0, sc->sc_tag, 0, + CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL); + error = virtio_child_attach_finish(vsc); if (error != 0) goto err_mutex;