diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kmod.h | 60 | ||||
| -rw-r--r-- | include/linux/umh.h | 69 |
2 files changed, 70 insertions, 59 deletions
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 655082c88fd9..40c89ad4bea6 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <linux/umh.h> | ||
| 22 | #include <linux/gfp.h> | 23 | #include <linux/gfp.h> |
| 23 | #include <linux/stddef.h> | 24 | #include <linux/stddef.h> |
| 24 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
| @@ -44,63 +45,4 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; | |||
| 44 | #define try_then_request_module(x, mod...) (x) | 45 | #define try_then_request_module(x, mod...) (x) |
| 45 | #endif | 46 | #endif |
| 46 | 47 | ||
| 47 | |||
| 48 | struct cred; | ||
| 49 | struct file; | ||
| 50 | |||
| 51 | #define UMH_NO_WAIT 0 /* don't wait at all */ | ||
| 52 | #define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ | ||
| 53 | #define UMH_WAIT_PROC 2 /* wait for the process to complete */ | ||
| 54 | #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ | ||
| 55 | |||
| 56 | struct subprocess_info { | ||
| 57 | struct work_struct work; | ||
| 58 | struct completion *complete; | ||
| 59 | const char *path; | ||
| 60 | char **argv; | ||
| 61 | char **envp; | ||
| 62 | int wait; | ||
| 63 | int retval; | ||
| 64 | int (*init)(struct subprocess_info *info, struct cred *new); | ||
| 65 | void (*cleanup)(struct subprocess_info *info); | ||
| 66 | void *data; | ||
| 67 | } __randomize_layout; | ||
| 68 | |||
| 69 | extern int | ||
| 70 | call_usermodehelper(const char *path, char **argv, char **envp, int wait); | ||
| 71 | |||
| 72 | extern struct subprocess_info * | ||
| 73 | call_usermodehelper_setup(const char *path, char **argv, char **envp, | ||
| 74 | gfp_t gfp_mask, | ||
| 75 | int (*init)(struct subprocess_info *info, struct cred *new), | ||
| 76 | void (*cleanup)(struct subprocess_info *), void *data); | ||
| 77 | |||
| 78 | extern int | ||
| 79 | call_usermodehelper_exec(struct subprocess_info *info, int wait); | ||
| 80 | |||
| 81 | extern struct ctl_table usermodehelper_table[]; | ||
| 82 | |||
| 83 | enum umh_disable_depth { | ||
| 84 | UMH_ENABLED = 0, | ||
| 85 | UMH_FREEZING, | ||
| 86 | UMH_DISABLED, | ||
| 87 | }; | ||
| 88 | |||
| 89 | extern int __usermodehelper_disable(enum umh_disable_depth depth); | ||
| 90 | extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth); | ||
| 91 | |||
| 92 | static inline int usermodehelper_disable(void) | ||
| 93 | { | ||
| 94 | return __usermodehelper_disable(UMH_DISABLED); | ||
| 95 | } | ||
| 96 | |||
| 97 | static inline void usermodehelper_enable(void) | ||
| 98 | { | ||
| 99 | __usermodehelper_set_disable_depth(UMH_ENABLED); | ||
| 100 | } | ||
| 101 | |||
| 102 | extern int usermodehelper_read_trylock(void); | ||
| 103 | extern long usermodehelper_read_lock_wait(long timeout); | ||
| 104 | extern void usermodehelper_read_unlock(void); | ||
| 105 | |||
| 106 | #endif /* __LINUX_KMOD_H__ */ | 48 | #endif /* __LINUX_KMOD_H__ */ |
diff --git a/include/linux/umh.h b/include/linux/umh.h new file mode 100644 index 000000000000..244aff638220 --- /dev/null +++ b/include/linux/umh.h | |||
| @@ -0,0 +1,69 @@ | |||
| 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__ */ | ||
