]> git.ozlabs.org Git - petitboot/commitdiff
lib/log: Switch to pb_log_fn
authorGeoff Levand <geoff@infradead.org>
Thu, 2 Aug 2018 17:29:34 +0000 (17:29 +0000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 7 Aug 2018 01:30:36 +0000 (11:30 +1000)
The only functional change should be an additional '/n' to
a few log messagees that seemed to be missing it.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
32 files changed:
discover/boot.c
discover/device-handler.c
discover/devmapper.c
discover/discover-server.c
discover/event.c
discover/ipmi.c
discover/platform-powerpc.c
discover/pxe-parser.c
discover/resource.c
discover/udev.c
discover/user-event.c
lib/file/file.c
lib/flash/flash.c
lib/pb-protocol/pb-protocol.c
lib/process/process.c
lib/security/common.c
lib/security/gpg.c
lib/security/openssl.c
lib/url/url.c
ui/common/discover-client.c
ui/common/joystick.c
ui/common/ps3.c
ui/common/timer.c
ui/common/ui-system.c
ui/ncurses/generic-main.c
ui/ncurses/nc-cui.c
ui/ncurses/nc-menu.c
ui/ncurses/ps3-main.c
ui/twin/main-generic.c
ui/twin/main-ps3.c
ui/twin/pbt-client.c
ui/twin/pbt-scr.c

index 04c32a188414e4f59f14285d72f87f32f35b2798..7faec9fcf684027117283a4f9806f1db26be727b 100644 (file)
@@ -94,7 +94,7 @@ static int kexec_load(struct boot_task *boot_task)
 
        process = process_create(boot_task);
        if (!process) {
-               pb_log("%s: failed to create process\n", __func__);
+               pb_log_fn("failed to create process\n");
                return -1;
        }
 
@@ -131,14 +131,14 @@ static int kexec_load(struct boot_task *boot_task)
 
        result = process_run_sync(process);
        if (result) {
-               pb_log("%s: failed to run process\n", __func__);
+               pb_log_fn("failed to run process\n");
                goto abort_kexec;
        }
 
        result = process->exit_status;
 
        if (result) {
-               pb_log("%s: failed: (%d)\n", __func__, result);
+               pb_log_fn("failed: (%d)\n", result);
                update_status(boot_task->status_fn, boot_task->status_arg,
                                STATUS_ERROR, "%s", process->stdout_buf);
        }
@@ -170,7 +170,7 @@ static int kexec_reboot(struct boot_task *task)
        }
 
        if (result)
-               pb_log("%s: failed: (%d)\n", __func__, result);
+               pb_log_fn("failed: (%d)\n", result);
 
        /* okay, kexec -e -f */
        if (result) {
@@ -179,7 +179,7 @@ static int kexec_reboot(struct boot_task *task)
        }
 
        if (result)
-               pb_log("%s: failed: (%d)\n", __func__, result);
+               pb_log_fn("failed: (%d)\n", result);
 
 
        return result;
@@ -423,7 +423,7 @@ static void boot_process(struct load_url_result *result, void *data)
                        _("Performing kexec load"));
 
        rc = kexec_load(task);
-       pb_log("%s: kexec_load returned %d\n", __func__, rc);
+       pb_log_fn("kexec_load returned %d\n", rc);
        if (rc == KEXEC_LOAD_DECRYPTION_FALURE) {
                update_status(task->status_fn, task->status_arg,
                                STATUS_ERROR, _("Decryption failed"));
@@ -526,7 +526,7 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
        } else if (opt && opt->boot_image) {
                image = opt->boot_image->url;
        } else {
-               pb_log("%s: no image specified\n", __func__);
+               pb_log_fn("no image specified\n");
                update_status(status_fn, status_arg, STATUS_INFO,
                                _("Boot failed: no image specified"));
                return NULL;
index 69bc050c7241925a215d2b28d2c77c26ff740e19..1299c33b7bb5c517dd06c1a6c1bee23bd10816a2 100644 (file)
@@ -675,7 +675,7 @@ void device_handler_status_download(struct device_handler *handler,
        }
 
        if (!update) {
-               pb_log("%s: failed to allocate new status\n", __func__);
+               pb_log_fn("failed to allocate new status\n");
        } else {
                device_handler_status_info(handler, "%s\n", update);
                talloc_free(update);
@@ -1568,7 +1568,7 @@ static void process_url_cb(struct load_url_result *result, void *data)
        const char *mac;
 
        if (result->status != LOAD_OK) {
-               pb_log("%s: Load failed for %s\n", __func__, result->url->full);
+               pb_log_fn("Load failed for %s\n", result->url->full);
                return;
        }
 
@@ -1673,7 +1673,7 @@ static void plugin_install_cb(struct process *process)
        struct device_handler *handler = process->data;
 
        if (!handler) {
-               pb_log("%s: Missing data!\n", __func__);
+               pb_log_fn("Missing data!\n");
                return;
        }
 
@@ -2206,7 +2206,7 @@ void device_handler_discover_context_commit(
                struct device_handler *handler __attribute__((unused)),
                struct discover_context *ctx __attribute__((unused)))
 {
-       pb_log("%s stubbed out for test cases\n", __func__);
+       pb_log_fn("stubbed out for test cases\n");
 }
 
 static void device_handler_update_lang(const char *lang __attribute__((unused)))
index d8445e62e999a7c7e9681fa7f3ce51ccf93b405e..f7407b77b3544c94d6fa85d86aac3d0c950ab7b5 100644 (file)
@@ -138,7 +138,7 @@ static bool snapshot_merge_complete(const char *dm_name)
 
        task = dm_task_create(DM_DEVICE_STATUS);
        if (!task) {
-               pb_log("%s: Error creating task\n", __func__);
+               pb_log_fn("Error creating task\n");
                return result;
        }
 
@@ -198,7 +198,7 @@ static int set_device_active(const char *dm_name, bool active)
                task = dm_task_create(DM_DEVICE_SUSPEND);
 
        if (!task) {
-               pb_log("%s: Could not create dm_task\n", __func__);
+               pb_log_fn("Could not create dm_task\n");
                return rc;
        }
 
@@ -461,7 +461,7 @@ static int destroy_device(const char *dm_name)
 
        task = dm_task_create(DM_DEVICE_REMOVE);
        if (!task) {
-               pb_log("%s: could not create dm_task\n", __func__);
+               pb_log_fn("could not create dm_task\n");
                return -1;
        }
 
@@ -543,13 +543,13 @@ static int reload_snapshot(struct discover_device *device, bool merge)
                         device->ramdisk->base);
        }
        if (!target.ttype || !target.params) {
-               pb_log("%s: failed to allocate parameters\n", __func__);
+               pb_log_fn("failed to allocate parameters\n");
                goto err1;
        }
 
        task = dm_task_create(DM_DEVICE_RELOAD);
        if (!task) {
-               pb_log("%s: Error creating task\n", __func__);
+               pb_log_fn("Error creating task\n");
                goto err1;
        }
 
