]> git.ozlabs.org Git - petitboot/commitdiff
discover: Add struct resource
authorJeremy Kerr <jk@ozlabs.org>
Thu, 14 Mar 2013 07:55:55 +0000 (15:55 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 29 Apr 2013 04:31:20 +0000 (14:31 +1000)
Introduce a new type, struct resource, for handling resources such as
kernels and initrds.

This allows the parsers to better describe resources that are required
for booting. Firstly, we enforce all resources to be URLs, rather than
local paths. Also, resources allow us to describe files devices that
have not-yet been hotplugged.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/Makefile.am
discover/resource.h [new file with mode: 0644]

index 0e208357cfc1de34a62b55f691b84e4488a35508..a85885554eb7b099a8a9c24d93b757b1cf6e4d87 100644 (file)
@@ -54,6 +54,7 @@ pb_discover_SOURCES = \
        params.h \
        pb-discover.c \
        pb-discover.h \
+       resource.h \
        udev.c \
        udev.h \
        user-event.c \
diff --git a/discover/resource.h b/discover/resource.h
new file mode 100644 (file)
index 0000000..b7e1a46
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef RESOURCE_H
+#define RESOURCE_H
+
+#include <stdbool.h>
+
+struct pb_url;
+
+/**
+ * Data for local/remote resources. Resources may be "unresolved", in that
+ * they refer to a device that is not yet present. Unresolved resources
+ * simply contain parser-specific data (generally a device string parsed from
+ * the config file), and may be resolved by the parser once new devices appear.
+ */
+struct resource {
+       bool resolved;
+       union {
+               struct pb_url   *url;
+               void            *info;
+       };
+};
+
+#endif /* RESOURCE_H */
+