diff mbox series

[1/2] lapi: Add uinput.h

Message ID 20231024201135.264768-2-pvorel@suse.cz
State Accepted
Headers show
Series Fix CI for CentOS 7 | expand

Commit Message

Petr Vorel Oct. 24, 2023, 8:11 p.m. UTC
With the only definition UI_GET_SYSNAME, which was added in kernel 3.15,
but we 3.10 (CentOS 7).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 configure.ac          |  1 +
 include/lapi/uinput.h | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 include/lapi/uinput.h

Comments

Richard Palethorpe Oct. 25, 2023, 7:18 a.m. UTC | #1
Hello,

Petr Vorel <pvorel@suse.cz> writes:

> With the only definition UI_GET_SYSNAME, which was added in kernel 3.15,
> but we 3.10 (CentOS 7).
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  configure.ac          |  1 +
>  include/lapi/uinput.h | 15 +++++++++++++++
>  2 files changed, 16 insertions(+)
>  create mode 100644 include/lapi/uinput.h
>
> diff --git a/configure.ac b/configure.ac
> index e40a18fa0..6d3620c57 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -67,6 +67,7 @@ AC_CHECK_HEADERS_ONCE([ \
>      linux/tls.h \
>      linux/tty.h \
>      linux/types.h \
> +    linux/uinput.h \

Do we use this?

>      linux/userfaultfd.h \
>      netinet/sctp.h \
>      pthread.h \
> diff --git a/include/lapi/uinput.h b/include/lapi/uinput.h
> new file mode 100644
> index 000000000..bdd6f466f
> --- /dev/null
> +++ b/include/lapi/uinput.h
> @@ -0,0 +1,15 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
> + */
> +
> +#ifndef LAPI_UINPUT_H__
> +#define LAPI_UINPUT_H__
> +
> +#include <linux/uinput.h>
> +
> +#ifndef UI_GET_SYSNAME
> +# define UI_GET_SYSNAME(len)	_IOC(_IOC_READ, UINPUT_IOCTL_BASE, 44, len)
> +#endif
> +
> +#endif	/* LAPI_UINPUT_H__ */
Petr Vorel Oct. 25, 2023, 7:39 a.m. UTC | #2
Hi Richie,

> > +++ b/configure.ac
> > @@ -67,6 +67,7 @@ AC_CHECK_HEADERS_ONCE([ \
> >      linux/tls.h \
> >      linux/tty.h \
> >      linux/types.h \
> > +    linux/uinput.h \

> Do we use this?
Yes, see below.

> >      linux/userfaultfd.h \
> >      netinet/sctp.h \
> >      pthread.h \
> > diff --git a/include/lapi/uinput.h b/include/lapi/uinput.h
> > new file mode 100644
> > index 000000000..bdd6f466f
> > --- /dev/null
> > +++ b/include/lapi/uinput.h
> > @@ -0,0 +1,15 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
> > + */
> > +
> > +#ifndef LAPI_UINPUT_H__
> > +#define LAPI_UINPUT_H__
> > +
> > +#include <linux/uinput.h>
Here. We have policy, that we first load the header and then check for a
fallback.

Kind regards,
Petr

> > +
> > +#ifndef UI_GET_SYSNAME
> > +# define UI_GET_SYSNAME(len)	_IOC(_IOC_READ, UINPUT_IOCTL_BASE, 44, len)
> > +#endif
> > +
> > +#endif	/* LAPI_UINPUT_H__ */
Cyril Hrubis Oct. 25, 2023, 7:51 a.m. UTC | #3
Hi!
> > > +++ b/configure.ac
> > > @@ -67,6 +67,7 @@ AC_CHECK_HEADERS_ONCE([ \
> > >      linux/tls.h \
> > >      linux/tty.h \
> > >      linux/types.h \
> > > +    linux/uinput.h \
> 
> > Do we use this?
> Yes, see below.

Ritchie probably means the macro HAVE_LINUX_UINPUT_H that is generated
by this, and no we do not use that, we include <linux/uinput.h>
unconditionally.
Richard Palethorpe Oct. 25, 2023, 7:52 a.m. UTC | #4
Hello,

Petr Vorel <pvorel@suse.cz> writes:

> Hi Richie,
>
>> > +++ b/configure.ac
>> > @@ -67,6 +67,7 @@ AC_CHECK_HEADERS_ONCE([ \
>> >      linux/tls.h \
>> >      linux/tty.h \
>> >      linux/types.h \
>> > +    linux/uinput.h \
>
>> Do we use this?
> Yes, see below.
>
>> >      linux/userfaultfd.h \
>> >      netinet/sctp.h \
>> >      pthread.h \
>> > diff --git a/include/lapi/uinput.h b/include/lapi/uinput.h
>> > new file mode 100644
>> > index 000000000..bdd6f466f
>> > --- /dev/null
>> > +++ b/include/lapi/uinput.h
>> > @@ -0,0 +1,15 @@
>> > +// SPDX-License-Identifier: GPL-2.0-or-later
>> > +/*
>> > + * Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
>> > + */
>> > +
>> > +#ifndef LAPI_UINPUT_H__
>> > +#define LAPI_UINPUT_H__
>> > +
>> > +#include <linux/uinput.h>
> Here. We have policy, that we first load the header and then check for a
> fallback.

But we don't check if the header exists with HAVE_LINUX_UINPUT_H before
loading it?

>
> Kind regards,
> Petr
>
>> > +
>> > +#ifndef UI_GET_SYSNAME
>> > +# define UI_GET_SYSNAME(len)	_IOC(_IOC_READ, UINPUT_IOCTL_BASE, 44, len)
>> > +#endif
>> > +
>> > +#endif	/* LAPI_UINPUT_H__ */
Petr Vorel Oct. 25, 2023, 8:12 a.m. UTC | #5
> Hi!
> > > > +++ b/configure.ac
> > > > @@ -67,6 +67,7 @@ AC_CHECK_HEADERS_ONCE([ \
> > > >      linux/tls.h \
> > > >      linux/tty.h \
> > > >      linux/types.h \
> > > > +    linux/uinput.h \

> > > Do we use this?
> > Yes, see below.

> Ritchie probably means the macro HAVE_LINUX_UINPUT_H that is generated
> by this, and no we do not use that, we include <linux/uinput.h>
> unconditionally.

Ah, thank you. This is obviously missing.

Kind regards,
Petr
Cyril Hrubis Oct. 25, 2023, 8:14 a.m. UTC | #6
Hi!
> Ah, thank you. This is obviously missing.

I do not think that it's needed at all, the uinput header has been in
there for more than decade.
Petr Vorel Oct. 25, 2023, 8:22 a.m. UTC | #7
> Hi!
> > Ah, thank you. This is obviously missing.

> I do not think that it's needed at all, the uinput header has been in
> there for more than decade.

Thank you for spotting trivial error.  I only checked up to UAPI introduction
v3.7-rc1 (but we already raised the support to 3.10).  More importantly
include/linux/uinput.h existed since git history (2.6.12-rc2).

I'll remove check in v2.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index e40a18fa0..6d3620c57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,7 @@  AC_CHECK_HEADERS_ONCE([ \
     linux/tls.h \
     linux/tty.h \
     linux/types.h \
+    linux/uinput.h \
     linux/userfaultfd.h \
     netinet/sctp.h \
     pthread.h \
diff --git a/include/lapi/uinput.h b/include/lapi/uinput.h
new file mode 100644
index 000000000..bdd6f466f
--- /dev/null
+++ b/include/lapi/uinput.h
@@ -0,0 +1,15 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
+ */
+
+#ifndef LAPI_UINPUT_H__
+#define LAPI_UINPUT_H__
+
+#include <linux/uinput.h>
+
+#ifndef UI_GET_SYSNAME
+# define UI_GET_SYSNAME(len)	_IOC(_IOC_READ, UINPUT_IOCTL_BASE, 44, len)
+#endif
+
+#endif	/* LAPI_UINPUT_H__ */