@@ -560,7 +560,7 @@ static int reload_snapshot(struct discover_device *device, bool merge)
 
        if (!dm_task_add_target(task, target.start_sector, target.end_sector,
                                target.ttype, target.params)) {
-               pb_log("%s: Failed to set target\n", __func__);
+               pb_log_fn("Failed to set target\n");
                goto err2;
        }
 
@@ -581,7 +581,7 @@ err1:
 int devmapper_merge_snapshot(struct discover_device *device)
 {
        if (device->mounted) {
-               pb_log("%s: %s still mounted\n", __func__, device->device->id);
+               pb_log_fn("%s still mounted\n", device->device->id);
                return -1;
        }
 
index 3377fa66621fc29be47b0c4cb388342641000bfa..34d82be828cc623bb7e5f12b949a72c23953c052 100644 (file)
@@ -270,7 +270,7 @@ static int discover_server_process_message(void *arg)
                rc = pb_protocol_deserialise_boot_command(boot_command,
                                message);
                if (rc) {
-                       pb_log("%s: no boot command?", __func__);
+                       pb_log_fn("no boot command?\n");
                        return 0;
                }
 
@@ -291,7 +291,7 @@ static int discover_server_process_message(void *arg)
 
                rc = pb_protocol_deserialise_config(config, message);
                if (rc) {
-                       pb_log("%s: no config?", __func__);
+                       pb_log_fn("no config?\n");
                        return 0;
                }
 
@@ -328,7 +328,7 @@ static int discover_server_process_message(void *arg)
                break;
 
        default:
-               pb_log("%s: invalid action %d\n", __func__, message->action);
+               pb_log_fn("invalid action %d\n", message->action);
                return 0;
        }
 
