2004-01-15 03:28:36

by Kieran Morrissey

[permalink] [raw]
Subject: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

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 {


2004-01-15 04:05:43

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

Kieran Morrissey wrote:
> 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)


Well, appreciated, but we really do need to remove it. We don't need
these strings in the kernel at all. pci.ids is just a static lookup
table that is best kept in userspace.

Jeff



2004-01-15 09:20:16

by Ingo Oeser

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 15 January 2004 05:05, Jeff Garzik wrote:
> We don't need these strings in the kernel at all. pci.ids is just a
> static lookup table that is best kept in userspace.

Where it is always out of date, according to my experience. People tend
to update their kernel more often than lspci, so on most machines I've
been on, I usally point lspci to the kernel copy of it.

sth. needs to be done in this area in the main distros (e.g. more
frequent updates of just this file as a package would be fine).


Regards

Ingo Oeser

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFABlqhU56oYWuOrkARAs9AAKDhW5bfSVSV6VqpF1e7aDxgy3ZuQwCeKAk6
Bqu9S7eWlqtwLlimEA2Y0mE=
=Rvll
-----END PGP SIGNATURE-----

2004-01-16 01:26:55

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

On Wed, Jan 14, 2004 at 11:05:28PM -0500, Jeff Garzik wrote:
> Kieran Morrissey wrote:
> >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)
>
>
> Well, appreciated, but we really do need to remove it. We don't need
> these strings in the kernel at all. pci.ids is just a static lookup
> table that is best kept in userspace.

It will be removed in 2.7.

thanks,

greg k-h

2004-01-16 01:26:51

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

On Thu, Jan 15, 2004 at 02:28:39PM +1100, Kieran Morrissey wrote:
> 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)

Your patch is line-wrapped and can't be applied.

Please try it again.

> 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

Feel free to just send this patch to me, as it's much easier for me to
apply this if I get an email with it in it (include the description
please too.)

thanks,

greg k-h

2004-01-16 04:25:42

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

On Thu, Jan 15, 2004 at 05:23:14PM -0800, Greg KH wrote:

> > Well, appreciated, but we really do need to remove it. We don't need
> > these strings in the kernel at all. pci.ids is just a static lookup
> > table that is best kept in userspace.
>
> It will be removed in 2.7.

So I'm the only one with deja vu ?

My recollection of history went something like..

2.2 - Marked as OBSOLETE when /proc/bus/pci came to town.
iirc, even Martin Mares (PCI maintainer at the time) wanted
it removed in 2.3.x
2.3 - Linus decides he likes it, and wants to keep it.
2.4 - Unmarked OBSOLETE
2.5 - Silence, (though we now get PCI stuff in /sys too, woo!)
2.6 - "It will be removed in 2.7"

Anyone else spot a pattern ? 8-)

Dave

2004-01-17 10:39:04

by Martin Mares

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

Hello!

> * 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 think it would be better to increase the name length limit, the long entries
really have useful information at the end :)

Have a nice fortnight
--
Martin `MJ' Mares <[email protected]> http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth

2004-01-20 01:51:27

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

On Sat, Jan 17, 2004 at 11:39:00AM +0100, Martin Mares wrote:
> Hello!
>
> > * 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 think it would be better to increase the name length limit, the long entries
> really have useful information at the end :)

That's probably a good idea. Kieran, care to make up a patch to do
this?

thanks,

greg k-h

2004-01-20 01:51:26

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

On Fri, Jan 16, 2004 at 04:25:00AM +0000, Dave Jones wrote:
> On Thu, Jan 15, 2004 at 05:23:14PM -0800, Greg KH wrote:
>
> > > Well, appreciated, but we really do need to remove it. We don't need
> > > these strings in the kernel at all. pci.ids is just a static lookup
> > > table that is best kept in userspace.
> >
> > It will be removed in 2.7.
>
> So I'm the only one with deja vu ?
>
> My recollection of history went something like..
>
> 2.2 - Marked as OBSOLETE when /proc/bus/pci came to town.
> iirc, even Martin Mares (PCI maintainer at the time) wanted
> it removed in 2.3.x
> 2.3 - Linus decides he likes it, and wants to keep it.
> 2.4 - Unmarked OBSOLETE
> 2.5 - Silence, (though we now get PCI stuff in /sys too, woo!)

No, we tried in 2.5 too. Linus said it wanted to keep it as a CONFIG
option for now, so we can drop it in 2.7.

> 2.6 - "It will be removed in 2.7"
>
> Anyone else spot a pattern ? 8-)

Heh, well, we can try again :)

thanks,

greg k-h

2004-01-20 05:07:15

by Kieran Morrissey

[permalink] [raw]
Subject: Re: [PATCH] 2.6.1: Update PCI Name database, fix gen-devlist.c for long device names.

At 05:30 PM 19/01/2004 -0800, you wrote:

>On Sat, Jan 17, 2004 at 11:39:00AM +0100, Martin Mares wrote:
>> Hello!
>>
>> > * 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 think it would be better to increase the name length limit, the long entries
>> really have useful information at the end :)
>
>That's probably a good idea. Kieran, care to make up a patch to do
>this?
>
>thanks,
>
>greg k-h

Done (see other message).. but does anyone know why the name size limit was introduced in 2.5? Saving memory? (all of 30-odd bytes per device, say 480 bytes in an average system? seems silly to reduce functionality that much to achieve such a tiny space saving; I mean it's understandable perhaps on an embedded system, but you wouldn't be compiling the database in then :)

Cheers

Kieran