[PATCH] qga: Add initial OpenBSD and NetBSD support

Brad Smith posted 1 patch 1 year, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/Y2+GO5jyd9E2uCT9@humpty.home.comstyle.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Michael Roth <michael.roth@amd.com>, Konstantin Kostiuk <kkostiuk@redhat.com>, Kamil Rytarowski <kamil@netbsd.org>, Reinoud Zandijk <reinoud@netbsd.org>, Ryo ONODERA <ryoon@netbsd.org>, Brad Smith <brad@comstyle.com>
meson.build          | 2 +-
qga/commands-bsd.c   | 5 +++++
qga/commands-posix.c | 9 +++++++--
qga/main.c           | 6 +++---
4 files changed, 16 insertions(+), 6 deletions(-)
[PATCH] qga: Add initial OpenBSD and NetBSD support
Posted by Brad Smith 1 year, 5 months ago
qga: Add initial OpenBSD and NetBSD support

Signed-off-by: Brad Smith <brad@comstyle.com>
---
 meson.build          | 2 +-
 qga/commands-bsd.c   | 5 +++++
 qga/commands-posix.c | 9 +++++++--
 qga/main.c           | 6 +++---
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index cf3e517e56..5556356f14 100644
--- a/meson.build
+++ b/meson.build
@@ -75,7 +75,7 @@ have_tools = get_option('tools') \
   .allowed()
 have_ga = get_option('guest_agent') \
   .disable_auto_if(not have_system and not have_tools) \
-  .require(targetos in ['sunos', 'linux', 'windows', 'freebsd'],
+  .require(targetos in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', 'openbsd'],
            error_message: 'unsupported OS for QEMU guest agent') \
   .allowed()
 have_block = have_system or have_tools
diff --git a/qga/commands-bsd.c b/qga/commands-bsd.c
index 15cade2d4c..17bddda1cf 100644
--- a/qga/commands-bsd.c
+++ b/qga/commands-bsd.c
@@ -21,7 +21,12 @@
 #include <sys/ucred.h>
 #include <sys/mount.h>
 #include <net/if_dl.h>
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
+#else
 #include <net/ethernet.h>
+#endif
 #include <paths.h>
 
 #if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 32493d6383..86be320a1b 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -45,7 +45,12 @@
 #include <arpa/inet.h>
 #include <sys/socket.h>
 #include <net/if.h>
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
+#else
 #include <net/ethernet.h>
+#endif
 #include <sys/types.h>
 #ifdef CONFIG_SOLARIS
 #include <sys/sockio.h>
@@ -2881,7 +2886,7 @@ static int guest_get_network_stats(const char *name,
     return -1;
 }
 
-#ifndef __FreeBSD__
+#ifndef CONFIG_BSD
 /*
  * Fill "buf" with MAC address by ifaddrs. Pointer buf must point to a
  * buffer with ETHER_ADDR_LEN length at least.
@@ -2930,7 +2935,7 @@ bool guest_get_hw_addr(struct ifaddrs *ifa, unsigned char *buf,
     close(sock);
     return true;
 }
-#endif /* __FreeBSD__ */
+#endif /* CONFIG_BSD */
 
 /*
  * Build information about guest interfaces
diff --git a/qga/main.c b/qga/main.c
index b3580508fa..0865c992f0 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -40,11 +40,11 @@
 #include "commands-common.h"
 
 #ifndef _WIN32
-#ifdef __FreeBSD__
+#ifdef CONFIG_BSD
 #define QGA_VIRTIO_PATH_DEFAULT "/dev/vtcon/org.qemu.guest_agent.0"
-#else /* __FreeBSD__ */
+#else /* CONFIG_BSD */
 #define QGA_VIRTIO_PATH_DEFAULT "/dev/virtio-ports/org.qemu.guest_agent.0"
-#endif /* __FreeBSD__ */
+#endif /* CONFIG_BSD */
 #define QGA_SERIAL_PATH_DEFAULT "/dev/ttyS0"
 #define QGA_STATE_RELATIVE_DIR  "run"
 #else
-- 
2.38.1
Re: [PATCH] qga: Add initial OpenBSD and NetBSD support
Posted by Philippe Mathieu-Daudé 1 year, 5 months ago
On 12/11/22 12:40, Brad Smith wrote:
> qga: Add initial OpenBSD and NetBSD support
> 
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
>   meson.build          | 2 +-
>   qga/commands-bsd.c   | 5 +++++
>   qga/commands-posix.c | 9 +++++++--
>   qga/main.c           | 6 +++---
>   4 files changed, 16 insertions(+), 6 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH] qga: Add initial OpenBSD and NetBSD support
Posted by Konstantin Kostiuk 1 year, 5 months ago
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>

On Sun, Nov 13, 2022 at 9:32 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> On 12/11/22 12:40, Brad Smith wrote:
> > qga: Add initial OpenBSD and NetBSD support
> >
> > Signed-off-by: Brad Smith <brad@comstyle.com>
> > ---
> >   meson.build          | 2 +-
> >   qga/commands-bsd.c   | 5 +++++
> >   qga/commands-posix.c | 9 +++++++--
> >   qga/main.c           | 6 +++---
> >   4 files changed, 16 insertions(+), 6 deletions(-)
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
>
Re: [PATCH] qga: Add initial OpenBSD and NetBSD support
Posted by Konstantin Kostiuk 1 year, 4 months ago
the series was merged

Best Regards,
Konstantin Kostiuk.


On Thu, Nov 17, 2022 at 10:50 AM Konstantin Kostiuk <kkostiuk@redhat.com>
wrote:

> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
>
> On Sun, Nov 13, 2022 at 9:32 PM Philippe Mathieu-Daudé <philmd@linaro.org>
> wrote:
>
>> On 12/11/22 12:40, Brad Smith wrote:
>> > qga: Add initial OpenBSD and NetBSD support
>> >
>> > Signed-off-by: Brad Smith <brad@comstyle.com>
>> > ---
>> >   meson.build          | 2 +-
>> >   qga/commands-bsd.c   | 5 +++++
>> >   qga/commands-posix.c | 9 +++++++--
>> >   qga/main.c           | 6 +++---
>> >   4 files changed, 16 insertions(+), 6 deletions(-)
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>
>>
Re: [PATCH] qga: Add initial OpenBSD and NetBSD support
Posted by Brad Smith 1 year, 4 months ago
On 12/26/2022 9:02 AM, Konstantin Kostiuk wrote:
> the series was merged

Thank you.