summaryrefslogtreecommitdiffstats
path: root/lib/pb-protocol
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-01-30 16:19:20 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-01-30 21:59:10 +0800
commitaa530148044a7c6d7ec7b6a32672cc69d53979b2 (patch)
tree09e9ef7bb4a1f0c6976657c581553bb00ea5c40f /lib/pb-protocol
parenta984595cfb4910ba6f464c69c316f1613f10f894 (diff)
downloadpetitboot-aa530148044a7c6d7ec7b6a32672cc69d53979b2.zip
petitboot-aa530148044a7c6d7ec7b6a32672cc69d53979b2.tar.gz
discover: Make boot_priorities more flexible
Rather than rely on the ordering of the boot_priorities array to define which device types have a higher "default boot" priority, this change introduces a slightly more flexible way of priority lookups, by adding a separate priority field to struct boot_priority. This means we can have an unordered array, change priorities without re-writing the array, and implementing a disable mechanism. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/pb-protocol')
-rw-r--r--lib/pb-protocol/pb-protocol.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 5a1cee7..3c472fe 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -279,7 +279,7 @@ int pb_protocol_config_len(const struct config *config)
len += 4 + optional_strlen(config->network.dns_servers[i]);
len += 4;
- len += config->n_boot_priorities * 4;
+ len += config->n_boot_priorities * 8;
return len;
}
@@ -464,7 +464,11 @@ int pb_protocol_serialise_config(const struct config *config,
*(uint32_t *)pos = __cpu_to_be32(config->n_boot_priorities);
pos += 4;
for (i = 0; i < config->n_boot_priorities; i++) {
- *(uint32_t *)pos = __cpu_to_be32(config->boot_priorities[i].type);
+ *(uint32_t *)pos =
+ __cpu_to_be32(config->boot_priorities[i].type);
+ pos += 4;
+ *(uint32_t *)pos =
+ __cpu_to_be32(config->boot_priorities[i].priority);
pos += 4;
}
OpenPOWER on IntegriCloud