kern_linker.c (44731cab3b9966b7ca67f3fe50e7f3c711533730) | kern_linker.c (96987c74d66bbaf822f59d550460259611a7ed1d) |
---|---|
1/*- 2 * Copyright (c) 1997-2000 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 84 unchanged lines hidden (view full) --- 93 TAILQ_ENTRY(modlist) link; /* chain together all modules */ 94 linker_file_t container; 95 const char *name; 96 int version; 97}; 98typedef struct modlist *modlist_t; 99static modlisthead_t found_modules; 100 | 1/*- 2 * Copyright (c) 1997-2000 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 84 unchanged lines hidden (view full) --- 93 TAILQ_ENTRY(modlist) link; /* chain together all modules */ 94 linker_file_t container; 95 const char *name; 96 int version; 97}; 98typedef struct modlist *modlist_t; 99static modlisthead_t found_modules; 100 |
101static modlist_t modlist_lookup2(const char *name, 102 struct mod_depend *verinfo); 103 |
|
101static char * 102linker_strdup(const char *str) 103{ 104 char *result; 105 106 if ((result = malloc((strlen(str) + 1), M_LINKER, M_WAITOK)) != NULL) 107 strcpy(result, str); 108 return (result); --- 231 unchanged lines hidden (view full) --- 340 /* Format not recognized (or unloadable). */ 341 error = ENOEXEC; 342 else 343 error = ENOENT; /* Nothing found */ 344out: 345 return (error); 346} 347 | 104static char * 105linker_strdup(const char *str) 106{ 107 char *result; 108 109 if ((result = malloc((strlen(str) + 1), M_LINKER, M_WAITOK)) != NULL) 110 strcpy(result, str); 111 return (result); --- 231 unchanged lines hidden (view full) --- 343 /* Format not recognized (or unloadable). */ 344 error = ENOEXEC; 345 else 346 error = ENOENT; /* Nothing found */ 347out: 348 return (error); 349} 350 |
348/* XXX: function parameters are incomplete */ | |
349int | 351int |
350linker_reference_module(const char *modname, linker_file_t *result) | 352linker_reference_module(const char *modname, struct mod_depend *verinfo, 353 linker_file_t *result) |
351{ | 354{ |
352 return (linker_load_module(NULL, modname, NULL, NULL, result)); | 355 modlist_t mod; 356 357 if ((mod = modlist_lookup2(modname, verinfo)) != NULL) { 358 *result = mod->container; 359 (*result)->refs++; 360 return (0); 361 } 362 363 return (linker_load_module(NULL, modname, NULL, verinfo, result)); |
353} 354 355linker_file_t 356linker_find_file_by_name(const char *filename) 357{ 358 linker_file_t lf = 0; 359 char *koname; 360 --- 1407 unchanged lines hidden --- | 364} 365 366linker_file_t 367linker_find_file_by_name(const char *filename) 368{ 369 linker_file_t lf = 0; 370 char *koname; 371 --- 1407 unchanged lines hidden --- |