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

Contents of /ldetect/trunk/generate_pciclass.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1357 - (show annotations) (download)
Tue May 17 09:21:22 2011 UTC (10 years ago) by dmorgan
File MIME type: text/plain
File size: 575 byte(s)
Import  ldetect
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 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.28