blob: 363d52a525362389c13d31e8e18b4ac50ebc65cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/perl
print q(/* This auto-generated from <pci.h>, don't modify! */
static struct {
unsigned short id;
const char *name;
} classes[] = {
);
/^#define\s+PCI_CLASS_(\w+)\s+(0x\w{4})/ and print qq( { $2, "$1" },\n) while <>;
print '
};
static int nb_classes = sizeof(classes) / sizeof(*classes);
#pragma GCC visibility push(default)
extern const char *pci_class2text(unsigned long class_id) {
int i;
for (i = 0; i < nb_classes; i++)
if (classes[i].id == class_id) return classes[i].name;
return pci_class2text(0);
}
#pragma GCC visibility pop
';
|