On Fri, Mar 15, 2024 at 04:09:02PM +0100, Daniel Kiper wrote: > On Fri, Mar 15, 2024 at 05:00:28PM +0800, Michael Chang via Grub-devel wrote: > > Refine iteration to prioritize returning system disk devices over > > memdisk and procfs. This adjustment brings about a modest improvement in > > search efficiency, particularly during file or UUID-based > > searches for a root file system. Additionally, it helps mitigate > > potential collisions in file-based searches where memdisk may mistakenly > > take precedence over system disks. > > It seems to me you could do this without adding additional loops. If it > is not possible the change begs for comment.
Thanks for review. The added loop for proc and memdisk in the final output is required for the `ls' to output list of all devices. I'll add this to the comment and send v2 patch. Thanks, Michael > > Daniel > > > Signed-off-by: Michael Chang <mch...@suse.com> > > --- > > include/grub/disk.h | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/include/grub/disk.h b/include/grub/disk.h > > index fbf23df7f..b3e4f1c8b 100644 > > --- a/include/grub/disk.h > > +++ b/include/grub/disk.h > > @@ -242,7 +242,12 @@ grub_disk_dev_iterate (grub_disk_dev_iterate_hook_t > > hook, void *hook_data) > > > > for (pull = 0; pull < GRUB_DISK_PULL_MAX; pull++) > > for (p = grub_disk_dev_list; p; p = p->next) > > - if (p->disk_iterate && (p->disk_iterate) (hook, hook_data, pull)) > > + if ((p->id != GRUB_DISK_DEVICE_MEMDISK_ID && p->id != > > GRUB_DISK_DEVICE_PROCFS_ID) && p->disk_iterate && (p->disk_iterate) (hook, > > hook_data, pull)) > > + return 1; > > + > > + for (pull = 0; pull < GRUB_DISK_PULL_MAX; pull++) > > + for (p = grub_disk_dev_list; p; p = p->next) > > + if ((p->id == GRUB_DISK_DEVICE_MEMDISK_ID || p->id == > > GRUB_DISK_DEVICE_PROCFS_ID) && p->disk_iterate && (p->disk_iterate) (hook, > > hook_data, pull)) > > return 1; > > > > return 0; _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel