[Concept,13/14] bootstd: Add bootmeth_id to struct bootflow
Commit Message
From: Simon Glass <sjg@chromium.org>
Add a bootmeth_id field to struct bootflow that bootmeths can use to
store an identifier for this bootflow, e.g. an alist index for the
PXE context used during scanning. Initialise it to -1 (not set) in
bootflow_init().
Signed-off-by: Simon Glass <sjg@chromium.org>
---
boot/bootflow.c | 1 +
doc/develop/bootstd/overview.rst | 5 ++++-
include/bootflow.h | 4 ++++
3 files changed, 9 insertions(+), 1 deletion(-)
@@ -712,6 +712,7 @@ void bootflow_init(struct bootflow *bflow, struct udevice *bootdev,
bflow->dev = bootdev;
bflow->method = meth;
bflow->state = BOOTFLOWST_BASE;
+ bflow->bootmeth_id = -1;
alist_init_struct(&bflow->images, struct bootflow_img);
}
@@ -853,7 +853,10 @@ Each bootdev device has its own `struct bootdev_uc_plat` which holds a
list of scanned bootflows just for that device.
The bootflow itself is documented in bootflow_h_. It includes various bits of
-information about the bootflow and a buffer to hold the file.
+information about the bootflow and a buffer to hold the file. The ``bootmeth_id``
+field allows a bootmeth to associate an identifier with each bootflow, such as
+an index into a list of parsed configurations. It is initialised to -1 (not
+set) and its interpretation is up to the bootmeth.
The ``bootmeth_priv`` field allows a bootmeth to attach private data to each
bootflow, such as parsed configuration state. When the bootflow is freed,
@@ -101,6 +101,9 @@ enum bootflow_flags_t {
* @bootmeth_priv: Private data for the bootmeth (allocated). Freed by
* bootmeth_free_bootflow() which calls the bootmeth's free_bootflow() op
* for internal cleanup, then frees the pointer itself.
+ * @bootmeth_id: Bootmeth-specific identifier for this bootflow, e.g. an
+ * alist index for the PXE context used during scanning. Interpretation
+ * is up to the bootmeth.
* @images: List of loaded images (struct bootstd_img)
*/
struct bootflow {
@@ -127,6 +130,7 @@ struct bootflow {
char *cmdline;
void *x86_setup;
void *bootmeth_priv;
+ int bootmeth_id;
struct alist images;
};