aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-11-01 12:39:18 -0200
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-11-01 12:46:12 -0200
commit07df56eb2434b04880e3c92be6ab63a4b4c8e4aa (patch)
treea24ff0ff597472e9751304323ca1d8a13153e7cb
parent86cc1f2328d548e28eb18b5e5f4cab7f7190a023 (diff)
downloadkmod-07df56eb2434b04880e3c92be6ab63a4b4c8e4aa.tar.gz
modprobe: move log function
-rw-r--r--tools/modprobe.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 17a8c17..5bfba57 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -184,6 +184,35 @@ static _always_inline_ const char *prio_to_str(int prio)
return prioname;
}
+static void log_modprobe(void *data, int priority, const char *file, int line,
+ const char *fn, const char *format, va_list args)
+{
+ const char *prioname = prio_to_str(priority);
+ char *str;
+
+ if (vasprintf(&str, format, args) < 0)
+ return;
+
+ if (use_syslog) {
+#ifdef ENABLE_DEBUG
+ syslog(priority, "%s: %s:%d %s() %s", prioname, file, line,
+ fn, str);
+#else
+ syslog(priority, "%s: %s", prioname, str);
+#endif
+ } else {
+#ifdef ENABLE_DEBUG
+ fprintf(stderr, "modprobe: %s: %s:%d %s() %s", prioname, file,
+ line, fn, str);
+#else
+ fprintf(stderr, "modprobe: %s: %s", prioname, str);
+#endif
+ }
+
+ free(str);
+ (void)data;
+}
+
static inline void _log(int prio, const char *fmt, ...)
{
const char *prioname;
@@ -796,35 +825,6 @@ static char **prepend_options_from_env(int *p_argc, char **orig_argv)
return new_argv;
}
-static void log_modprobe(void *data, int priority, const char *file, int line,
- const char *fn, const char *format, va_list args)
-{
- const char *prioname = prio_to_str(priority);
- char *str;
-
- if (vasprintf(&str, format, args) < 0)
- return;
-
- if (use_syslog) {
-#ifdef ENABLE_DEBUG
- syslog(priority, "%s: %s:%d %s() %s", prioname, file, line,
- fn, str);
-#else
- syslog(priority, "%s: %s", prioname, str);
-#endif
- } else {
-#ifdef ENABLE_DEBUG
- fprintf(stderr, "modprobe: %s: %s:%d %s() %s", prioname, file,
- line, fn, str);
-#else
- fprintf(stderr, "modprobe: %s: %s", prioname, str);
-#endif
- }
-
- free(str);
- (void)data;
-}
-
static int do_modprobe(int argc, char **orig_argv)
{
struct kmod_ctx *ctx;