]> git.ozlabs.org Git - petitboot/blobdiff - discover/device-handler.c
pb-config: Move config storage modules to "platform" modules in discover code
[petitboot] / discover / device-handler.c
index 9033c4fdfb8d3162417ed332e415b6446d33df8e..c57b7b62880d8d4a8952fd896ac3bfe8dd38311d 100644 (file)
@@ -8,7 +8,6 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 
-#include <pb-config/pb-config.h>
 #include <talloc/talloc.h>
 #include <list/list.h>
 #include <log/log.h>
@@ -19,6 +18,7 @@
 
 #include "device-handler.h"
 #include "discover-server.h"
+#include "platform.h"
 #include "event.h"
 #include "parser.h"
 #include "resource.h"
@@ -279,6 +279,7 @@ struct device_handler *device_handler_init(struct discover_server *server,
 void device_handler_remove(struct device_handler *handler,
                struct discover_device *device)
 {
+       struct discover_boot_option *opt, *tmp;
        unsigned int i;
 
        for (i = 0; i < handler->n_devices; i++)
@@ -290,6 +291,16 @@ void device_handler_remove(struct device_handler *handler,
                return;
        }
 
+       /* Free any unresolved options, as they're currently allocated
+        * against the handler */
+       list_for_each_entry_safe(&handler->unresolved_boot_options,
+                       opt, tmp, list) {
+               if (opt->device != device)
+                       continue;
+               list_remove(&opt->list);
+               talloc_free(opt);
+       }
+
        handler->n_devices--;
        memmove(&handler->devices[i], &handler->devices[i + 1],
                (handler->n_devices - i) * sizeof(handler->devices[0]));