From patchwork Mon Mar 26 18:01:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 148794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id D0485B6EE8 for ; Tue, 27 Mar 2012 05:02:18 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SCEEy-00072l-Vd; Mon, 26 Mar 2012 18:02:01 +0000 Received: from mail.tpi.com ([70.99.223.143]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SCEEt-0006wg-Jo for kernel-team@lists.ubuntu.com; Mon, 26 Mar 2012 18:01:56 +0000 Received: from salmon.rtg.net (mail.tpi.com [70.99.223.143]) by mail.tpi.com (Postfix) with ESMTP id 5FD89314708 for ; Mon, 26 Mar 2012 11:01:37 -0700 (PDT) Received: by salmon.rtg.net (Postfix, from userid 1000) id 9DBF7203BE; Mon, 26 Mar 2012 12:01:54 -0600 (MDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [Lucid PATCH 06/10] usermodehelper: kill umh_wait, renumber UMH_* constants Date: Mon, 26 Mar 2012 12:01:39 -0600 Message-Id: <1332784903-75063-7-git-send-email-tim.gardner@canonical.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1332784903-75063-1-git-send-email-tim.gardner@canonical.com> References: <1332784903-75063-1-git-send-email-tim.gardner@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Oleg Nesterov BugLink: http://bugs.launchpad.net/bugs/963685 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 Cc: Tetsuo Handa Cc: Rusty Russell Cc: Tejun Heo Cc: David Rientjes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (back ported from commit 9d944ef32e83405a07376f112e9f02161d3e9731) Signed-off-by: Tim Gardner --- include/linux/kmod.h | 19 ++++++++----------- kernel/kmod.c | 8 ++------ 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/include/linux/kmod.h b/include/linux/kmod.h index da7db04..1ebe117 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h @@ -46,12 +46,9 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; struct key; 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 { @@ -61,7 +58,7 @@ struct subprocess_info { char *path; char **argv; char **envp; - enum umh_wait wait; + int wait; int retval; struct file *stdin; int (*init)(struct subprocess_info *info); @@ -84,7 +81,7 @@ 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 */ @@ -92,7 +89,7 @@ void call_usermodehelper_freeinfo(struct subprocess_info *info); static inline int call_usermodehelper_fns(char *path, char **argv, char **envp, - enum umh_wait wait, + int wait, int (*init)(struct subprocess_info *info), void (*cleanup)(struct subprocess_info *), void *data) { @@ -110,7 +107,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); @@ -118,7 +115,7 @@ call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) static inline int call_usermodehelper_keys(char *path, char **argv, char **envp, - struct key *session_keyring, enum umh_wait wait) + struct key *session_keyring, int wait) { struct subprocess_info *info; gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; diff --git a/kernel/kmod.c b/kernel/kmod.c index 92296e1..ca3fda9 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -263,14 +263,11 @@ static void __call_usermodehelper(struct work_struct *work) { struct subprocess_info *sub_info = container_of(work, struct subprocess_info, work); + int wait = sub_info->wait & ~UMH_KILLABLE; pid_t pid; - enum umh_wait wait = sub_info->wait; BUG_ON(atomic_read(&sub_info->cred->usage) != 1); - 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. */ @@ -518,8 +515,7 @@ EXPORT_SYMBOL(call_usermodehelper_stdinpipe); * 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;