diff mbox series

[v2,1/3] tools/nolibc/stdio: Implement vprintf()

Message ID 20230405-kselftest-nolibc-v2-1-2ac2495814b5@kernel.org (mailing list archive)
State New, archived
Headers show
Series tools/nolibc: Support vprintf() so we can use kselftest.h with nolibc | expand

Commit Message

Mark Brown April 6, 2023, 4:19 p.m. UTC
vprintf() is equivalent to vfprintf() to stdout so implement it as a simple
wrapper for the existing vfprintf(), allowing us to build kselftest.h.

Suggested-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/include/nolibc/stdio.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Willy Tarreau April 6, 2023, 6:26 p.m. UTC | #1
On Thu, Apr 06, 2023 at 05:19:10PM +0100, Mark Brown wrote:
> vprintf() is equivalent to vfprintf() to stdout so implement it as a simple
> wrapper for the existing vfprintf(), allowing us to build kselftest.h.
> 
> Suggested-by: Willy Tarreau <w@1wt.eu>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  tools/include/nolibc/stdio.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h
> index 96ac8afc5aee..6cbbb52836a0 100644
> --- a/tools/include/nolibc/stdio.h
> +++ b/tools/include/nolibc/stdio.h
> @@ -273,6 +273,12 @@ int vfprintf(FILE *stream, const char *fmt, va_list args)
>  	return written;
>  }
>  
> +static __attribute__((unused))
> +int vprintf(const char *fmt, va_list args)
> +{
> +	return vfprintf(stdout, fmt, args);
> +}
> +
>  static __attribute__((unused, format(printf, 2, 3)))
>  int fprintf(FILE *stream, const char *fmt, ...)
>  {

Perfect, thank you Mark, I'm glad that it simplified the rest of
your series.

Acked-by: Willy Tarreau <w@1wt.eu>

Paul, feel free to directly queue this one for 6.5. If you prefer I
can as well queue it on my side and send it later, it's just that I
have exactly zero extra value on top of this one ;-)

Thanks,
Willy
Paul E. McKenney April 6, 2023, 6:43 p.m. UTC | #2
On Thu, Apr 06, 2023 at 08:26:09PM +0200, Willy Tarreau wrote:
> On Thu, Apr 06, 2023 at 05:19:10PM +0100, Mark Brown wrote:
> > vprintf() is equivalent to vfprintf() to stdout so implement it as a simple
> > wrapper for the existing vfprintf(), allowing us to build kselftest.h.
> > 
> > Suggested-by: Willy Tarreau <w@1wt.eu>
> > Signed-off-by: Mark Brown <broonie@kernel.org>
> > ---
> >  tools/include/nolibc/stdio.h | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h
> > index 96ac8afc5aee..6cbbb52836a0 100644
> > --- a/tools/include/nolibc/stdio.h
> > +++ b/tools/include/nolibc/stdio.h
> > @@ -273,6 +273,12 @@ int vfprintf(FILE *stream, const char *fmt, va_list args)
> >  	return written;
> >  }
> >  
> > +static __attribute__((unused))
> > +int vprintf(const char *fmt, va_list args)
> > +{
> > +	return vfprintf(stdout, fmt, args);
> > +}
> > +
> >  static __attribute__((unused, format(printf, 2, 3)))
> >  int fprintf(FILE *stream, const char *fmt, ...)
> >  {
> 
> Perfect, thank you Mark, I'm glad that it simplified the rest of
> your series.
> 
> Acked-by: Willy Tarreau <w@1wt.eu>
> 
> Paul, feel free to directly queue this one for 6.5. If you prefer I
> can as well queue it on my side and send it later, it's just that I
> have exactly zero extra value on top of this one ;-)

Alternatively, if it would be more convenient for Mark to send this
up via kselftest:

Acked-by: Paul E. McKenney <paulmck@kernel.org>

It currently merges cleanly with the -rcu tree's dev branch, so this
should not be a problem.

Either way, please let me know, Mark!

							Thanx, Paul
