From aa530148044a7c6d7ec7b6a32672cc69d53979b2 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 30 Jan 2014 16:19:20 +0800 Subject: 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 --- lib/pb-config/pb-config.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/pb-config/pb-config.c') diff --git a/lib/pb-config/pb-config.c b/lib/pb-config/pb-config.c index 35008cc..ed84fec 100644 --- a/lib/pb-config/pb-config.c +++ b/lib/pb-config/pb-config.c @@ -62,8 +62,11 @@ struct config *config_copy(void *ctx, const struct config *src) dest->boot_priorities = talloc_array(dest, struct boot_priority, src->n_boot_priorities); - for (i = 0; i < src->n_boot_priorities; i++) + for (i = 0; i < src->n_boot_priorities; i++) { + dest->boot_priorities[i].priority = + src->boot_priorities[i].priority; dest->boot_priorities[i].type = src->boot_priorities[i].type; + } return dest; } -- cgit v1.2.1