discover: log cleanup
authorJeremy Kerr <jk@ozlabs.org>
Thu, 9 May 2013 08:12:24 +0000 (16:12 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 16 May 2013 03:56:28 +0000 (11:56 +0800)
Remove some of the more noisy log messages, and add some information
pertinent to device resolution events.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/device-handler.c
discover/parser-conf.c
discover/parser.c
discover/resource.c
discover/udev.c
lib/url/url.c

index 8e71310ef5e614b38e9475478a117e7fed66f18d..3a687675c3bde9c0af445634dbf25a3ff91fcab0 100644 (file)
@@ -388,12 +388,17 @@ static bool __attribute__((used)) boot_option_is_resolved(
                resource_is_resolved(opt->icon);
 }
 
-static bool resource_resolve(struct resource *res, struct parser *parser,
+static bool resource_resolve(struct resource *res, const char *name,
+               struct discover_boot_option *opt,
                struct device_handler *handler)
 {
+       struct parser *parser = opt->source;
+
        if (resource_is_resolved(res))
                return true;
 
+       pb_log("Attempting to resolve resource %s->%s with parser %s\n",
+                       opt->option->id, name, parser->name);
        parser->resolve_resource(handler, res);
 
        return res->resolved;
@@ -402,9 +407,9 @@ static bool resource_resolve(struct resource *res, struct parser *parser,
 static bool boot_option_resolve(struct discover_boot_option *opt,
                struct device_handler *handler)
 {
-       return resource_resolve(opt->boot_image, opt->source, handler) &&
-               resource_resolve(opt->initrd, opt->source, handler) &&
-               resource_resolve(opt->icon, opt->source, handler);
+       return resource_resolve(opt->boot_image, "boot_image", opt, handler) &&
+               resource_resolve(opt->initrd, "initrd", opt, handler) &&
+               resource_resolve(opt->icon, "icon", opt, handler);
 }
 
 static void boot_option_finalise(struct discover_boot_option *opt)
@@ -434,9 +439,14 @@ static void process_boot_option_queue(struct device_handler *handler)
        list_for_each_entry_safe(&handler->unresolved_boot_options,
                        opt, tmp, list) {
 
+               pb_log("queue: attempting resolution for %s\n",
+                               opt->option->id);
+
                if (!boot_option_resolve(opt, handler))
                        continue;
 
+               pb_log("\tresolved!\n");
+
                list_remove(&opt->list);
                list_add(&opt->device->boot_options, &opt->list);
                talloc_steal(opt->device, opt);
@@ -477,6 +487,7 @@ static void context_commit(struct device_handler *handler,
 
                /* this new device might be able to resolve existing boot
                 * options */
+               pb_log("New device %s, processing queue\n", dev->device->id);
                process_boot_option_queue(handler);
        }
 
@@ -486,6 +497,9 @@ static void context_commit(struct device_handler *handler,
                list_remove(&opt->list);
 
                if (boot_option_resolve(opt, handler)) {
+                       pb_log("boot option %s is resolved, "
+                                       "sending to clients\n",
+                                       opt->option->id);
                        list_add(&dev->boot_options, &opt->list);
                        talloc_steal(dev, opt);
                        boot_option_finalise(opt);
index 4bd23871bc6e6980c2dc3d785de0eeb3bad27a74..3154a463c6908a5ea4b3e05a15b10c3f5bc468a4 100644 (file)
@@ -127,8 +127,6 @@ char *conf_get_pair(struct conf_context __attribute__((unused)) *conf, char *str
        }
 
 exit:
-       pb_log("%s: @%s@%s@\n", __func__, *name_out, *value_out);
-
        return end ? end + 1 : NULL;
 }
 
@@ -183,7 +181,7 @@ int conf_set_global_option(struct conf_context *conf, const char *name,
                if (streq(name, conf->global_options[i].name)) {
                        conf->global_options[i].value
                                = talloc_strdup(conf, value);
-                       pb_log("%s: @%s@%s@\n", __func__, name, value);
+                       pb_log("%s: %s = '%s'\n", __func__, name, value);
                        return 1;
                }
        }
@@ -207,11 +205,8 @@ const char *conf_get_global_option(struct conf_context *conf,
        assert(conf->global_options);
 
        for (i = 0; conf->global_options[i].name ;i++)
-               if (streq(name, conf->global_options[i].name)) {
-                       pb_log("%s: @%s@%s@\n", __func__, name,
-                               conf->global_options[i].value);
+               if (streq(name, conf->global_options[i].name))
                        return conf->global_options[i].value;
-               }
 
        assert(0 && "unknown global name");
        return NULL;
index 8d4c180c2c1bccc7a3a43f1da996c09f5b901f65..3153a657c7528f729e3341972f02fae91783496f 100644 (file)
@@ -116,6 +116,8 @@ static void iterate_parser_files(struct discover_context *ctx,
 
                rc = read_file(ctx, path, &buf, &len);
                if (!rc) {
+                       pb_log("Running parser %s on file %s\n",
+                                       parser->name, *filename);
                        parser->parse(ctx, buf, len);
                        talloc_free(buf);
                }
index b31a215b39be8b345e46abe97fcb1c2ae16387de..b4fa9ca3930f350b8622027a793c0a5be427ef55 100644 (file)
@@ -6,6 +6,7 @@
 #include <string.h>
 
 #include <url/url.h>
+#include <log/log.h>
 #include <talloc/talloc.h>
 
 #include "device-handler.h"
@@ -82,6 +83,8 @@ struct resource *create_devpath_resource(struct discover_boot_option *opt,
        devstr = talloc_strndup(res, devpath, pos - devpath);
        path = talloc_strdup(res, pos + 1);
 
+       pb_log("%s: resource depends on device %s\n", __func__, devstr);
+
        /* defer resolution until we can find a suitable matching device */
        info = talloc(res, struct devpath_resource_info);
        info->dev = devstr;
index 1ce623d17c6c61a8a1e7e2891af2adc89a799d42..330b286848513d47e68f769c64c7dfaeedf8bcc4 100644 (file)
@@ -59,16 +59,9 @@ static void udev_setup_event_params(struct udev_device *dev,
        if (!list)
                return;
 
-       udev_list_entry_foreach(entry, list) {
-               DBG("property: %s - %s\n",
-                       udev_list_entry_get_name(entry),
-                       udev_device_get_property_value(dev,
-                               udev_list_entry_get_name(entry)));
-
+       udev_list_entry_foreach(entry, list)
                event_set_param(event,udev_list_entry_get_name(entry),
                                udev_list_entry_get_value(entry));
-
-       }
 }
 
 static int udev_handle_dev_action(struct udev_device *dev, const char *action)
index 42bd4a1afb0e3e5bae5c8db61e2d316d06234c92..6d1004f7f806d2ac6e94cfd9e265be4446eee852 100644 (file)
@@ -162,8 +162,6 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str)
        struct pb_url *url;
        const char *p;
 
-       pb_log("%s: '%s'\n", __func__, url_str);
-
        if (!url_str || !*url_str) {
                assert(0 && "bad url");
                return NULL;
@@ -223,13 +221,6 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str)
 
        pb_url_parse_path(url);
 
-       pb_log(" scheme %d\n", url->scheme);
-       pb_log(" host '%s'\n", url->host);
-       pb_log(" port '%s'\n", url->port);
-       pb_log(" path '%s'\n", url->path);
-       pb_log(" dir '%s'\n", url->dir);
-       pb_log(" file '%s'\n", url->file);
-
        return url;
 
 fail: