X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fdevice-handler.c;h=cf379e78ca7f7ecc1f52adbca0fedc2e22903fa8;hp=1299c33b7bb5c517dd06c1a6c1bee23bd10816a2;hb=c4be9490a5d94b662370576157b6e0ed73f2fe77;hpb=c78f9ec47ba92b74698dacdae963dbbefd9b676f diff --git a/discover/device-handler.c b/discover/device-handler.c index 1299c33..cf379e7 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -522,6 +522,7 @@ void device_handler_remove(struct device_handler *handler, void device_handler_status(struct device_handler *handler, struct status *status) { + pb_debug("%s: %s\n", __func__, status->message); discover_server_notify_boot_status(handler->server, status); } @@ -1403,6 +1404,28 @@ int device_handler_dhcp(struct device_handler *handler, return 0; } +struct discover_boot_option *device_handler_find_option_by_name( + struct device_handler *handler, const char *device, + const char *name) +{ + size_t len = strlen(name); + unsigned int i; + + for (i = 0; i < handler->n_devices; i++) { + struct discover_device *dev = handler->devices[i]; + struct discover_boot_option *opt; + + list_for_each_entry(&dev->boot_options, opt, list) + /* Match exactly, partial matches can be quite common */ + if (strlen(opt->option->name) == len && + !strcmp(opt->option->name, name)) + if (!dev || !strcmp(opt->option->device_id, device)) + return opt; + } + + return NULL; +} + static struct discover_boot_option *find_boot_option_by_id( struct device_handler *handler, const char *id) {