Shuah Khan April 10, 2023, 6:30 p.m. UTC | #3
On 4/6/23 12:43, Paul E. McKenney wrote:
> On Thu, Apr 06, 2023 at 08:26:09PM +0200, Willy Tarreau wrote:
>> On Thu, Apr 06, 2023 at 05:19:10PM +0100, Mark Brown wrote:
>>> vprintf() is equivalent to vfprintf() to stdout so implement it as a simple
>>> wrapper for the existing vfprintf(), allowing us to build kselftest.h.
>>>
>>> Suggested-by: Willy Tarreau <w@1wt.eu>
>>> Signed-off-by: Mark Brown <broonie@kernel.org>
>>> ---
>>>   tools/include/nolibc/stdio.h | 6 ++++++
>>>   1 file changed, 6 insertions(+)
>>>
>>> diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h
>>> index 96ac8afc5aee..6cbbb52836a0 100644
>>> --- a/tools/include/nolibc/stdio.h
>>> +++ b/tools/include/nolibc/stdio.h
>>> @@ -273,6 +273,12 @@ int vfprintf(FILE *stream, const char *fmt, va_list args)
>>>   	return written;
>>>   }
>>>   
>>> +static __attribute__((unused))
>>> +int vprintf(const char *fmt, va_list args)
>>> +{
>>> +	return vfprintf(stdout, fmt, args);
>>> +}
>>> +
>>>   static __attribute__((unused, format(printf, 2, 3)))
>>>   int fprintf(FILE *stream, const char *fmt, ...)
>>>   {
>>
>> Perfect, thank you Mark, I'm glad that it simplified the rest of
>> your series.
>>
>> Acked-by: Willy Tarreau <w@1wt.eu>
>>
>> Paul, feel free to directly queue this one for 6.5. If you prefer I
>> can as well queue it on my side and send it later, it's just that I
>> have exactly zero extra value on top of this one ;-)
> 
> Alternatively, if it would be more convenient for Mark to send this
> up via kselftest:
> 
> Acked-by: Paul E. McKenney <paulmck@kernel.org>
> 
> It currently merges cleanly with the -rcu tree's dev branch, so this
> should not be a problem.
> 
> Either way, please let me know, Mark!
> 
> 						

I can take these through kselftest or can go through arm64

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah
Mark Brown April 11, 2023, 2:31 p.m. UTC | #4
On Mon, Apr 10, 2023 at 12:30:04PM -0600, Shuah Khan wrote:
> On 4/6/23 12:43, Paul E. McKenney wrote:

> > Alternatively, if it would be more convenient for Mark to send this
> > up via kselftest:

> > Acked-by: Paul E. McKenney <paulmck@kernel.org>

> > It currently merges cleanly with the -rcu tree's dev branch, so this
> > should not be a problem.

> > Either way, please let me know, Mark!

> I can take these through kselftest or can go through arm64

> Acked-by: Shuah Khan <skhan@linuxfoundation.org>

It seems like more of a kselftest change than anything else so probably
makes sense for it to go that way?  The example user isn't really even
needed.
Will Deacon April 11, 2023, 3:03 p.m. UTC | #5
On Tue, Apr 11, 2023 at 03:31:10PM +0100, Mark Brown wrote:
> On Mon, Apr 10, 2023 at 12:30:04PM -0600, Shuah Khan wrote:
> > On 4/6/23 12:43, Paul E. McKenney wrote:
> 
> > > Alternatively, if it would be more convenient for Mark to send this
> > > up via kselftest:
> 
> > > Acked-by: Paul E. McKenney <paulmck@kernel.org>
> 
> > > It currently merges cleanly with the -rcu tree's dev branch, so this
> > > should not be a problem.
> 
> > > Either way, please let me know, Mark!
> 
> > I can take these through kselftest or can go through arm64
> 
> > Acked-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> It seems like more of a kselftest change than anything else so probably
> makes sense for it to go that way?  The example user isn't really even
> needed.

Fine by me, as long as it doesn't conflict with any other arm64 selftest
changes you hope to land for 6.4.

