file2alias.c (d59b66c7a575cfa8e01f483875d131e42b539bbc) | file2alias.c (61e115a56d1aafd6e6a8a9fee8ac099a6128ac7b) |
---|---|
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 * --- 470 unchanged lines hidden (view full) --- 479 ADD(alias, "t", id->hw_type != PA_HWTYPE_ANY_ID, id->hw_type); 480 ADD(alias, "hv", id->hversion != PA_HVERSION_ANY_ID, id->hversion); 481 ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev); 482 ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion); 483 484 return 1; 485} 486 | 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 * --- 470 unchanged lines hidden (view full) --- 479 ADD(alias, "t", id->hw_type != PA_HWTYPE_ANY_ID, id->hw_type); 480 ADD(alias, "hv", id->hversion != PA_HVERSION_ANY_ID, id->hversion); 481 ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev); 482 ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion); 483 484 return 1; 485} 486 |
487/* Looks like: sdio:cNvNdN. */ 488static int do_sdio_entry(const char *filename, 489 struct sdio_device_id *id, char *alias) | 487/* Looks like: ssb:vNidNrevN. */ 488static int do_ssb_entry(const char *filename, 489 struct ssb_device_id *id, char *alias) |
490{ | 490{ |
491 id->class = TO_NATIVE(id->class); | |
492 id->vendor = TO_NATIVE(id->vendor); | 491 id->vendor = TO_NATIVE(id->vendor); |
493 id->device = TO_NATIVE(id->device); | 492 id->coreid = TO_NATIVE(id->coreid); 493 id->revision = TO_NATIVE(id->revision); |
494 | 494 |
495 strcpy(alias, "sdio:"); 496 ADD(alias, "c", id->class != (__u8)SDIO_ANY_ID, id->class); 497 ADD(alias, "v", id->vendor != (__u16)SDIO_ANY_ID, id->vendor); 498 ADD(alias, "d", id->device != (__u16)SDIO_ANY_ID, id->device); 499 | 495 strcpy(alias, "ssb:"); 496 ADD(alias, "v", id->vendor != SSB_ANY_VENDOR, id->vendor); 497 ADD(alias, "id", id->coreid != SSB_ANY_ID, id->coreid); 498 ADD(alias, "rev", id->revision != SSB_ANY_REV, id->revision); |
500 return 1; 501} 502 503/* Ignore any prefix, eg. v850 prepends _ */ 504static inline int sym_is(const char *symbol, const char *name) 505{ 506 const char *match; 507 --- 102 unchanged lines hidden (view full) --- 610 else if (sym_is(symname, "__mod_eisa_device_table")) 611 do_table(symval, sym->st_size, 612 sizeof(struct eisa_device_id), "eisa", 613 do_eisa_entry, mod); 614 else if (sym_is(symname, "__mod_parisc_device_table")) 615 do_table(symval, sym->st_size, 616 sizeof(struct parisc_device_id), "parisc", 617 do_parisc_entry, mod); | 499 return 1; 500} 501 502/* Ignore any prefix, eg. v850 prepends _ */ 503static inline int sym_is(const char *symbol, const char *name) 504{ 505 const char *match; 506 --- 102 unchanged lines hidden (view full) --- 609 else if (sym_is(symname, "__mod_eisa_device_table")) 610 do_table(symval, sym->st_size, 611 sizeof(struct eisa_device_id), "eisa", 612 do_eisa_entry, mod); 613 else if (sym_is(symname, "__mod_parisc_device_table")) 614 do_table(symval, sym->st_size, 615 sizeof(struct parisc_device_id), "parisc", 616 do_parisc_entry, mod); |
618 else if (sym_is(symname, "__mod_sdio_device_table")) | 617 else if (sym_is(symname, "__mod_ssb_device_table")) |
619 do_table(symval, sym->st_size, | 618 do_table(symval, sym->st_size, |
620 sizeof(struct sdio_device_id), "sdio", 621 do_sdio_entry, mod); | 619 sizeof(struct ssb_device_id), "ssb", 620 do_ssb_entry, mod); |
622} 623 624/* Now add out buffered information to the generated C source */ 625void add_moddevtable(struct buffer *buf, struct module *mod) 626{ 627 buf_printf(buf, "\n"); 628 buf_write(buf, mod->dev_table_buf.p, mod->dev_table_buf.pos); 629 free(mod->dev_table_buf.p); 630} | 621} 622 623/* Now add out buffered information to the generated C source */ 624void add_moddevtable(struct buffer *buf, struct module *mod) 625{ 626 buf_printf(buf, "\n"); 627 buf_write(buf, mod->dev_table_buf.p, mod->dev_table_buf.pos); 628 free(mod->dev_table_buf.p); 629} |