On 2015/6/9 23:55, Alex Williamson wrote:
> +static int vfio_populate_device(VFIODevice *vbasedev)
> +{
> + int i, ret = -1;
> + VFIOPlatformDevice *vdev =
> + container_of(vbasedev, VFIOPlatformDevice, vbasedev);
> +
> + if (!(vbasedev->flags & VFIO_DEVICE_FLAGS_PLATFORM)) {
> + error_report("vfio: Um, this isn't a platform device");
> + return ret;
> + }
> +
> + vdev->regions = g_malloc0_n(vbasedev->num_regions,
> + sizeof(VFIORegion *));
Failed to build on SUSE11.3:
/home/qemu/hw/vfio/platform.c: In function ‘vfio_populate_device’:
/home/qemu/hw/vfio/platform.c:349: warning: implicit declaration of function
‘g_malloc0_n’
/home/qemu/hw/vfio/platform.c:349: warning: nested extern declaration of
‘g_malloc0_n’
/home/qemu/hw/vfio/platform.c:350: warning: assignment makes pointer from
integer without a cast
CC x86_64-softmmu/hw/i386/pc_q35.o
CC x86_64-softmmu/hw/i386/pc_sysfw.o
CC x86_64-softmmu/hw/i386/acpi-build.o
CC x86_64-softmmu/hw/i386/kvm/pci-assign.o
CC x86_64-softmmu/target-i386/translate.o
GEN trace/generated-helpers.c
CC x86_64-softmmu/trace/generated-helpers.o
LINK x86_64-softmmu/qemu-system-x86_64
hw/vfio/platform.o: In function `vfio_populate_device':
/home/qemu/hw/vfio/platform.c:349: undefined reference to `g_malloc0_n'
collect2: ld returned 1 exit status
make[1]: *** [qemu-system-x86_64] Error 1
make: *** [subdir-x86_64-softmmu] Error 2
That's because g_malloc0_n() introduced since glib-2.24,
but QEMU just require glib-2.22.
Regards,
-Gonglei