From bebd89afad3ae1b12c16b9676bbc122cde4dc444 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Sun, 8 Feb 2009 10:42:01 -0800 Subject: [PATCH] --- yaml --- r: 140524 b: refs/heads/master c: acae05156551fd7528fbb616271e672789388e3c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/kmod.h | 11 ++++++++--- trunk/kernel/kmod.c | 10 ++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index bf5efa0ca2d1..e6574d03df2c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8c8ef42aee8fcfb4128bb94c50d55c9f80ade525 +refs/heads/master: acae05156551fd7528fbb616271e672789388e3c diff --git a/trunk/include/linux/kmod.h b/trunk/include/linux/kmod.h index 92213a9194e1..d5fa565086d1 100644 --- a/trunk/include/linux/kmod.h +++ b/trunk/include/linux/kmod.h @@ -29,10 +29,15 @@ #ifdef CONFIG_MODULES /* modprobe exit status on success, -ve on error. Return value * usually useless though. */ -extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); -#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) +extern int __request_module(bool wait, const char *name, ...) \ + __attribute__((format(printf, 2, 3))); +#define request_module(mod...) __request_module(true, mod) +#define request_module_nowait(mod...) __request_module(false, mod) +#define try_then_request_module(x, mod...) \ + ((x) ?: (__request_module(false, mod), (x))) #else -static inline int request_module(const char * name, ...) { return -ENOSYS; } +static inline int request_module(const char *name, ...) { return -ENOSYS; } +static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; } #define try_then_request_module(x, mod...) (x) #endif diff --git a/trunk/kernel/kmod.c b/trunk/kernel/kmod.c index f0c8f545180d..b750675251e5 100644 --- a/trunk/kernel/kmod.c +++ b/trunk/kernel/kmod.c @@ -50,7 +50,8 @@ static struct workqueue_struct *khelper_wq; char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe"; /** - * request_module - try to load a kernel module + * __request_module - try to load a kernel module + * @wait: wait (or not) for the operation to complete * @fmt: printf style format string for the name of the module * @...: arguments as specified in the format string * @@ -63,7 +64,7 @@ char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe"; * If module auto-loading support is disabled then this function * becomes a no-operation. */ -int request_module(const char *fmt, ...) +int __request_module(bool wait, const char *fmt, ...) { va_list args; char module_name[MODULE_NAME_LEN]; @@ -108,11 +109,12 @@ int request_module(const char *fmt, ...) return -ENOMEM; } - ret = call_usermodehelper(modprobe_path, argv, envp, 1); + ret = call_usermodehelper(modprobe_path, argv, envp, + wait ? UMH_WAIT_PROC : UMH_WAIT_EXEC); atomic_dec(&kmod_concurrent); return ret; } -EXPORT_SYMBOL(request_module); +EXPORT_SYMBOL(__request_module); #endif /* CONFIG_MODULES */ struct subprocess_info {