aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKelsey Skunberg <skunberg.kelsey@gmail.com>2019-06-19 10:48:58 -0600
committerMartin Mares <mj@ucw.cz>2020-01-21 21:49:13 +0100
commite6b0b6e1518dc383de76ce6c0afcb4291a6adfea (patch)
tree83c8806ce4f8922c268fb644dac023ecb39df34e
parent25f2e4db6ecad1868302bc27d5b1ec7d74a59c19 (diff)
downloadpciutils-e6b0b6e1518dc383de76ce6c0afcb4291a6adfea.tar.gz
lspci: Change output for bridge with empty range to "[disabled]"
Change output displayed for memory behind bridge when the range is empty to be consistent between each verbosity level. Replace "None" and "[empty]" with "[disabled]". Old and new output examples listed below for each verbosity level. Show_range() is not called unless verbose == true. No output given unless a verbose argument is provided. OLD output for -v and -vv which uses "None" and -vvv uses "[empty]": Memory behind bridge: None # lspci -v Memory behind bridge: None # lspci -vv Memory behind bridge: 0000e000-0000efff [empty] # lspci -vvv NEW output for -v, -vv, and -vvv to use "[disabled]": Memory behind bridge: [disabled] # lspci -v Memory behind bridge: [disabled] # lspci -vv Memory behind bridge: 0000e000-0000efff [disabled] # lspci -vvv Advantage is consistent output regardless of verbosity level chosen and to simplify the code. Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
-rw-r--r--lspci.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/lspci.c b/lspci.c
index 7418b07..525bb82 100644
--- a/lspci.c
+++ b/lspci.c
@@ -376,20 +376,18 @@ show_size(u64 x)
static void
show_range(char *prefix, u64 base, u64 limit, int is_64bit)
{
- if (base > limit && verbose < 3)
+ printf("%s:", prefix);
+ if (base <= limit || verbose > 2)
{
- printf("%s: None\n", prefix);
- return;
+ if (is_64bit)
+ printf(" %016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit);
+ else
+ printf(" %08x-%08x", (unsigned) base, (unsigned) limit);
}
- printf("%s: ", prefix);
- if (is_64bit)
- printf("%016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit);
- else
- printf("%08x-%08x", (unsigned) base, (unsigned) limit);
if (base <= limit)
show_size(limit - base + 1);
else
- printf(" [empty]");
+ printf(" [disabled]");
putchar('\n');
}