diff options
| author | Boaz Harrosh <bharrosh@panasas.com> | 2012-05-31 19:26:15 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 20:49:28 -0400 |
| commit | 785042f2e275089e22c36b462f6495ce8d91732d (patch) | |
| tree | 4e847408b4e675c7c616d357ae9b330f7104fbc0 /include/linux | |
| parent | 81ab6e7b26b453a795d46f2616ed0e31d97f05b9 (diff) | |
kmod: move call_usermodehelper_fns() to .c file and unexport all it's helpers
If we move call_usermodehelper_fns() to kmod.c file and EXPORT_SYMBOL it
we can avoid exporting all it's helper functions:
call_usermodehelper_setup
call_usermodehelper_setfns
call_usermodehelper_exec
And make all of them static to kmod.c
Since the optimizer will see all these as a single call site it will
inline them inside call_usermodehelper_fns(). So we loose the call to
_fns but gain 3 calls to the helpers. (Not that it matters)
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kmod.h | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index f07f9a4e10ff..5398d5807075 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
| @@ -66,36 +66,10 @@ struct subprocess_info { | |||
| 66 | void *data; | 66 | void *data; |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | /* Allocate a subprocess_info structure */ | 69 | extern int |
| 70 | struct subprocess_info *call_usermodehelper_setup(char *path, char **argv, | ||
| 71 | char **envp, gfp_t gfp_mask); | ||
| 72 | |||
| 73 | /* Set various pieces of state into the subprocess_info structure */ | ||
| 74 | void call_usermodehelper_setfns(struct subprocess_info *info, | ||
| 75 | int (*init)(struct subprocess_info *info, struct cred *new), | ||
| 76 | void (*cleanup)(struct subprocess_info *info), | ||
| 77 | void *data); | ||
| 78 | |||
| 79 | /* Actually execute the sub-process */ | ||
| 80 | int call_usermodehelper_exec(struct subprocess_info *info, int wait); | ||
| 81 | |||
| 82 | static inline int | ||
| 83 | call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, | 70 | call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, |
| 84 | int (*init)(struct subprocess_info *info, struct cred *new), | 71 | int (*init)(struct subprocess_info *info, struct cred *new), |
| 85 | void (*cleanup)(struct subprocess_info *), void *data) | 72 | void (*cleanup)(struct subprocess_info *), void *data); |
| 86 | { | ||
| 87 | struct subprocess_info *info; | ||
| 88 | gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; | ||
| 89 | |||
| 90 | info = call_usermodehelper_setup(path, argv, envp, gfp_mask); | ||
| 91 | |||
| 92 | if (info == NULL) | ||
| 93 | return -ENOMEM; | ||
| 94 | |||
| 95 | call_usermodehelper_setfns(info, init, cleanup, data); | ||
| 96 | |||
| 97 | return call_usermodehelper_exec(info, wait); | ||
| 98 | } | ||
| 99 | 73 | ||
| 100 | static inline int | 74 | static inline int |
| 101 | call_usermodehelper(char *path, char **argv, char **envp, int wait) | 75 | call_usermodehelper(char *path, char **argv, char **envp, int wait) |
