[patch] /proc/pci

Jeff Garzik (garzik@pobox.com)
Tue, 31 Aug 1999 04:22:21 -0400 (EDT)


The attached patch fixes /proc/pci. It also adds a lazy update of the
/proc/pci dir entry size, with the size of get_pci_list() output. I
always liked how mtrr report its output size in /proc.

Jeff

diff -urN linux-2.3.16-pre1/fs/proc/array.c linux/fs/proc/array.c
--- linux-2.3.16-pre1/fs/proc/array.c Mon Aug 30 23:06:12 1999
+++ linux/fs/proc/array.c Tue Aug 31 04:08:57 1999
@@ -1350,7 +1350,7 @@
case PROC_MEMINFO:
return get_meminfo(page);

-#ifdef CONFIG_PCI_OLD_PROC
+#ifdef CONFIG_PCI
case PROC_PCI:
return get_pci_list(page);
#endif
diff -urN linux-2.3.16-pre1/drivers/pci/proc.c linux/drivers/pci/proc.c
--- linux-2.3.16-pre1/drivers/pci/proc.c Mon Aug 30 23:06:03 1999
+++ linux/drivers/pci/proc.c Tue Aug 31 04:08:57 1999
@@ -546,6 +546,12 @@
}


+static struct proc_dir_entry proc_old_pci = {
+ PROC_PCI, 3, "pci",
+ S_IFREG | S_IRUGO, 1, 0, 0,
+ 0, &proc_array_inode_operations
+};
+
/*
* Return list of PCI devices as a character string for /proc/pci.
* BUF is a buffer that is PAGE_SIZE bytes long.
@@ -563,18 +569,15 @@
for (dev = pci_devices; dev; dev = dev->next) {
nprinted = sprint_dev_config(dev, buf + len, size - len);
if (nprinted < 0) {
- return len + sprintf(buf + len, MSG);
+ len += sprintf(buf + len, MSG);
+ proc_old_pci.size = len;
+ return len;
}
len += nprinted;
}
+ proc_old_pci.size = len;
return len;
}
-
-static struct proc_dir_entry proc_old_pci = {
- PROC_PCI, 3, "pci",
- S_IFREG | S_IRUGO, 1, 0, 0,
- 0, &proc_array_inode_operations
-};

static int __init pci_proc_init(void)
{

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/