function.
* include/grub/emu/hostdisk.h (grub_util_biosdisk_is_floppy): New proto.
* util/grub-setup.c (setup): Use grub_util_biosdisk_is_floppy.
+2010-09-15 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): New
+ function.
+ * include/grub/emu/hostdisk.h (grub_util_biosdisk_is_floppy): New proto.
+ * util/grub-setup.c (setup): Use grub_util_biosdisk_is_floppy.
+
2010-09-15 Yves Blusseau <blusseau@zetam.org>
Add function to get completions from usage.
{
return map[disk->id].device;
}
+
+int
+grub_util_biosdisk_is_floppy (grub_disk_t disk)
+{
+ struct stat st;
+ int fd;
+
+ fd = open (map[disk->id].device, O_RDONLY);
+ /* Shouldn't happen. */
+ if (fd == -1)
+ return 0;
+
+ /* Shouldn't happen either. */
+ if (fstat (fd, &st) < 0)
+ return 0;
+
+#if defined(__NetBSD__)
+ if (major(st.st_rdev) == RAW_FLOPPY_MAJOR)
+ return 1;
+#endif
+
+ if (major(st.st_rdev) == FLOPPY_MAJOR)
+ return 1;
+
+ return 0;
+}
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
int grub_util_biosdisk_is_present (const char *name);
+int grub_util_biosdisk_is_floppy (grub_disk_t disk);
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
/* If DEST_DRIVE is a hard disk, enable the workaround, which is
for buggy BIOSes which don't pass boot drive correctly. Instead,
they pass 0x00 or 0x01 even when booted from 0x80. */
- if (dest_dev->disk->id & 0x80)
- /* Replace the jmp (2 bytes) with double nop's. */
+ if (!grub_util_biosdisk_is_floppy (dest_dev->disk))
+ /* Replace the jmp (2 bytes) with double nop's. */
*boot_drive_check = 0x9090;
}
#endif