diff mbox

lspci tries to open non-existent files

Message ID 20090630132704.GW5480@parisc-linux.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Matthew Wilcox June 30, 2009, 1:27 p.m. UTC
On Tue, Jun 30, 2009 at 02:39:48PM +0200, Martin Mares wrote:
> Hi!
> 
> > Change the warning to an error; there's no point in proceeding.
> 
> Well, I have used it when debugging the bus mapper several times, so I would
> prefer keeping it as a warning. The addition of PCI_ACCESS_SYS_BUS_PCI is
> of course correct.

Fair enough.  How about this patch instead which adds a -MM option to
permit the debugging use?  I also reworded the help text for -M.

Comments

Martin Mareš July 4, 2009, 2:16 p.m. UTC | #1
Hi!

> Fair enough.  How about this patch instead which adds a -MM option to
> permit the debugging use?  I also reworded the help text for -M.

I do not think that an occassional user who shoots himself in the foot,
because he does not see the warning, is a good enough reason for adding
yet another option.

I have extended the check to include PCI_ACCESS_SYS_BUS_PCI and improved
the help text, but I would prefer to keep the warning.

				Have a nice fortnight
diff mbox

Patch

diff --git a/ls-map.c b/ls-map.c
index c812f50..e3cc041 100644
--- a/ls-map.c
+++ b/ls-map.c
@@ -161,11 +161,15 @@  map_bridges(void)
 }
 
 void
-map_the_bus(void)
+map_the_bus(int map_mode)
 {
   if (pacc->method == PCI_ACCESS_PROC_BUS_PCI ||
+      pacc->method == PCI_ACCESS_SYS_BUS_PCI ||
       pacc->method == PCI_ACCESS_DUMP)
-    printf("WARNING: Bus mapping can be reliable only with direct hardware access enabled.\n\n");
+  if (map_mode > 1)
+    pacc->warning("Bus mapping only works properly with direct hardware access");
+  else
+    pacc->error("Bus mapping only works with direct hardware access");
   bus_info = xmalloc(sizeof(struct bus_info) * 256);
   memset(bus_info, 0, sizeof(struct bus_info) * 256);
   if (filter.bus >= 0)
diff --git a/lspci.c b/lspci.c
index e453f1b..7033ef4 100644
--- a/lspci.c
+++ b/lspci.c
@@ -1005,7 +1005,7 @@  main(int argc, char **argv)
 
   pci_init(pacc);
   if (opt_map_mode)
-    map_the_bus();
+    map_the_bus(opt_map_mode);
   else
     {
       scan_devices();
diff --git a/lspci.h b/lspci.h
index c498b7c..844a800 100644
--- a/lspci.h
+++ b/lspci.h
@@ -77,4 +77,4 @@  void show_forest(void);
 
 /* ls-map.c */
 
-void map_the_bus(void);
+void map_the_bus(int map_mode);
diff --git a/lspci.man b/lspci.man
index 441bc2b..4099940 100644
--- a/lspci.man
+++ b/lspci.man
@@ -157,11 +157,14 @@  as the map of PCI ID's handled by kernel modules. By default, lspci uses
 Applies only to Linux systems with recent enough module tools.
 .TP
 .B -M
-Invoke bus mapping mode which performs a thorough scan of all PCI devices, including
-those behind misconfigured bridges etc. This option is available only to root and it
-gives meaningful results only if combined with direct hardware access mode (otherwise
-the results are identical to normal listing modes, modulo bugs in lspci). Please note
-that the bus mapper doesn't support PCI domains and scans only domain 0.
+Invoke bus mapping mode which performs a thorough scan of all PCI devices,
+including those behind misconfigured bridges, etc.  This option only works
+with a direct hardware access mode, which usually requires root privileges.
+Please note that the bus mapper only scans PCI domain 0.
+.TP
+.B -MM
+Forces bus mapping mode to try even without a direct hardware access mode.
+The results may not be very useful.
 .TP
 .B --version
 Shows