aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kmod.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kmod.h')
-rw-r--r--include/linux/kmod.h44
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
38struct key; 38struct key;
39extern int call_usermodehelper_keys(char *path, char *argv[], char *envp[], 39struct file;
40 struct key *session_keyring, int wait); 40struct subprocess_info;
41
42/* Allocate a subprocess_info structure */
43struct subprocess_info *call_usermodehelper_setup(char *path,
44 char **argv, char **envp);
45
46/* Set various pieces of state into the subprocess_info structure */
47void call_usermodehelper_setkeys(struct subprocess_info *info,
48 struct key *session_keyring);
49int call_usermodehelper_stdinpipe(struct subprocess_info *sub_info,
50 struct file **filp);
51void call_usermodehelper_setcleanup(struct subprocess_info *info,
52 void (*cleanup)(char **argv, char **envp));
53
54/* Actually execute the sub-process */
55int 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 */
59void call_usermodehelper_freeinfo(struct subprocess_info *info);
41 60
42static inline int 61static inline int
43call_usermodehelper(char *path, char **argv, char **envp, int wait) 62call_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
72static inline int
73call_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
48extern void usermodehelper_init(void); 86extern void usermodehelper_init(void);