Skip to content

Commit

Permalink
usermodehelper: kill umh_wait, renumber UMH_* constants
Browse files Browse the repository at this point in the history
No functional changes.  It is not sane to use UMH_KILLABLE with enum
umh_wait, but obviously we do not want another argument in
call_usermodehelper_* helpers.  Kill this enum, use the plain int.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Tetsuo Handa <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oleg-nesterov authored and torvalds committed Mar 23, 2012
1 parent d0bd587 commit 9d944ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
18 changes: 7 additions & 11 deletions include/linux/kmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
struct cred;
struct file;

enum umh_wait {
UMH_NO_WAIT = -1, /* don't wait at all */
UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */
UMH_WAIT_PROC = 1, /* wait for the process to complete */
};

#define UMH_NO_WAIT 0 /* don't wait at all */
#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */
#define UMH_WAIT_PROC 2 /* wait for the process to complete */
#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */

struct subprocess_info {
Expand All @@ -62,7 +59,7 @@ struct subprocess_info {
char *path;
char **argv;
char **envp;
enum umh_wait wait;
int wait;
int retval;
int (*init)(struct subprocess_info *info, struct cred *new);
void (*cleanup)(struct subprocess_info *info);
Expand All @@ -80,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
void *data);

/* Actually execute the sub-process */
int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
int call_usermodehelper_exec(struct subprocess_info *info, int wait);

/* Free the subprocess_info. This is only needed if you're not going
to call call_usermodehelper_exec */
void call_usermodehelper_freeinfo(struct subprocess_info *info);

static inline int
call_usermodehelper_fns(char *path, char **argv, char **envp,
enum umh_wait wait,
call_usermodehelper_fns(char *path, char **argv, char **envp, int wait,
int (*init)(struct subprocess_info *info, struct cred *new),
void (*cleanup)(struct subprocess_info *), void *data)
{
Expand All @@ -106,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
}

static inline int
call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
call_usermodehelper(char *path, char **argv, char **envp, int wait)
{
return call_usermodehelper_fns(path, argv, envp, wait,
NULL, NULL, NULL);
Expand Down
8 changes: 2 additions & 6 deletions kernel/kmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,9 @@ static void __call_usermodehelper(struct work_struct *work)
{
struct subprocess_info *sub_info =
container_of(work, struct subprocess_info, work);
enum umh_wait wait = sub_info->wait;
int wait = sub_info->wait & ~UMH_KILLABLE;
pid_t pid;

if (wait != UMH_NO_WAIT)
wait &= ~UMH_KILLABLE;

/* CLONE_VFORK: wait until the usermode helper has execve'd
* successfully We need the data structures to stay around
* until that is done. */
Expand Down Expand Up @@ -451,8 +448,7 @@ EXPORT_SYMBOL(call_usermodehelper_setfns);
* asynchronously if wait is not set, and runs as a child of keventd.
* (ie. it runs with full root capabilities).
*/
int call_usermodehelper_exec(struct subprocess_info *sub_info,
enum umh_wait wait)
int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
{
DECLARE_COMPLETION_ONSTACK(done);
int retval = 0;
Expand Down
2 changes: 1 addition & 1 deletion security/keys/request_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static void umh_keys_cleanup(struct subprocess_info *info)
* Call a usermode helper with a specific session keyring.
*/
static int call_usermodehelper_keys(char *path, char **argv, char **envp,
struct key *session_keyring, enum umh_wait wait)
struct key *session_keyring, int wait)
{
gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
struct subprocess_info *info =
Expand Down

0 comments on commit 9d944ef

Please sign in to comment.