[libvirt] [PATCH v2] virmdev: fix build on non-Linux

Roman Bogorodskiy posted 1 patch 125 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170327155644.49165-1-bogorodskiy@gmail.com
src/util/virmdev.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

[libvirt] [PATCH v2] virmdev: fix build on non-Linux

Posted by Roman Bogorodskiy 125 weeks ago
 - Make virMediatedDeviceNew() stub args match its prototype
 - Fix typo: virRerportError -> virReportError
 - Move MDEV_SYSFS_DEVICES definition out of the #ifdef __linux__ block
   so we don't have to stub virMediatedDeviceGetSysfsPath()
---
Changes from v1: instead of adding a stub for virMediatedDeviceGetSysfsPath(),
just unconditionally define MDEV_SYSFS_DEVICES as it makes things easier for
the tests.

 src/util/virmdev.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/util/virmdev.c b/src/util/virmdev.c
index e924af3c1..2a1ade739 100644
--- a/src/util/virmdev.c
+++ b/src/util/virmdev.c
@@ -28,6 +28,8 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
+#define MDEV_SYSFS_DEVICES "/sys/bus/mdev/devices/"
+
 VIR_LOG_INIT("util.mdev");
 
 struct _virMediatedDevice {
@@ -68,7 +70,6 @@ virMediatedOnceInit(void)
 VIR_ONCE_GLOBAL_INIT(virMediated)
 
 #ifdef __linux__
-# define MDEV_SYSFS_DEVICES "/sys/bus/mdev/devices/"
 
 static int
 virMediatedDeviceGetSysfsDeviceAPI(virMediatedDevicePtr dev,
@@ -173,12 +174,12 @@ virMediatedDeviceNew(const char *uuidstr, virMediatedDeviceModelType model)
 #else
 
 virMediatedDevicePtr
-virMediatedDeviceNew(virPCIDeviceAddressPtr pciaddr ATTRIBUTE_UNUSED,
-                     const char *uuidstr ATTRIBUTE_UNUSED)
+virMediatedDeviceNew(const char *uuidstr ATTRIBUTE_UNUSED,
+                     virMediatedDeviceModelType model ATTRIBUTE_UNUSED)
 {
-    virRerportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("mediated devices are not supported on non-linux "
-                      "platforms"));
+    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                   _("mediated devices are not supported on non-linux "
+                     "platforms"));
     return NULL;
 }
 
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2] virmdev: fix build on non-Linux

Posted by Roman Bogorodskiy 125 weeks ago
  Roman Bogorodskiy wrote:

>  - Make virMediatedDeviceNew() stub args match its prototype
>  - Fix typo: virRerportError -> virReportError
>  - Move MDEV_SYSFS_DEVICES definition out of the #ifdef __linux__ block
>    so we don't have to stub virMediatedDeviceGetSysfsPath()
> ---
> Changes from v1: instead of adding a stub for virMediatedDeviceGetSysfsPath(),
> just unconditionally define MDEV_SYSFS_DEVICES as it makes things easier for
> the tests.
> 
>  src/util/virmdev.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/src/util/virmdev.c b/src/util/virmdev.c
> index e924af3c1..2a1ade739 100644
> --- a/src/util/virmdev.c
> +++ b/src/util/virmdev.c
> @@ -28,6 +28,8 @@
>  
>  #define VIR_FROM_THIS VIR_FROM_NONE
>  
> +#define MDEV_SYSFS_DEVICES "/sys/bus/mdev/devices/"
> +
>  VIR_LOG_INIT("util.mdev");
>  
>  struct _virMediatedDevice {
> @@ -68,7 +70,6 @@ virMediatedOnceInit(void)
>  VIR_ONCE_GLOBAL_INIT(virMediated)
>  
>  #ifdef __linux__
> -# define MDEV_SYSFS_DEVICES "/sys/bus/mdev/devices/"
>  
>  static int
>  virMediatedDeviceGetSysfsDeviceAPI(virMediatedDevicePtr dev,
> @@ -173,12 +174,12 @@ virMediatedDeviceNew(const char *uuidstr, virMediatedDeviceModelType model)
>  #else
>  
>  virMediatedDevicePtr
> -virMediatedDeviceNew(virPCIDeviceAddressPtr pciaddr ATTRIBUTE_UNUSED,
> -                     const char *uuidstr ATTRIBUTE_UNUSED)
> +virMediatedDeviceNew(const char *uuidstr ATTRIBUTE_UNUSED,
> +                     virMediatedDeviceModelType model ATTRIBUTE_UNUSED)
>  {
> -    virRerportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -                    _("mediated devices are not supported on non-linux "
> -                      "platforms"));
> +    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                   _("mediated devices are not supported on non-linux "
> +                     "platforms"));
>      return NULL;
>  }

Now as the other things are fixed, I've pushed this one as a
build-breaker.

Roman Bogorodskiy
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list