for (iter->cur_method++; iter->cur_method < iter->num_methods;
iter->cur_method++) {
/* loop until we find a global bootmeth we haven't used */
- if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && iter->doing_global &&
- !bootmeth_glob_allowed(iter, iter->cur_method))
- continue;
+ if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && iter->doing_global) {
+ if (!bootmeth_glob_allowed(iter, iter->cur_method))
+ continue;
+
+ iter->method = iter->method_order[iter->cur_method];
+ log_debug("-> next global method '%s'\n",
+ iter->method->name);
+ return 0;
+ }
+
+ /* at this point we are only considering non-global bootmeths */
+ if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && iter->have_global &&
+ iter->cur_method >= iter->first_glob_method)
+ break;
iter->method = iter->method_order[iter->cur_method];
return 0;
* normal bootdev scan
*/
if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && global) {
- iter->num_methods = iter->first_glob_method;
iter->doing_global = false;
/*
ut_asserteq(-EPROTONOSUPPORT, bootflow_scan_next(&iter, &bflow));
/* at this point the global bootmeths are stranded above num_methods */
- ut_asserteq(2, iter.num_methods);
+ ut_asserteq(3, iter.num_methods);
ut_asserteq(2, iter.first_glob_method);
ut_assert(!iter.doing_global);
ut_assert(iter.have_global);
ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow));
/* at this point the global bootmeths are stranded above num_methods */
- ut_asserteq(3, iter.num_methods);
+ ut_asserteq(4, iter.num_methods);
ut_assert(!iter.doing_global);
ut_assert(iter.have_global);
ut_asserteq(3, iter.first_glob_method);
ut_assert_console_end();
/* Check that the sandbox bootmeth has been removed */
- ut_asserteq(2, iter.num_methods);
+ ut_asserteq(3, iter.num_methods);
for (i = 0; i < iter.num_methods; i++)
ut_assert(strcmp("sandbox", iter.method_order[i]->name));