static int grub_biosdisk_iterate (int (*hook) (const char *name)) { int drive; int num_floppies; /* For hard disks, attempt to read the MBR. */ for (drive = 0x80; drive < 0x90; drive++) { if (grub_biosdisk_rw_standard (0x02, drive, 0, 0, 1, 1, GRUB_MEMORY_MACHINE_SCRATCH_SEG) != 0) { grub_dprintf ("disk", "Read error when probing drive 0x%2x\n", drive); break; } if (grub_biosdisk_call_hook (hook, drive)) return 1; } if (cd_drive) { if (grub_biosdisk_call_hook (hook, cd_drive)) return 1; } /* For floppy disks, we can get the number safely. */ num_floppies = grub_biosdisk_get_num_floppies (); for (drive = 0; drive < num_floppies; drive++) if (grub_biosdisk_call_hook (hook, drive)) return 1; return 0; }
static int grub_biosdisk_iterate (int (*hook) (const char *name, void *closure), void *closure) { int drive; int num_floppies; /* For hard disks, attempt to read the MBR. */ for (drive = 0x80; drive < 0x90; drive++) { if (grub_biosdisk_call_hook (hook, closure, drive)) return 1; } if (cd_drive >= 0x90) { if (grub_biosdisk_call_hook (hook, closure, cd_drive)) return 1; } /* For floppy disks, we can get the number safely. */ num_floppies = grub_biosdisk_get_num_floppies (); if ((grub_boot_drive == 0) && (num_floppies == 0)) num_floppies++; for (drive = 0; drive < num_floppies; drive++) if (grub_biosdisk_call_hook (hook, closure, drive)) return 1; return 0; }