blob: 40c89ad4bea6adf829eeb54f34d2328a577c4b1e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __LINUX_KMOD_H__
2#define __LINUX_KMOD_H__
3
4/*
5 * include/linux/kmod.h
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
Luis R. Rodriguezc1f3fa22017-09-08 16:17:08 -070022#include <linux/umh.h>
KOSAKI Motohiroac331d12008-07-25 01:45:38 -070023#include <linux/gfp.h>
David Howells7888e7f2005-06-23 22:00:51 -070024#include <linux/stddef.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <linux/errno.h>
26#include <linux/compiler.h>
Neil Hormana06a4dc2010-05-26 14:42:58 -070027#include <linux/workqueue.h>
Eric Paris17f60a72011-04-01 17:07:50 -040028#include <linux/sysctl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30#define KMOD_PATH_LEN 256
31
Johannes Berga1ef5ad2008-07-08 19:00:17 +020032#ifdef CONFIG_MODULES
Dave Young5ed10912010-03-10 15:24:06 -080033extern char modprobe_path[]; /* for sysctl */
Linus Torvalds1da177e2005-04-16 15:20:36 -070034/* modprobe exit status on success, -ve on error. Return value
35 * usually useless though. */
Joe Perchesb9075fa2011-10-31 17:11:33 -070036extern __printf(2, 3)
37int __request_module(bool wait, const char *name, ...);
Arjan van de Venacae0512009-02-08 10:42:01 -080038#define request_module(mod...) __request_module(true, mod)
39#define request_module_nowait(mod...) __request_module(false, mod)
40#define try_then_request_module(x, mod...) \
Herbert Xu97c18e22009-04-09 10:35:47 +080041 ((x) ?: (__request_module(true, mod), (x)))
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#else
Arjan van de Venacae0512009-02-08 10:42:01 -080043static inline int request_module(const char *name, ...) { return -ENOSYS; }
44static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; }
Johannes Bergdf648c92008-07-08 19:00:18 +020045#define try_then_request_module(x, mod...) (x)
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#endif
47
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#endif /* __LINUX_KMOD_H__ */