blob: 68f69362d427caaaefc2565127a7a4158433e5f5 [file] [log] [blame]
Thomas Gleixner74ba9202019-05-20 09:19:02 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef __LINUX_KMOD_H__
3#define __LINUX_KMOD_H__
4
5/*
6 * include/linux/kmod.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 */
8
Luis R. Rodriguezc1f3fa22017-09-08 16:17:08 -07009#include <linux/umh.h>
KOSAKI Motohiroac331d12008-07-25 01:45:38 -070010#include <linux/gfp.h>
David Howells7888e7f2005-06-23 22:00:51 -070011#include <linux/stddef.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/errno.h>
13#include <linux/compiler.h>
Neil Hormana06a4dc2010-05-26 14:42:58 -070014#include <linux/workqueue.h>
Eric Paris17f60a72011-04-01 17:07:50 -040015#include <linux/sysctl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
17#define KMOD_PATH_LEN 256
18
Johannes Berga1ef5ad2008-07-08 19:00:17 +020019#ifdef CONFIG_MODULES
Dave Young5ed10912010-03-10 15:24:06 -080020extern char modprobe_path[]; /* for sysctl */
Linus Torvalds1da177e2005-04-16 15:20:36 -070021/* modprobe exit status on success, -ve on error. Return value
22 * usually useless though. */
Joe Perchesb9075fa2011-10-31 17:11:33 -070023extern __printf(2, 3)
24int __request_module(bool wait, const char *name, ...);
Arjan van de Venacae0512009-02-08 10:42:01 -080025#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...) \
Herbert Xu97c18e22009-04-09 10:35:47 +080028 ((x) ?: (__request_module(true, mod), (x)))
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#else
Arjan van de Venacae0512009-02-08 10:42:01 -080030static inline int request_module(const char *name, ...) { return -ENOSYS; }
31static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; }
Johannes Bergdf648c92008-07-08 19:00:18 +020032#define try_then_request_module(x, mod...) (x)
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#endif
34
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#endif /* __LINUX_KMOD_H__ */