Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_virtio_block.c
Show First 20 Lines • Show All 447 Lines • ▼ Show 20 Lines | pci_vtblk_resized(struct blockif_ctxt *bctxt __unused, void *arg, | ||||
vi_interrupt(&sc->vbsc_vs, VIRTIO_PCI_ISR_CONFIG, | vi_interrupt(&sc->vbsc_vs, VIRTIO_PCI_ISR_CONFIG, | ||||
sc->vbsc_vs.vs_msix_cfg_idx); | sc->vbsc_vs.vs_msix_cfg_idx); | ||||
} | } | ||||
static int | static int | ||||
pci_vtblk_init(struct vmctx *ctx __unused, struct pci_devinst *pi, | pci_vtblk_init(struct vmctx *ctx __unused, struct pci_devinst *pi, | ||||
nvlist_t *nvl) | nvlist_t *nvl) | ||||
{ | { | ||||
char bident[sizeof("XX:X:X")]; | char bident[sizeof("XXX:XXX")]; | ||||
struct blockif_ctxt *bctxt; | struct blockif_ctxt *bctxt; | ||||
const char *path, *serial; | const char *path, *serial; | ||||
MD5_CTX mdctx; | MD5_CTX mdctx; | ||||
u_char digest[16]; | u_char digest[16]; | ||||
struct pci_vtblk_softc *sc; | struct pci_vtblk_softc *sc; | ||||
off_t size; | off_t size; | ||||
int i, sectsz, sts, sto; | int i, sectsz, sts, sto; | ||||
/* | /* | ||||
* The supplied backing file has to exist | * The supplied backing file has to exist | ||||
*/ | */ | ||||
snprintf(bident, sizeof(bident), "%d:%d", pi->pi_slot, pi->pi_func); | snprintf(bident, sizeof(bident), "%u:%u", pi->pi_slot, pi->pi_func); | ||||
bctxt = blockif_open(nvl, bident); | bctxt = blockif_open(nvl, bident); | ||||
if (bctxt == NULL) { | if (bctxt == NULL) { | ||||
perror("Could not open backing file"); | perror("Could not open backing file"); | ||||
return (1); | return (1); | ||||
} | } | ||||
size = blockif_size(bctxt); | size = blockif_size(bctxt); | ||||
sectsz = blockif_sectsz(bctxt); | sectsz = blockif_sectsz(bctxt); | ||||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |