summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-11-01 10:31:00 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-11-01 15:32:52 +0800
commit089d0a6eb769d531129a7cd1061493a1a24b4bef (patch)
tree62e6b58e6a9cd9b19ac9f7a8986b9d01cfe5ec70
parent896da834e7126759ef69c33347055c593abedde3 (diff)
downloadtalos-petitboot-089d0a6eb769d531129a7cd1061493a1a24b4bef.tar.gz
talos-petitboot-089d0a6eb769d531129a7cd1061493a1a24b4bef.zip
logging: Clean up debug logs
We have quite a few pb_logs which should be pb_debug. This change moves developer-specific info to pb_debug. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--discover/device-handler.c6
-rw-r--r--discover/discover-server.c4
-rw-r--r--discover/network.c2
-rw-r--r--discover/parser-conf.c2
-rw-r--r--discover/parser.c4
-rw-r--r--discover/udev.c11
-rw-r--r--discover/user-event.c12
-rw-r--r--ui/common/joystick.c2
-rw-r--r--ui/common/ps3.c12
-rw-r--r--ui/ncurses/nc-cui.c8
-rw-r--r--ui/ncurses/nc-menu.h16
-rw-r--r--ui/ncurses/nc-scr.h9
-rw-r--r--ui/ncurses/ps3-main.c2
-rw-r--r--ui/twin/main-generic.c2
-rw-r--r--ui/twin/pbt-client.c8
-rw-r--r--ui/twin/pbt-scr.c4
-rw-r--r--ui/twin/pbt-scr.h4
17 files changed, 43 insertions, 65 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index af9fbba..43bcd9f 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -440,7 +440,7 @@ static bool resource_resolve(struct resource *res, const char *name,
if (resource_is_resolved(res))
return true;
- pb_log("Attempting to resolve resource %s->%s with parser %s\n",
+ pb_debug("Attempting to resolve resource %s->%s with parser %s\n",
opt->option->id, name, parser->name);
parser->resolve_resource(handler, res);
@@ -502,13 +502,13 @@ 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",
+ pb_debug("queue: attempting resolution for %s\n",
opt->option->id);
if (!boot_option_resolve(opt, handler))
continue;
- pb_log("\tresolved!\n");
+ pb_debug("\tresolved!\n");
list_remove(&opt->list);
list_add_tail(&opt->device->boot_options, &opt->list);
diff --git a/discover/discover-server.c b/discover/discover-server.c
index 2467e33..41a4fde 100644
--- a/discover/discover-server.c
+++ b/discover/discover-server.c
@@ -74,12 +74,12 @@ static void print_clients(struct discover_server *server)
{
struct client *client;
- pb_log("current clients [%p,%p,%p]:\n",
+ pb_debug("current clients [%p,%p,%p]:\n",
&server->clients.head,
server->clients.head.prev,
server->clients.head.next);
list_for_each_entry(&server->clients, client, list)
- pb_log("\t[%p,%p,%p] client: %d\n", &client->list,
+ pb_debug("\t[%p,%p,%p] client: %d\n", &client->list,
client->list.prev, client->list.next,
client->fd);
}
diff --git a/discover/network.c b/discover/network.c
index d39f7a7..b9b0c50 100644
--- a/discover/network.c
+++ b/discover/network.c
@@ -204,7 +204,7 @@ static int interface_down(struct interface *interface)
static void udhcpc_process_exit(struct process *process)
{
struct interface *interface = process->data;
- pb_log("udhcp client [pid %d] for interface %s exited, rc %d\n",
+ pb_debug("udhcp client [pid %d] for interface %s exited, rc %d\n",
process->pid, interface->name, process->exit_status);
interface->udhcpc_process = NULL;
process_release(process);
diff --git a/discover/parser-conf.c b/discover/parser-conf.c
index 3154a46..79193ed 100644
--- a/discover/parser-conf.c
+++ b/discover/parser-conf.c
@@ -181,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_debug("%s: %s = '%s'\n", __func__, name, value);
return 1;
}
}
diff --git a/discover/parser.c b/discover/parser.c
index e83b994..7b70118 100644
--- a/discover/parser.c
+++ b/discover/parser.c
@@ -140,7 +140,7 @@ void iterate_parsers(struct discover_context *ctx, enum conf_method method)
if (i->parser->method != CONF_METHOD_LOCAL_FILE)
continue;
- pb_log("\ttrying parser '%s'\n", i->parser->name);
+ pb_debug("\ttrying parser '%s'\n", i->parser->name);
ctx->parser = i->parser;
iterate_parser_files(ctx, ctx->parser);
}
@@ -158,7 +158,7 @@ void iterate_parsers(struct discover_context *ctx, enum conf_method method)
if (i->parser->method != method)
continue;
- pb_log("\ttrying parser '%s'\n", i->parser->name);
+ pb_debug("\ttrying parser '%s'\n", i->parser->name);
ctx->parser = i->parser;
i->parser->parse(ctx, buf, len);
}
diff --git a/discover/udev.c b/discover/udev.c
index 6212e43..0c656f3 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -23,15 +23,6 @@
#include "pb-discover.h"
#include "device-handler.h"
-#if defined(DEBUG)
-#define DBG(fmt, args...) pb_log("DBG: " fmt, ## args)
-#define DBGS(fmt, args...) \
- pb_log("DBG:%s:%d: " fmt, __func__, __LINE__, ## args)
-#else
-#define DBG(fmt, args...)
-#define DBGS(fmt, args...)
-#endif
-
struct pb_udev {
struct udev *udev;
struct udev_monitor *monitor;
@@ -323,7 +314,7 @@ struct pb_udev *udev_init(struct waitset *waitset,
waiter_register_io(waitset, udev_monitor_get_fd(udev->monitor), WAIT_IN,
udev_process, udev->monitor);
- pb_log("%s: waiting on udev\n", __func__);
+ pb_debug("%s: waiting on udev\n", __func__);
return udev;
diff --git a/discover/user-event.c b/discover/user-event.c
index 275d9e2..4b56de4 100644
--- a/discover/user-event.c
+++ b/discover/user-event.c
@@ -65,11 +65,11 @@ static void user_event_print_event(struct event __attribute__((unused)) *event)
{
int i;
- pb_log("user_event %s event:\n", event_action_name(event->action));
- pb_log("\tdevice: %s\n", event->device);
+ pb_debug("user_event %s event:\n", event_action_name(event->action));
+ pb_debug("\tdevice: %s\n", event->device);
for (i = 0; i < event->n_params; i++)
- pb_log("\t%-12s => %s\n",
+ pb_debug("\t%-12s => %s\n",
event->params[i].name, event->params[i].value);
}
@@ -276,7 +276,7 @@ static int user_event_process(void *arg)
return 0;
}
- pb_log("%s: %u bytes\n", __func__, len);
+ pb_debug("%s: %u bytes\n", __func__, len);
user_event_handle_message(uev, buf, len);
@@ -287,7 +287,7 @@ static int user_event_destructor(void *arg)
{
struct user_event *uev = arg;
- pb_log("%s\n", __func__);
+ pb_debug("%s\n", __func__);
if (uev->socket >= 0)
close(uev->socket);
@@ -328,7 +328,7 @@ struct user_event *user_event_init(struct waitset *waitset,
waiter_register_io(waitset, uev->socket, WAIT_IN,
user_event_process, uev);
- pb_log("%s: waiting on %s\n", __func__, PBOOT_USER_EVENT_SOCKET);
+ pb_debug("%s: waiting on %s\n", __func__, PBOOT_USER_EVENT_SOCKET);
return uev;
diff --git a/ui/common/joystick.c b/ui/common/joystick.c
index 94c85fe..4faf8b6 100644
--- a/ui/common/joystick.c
+++ b/ui/common/joystick.c
@@ -94,7 +94,7 @@ struct pjs *pjs_init(void *ctx, int (*map)(const struct js_event *))
talloc_set_destructor(pjs, pjs_destructor);
- pb_log("%s: using %s\n", __func__, dev_name);
+ pb_debug("%s: using %s\n", __func__, dev_name);
return pjs;
diff --git a/ui/common/ps3.c b/ui/common/ps3.c
index c62a10d..d3ca6d6 100644
--- a/ui/common/ps3.c
+++ b/ui/common/ps3.c
@@ -141,11 +141,11 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
if (!result)
values->video_mode = (uint16_t)tmp;
- pb_log("%s: default_item: %x\n", __func__,
+ pb_debug("%s: default_item: %x\n", __func__,
(unsigned int)values->default_item);
- pb_log("%s: timeout: %u\n", __func__,
+ pb_debug("%s: timeout: %u\n", __func__,
(unsigned int)values->timeout);
- pb_log("%s: video_mode: %u\n", __func__,
+ pb_debug("%s: video_mode: %u\n", __func__,
(unsigned int)values->video_mode);
fail:
return (result || sum) ? -1 : 0;
@@ -163,8 +163,8 @@ int ps3_flash_set_values(const struct ps3_flash_values *values)
int result;
struct ps3_flash_ctx fc;
- pb_log("%s: default_item: %u\n", __func__, values->default_item);
- pb_log("%s: video_mode: %u\n", __func__, values->video_mode);
+ pb_debug("%s: default_item: %u\n", __func__, values->default_item);
+ pb_debug("%s: video_mode: %u\n", __func__, values->video_mode);
result = ps3_flash_open(&fc, "r+");
@@ -245,7 +245,7 @@ static int ps3_video_ioctl(int request, unsigned int *mode_id)
int ps3_set_video_mode(unsigned int mode_id)
{
- pb_log("%s: %u\n", __func__, mode_id);
+ pb_debug("%s: %u\n", __func__, mode_id);
return ps3_video_ioctl(PS3FB_IOCTL_SETMODE, &mode_id);
}
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index da97fd9..e02c6a6 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -60,7 +60,7 @@ void cui_abort(struct cui *cui)
void cui_resize(struct cui *cui)
{
- pb_log("%s: resizing\n", __func__);
+ pb_debug("%s: resizing\n", __func__);
cui->resize = 1;
}
@@ -112,7 +112,7 @@ static int cui_boot(struct pmenu_item *item)
assert(cui->current == &cui->main->scr);
- pb_log("%s: %s\n", __func__, cod->name);
+ pb_debug("%s: %s\n", __func__, cod->name);
nc_scr_status_printf(cui->current, "Booting %s...", cod->name);
@@ -302,7 +302,7 @@ static void cui_handle_resize(struct cui *cui)
return;
}
- pb_log("%s: {%u,%u}\n", __func__, ws.ws_row, ws.ws_col);
+ pb_debug("%s: {%u,%u}\n", __func__, ws.ws_row, ws.ws_col);
wclear(cui->current->main_ncw);
resize_term(ws.ws_row, ws.ws_col);
@@ -331,7 +331,7 @@ static int cui_boot_option_add(struct device *dev, struct boot_option *opt,
ITEM *selected;
int result;
- pb_log("%s: %p %s\n", __func__, opt, opt->id);
+ pb_debug("%s: %p %s\n", __func__, opt, opt->id);
selected = current_item(cui->main->ncm);
diff --git a/ui/ncurses/nc-menu.h b/ui/ncurses/nc-menu.h
index 3b7bc88..4beffb0 100644
--- a/ui/ncurses/nc-menu.h
+++ b/ui/ncurses/nc-menu.h
@@ -114,26 +114,18 @@ static inline struct pmenu *pmenu_from_scr(struct nc_scr *scr)
/* debug routines */
-#if defined(DEBUG)
-enum {do_debug = 1};
-#else
-enum {do_debug = 0};
-#endif
-
static inline void pmenu_dump_item(const ITEM *item)
{
- if (do_debug)
- pb_log("%p %s\n", item, (item ? item->name.str : "(null)"));
+ pb_debug("%p %s\n", item, (item ? item->name.str : "(null)"));
}
static inline void pmenu_dump_items(ITEM *const *items, unsigned int count)
{
unsigned int i;
- if (do_debug)
- for (i = 0; i < count; i++)
- pb_log("%u: %p %s\n", i, items[i],
- (items[i] ? items[i]->name.str : "(null)"));
+ for (i = 0; i < count; i++)
+ pb_debug("%u: %p %s\n", i, items[i],
+ (items[i] ? items[i]->name.str : "(null)"));
}
#endif
diff --git a/ui/ncurses/nc-scr.h b/ui/ncurses/nc-scr.h
index 298aa7d..9f80e65 100644
--- a/ui/ncurses/nc-scr.h
+++ b/ui/ncurses/nc-scr.h
@@ -34,14 +34,9 @@
# error "Curses header file not found."
#endif
-#ifdef DEBUG
-#define DBG(fmt, args...) pb_log("DBG: " fmt, ## args)
+#define DBG(fmt, args...) pb_debug("DBG: " fmt, ## args)
#define DBGS(fmt, args...) \
- pb_log("DBG:%s:%d: " fmt, __func__, __LINE__, ## args)
-#else
-#define DBG(fmt, args...)
-#define DBGS(fmt, args...)
-#endif
+ pb_debug("DBG:%s:%d: " fmt, __func__, __LINE__, ## args)
enum pb_nc_sig {
diff --git a/ui/ncurses/ps3-main.c b/ui/ncurses/ps3-main.c
index c4a3892..1269549 100644
--- a/ui/ncurses/ps3-main.c
+++ b/ui/ncurses/ps3-main.c
@@ -275,7 +275,7 @@ static int ps3_boot_cb(struct cui *cui, struct cui_opt_data *cod)
int altered_args;
char *orig_args;
- pb_log("%s: %s\n", __func__, cod->name);
+ pb_debug("%s: %s\n", __func__, cod->name);
assert(ps3->cui->current == &ps3->cui->main->scr);
diff --git a/ui/twin/main-generic.c b/ui/twin/main-generic.c
index 649ad00..2301e31 100644
--- a/ui/twin/main-generic.c
+++ b/ui/twin/main-generic.c
@@ -58,7 +58,7 @@ static int edit_preferences_cb(struct pbt_item *item)
(void)client;
- pb_log("%s: TODO\n", __func__);
+ pb_debug("%s: TODO\n", __func__);
return 0;
}
diff --git a/ui/twin/pbt-client.c b/ui/twin/pbt-client.c
index dba6110..21ed524 100644
--- a/ui/twin/pbt-client.c
+++ b/ui/twin/pbt-client.c
@@ -58,7 +58,7 @@ static int pbt_client_boot(struct pbt_item *item)
int result;
struct pb_opt_data *opt_data = pbt_opt_data_from_item(item);
- pb_log("%s: %s\n", __func__, pbt_item_name(item));
+ pb_debug("%s: %s\n", __func__, pbt_item_name(item));
pbt_frame_status_printf(&item->pbt_client->frame, "Booting %s...",
pbt_item_name(item));
@@ -88,7 +88,7 @@ static int pbt_device_add(struct device *dev, struct pbt_client *client)
struct pbt_quad q;
const char *icon_file;
- pb_log("%s: %p %s: n_options %d\n", __func__, dev, dev->id,
+ pb_debug("%s: %p %s: n_options %d\n", __func__, dev, dev->id,
dev->n_options);
pb_protocol_dump_device(dev, "", pb_log_get_stream());
@@ -181,7 +181,7 @@ static void pbt_device_remove(struct device *dev, struct pbt_client *client)
struct pbt_item *next_item;
struct pbt_item *i;
- pb_log("%s: %p %s: n_options %d\n", __func__, dev, dev->id,
+ pb_debug("%s: %p %s: n_options %d\n", __func__, dev, dev->id,
dev->n_options);
pb_protocol_dump_device(dev, "", pb_log_get_stream());
@@ -245,7 +245,7 @@ static struct discover_client_ops pbt_client_ops = {
static void pbt_client_destructor(struct pbt_client *client)
{
- pb_log("%s\n", __func__);
+ pb_debug("%s\n", __func__);
// move to screen twin_x11_destroy(twin_ctx);
talloc_free(client->discover_client);
diff --git a/ui/twin/pbt-scr.c b/ui/twin/pbt-scr.c
index e093c3c..79f6792 100644
--- a/ui/twin/pbt-scr.c
+++ b/ui/twin/pbt-scr.c
@@ -361,7 +361,7 @@ static int pbt_twin_waiter_cb(struct pbt_twin_ctx *twin_ctx)
static void pbt_scr_destructor(struct pbt_scr *scr)
{
- pb_log("%s\n", __func__);
+ pb_debug("%s\n", __func__);
twin_x11_destroy(scr->twin_ctx.x11);
// FIXME: need cursor cleanup???
@@ -409,7 +409,7 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx,
goto fail_ctx_create;
}
- pb_log("%s: x11: %p\n", __func__, scr->twin_ctx.x11);
+ pb_debug("%s: x11: %p\n", __func__, scr->twin_ctx.x11);
assert(scr->twin_ctx.x11->screen);
scr->tscreen = scr->twin_ctx.x11->screen;
diff --git a/ui/twin/pbt-scr.h b/ui/twin/pbt-scr.h
index 1198a59..2880ee1 100644
--- a/ui/twin/pbt-scr.h
+++ b/ui/twin/pbt-scr.h
@@ -33,9 +33,9 @@
# include <libtwin/twin_fbdev.h>
#endif
-#define DBG(fmt, args...) pb_log("DBG: " fmt, ## args)
+#define DBG(fmt, args...) pb_debug("DBG: " fmt, ## args)
#define DBGS(fmt, args...) \
- pb_log("DBG:%s:%d: " fmt, __func__, __LINE__, ## args)
+ pb_debug("DBG:%s:%d: " fmt, __func__, __LINE__, ## args)
struct pbt_quad {
twin_coord_t x;
OpenPOWER on IntegriCloud