contrib/vhost-user-blk: fix the compilation issue

Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Peter Xu 2019-01-16 11:08:15 +08:00 committed by Michael S. Tsirkin
parent afa26ecc30
commit a56de056c9
2 changed files with 16 additions and 4 deletions

View File

@ -20,6 +20,10 @@
#include "contrib/libvhost-user/libvhost-user-glib.h"
#include "contrib/libvhost-user/libvhost-user.h"
#if defined(__linux__)
#include <linux/fs.h>
#include <sys/ioctl.h>
#endif
struct virtio_blk_inhdr {
unsigned char status;
@ -454,7 +458,7 @@ vub_get_blocksize(int fd)
#if defined(__linux__) && defined(BLKSSZGET)
if (ioctl(fd, BLKSSZGET, &blocksize) == 0) {
return blocklen;
return blocksize;
}
#endif

View File

@ -3894,7 +3894,7 @@ static QLIST_HEAD(, MSIRouteEntry) msi_route_list = \
static void kvm_update_msi_routes_all(void *private, bool global,
uint32_t index, uint32_t mask)
{
int cnt = 0;
int cnt = 0, vector;
MSIRouteEntry *entry;
MSIMessage msg;
PCIDevice *dev;
@ -3902,11 +3902,19 @@ static void kvm_update_msi_routes_all(void *private, bool global,
/* TODO: explicit route update */
QLIST_FOREACH(entry, &msi_route_list, list) {
cnt++;
vector = entry->vector;
dev = entry->dev;
if (!msix_enabled(dev) && !msi_enabled(dev)) {
if (msix_enabled(dev) && !msix_is_masked(dev, vector)) {
msg = msix_get_message(dev, vector);
} else if (msi_enabled(dev) && !msi_is_masked(dev, vector)) {
msg = msi_get_message(dev, vector);
} else {
/*
* Either MSI/MSIX is disabled for the device, or the
* specific message was masked out. Skip this one.
*/
continue;
}
msg = pci_get_msi_message(dev, entry->vector);
kvm_irqchip_update_msi_route(kvm_state, entry->virq, msg, dev);
}
kvm_irqchip_commit_routes(kvm_state);