[Pkg-pciutils-discuss] Re: [PATCH] Restore lspci -m formatting on machines with domains

Martin Mares mj at ucw.cz
Tue Mar 21 22:49:45 UTC 2006


> So I think the right solution is to partially revert to the previous
> behavior and always omit the "0000:" in -m mode (unless forced by -D).

Here is a patch.

				Have a nice fortnight
-- 
Martin `MJ' Mares   <mj at ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"I don't give a damn for a man that can only spell a word one way." -- M. Twain



--- orig/lspci.c
+++ mod/lspci.c
@@ -23,7 +23,7 @@
 static int show_tree;			/* Show bus tree */
 static int machine_readable;		/* Generate machine-readable output */
 static int map_mode;			/* Bus mapping mode enabled */
-static int show_domains;		/* Show domain numbers */
+static int show_domains;		/* Show domain numbers (0=disabled, 1=auto-detected, 2=requested) */
 
 static char options[] = "nvbxs:d:ti:mgMD" GENERIC_OPTIONS ;
 
@@ -243,7 +243,7 @@
 {
   struct pci_dev *p = d->dev;
 
-  if (show_domains)
+  if (!machine_readable ? show_domains : (p->domain || show_domains >= 2))
     printf("%04x:", p->domain);
   printf("%02x:%02x.%d", p->bus, p->dev, p->func);
 }
@@ -2322,7 +2322,7 @@
 	map_mode++;
 	break;
       case 'D':
-	show_domains = 1;
+	show_domains = 2;
 	break;
       default:
 	if (parse_generic_option(i, pacc, optarg))



More information about the Pkg-pciutils-discuss mailing list