Will
Mark Brown April 11, 2023, 3:13 p.m. UTC | #6
On Tue, Apr 11, 2023 at 04:03:21PM +0100, Will Deacon wrote:
> On Tue, Apr 11, 2023 at 03:31:10PM +0100, Mark Brown wrote:

> > It seems like more of a kselftest change than anything else so probably
> > makes sense for it to go that way?  The example user isn't really even
> > needed.

> Fine by me, as long as it doesn't conflict with any other arm64 selftest
> changes you hope to land for 6.4.

That shouldn't be an issue.
Paul E. McKenney April 11, 2023, 4:44 p.m. UTC | #7
On Tue, Apr 11, 2023 at 04:13:11PM +0100, Mark Brown wrote:
> On Tue, Apr 11, 2023 at 04:03:21PM +0100, Will Deacon wrote:
> > On Tue, Apr 11, 2023 at 03:31:10PM +0100, Mark Brown wrote:
> 
> > > It seems like more of a kselftest change than anything else so probably
> > > makes sense for it to go that way?  The example user isn't really even
> > > needed.
> 
> > Fine by me, as long as it doesn't conflict with any other arm64 selftest
> > changes you hope to land for 6.4.
> 
> That shouldn't be an issue.

Shuah, looks to me like this one is yours in kselftest, then.  ;-)

							Thanx, Paul
Shuah Khan April 11, 2023, 6:54 p.m. UTC | #8
On 4/11/23 10:44, Paul E. McKenney wrote:
> On Tue, Apr 11, 2023 at 04:13:11PM +0100, Mark Brown wrote:
>> On Tue, Apr 11, 2023 at 04:03:21PM +0100, Will Deacon wrote:
>>> On Tue, Apr 11, 2023 at 03:31:10PM +0100, Mark Brown wrote:
>>
>>>> It seems like more of a kselftest change than anything else so probably
>>>> makes sense for it to go that way?  The example user isn't really even
>>>> needed.
>>
>>> Fine by me, as long as it doesn't conflict with any other arm64 selftest
>>> changes you hope to land for 6.4.
>>
>> That shouldn't be an issue.
> 
> Shuah, looks to me like this one is yours in kselftest, then.  ;-)
> 
> 							Thanx, Paul

I will pick these up for Linux 6.4
thanks,
-- Shuah
Will Deacon April 11, 2023, 9:06 p.m. UTC | #9
On Tue, Apr 11, 2023 at 12:54:29PM -0600, Shuah Khan wrote:
> On 4/11/23 10:44, Paul E. McKenney wrote:
> > On Tue, Apr 11, 2023 at 04:13:11PM +0100, Mark Brown wrote:
> > > On Tue, Apr 11, 2023 at 04:03:21PM +0100, Will Deacon wrote:
> > > > On Tue, Apr 11, 2023 at 03:31:10PM +0100, Mark Brown wrote:
> > > 
> > > > > It seems like more of a kselftest change than anything else so probably
> > > > > makes sense for it to go that way?  The example user isn't really even
> > > > > needed.
> > > 
> > > > Fine by me, as long as it doesn't conflict with any other arm64 selftest
> > > > changes you hope to land for 6.4.
> > > 
> > > That shouldn't be an issue.
> > 
> > Shuah, looks to me like this one is yours in kselftest, then.  ;-)
> > 
> > 							Thanx, Paul
> 
> I will pick these up for Linux 6.4

Cheers, Shuah!

Will
diff mbox series

Patch

diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h
index 96ac8afc5aee..6cbbb52836a0 100644
--- a/tools/include/nolibc/stdio.h
+++ b/tools/include/nolibc/stdio.h
@@ -273,6 +273,12 @@  int vfprintf(FILE *stream, const char *fmt, va_list args)
 	return written;
 }
 
+static __attribute__((unused))
+int vprintf(const char *fmt, va_list args)
+{
+	return vfprintf(stdout, fmt, args);
+}
+
 static __attribute__((unused, format(printf, 2, 3)))
 int fprintf(FILE *stream, const char *fmt, ...)
 {