xref: /aosp_15_r20/external/kmod/libkmod/libkmod.h (revision cc4ad7da8cefe208cb129ac2aa9a357c7c72deb2)
1*cc4ad7daSAndroid Build Coastguard Worker /*
2*cc4ad7daSAndroid Build Coastguard Worker  * libkmod - interface to kernel module operations
3*cc4ad7daSAndroid Build Coastguard Worker  *
4*cc4ad7daSAndroid Build Coastguard Worker  * Copyright (C) 2011-2013  ProFUSION embedded systems
5*cc4ad7daSAndroid Build Coastguard Worker  *
6*cc4ad7daSAndroid Build Coastguard Worker  * This library is free software; you can redistribute it and/or
7*cc4ad7daSAndroid Build Coastguard Worker  * modify it under the terms of the GNU Lesser General Public
8*cc4ad7daSAndroid Build Coastguard Worker  * License as published by the Free Software Foundation; either
9*cc4ad7daSAndroid Build Coastguard Worker  * version 2.1 of the License, or (at your option) any later version.
10*cc4ad7daSAndroid Build Coastguard Worker  *
11*cc4ad7daSAndroid Build Coastguard Worker  * This library is distributed in the hope that it will be useful,
12*cc4ad7daSAndroid Build Coastguard Worker  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*cc4ad7daSAndroid Build Coastguard Worker  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*cc4ad7daSAndroid Build Coastguard Worker  * Lesser General Public License for more details.
15*cc4ad7daSAndroid Build Coastguard Worker  *
16*cc4ad7daSAndroid Build Coastguard Worker  * You should have received a copy of the GNU Lesser General Public
17*cc4ad7daSAndroid Build Coastguard Worker  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18*cc4ad7daSAndroid Build Coastguard Worker  */
19*cc4ad7daSAndroid Build Coastguard Worker 
20*cc4ad7daSAndroid Build Coastguard Worker #pragma once
21*cc4ad7daSAndroid Build Coastguard Worker #ifndef _LIBKMOD_H_
22*cc4ad7daSAndroid Build Coastguard Worker #define _LIBKMOD_H_
23*cc4ad7daSAndroid Build Coastguard Worker 
24*cc4ad7daSAndroid Build Coastguard Worker #include <fcntl.h>
25*cc4ad7daSAndroid Build Coastguard Worker #include <stdarg.h>
26*cc4ad7daSAndroid Build Coastguard Worker #include <stdbool.h>
27*cc4ad7daSAndroid Build Coastguard Worker #include <inttypes.h>
28*cc4ad7daSAndroid Build Coastguard Worker 
29*cc4ad7daSAndroid Build Coastguard Worker #ifdef __cplusplus
30*cc4ad7daSAndroid Build Coastguard Worker extern "C" {
31*cc4ad7daSAndroid Build Coastguard Worker #endif
32*cc4ad7daSAndroid Build Coastguard Worker 
33*cc4ad7daSAndroid Build Coastguard Worker /*
34*cc4ad7daSAndroid Build Coastguard Worker  * kmod_ctx
35*cc4ad7daSAndroid Build Coastguard Worker  *
36*cc4ad7daSAndroid Build Coastguard Worker  * library user context - reads the config and system
37*cc4ad7daSAndroid Build Coastguard Worker  * environment, user variables, allows custom logging
38*cc4ad7daSAndroid Build Coastguard Worker  */
39*cc4ad7daSAndroid Build Coastguard Worker struct kmod_ctx;
40*cc4ad7daSAndroid Build Coastguard Worker struct kmod_ctx *kmod_new(const char *dirname, const char * const *config_paths);
41*cc4ad7daSAndroid Build Coastguard Worker struct kmod_ctx *kmod_ref(struct kmod_ctx *ctx);
42*cc4ad7daSAndroid Build Coastguard Worker struct kmod_ctx *kmod_unref(struct kmod_ctx *ctx);
43*cc4ad7daSAndroid Build Coastguard Worker void kmod_set_log_fn(struct kmod_ctx *ctx,
44*cc4ad7daSAndroid Build Coastguard Worker 			void (*log_fn)(void *log_data,
45*cc4ad7daSAndroid Build Coastguard Worker 					int priority, const char *file, int line,
46*cc4ad7daSAndroid Build Coastguard Worker 					const char *fn, const char *format,
47*cc4ad7daSAndroid Build Coastguard Worker 					va_list args),
48*cc4ad7daSAndroid Build Coastguard Worker 			const void *data);
49*cc4ad7daSAndroid Build Coastguard Worker int kmod_get_log_priority(const struct kmod_ctx *ctx);
50*cc4ad7daSAndroid Build Coastguard Worker void kmod_set_log_priority(struct kmod_ctx *ctx, int priority);
51*cc4ad7daSAndroid Build Coastguard Worker void *kmod_get_userdata(const struct kmod_ctx *ctx);
52*cc4ad7daSAndroid Build Coastguard Worker void kmod_set_userdata(struct kmod_ctx *ctx, const void *userdata);
53*cc4ad7daSAndroid Build Coastguard Worker 
54*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_get_dirname(const struct kmod_ctx *ctx);
55*cc4ad7daSAndroid Build Coastguard Worker 
56*cc4ad7daSAndroid Build Coastguard Worker /*
57*cc4ad7daSAndroid Build Coastguard Worker  * Management of libkmod's resources
58*cc4ad7daSAndroid Build Coastguard Worker  */
59*cc4ad7daSAndroid Build Coastguard Worker int kmod_load_resources(struct kmod_ctx *ctx);
60*cc4ad7daSAndroid Build Coastguard Worker void kmod_unload_resources(struct kmod_ctx *ctx);
61*cc4ad7daSAndroid Build Coastguard Worker 
62*cc4ad7daSAndroid Build Coastguard Worker enum kmod_resources {
63*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_RESOURCES_OK = 0,
64*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_RESOURCES_MUST_RELOAD = 1,
65*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_RESOURCES_MUST_RECREATE = 2,
66*cc4ad7daSAndroid Build Coastguard Worker };
67*cc4ad7daSAndroid Build Coastguard Worker int kmod_validate_resources(struct kmod_ctx *ctx);
68*cc4ad7daSAndroid Build Coastguard Worker 
69*cc4ad7daSAndroid Build Coastguard Worker enum kmod_index {
70*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_INDEX_MODULES_DEP = 0,
71*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_INDEX_MODULES_ALIAS,
72*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_INDEX_MODULES_SYMBOL,
73*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_INDEX_MODULES_BUILTIN_ALIAS,
74*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_INDEX_MODULES_BUILTIN,
75*cc4ad7daSAndroid Build Coastguard Worker 	/* Padding to make sure enum is not mapped to char */
76*cc4ad7daSAndroid Build Coastguard Worker 	_KMOD_INDEX_PAD = 1U << 31,
77*cc4ad7daSAndroid Build Coastguard Worker };
78*cc4ad7daSAndroid Build Coastguard Worker int kmod_dump_index(struct kmod_ctx *ctx, enum kmod_index type, int fd);
79*cc4ad7daSAndroid Build Coastguard Worker 
80*cc4ad7daSAndroid Build Coastguard Worker /*
81*cc4ad7daSAndroid Build Coastguard Worker  * kmod_list
82*cc4ad7daSAndroid Build Coastguard Worker  *
83*cc4ad7daSAndroid Build Coastguard Worker  * access to kmod generated lists
84*cc4ad7daSAndroid Build Coastguard Worker  */
85*cc4ad7daSAndroid Build Coastguard Worker struct kmod_list;
86*cc4ad7daSAndroid Build Coastguard Worker struct kmod_list *kmod_list_next(const struct kmod_list *list,
87*cc4ad7daSAndroid Build Coastguard Worker 						const struct kmod_list *curr);
88*cc4ad7daSAndroid Build Coastguard Worker struct kmod_list *kmod_list_prev(const struct kmod_list *list,
89*cc4ad7daSAndroid Build Coastguard Worker 						const struct kmod_list *curr);
90*cc4ad7daSAndroid Build Coastguard Worker struct kmod_list *kmod_list_last(const struct kmod_list *list);
91*cc4ad7daSAndroid Build Coastguard Worker 
92*cc4ad7daSAndroid Build Coastguard Worker #define kmod_list_foreach(list_entry, first_entry) \
93*cc4ad7daSAndroid Build Coastguard Worker 	for (list_entry = first_entry; \
94*cc4ad7daSAndroid Build Coastguard Worker 		list_entry != NULL; \
95*cc4ad7daSAndroid Build Coastguard Worker 		list_entry = kmod_list_next(first_entry, list_entry))
96*cc4ad7daSAndroid Build Coastguard Worker 
97*cc4ad7daSAndroid Build Coastguard Worker #define kmod_list_foreach_reverse(list_entry, first_entry) \
98*cc4ad7daSAndroid Build Coastguard Worker 	for (list_entry = kmod_list_last(first_entry); \
99*cc4ad7daSAndroid Build Coastguard Worker 		list_entry != NULL; \
100*cc4ad7daSAndroid Build Coastguard Worker 		list_entry = kmod_list_prev(first_entry, list_entry))
101*cc4ad7daSAndroid Build Coastguard Worker 
102*cc4ad7daSAndroid Build Coastguard Worker /*
103*cc4ad7daSAndroid Build Coastguard Worker  * kmod_config_iter
104*cc4ad7daSAndroid Build Coastguard Worker  *
105*cc4ad7daSAndroid Build Coastguard Worker  * access to configuration lists - it allows to get each configuration's
106*cc4ad7daSAndroid Build Coastguard Worker  * key/value stored by kmod
107*cc4ad7daSAndroid Build Coastguard Worker  */
108*cc4ad7daSAndroid Build Coastguard Worker struct kmod_config_iter;
109*cc4ad7daSAndroid Build Coastguard Worker struct kmod_config_iter *kmod_config_get_blacklists(const struct kmod_ctx *ctx);
110*cc4ad7daSAndroid Build Coastguard Worker struct kmod_config_iter *kmod_config_get_install_commands(const struct kmod_ctx *ctx);
111*cc4ad7daSAndroid Build Coastguard Worker struct kmod_config_iter *kmod_config_get_remove_commands(const struct kmod_ctx *ctx);
112*cc4ad7daSAndroid Build Coastguard Worker struct kmod_config_iter *kmod_config_get_aliases(const struct kmod_ctx *ctx);
113*cc4ad7daSAndroid Build Coastguard Worker struct kmod_config_iter *kmod_config_get_options(const struct kmod_ctx *ctx);
114*cc4ad7daSAndroid Build Coastguard Worker struct kmod_config_iter *kmod_config_get_softdeps(const struct kmod_ctx *ctx);
115*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_config_iter_get_key(const struct kmod_config_iter *iter);
116*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_config_iter_get_value(const struct kmod_config_iter *iter);
117*cc4ad7daSAndroid Build Coastguard Worker bool kmod_config_iter_next(struct kmod_config_iter *iter);
118*cc4ad7daSAndroid Build Coastguard Worker void kmod_config_iter_free_iter(struct kmod_config_iter *iter);
119*cc4ad7daSAndroid Build Coastguard Worker 
120*cc4ad7daSAndroid Build Coastguard Worker /*
121*cc4ad7daSAndroid Build Coastguard Worker  * kmod_module
122*cc4ad7daSAndroid Build Coastguard Worker  *
123*cc4ad7daSAndroid Build Coastguard Worker  * Operate on kernel modules
124*cc4ad7daSAndroid Build Coastguard Worker  */
125*cc4ad7daSAndroid Build Coastguard Worker struct kmod_module;
126*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_new_from_name(struct kmod_ctx *ctx, const char *name,
127*cc4ad7daSAndroid Build Coastguard Worker 						struct kmod_module **mod);
128*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_new_from_path(struct kmod_ctx *ctx, const char *path,
129*cc4ad7daSAndroid Build Coastguard Worker 						struct kmod_module **mod);
130*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_new_from_lookup(struct kmod_ctx *ctx, const char *given_alias,
131*cc4ad7daSAndroid Build Coastguard Worker 						struct kmod_list **list);
132*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_new_from_name_lookup(struct kmod_ctx *ctx,
133*cc4ad7daSAndroid Build Coastguard Worker 				     const char *modname,
134*cc4ad7daSAndroid Build Coastguard Worker 				     struct kmod_module **mod);
135*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_new_from_loaded(struct kmod_ctx *ctx,
136*cc4ad7daSAndroid Build Coastguard Worker 						struct kmod_list **list);
137*cc4ad7daSAndroid Build Coastguard Worker 
138*cc4ad7daSAndroid Build Coastguard Worker struct kmod_module *kmod_module_ref(struct kmod_module *mod);
139*cc4ad7daSAndroid Build Coastguard Worker struct kmod_module *kmod_module_unref(struct kmod_module *mod);
140*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_unref_list(struct kmod_list *list);
141*cc4ad7daSAndroid Build Coastguard Worker struct kmod_module *kmod_module_get_module(const struct kmod_list *entry);
142*cc4ad7daSAndroid Build Coastguard Worker 
143*cc4ad7daSAndroid Build Coastguard Worker 
144*cc4ad7daSAndroid Build Coastguard Worker /* Removal flags */
145*cc4ad7daSAndroid Build Coastguard Worker enum kmod_remove {
146*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_REMOVE_FORCE = O_TRUNC,
147*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_REMOVE_NOWAIT = O_NONBLOCK, /* always set */
148*cc4ad7daSAndroid Build Coastguard Worker 	/* libkmod-only defines, not passed to kernel */
149*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_REMOVE_NOLOG = 1,
150*cc4ad7daSAndroid Build Coastguard Worker };
151*cc4ad7daSAndroid Build Coastguard Worker 
152*cc4ad7daSAndroid Build Coastguard Worker /* Insertion flags */
153*cc4ad7daSAndroid Build Coastguard Worker enum kmod_insert {
154*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_INSERT_FORCE_VERMAGIC = 0x1,
155*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_INSERT_FORCE_MODVERSION = 0x2,
156*cc4ad7daSAndroid Build Coastguard Worker };
157*cc4ad7daSAndroid Build Coastguard Worker 
158*cc4ad7daSAndroid Build Coastguard Worker /* Flags to kmod_module_probe_insert_module() */
159*cc4ad7daSAndroid Build Coastguard Worker enum kmod_probe {
160*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_FORCE_VERMAGIC =		0x00001,
161*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_FORCE_MODVERSION =		0x00002,
162*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_IGNORE_COMMAND =		0x00004,
163*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_IGNORE_LOADED =		0x00008,
164*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_DRY_RUN =			0x00010,
165*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_FAIL_ON_LOADED =		0x00020,
166*cc4ad7daSAndroid Build Coastguard Worker 
167*cc4ad7daSAndroid Build Coastguard Worker 	/* codes below can be used in return value, too */
168*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_APPLY_BLACKLIST_ALL =	0x10000,
169*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_APPLY_BLACKLIST =		0x20000,
170*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY =	0x40000,
171*cc4ad7daSAndroid Build Coastguard Worker };
172*cc4ad7daSAndroid Build Coastguard Worker 
173*cc4ad7daSAndroid Build Coastguard Worker /* Flags to kmod_module_apply_filter() */
174*cc4ad7daSAndroid Build Coastguard Worker enum kmod_filter {
175*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_FILTER_BLACKLIST = 0x00001,
176*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_FILTER_BUILTIN = 0x00002,
177*cc4ad7daSAndroid Build Coastguard Worker };
178*cc4ad7daSAndroid Build Coastguard Worker 
179*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_remove_module(struct kmod_module *mod, unsigned int flags);
180*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_insert_module(struct kmod_module *mod, unsigned int flags,
181*cc4ad7daSAndroid Build Coastguard Worker 							const char *options);
182*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_probe_insert_module(struct kmod_module *mod,
183*cc4ad7daSAndroid Build Coastguard Worker 			unsigned int flags, const char *extra_options,
184*cc4ad7daSAndroid Build Coastguard Worker 			int (*run_install)(struct kmod_module *m,
185*cc4ad7daSAndroid Build Coastguard Worker 						const char *cmdline, void *data),
186*cc4ad7daSAndroid Build Coastguard Worker 			const void *data,
187*cc4ad7daSAndroid Build Coastguard Worker 			void (*print_action)(struct kmod_module *m, bool install,
188*cc4ad7daSAndroid Build Coastguard Worker 						const char *options));
189*cc4ad7daSAndroid Build Coastguard Worker 
190*cc4ad7daSAndroid Build Coastguard Worker 
191*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_get_name(const struct kmod_module *mod);
192*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_get_path(const struct kmod_module *mod);
193*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_get_options(const struct kmod_module *mod);
194*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_get_install_commands(const struct kmod_module *mod);
195*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_get_remove_commands(const struct kmod_module *mod);
196*cc4ad7daSAndroid Build Coastguard Worker struct kmod_list *kmod_module_get_dependencies(const struct kmod_module *mod);
197*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_get_softdeps(const struct kmod_module *mod,
198*cc4ad7daSAndroid Build Coastguard Worker 				struct kmod_list **pre, struct kmod_list **post);
199*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_get_filtered_blacklist(const struct kmod_ctx *ctx,
200*cc4ad7daSAndroid Build Coastguard Worker 					const struct kmod_list *input,
201*cc4ad7daSAndroid Build Coastguard Worker 					struct kmod_list **output) __attribute__ ((deprecated));
202*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_apply_filter(const struct kmod_ctx *ctx,
203*cc4ad7daSAndroid Build Coastguard Worker 					enum kmod_filter filter_type,
204*cc4ad7daSAndroid Build Coastguard Worker 					const struct kmod_list *input,
205*cc4ad7daSAndroid Build Coastguard Worker 					struct kmod_list **output);
206*cc4ad7daSAndroid Build Coastguard Worker 
207*cc4ad7daSAndroid Build Coastguard Worker 
208*cc4ad7daSAndroid Build Coastguard Worker 
209*cc4ad7daSAndroid Build Coastguard Worker /*
210*cc4ad7daSAndroid Build Coastguard Worker  * Information regarding "live information" from module's state, as returned
211*cc4ad7daSAndroid Build Coastguard Worker  * by kernel
212*cc4ad7daSAndroid Build Coastguard Worker  */
213*cc4ad7daSAndroid Build Coastguard Worker 
214*cc4ad7daSAndroid Build Coastguard Worker enum kmod_module_initstate {
215*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_MODULE_BUILTIN = 0,
216*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_MODULE_LIVE,
217*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_MODULE_COMING,
218*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_MODULE_GOING,
219*cc4ad7daSAndroid Build Coastguard Worker 	/* Padding to make sure enum is not mapped to char */
220*cc4ad7daSAndroid Build Coastguard Worker 	_KMOD_MODULE_PAD = 1U << 31,
221*cc4ad7daSAndroid Build Coastguard Worker };
222*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_initstate_str(enum kmod_module_initstate state);
223*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_get_initstate(const struct kmod_module *mod);
224*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_get_refcnt(const struct kmod_module *mod);
225*cc4ad7daSAndroid Build Coastguard Worker struct kmod_list *kmod_module_get_holders(const struct kmod_module *mod);
226*cc4ad7daSAndroid Build Coastguard Worker struct kmod_list *kmod_module_get_sections(const struct kmod_module *mod);
227*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_section_get_name(const struct kmod_list *entry);
228*cc4ad7daSAndroid Build Coastguard Worker unsigned long kmod_module_section_get_address(const struct kmod_list *entry);
229*cc4ad7daSAndroid Build Coastguard Worker void kmod_module_section_free_list(struct kmod_list *list);
230*cc4ad7daSAndroid Build Coastguard Worker long kmod_module_get_size(const struct kmod_module *mod);
231*cc4ad7daSAndroid Build Coastguard Worker 
232*cc4ad7daSAndroid Build Coastguard Worker 
233*cc4ad7daSAndroid Build Coastguard Worker 
234*cc4ad7daSAndroid Build Coastguard Worker /*
235*cc4ad7daSAndroid Build Coastguard Worker  * Information retrieved from ELF headers and sections
236*cc4ad7daSAndroid Build Coastguard Worker  */
237*cc4ad7daSAndroid Build Coastguard Worker 
238*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_get_info(const struct kmod_module *mod, struct kmod_list **list);
239*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_info_get_key(const struct kmod_list *entry);
240*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_info_get_value(const struct kmod_list *entry);
241*cc4ad7daSAndroid Build Coastguard Worker void kmod_module_info_free_list(struct kmod_list *list);
242*cc4ad7daSAndroid Build Coastguard Worker 
243*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_get_versions(const struct kmod_module *mod, struct kmod_list **list);
244*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_version_get_symbol(const struct kmod_list *entry);
245*cc4ad7daSAndroid Build Coastguard Worker uint64_t kmod_module_version_get_crc(const struct kmod_list *entry);
246*cc4ad7daSAndroid Build Coastguard Worker void kmod_module_versions_free_list(struct kmod_list *list);
247*cc4ad7daSAndroid Build Coastguard Worker 
248*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_get_symbols(const struct kmod_module *mod, struct kmod_list **list);
249*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_symbol_get_symbol(const struct kmod_list *entry);
250*cc4ad7daSAndroid Build Coastguard Worker uint64_t kmod_module_symbol_get_crc(const struct kmod_list *entry);
251*cc4ad7daSAndroid Build Coastguard Worker void kmod_module_symbols_free_list(struct kmod_list *list);
252*cc4ad7daSAndroid Build Coastguard Worker 
253*cc4ad7daSAndroid Build Coastguard Worker enum kmod_symbol_bind {
254*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_SYMBOL_NONE = '\0',
255*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_SYMBOL_LOCAL = 'L',
256*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_SYMBOL_GLOBAL = 'G',
257*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_SYMBOL_WEAK = 'W',
258*cc4ad7daSAndroid Build Coastguard Worker 	KMOD_SYMBOL_UNDEF = 'U'
259*cc4ad7daSAndroid Build Coastguard Worker };
260*cc4ad7daSAndroid Build Coastguard Worker 
261*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_get_dependency_symbols(const struct kmod_module *mod, struct kmod_list **list);
262*cc4ad7daSAndroid Build Coastguard Worker const char *kmod_module_dependency_symbol_get_symbol(const struct kmod_list *entry);
263*cc4ad7daSAndroid Build Coastguard Worker int kmod_module_dependency_symbol_get_bind(const struct kmod_list *entry);
264*cc4ad7daSAndroid Build Coastguard Worker uint64_t kmod_module_dependency_symbol_get_crc(const struct kmod_list *entry);
265*cc4ad7daSAndroid Build Coastguard Worker void kmod_module_dependency_symbols_free_list(struct kmod_list *list);
266*cc4ad7daSAndroid Build Coastguard Worker 
267*cc4ad7daSAndroid Build Coastguard Worker #ifdef __cplusplus
268*cc4ad7daSAndroid Build Coastguard Worker } /* extern "C" */
269*cc4ad7daSAndroid Build Coastguard Worker #endif
270*cc4ad7daSAndroid Build Coastguard Worker #endif
271