linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc: Fix struct termio related ioctl macros
@ 2025-05-17 14:22 Madhavan Srinivasan
  2025-05-20 10:36 ` Michael Ellerman
  2025-06-15  2:39 ` Madhavan Srinivasan
  0 siblings, 2 replies; 5+ messages in thread
From: Madhavan Srinivasan @ 2025-05-17 14:22 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: naveen, linuxppc-dev, Madhavan Srinivasan, Tulio Magno

Since termio interface is now obsolete, include/uapi/asm/ioctls.h
has some constant macros referring to "struct termio", this caused
build failure at userspace.

In file included from /usr/include/asm/ioctl.h:12,
                 from /usr/include/asm/ioctls.h:5,
                 from tst-ioctls.c:3:
tst-ioctls.c: In function 'get_TCGETA':
tst-ioctls.c:12:10: error: invalid application of 'sizeof' to incomplete type 'struct termio'
   12 |   return TCGETA;
      |          ^~~~~~

Even though termios.h provides "struct termio", trying to juggle definitions around to
make it compile could introduce regressions. So better to open code it.

Reported-by: Tulio Magno <tuliom@ascii.art.br>
Closes: https://lore.kernel.org/linuxppc-dev/8734dji5wl.fsf@ascii.art.br/
Suggested-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Changelog v1:
- mpe pointing out mistake in hardcoded values.
  Fixed the same.

 arch/powerpc/include/uapi/asm/ioctls.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/uapi/asm/ioctls.h b/arch/powerpc/include/uapi/asm/ioctls.h
index 2c145da3b774..b5211e413829 100644
--- a/arch/powerpc/include/uapi/asm/ioctls.h
+++ b/arch/powerpc/include/uapi/asm/ioctls.h
@@ -23,10 +23,10 @@
 #define TCSETSW		_IOW('t', 21, struct termios)
 #define TCSETSF		_IOW('t', 22, struct termios)
 
-#define TCGETA		_IOR('t', 23, struct termio)
-#define TCSETA		_IOW('t', 24, struct termio)
-#define TCSETAW		_IOW('t', 25, struct termio)
-#define TCSETAF		_IOW('t', 28, struct termio)
+#define TCGETA		0x40147417 /* _IOR('t', 23, struct termio) */
+#define TCSETA		0x80147418 /* _IOW('t', 24, struct termio) */
+#define TCSETAW		0x80147419 /* _IOW('t', 25, struct termio) */
+#define TCSETAF		0x8014741c /* _IOW('t', 28, struct termio) */
 
 #define TCSBRK		_IO('t', 29)
 #define TCXONC		_IO('t', 30)
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] powerpc: Fix struct termio related ioctl macros
  2025-05-17 14:22 [PATCH v2] powerpc: Fix struct termio related ioctl macros Madhavan Srinivasan
@ 2025-05-20 10:36 ` Michael Ellerman
  2025-06-13 16:32   ` Justin Forbes
  2025-06-15  2:39 ` Madhavan Srinivasan
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2025-05-20 10:36 UTC (permalink / raw)
  To: Madhavan Srinivasan, npiggin, christophe.leroy
  Cc: naveen, linuxppc-dev, Madhavan Srinivasan, Tulio Magno

Madhavan Srinivasan <maddy@linux.ibm.com> writes:
> Since termio interface is now obsolete, include/uapi/asm/ioctls.h
> has some constant macros referring to "struct termio", this caused
> build failure at userspace.
>
> In file included from /usr/include/asm/ioctl.h:12,
>                  from /usr/include/asm/ioctls.h:5,
>                  from tst-ioctls.c:3:
> tst-ioctls.c: In function 'get_TCGETA':
> tst-ioctls.c:12:10: error: invalid application of 'sizeof' to incomplete type 'struct termio'
>    12 |   return TCGETA;
>       |          ^~~~~~
>
> Even though termios.h provides "struct termio", trying to juggle definitions around to
> make it compile could introduce regressions. So better to open code it.
>
> Reported-by: Tulio Magno <tuliom@ascii.art.br>
> Closes: https://lore.kernel.org/linuxppc-dev/8734dji5wl.fsf@ascii.art.br/
> Suggested-by: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
> ---
> Changelog v1:
> - mpe pointing out mistake in hardcoded values.
>   Fixed the same.
>
>  arch/powerpc/include/uapi/asm/ioctls.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/include/uapi/asm/ioctls.h b/arch/powerpc/include/uapi/asm/ioctls.h
> index 2c145da3b774..b5211e413829 100644
> --- a/arch/powerpc/include/uapi/asm/ioctls.h
> +++ b/arch/powerpc/include/uapi/asm/ioctls.h
> @@ -23,10 +23,10 @@
>  #define TCSETSW		_IOW('t', 21, struct termios)
>  #define TCSETSF		_IOW('t', 22, struct termios)
>  
> -#define TCGETA		_IOR('t', 23, struct termio)
> -#define TCSETA		_IOW('t', 24, struct termio)
> -#define TCSETAW		_IOW('t', 25, struct termio)
> -#define TCSETAF		_IOW('t', 28, struct termio)
> +#define TCGETA		0x40147417 /* _IOR('t', 23, struct termio) */
> +#define TCSETA		0x80147418 /* _IOW('t', 24, struct termio) */
> +#define TCSETAW		0x80147419 /* _IOW('t', 25, struct termio) */
> +#define TCSETAF		0x8014741c /* _IOW('t', 28, struct termio) */

These values look right to me. And the values should never change, so
hard-coding them is a reasonable solution.

Reviewed-by: Michael Ellerman <mpe@ellerman.id.au>

cheers


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] powerpc: Fix struct termio related ioctl macros
  2025-05-20 10:36 ` Michael Ellerman
