mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
vsprintf: Make %pGp print the hex value
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. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Yafang Shao <laoar.shao@gmail.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20211019142621.2810043-6-willy@infradead.org
This commit is contained in:
committed by
Petr Mladek
parent
507f986036
commit
23efd0804c
@@ -609,10 +609,14 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
|
||||
char *cmp_buf)
|
||||
{
|
||||
unsigned long values[] = {section, node, zone, last_cpupid, kasan_tag};
|
||||
unsigned long size = 0;
|
||||
unsigned long size;
|
||||
bool append = false;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(values); i++)
|
||||
flags |= (values[i] & pft[i].mask) << pft[i].shift;
|
||||
|
||||
size = scnprintf(cmp_buf, BUF_SIZE, "%#lx(", flags);
|
||||
if (flags & PAGEFLAGS_MASK) {
|
||||
size += scnprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
|
||||
append = true;
|
||||
@@ -625,7 +629,6 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
|
||||
if (append)
|
||||
size += scnprintf(cmp_buf + size, BUF_SIZE - size, "|");
|
||||
|
||||
flags |= (values[i] & pft[i].mask) << pft[i].shift;
|
||||
size += scnprintf(cmp_buf + size, BUF_SIZE - size, "%s=",
|
||||
pft[i].name);
|
||||
size += scnprintf(cmp_buf + size, BUF_SIZE - size, pft[i].fmt,
|
||||
@@ -633,6 +636,8 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
|
||||
append = true;
|
||||
}
|
||||
|
||||
snprintf(cmp_buf + size, BUF_SIZE - size, ")");
|
||||
|
||||
test(cmp_buf, "%pGp", &flags);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user