file2alias.c (3613047280ec42a4e1350fdc1a6dd161ff4008cc) file2alias.c (fa10f413091a43f801f82b3cf484f15d6fc9266f)
1/* Simple code to turn various tables in an ELF file into alias definitions.
2 * This deals with kernel datastructures where they should be
3 * dealt with: in the kernel source.
4 *
5 * Copyright 2002-2003 Rusty Russell, IBM Corporation
6 * 2003 Kai Germaschewski
7 *
8 *

--- 1444 unchanged lines hidden (view full) ---

1453}
1454
1455/* Looks like: cdx:vNdN */
1456static int do_cdx_entry(const char *filename, void *symval,
1457 char *alias)
1458{
1459 DEF_FIELD(symval, cdx_device_id, vendor);
1460 DEF_FIELD(symval, cdx_device_id, device);
1/* Simple code to turn various tables in an ELF file into alias definitions.
2 * This deals with kernel datastructures where they should be
3 * dealt with: in the kernel source.
4 *
5 * Copyright 2002-2003 Rusty Russell, IBM Corporation
6 * 2003 Kai Germaschewski
7 *
8 *

--- 1444 unchanged lines hidden (view full) ---

1453}
1454
1455/* Looks like: cdx:vNdN */
1456static int do_cdx_entry(const char *filename, void *symval,
1457 char *alias)
1458{
1459 DEF_FIELD(symval, cdx_device_id, vendor);
1460 DEF_FIELD(symval, cdx_device_id, device);
1461 DEF_FIELD(symval, cdx_device_id, subvendor);
1462 DEF_FIELD(symval, cdx_device_id, subdevice);
1463 DEF_FIELD(symval, cdx_device_id, class);
1464 DEF_FIELD(symval, cdx_device_id, class_mask);
1461 DEF_FIELD(symval, cdx_device_id, override_only);
1462
1463 switch (override_only) {
1464 case 0:
1465 strcpy(alias, "cdx:");
1466 break;
1467 case CDX_ID_F_VFIO_DRIVER_OVERRIDE:
1468 strcpy(alias, "vfio_cdx:");
1469 break;
1470 default:
1471 warn("Unknown CDX driver_override alias %08X\n",
1472 override_only);
1473 return 0;
1474 }
1475
1476 ADD(alias, "v", vendor != CDX_ANY_ID, vendor);
1477 ADD(alias, "d", device != CDX_ANY_ID, device);
1465 DEF_FIELD(symval, cdx_device_id, override_only);
1466
1467 switch (override_only) {
1468 case 0:
1469 strcpy(alias, "cdx:");
1470 break;
1471 case CDX_ID_F_VFIO_DRIVER_OVERRIDE:
1472 strcpy(alias, "vfio_cdx:");
1473 break;
1474 default:
1475 warn("Unknown CDX driver_override alias %08X\n",
1476 override_only);
1477 return 0;
1478 }
1479
1480 ADD(alias, "v", vendor != CDX_ANY_ID, vendor);
1481 ADD(alias, "d", device != CDX_ANY_ID, device);
1482 ADD(alias, "sv", subvendor != CDX_ANY_ID, subvendor);
1483 ADD(alias, "sd", subdevice != CDX_ANY_ID, subdevice);
1484 ADD(alias, "c", class_mask == 0xFFFFFF, class);
1485
1478 return 1;
1479}
1480
1481/* Does namelen bytes of name exactly match the symbol? */
1482static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1483{
1484 if (namelen != strlen(symbol))
1485 return false;

--- 150 unchanged lines hidden ---
1486 return 1;
1487}
1488
1489/* Does namelen bytes of name exactly match the symbol? */
1490static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1491{
1492 if (namelen != strlen(symbol))
1493 return false;

--- 150 unchanged lines hidden ---