Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kmod: split off umh headers into its own file

In the future usermode helper users do not need to carry in all the of
kmod headers declarations.

Since kmod.h still includes umh.h this change has no functional changes,
each umh user can be cleaned up separately later and with time.

Link: http://lkml.kernel.org/r/20170810180618.22457-4-mcgrof@kernel.org
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jessica Yu <jeyu@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Michal Marek <mmarek@suse.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Daniel Mentz <danielmentz@google.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Luis R. Rodriguez and committed by
Linus Torvalds
c1f3fa2a 00653d3a

+71 -59
+1
MAINTAINERS
··· 7462 7462 L: linux-kernel@vger.kernel.org 7463 7463 S: Maintained 7464 7464 F: kernel/umh.c 7465 + F: include/linux/umh.h 7465 7466 7466 7467 KERNEL VIRTUAL MACHINE (KVM) 7467 7468 M: Paolo Bonzini <pbonzini@redhat.com>
+1 -59
include/linux/kmod.h
··· 19 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 20 */ 21 21 22 + #include <linux/umh.h> 22 23 #include <linux/gfp.h> 23 24 #include <linux/stddef.h> 24 25 #include <linux/errno.h> ··· 44 43 static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; } 45 44 #define try_then_request_module(x, mod...) (x) 46 45 #endif 47 - 48 - 49 - struct cred; 50 - struct file; 51 - 52 - #define UMH_NO_WAIT 0 /* don't wait at all */ 53 - #define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ 54 - #define UMH_WAIT_PROC 2 /* wait for the process to complete */ 55 - #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ 56 - 57 - struct subprocess_info { 58 - struct work_struct work; 59 - struct completion *complete; 60 - const char *path; 61 - char **argv; 62 - char **envp; 63 - int wait; 64 - int retval; 65 - int (*init)(struct subprocess_info *info, struct cred *new); 66 - void (*cleanup)(struct subprocess_info *info); 67 - void *data; 68 - } __randomize_layout; 69 - 70 - extern int 71 - call_usermodehelper(const char *path, char **argv, char **envp, int wait); 72 - 73 - extern struct subprocess_info * 74 - call_usermodehelper_setup(const char *path, char **argv, char **envp, 75 - gfp_t gfp_mask, 76 - int (*init)(struct subprocess_info *info, struct cred *new), 77 - void (*cleanup)(struct subprocess_info *), void *data); 78 - 79 - extern int 80 - call_usermodehelper_exec(struct subprocess_info *info, int wait); 81 - 82 - extern struct ctl_table usermodehelper_table[]; 83 - 84 - enum umh_disable_depth { 85 - UMH_ENABLED = 0, 86 - UMH_FREEZING, 87 - UMH_DISABLED, 88 - }; 89 - 90 - extern int __usermodehelper_disable(enum umh_disable_depth depth); 91 - extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth); 92 - 93 - static inline int usermodehelper_disable(void) 94 - { 95 - return __usermodehelper_disable(UMH_DISABLED); 96 - } 97 - 98 - static inline void usermodehelper_enable(void) 99 - { 100 - __usermodehelper_set_disable_depth(UMH_ENABLED); 101 - } 102 - 103 - extern int usermodehelper_read_trylock(void); 104 - extern long usermodehelper_read_lock_wait(long timeout); 105 - extern void usermodehelper_read_unlock(void); 106 46 107 47 #endif /* __LINUX_KMOD_H__ */
+69
include/linux/umh.h
··· 1 + #ifndef __LINUX_UMH_H__ 2 + #define __LINUX_UMH_H__ 3 + 4 + #include <linux/gfp.h> 5 + #include <linux/stddef.h> 6 + #include <linux/errno.h> 7 + #include <linux/compiler.h> 8 + #include <linux/workqueue.h> 9 + #include <linux/sysctl.h> 10 + 11 + struct cred; 12 + struct file; 13 + 14 + #define UMH_NO_WAIT 0 /* don't wait at all */ 15 + #define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ 16 + #define UMH_WAIT_PROC 2 /* wait for the process to complete */ 17 + #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ 18 + 19 + struct subprocess_info { 20 + struct work_struct work; 21 + struct completion *complete; 22 + const char *path; 23 + char **argv; 24 + char **envp; 25 + int wait; 26 + int retval; 27 + int (*init)(struct subprocess_info *info, struct cred *new); 28 + void (*cleanup)(struct subprocess_info *info); 29 + void *data; 30 + } __randomize_layout; 31 + 32 + extern int 33 + call_usermodehelper(const char *path, char **argv, char **envp, int wait); 34 + 35 + extern struct subprocess_info * 36 + call_usermodehelper_setup(const char *path, char **argv, char **envp, 37 + gfp_t gfp_mask, 38 + int (*init)(struct subprocess_info *info, struct cred *new), 39 + void (*cleanup)(struct subprocess_info *), void *data); 40 + 41 + extern int 42 + call_usermodehelper_exec(struct subprocess_info *info, int wait); 43 + 44 + extern struct ctl_table usermodehelper_table[]; 45 + 46 + enum umh_disable_depth { 47 + UMH_ENABLED = 0, 48 + UMH_FREEZING, 49 + UMH_DISABLED, 50 + }; 51 + 52 + extern int __usermodehelper_disable(enum umh_disable_depth depth); 53 + extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth); 54 + 55 + static inline int usermodehelper_disable(void) 56 + { 57 + return __usermodehelper_disable(UMH_DISABLED); 58 + } 59 + 60 + static inline void usermodehelper_enable(void) 61 + { 62 + __usermodehelper_set_disable_depth(UMH_ENABLED); 63 + } 64 + 65 + extern int usermodehelper_read_trylock(void); 66 + extern long usermodehelper_read_lock_wait(long timeout); 67 + extern void usermodehelper_read_unlock(void); 68 + 69 + #endif /* __LINUX_UMH_H__ */