@ 2025-06-13 16:32   ` Justin Forbes
  2025-06-13 16:46     ` Madhavan Srinivasan
  0 siblings, 1 reply; 5+ messages in thread
From: Justin Forbes @ 2025-06-13 16:32 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Madhavan Srinivasan, npiggin, christophe.leroy, naveen,
	linuxppc-dev, Tulio Magno

On Tue, May 20, 2025 at 08:36:18PM +1000, Michael Ellerman wrote:
> Madhavan Srinivasan <maddy@linux.ibm.com> writes:
> > Since termio interface is now obsolete, include/uapi/asm/ioctls.h
> > has some constant macros referring to "struct termio", this caused
> > build failure at userspace.
> >
> > In file included from /usr/include/asm/ioctl.h:12,
> >                  from /usr/include/asm/ioctls.h:5,
> >                  from tst-ioctls.c:3:
> > tst-ioctls.c: In function 'get_TCGETA':
> > tst-ioctls.c:12:10: error: invalid application of 'sizeof' to incomplete type 'struct termio'
> >    12 |   return TCGETA;
> >       |          ^~~~~~
> >
> > Even though termios.h provides "struct termio", trying to juggle definitions around to
> > make it compile could introduce regressions. So better to open code it.
> >
> > Reported-by: Tulio Magno <tuliom@ascii.art.br>
> > Closes: https://lore.kernel.org/linuxppc-dev/8734dji5wl.fsf@ascii.art.br/
> > Suggested-by: Nicholas Piggin <npiggin@gmail.com>
> > Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
> > ---
> > Changelog v1:
> > - mpe pointing out mistake in hardcoded values.
> >   Fixed the same.
> >
> >  arch/powerpc/include/uapi/asm/ioctls.h | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/powerpc/include/uapi/asm/ioctls.h b/arch/powerpc/include/uapi/asm/ioctls.h
> > index 2c145da3b774..b5211e413829 100644
> > --- a/arch/powerpc/include/uapi/asm/ioctls.h
> > +++ b/arch/powerpc/include/uapi/asm/ioctls.h
> > @@ -23,10 +23,10 @@
> >  #define TCSETSW		_IOW('t', 21, struct termios)
> >  #define TCSETSF		_IOW('t', 22, struct termios)
> >  
> > -#define TCGETA		_IOR('t', 23, struct termio)
> > -#define TCSETA		_IOW('t', 24, struct termio)
> > -#define TCSETAW		_IOW('t', 25, struct termio)
> > -#define TCSETAF		_IOW('t', 28, struct termio)
> > +#define TCGETA		0x40147417 /* _IOR('t', 23, struct termio) */
> > +#define TCSETA		0x80147418 /* _IOW('t', 24, struct termio) */
> > +#define TCSETAW		0x80147419 /* _IOW('t', 25, struct termio) */
> > +#define TCSETAF		0x8014741c /* _IOW('t', 28, struct termio) */
> 
> These values look right to me. And the values should never change, so
> hard-coding them is a reasonable solution.
> 
> Reviewed-by: Michael Ellerman <mpe@ellerman.id.au>

Has this been forgotten? We are having to carry it for userspace to
continue, and this should really be pushed to Linus.

Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>

> 
> cheers
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] powerpc: Fix struct termio related ioctl macros
  2025-06-13 16:32   ` Justin Forbes
@ 2025-06-13 16:46     ` Madhavan Srinivasan
  0 siblings, 0 replies; 5+ messages in thread
From: Madhavan Srinivasan @ 2025-06-13 16:46 UTC (permalink / raw)
  To: Justin Forbes, Michael Ellerman
  Cc: npiggin, christophe.leroy, naveen, linuxppc-dev, Tulio Magno



