Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef __LINUX_KMOD_H__
0003 #define __LINUX_KMOD_H__
0004 
0005 /*
0006  *  include/linux/kmod.h
0007  */
0008 
0009 #include <linux/umh.h>
0010 #include <linux/gfp.h>
0011 #include <linux/stddef.h>
0012 #include <linux/errno.h>
0013 #include <linux/compiler.h>
0014 #include <linux/workqueue.h>
0015 #include <linux/sysctl.h>
0016 
0017 #define KMOD_PATH_LEN 256
0018 
0019 #ifdef CONFIG_MODULES
0020 extern char modprobe_path[]; /* for sysctl */
0021 /* modprobe exit status on success, -ve on error.  Return value
0022  * usually useless though. */
0023 extern __printf(2, 3)
0024 int __request_module(bool wait, const char *name, ...);
0025 #define request_module(mod...) __request_module(true, mod)
0026 #define request_module_nowait(mod...) __request_module(false, mod)
0027 #define try_then_request_module(x, mod...) \
0028     ((x) ?: (__request_module(true, mod), (x)))
0029 #else
0030 static inline int request_module(const char *name, ...) { return -ENOSYS; }
0031 static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; }
0032 #define try_then_request_module(x, mod...) (x)
0033 #endif
0034 
0035 #endif /* __LINUX_KMOD_H__ */