Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_nvme.c
Show First 20 Lines • Show All 3,146 Lines • ▼ Show 20 Lines | pci_nvme_read(struct vmctx *ctx __unused, int vcpu __unused, | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
pci_nvme_parse_config(struct pci_nvme_softc *sc, nvlist_t *nvl) | pci_nvme_parse_config(struct pci_nvme_softc *sc, nvlist_t *nvl) | ||||
{ | { | ||||
char bident[sizeof("XX:X:X")]; | char bident[sizeof("XXX:XXX")]; | ||||
const char *value; | const char *value; | ||||
uint32_t sectsz; | uint32_t sectsz; | ||||
sc->max_queues = NVME_QUEUES; | sc->max_queues = NVME_QUEUES; | ||||
sc->max_qentries = NVME_MAX_QENTRIES; | sc->max_qentries = NVME_MAX_QENTRIES; | ||||
sc->ioslots = NVME_IOSLOTS; | sc->ioslots = NVME_IOSLOTS; | ||||
sc->num_squeues = sc->max_queues; | sc->num_squeues = sc->max_queues; | ||||
sc->num_cqueues = sc->max_queues; | sc->num_cqueues = sc->max_queues; | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | if (value != NULL) { | ||||
sc->nvstore.ctx = calloc(1, sc->nvstore.size); | sc->nvstore.ctx = calloc(1, sc->nvstore.size); | ||||
sc->nvstore.sectsz = 4096; | sc->nvstore.sectsz = 4096; | ||||
sc->nvstore.sectsz_bits = 12; | sc->nvstore.sectsz_bits = 12; | ||||
if (sc->nvstore.ctx == NULL) { | if (sc->nvstore.ctx == NULL) { | ||||
EPRINTLN("nvme: Unable to allocate RAM"); | EPRINTLN("nvme: Unable to allocate RAM"); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
} else { | } else { | ||||
snprintf(bident, sizeof(bident), "%d:%d", | snprintf(bident, sizeof(bident), "%u:%u", | ||||
corvink: Have you tried using %u? Maybe gcc warns due to the possible minus sign of signed integers? | |||||
sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); | sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); | ||||
sc->nvstore.ctx = blockif_open(nvl, bident); | sc->nvstore.ctx = blockif_open(nvl, bident); | ||||
if (sc->nvstore.ctx == NULL) { | if (sc->nvstore.ctx == NULL) { | ||||
EPRINTLN("nvme: Could not open backing file: %s", | EPRINTLN("nvme: Could not open backing file: %s", | ||||
strerror(errno)); | strerror(errno)); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
sc->nvstore.type = NVME_STOR_BLOCKIF; | sc->nvstore.type = NVME_STOR_BLOCKIF; | ||||
▲ Show 20 Lines • Show All 158 Lines • Show Last 20 Lines |
Have you tried using %u? Maybe gcc warns due to the possible minus sign of signed integers?