index 047e9281fe8feabd8790d833780f4e9abe159bc6..ead2fdad88833387768d1489f9cf6d161f35de2c 100644 (file)
@@ -29,14 +29,14 @@ static int event_parse_ad_header(char *buf, int len, enum event_action *action,
        headerlen = strnlen(buf, len);
 
        if (!headerlen) {
-               pb_log("%s: bad header, no data\n", __func__);
+               pb_log_fn("bad header, no data\n");
                return -1;
        }
 
        /* we should see an <action>@<device>\0 at the head of the buffer */
        sep = strchr(buf, '@');
        if (!sep) {
-               pb_log("%s: bad header: %s\n", __func__, buf);
+               pb_log_fn("bad header: %s\n", buf);
                return -1;
        }
 
@@ -58,12 +58,12 @@ static int event_parse_ad_header(char *buf, int len, enum event_action *action,
        else if (streq(buf, "plugin"))
                *action = EVENT_ACTION_PLUGIN;
        else {
-               pb_log("%s: unknown action: %s\n", __func__, buf);
+               pb_log_fn("unknown action: %s\n", buf);
                return -1;
        }
 
        if (!*(sep + 1)) {
-               pb_log("%s: bad device: %s\n", __func__, buf);
+               pb_log_fn("bad device: %s\n", buf);
                return -1;
        }
 
index d652e9fbb966187384ea890780bf870bc8797a3b..f94dab76e24e79dfe050dc1df58ac716801e7ec0 100644 (file)
@@ -239,7 +239,7 @@ int parse_ipmi_interface_override(struct config *config, uint8_t *buf,
        i += sizeof(ipsize);
 
        if (!hwsize || !ipsize) {
-               pb_log("%s: Empty response\n", __func__);
+               pb_log_fn("Empty response\n");
                return -1;
        }
 
index df8c7d611d26a0c46c97de0bd921fc82e1414520..22d213d0a6dac503267d277711f67b86f5b6c575 100644 (file)
@@ -1193,7 +1193,7 @@ static void get_ipmi_network_override(struct platform_powerpc *platform,
        memcpy(&cookie, &resp[i], sizeof(cookie));
        cookie = __be32_to_cpu(cookie);
        if (cookie != magic_value) {
-               pb_log("%s: Incorrect cookie %x\n", __func__, cookie);
+               pb_log_fn("Incorrect cookie %x\n", cookie);
                return;
        }
        i += sizeof(cookie);
@@ -1259,7 +1259,7 @@ static int load_config(struct platform *p, struct config *config)
 
        rc = parse_nvram(platform);
        if (rc)
-               pb_log("%s: Failed to parse nvram\n", __func__);
+               pb_log_fn("Failed to parse nvram\n");
 
        populate_config(platform, config);
 
index 9221f95ae07744cb5cd136ed0187c429cc413f8a..ba0f81c44518bc2f754c583d35dabf55f2e311f1 100644 (file)
@@ -500,7 +500,7 @@ static int pxe_parse(struct discover_context *dc)
                        file_url = dc->conf_url;
 
                if (!file_url) {
-                       pb_log("%s: Failed to parse conf url!\n", __func__);
+                       pb_log_fn("Failed to parse conf url!\n");
                        goto out_conf;
                }
 
index 04e14cb42c634567a5d99f3cbab226d5055139d0..c09c1c51051679900b11dfc513b8f115436239f5 100644 (file)
@@ -86,7 +86,7 @@ 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);
+       pb_log_fn("resource depends on device %s\n", devstr);
 
        /* defer resolution until we can find a suitable matching device */
        info = talloc(res, struct devpath_resource_info);
index 883313bcee2548438cfcd0f3b00dec41397ceb3b..fa5d4b417a0f7f2164b6f4245bcf20e09f52ab2e 100644 (file)
@@ -81,11 +81,11 @@ static void udev_setup_device_params(struct udev_device *udev,
 static void lvm_vg_search(struct device_handler *handler)
 {
        if (process_run_simple(handler, pb_system_apps.vgscan, "-qq", NULL))
-               pb_log("%s: Failed to execute vgscan\n", __func__);
+               pb_log_fn("Failed to execute vgscan\n");
 
        if (process_run_simple(handler, pb_system_apps.vgchange, "-ay", "-qq",
                                NULL))
-               pb_log("%s: Failed to execute vgchange\n", __func__);
+               pb_log_fn("Failed to execute vgchange\n");
 }
 
 static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev,
index 128186beb0468be9f17c321e4d61199ac1746693..1257796494e5211f01d210a11565c9539a6bffca 100644 (file)
@@ -94,13 +94,13 @@ static struct resource *user_event_resource(struct discover_boot_option *opt,
 
        siaddr = event_get_param(event, "siaddr");
        if (!siaddr) {
-               pb_log("%s: next server option not found\n", __func__);
+               pb_log_fn("next server option not found\n");
                return NULL;
        }
 
        boot_file = event_get_param(event, "bootfile");
        if (!boot_file) {
-               pb_log("%s: bootfile not found\n", __func__);
+               pb_log_fn("bootfile not found\n");
                return NULL;
        }
 
@@ -148,7 +148,7 @@ static int parse_user_event(struct discover_context *ctx, struct event *event)
        val = event_get_param(event, "name");
 
        if (!val) {
-               pb_log("%s: no name found\n", __func__);
+               pb_log_fn("no name found\n");
                goto fail_opt;
        }
 
@@ -157,7 +157,7 @@ static int parse_user_event(struct discover_context *ctx, struct event *event)
 
        d_opt->boot_image = user_event_resource(d_opt, event, false);
        if (!d_opt->boot_image) {
-               pb_log("%s: no boot image found for %s!\n", __func__,
+               pb_log_fn("no boot image found for %s!\n",
                                opt->name);
                goto fail_opt;
        }
@@ -288,7 +288,7 @@ struct pb_url *user_event_parse_conf_url(struct discover_context *ctx,
 
        host = parse_host_addr(event);
        if (!host) {
-               pb_log("%s: host address not found\n", __func__);
+               pb_log_fn("host address not found\n");
 
                /* No full URLs and no host address? Check for DHCPv6 options */
                if (bootfile_url && is_url(bootfile_url)) {
@@ -362,7 +362,7 @@ char **user_event_parse_conf_filenames(
        }
 
        if (!mac_addr && !ip_hex) {
-               pb_log("%s: neither mac nor ip parameter found\n", __func__);
+               pb_log_fn("neither mac nor ip parameter found\n");
                return NULL;
        }
 
@@ -672,12 +672,12 @@ static int user_event_process(void *arg)
        len = recvfrom(uev->socket, buf, PBOOT_USER_EVENT_SIZE, 0, NULL, NULL);
 
        if (len < 0) {
-               pb_log("%s: socket read failed: %s", __func__, strerror(errno));
+               pb_log_fn("socket read failed: %s\n", strerror(errno));
                return 0;
        }
 
        if (len == 0) {
-               pb_log("%s: empty", __func__);
+               pb_log_fn("empty\n");
                return 0;
        }
 
index b575d343150ebbb246d8c0ccf5961a68fd434708..6028005712788c9b8dd8c4d552561f211f2fcdcd 100644 (file)
@@ -54,13 +54,13 @@ int copy_file_secure_dest(void *ctx, const char *source_file,
 
        destination_fd = mkstemp(template);
        if (destination_fd < 0) {
-               pb_log("%s: unable to create temp file, %m\n", __func__);
+               pb_log_fn("unable to create temp file, %m\n");
                fclose(source_handle);
                return -1;
        }
        destination_handle = fdopen(destination_fd, "w");
        if (!destination_handle) {
-               pb_log("%s: unable to open destination file, %m\n", __func__);
+               pb_log_fn("unable to open destination file, %m\n");
                fclose(source_handle);
                close(destination_fd);
                return -1;
@@ -81,7 +81,7 @@ int copy_file_secure_dest(void *ctx, const char *source_file,
                        if (ferror(destination_handle)) {
                                /* General error */
                                result = -1;
-                               pb_log("%s: failed: unknown fault\n", __func__);
+                               pb_log_fn("failed: unknown fault\n");
                        }
                        else {
                                /* No space on destination device */
index 464b8760b54db8cdd2d8b51564f9dbdcf5a81b26..b7e5b88b95684f737eeaa4366cda298387c046c1 100644 (file)
@@ -94,7 +94,7 @@ static struct flash_info *flash_setup_buffer(void *ctx, const char *partition)
 
        rc = ffs_init(0, info->size, info->bl, &info->ffs, 1);
        if (rc) {
-               pb_log("%s: Failed to init ffs\n", __func__);
+               pb_log_fn("Failed to init ffs\n");
                goto out_flash;
        }
 
@@ -171,7 +171,7 @@ int flash_parse_version(void *ctx, char ***versions, bool current)
        len = cur_info->attr_data_len -  ecc_size(cur_info->attr_data_len);
        buffer = talloc_array(cur_info, char, len);
        if (!buffer) {
-               pb_log("%s: Failed to init buffer!\n", __func__);
+               pb_log_fn("Failed to init buffer!\n");
                goto out;
        }
 
@@ -187,7 +187,7 @@ int flash_parse_version(void *ctx, char ***versions, bool current)
        if (tok) {
                tmp = talloc_realloc(ctx, tmp, char *, n + 1);
                if (!tmp) {
-                       pb_log("%s: Failed to allocate memory\n", __func__);
+                       pb_log_fn("Failed to allocate memory\n");
                        goto out;
                }
                tmp[n++] = talloc_strdup(ctx, tok);
@@ -198,7 +198,7 @@ int flash_parse_version(void *ctx, char ***versions, bool current)
                /* Ignore leading tab from subsequent lines */
                tmp = talloc_realloc(ctx, tmp, char *, n + 1);
                if (!tmp) {
-                       pb_log("%s: Failed to reallocate memory\n", __func__);
+                       pb_log_fn("Failed to reallocate memory\n");
                        n = 0;
                        goto out;
                }
index 41707da09ab0d7345c8d0a0a2d2f9d1b48f43517..315efc4cf000555f9575b20c489d01441aeca0e3 100644 (file)
@@ -725,7 +725,7 @@ int pb_protocol_write_message(int fd, struct pb_protocol_message *message)
        if (!total_len)
                return 0;
 
-       pb_log("%s: failed: %s\n", __func__, strerror(errno));
+       pb_log_fn("failed: %s\n", strerror(errno));
        return -1;
 }
 
@@ -735,7 +735,7 @@ struct pb_protocol_message *pb_protocol_create_message(void *ctx,
        struct pb_protocol_message *message;
 
        if (payload_len > PB_PROTOCOL_MAX_PAYLOAD_SIZE) {
-               pb_log("%s: payload too big %u/%u\n", __func__, payload_len,
+               pb_log_fn("payload too big %u/%u\n", payload_len,
                        PB_PROTOCOL_MAX_PAYLOAD_SIZE);
                return NULL;
        }
@@ -766,7 +766,7 @@ struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
        m.action = __be32_to_cpu(m.action);
 
        if (m.payload_len > PB_PROTOCOL_MAX_PAYLOAD_SIZE) {
-               pb_log("%s: payload too big %u/%u\n", __func__, m.payload_len,
+               pb_log_fn("payload too big %u/%u\n", m.payload_len,
                        PB_PROTOCOL_MAX_PAYLOAD_SIZE);
                return NULL;
        }
@@ -779,7 +779,7 @@ struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
 
                if (rc <= 0) {
                        talloc_free(message);
-                       pb_log("%s: failed (%u): %s\n", __func__, len,
+                       pb_log_fn("failed (%u): %s\n", len,
                                strerror(errno));
                        return NULL;
                }
index c1606a52b342406de99d44d9cd07a678a327ba29..1fa0bb0dd347aafa48f4844ed00d15487dacd9bb 100644 (file)
@@ -92,7 +92,7 @@ static int process_read_stdout_once(struct process_info *procinfo, char **line)
        if (rc < 0) {
                if (errno == EINTR)
                        return 1;
-               pb_log("%s: read failed: %s\n", __func__, strerror(errno));
+               pb_log_fn("read failed: %s\n", strerror(errno));
                return rc;
        }
 
@@ -232,7 +232,7 @@ static void sigchld_sigaction(int signo, siginfo_t *info,
 
        rc = write(procset->sigchld_pipe[1], &pid, sizeof(pid));
        if (rc != sizeof(pid))
-               pb_log("%s: write failed: %s\n", __func__, strerror(errno));
+               pb_log_fn("write failed: %s\n", strerror(errno));
 }
 
 static int sigchld_pipe_event(void *arg)
@@ -306,7 +306,7 @@ struct procset *process_init(void *ctx, struct waitset *set, bool dry_run)
 
        rc = pipe(procset->sigchld_pipe);
        if (rc) {
-               pb_log("%s: pipe() failed: %s\n", __func__, strerror(errno));
+               pb_log_fn("pipe() failed: %s\n", strerror(errno));
                goto err_free;
        }
 
@@ -322,7 +322,7 @@ struct procset *process_init(void *ctx, struct waitset *set, bool dry_run)
 
        rc = sigaction(SIGCHLD, &sa, NULL);
        if (rc) {
-               pb_log("%s: sigaction() failed: %s\n", __func__,
+               pb_log_fn("sigaction() failed: %s\n",
                                strerror(errno));
                goto err_remove;
        }
@@ -374,7 +374,7 @@ static int process_run_common(struct process_info *procinfo)
 
        pid = fork();
        if (pid < 0) {
-               pb_log("%s: fork failed: %s\n", __func__, strerror(errno));
+               pb_log_fn("fork failed: %s\n", strerror(errno));
                return pid;
        }
 
@@ -410,7 +410,7 @@ int process_run_sync(struct process *process)
                if (errno == EINTR)
                        continue;
 
-               pb_log("%s: waitpid failed: %s\n", __func__, strerror(errno));
+               pb_log_fn("waitpid failed: %s\n", strerror(errno));
                return rc;
        }
 
index df040549a57c0435de195fc9592a671160da745a..a93ee9890eca98ff2f153fdbb2410faf12c269ca 100644 (file)
@@ -81,7 +81,7 @@ int validate_boot_files(struct boot_task *boot_task) {
     /* Load authorized signatures file */
     authorized_signatures_handle = fopen(LOCKDOWN_FILE, "r");
     if (!authorized_signatures_handle) {
-        pb_log("%s: unable to read lockdown file\n", __func__);
+        pb_log_fn("unable to read lockdown file\n");
         return KEXEC_LOAD_SIG_SETUP_INVALID;
     }
 
index aae85aa06e1084fbf365f537b8003bfee3b098b9..e319a069036b607c1ef13eb2bb5329a7b42ca56f 100644 (file)
@@ -73,22 +73,22 @@ int decrypt_file(const char *filename,
        gpgme_set_locale(NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
        err = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: OpenPGP support not available\n", __func__);
+               pb_log_fn("OpenPGP support not available\n");
                return -1;
        }
        err = gpgme_get_engine_info(&enginfo);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: GPG engine failed to initialize\n", __func__);
+               pb_log_fn("GPG engine failed to initialize\n");
                return -1;
        }
        err = gpgme_new(&gpg_context);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: GPG context could not be created\n", __func__);
+               pb_log_fn("GPG context could not be created\n");
                return -1;
        }
        err = gpgme_set_protocol(gpg_context, GPGME_PROTOCOL_OpenPGP);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: GPG protocol could not be set\n", __func__);
+               pb_log_fn("GPG protocol could not be set\n");
                return -1;
        }
        if (keyring_path)
@@ -100,7 +100,7 @@ int decrypt_file(const char *filename,
                        GPGME_PROTOCOL_OpenPGP,
                        enginfo->file_name, enginfo->home_dir);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: Could not set GPG engine information\n", __func__);
+               pb_log_fn("Could not set GPG engine information\n");
                return -1;
        }
        err = gpgme_data_new(&plaintext_data);
@@ -120,7 +120,7 @@ int decrypt_file(const char *filename,
        err = gpgme_op_decrypt_verify(gpg_context, ciphertext_data,
                plaintext_data);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: Could not decrypt file\n", __func__);
+               pb_log_fn("Could not decrypt file\n");
                return -1;
        }
        verification_result = gpgme_op_verify_result(gpg_context);
@@ -210,7 +210,7 @@ int decrypt_file(const char *filename,
        gpgme_release(gpg_context);
 
        if (!valid) {
-               pb_log("%s: Incorrect GPG signature\n", __func__);
+               pb_log_fn("Incorrect GPG signature\n");
                return -1;
        }
 
@@ -242,22 +242,22 @@ int verify_file_signature(const char *plaintext_filename,
        gpgme_set_locale(NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
        err = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: OpenPGP support not available\n", __func__);
+               pb_log_fn("OpenPGP support not available\n");
                return -1;
        }
        err = gpgme_get_engine_info(&enginfo);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: GPG engine failed to initialize\n", __func__);
+               pb_log_fn("GPG engine failed to initialize\n");
                return -1;
        }
        err = gpgme_new(&gpg_context);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: GPG context could not be created\n", __func__);
+               pb_log_fn("GPG context could not be created\n");
                return -1;
        }
        err = gpgme_set_protocol(gpg_context, GPGME_PROTOCOL_OpenPGP);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: GPG protocol could not be set\n", __func__);
+               pb_log_fn("GPG protocol could not be set\n");
                return -1;
        }
        if (keyring_path)
@@ -269,7 +269,7 @@ int verify_file_signature(const char *plaintext_filename,
                        GPGME_PROTOCOL_OpenPGP, enginfo->file_name,
                        enginfo->home_dir);
        if (err != GPG_ERR_NO_ERROR) {
-               pb_log("%s: Could not set GPG engine information\n", __func__);
+               pb_log_fn("Could not set GPG engine information\n");
                return -1;
        }
        err = gpgme_data_new_from_file(&plaintext_data, plaintext_filename, 1);
@@ -340,7 +340,7 @@ int verify_file_signature(const char *plaintext_filename,
        gpgme_release(gpg_context);
 
        if (!valid) {
-               pb_log("%s: Incorrect GPG signature\n", __func__);
+               pb_log_fn("Incorrect GPG signature\n");
                return -1;
        }
 
index 6454f8a8668c14b2db7f5f3961a792ea9f4b5685..d9dfb95e0dd7d10172d13fb6705d03e11a085787 100644 (file)
@@ -94,7 +94,7 @@ static int get_pkcs12(FILE *keyfile, X509 **cert, EVP_PKEY **priv)
                 */
                if (!PKCS12_parse(p12, NULL, priv, cert, NULL) &&
                    !PKCS12_parse(p12,   "", priv, cert, NULL)) {
-                       pb_log("%s: Error parsing OpenSSL PKCS12:\n", __func__);
+                       pb_log_fn("Error parsing OpenSSL PKCS12:\n");
                        ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
                } else
                        ok = 1;
@@ -131,7 +131,7 @@ static STACK_OF(X509) *get_cert_stack(FILE *keyfile)
                if (cert)
                        sk_X509_push(certs, get_cert(keyfile));
        } else {
-               pb_log("%s: Error allocating OpenSSL X509 stack:\n", __func__);
+               pb_log_fn("Error allocating OpenSSL X509 stack:\n");
                ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
        }
 
@@ -168,7 +168,7 @@ static EVP_PKEY *get_public_key(FILE *keyfile)
 
        /* handles both cases */
        if (!pkey) {
-               pb_log("%s: Error loading OpenSSL public key:\n", __func__);
+               pb_log_fn("Error loading OpenSSL public key:\n");
                ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
        }
 
@@ -240,7 +240,7 @@ int decrypt_file(const char *filename,
 
        certs = sk_X509_new_null();
        if (!certs) {
-               pb_log("%s: Error allocating OpenSSL X509 stack:\n", __func__);
+               pb_log_fn("Error allocating OpenSSL X509 stack:\n");
                ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
                goto out;
        }
@@ -268,7 +268,7 @@ int decrypt_file(const char *filename,
        /* in this mode its attached content */
        if (!CMS_verify(cms, certs, NULL, content_bio, out_bio,
                        CMS_NO_SIGNER_CERT_VERIFY | CMS_BINARY)) {
-               pb_log("%s: Failed OpenSSL CMS decrypt verify:\n", __func__);
+               pb_log_fn("Failed OpenSSL CMS decrypt verify:\n");
                ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
                goto out;
        }
@@ -359,7 +359,7 @@ int verify_file_signature(const char *plaintext_filename,
 
                if (!CMS_verify(cms, certs, NULL, plaintext_bio, NULL,
                                CMS_DETACHED | CMS_NO_SIGNER_CERT_VERIFY | CMS_BINARY)) {
-                       pb_log("%s: Failed OpenSSL CMS verify:\n", __func__);
+                       pb_log_fn("Failed OpenSSL CMS verify:\n");
                        ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
                        goto out;
                }
@@ -375,7 +375,7 @@ int verify_file_signature(const char *plaintext_filename,
                ctx = EVP_MD_CTX_create();
 
                if (!ctx) {
-                       pb_log("%s: Error allocating OpenSSL MD ctx:\n", __func__);
+                       pb_log_fn("Error allocating OpenSSL MD ctx:\n");
                        ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
                        goto out;
                }
@@ -385,7 +385,7 @@ int verify_file_signature(const char *plaintext_filename,
                        goto out;
 
                if (EVP_DigestVerifyInit(ctx, NULL, s_verify_md, NULL, pkey) < 1) {
-                       pb_log("%s: Error initializing OpenSSL verify:\n", __func__);
+                       pb_log_fn("Error initializing OpenSSL verify:\n");
                        ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
                        goto out;
                }
@@ -425,7 +425,7 @@ int verify_file_signature(const char *plaintext_filename,
                if (EVP_DigestVerifyFinal(ctx, (unsigned char*)sigbuf, siglen))
                        nok = 0;
                else {
-                       pb_log("%s: Error finalizing OpenSSL verify:\n", __func__);
+                       pb_log_fn("Error finalizing OpenSSL verify:\n");
                        ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
                }
        }
index f0e8b0eef610ae7021c6b749fd396ddfa6039be3..44e9ac403b7daa4c9e04ad549b4f45b4cc3e661b 100644 (file)
@@ -193,7 +193,7 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str)
                path = strchr(p, '/');
 
                if (!path) {
-                       pb_log("%s: parse path failed '%s'\n", __func__ , p);
+                       pb_log_fn("parse path failed '%s'\n" , p);
                        goto fail;
                }
 
index 88d0b4e3a8cea9eb31e4f129800d261f64a0b3ff..d94149765dc95a3130c33035ef0bff27cfbfcb65 100644 (file)
@@ -197,7 +197,7 @@ static int discover_client_process(void *arg)
 
                rc = pb_protocol_deserialise_device(dev, message);
                if (rc) {
-                       pb_log("%s: no device?\n", __func__);
+                       pb_log_fn("no device?\n");
                        goto out;
                }
 
@@ -208,7 +208,7 @@ static int discover_client_process(void *arg)
 
                rc = pb_protocol_deserialise_boot_option(opt, message);
                if (rc) {
-                       pb_log("%s: no boot_option?\n", __func__);
+                       pb_log_fn("no boot_option?\n");
                        goto out;
                }
 
@@ -217,7 +217,7 @@ static int discover_client_process(void *arg)
        case PB_PROTOCOL_ACTION_DEVICE_REMOVE:
                dev_id = pb_protocol_deserialise_string(ctx, message);
                if (!dev_id) {
-                       pb_log("%s: no device id?\n", __func__);
+                       pb_log_fn("no device id?\n");
                        goto out;
                }
                device_remove(client, dev_id);
@@ -227,7 +227,7 @@ static int discover_client_process(void *arg)
 
                rc = pb_protocol_deserialise_boot_status(status, message);
                if (rc) {
-                       pb_log("%s: invalid status message?\n", __func__);
+                       pb_log_fn("invalid status message?\n");
                        goto out;
                }
                update_status(client, status);
@@ -237,7 +237,7 @@ static int discover_client_process(void *arg)
 
                rc = pb_protocol_deserialise_system_info(sysinfo, message);
                if (rc) {
-                       pb_log("%s: invalid sysinfo message?\n", __func__);
+                       pb_log_fn("invalid sysinfo message?\n");
                        goto out;
                }
                update_sysinfo(client, sysinfo);
@@ -247,7 +247,7 @@ static int discover_client_process(void *arg)
 
                rc = pb_protocol_deserialise_config(config, message);
                if (rc) {
-                       pb_log("%s: invalid config message?\n", __func__);
+                       pb_log_fn("invalid config message?\n");
                        goto out;
                }
                update_config(client, config);
@@ -257,7 +257,7 @@ static int discover_client_process(void *arg)
 
                rc = pb_protocol_deserialise_plugin_option(p_opt, message);
                if (rc) {
-                       pb_log("%s: no plugin_option?\n", __func__);
+                       pb_log_fn("no plugin_option?\n");
                        goto out;
                }
 
@@ -267,7 +267,7 @@ static int discover_client_process(void *arg)
                plugins_remove(client);
                break;
        default:
-               pb_log("%s: unknown action %d\n", __func__, message->action);
+               pb_log_fn("unknown action %d\n", message->action);
        }
 
 out:
@@ -291,7 +291,7 @@ struct discover_client* discover_client_init(struct waitset *waitset,
 
        client->fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (client->fd < 0) {
-               pb_log("%s: socket: %s\n", __func__, strerror(errno));
+               pb_log_fn("socket: %s\n", strerror(errno));
                goto out_err;
        }
 
@@ -304,7 +304,7 @@ struct discover_client* discover_client_init(struct waitset *waitset,
        strcpy(addr.sun_path, PB_SOCKET_PATH);
 
        if (connect(client->fd, (struct sockaddr *)&addr, sizeof(addr))) {
-               pb_log("%s: connect: %s\n", __func__, strerror(errno));
+               pb_log_fn("connect: %s\n", strerror(errno));
                goto out_err;
        }
 
index a3d6abd6acc37803809c75f6cbd887336bf54c0f..f75ae3d384bb79e9e14778918f695b0b4b6fc33f 100644 (file)
@@ -47,7 +47,7 @@ int pjs_process_event(const struct pjs *pjs)
        result = read(pjs->fd, &e, sizeof(e));
 
        if (result != sizeof(e)) {
-               pb_log("%s: read failed: %s\n", __func__, strerror(errno));
+               pb_log_fn("read failed: %s\n", strerror(errno));
                return 0;
        }
 
@@ -86,7 +86,7 @@ struct pjs *pjs_init(void *ctx, int (*map)(const struct js_event *))
        pjs->fd = open(dev_name, O_RDONLY | O_NONBLOCK);
 
        if (pjs->fd < 0) {
-               pb_log("%s: open %s failed: %s\n", __func__, dev_name,
+               pb_log_fn("open %s failed: %s\n", dev_name,
                        strerror(errno));
                goto out_err;
        }
index c9b97b5d2ca9da734b8b934c5113cc7c5ae59e18..d2a57a53b2ba6bd0a6a276f4a07eebecb5d4dcbb 100644 (file)
@@ -79,7 +79,7 @@ static int ps3_flash_open(struct ps3_flash_ctx *fc, const char *mode)
        fc->dev = fopen(flash_dev, mode);
 
        if (!fc->dev) {
-               pb_log("%s: fopen failed: %s: %s\n", __func__, strerror(errno),
+               pb_log_fn("fopen failed: %s: %s\n", strerror(errno),
                        flash_dev);
                return -1;
        }
@@ -89,7 +89,7 @@ static int ps3_flash_open(struct ps3_flash_ctx *fc, const char *mode)
        result = os_area_fixed_read(&fc->header, &fc->params, fc->dev);
 
        if (result) {
-               pb_log("%s: os_area_fixed_read failed\n", __func__);
+               pb_log_fn("os_area_fixed_read failed\n");
                goto fail;
        }
 
@@ -123,7 +123,7 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
        ps3_flash_close(&fc);
 
        if (result) {
-               pb_log("%s: os_area_db_read failed: %s\n", __func__,
+               pb_log_fn("os_area_db_read failed: %s\n",
                        strerror(errno));
                goto fail;
        }
@@ -176,14 +176,14 @@ int ps3_flash_set_values(const struct ps3_flash_values *values)
        result = os_area_db_read(&fc.db, &fc.header, fc.dev);
 
        if (result) {
-               pb_log("%s: os_area_db_read failed: %s\n", __func__,
+               pb_log_fn("os_area_db_read failed: %s\n",
                        strerror(errno));
-               pb_log("%s: formating db\n", __func__);
+               pb_log_fn("formating db\n");
 
                result = os_area_db_format(&fc.db, &fc.header, fc.dev);
 
                if (result) {
-                       pb_log("%s: db_format failed: %s\n", __func__,
+                       pb_log_fn("db_format failed: %s\n",
                                strerror(errno));
                        goto fail;
                }
@@ -220,7 +220,7 @@ static int ps3_video_ioctl(int request, unsigned int *mode_id)
        fd = open(fb_dev, O_RDWR);
 
        if (fd < 0) {
-               pb_log("%s: open failed: %s: %s\n", __func__, strerror(errno),
+               pb_log_fn("open failed: %s: %s\n", strerror(errno),
                        fb_dev);
                return -1;
        }
@@ -230,7 +230,7 @@ static int ps3_video_ioctl(int request, unsigned int *mode_id)
        close(fd);
 
        if (result < 0) {
-               pb_log("%s: ioctl failed: %s: %s\n", __func__, strerror(errno),
+               pb_log_fn("ioctl failed: %s: %s\n", strerror(errno),
                        fb_dev);
                return -1;
        }
@@ -266,6 +266,6 @@ int ps3_get_video_mode(unsigned int *mode_id)
 
        result =  ps3_video_ioctl(PS3FB_IOCTL_GETMODE, mode_id);
 
-       pb_log("%s: %u\n", __func__, *mode_id);
+       pb_log_fn("%u\n", *mode_id);
        return result;
 }
index b0cae0dfd0e8c93b4b00f049918d372d216dc67a..23c3e623df7006f318cd5f5322fc65cf3976f830 100644 (file)
@@ -35,7 +35,7 @@
 void ui_timer_init(struct waitset *waitset, struct ui_timer *timer,
                unsigned int seconds)
 {
-       pb_log("%s: %u\n", __func__, seconds);
+       pb_log_fn("%u\n", seconds);
        timer->timeout = seconds;
        timer->waitset = waitset;
 }
index 7e04801edf9a96a8e146ad050074e32256779707..02142dbf303a1e993dcc39897d2773f73297cb5c 100644 (file)
@@ -78,7 +78,7 @@ unsigned int pb_elf_hash(const char *str)
                        h ^= g >> 24;
                h &= ~g;
        }
-       pb_log("%s: %x\n", __func__, h);
+       pb_log_fn("%x\n", h);
        return h;
 }
 
index 70627966a78653da5a77e0ba35147740798530ed..096eb565da906b16bc109a4d8a69d110f99cdc39 100644 (file)
@@ -245,7 +245,7 @@ int main(int argc, char *argv[])
        result += sigaction(SIGWINCH, &sa, NULL);
 
        if (result) {
-               pb_log("%s sigaction failed.\n", __func__);
+               pb_log_fn("sigaction failed.\n");
                return EXIT_FAILURE;
        }
 
index 87d2503d94a4042c2b63f41f5ecc69d71619a245..3abeac3e2ff29d41a2ecfd34f552339d5637523e 100644 (file)
@@ -169,7 +169,7 @@ static void cui_atexit(void)
 
 void cui_abort(struct cui *cui)
 {
-       pb_log("%s: exiting\n", __func__);
+       pb_log_fn("exiting\n");
        cui->abort = 1;
 }
 
@@ -254,7 +254,7 @@ int cui_run_cmd(struct cui *cui, const char **cmd_argv)
        nc_scr_post(cui->current);
 
        if (result) {
-               pb_log("%s: failed: '%s'\n", __func__, cmd_argv[0]);
+               pb_log_fn("failed: '%s'\n", cmd_argv[0]);
                nc_scr_status_printf(cui->current, _("Failed: %s"),
                                cmd_argv[0]);
        }
@@ -688,7 +688,7 @@ static void cui_handle_resize(struct cui *cui)
        struct winsize ws;
 
        if (ioctl(1, TIOCGWINSZ, &ws) == -1) {
-               pb_log("%s: ioctl failed: %s\n", __func__, strerror(errno));
+               pb_log_fn("ioctl failed: %s\n", strerror(errno));
                return;
        }
 
@@ -783,7 +783,7 @@ static int cui_boot_option_add(struct device *dev, struct boot_option *opt,
        result = set_menu_items(menu->ncm, NULL);
 
        if (result)
-               pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+               pb_log_fn("set_menu_items failed: %d\n", result);
 
        /* Insert new items at insert_pt. */
        if (dev_hdr) {
@@ -798,10 +798,10 @@ static int cui_boot_option_add(struct device *dev, struct boot_option *opt,
        }
 
        if (plugin_option) {
-               pb_log("%s: adding plugin '%s'\n", __func__, cod->name);
+               pb_log_fn("adding plugin '%s'\n", cod->name);
                pb_log("   file  '%s'\n", cod->pd->plugin_file);
        } else {
-               pb_log("%s: adding opt '%s'\n", __func__, cod->name);
+               pb_log_fn("adding opt '%s'\n", cod->name);
                pb_log("   image  '%s'\n", cod->bd->image);
                pb_log("   initrd '%s'\n", cod->bd->initrd);
                pb_log("   args   '%s'\n", cod->bd->args);
@@ -826,14 +826,14 @@ static int cui_boot_option_add(struct device *dev, struct boot_option *opt,
                }
                result = set_menu_items(cui->main->ncm, cui->main->items);
                if (result)
-                       pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+                       pb_log_fn("set_menu_items failed: %d\n", result);
        }
 
        /* Re-attach the items array. */
        result = set_menu_items(menu->ncm, menu->items);
 
        if (result)
-               pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+               pb_log_fn("set_menu_items failed: %d\n", result);
 
        if (0) {
                pb_log("%s\n", __func__);
@@ -878,7 +878,7 @@ static void cui_device_remove(struct device *dev, void *arg)
        int rows, cols, top, last;
        int result;
 
-       pb_log("%s: %p %s\n", __func__, dev, dev->id);
+       pb_log_fn("%p %s\n", dev, dev->id);
 
        if (cui->current == &cui->main->scr)
                nc_scr_unpost(cui->current);
@@ -891,7 +891,7 @@ static void cui_device_remove(struct device *dev, void *arg)
        result |= set_menu_items(cui->plugin_menu->ncm, NULL);
 
        if (result)
-               pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+               pb_log_fn("set_menu_items failed: %d\n", result);
 
        list_for_each_entry(&dev->boot_options, opt, list) {
                struct pmenu_item *item = pmenu_item_from_arg(opt->ui_info);
@@ -948,7 +948,7 @@ static void cui_device_remove(struct device *dev, void *arg)
        }
 
        if (result)
-               pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+               pb_log_fn("set_menu_items failed: %d\n", result);
 
        if (0) {
                pb_log("%s\n", __func__);
@@ -1300,14 +1300,14 @@ static struct pmenu *main_menu_init(struct cui *cui)
 
        m = pmenu_init(cui, 9, cui_on_exit);
        if (!m) {
-               pb_log("%s: failed\n", __func__);
+               pb_log_fn("failed\n");
                return NULL;
        }
 
        m->n_hot_keys = 1;
        m->hot_keys = talloc_array(m, hot_key_fn, m->n_hot_keys);
        if (!m->hot_keys) {
-               pb_log("%s: failed to allocate hot_keys\n", __func__);
+               pb_log_fn("failed to allocate hot_keys\n");
                talloc_free(m);
                return NULL;
        }
@@ -1506,7 +1506,7 @@ struct cui *cui_init(void* platform_info,
 
        cui = talloc_zero(NULL, struct cui);
        if (!cui) {
-               pb_log("%s: alloc cui failed.\n", __func__);
+               pb_log_fn("alloc cui failed.\n");
                fprintf(stderr, _("%s: alloc cui failed.\n"), __func__);
                goto fail_alloc;
        }
@@ -1526,7 +1526,7 @@ retry_start:
                                &cui_client_ops, cui);
                if (cui->client || !i)
                        break;
-               pb_log("%s: waiting for server %d\n", __func__, i);
+               pb_log_fn("waiting for server %d\n", i);
                sleep(1);
        }
 
@@ -1540,7 +1540,7 @@ retry_start:
                if (!result)
                        goto retry_start;
 
-               pb_log("%s: discover_client_init failed.\n", __func__);
+               pb_log_fn("discover_client_init failed.\n");
                fprintf(stderr, _("%s: error: discover_client_init failed.\n"),
                        __func__);
                fprintf(stderr, _("could not start pb-discover, the petitboot "
@@ -1554,7 +1554,7 @@ retry_start:
                waiter_register_timeout(cui->waitset, 0,
                                        cui_server_wait, cui);
        } else if (!cui->client) {
-               pb_log("%s: discover_client_init failed.\n", __func__);
+               pb_log_fn("discover_client_init failed.\n");
                fprintf(stderr, _("%s: error: discover_client_init failed.\n"),
                        __func__);
                fprintf(stderr, _("check that pb-discover, "
@@ -1653,7 +1653,7 @@ int cui_run(struct cui *cui)
                int result = waiter_poll(cui->waitset);
 
                if (result < 0) {
-                       pb_log("%s: poll: %s\n", __func__, strerror(errno));
+                       pb_log_fn("poll: %s\n", strerror(errno));
                        break;
                }
 
index a6c2b15f61d2caf7d66cce45f980790b2e50c24e..a90a02e3f89d43a2be8b1aa284f4b43096a413fd 100644 (file)
@@ -117,7 +117,7 @@ static const char *pmenu_item_label(struct pmenu_item *item, const char *name)
        label = talloc_array(item, char, len + 1);
        wcstombs(label, tmp, len + 1);
 
-       pb_log("%s: %s\n", __func__, label);
+       pb_log_fn("%s\n", label);
 
        talloc_free(tmp);
        return label;
@@ -357,7 +357,7 @@ static int pmenu_item_get_index(const struct pmenu_item *item)
                        if (item->pmenu->items[i] == item->nci)
                                return i;
 
-       pb_log("%s: not found: %p %s\n", __func__, item,
+       pb_log_fn("not found: %p %s\n", item,
                (item ? item->nci->name.str : "(null)"));
        return -1;
 }
@@ -491,7 +491,7 @@ unsigned int pmenu_grow(struct pmenu *menu, unsigned int count)
 
        assert(item_count(menu->ncm) == 0 && "not disconnected");
 
-       pb_log("%s: %u current + %u new = %u\n", __func__, menu->item_count,
+       pb_log_fn("%u current + %u new = %u\n", menu->item_count,
                count, menu->item_count + count);
 
        /* Note that items array has a null terminator. */
@@ -526,7 +526,7 @@ int pmenu_remove(struct pmenu *menu, struct pmenu_item *item)
 
        assert(menu->item_count);
 
-       pb_log("%s: %u\n", __func__, menu->item_count);
+       pb_log_fn("%u\n", menu->item_count);
 
        index = pmenu_item_get_index(item);
 
index f60a05e41a8c842395ae6350b4c86c8930805632..eda15d05e2230388cf779860bbf34eef2241a7c7 100644 (file)
@@ -407,14 +407,14 @@ static struct pmenu *ps3_mm_init(struct ps3_cui *ps3_cui)
        m = pmenu_init(ps3_cui->cui, 3, cui_on_exit);
 
        if (!m) {
-               pb_log("%s: failed\n", __func__);
+               pb_log_fn("failed\n");
                return NULL;
        }
 
        m->n_hot_keys = 2;
        m->hot_keys = talloc_array(m, hot_key_fn *, m->n_hot_keys);
        if (!m->hot_keys) {
-               pb_log("%s: failed to allocate hot_keys\n", __func__);
+               pb_log_fn("failed to allocate hot_keys\n");
                talloc_free(m);
                return NULL;
        }
@@ -474,7 +474,7 @@ static struct pmenu *ps3_svm_init(struct ps3_cui *ps3_cui)
        m = pmenu_init(ps3_cui->cui, 12, ps3_svm_to_mm_helper);
 
        if (!m) {
-               pb_log("%s: failed\n", __func__);
+               pb_log_fn("failed\n");
                return NULL;
        }
 
@@ -621,7 +621,7 @@ int main(int argc, char *argv[])
        result += sigaction(SIGWINCH, &sa, NULL);
 
        if (result) {
-               pb_log("%s sigaction failed.\n", __func__);
+               pb_log_fn("sigaction failed.\n");
                return EXIT_FAILURE;
        }
 
index 8ddec9ef2cd790044754196508114d08bf919e4b..a85cace0b8581c263881ff0285240b6a175282f8 100644 (file)
@@ -204,7 +204,7 @@ static int run(struct pbt_client *client)
                int result = waiter_poll(client->waitset);
 
                if (result < 0) {
-                       pb_log("%s: poll: %s\n", __func__, strerror(errno));
+                       pb_log_fn("poll: %s\n", strerror(errno));
                        break;
                }
 
@@ -304,7 +304,7 @@ int main(int argc, char *argv[])
        result += sigaction(SIGWINCH, &sa, NULL);
 
        if (result) {
-               pb_log("%s sigaction failed.\n", __func__);
+               pb_log_fn("sigaction failed.\n");
                return EXIT_FAILURE;
        }
 
index ba4b1d7b851afdfa79b08df0d04137769bd06511..f98aca83674c213c95f5c3c70c24bc5db047ff77 100644 (file)
@@ -411,7 +411,7 @@ int main(int argc, char *argv[])
        result += sigaction(SIGWINCH, &sa, NULL);
 
        if (result) {
-               pb_log("%s sigaction failed.\n", __func__);
+               pb_log_fn("sigaction failed.\n");
                return EXIT_FAILURE;
        }
 
index 48de8160eeee7d1f0877cdc52c13a467c2b4a85a..cffb5ded1bf1d0bb1b69622144e82ef849518d6b 100644 (file)
@@ -66,7 +66,7 @@ static int pbt_client_boot(struct pbt_item *item)
                        NULL, opt_data->opt, opt_data->bd);
 
        if (result) {
-               pb_log("%s: failed: %s\n", __func__, opt_data->bd->image);
+               pb_log_fn("failed: %s\n", opt_data->bd->image);
                pbt_frame_status_printf(&item->pbt_client->frame,
                                "Failed: kexec %s", opt_data->bd->image);
        }
@@ -194,7 +194,7 @@ static void pbt_device_remove(struct device *dev, struct pbt_client *client)
        }
 
        if (!removed_item) {
-               pb_log("%s: %p %s: unknown device\n", __func__, dev, dev->id);
+               pb_log_fn("%p %s: unknown device\n", dev, dev->id);
                assert(0 && "unknown device");
                return;
        }
@@ -260,7 +260,7 @@ struct pbt_client *pbt_client_init(enum pbt_twin_backend backend,
        pbt_client = talloc_zero(NULL, struct pbt_client);
 
        if (!pbt_client) {
-               pb_log("%s: alloc pbt_client failed.\n", __func__);
+               pb_log_fn("alloc pbt_client failed.\n");
                fprintf(stderr, "%s: alloc pbt_client failed.\n", __func__);
                goto fail_alloc;
        }
@@ -288,7 +288,7 @@ retry_start:
                                        &pbt_client_ops, pbt_client);
                if (pbt_client->discover_client || !i)
                        break;
-               pb_log("%s: waiting for server %d\n", __func__, i);
+               pb_log_fn("waiting for server %d\n", i);
                sleep(1);
        }
 
@@ -302,7 +302,7 @@ retry_start:
                if (!result)
                        goto retry_start;
 
-               pb_log("%s: discover_client_init failed.\n", __func__);
+               pb_log_fn("discover_client_init failed.\n");
                fprintf(stderr, "%s: error: discover_client_init failed.\n",
                        __func__);
                fprintf(stderr, "could not start pb-discover, the petitboot "
@@ -311,7 +311,7 @@ retry_start:
        }
 
        if (!pbt_client->discover_client) {
-               pb_log("%s: discover_client_init failed.\n", __func__);
+               pb_log_fn("discover_client_init failed.\n");
                fprintf(stderr, "%s: error: discover_client_init failed.\n",
                        __func__);
                fprintf(stderr, "check that pb-discover, "
index e10cab10e9c9b817d8ae06a5c6a9da27b6c8fac7..c360047cb5879ca7bce16e4629f46da7031f0cad 100644 (file)
@@ -138,7 +138,7 @@ twin_pixmap_t *pbt_background_load(twin_screen_t *tscreen,
        raw_background = twin_jpeg_to_pixmap(filename, TWIN_ARGB32);
 
        if (!raw_background) {
-               pb_log("%s: loading image '%s' failed\n", __func__, filename);
+               pb_log_fn("loading image '%s' failed\n", filename);
 
                /* Fallback to a default pattern */
 
@@ -158,7 +158,7 @@ twin_pixmap_t *pbt_background_load(twin_screen_t *tscreen,
                                tscreen->width,
                                tscreen->height);
        if (!scaled_background) {
-               pb_log("%s: scale '%s' failed\n", __func__, filename);
+               pb_log_fn("scale '%s' failed\n", filename);
                twin_pixmap_destroy(raw_background);
                return twin_make_pattern();
        }
@@ -224,7 +224,7 @@ retry:
        new.icon = twin_png_to_pixmap(filename, TWIN_ARGB32);
 
        if (!new.icon) {
-               pb_log("%s: loading image '%s' failed\n", __func__, filename);
+               pb_log_fn("loading image '%s' failed\n", filename);
 
                if (filename == default_icon_file)
                        return NULL;
@@ -384,7 +384,7 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx,
        assert(backend && backend < 3);
 
        if (!scr) {
-               pb_log("%s: alloc pbt_scr failed.\n", __func__);
+               pb_log_fn("alloc pbt_scr failed.\n");
                goto fail_alloc;
        }
 
@@ -395,7 +395,7 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx,
        scr->twin_ctx.backend = backend;
 
        if (backend == pbt_twin_x11) {
-               pb_log("%s: using twin x11 backend.\n", __func__);
+               pb_log_fn("using twin x11 backend.\n");
                assert(width > 100);
                assert(height > 100);
 
@@ -406,7 +406,7 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx,
                        width, height, 0);
 
                if (!scr->twin_ctx.x11) {
-                       pb_log("%s: twin_x11_create_ext failed.\n", __func__);
+                       pb_log_fn("twin_x11_create_ext failed.\n");
                        perror("failed to create twin x11 context\n");
                        goto fail_ctx_create;
                }
@@ -418,14 +418,14 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx,
                waiter_fd = ConnectionNumber(scr->twin_ctx.x11->dpy);
 #endif
        } else if (backend == pbt_twin_fbdev) {
-               pb_log("%s: using twin fbdev backend.\n", __func__);
+               pb_log_fn("using twin fbdev backend.\n");
 #if !defined(HAVE_LIBTWIN_TWIN_FBDEV_H)
                assert(0);
 #else
                scr->twin_ctx.fbdev = twin_fbdev_create_ext(-1, SIGUSR1, 0);
 
                if (!scr->twin_ctx.fbdev) {
-                       pb_log("%s: twin_fbdev_create_ext failed.\n", __func__);
+                       pb_log_fn("twin_fbdev_create_ext failed.\n");
                        perror("failed to create twin fbdev context\n");
                        goto fail_ctx_create;
                }