summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-05-09 16:12:24 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-05-16 11:56:28 +0800
commita5db3ced87f5f24500f785b70af8b8630bc1c077 (patch)
treed28c9f6e4f8c5642b19534ed9253db54a0f97591 /discover
parentc37e69dfc9df2d7adf442d2463633c067f5fceaf (diff)
downloadtalos-petitboot-a5db3ced87f5f24500f785b70af8b8630bc1c077.tar.gz
talos-petitboot-a5db3ced87f5f24500f785b70af8b8630bc1c077.zip
discover: log cleanup
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>
Diffstat (limited to 'discover')
-rw-r--r--discover/device-handler.c22
-rw-r--r--discover/parser-conf.c9
-rw-r--r--discover/parser.c2
-rw-r--r--discover/resource.c3
-rw-r--r--discover/udev.c9
5 files changed, 26 insertions, 19 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)
OpenPOWER on IntegriCloud