]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
modprobe: move log function
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 1 Nov 2012 14:39:18 +0000 (12:39 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 1 Nov 2012 14:46:12 +0000 (12:46 -0200)
tools/modprobe.c

index 17a8c1716bf8d27f1369f79eb897c620a023d8de..5bfba5726af05eee34e50751570a0defe2b5d5ec 100644 (file)
@@ -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;