Re: [PATCH 5/5] vsprintf: Make %pGp print the hex value
From: Petr Mladek <pmladek@suse.com>
Date: 2021-10-27 11:28:35
On Fri 2021-10-15 12:55:48, Petr Mladek wrote:
On Tue 2021-10-12 19:26:47, Matthew Wilcox (Oracle) wrote:quoted
All existing users of %pGp want the hex value as well as the decoded flag names. This looks awkward (passing the same parameter to printf twice), so move that functionality into the core. If we want, we can make that optional with flag arguments to %pGp in the future.It makes sense. Just the selftest code is pain, see below ;-)quoted
diff --git a/lib/test_printf.c b/lib/test_printf.c index 662c3785aa57..a60b1a749e87 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c@@ -613,6 +613,10 @@ page_flags_test(int section, int node, int zone, int last_cpupid, bool append = false; int i; + for (i = 0; i < ARRAY_SIZE(values); i++) + page_flags |= (values[i] & pft[i].mask) << pft[i].shift;I can't get the idea behind this. IMHO, the value might be zero even when the related flag is set. And the %pGp code seems to always print page flags from page_flags_fields[] when the field width is not zero. Or do I misread the code?
Just for record. I really did misread the code. It constructs flags from the given values. It does reverse operation to format_page_flags(). Best Regards, Petr