diff options
-rw-r--r-- | discover/device-handler.c | 22 | ||||
-rw-r--r-- | discover/parser-conf.c | 9 | ||||
-rw-r--r-- | discover/parser.c | 2 | ||||
-rw-r--r-- | discover/resource.c | 3 | ||||
-rw-r--r-- | discover/udev.c | 9 | ||||
-rw-r--r-- | lib/url/url.c | 9 |
6 files changed, 26 insertions, 28 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c index 8e71310..3a68767 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -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); diff --git a/discover/parser-conf.c b/discover/parser-conf.c index 4bd2387..3154a46 100644 --- a/discover/parser-conf.c +++ b/discover/parser-conf.c @@ -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; diff --git a/discover/parser.c b/discover/parser.c index 8d4c180..3153a65 100644 --- a/discover/parser.c +++ b/discover/parser.c @@ -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); } diff --git a/discover/resource.c b/discover/resource.c index b31a215..b4fa9ca 100644 --- a/discover/resource.c +++ b/discover/resource.c @@ -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; diff --git a/discover/udev.c b/discover/udev.c index 1ce623d..330b286 100644 --- a/discover/udev.c +++ b/discover/udev.c @@ -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) diff --git a/lib/url/url.c b/lib/url/url.c index 42bd4a1..6d1004f 100644 --- a/lib/url/url.c +++ b/lib/url/url.c @@ -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: |