1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
2 | #ifndef __LINUX_KMOD_H__ |
3 | #define __LINUX_KMOD_H__ |
4 | |
5 | /* |
6 | * include/linux/kmod.h |
7 | */ |
8 | |
9 | #include <linux/umh.h> |
10 | #include <linux/gfp.h> |
11 | #include <linux/stddef.h> |
12 | #include <linux/errno.h> |
13 | #include <linux/compiler.h> |
14 | #include <linux/workqueue.h> |
15 | #include <linux/sysctl.h> |
16 | |
17 | #define KMOD_PATH_LEN 256 |
18 | |
19 | #ifdef CONFIG_MODULES |
20 | extern char modprobe_path[]; /* for sysctl */ |
21 | /* modprobe exit status on success, -ve on error. Return value |
22 | * usually useless though. */ |
23 | extern __printf(2, 3) |
24 | int __request_module(bool wait, const char *name, ...); |
25 | #define request_module(mod...) __request_module(true, mod) |
26 | #define request_module_nowait(mod...) __request_module(false, mod) |
27 | #define try_then_request_module(x, mod...) \ |
28 | ((x) ?: (__request_module(true, mod), (x))) |
29 | #else |
30 | static inline int request_module(const char *name, ...) { return -ENOSYS; } |
31 | static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; } |
32 | #define try_then_request_module(x, mod...) (x) |
33 | #endif |
34 | |
35 | #endif /* __LINUX_KMOD_H__ */ |
36 | |