Currently, If we want disable all but a specific device type from
default boot, we need to add a negative priority for all other devices.
This change adds a DEVICE_TYPE_ANY definition, to allow a simpler way to
express "only boot a specific type" by default behaviour.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
static bool priority_match(struct boot_priority *prio,
struct discover_boot_option *opt)
{
- return prio->type == opt->device->device->type;
+ return prio->type == opt->device->device->type ||
+ prio->type == DEVICE_TYPE_ANY;
}
static int default_option_priority(struct discover_boot_option *opt)
DEVICE_TYPE_NETWORK,
DEVICE_TYPE_DISK,
DEVICE_TYPE_OPTICAL,
+ DEVICE_TYPE_ANY,
DEVICE_TYPE_UNKNOWN,
};
return "network";
case DEVICE_TYPE_OPTICAL:
return "optical";
+ case DEVICE_TYPE_ANY:
+ return "any";
case DEVICE_TYPE_UNKNOWN:
return "unknown";
}