summaryrefslogtreecommitdiffstats
path: root/lib/pb-protocol/pb-protocol.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-12-11 16:38:21 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-12-15 15:47:40 +0800
commitd3e95283e69d3099fe9f36e56be1f645f565c843 (patch)
tree42e2f2c71ede42c9922a327b26340b5909f65b5a /lib/pb-protocol/pb-protocol.c
parentf69fabee4a120cebaeff2359350e62bd960088f4 (diff)
downloadtalos-petitboot-d3e95283e69d3099fe9f36e56be1f645f565c843.tar.gz
talos-petitboot-d3e95283e69d3099fe9f36e56be1f645f565c843.zip
discover: Integrate ipmi bootdev settings into the priority system
Currently, we expose the boot device priorities through an array in struct config, which will either be the default (network -> disk), or a single device type specified by the IPMI code. Rather than hide the implementation details in this array, we'd like to expose the details of the machine configuration instead. This allows user visibility of the real boot configuration (for example, if an IPMI boot preference is set). This change removes the priority array, and replaces it with the ipmi_bootdev data (and a persistent flag). We update the default-conflict-resolution code to reflect the priorities between IPMI and UUID preferences. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/pb-protocol/pb-protocol.c')
-rw-r--r--lib/pb-protocol/pb-protocol.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 866673d..4398248 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -284,6 +284,8 @@ int pb_protocol_config_len(const struct config *config)
len += 4 + optional_strlen(config->boot_device);
+ len += 4 + 4; /* ipmi_bootdev, ipmi_bootdev_persistent */
+
len += 4 + optional_strlen(config->lang);
return len;
@@ -488,6 +490,11 @@ int pb_protocol_serialise_config(const struct config *config,
pos += pb_protocol_serialise_string(pos, config->boot_device);
+ *(uint32_t *)pos = __cpu_to_be32(config->ipmi_bootdev);
+ pos += 4;
+ *(uint32_t *)pos = config->ipmi_bootdev_persistent;
+ pos += 4;
+
pos += pb_protocol_serialise_string(pos, config->lang);
assert(pos <= buf + buf_len);
@@ -934,9 +941,14 @@ int pb_protocol_deserialise_config(struct config *config,
if (read_string(config, &pos, &len, &str))
goto out;
-
config->boot_device = str;
+ if (read_u32(&pos, &len, &config->ipmi_bootdev))
+ goto out;
+ if (read_u32(&pos, &len, &tmp))
+ goto out;
+ config->ipmi_bootdev_persistent = !!tmp;
+
if (read_string(config, &pos, &len, &str))
goto out;
OpenPOWER on IntegriCloud