summaryrefslogtreecommitdiffstats
path: root/discover/device-handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'discover/device-handler.c')
-rw-r--r--discover/device-handler.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index 9c05029..cf379e7 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -1404,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)
{
OpenPOWER on IntegriCloud