Subject: [PATCH] PCI vendor and device strings in sysfs

Hi,

Here is a patch against 2.6.0-test1 to display PCI vendor and
device strings in sysfs.

At present, the PCI "name" attribute has a length restriction
(DEVICE_NAME_SIZE) within which it tries to accomodate the vendor
and device strings, leading to, in most cases, truncation of one
or both strings.

This patch alleviates the issue by creating the vendor_name and
device_name attributes for PCI devices.

Here is an example:

ananth@llm06:/sys/devices/pci0000:00/0000:00:01.0> cat name
Intel Corp. 82810 DC-100 CGC [Ch
ananth@llm06:/sys/devices/pci0000:00/0000:00:01.0> cat vendor_name
Intel Corp.
ananth@llm06:/sys/devices/pci0000:00/0000:00:01.0> cat device_name
82810 DC-100 CGC [Chipset Graphics Controller]

Thanks,
--
Ananth Narayan <[email protected]>
Linux Technology Center,
IBM Software Lab, INDIA


Attachments:
(No filename) (814.00 B)
km_pci.patch (4.80 kB)
Download all attachments

2003-07-17 14:36:59

by Patrick Mochel

[permalink] [raw]
Subject: Re: [PATCH] PCI vendor and device strings in sysfs


> Here is a patch against 2.6.0-test1 to display PCI vendor and
> device strings in sysfs.
>
> At present, the PCI "name" attribute has a length restriction
> (DEVICE_NAME_SIZE) within which it tries to accomodate the vendor
> and device strings, leading to, in most cases, truncation of one
> or both strings.
>
> This patch alleviates the issue by creating the vendor_name and
> device_name attributes for PCI devices.

We don't necessarily need to keep the ASCII strings around at all, and in
the case in which CONFIG_PCI_NAMES=n, they are completely irrelevant. They
are pretty, but we could just export the vendor/device IDs and have a
userspace tool (e.g. sysutils from IBM) look up the name in a userspace
database.


-pat

2003-07-18 02:23:35

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] PCI vendor and device strings in sysfs

On Thu, Jul 17, 2003 at 03:41:24PM +0530, Ananth N Mavinakayanahalli wrote:
> Hi,
>
> Here is a patch against 2.6.0-test1 to display PCI vendor and
> device strings in sysfs.
>
> At present, the PCI "name" attribute has a length restriction
> (DEVICE_NAME_SIZE) within which it tries to accomodate the vendor
> and device strings, leading to, in most cases, truncation of one
> or both strings.
>
> This patch alleviates the issue by creating the vendor_name and
> device_name attributes for PCI devices.

I agree with Pat, this should be done in userspace.

We should really just get rid of the dev->name file all together to keep
people from relying on it :)

thanks,

greg k-h