public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.
@ 2004-01-15  3:28 Kieran Morrissey
  2004-01-15  4:05 ` Jeff Garzik
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Kieran Morrissey @ 2004-01-15  3:28 UTC (permalink / raw)
  To: greg KH; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2397 bytes --]

Hi all and sundry..

Although /proc/pci and by extension the name database is allegedly legacy 
and therefore deprecated, some (including myself) still use it for things 
such as phpSysInfo, and the still-widespread usage of it is obvious in the 
regularity of slight patches to pci.ids. So, this is an all-inclusive patch 
to bring things up to date:

* Updates pci.ids with a snapshot from http://pciids.sourceforge.net/ as at 
14 Jan 04.
* Fixes gen-devlist.c to truncate long device names rather than reject the 
whole database
   (previously the latest databases had some devices that were too long and 
caused a kernel with the latest db to fail to compile)

I've included the (minor) changes to gen-devlist.c in this email if anyone 
cares to discuss them, but since the pci database changes aren't really 
that worthy of discussion on the list and the patch is 83kb, THE COMPLETE 
PATCH has been posted on the web:

http://digital.mgpenguin.net/linux/patch-2.6.1.pci-db/patch.2.6.1.pci-db.diff

or http://digital.mgpenguin.net/linux/ for bzipped versions if you're that 
way inclined..

Cheers,

	Kieran Morrissey


diff -urN -X dontdiff a/drivers/pci/gen-devlist.c b/drivers/pci/gen-devlist.c
--- a/drivers/pci/gen-devlist.c	2003-12-18 13:58:49.000000000 +1100
+++ b/drivers/pci/gen-devlist.c	2004-01-15 13:30:54.929783941 +1100
@@ -10,9 +10,10 @@
  #define MAX_NAME_SIZE 79

  static void
-pq(FILE *f, const char *c)
+pq(FILE *f, const char *c, int len)
  {
-	while (*c) {
+	int i = 1;
+	while (*c && i != len) {
  		if (*c == '"')
  			fprintf(f, "\\\"");
  		else {
@@ -23,6 +24,7 @@
  			}
  		}
  		c++;
+		i++;
  	}
  }

@@ -72,13 +74,13 @@
  						if (bra && bra > c && bra[-1] == ' ')
  							bra[-1] = 0;
  						if (vendor_len + strlen(c) + 1 > MAX_NAME_SIZE) {
-							fprintf(stderr, "Line %d: Device name too long\n", lino);
+							fprintf(stderr, "Line %d: Device name too long. Name truncated.\n", 
lino);
  							fprintf(stderr, "%s\n", c);
-							return 1;
+							/*return 1;*/
  						}
  					}
  					fprintf(devf, "\tDEVICE(%s,%s,\"", vend, line+1);
-					pq(devf, c);
+					pq(devf, c, MAX_NAME_SIZE - vendor_len - 1);
  					fputs("\")\n", devf);
  				} else goto err;
  				break;
@@ -107,7 +109,7 @@
  				return 1;
  			}
  			fprintf(devf, "VENDOR(%s,\"", vend);
-			pq(devf, c);
+			pq(devf, c, 0);
  			fputs("\")\n", devf);
  			mode = 1;
  		} else {

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-01-20  5:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-15  3:28 [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names Kieran Morrissey
2004-01-15  4:05 ` Jeff Garzik
2004-01-15  9:17   ` Ingo Oeser
2004-01-16  1:23   ` Greg KH
2004-01-16  4:25     ` Dave Jones
2004-01-20  1:29       ` Greg KH
2004-01-16  1:24 ` Greg KH
2004-01-17 10:39 ` Martin Mares
2004-01-20  1:30   ` Greg KH
2004-01-20  5:07     ` Kieran Morrissey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox