bhyve: Mark variables and functions as static where appropriate
Mark them const as well when it makes sense to do so. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
75ce327a2c
commit
37045dfa89
|
@ -305,7 +305,7 @@ _expand_config_value(const char *value, int depth)
|
|||
return (valbuf);
|
||||
}
|
||||
|
||||
const char *
|
||||
static const char *
|
||||
expand_config_value(const char *value)
|
||||
{
|
||||
static char *valbuf;
|
||||
|
@ -346,7 +346,7 @@ get_config_value_node(const nvlist_t *parent, const char *name)
|
|||
return (expand_config_value(nvlist_get_string(parent, name)));
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
_bool_value(const char *name, const char *value)
|
||||
{
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
|
|||
/*
|
||||
* Back-end state-machine
|
||||
*/
|
||||
enum state {
|
||||
static enum state {
|
||||
DORMANT,
|
||||
IDENT_WAIT,
|
||||
IDENT_SEND,
|
||||
|
|
|
@ -135,7 +135,7 @@ static struct vcpu_state *vcpu_state;
|
|||
static int cur_vcpu, stopped_vcpu;
|
||||
static bool gdb_active = false;
|
||||
|
||||
const int gdb_regset[] = {
|
||||
static const int gdb_regset[] = {
|
||||
VM_REG_GUEST_RAX,
|
||||
VM_REG_GUEST_RBX,
|
||||
VM_REG_GUEST_RCX,
|
||||
|
@ -162,7 +162,7 @@ const int gdb_regset[] = {
|
|||
VM_REG_GUEST_GS
|
||||
};
|
||||
|
||||
const int gdb_regsize[] = {
|
||||
static const int gdb_regsize[] = {
|
||||
8,
|
||||
8,
|
||||
8,
|
||||
|
@ -1804,7 +1804,7 @@ new_connection(int fd, enum ev_type event, void *arg)
|
|||
}
|
||||
|
||||
#ifndef WITHOUT_CAPSICUM
|
||||
void
|
||||
static void
|
||||
limit_gdb_socket(int s)
|
||||
{
|
||||
cap_rights_t rights;
|
||||
|
|
|
@ -845,17 +845,15 @@ hda_codec_audio_inout_nid(struct hda_codec_stream *st, uint16_t verb,
|
|||
return (res);
|
||||
}
|
||||
|
||||
struct hda_codec_class hda_codec = {
|
||||
static const struct hda_codec_class hda_codec = {
|
||||
.name = "hda_codec",
|
||||
.init = hda_codec_init,
|
||||
.reset = hda_codec_reset,
|
||||
.command = hda_codec_command,
|
||||
.notify = hda_codec_notify,
|
||||
};
|
||||
|
||||
HDA_EMUL_SET(hda_codec);
|
||||
|
||||
|
||||
/*
|
||||
* HDA Audio Context module function definitions
|
||||
*/
|
||||
|
|
|
@ -61,7 +61,7 @@ struct mmio_rb_range {
|
|||
struct mmio_rb_tree;
|
||||
RB_PROTOTYPE(mmio_rb_tree, mmio_rb_range, mr_link, mmio_rb_range_compare);
|
||||
|
||||
RB_HEAD(mmio_rb_tree, mmio_rb_range) mmio_rb_root, mmio_rb_fallback;
|
||||
static RB_HEAD(mmio_rb_tree, mmio_rb_range) mmio_rb_root, mmio_rb_fallback;
|
||||
|
||||
/*
|
||||
* Per-vCPU cache. Since most accesses from a vCPU will be to
|
||||
|
|
|
@ -183,7 +183,7 @@ SET_DECLARE(net_backend_set, struct net_backend);
|
|||
*/
|
||||
|
||||
#if defined(INET6) || defined(INET)
|
||||
const int pf_list[] = {
|
||||
static const int pf_list[] = {
|
||||
#if defined(INET6)
|
||||
PF_INET6,
|
||||
#endif
|
||||
|
|
|
@ -2704,7 +2704,7 @@ pci_ahci_resume(struct vmctx *ctx, struct pci_devinst *pi)
|
|||
/*
|
||||
* Use separate emulation names to distinguish drive and atapi devices
|
||||
*/
|
||||
struct pci_devemu pci_de_ahci = {
|
||||
static const struct pci_devemu pci_de_ahci = {
|
||||
.pe_emu = "ahci",
|
||||
.pe_init = pci_ahci_init,
|
||||
.pe_legacy_config = pci_ahci_legacy_config,
|
||||
|
@ -2718,14 +2718,14 @@ struct pci_devemu pci_de_ahci = {
|
|||
};
|
||||
PCI_EMUL_SET(pci_de_ahci);
|
||||
|
||||
struct pci_devemu pci_de_ahci_hd = {
|
||||
static const struct pci_devemu pci_de_ahci_hd = {
|
||||
.pe_emu = "ahci-hd",
|
||||
.pe_legacy_config = pci_ahci_hd_legacy_config,
|
||||
.pe_alias = "ahci",
|
||||
};
|
||||
PCI_EMUL_SET(pci_de_ahci_hd);
|
||||
|
||||
struct pci_devemu pci_de_ahci_cd = {
|
||||
static const struct pci_devemu pci_de_ahci_cd = {
|
||||
.pe_emu = "ahci-cd",
|
||||
.pe_legacy_config = pci_ahci_cd_legacy_config,
|
||||
.pe_alias = "ahci",
|
||||
|
|
|
@ -812,7 +812,7 @@ e82545_tx_ctl(struct e82545_softc *sc, uint32_t val)
|
|||
sc->esc_TCTL = val & ~0xFE800005;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
e82545_bufsz(uint32_t rctl)
|
||||
{
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ e82545_iov_checksum(struct iovec *iov, int iovcnt, int off, int len)
|
|||
/*
|
||||
* Return the transmit descriptor type.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
e82545_txdesc_type(uint32_t lower)
|
||||
{
|
||||
int type;
|
||||
|
@ -2500,7 +2500,7 @@ done:
|
|||
}
|
||||
#endif
|
||||
|
||||
struct pci_devemu pci_de_e82545 = {
|
||||
static const struct pci_devemu pci_de_e82545 = {
|
||||
.pe_emu = "e1000",
|
||||
.pe_init = e82545_init,
|
||||
.pe_legacy_config = netbe_legacy_config,
|
||||
|
@ -2511,4 +2511,3 @@ struct pci_devemu pci_de_e82545 = {
|
|||
#endif
|
||||
};
|
||||
PCI_EMUL_SET(pci_de_e82545);
|
||||
|
||||
|
|
|
@ -2626,7 +2626,7 @@ pci_emul_snapshot(struct vm_snapshot_meta *meta)
|
|||
}
|
||||
#endif
|
||||
|
||||
struct pci_devemu pci_dummy = {
|
||||
static const struct pci_devemu pci_dummy = {
|
||||
.pe_emu = "dummy",
|
||||
.pe_init = pci_emul_dinit,
|
||||
.pe_barwrite = pci_emul_diow,
|
||||
|
|
|
@ -170,7 +170,7 @@ pci_fbuf_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t
|
||||
static uint64_t
|
||||
pci_fbuf_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
|
||||
int baridx, uint64_t offset, int size)
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ pci_fbuf_parse_config(struct pci_fbuf_softc *sc, nvlist_t *nvl)
|
|||
|
||||
extern void vga_render(struct bhyvegc *gc, void *arg);
|
||||
|
||||
void
|
||||
static void
|
||||
pci_fbuf_render(struct bhyvegc *gc, void *arg)
|
||||
{
|
||||
struct pci_fbuf_softc *sc;
|
||||
|
@ -464,7 +464,7 @@ err:
|
|||
}
|
||||
#endif
|
||||
|
||||
struct pci_devemu pci_fbuf = {
|
||||
static const struct pci_devemu pci_fbuf = {
|
||||
.pe_emu = "fbuf",
|
||||
.pe_init = pci_fbuf_init,
|
||||
.pe_barwrite = pci_fbuf_write,
|
||||
|
|
|
@ -270,13 +270,12 @@ static struct hda_ops hops = {
|
|||
.transfer = hda_transfer,
|
||||
};
|
||||
|
||||
struct pci_devemu pci_de_hda = {
|
||||
static const struct pci_devemu pci_de_hda = {
|
||||
.pe_emu = "hda",
|
||||
.pe_init = pci_hda_init,
|
||||
.pe_barwrite = pci_hda_write,
|
||||
.pe_barread = pci_hda_read
|
||||
};
|
||||
|
||||
PCI_EMUL_SET(pci_de_hda);
|
||||
|
||||
SET_DECLARE(hda_codec_class_set, struct hda_codec_class);
|
||||
|
|
|
@ -74,14 +74,14 @@ pci_amd_hostbridge_legacy_config(nvlist_t *nvl, const char *opts)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct pci_devemu pci_de_amd_hostbridge = {
|
||||
static const struct pci_devemu pci_de_amd_hostbridge = {
|
||||
.pe_emu = "amd_hostbridge",
|
||||
.pe_legacy_config = pci_amd_hostbridge_legacy_config,
|
||||
.pe_alias = "hostbridge",
|
||||
};
|
||||
PCI_EMUL_SET(pci_de_amd_hostbridge);
|
||||
|
||||
struct pci_devemu pci_de_hostbridge = {
|
||||
static const struct pci_devemu pci_de_hostbridge = {
|
||||
.pe_emu = "hostbridge",
|
||||
.pe_init = pci_hostbridge_init,
|
||||
};
|
||||
|
|
|
@ -515,7 +515,7 @@ done:
|
|||
}
|
||||
#endif
|
||||
|
||||
struct pci_devemu pci_de_lpc = {
|
||||
static const struct pci_devemu pci_de_lpc = {
|
||||
.pe_emu = "lpc",
|
||||
.pe_init = pci_lpc_init,
|
||||
.pe_write_dsdt = pci_lpc_write_dsdt,
|
||||
|
|
|
@ -3361,7 +3361,7 @@ pci_nvme_legacy_config(nvlist_t *nvl, const char *opts)
|
|||
return (blockif_legacy_config(nvl, opts));
|
||||
}
|
||||
|
||||
struct pci_devemu pci_de_nvme = {
|
||||
static const struct pci_devemu pci_de_nvme = {
|
||||
.pe_emu = "nvme",
|
||||
.pe_init = pci_nvme_init,
|
||||
.pe_legacy_config = pci_nvme_legacy_config,
|
||||
|
|
|
@ -1125,7 +1125,7 @@ passthru_addr(struct vmctx *ctx, struct pci_devinst *pi, int baridx,
|
|||
}
|
||||
}
|
||||
|
||||
struct pci_devemu passthru = {
|
||||
static const struct pci_devemu passthru = {
|
||||
.pe_emu = "passthru",
|
||||
.pe_init = passthru_init,
|
||||
.pe_legacy_config = passthru_legacy_config,
|
||||
|
|
|
@ -125,7 +125,7 @@ pci_uart_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct pci_devemu pci_de_com = {
|
||||
static const struct pci_devemu pci_de_com = {
|
||||
.pe_emu = "uart",
|
||||
.pe_init = pci_uart_init,
|
||||
.pe_legacy_config = pci_uart_legacy_config,
|
||||
|
|
|
@ -343,7 +343,7 @@ pci_vt9p_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct pci_devemu pci_de_v9p = {
|
||||
static const struct pci_devemu pci_de_v9p = {
|
||||
.pe_emu = "virtio-9p",
|
||||
.pe_legacy_config = pci_vt9p_legacy_config,
|
||||
.pe_init = pci_vt9p_init,
|
||||
|
|
|
@ -584,7 +584,7 @@ pci_vtblk_cfgread(void *vsc, int offset, int size, uint32_t *retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct pci_devemu pci_de_vblk = {
|
||||
static const struct pci_devemu pci_de_vblk = {
|
||||
.pe_emu = "virtio-blk",
|
||||
.pe_init = pci_vtblk_init,
|
||||
.pe_legacy_config = blockif_legacy_config,
|
||||
|
|
|
@ -752,7 +752,7 @@ pci_vtcon_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct pci_devemu pci_de_vcon = {
|
||||
static const struct pci_devemu pci_de_vcon = {
|
||||
.pe_emu = "virtio-console",
|
||||
.pe_init = pci_vtcon_init,
|
||||
.pe_barwrite = vi_pci_write,
|
||||
|
|
|
@ -772,7 +772,7 @@ failed:
|
|||
return (-1);
|
||||
}
|
||||
|
||||
struct pci_devemu pci_de_vinput = {
|
||||
static const struct pci_devemu pci_de_vinput = {
|
||||
.pe_emu = "virtio-input",
|
||||
.pe_init = pci_vtinput_init,
|
||||
.pe_legacy_config = pci_vtinput_legacy_config,
|
||||
|
|
|
@ -804,7 +804,7 @@ done:
|
|||
}
|
||||
#endif
|
||||
|
||||
static struct pci_devemu pci_de_vnet = {
|
||||
static const struct pci_devemu pci_de_vnet = {
|
||||
.pe_emu = "virtio-net",
|
||||
.pe_init = pci_vtnet_init,
|
||||
.pe_legacy_config = netbe_legacy_config,
|
||||
|
|
|
@ -204,7 +204,7 @@ pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl)
|
|||
}
|
||||
|
||||
|
||||
struct pci_devemu pci_de_vrnd = {
|
||||
static const struct pci_devemu pci_de_vrnd = {
|
||||
.pe_emu = "virtio-rnd",
|
||||
.pe_init = pci_vtrnd_init,
|
||||
.pe_barwrite = vi_pci_write,
|
||||
|
|
|
@ -735,7 +735,7 @@ pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl)
|
|||
}
|
||||
|
||||
|
||||
struct pci_devemu pci_de_vscsi = {
|
||||
static const struct pci_devemu pci_de_vscsi = {
|
||||
.pe_emu = "virtio-scsi",
|
||||
.pe_init = pci_vtscsi_init,
|
||||
.pe_legacy_config = pci_vtscsi_legacy_config,
|
||||
|
|
|
@ -564,7 +564,7 @@ pci_xhci_portregs_write(struct pci_xhci_softc *sc, uint64_t offset,
|
|||
}
|
||||
}
|
||||
|
||||
struct xhci_dev_ctx *
|
||||
static struct xhci_dev_ctx *
|
||||
pci_xhci_get_dev_ctx(struct pci_xhci_softc *sc, uint32_t slot)
|
||||
{
|
||||
uint64_t devctx_addr;
|
||||
|
@ -588,7 +588,7 @@ pci_xhci_get_dev_ctx(struct pci_xhci_softc *sc, uint32_t slot)
|
|||
return (devctx);
|
||||
}
|
||||
|
||||
struct xhci_trb *
|
||||
static struct xhci_trb *
|
||||
pci_xhci_trb_next(struct pci_xhci_softc *sc, struct xhci_trb *curtrb,
|
||||
uint64_t *guestaddr)
|
||||
{
|
||||
|
@ -3180,7 +3180,7 @@ done:
|
|||
}
|
||||
#endif
|
||||
|
||||
struct pci_devemu pci_de_xhci = {
|
||||
static const struct pci_devemu pci_de_xhci = {
|
||||
.pe_emu = "xhci",
|
||||
.pe_init = pci_xhci_init,
|
||||
.pe_legacy_config = pci_xhci_legacy_config,
|
||||
|
|
|
@ -854,7 +854,7 @@ rfb_wr_thr(void *arg)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
rfb_handle(struct rfb_softc *rc, int cfd)
|
||||
{
|
||||
const char *vbuf = "RFB 003.008\n";
|
||||
|
|
|
@ -174,7 +174,7 @@ vi_intr_init(struct virtio_softc *vs, int barnum, int use_msix)
|
|||
* The guest just gave us a page frame number, from which we can
|
||||
* calculate the addresses of the queue.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
vi_vq_init(struct virtio_softc *vs, uint32_t pfn)
|
||||
{
|
||||
struct vqueue_info *vq;
|
||||
|
|
Loading…
Reference in New Issue