}
struct discover_device *discover_device_create(struct device_handler *handler,
- const char *id)
+ const char *uuid, const char *id)
{
struct discover_device *dev;
- dev = device_lookup_by_id(handler, id);
+ if (uuid)
+ dev = device_lookup_by_uuid(handler, uuid);
+ else
+ dev = device_lookup_by_id(handler, id);
+
if (dev)
return dev;
dev = talloc_zero(handler, struct discover_device);
dev->device = talloc_zero(dev, struct device);
dev->device->id = talloc_strdup(dev->device, id);
+ dev->uuid = talloc_strdup(dev, uuid);
list_init(&dev->params);
list_init(&dev->boot_options);
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.progress = -1;
- status.detail = NULL;
+ status.type = STATUS_INFO;
status.message = talloc_asprintf(handler,
_("Booting in %d sec: %s"), sec, opt->option->name);
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.progress = -1;
- status.detail = NULL;
+ status.type = STATUS_INFO;
status.message = _("Default boot cancelled");
discover_server_notify_boot_status(handler->server, &status);
{
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->type = BOOT_STATUS_ERROR;
- status->progress = 0;
- status->detail = talloc_asprintf(status,
- _("Received config URL %s"), url);
+ status = talloc(handler, struct status);
+ status->type = STATUS_ERROR;
if (!handler->network) {
status->message = talloc_asprintf(handler,
goto msg;
}
- dev = discover_device_create(handler, event->device);
+ dev = discover_device_create(handler, mac, event->device);
if (pb_url->scheme == pb_url_file)
dev->device->type = DEVICE_TYPE_ANY;
ctx = device_handler_discover_context_create(handler, dev);
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:
struct discover_device *dev = ctx->device;
struct discover_boot_option *opt, *tmp;
- if (!device_lookup_by_id(handler, dev->device->id))
+ if (!device_lookup_by_uuid(handler, dev->uuid))
device_handler_add_device(handler, dev);
/* move boot options from the context to the device */