+2013-09-24 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * include/grub/emu/hostdisk.h (GRUB_FD_STAT_IS_FUNTIONAL): New define.
+ Migrate all explicit defines to this new one.
+
2013-09-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_open): Use
typedef HANDLE grub_util_fd_t;
#define GRUB_UTIL_FD_INVALID INVALID_HANDLE_VALUE
#define GRUB_UTIL_FD_IS_VALID(x) ((x) != GRUB_UTIL_FD_INVALID)
+#define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 0
#else
typedef int grub_util_fd_t;
#define GRUB_UTIL_FD_INVALID -1
#define GRUB_UTIL_FD_IS_VALID(x) ((x) >= 0)
+#define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 1
#endif
grub_util_fd_t
grub_util_info ("Looking for %s", os_dev);
-#if !defined (__MINGW32__) && !defined (__CYGWIN__)
+#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
struct stat st;
if (stat (os_dev, &st) < 0)
char *
grub_util_biosdisk_get_grub_dev (const char *os_dev)
{
-#if !defined (__MINGW32__) && !defined (__CYGWIN__)
+#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
struct stat st;
#endif
const char *drive;
grub_util_info ("Looking for %s", os_dev);
-#if !defined (__MINGW32__) && !defined (__CYGWIN__)
+#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
if (stat (os_dev, &st) < 0)
{
const char *errstr = strerror (errno);
grub_errno = GRUB_ERR_NONE;
canon = canonicalize_file_name (os_dev);
-#if !defined (__MINGW32__) && !defined (__CYGWIN__)
+#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
drive = find_system_device (canon ? : os_dev, &st, 0, 1);
#else
drive = find_system_device (canon ? : os_dev, NULL, 0, 1);
int
grub_util_biosdisk_is_present (const char *os_dev)
{
-#if !defined (__MINGW32__) && !defined (__CYGWIN__) && !defined (__AROS__)
+#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
struct stat st;
if (stat (os_dev, &st) < 0)