[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] Add grub_qdprintf() - grub_dprintf() without the file+li
From: |
Glenn Washburn |
Subject: |
Re: [PATCH 1/2] Add grub_qdprintf() - grub_dprintf() without the file+line number. |
Date: |
Tue, 12 Oct 2021 01:14:52 -0500 |
On Mon, 11 Oct 2021 14:48:43 -0400
Robbie Harwood <rharwood@redhat.com> wrote:
> From: Peter Jones <pjones@redhat.com>
>
> This just makes copy+paste of our debug loading info easier.
>
> Signed-off-by: Peter Jones <pjones@redhat.com>
> Signed-off-by: Robbie Harwood <rharwood@redhat.com>
> ---
> grub-core/kern/misc.c | 18 ++++++++++++++++++
> include/grub/misc.h | 2 ++
> 2 files changed, 20 insertions(+)
>
> diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
> index 3af336ee2..633fb48ec 100644
> --- a/grub-core/kern/misc.c
> +++ b/grub-core/kern/misc.c
> @@ -190,6 +190,24 @@ grub_real_dprintf (const char *file, const int line,
> const char *condition,
> }
> }
>
> +void
> +grub_qdprintf (const char *condition, const char *fmt, ...)
> +{
> + va_list args;
> + const char *debug = grub_env_get ("debug");
> +
> + if (! debug)
> + return;
> +
> + if (grub_strword (debug, "all") || grub_strword (debug, condition))
Is there a good reason why this is done like this instead of using
grub_debug_enabled as in grub_real_dprintf.
> + {
> + va_start (args, fmt);
> + grub_vprintf (fmt, args);
> + va_end (args);
> + grub_refresh ();
> + }
I don't particularly like, that this function is mostly a copy of
grub_real_dprintf. What about modifying grub_real_dprintf to not print
the file:line if file == NULL? Then have grub_qdprintf be a macro to
grub_real_dprintf as grub_dprintf is. This would obviate the concern
above.
> +}
> +
> #define PREALLOC_SIZE 255
>
> int
> diff --git a/include/grub/misc.h b/include/grub/misc.h
> index 7d2b55196..b9b22b2ec 100644
> --- a/include/grub/misc.h
> +++ b/include/grub/misc.h
> @@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
> const int line,
> const char *condition,
> const char *fmt, ...) __attribute__
> ((format (GNU_PRINTF, 4, 5)));
> +void EXPORT_FUNC(grub_qdprintf) (const char *condition,
> + const char *fmt, ...) __attribute__ ((format
> (GNU_PRINTF, 2, 3)));
> int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
> int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt,
> ...)
> __attribute__ ((format (GNU_PRINTF, 3, 4)));
Glenn
- [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., (continued)
- [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Robbie Harwood, 2021/10/11
- Re: [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Glenn Washburn, 2021/10/12
- Re: [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Robbie Harwood, 2021/10/14
- Re: [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Glenn Washburn, 2021/10/15
- Re: [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Robbie Harwood, 2021/10/15
- Re: [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Glenn Washburn, 2021/10/15
- Re: [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Robbie Harwood, 2021/10/19
- Re: [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Glenn Washburn, 2021/10/19
- Re: [PATCH 2/2] Make a "gdb" dprintf that tells us load addresses., Thomas Schmitt, 2021/10/20
[PATCH 1/2] Add grub_qdprintf() - grub_dprintf() without the file+line number., Robbie Harwood, 2021/10/11
- Re: [PATCH 1/2] Add grub_qdprintf() - grub_dprintf() without the file+line number.,
Glenn Washburn <=