diff options
Diffstat (limited to 'include/linux/kmod.h')
-rw-r--r-- | include/linux/kmod.h | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 10f505c8431d..c4cbe59d9c67 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -36,13 +36,51 @@ static inline int request_module(const char * name, ...) { return -ENOSYS; } | |||
36 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) | 36 | #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) |
37 | 37 | ||
38 | struct key; | 38 | struct key; |
39 | extern int call_usermodehelper_keys(char *path, char *argv[], char *envp[], | 39 | struct file; |
40 | struct key *session_keyring, int wait); | 40 | struct subprocess_info; |
41 | |||
42 | /* Allocate a subprocess_info structure */ | ||
43 | struct subprocess_info *call_usermodehelper_setup(char *path, | ||
44 | char **argv, char **envp); | ||
45 | |||
46 | /* Set various pieces of state into the subprocess_info structure */ | ||
47 | void call_usermodehelper_setkeys(struct subprocess_info *info, | ||
48 | struct key *session_keyring); | ||
49 | int call_usermodehelper_stdinpipe(struct subprocess_info *sub_info, | ||
50 | struct file **filp); | ||
51 | void call_usermodehelper_setcleanup(struct subprocess_info *info, | ||
52 | void (*cleanup)(char **argv, char **envp)); | ||
53 | |||
54 | /* Actually execute the sub-process */ | ||
55 | int call_usermodehelper_exec(struct subprocess_info *info, int wait); | ||
56 | |||
57 | /* Free the subprocess_info. This is only needed if you're not going | ||
58 | to call call_usermodehelper_exec */ | ||
59 | void call_usermodehelper_freeinfo(struct subprocess_info *info); | ||
41 | 60 | ||
42 | static inline int | 61 | static inline int |
43 | call_usermodehelper(char *path, char **argv, char **envp, int wait) | 62 | call_usermodehelper(char *path, char **argv, char **envp, int wait) |
44 | { | 63 | { |
45 | return call_usermodehelper_keys(path, argv, envp, NULL, wait); | 64 | struct subprocess_info *info; |
65 | |||
66 | info = call_usermodehelper_setup(path, argv, envp); | ||
67 | if (info == NULL) | ||
68 | return -ENOMEM; | ||
69 | return call_usermodehelper_exec(info, wait); | ||
70 | } | ||
71 | |||
72 | static inline int | ||
73 | call_usermodehelper_keys(char *path, char **argv, char **envp, | ||
74 | struct key *session_keyring, int wait) | ||
75 | { | ||
76 | struct subprocess_info *info; | ||
77 | |||
78 | info = call_usermodehelper_setup(path, argv, envp); | ||
79 | if (info == NULL) | ||
80 | return -ENOMEM; | ||
81 | |||
82 | call_usermodehelper_setkeys(info, session_keyring); | ||
83 | return call_usermodehelper_exec(info, wait); | ||
46 | } | 84 | } |
47 | 85 | ||
48 | extern void usermodehelper_init(void); | 86 | extern void usermodehelper_init(void); |