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;
}
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);
}
}
if (result)
- pb_log("%s: failed: (%d)\n", __func__, result);
+ pb_log_fn("failed: (%d)\n", result);
/* okay, kexec -e -f */
if (result) {
}
if (result)
- pb_log("%s: failed: (%d)\n", __func__, result);
+ pb_log_fn("failed: (%d)\n", result);
return result;
_("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"));
} 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;
}
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);
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;
}
struct device_handler *handler = process->data;
if (!handler) {
- pb_log("%s: Missing data!\n", __func__);
+ pb_log_fn("Missing data!\n");
return;
}
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)))
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
rc = pb_protocol_deserialise_config(config, message);
if (rc) {
- pb_log("%s: no config?", __func__);
+ pb_log_fn("no config?\n");
return 0;
}
break;
default:
- pb_log("%s: invalid action %d\n", __func__, message->action);
+ pb_log_fn("invalid action %d\n", message->action);
return 0;
}
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;
}
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;
}
i += sizeof(ipsize);
if (!hwsize || !ipsize) {
- pb_log("%s: Empty response\n", __func__);
+ pb_log_fn("Empty response\n");
return -1;
}
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);
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);
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;
}
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);
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,
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;
}
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;
}
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;
}
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)) {
}
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;
}
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;
}
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;
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 */
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;
}
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;
}
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);
/* 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;
}
if (!total_len)
return 0;
- pb_log("%s: failed: %s\n", __func__, strerror(errno));
+ pb_log_fn("failed: %s\n", strerror(errno));
return -1;
}
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;
}
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;
}
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;
}
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;
}
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)
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;
}
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;
}
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;
}
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;
}
/* 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;
}
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)
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);
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);
gpgme_release(gpg_context);
if (!valid) {
- pb_log("%s: Incorrect GPG signature\n", __func__);
+ pb_log_fn("Incorrect GPG signature\n");
return -1;
}
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)
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);
gpgme_release(gpg_context);
if (!valid) {
- pb_log("%s: Incorrect GPG signature\n", __func__);
+ pb_log_fn("Incorrect GPG signature\n");
return -1;
}
*/
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;
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);
}
/* 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);
}
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;
}
/* 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;
}
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;
}
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;
}
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;
}
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);
}
}
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;
}
rc = pb_protocol_deserialise_device(dev, message);
if (rc) {
- pb_log("%s: no device?\n", __func__);
+ pb_log_fn("no device?\n");
goto out;
}
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;
}
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);
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);
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);
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);
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;
}
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:
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
h ^= g >> 24;
h &= ~g;
}
- pb_log("%s: %x\n", __func__, h);
+ pb_log_fn("%x\n", h);
return h;
}
result += sigaction(SIGWINCH, &sa, NULL);
if (result) {
- pb_log("%s sigaction failed.\n", __func__);
+ pb_log_fn("sigaction failed.\n");
return EXIT_FAILURE;
}
void cui_abort(struct cui *cui)
{
- pb_log("%s: exiting\n", __func__);
+ pb_log_fn("exiting\n");
cui->abort = 1;
}
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]);
}
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;
}
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) {
}
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);
}
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__);
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);
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);
}
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__);
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;
}
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;
}
&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);
}
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 "
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, "
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;
}
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;
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;
}
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. */
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);
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;
}
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;
}
result += sigaction(SIGWINCH, &sa, NULL);
if (result) {
- pb_log("%s sigaction failed.\n", __func__);
+ pb_log_fn("sigaction failed.\n");
return EXIT_FAILURE;
}
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;
}
result += sigaction(SIGWINCH, &sa, NULL);
if (result) {
- pb_log("%s sigaction failed.\n", __func__);
+ pb_log_fn("sigaction failed.\n");
return EXIT_FAILURE;
}
result += sigaction(SIGWINCH, &sa, NULL);
if (result) {
- pb_log("%s sigaction failed.\n", __func__);
+ pb_log_fn("sigaction failed.\n");
return EXIT_FAILURE;
}
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);
}
}
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;
}
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;
}
&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);
}
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 "
}
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, "
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 */
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();
}
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;
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;
}
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);
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;
}
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;
}