Skip to contentSkip to conversation

package/qemu: fix build with 64 bits time_t

PATCH New Fabrice Fontaine 2 participants 3 messages Nov 14, 2020 – Nov 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/qemu: fix build with 64 bits time_t

Fix build of qemu 5.0.0 and above with 64 bites time_t

Fixes:
- http://autobuild.buildroot.org/results/efd4474fb4b6c0ce0ab3838ce130429c51e43bbb

---
 .../0002-Fix-build-with-64-bits-time_t.patch  | 98 +++++++++++++++++++
 1 file changed, 98 insertions(+)
 create mode 100644 package/qemu/0002-Fix-build-with-64-bits-time_t.patch
package/qemu/0002-Fix-build-with-64-bits-time_t.patch new file +98 -0
new file mode 100644
index 0000000000..7a72047136
@@ -0,0 +1,98 @@
+From 839e51aa452345b440f8d2d0df84ab58bdedfcd1 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sat, 14 Nov 2020 21:54:17 +0100
+Subject: [PATCH] Fix build with 64 bits time_t
+
+time element is deprecated on new input_event structure in kernel's
+input.h [1]
+
+This will avoid the following build failure:
+
+hw/input/virtio-input-host.c: In function 'virtio_input_host_handle_status':
+hw/input/virtio-input-host.c:198:28: error: 'struct input_event' has no member named 'time'
+  198 |     if (gettimeofday(&evdev.time, NULL)) {
+      |                            ^
+
+Fixes:
+ - http://autobuild.buildroot.org/results/a538167e288c14208d557cd45446df86d3d599d5
+ - http://autobuild.buildroot.org/results/efd4474fb4b6c0ce0ab3838ce130429c51e43bbb
+
+[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ contrib/vhost-user-input/main.c | 10 +++++++++-
+ hw/input/virtio-input-host.c    | 10 +++++++++-
+ 2 files changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
+index 6020c6f33a..e688c3e0a9 100644
+--- a/contrib/vhost-user-input/main.c
++++ b/contrib/vhost-user-input/main.c
+@@ -17,6 +17,11 @@
+ #include "standard-headers/linux/virtio_input.h"
+ #include "qapi/error.h"
+ 
++#ifndef input_event_sec
++#define input_event_sec time.tv_sec
++#define input_event_usec time.tv_usec
++#endif
++
+ enum {
+     VHOST_USER_INPUT_MAX_QUEUES = 2,
+ };
+@@ -115,13 +120,16 @@ vi_evdev_watch(VuDev *dev, int condition, void *data)
+ static void vi_handle_status(VuInput *vi, virtio_input_event *event)
+ {
+     struct input_event evdev;
++    struct timeval tval;
+     int rc;
+ 
+-    if (gettimeofday(&evdev.time, NULL)) {
++    if (gettimeofday(&tval, NULL)) {
+         perror("vi_handle_status: gettimeofday");
+         return;
+     }
+ 
++    evdev.input_event_sec = tval.tv_sec;
++    evdev.input_event_usec = tval.tv_usec;
+     evdev.type = le16toh(event->type);
+     evdev.code = le16toh(event->code);
+     evdev.value = le32toh(event->value);
+diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c
+index 85daf73f1a..2e261737e1 100644
+--- a/hw/input/virtio-input-host.c
++++ b/hw/input/virtio-input-host.c
+@@ -16,6 +16,11 @@
+ #include <sys/ioctl.h>
+ #include "standard-headers/linux/input.h"
+ 
++#ifndef input_event_sec
++#define input_event_sec time.tv_sec
++#define input_event_usec time.tv_usec
++#endif
++
+ /* ----------------------------------------------------------------- */
+ 
+ static struct virtio_input_config virtio_input_host_config[] = {
+@@ -193,13 +198,16 @@ static void virtio_input_host_handle_status(VirtIOInput *vinput,
+ {
+     VirtIOInputHost *vih = VIRTIO_INPUT_HOST(vinput);
+     struct input_event evdev;
++    struct timeval tval;
+     int rc;
+ 
+-    if (gettimeofday(&evdev.time, NULL)) {
++    if (gettimeofday(&tval, NULL)) {
+         perror("virtio_input_host_handle_status: gettimeofday");
+         return;
+     }
+ 
++    evdev.input_event_sec = tval.tv_sec;
++    evdev.input_event_usec = tval.tv_usec;
+     evdev.type = le16_to_cpu(event->type);
+     evdev.code = le16_to_cpu(event->code);
+     evdev.value = le32_to_cpu(event->value);
+-- 
+2.29.2
+
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 package/qemu: fix build with 64 bits time_t

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Fix build of qemu 5.0.0 and above with 64 bites time_t
Fixes:
- http://autobuild.buildroot.org/results/efd4474fb4b6c0ce0ab3838ce130429c51e43bbb

Committed, thanks.

Don't forget to submit the patch upstream.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 package/qemu: fix build with 64 bits time_t

In reply to Fabrice Fontaine
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Fix build of qemu 5.0.0 and above with 64 bites time_t
Fixes:
- http://autobuild.buildroot.org/results/efd4474fb4b6c0ce0ab3838ce130429c51e43bbb

Committed to 2020.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard