Anonymous avatar Anonymous committed 80df994

builtin: kmod - hook up udev main logging to libkmod

Comments (0)

Files changed (4)

udev/udev-builtin-kmod.c

 		return insmod_alias(ctx, name, extra_options);
 }
 
+static void udev_kmod_log(void *data, int priority, const char *file, int line,
+			  const char *fn, const char *format, va_list args)
+{
+	udev_main_log(data, priority, file, line, fn, format, args);
+}
+
 static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test)
 {
 	struct udev *udev = udev_device_get_udev(dev);
 			return -ENOMEM;
 
 		info(udev, "load module index\n");
+		kmod_set_log_fn(ctx, udev_kmod_log, udev);
 		kmod_load_resources(ctx);
 	}
 
 		return -ENOMEM;
 
 	info(udev, "load module index\n");
+	kmod_set_log_fn(ctx, udev_kmod_log, udev);
 	kmod_load_resources(ctx);
 	return 0;
 }
 const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg);
 int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg);
 
-/* udevadm commands */
-struct udevadm_cmd {
-	const char *name;
-	int (*cmd)(struct udev *udev, int argc, char *argv[]);
-	const char *help;
-	int debug;
-};
-extern const struct udevadm_cmd udevadm_monitor;
-extern const struct udevadm_cmd udevadm_info;
-extern const struct udevadm_cmd udevadm_control;
-extern const struct udevadm_cmd udevadm_trigger;
-extern const struct udevadm_cmd udevadm_settle;
-extern const struct udevadm_cmd udevadm_test;
-extern const struct udevadm_cmd udevadm_test_builtin;
-
 /* built-in commands */
 enum udev_builtin_cmd {
 	UDEV_BUILTIN_BLKID,
 int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test);
 int udev_builtin_list(struct udev *udev);
 int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val);
+
+/* udev logging */
+void udev_main_log(struct udev *udev, int priority,
+		   const char *file, int line, const char *fn,
+		   const char *format, va_list args);
+
+/* udevadm commands */
+struct udevadm_cmd {
+	const char *name;
+	int (*cmd)(struct udev *udev, int argc, char *argv[]);
+	const char *help;
+	int debug;
+};
+extern const struct udevadm_cmd udevadm_info;
+extern const struct udevadm_cmd udevadm_trigger;
+extern const struct udevadm_cmd udevadm_settle;
+extern const struct udevadm_cmd udevadm_control;
+extern const struct udevadm_cmd udevadm_monitor;
+extern const struct udevadm_cmd udevadm_test;
+extern const struct udevadm_cmd udevadm_test_builtin;
 #endif
 
 static bool debug;
 
-static void log_fn(struct udev *udev, int priority,
+void udev_main_log(struct udev *udev, int priority,
 		   const char *file, int line, const char *fn,
 		   const char *format, va_list args)
 {
 		goto out;
 
 	udev_log_init("udevadm");
-	udev_set_log_fn(udev, log_fn);
+	udev_set_log_fn(udev, udev_main_log);
 	udev_selinux_init(udev);
 
 	for (;;) {
 
 static bool debug;
 
-static void log_fn(struct udev *udev, int priority,
+void udev_main_log(struct udev *udev, int priority,
 		   const char *file, int line, const char *fn,
 		   const char *format, va_list args)
 {
 		goto exit;
 
 	udev_log_init("udevd");
-	udev_set_log_fn(udev, log_fn);
+	udev_set_log_fn(udev, udev_main_log);
 	info(udev, "version %s\n", VERSION);
 	udev_selinux_init(udev);
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.