diff options
Diffstat (limited to 'include/linux/kmod.h')
-rw-r--r-- | include/linux/kmod.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 5dc13848891b..92213a9194e1 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -19,29 +19,31 @@ | |||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/gfp.h> | ||
22 | #include <linux/stddef.h> | 23 | #include <linux/stddef.h> |
23 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
24 | #include <linux/compiler.h> | 25 | #include <linux/compiler.h> |
25 | 26 | ||
26 | #define KMOD_PATH_LEN 256 | 27 | #define KMOD_PATH_LEN 256 |
27 | 28 | ||
28 | #ifdef CONFIG_KMOD | 29 | #ifdef CONFIG_MODULES |
29 | /* modprobe exit status on success, -ve on error. Return value | 30 | /* modprobe exit status on success, -ve on error. Return value |
30 | * usually useless though. */ | 31 | * usually useless though. */ |
31 | extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); | 32 | extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); |
33 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | ||
32 | #else | 34 | #else |
33 | static inline int request_module(const char * name, ...) { return -ENOSYS; } | 35 | static inline int request_module(const char * name, ...) { return -ENOSYS; } |
36 | #define try_then_request_module(x, mod...) (x) | ||
34 | #endif | 37 | #endif |
35 | 38 | ||
36 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | ||
37 | 39 | ||
38 | struct key; | 40 | struct key; |
39 | struct file; | 41 | struct file; |
40 | struct subprocess_info; | 42 | struct subprocess_info; |
41 | 43 | ||
42 | /* Allocate a subprocess_info structure */ | 44 | /* Allocate a subprocess_info structure */ |
43 | struct subprocess_info *call_usermodehelper_setup(char *path, | 45 | struct subprocess_info *call_usermodehelper_setup(char *path, char **argv, |
44 | char **argv, char **envp); | 46 | char **envp, gfp_t gfp_mask); |
45 | 47 | ||
46 | /* Set various pieces of state into the subprocess_info structure */ | 48 | /* Set various pieces of state into the subprocess_info structure */ |
47 | void call_usermodehelper_setkeys(struct subprocess_info *info, | 49 | void call_usermodehelper_setkeys(struct subprocess_info *info, |
@@ -68,8 +70,9 @@ static inline int | |||
68 | call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) | 70 | call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) |
69 | { | 71 | { |
70 | struct subprocess_info *info; | 72 | struct subprocess_info *info; |
73 | gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; | ||
71 | 74 | ||
72 | info = call_usermodehelper_setup(path, argv, envp); | 75 | info = call_usermodehelper_setup(path, argv, envp, gfp_mask); |
73 | if (info == NULL) | 76 | if (info == NULL) |
74 | return -ENOMEM; | 77 | return -ENOMEM; |
75 | return call_usermodehelper_exec(info, wait); | 78 | return call_usermodehelper_exec(info, wait); |
@@ -80,8 +83,9 @@ call_usermodehelper_keys(char *path, char **argv, char **envp, | |||
80 | struct key *session_keyring, enum umh_wait wait) | 83 | struct key *session_keyring, enum umh_wait wait) |
81 | { | 84 | { |
82 | struct subprocess_info *info; | 85 | struct subprocess_info *info; |
86 | gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; | ||
83 | 87 | ||
84 | info = call_usermodehelper_setup(path, argv, envp); | 88 | info = call_usermodehelper_setup(path, argv, envp, gfp_mask); |
85 | if (info == NULL) | 89 | if (info == NULL) |
86 | return -ENOMEM; | 90 | return -ENOMEM; |
87 | 91 | ||
@@ -95,4 +99,7 @@ struct file; | |||
95 | extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[], | 99 | extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[], |
96 | struct file **filp); | 100 | struct file **filp); |
97 | 101 | ||
102 | extern int usermodehelper_disable(void); | ||
103 | extern void usermodehelper_enable(void); | ||
104 | |||
98 | #endif /* __LINUX_KMOD_H__ */ | 105 | #endif /* __LINUX_KMOD_H__ */ |