mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 00:02:14 -04:00
hyperv/vmbus: Add sysctl to expose vmbus version.
Requested by: Hongxiong Xian <v-hoxian microsoft com> MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6860
This commit is contained in:
parent
f2e1e9bd53
commit
47a3ee5c60
1 changed files with 21 additions and 0 deletions
|
|
@ -100,6 +100,8 @@ static int vmbus_init_contact(struct vmbus_softc *,
|
|||
uint32_t);
|
||||
static int vmbus_req_channels(struct vmbus_softc *sc);
|
||||
|
||||
static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t);
|
||||
static void vmbus_msghc_ctx_destroy(
|
||||
struct vmbus_msghc_ctx *);
|
||||
|
|
@ -947,6 +949,17 @@ hv_vmbus_child_device_unregister(struct hv_device *child_dev)
|
|||
return(ret);
|
||||
}
|
||||
|
||||
static int
|
||||
vmbus_sysctl_version(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
char verstr[16];
|
||||
|
||||
snprintf(verstr, sizeof(verstr), "%u.%u",
|
||||
hv_vmbus_protocal_version >> 16,
|
||||
hv_vmbus_protocal_version & 0xffff);
|
||||
return sysctl_handle_string(oidp, verstr, sizeof(verstr), req);
|
||||
}
|
||||
|
||||
static int
|
||||
vmbus_probe(device_t dev)
|
||||
{
|
||||
|
|
@ -977,6 +990,8 @@ vmbus_probe(device_t dev)
|
|||
static int
|
||||
vmbus_doattach(struct vmbus_softc *sc)
|
||||
{
|
||||
struct sysctl_oid_list *child;
|
||||
struct sysctl_ctx_list *ctx;
|
||||
int ret;
|
||||
|
||||
if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)
|
||||
|
|
@ -1040,6 +1055,12 @@ vmbus_doattach(struct vmbus_softc *sc)
|
|||
bus_generic_attach(sc->vmbus_dev);
|
||||
device_printf(sc->vmbus_dev, "device scan, probe and attach done\n");
|
||||
|
||||
ctx = device_get_sysctl_ctx(sc->vmbus_dev);
|
||||
child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->vmbus_dev));
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "version",
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
|
||||
vmbus_sysctl_version, "A", "vmbus version");
|
||||
|
||||
return (ret);
|
||||
|
||||
cleanup:
|
||||
|
|
|
|||
Loading…
Reference in a new issue