static void __attribute__((format(__printf__, 4, 5))) update_status(
boot_status_fn fn, void *arg, int type, char *fmt, ...)
{
- struct boot_status status;
+ struct status status;
va_list ap;
va_start(ap, fmt);
if (n < 1)
return;
- update_status(task->status_fn, task->status_arg, BOOT_STATUS_INFO,
+ update_status(task->status_fn, task->status_arg, STATUS_INFO,
_("running boot hooks"));
boot_hook_setenv(task);
return 0;
update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
+ STATUS_ERROR,
_("Couldn't load %s"), name);
return -1;
}
run_boot_hooks(task);
- update_status(task->status_fn, task->status_arg, BOOT_STATUS_INFO,
+ update_status(task->status_fn, task->status_arg, STATUS_INFO,
_("performing kexec_load"));
rc = kexec_load(task);
if (rc == KEXEC_LOAD_DECRYPTION_FALURE) {
update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR, _("decryption failed"));
+ STATUS_ERROR, _("decryption failed"));
}
else if (rc == KEXEC_LOAD_SIGNATURE_FAILURE) {
update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
+ STATUS_ERROR,
_("signature verification failed"));
}
else if (rc == KEXEC_LOAD_SIG_SETUP_INVALID) {
update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
+ STATUS_ERROR,
_("invalid signature configuration"));
}
else if (rc) {
update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
- _("kexec load failed"));
+ STATUS_ERROR, _("kexec load failed"));
}
no_sig_load:
if (!rc) {
update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_INFO,
- _("performing kexec reboot"));
+ STATUS_INFO, _("performing kexec reboot"));
rc = kexec_reboot(task);
if (rc) {
update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
+ STATUS_ERROR,
_("kexec reboot failed"));
}
}
*result = load_url_async(task, url, boot_process, task);
if (!*result) {
update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
- _("Error loading %s"), name);
+ STATUS_ERROR, _("Error loading %s"), name);
return -1;
}
return 0;
else
boot_desc = _("(unknown)");
- update_status(status_fn, status_arg, BOOT_STATUS_INFO,
+ update_status(status_fn, status_arg, STATUS_INFO,
_("Booting %s."), boot_desc);
if (cmd && cmd->boot_image_file) {
image = opt->boot_image->url;
} else {
pb_log("%s: no image specified\n", __func__);
- update_status(status_fn, status_arg, BOOT_STATUS_INFO,
+ update_status(status_fn, status_arg, STATUS_INFO,
_("Boot failed: no image specified"));
return NULL;
}
} else {
pb_log("%s: no command line signature file"
" specified\n", __func__);
- update_status(status_fn, status_arg, BOOT_STATUS_INFO,
+ update_status(status_fn, status_arg, STATUS_INFO,
_("Boot failed: no command line"
" signature file specified"));
talloc_free(boot_task);
{
task->cancelled = true;
- update_status(task->status_fn, task->status_arg, BOOT_STATUS_INFO,
+ update_status(task->status_fn, task->status_arg, STATUS_INFO,
_("Boot cancelled"));
cleanup_cancellations(task, NULL);
struct boot_option;
struct boot_command;
-typedef void (*boot_status_fn)(void *arg, struct boot_status *);
+typedef void (*boot_status_fn)(void *arg, struct status *);
struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
struct boot_command *cmd, int dry_run,
talloc_free(device);
}
-void device_handler_boot_status(void *arg, struct boot_status *status)
+void device_handler_boot_status(void *arg, struct status *status)
{
struct device_handler *handler = arg;
static void countdown_status(struct device_handler *handler,
struct discover_boot_option *opt, unsigned int sec)
{
- struct boot_status status;
+ struct status status;
- status.type = BOOT_STATUS_INFO;
+ status.type = STATUS_INFO;
status.progress = -1;
status.detail = NULL;
status.message = talloc_asprintf(handler,
struct discover_device *dev)
{
struct discover_context *ctx;
- struct boot_status *status;
+ struct status *status;
int rc;
- status = talloc_zero(handler, struct boot_status);
- status->type = BOOT_STATUS_INFO;
+ status = talloc_zero(handler, struct status);
+ status->type = STATUS_INFO;
/*
* TRANSLATORS: this string will be passed the type and identifier
* of the device. For example, the first parameter could be "Disk",
struct discover_device *dev, struct event *event)
{
struct discover_context *ctx;
- struct boot_status *status;
+ struct status *status;
- status = talloc_zero(handler, struct boot_status);
- status->type = BOOT_STATUS_INFO;
+ status = talloc_zero(handler, struct status);
+ status->type = STATUS_INFO;
/*
* TRANSLATORS: this format specifier will be the name of a network
* device, like 'eth0'.
void device_handler_cancel_default(struct device_handler *handler)
{
- struct boot_status status;
+ struct status status;
if (handler->timeout_waiter)
waiter_remove(handler->timeout_waiter);
handler->default_boot_option = NULL;
- status.type = BOOT_STATUS_INFO;
+ status.type = STATUS_INFO;
status.progress = -1;
status.detail = NULL;
status.message = _("Default boot cancelled");
{
struct discover_context *ctx;
struct discover_device *dev;
- struct boot_status *status;
+ struct status *status;
struct pb_url *pb_url;
struct event *event;
struct param *param;
- status = talloc(handler, struct boot_status);
+ status = talloc(handler, struct status);
- status->type = BOOT_STATUS_ERROR;
+ status->type = STATUS_ERROR;
status->progress = 0;
status->detail = talloc_asprintf(status,
_("Received config URL %s"), url);
talloc_unlink(handler, ctx);
- status->type = BOOT_STATUS_INFO;
+ status->type = STATUS_INFO;
status->message = talloc_asprintf(status, _("Config file %s parsed"),
pb_url->file);
msg:
void device_handler_remove(struct device_handler *handler,
struct discover_device *device);
-void device_handler_boot_status(void *arg, struct boot_status *status);
+void device_handler_boot_status(void *arg, struct status *status);
struct discover_context *device_handler_discover_context_create(
struct device_handler *handler,
}
static int write_boot_status_message(struct discover_server *server,
- struct client *client, const struct boot_status *status)
+ struct client *client, const struct status *status)
{
struct pb_protocol_message *message;
int len;
}
void discover_server_notify_boot_status(struct discover_server *server,
- struct boot_status *status)
+ struct status *status)
{
struct client *client;
struct discover_server;
struct device_handler;
struct boot_option;
-struct boot_status;
+struct status;
struct system_info;
struct device;
struct config;
void discover_server_notify_device_remove(struct discover_server *server,
struct device *device);
void discover_server_notify_boot_status(struct discover_server *server,
- struct boot_status *status);
+ struct status *status);
void discover_server_notify_system_info(struct discover_server *server,
const struct system_info *sysinfo);
void discover_server_notify_config(struct discover_server *server,
{
struct conf_context *conf = data;
struct device_handler *handler;
- struct boot_status status = {0};
+ struct status status = {0};
struct pxe_parser_info *info;
char *buf = NULL;
int len, rc = 0;
handler = talloc_parent(conf);
device_handler_discover_context_commit(handler, conf->dc);
- status.type = BOOT_STATUS_INFO;
+ status.type = STATUS_INFO;
/*
* TRANSLATORS: the format specifier in this string in an IP address,
* eg. 192.168.1.1
4 + optional_strlen(boot->console);
}
-int pb_protocol_boot_status_len(const struct boot_status *status)
+int pb_protocol_boot_status_len(const struct status *status)
{
return 4 +
4 + optional_strlen(status->message) +
return 0;
}
-int pb_protocol_serialise_boot_status(const struct boot_status *status,
+int pb_protocol_serialise_boot_status(const struct status *status,
char *buf, int buf_len)
{
char *pos = buf;
return rc;
}
-int pb_protocol_deserialise_boot_status(struct boot_status *status,
+int pb_protocol_deserialise_boot_status(struct status *status,
const struct pb_protocol_message *message)
{
unsigned int len;
status->type = __be32_to_cpu(*(uint32_t *)(pos));
switch (status->type) {
- case BOOT_STATUS_ERROR:
- case BOOT_STATUS_INFO:
+ case STATUS_ERROR:
+ case STATUS_INFO:
break;
default:
goto out;
int pb_protocol_device_len(const struct device *dev);
int pb_protocol_boot_option_len(const struct boot_option *opt);
int pb_protocol_boot_len(const struct boot_command *boot);
-int pb_protocol_boot_status_len(const struct boot_status *status);
+int pb_protocol_boot_status_len(const struct status *status);
int pb_protocol_system_info_len(const struct system_info *sysinfo);
int pb_protocol_config_len(const struct config *config);
int pb_protocol_url_len(const char *url);
char *buf, int buf_len);
int pb_protocol_serialise_boot_command(const struct boot_command *boot,
char *buf, int buf_len);
-int pb_protocol_serialise_boot_status(const struct boot_status *status,
+int pb_protocol_serialise_boot_status(const struct status *status,
char *buf, int buf_len);
int pb_protocol_serialise_system_info(const struct system_info *sysinfo,
char *buf, int buf_len);
int pb_protocol_deserialise_boot_command(struct boot_command *cmd,
const struct pb_protocol_message *message);
-int pb_protocol_deserialise_boot_status(struct boot_status *status,
+int pb_protocol_deserialise_boot_status(struct status *status,
const struct pb_protocol_message *message);
int pb_protocol_deserialise_system_info(struct system_info *sysinfo,
char *console;
};
-struct boot_status {
- enum {
- BOOT_STATUS_INFO,
- BOOT_STATUS_ERROR,
+struct status {
+ enum status_type {
+ STATUS_INFO,
+ STATUS_ERROR,
} type;
char *message;
char *detail;
struct network;
-typedef void (*boot_status_fn)(void *arg, struct boot_status *);
+typedef void (*boot_status_fn)(void *arg, struct status *);
void discover_server_notify_device_add(struct discover_server *server,
struct device *device)
}
void discover_server_notify_boot_status(struct discover_server *server,
- struct boot_status *status)
+ struct status *status)
{
(void)server;
(void)status;
}
static void update_status(struct discover_client *client,
- struct boot_status *status)
+ struct status *status)
{
if (client->ops.update_status)
client->ops.update_status(status, client->ops.cb_arg);
struct discover_client *client = arg;
struct pb_protocol_message *message;
struct system_info *sysinfo;
- struct boot_status *status;
struct boot_option *opt;
+ struct status *status;
struct config *config;
struct device *dev;
char *dev_id;
device_remove(client, dev_id);
break;
case PB_PROTOCOL_ACTION_STATUS:
- status = talloc_zero(ctx, struct boot_status);
+ status = talloc_zero(ctx, struct status);
rc = pb_protocol_deserialise_boot_status(status, message);
if (rc) {
* devices' boot options), so callbacks may store boot options and devices
* as long as the client remains allocated.
*
- * The boot_status and system_info structs are allocated by the client,
+ * The status and system_info structs are allocated by the client,
* and will be free()ed after the callback is invoked. If the callback
* stores these structures for usage beyond the duration of the callback,
* it must talloc_steal() them.
int (*boot_option_add)(struct device *dev, struct boot_option *option,
void *arg);
void (*device_remove)(struct device *device, void *arg);
- void (*update_status)(struct boot_status *status, void *arg);
+ void (*update_status)(struct status *status, void *arg);
void (*update_sysinfo)(struct system_info *sysinfo, void *arg);
void (*update_config)(struct config *sysinfo, void *arg);
void *cb_arg;
nc_scr_post(cui->current);
}
-static void cui_update_status(struct boot_status *status, void *arg)
+static void cui_update_status(struct status *status, void *arg)
{
struct cui *cui = cui_from_arg(arg);
nc_scr_status_printf(cui->current,
"%s: %s",
- status->type == BOOT_STATUS_ERROR ?
+ status->type == STATUS_ERROR ?
_("Error") : _("Info"),
status->message);
printf("\tname: %s\n", device->name);
}
-static void print_status(struct boot_status *status,
+static void print_status(struct status *status,
void __attribute__((unused)) *arg)
{
printf("status:\n");