diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -10,6 +10,8 @@ .. atf-c++ .. + bhyve + .. bsm tags=package=audit-dev .. bsnmp diff --git a/lib/Makefile b/lib/Makefile --- a/lib/Makefile +++ b/lib/Makefile @@ -37,6 +37,7 @@ libauditd \ libbegemot \ libblocksruntime \ + libbhyve \ libbsddialog \ libbsdstat \ libbsm \ diff --git a/lib/libbhyve/Makefile b/lib/libbhyve/Makefile new file mode 100644 --- /dev/null +++ b/lib/libbhyve/Makefile @@ -0,0 +1,18 @@ +SHLIBDIR?= /lib + +PACKAGE=lib${LIB} +LIB= bhyve +SRCS= config.c \ + pci.c +INCS= bhyve/config.h \ + bhyve/net_backends.h \ + bhyve/pci.h +INCSDIR = ${INCLUDEDIR}/bhyve + +SHLIB_MAJOR= 0 +SHLIB_MINOR= 1 +CFLAGS+= -I${.CURDIR} +LIBADD+= netgraph + +MAN= libbhyve.3 +.include diff --git a/usr.sbin/bhyve/config.h b/lib/libbhyve/bhyve/config.h rename from usr.sbin/bhyve/config.h rename to lib/libbhyve/bhyve/config.h --- a/usr.sbin/bhyve/config.h +++ b/lib/libbhyve/bhyve/config.h @@ -26,7 +26,7 @@ */ #ifndef __CONFIG_H__ -#define __CONFIG_H__ +#define __CONFIG_H__ #include diff --git a/lib/libbhyve/bhyve/net_backends.h b/lib/libbhyve/bhyve/net_backends.h new file mode 100644 --- /dev/null +++ b/lib/libbhyve/bhyve/net_backends.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2025 Bojan Novković + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef _LIBBHYVE_NET_H_ +#define _LIBBHYVE_NET_H_ + +#include + +int netbe_legacy_config(nvlist_t *nvl, const char *opts); +#endif /* _LIBBHYVE_NET_H_ */ diff --git a/lib/libbhyve/bhyve/pci.h b/lib/libbhyve/bhyve/pci.h new file mode 100644 --- /dev/null +++ b/lib/libbhyve/bhyve/pci.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Bojan Novković + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef _LIBBHYVE_PCI_H_ +#define _LIBBHYVE_PCI_H_ + +#include + +#define BHYVE_RUN_DIR "/var/run/bhyve/" + +/* + * PCI routines. + */ +int pci_init_fds(nvlist_t *nvl, const char *device); +int pci_parse_config(nvlist_t *nvl, const char *device, const char *config); +int pci_parse_legacy_config(nvlist_t *nvl, const char *opt); +bool pci_validate_hotplug_request(nvlist_t *nvl, const char *device); +#endif /* _LIBBHYVE_PCI_H_ */ diff --git a/usr.sbin/bhyve/config.c b/lib/libbhyve/config.c rename from usr.sbin/bhyve/config.c rename to lib/libbhyve/config.c --- a/usr.sbin/bhyve/config.c +++ b/lib/libbhyve/config.c @@ -32,7 +32,7 @@ #include #include -#include "config.h" +#include "bhyve/config.h" static nvlist_t *config_root; diff --git a/lib/libbhyve/internal.h b/lib/libbhyve/internal.h new file mode 100644 --- /dev/null +++ b/lib/libbhyve/internal.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2025 Bojan Novković + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef _INTERNAL_H_ +#define _INTERNAL_H_ + +#include +#include + +int netbe_init_fds(nvlist_t *nvl); +bool netbe_validate_hotplug_request(nvlist_t *nvl); +#endif // _INTERNAL_H_ diff --git a/lib/libbhyve/libbhyve.3 b/lib/libbhyve/libbhyve.3 new file mode 100644 --- /dev/null +++ b/lib/libbhyve/libbhyve.3 @@ -0,0 +1,105 @@ +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2026 Bojan Novković . +.\" +.\" This documentation was written by +.\" Bojan Novković . +.\" +.Dd January 3, 2026 +.Dt LIBBHYVE 3 +.Os +.Sh NAME +.Nm libbhyve , +.Nm netbe_legacy_config , +.Nm pci_init_fds , +.Nm pci_parse_config , +.Nm pci_parse_legacy_config , +.Nm pci_validate_hotplug_request +.Nd shared bhyve routines +.Sh SYNOPSIS +.Lb libbhyve +.In bhyve/net_backends.h +.In bhyve/config.h +.In bhyve/pci.h +.Ft int +.Fo netbe_legacy_config +.Fa "nvlist_t *nvl" +.Fa "const char *opts" +.Fc +.Ft int +.Fo pci_init_fds +.Fa "nvlist_t *nvl" +.Fa "const char *devname" +.Fc +.Ft int +.Fo pci_parse_config +.Fa "nvlist_t *nvl" +.Fa "const char *device" +.Fa "const char *config" +.Fc +.Ft int +.Fo pci_parse_legacy_config +.Fa "nvlist_t *nvl" +.Fa "const char *opt" +.Fc +.Ft bool +.Fo pci_validate_hotplug_request +.Fa "nvlist_t *nvl" +.Fa "const char *device" +.Fc +.Sh DESCRIPTION +The +.Nm +library contains +.Xr bhyve 8 +code that is meant to be used by other userspace programs. +Please refer to the +.Xr bhyve_config 5 +manual page to read the documentation for the functions listed in +.In bhyve/config.h . +.Pp +The +.Fn netbe_legacy_config +routine parses common network device backend options from the configuration +string +.Ar opt . +.Pp +The +.Fn pci_init_fds +routine creates all file descriptors required for a hotpluggable +emulated PCI device +.Ar devname +and stores them in the +.Ar nvl +.Xr nvlist 9 +object. +.Pp +The +.Fn pci_parse_config +routine parses the configuration string +.Ar config +for a hotpluggable emulated PCI device specified by +.Ar device +using device-specific parsing routines. +.Pp +The +.Fn pci_parse_legacy_config +routine parses a list of "name[=value]" comma-separated options and stores them +in the +.Ar nvl +.Xr nvlist 9 +object. +.Pp +The +.Fn pci_validate_hotplug_request +routine determines whether the +.Ar nvl +.Xr nvlist 9 +object contains all necessary name value pairs required for hotplugging an +emulated PCI device specified by +.Ar device . +.Sh SEE ALSO +.Xr bhyve_config 5 , +.Xr bhyve 8 +.Sh AUTHORS +.An Bojan Novković Aq Mt bnovkov@FreeBSD.org . diff --git a/lib/libbhyve/pci.c b/lib/libbhyve/pci.c new file mode 100644 --- /dev/null +++ b/lib/libbhyve/pci.c @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2019 John Baldwin + * Copyright (c) 2025 Bojan Novković + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include + +#include +#include +#include + +#include "bhyve/config.h" +#include "bhyve/net_backends.h" +#include "bhyve/pci.h" +#include "internal.h" + +struct devinfo { + const char *name; + int (*init_fds)(nvlist_t *); + bool (*validate_hotplug_request)(nvlist_t *); + int (*legacy_config)(nvlist_t *, const char *); +}; +SET_DECLARE(pci_devinfo, struct devinfo); + +static struct devinfo * +find_devinfo(const char *device) +{ + struct devinfo **di; + + SET_FOREACH(di, pci_devinfo) { + if (strncmp(device, (*di)->name, strlen(device)) == 0) { + return (*di); + } + } + + return (NULL); +} + +bool +pci_validate_hotplug_request(nvlist_t *nvl, const char *device) +{ + struct devinfo *di; + + if (device == NULL) + return (false); + if (!nvlist_exists_bool(nvl, "ipc")) { + nvlist_add_string(nvl, "error", "not a hotplug request"); + return (false); + } + + di = find_devinfo(device); + if (di == NULL || di->validate_hotplug_request == NULL) + return (true); + + return (di->validate_hotplug_request(nvl)); +} + +int +pci_init_fds(nvlist_t *nvl, const char *device) +{ + struct devinfo *di; + + if (device == NULL) { + errno = EINVAL; + return (-1); + } + if (nvlist_exists_bool(nvl, "ipc")) { + /* + * We're dealing with a hotplug request, all + * descriptors should've been setup by now. + */ + return (0); + } + di = find_devinfo(device); + if (di == NULL || di->init_fds == NULL) + return (0); + + return (di->init_fds(nvl)); +} + +int +pci_parse_config(nvlist_t *nvl, const char *device, const char *config) +{ + struct devinfo *di; + + if (device == NULL) { + errno = EINVAL; + return (-1); + } + if (nvlist_exists_bool(nvl, "ipc") || config == NULL) + return (0); + di = find_devinfo(device); + if (di == NULL || di->legacy_config == NULL) + return (0); + + return (di->legacy_config(nvl, config)); +} + +/* + * Helper function to parse a list of comma-separated options where + * each option is formatted as "name[=value]". If no value is + * provided, the option is treated as a boolean and is given a value + * of true. + */ +int +pci_parse_legacy_config(nvlist_t *nvl, const char *opt) +{ + char *config, *name, *tofree, *value; + + if (opt == NULL) + return (0); + + config = tofree = strdup(opt); + while ((name = strsep(&config, ",")) != NULL) { + value = strchr(name, '='); + if (value != NULL) { + *value = '\0'; + value++; + set_config_value_node(nvl, name, value); + } else + set_config_bool_node(nvl, name, true); + } + free(tofree); + return (0); +} + +/* + * Per-device file initialization routines. + */ diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -116,6 +116,7 @@ be \ begemot \ bluetooth \ + bhyve \ bsdxml \ bsm \ bsnmp \ @@ -327,6 +328,7 @@ .if ${MK_BLOCKLIST} != "no" _DP_blocklist+= pthread .endif +_DP_bhyve= netgraph _DP_crypto= pthread # See comment by _DP_archive above .if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) @@ -618,6 +620,9 @@ LIBFDTDIR= ${_LIB_OBJTOP}/lib/libfdt LIBFDT?= ${LIBFDTDIR}/libfdt${PIE_SUFFIX}.a +LIBBHYVE= ${OBJTOP}/lib/libbhyve +LIBBHYVE?= ${LIBUVMEMDIR}/libbhyve${PIE_SUFFIX}.a + LIBLUADIR= ${_LIB_OBJTOP}/lib/liblua LIBLUA?= ${LIBLUADIR}/liblua${PIE_SUFFIX}.a diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -24,7 +24,6 @@ bhyverun_machdep.c \ block_if.c \ bootrom.c \ - config.c \ console.c \ crc16.c \ ctl_nvme_all.c \ @@ -98,7 +97,7 @@ -I${.CURDIR}/../../contrib/lib9p \ -I${SRCTOP}/sys -LIBADD+= vmmapi md nv uvmem pthread z util sbuf cam 9p +LIBADD+= bhyve vmmapi md nv uvmem pthread z util sbuf cam 9p .if ${MK_BHYVE_SNAPSHOT} != "no" LIBADD+= ucl xo diff --git a/usr.sbin/bhyve/aarch64/bhyverun_machdep.c b/usr.sbin/bhyve/aarch64/bhyverun_machdep.c --- a/usr.sbin/bhyve/aarch64/bhyverun_machdep.c +++ b/usr.sbin/bhyve/aarch64/bhyverun_machdep.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -40,12 +41,10 @@ #include #include #include - #include #include "bhyve_machdep.h" #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "fdt.h" #include "mem.h" diff --git a/usr.sbin/bhyve/aarch64/fdt.c b/usr.sbin/bhyve/aarch64/fdt.c --- a/usr.sbin/bhyve/aarch64/fdt.c +++ b/usr.sbin/bhyve/aarch64/fdt.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -38,7 +39,6 @@ #include #include -#include "config.h" #include "bhyve_machdep.h" #include "bhyverun.h" #include "fdt.h" diff --git a/usr.sbin/bhyve/aarch64/vmexit.c b/usr.sbin/bhyve/aarch64/vmexit.c --- a/usr.sbin/bhyve/aarch64/vmexit.c +++ b/usr.sbin/bhyve/aarch64/vmexit.c @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -49,7 +50,6 @@ #include "bhyve_machdep.h" #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "gdb.h" #include "mem.h" diff --git a/usr.sbin/bhyve/amd64/bhyverun_machdep.c b/usr.sbin/bhyve/amd64/bhyverun_machdep.c --- a/usr.sbin/bhyve/amd64/bhyverun_machdep.c +++ b/usr.sbin/bhyve/amd64/bhyverun_machdep.c @@ -27,6 +27,7 @@ */ #include +#include #include #include #include @@ -38,7 +39,6 @@ #include "atkbdc.h" #include "bhyverun.h" #include "bootrom.h" -#include "config.h" #include "debug.h" #include "e820.h" #include "fwctl.h" diff --git a/usr.sbin/bhyve/amd64/inout.c b/usr.sbin/bhyve/amd64/inout.c --- a/usr.sbin/bhyve/amd64/inout.c +++ b/usr.sbin/bhyve/amd64/inout.c @@ -37,12 +37,12 @@ #include #include +#include #include #include #include #include "bhyverun.h" -#include "config.h" #include "inout.h" SET_DECLARE(inout_port_set, struct inout_port); diff --git a/usr.sbin/bhyve/amd64/pci_lpc.c b/usr.sbin/bhyve/amd64/pci_lpc.c --- a/usr.sbin/bhyve/amd64/pci_lpc.c +++ b/usr.sbin/bhyve/amd64/pci_lpc.c @@ -28,9 +28,11 @@ */ #include + #include #include +#include #include #include #include @@ -41,7 +43,6 @@ #include "acpi.h" #include "debug.h" #include "bootrom.h" -#include "config.h" #include "inout.h" #include "pci_emul.h" #include "pci_irq.h" diff --git a/usr.sbin/bhyve/amd64/ps2kbd.c b/usr.sbin/bhyve/amd64/ps2kbd.c --- a/usr.sbin/bhyve/amd64/ps2kbd.c +++ b/usr.sbin/bhyve/amd64/ps2kbd.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -45,7 +46,6 @@ #include "atkbdc.h" #include "bhyverun.h" -#include "config.h" #include "console.h" #include "debug.h" #include "ps2kbd.h" diff --git a/usr.sbin/bhyve/amd64/rtc.c b/usr.sbin/bhyve/amd64/rtc.c --- a/usr.sbin/bhyve/amd64/rtc.c +++ b/usr.sbin/bhyve/amd64/rtc.c @@ -32,10 +32,11 @@ #include #include + +#include #include #include "acpi.h" -#include "config.h" #include "pci_lpc.h" #include "rtc.h" diff --git a/usr.sbin/bhyve/amd64/vmexit.c b/usr.sbin/bhyve/amd64/vmexit.c --- a/usr.sbin/bhyve/amd64/vmexit.c +++ b/usr.sbin/bhyve/amd64/vmexit.c @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -44,7 +45,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "gdb.h" #include "inout.h" diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c --- a/usr.sbin/bhyve/basl.c +++ b/usr.sbin/bhyve/basl.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -20,7 +21,6 @@ #include #include "basl.h" -#include "config.h" #include "qemu_loader.h" struct basl_table_checksum { diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -73,12 +73,13 @@ #endif #include + +#include #include #include "acpi.h" #include "bhyverun.h" #include "bootrom.h" -#include "config.h" #include "debug.h" #ifdef BHYVE_GDB #include "gdb.h" diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -41,6 +41,7 @@ #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include #include @@ -56,7 +57,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "mevent.h" #include "pci_emul.h" diff --git a/usr.sbin/bhyve/bootrom.h b/usr.sbin/bhyve/bootrom.h --- a/usr.sbin/bhyve/bootrom.h +++ b/usr.sbin/bhyve/bootrom.h @@ -29,12 +29,10 @@ #ifndef _BOOTROM_H_ #define _BOOTROM_H_ +#include #include #include #include -#include - -#include "config.h" struct vmctx; diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c --- a/usr.sbin/bhyve/gdb.c +++ b/usr.sbin/bhyve/gdb.c @@ -51,6 +51,7 @@ #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include #include @@ -66,7 +67,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "gdb.h" #include "mem.h" diff --git a/usr.sbin/bhyve/net_backend_netgraph.c b/usr.sbin/bhyve/net_backend_netgraph.c --- a/usr.sbin/bhyve/net_backend_netgraph.c +++ b/usr.sbin/bhyve/net_backend_netgraph.c @@ -34,13 +34,13 @@ #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include #include #include #include -#include "config.h" #include "debug.h" #include "net_backends.h" #include "net_backends_priv.h" diff --git a/usr.sbin/bhyve/net_backend_slirp.c b/usr.sbin/bhyve/net_backend_slirp.c --- a/usr.sbin/bhyve/net_backend_slirp.c +++ b/usr.sbin/bhyve/net_backend_slirp.c @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -59,7 +60,6 @@ #include #include -#include "config.h" #include "debug.h" #include "mevent.h" #include "net_utils.h" diff --git a/usr.sbin/bhyve/net_backends.c b/usr.sbin/bhyve/net_backends.c --- a/usr.sbin/bhyve/net_backends.c +++ b/usr.sbin/bhyve/net_backends.c @@ -47,6 +47,7 @@ #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include #include @@ -60,7 +61,6 @@ #include #include -#include "config.h" #include "debug.h" #include "iov.h" #include "mevent.h" diff --git a/usr.sbin/bhyve/net_utils.c b/usr.sbin/bhyve/net_utils.c --- a/usr.sbin/bhyve/net_utils.c +++ b/usr.sbin/bhyve/net_utils.c @@ -26,9 +26,11 @@ */ #include + #include #include +#include #include #include #include @@ -37,7 +39,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "net_utils.h" diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -51,7 +52,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #ifdef BHYVE_SNAPSHOT diff --git a/usr.sbin/bhyve/pci_e82545.c b/usr.sbin/bhyve/pci_e82545.c --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -44,6 +44,7 @@ #include #endif +#include #include #include #include @@ -61,7 +62,6 @@ #include "mii.h" #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #ifdef BHYVE_SNAPSHOT diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -32,6 +32,8 @@ #include #include +#include +#include #include #include #include @@ -45,6 +47,7 @@ #include #include + #include #include #include @@ -52,7 +55,6 @@ #include "acpi.h" #include "bhyverun.h" #include "bootrom.h" -#include "config.h" #include "debug.h" #ifdef __amd64__ #include "amd64/inout.h" @@ -265,34 +267,6 @@ EPRINTLN("Invalid PCI slot info field \"%s\"", aopt); } -/* - * Helper function to parse a list of comma-separated options where - * each option is formatted as "name[=value]". If no value is - * provided, the option is treated as a boolean and is given a value - * of true. - */ -int -pci_parse_legacy_config(nvlist_t *nvl, const char *opt) -{ - char *config, *name, *tofree, *value; - - if (opt == NULL) - return (0); - - config = tofree = strdup(opt); - while ((name = strsep(&config, ",")) != NULL) { - value = strchr(name, '='); - if (value != NULL) { - *value = '\0'; - value++; - set_config_value_node(nvl, name, value); - } else - set_config_bool_node(nvl, name, true); - } - free(tofree); - return (0); -} - /* * PCI device configuration is stored in MIBs that encode the device's * location: diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -45,7 +46,6 @@ #include "bhyvegc.h" #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "console.h" #include "pci_emul.h" diff --git a/usr.sbin/bhyve/pci_hda.c b/usr.sbin/bhyve/pci_hda.c --- a/usr.sbin/bhyve/pci_hda.c +++ b/usr.sbin/bhyve/pci_hda.c @@ -28,11 +28,12 @@ */ #include + +#include #include #include "pci_hda.h" #include "bhyverun.h" -#include "config.h" #include "pci_emul.h" #include "hdac_reg.h" diff --git a/usr.sbin/bhyve/pci_hostbridge.c b/usr.sbin/bhyve/pci_hostbridge.c --- a/usr.sbin/bhyve/pci_hostbridge.c +++ b/usr.sbin/bhyve/pci_hostbridge.c @@ -27,10 +27,11 @@ */ #include + +#include #include #include -#include "config.h" #include "pci_emul.h" static int diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -60,6 +60,7 @@ #include #include +#include #include #include #include @@ -78,7 +79,6 @@ #include "bhyverun.h" #include "block_if.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" diff --git a/usr.sbin/bhyve/pci_passthru.h b/usr.sbin/bhyve/pci_passthru.h --- a/usr.sbin/bhyve/pci_passthru.h +++ b/usr.sbin/bhyve/pci_passthru.h @@ -9,9 +9,9 @@ #include +#include #include -#include "config.h" #include "pci_emul.h" struct passthru_mmio_mapping { diff --git a/usr.sbin/bhyve/pci_uart.c b/usr.sbin/bhyve/pci_uart.c --- a/usr.sbin/bhyve/pci_uart.c +++ b/usr.sbin/bhyve/pci_uart.c @@ -28,10 +28,10 @@ #include +#include #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #include "uart_emul.h" diff --git a/usr.sbin/bhyve/pci_virtio_9p.c b/usr.sbin/bhyve/pci_virtio_9p.c --- a/usr.sbin/bhyve/pci_virtio_9p.c +++ b/usr.sbin/bhyve/pci_virtio_9p.c @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -48,7 +49,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #include "virtio.h" diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -36,6 +36,7 @@ #include +#include #include #include #include @@ -49,7 +50,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #include "virtio.h" diff --git a/usr.sbin/bhyve/pci_virtio_console.c b/usr.sbin/bhyve/pci_virtio_console.c --- a/usr.sbin/bhyve/pci_virtio_console.c +++ b/usr.sbin/bhyve/pci_virtio_console.c @@ -43,6 +43,7 @@ #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include #include @@ -57,7 +58,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #include "virtio.h" diff --git a/usr.sbin/bhyve/pci_virtio_input.c b/usr.sbin/bhyve/pci_virtio_input.c --- a/usr.sbin/bhyve/pci_virtio_input.c +++ b/usr.sbin/bhyve/pci_virtio_input.c @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -56,7 +57,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "mevent.h" #include "pci_emul.h" diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -35,6 +35,7 @@ #include #include /* IFNAMSIZ */ +#include #include #include #include @@ -49,7 +50,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #include "mevent.h" diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -58,7 +59,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #include "virtio.h" diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c --- a/usr.sbin/bhyve/pci_xhci.c +++ b/usr.sbin/bhyve/pci_xhci.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -52,7 +53,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "pci_emul.h" #include "pci_xhci.h" diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c --- a/usr.sbin/bhyve/rfb.c +++ b/usr.sbin/bhyve/rfb.c @@ -47,6 +47,7 @@ #ifndef WITHOUT_CAPSICUM #include #endif +#include #include #include #include @@ -64,7 +65,6 @@ #include "bhyvegc.h" #include "debug.h" #include "console.h" -#include "config.h" #include "rfb.h" #include "sockstream.h" diff --git a/usr.sbin/bhyve/riscv/bhyverun_machdep.c b/usr.sbin/bhyve/riscv/bhyverun_machdep.c --- a/usr.sbin/bhyve/riscv/bhyverun_machdep.c +++ b/usr.sbin/bhyve/riscv/bhyverun_machdep.c @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -48,7 +49,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "fdt.h" #include "mem.h" diff --git a/usr.sbin/bhyve/riscv/fdt.c b/usr.sbin/bhyve/riscv/fdt.c --- a/usr.sbin/bhyve/riscv/fdt.c +++ b/usr.sbin/bhyve/riscv/fdt.c @@ -46,7 +46,7 @@ #include -#include "config.h" +#include #include "bhyverun.h" #include "fdt.h" diff --git a/usr.sbin/bhyve/riscv/vmexit.c b/usr.sbin/bhyve/riscv/vmexit.c --- a/usr.sbin/bhyve/riscv/vmexit.c +++ b/usr.sbin/bhyve/riscv/vmexit.c @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -52,7 +53,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "mem.h" #include "vmexit.h" diff --git a/usr.sbin/bhyve/rtc_pl031.c b/usr.sbin/bhyve/rtc_pl031.c --- a/usr.sbin/bhyve/rtc_pl031.c +++ b/usr.sbin/bhyve/rtc_pl031.c @@ -28,12 +28,12 @@ #include #include +#include #include #include #include #include -#include "config.h" #include "mevent.h" #include "rtc_pl031.h" diff --git a/usr.sbin/bhyve/slirp/Makefile b/usr.sbin/bhyve/slirp/Makefile --- a/usr.sbin/bhyve/slirp/Makefile +++ b/usr.sbin/bhyve/slirp/Makefile @@ -1,9 +1,9 @@ .PATH: ${.CURDIR}/../ PROG= bhyve-slirp-helper -SRCS= slirp-helper.c config.c +SRCS= slirp-helper.c CFLAGS+= -I${.CURDIR}/../ -LIBADD= nv +LIBADD= bhyve nv MAN= BINDIR?= /usr/libexec diff --git a/usr.sbin/bhyve/slirp/slirp-helper.c b/usr.sbin/bhyve/slirp/slirp-helper.c --- a/usr.sbin/bhyve/slirp/slirp-helper.c +++ b/usr.sbin/bhyve/slirp/slirp-helper.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -35,7 +36,6 @@ #include #include -#include "config.h" #include "libslirp.h" struct slirp_priv { diff --git a/usr.sbin/bhyve/smbiostbl.c b/usr.sbin/bhyve/smbiostbl.c --- a/usr.sbin/bhyve/smbiostbl.c +++ b/usr.sbin/bhyve/smbiostbl.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -40,7 +41,6 @@ #include #include "bhyverun.h" -#include "config.h" #include "debug.h" #include "smbiostbl.h" diff --git a/usr.sbin/bhyve/tpm_device.h b/usr.sbin/bhyve/tpm_device.h --- a/usr.sbin/bhyve/tpm_device.h +++ b/usr.sbin/bhyve/tpm_device.h @@ -9,7 +9,7 @@ #include -#include "config.h" +#include struct tpm_device; diff --git a/usr.sbin/bhyve/tpm_device.c b/usr.sbin/bhyve/tpm_device.c --- a/usr.sbin/bhyve/tpm_device.c +++ b/usr.sbin/bhyve/tpm_device.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -16,7 +17,6 @@ #include "acpi.h" #include "acpi_device.h" -#include "config.h" #include "tpm_device.h" #include "tpm_emul.h" #include "tpm_intf.h" diff --git a/usr.sbin/bhyve/tpm_emul.h b/usr.sbin/bhyve/tpm_emul.h --- a/usr.sbin/bhyve/tpm_emul.h +++ b/usr.sbin/bhyve/tpm_emul.h @@ -9,7 +9,7 @@ #include -#include "config.h" +#include struct tpm_device; diff --git a/usr.sbin/bhyve/tpm_emul_passthru.c b/usr.sbin/bhyve/tpm_emul_passthru.c --- a/usr.sbin/bhyve/tpm_emul_passthru.c +++ b/usr.sbin/bhyve/tpm_emul_passthru.c @@ -7,6 +7,7 @@ #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include -#include "config.h" #include "tpm_device.h" #include "tpm_emul.h" diff --git a/usr.sbin/bhyve/tpm_emul_swtpm.c b/usr.sbin/bhyve/tpm_emul_swtpm.c --- a/usr.sbin/bhyve/tpm_emul_swtpm.c +++ b/usr.sbin/bhyve/tpm_emul_swtpm.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -18,7 +19,6 @@ #include #include -#include "config.h" #include "tpm_device.h" #include "tpm_emul.h" diff --git a/usr.sbin/bhyve/tpm_intf.h b/usr.sbin/bhyve/tpm_intf.h --- a/usr.sbin/bhyve/tpm_intf.h +++ b/usr.sbin/bhyve/tpm_intf.h @@ -7,10 +7,10 @@ #pragma once +#include #include #include "acpi_device.h" -#include "config.h" #include "tpm_device.h" #include "tpm_emul.h" diff --git a/usr.sbin/bhyve/tpm_intf_crb.c b/usr.sbin/bhyve/tpm_intf_crb.c --- a/usr.sbin/bhyve/tpm_intf_crb.c +++ b/usr.sbin/bhyve/tpm_intf_crb.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -22,7 +23,6 @@ #include #include "basl.h" -#include "config.h" #include "mem.h" #include "qemu_fwcfg.h" #include "tpm_device.h" diff --git a/usr.sbin/bhyve/tpm_ppi.h b/usr.sbin/bhyve/tpm_ppi.h --- a/usr.sbin/bhyve/tpm_ppi.h +++ b/usr.sbin/bhyve/tpm_ppi.h @@ -7,7 +7,7 @@ #pragma once -#include "config.h" +#include struct tpm_ppi { const char *name; diff --git a/usr.sbin/bhyve/tpm_ppi_qemu.c b/usr.sbin/bhyve/tpm_ppi_qemu.c --- a/usr.sbin/bhyve/tpm_ppi_qemu.c +++ b/usr.sbin/bhyve/tpm_ppi_qemu.c @@ -13,13 +13,13 @@ #include #include +#include #include #include #include #include "acpi.h" #include "acpi_device.h" -#include "config.h" #include "mem.h" #include "qemu_fwcfg.h" #include "tpm_ppi.h"