diff options
author | jhb <jhb@FreeBSD.org> | 2006-06-20 20:37:17 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-06-20 20:37:17 +0000 |
commit | c9fac30209a97fdedf9aeac93688911025f77170 (patch) | |
tree | 752b02bb55e8f018b0e29243b2f03c751e56ee9f /sys/sys/linker.h | |
parent | eef5a2aec40c3dd5f042fede5cc8566d82c27c0d (diff) | |
download | FreeBSD-src-c9fac30209a97fdedf9aeac93688911025f77170.zip FreeBSD-src-c9fac30209a97fdedf9aeac93688911025f77170.tar.gz |
- Add a new linker_file_foreach() function that walks the list of linker
file objects calling a user-specified predicate function on each object.
The iteration terminates either when the entire list has been iterated
over or the predicate function returns a non-zero value.
linker_file_foreach() returns the value returned by the last invocation
of the predicate function. It also accepts a void * context pointer that
is passed to the predicate function as well. Using an iterator function
avoids exposing linker internals to the rest of the kernel making locking
simpler.
- Use linker_file_foreach() instead of walking the list of linker files
manually to lookup ndis files in ndis(4).
- Use linker_file_foreach() to implement linker_hwpmc_list_objects().
Diffstat (limited to 'sys/sys/linker.h')
-rw-r--r-- | sys/sys/linker.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/sys/linker.h b/sys/sys/linker.h index bfd9804..bebe9c9 100644 --- a/sys/sys/linker.h +++ b/sys/sys/linker.h @@ -95,6 +95,11 @@ struct linker_class { }; /* + * Function type used when iterating over the list of linker files. + */ +typedef int linker_predicate_t(linker_file_t, void *); + +/* * The "file" for the kernel. */ extern linker_file_t linker_kernel_file; @@ -111,6 +116,13 @@ int linker_reference_module(const char* _modname, struct mod_depend *_verinfo, linker_file_t* _result); /* + * Iterate over all of the currently loaded linker files calling the + * predicate function while the function returns 0. Returns the value + * returned by the last predicate function. + */ +int linker_file_foreach(linker_predicate_t *_predicate, void *_context); + +/* * Find a currently loaded file given its filename. */ linker_file_t linker_find_file_by_name(const char* _filename); |