2008-08-29 Bean <bean123ch@gmail.com>

* configure.ac: Change host_os to cygwin for mingw.
	(asprintf): New check for function.

	* include/grub/symbol.h: Replace #ifndef __CYGWIN__ with
	#if ! defined (__CYGWIN__) && ! defined (__MINGW32__).

	* include/grub/util/misc.h: #include <config.h> and <grub/types.h>,
	declear asprintf if HAVE_ASPRINTF is not set, declear fseeko, ftello,
	sync, sleep and grub_util_get_disk_size for mingw.

	* util/biosdisk.c (grub_util_biosdisk_open): Use grub_util_get_disk_size
	to get size in mingw.
	(open_device): Use flag O_BINARY if it's defined.
	(find_root_device): Add dummy code for mingw.

	* util/grub-mkdevicemap.c (get_floppy_disk_name): Return 0 for mingw.
	(get_ide_disk_name): Return //./PHYSICALDRIVE%d for mingw.
	(get_scsi_disk_name): Return 0 for mingw.

	* util/hostfs.c: #include <grub/util/misc.h>.
	(grub_hostfs_open): Use "rb" flag to open file, use
	grub_util_get_disk_size to get disk size for mingw.

	* util/misc.c: #include <windows.h> and <winioctl.h> in mingw.
	(asprintf): New function if HAVE_ASPRINTF is not set.
	(sync): New function for mingw.
	(sleep): Likewise.
	(grub_util_get_disk_size): Likewise.
This commit is contained in:
bean 2008-08-29 19:55:23 +00:00
parent ab3f267329
commit 6e5a42fe9a
11 changed files with 199 additions and 6 deletions

View file

@ -169,6 +169,9 @@ get_floppy_disk_name (char *name, int unit)
#elif defined(__CYGWIN__)
/* Cygwin */
sprintf (name, "/dev/fd%d", unit);
#elif defined(__MINGW32__)
(void) unit;
*name = 0;
#else
# warning "BIOS floppy drives cannot be guessed in your operating system."
/* Set NAME to a bogus string. */
@ -214,6 +217,8 @@ get_ide_disk_name (char *name, int unit)
/* Cygwin emulates all disks as /dev/sdX. */
(void) unit;
*name = 0;
#elif defined(__MINGW32__)
sprintf (name, "//./PHYSICALDRIVE%d", unit);
#else
# warning "BIOS IDE drives cannot be guessed in your operating system."
/* Set NAME to a bogus string. */
@ -258,6 +263,9 @@ get_scsi_disk_name (char *name, int unit)
#elif defined(__CYGWIN__)
/* Cygwin emulates all disks as /dev/sdX. */
sprintf (name, "/dev/sd%c", unit + 'a');
#elif defined(__MINGW32__)
(void) unit;
*name = 0;
#else
# warning "BIOS SCSI drives cannot be guessed in your operating system."
/* Set NAME to a bogus string. */