* [PATCH v4] Fix build with 64 bits time_t
@ 2020-12-03 19:58 Fabrice Fontaine
2020-12-08 18:41 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Fontaine @ 2020-12-03 19:58 UTC (permalink / raw)
To: qemu-devel; +Cc: Fabrice Fontaine, Gerd Hoffmann, Michael S . Tsirkin
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>
---
Changes v3 -> v4 (after review of Gerd Hoffmann):
- Include <sys/ioctl.h>
Changes v2 -> v3 (after review of Gerd Hoffmann):
- Replace include on <linux/input.h> by
"standard-headers/linux/input.h" to try to fix build on rhel-7
Changes v1 -> v2 (after review of Michael S. Tsirkin):
- Drop define of input_event_{sec,usec} as it is already done in
include/standard-headers/linux/input.h
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 6020c6f33a..b27b12733b 100644
--- a/contrib/vhost-user-input/main.c
+++ b/contrib/vhost-user-input/main.c
@@ -7,13 +7,14 @@
#include "qemu/osdep.h"
#include <glib.h>
-#include <linux/input.h>
+#include <sys/ioctl.h>
#include "qemu/iov.h"
#include "qemu/bswap.h"
#include "qemu/sockets.h"
#include "contrib/libvhost-user/libvhost-user.h"
#include "contrib/libvhost-user/libvhost-user-glib.h"
+#include "standard-headers/linux/input.h"
#include "standard-headers/linux/virtio_input.h"
#include "qapi/error.h"
@@ -115,13 +116,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);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4] Fix build with 64 bits time_t
2020-12-03 19:58 [PATCH v4] Fix build with 64 bits time_t Fabrice Fontaine
@ 2020-12-08 18:41 ` Michael S. Tsirkin
2021-05-10 6:05 ` Thomas Huth
0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2020-12-08 18:41 UTC (permalink / raw)
To: Fabrice Fontaine; +Cc: qemu-devel, Gerd Hoffmann
On Thu, Dec 03, 2020 at 08:58:19PM +0100, Fabrice Fontaine wrote:
> 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>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Gerd pls feel free to merge.
> ---
> Changes v3 -> v4 (after review of Gerd Hoffmann):
> - Include <sys/ioctl.h>
>
> Changes v2 -> v3 (after review of Gerd Hoffmann):
> - Replace include on <linux/input.h> by
> "standard-headers/linux/input.h" to try to fix build on rhel-7
>
> Changes v1 -> v2 (after review of Michael S. Tsirkin):
> - Drop define of input_event_{sec,usec} as it is already done in
> include/standard-headers/linux/input.h
>
> 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 6020c6f33a..b27b12733b 100644
> --- a/contrib/vhost-user-input/main.c
> +++ b/contrib/vhost-user-input/main.c
> @@ -7,13 +7,14 @@
> #include "qemu/osdep.h"
>
> #include <glib.h>
> -#include <linux/input.h>
> +#include <sys/ioctl.h>
>
> #include "qemu/iov.h"
> #include "qemu/bswap.h"
> #include "qemu/sockets.h"
> #include "contrib/libvhost-user/libvhost-user.h"
> #include "contrib/libvhost-user/libvhost-user-glib.h"
> +#include "standard-headers/linux/input.h"
> #include "standard-headers/linux/virtio_input.h"
> #include "qapi/error.h"
>
> @@ -115,13 +116,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);
> --
> 2.29.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4] Fix build with 64 bits time_t
2020-12-08 18:41 ` Michael S. Tsirkin
@ 2021-05-10 6:05 ` Thomas Huth
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2021-05-10 6:05 UTC (permalink / raw)
To: Michael S. Tsirkin, Fabrice Fontaine
Cc: QEMU Trivial, qemu-devel, Gerd Hoffmann
On 08/12/2020 19.41, Michael S. Tsirkin wrote:
> On Thu, Dec 03, 2020 at 08:58:19PM +0100, Fabrice Fontaine wrote:
>> 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>
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
>
> Gerd pls feel free to merge.
>
>> ---
>> Changes v3 -> v4 (after review of Gerd Hoffmann):
>> - Include <sys/ioctl.h>
>>
>> Changes v2 -> v3 (after review of Gerd Hoffmann):
>> - Replace include on <linux/input.h> by
>> "standard-headers/linux/input.h" to try to fix build on rhel-7
>>
>> Changes v1 -> v2 (after review of Michael S. Tsirkin):
>> - Drop define of input_event_{sec,usec} as it is already done in
>> include/standard-headers/linux/input.h
>>
>> 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 6020c6f33a..b27b12733b 100644
>> --- a/contrib/vhost-user-input/main.c
>> +++ b/contrib/vhost-user-input/main.c
>> @@ -7,13 +7,14 @@
>> #include "qemu/osdep.h"
>>
>> #include <glib.h>
>> -#include <linux/input.h>
>> +#include <sys/ioctl.h>
>>
>> #include "qemu/iov.h"
>> #include "qemu/bswap.h"
>> #include "qemu/sockets.h"
>> #include "contrib/libvhost-user/libvhost-user.h"
>> #include "contrib/libvhost-user/libvhost-user-glib.h"
>> +#include "standard-headers/linux/input.h"
>> #include "standard-headers/linux/virtio_input.h"
>> #include "qapi/error.h"
>>
>> @@ -115,13 +116,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);
>> --
>> 2.29.2
>
>
Ping!
Did this fall through the cracks?
Anyway, whoever picks up this patch, please add this line to the commit message:
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/246
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-10 6:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 19:58 [PATCH v4] Fix build with 64 bits time_t Fabrice Fontaine
2020-12-08 18:41 ` Michael S. Tsirkin
2021-05-10 6:05 ` Thomas Huth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).