On 6/13/25 10:02 PM, Justin Forbes wrote:
> On Tue, May 20, 2025 at 08:36:18PM +1000, Michael Ellerman wrote:
>> Madhavan Srinivasan <maddy@linux.ibm.com> writes:
>>> Since termio interface is now obsolete, include/uapi/asm/ioctls.h
>>> has some constant macros referring to "struct termio", this caused
>>> build failure at userspace.
>>>
>>> In file included from /usr/include/asm/ioctl.h:12,
>>>                  from /usr/include/asm/ioctls.h:5,
>>>                  from tst-ioctls.c:3:
>>> tst-ioctls.c: In function 'get_TCGETA':
>>> tst-ioctls.c:12:10: error: invalid application of 'sizeof' to incomplete type 'struct termio'
>>>    12 |   return TCGETA;
>>>       |          ^~~~~~
>>>
>>> Even though termios.h provides "struct termio", trying to juggle definitions around to
>>> make it compile could introduce regressions. So better to open code it.
>>>
>>> Reported-by: Tulio Magno <tuliom@ascii.art.br>
>>> Closes: https://lore.kernel.org/linuxppc-dev/8734dji5wl.fsf@ascii.art.br/
>>> Suggested-by: Nicholas Piggin <npiggin@gmail.com>
>>> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
>>> ---
>>> Changelog v1:
>>> - mpe pointing out mistake in hardcoded values.
>>>   Fixed the same.
>>>
>>>  arch/powerpc/include/uapi/asm/ioctls.h | 8 ++++----
>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/arch/powerpc/include/uapi/asm/ioctls.h b/arch/powerpc/include/uapi/asm/ioctls.h
>>> index 2c145da3b774..b5211e413829 100644
>>> --- a/arch/powerpc/include/uapi/asm/ioctls.h
>>> +++ b/arch/powerpc/include/uapi/asm/ioctls.h
>>> @@ -23,10 +23,10 @@
>>>  #define TCSETSW		_IOW('t', 21, struct termios)
>>>  #define TCSETSF		_IOW('t', 22, struct termios)
>>>  
>>> -#define TCGETA		_IOR('t', 23, struct termio)
>>> -#define TCSETA		_IOW('t', 24, struct termio)
>>> -#define TCSETAW		_IOW('t', 25, struct termio)
>>> -#define TCSETAF		_IOW('t', 28, struct termio)
>>> +#define TCGETA		0x40147417 /* _IOR('t', 23, struct termio) */
>>> +#define TCSETA		0x80147418 /* _IOW('t', 24, struct termio) */
>>> +#define TCSETAW		0x80147419 /* _IOW('t', 25, struct termio) */
>>> +#define TCSETAF		0x8014741c /* _IOW('t', 28, struct termio) */
>>
>> These values look right to me. And the values should never change, so
>> hard-coding them is a reasonable solution.
>>
>> Reviewed-by: Michael Ellerman <mpe@ellerman.id.au>
> 
> Has this been forgotten? We are having to carry it for userspace to
> continue, and this should really be pushed to Linus.
> 
> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
> 

My bad, I will add this to my fixes-test
and sent it as part of my next fixes PR

Maddy



>>
>> cheers
>>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] powerpc: Fix struct termio related ioctl macros
  2025-05-17 14:22 [PATCH v2] powerpc: Fix struct termio related ioctl macros Madhavan Srinivasan
  2025-05-20 10:36 ` Michael Ellerman
@ 2025-06-15  2:39 ` Madhavan Srinivasan
  1 sibling, 0 replies; 5+ messages in thread
From: Madhavan Srinivasan @ 2025-06-15  2:39 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, Madhavan Srinivasan
  Cc: naveen, linuxppc-dev, Tulio Magno

On Sat, 17 May 2025 19:52:37 +0530, Madhavan Srinivasan wrote:
> Since termio interface is now obsolete, include/uapi/asm/ioctls.h
> has some constant macros referring to "struct termio", this caused
> build failure at userspace.
> 
> In file included from /usr/include/asm/ioctl.h:12,
>                  from /usr/include/asm/ioctls.h:5,
>                  from tst-ioctls.c:3:
> tst-ioctls.c: In function 'get_TCGETA':
> tst-ioctls.c:12:10: error: invalid application of 'sizeof' to incomplete type 'struct termio'
>    12 |   return TCGETA;
>       |          ^~~~~~
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc: Fix struct termio related ioctl macros
      https://git.kernel.org/powerpc/c/ab107276607af90b13a5994997e19b7b9731e251

Thanks


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-15  2:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-17 14:22 [PATCH v2] powerpc: Fix struct termio related ioctl macros Madhavan Srinivasan
2025-05-20 10:36 ` Michael Ellerman
2025-06-13 16:32   ` Justin Forbes
2025-06-13 16:46     ` Madhavan Srinivasan
2025-06-15  2:39 ` Madhavan Srinivasan

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).