/[soft]/ldetect/trunk/generate_pciclass.pl
ViewVC logotype

Contents of /ldetect/trunk/generate_pciclass.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5446 - (show annotations) (download)
Thu Aug 30 10:35:48 2012 UTC (11 years, 7 months ago) by tv
File MIME type: text/plain
File size: 577 byte(s)
fix build on FC: generate PCI classes info using ids from pcutils header
instead of deprecated kernel header (Andrey Bondrov)
1 #!/usr/bin/perl
2
3 print q(/* This auto-generated from <pci.h>, don't modify! */
4
5 static struct {
6 unsigned short id;
7 const char *name;
8 } classes[] = {
9 );
10
11 /^#define\s+PCI_CLASS_(\w+)\s+(0x\w{4})/ and print qq( { $2, "$1" },\n) while <>;
12
13 print '
14 };
15
16 static int nb_classes = sizeof(classes) / sizeof(*classes);
17
18 #pragma GCC visibility push(default)
19 extern const char *pci_class2text(unsigned long class_id) {
20 int i;
21 for (i = 0; i < nb_classes; i++)
22 if (classes[i].id == class_id) return classes[i].name;
23
24 return pci_class2text(0);
25 }
26 #pragma GCC visibility pop
27
28 ';

  ViewVC Help
Powered by ViewVC 1.1.30