[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/16] Fix build with 64 bits time_t
From: |
Michael S. Tsirkin |
Subject: |
[PULL 16/16] Fix build with 64 bits time_t |
Date: |
Fri, 14 May 2021 12:04:55 -0400 |
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
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 <fontaine.fabrice@gmail.com>
Message-Id: <20201203195819.583626-1-fontaine.fabrice@gmail.com>
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/246
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
contrib/vhost-user-input/main.c | 8 ++++++--
hw/input/virtio-input-host.c | 5 ++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
index c15d18c33f..081230da54 100644
--- a/contrib/vhost-user-input/main.c
+++ b/contrib/vhost-user-input/main.c
@@ -6,12 +6,13 @@
#include "qemu/osdep.h"
-#include <linux/input.h>
+#include <sys/ioctl.h>
#include "qemu/iov.h"
#include "qemu/bswap.h"
#include "qemu/sockets.h"
#include "libvhost-user-glib.h"
+#include "standard-headers/linux/input.h"
#include "standard-headers/linux/virtio_input.h"
#include "qapi/error.h"
@@ -113,13 +114,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..137efba57b 100644
--- a/hw/input/virtio-input-host.c
+++ b/hw/input/virtio-input-host.c
@@ -193,13 +193,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);
--
MST
- [PULL 08/16] virtio-blk: Fix rollback path in virtio_blk_data_plane_start(), (continued)
- [PULL 08/16] virtio-blk: Fix rollback path in virtio_blk_data_plane_start(), Michael S. Tsirkin, 2021/05/14
- [PULL 09/16] virtio-blk: Configure all host notifiers in a single MR transaction, Michael S. Tsirkin, 2021/05/14
- [PULL 10/16] virtio-scsi: Set host notifiers and callbacks separately, Michael S. Tsirkin, 2021/05/14
- [PULL 11/16] virtio-scsi: Configure all host notifiers in a single MR transaction, Michael S. Tsirkin, 2021/05/14
- [PULL 12/16] checkpatch: Fix use of uninitialized value, Michael S. Tsirkin, 2021/05/14
- [PULL 15/16] vhost-vdpa: Make vhost_vdpa_get_device_id() static, Michael S. Tsirkin, 2021/05/14
- [PULL 06/16] amd_iommu: fix wrong MMIO operations, Michael S. Tsirkin, 2021/05/14
- [PULL 02/16] x86: acpi: use offset instead of pointer when using build_header(), Michael S. Tsirkin, 2021/05/14
- [PULL 14/16] hw/virtio: enable ioeventfd configuring for mmio, Michael S. Tsirkin, 2021/05/14
- [PULL 13/16] hw/smbios: support for type 41 (onboard devices extended information), Michael S. Tsirkin, 2021/05/14
- [PULL 16/16] Fix build with 64 bits time_t,
Michael S. Tsirkin <=
- Re: [PULL 00/16] pc,pci,virtio: bugfixes, improvements, Peter Maydell, 2021/05/16