* include/grub/emu/hostdisk.h (GRUB_FD_STAT_IS_FUNTIONAL): New define.
Migrate all explicit defines to this new one.
This commit is contained in:
parent
43b1c99d53
commit
bab7b1ebeb
4 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2013-09-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_open): Use
|
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_open): Use
|
||||||
|
|
|
@ -161,7 +161,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
||||||
&disk->log_sector_size);
|
&disk->log_sector_size);
|
||||||
disk->total_sectors >>= disk->log_sector_size;
|
disk->total_sectors >>= disk->log_sector_size;
|
||||||
|
|
||||||
#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined (__AROS__)
|
#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
# if GRUB_DISK_DEVS_ARE_CHAR
|
# if GRUB_DISK_DEVS_ARE_CHAR
|
||||||
|
|
|
@ -29,10 +29,12 @@
|
||||||
typedef HANDLE grub_util_fd_t;
|
typedef HANDLE grub_util_fd_t;
|
||||||
#define GRUB_UTIL_FD_INVALID INVALID_HANDLE_VALUE
|
#define GRUB_UTIL_FD_INVALID INVALID_HANDLE_VALUE
|
||||||
#define GRUB_UTIL_FD_IS_VALID(x) ((x) != GRUB_UTIL_FD_INVALID)
|
#define GRUB_UTIL_FD_IS_VALID(x) ((x) != GRUB_UTIL_FD_INVALID)
|
||||||
|
#define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 0
|
||||||
#else
|
#else
|
||||||
typedef int grub_util_fd_t;
|
typedef int grub_util_fd_t;
|
||||||
#define GRUB_UTIL_FD_INVALID -1
|
#define GRUB_UTIL_FD_INVALID -1
|
||||||
#define GRUB_UTIL_FD_IS_VALID(x) ((x) >= 0)
|
#define GRUB_UTIL_FD_IS_VALID(x) ((x) >= 0)
|
||||||
|
#define GRUB_UTIL_FD_STAT_IS_FUNCTIONAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
grub_util_fd_t
|
grub_util_fd_t
|
||||||
|
|
|
@ -215,7 +215,7 @@ grub_util_get_os_disk (const char *os_dev)
|
||||||
|
|
||||||
grub_util_info ("Looking for %s", os_dev);
|
grub_util_info ("Looking for %s", os_dev);
|
||||||
|
|
||||||
#if !defined (__MINGW32__) && !defined (__CYGWIN__)
|
#if GRUB_UTIL_FD_STAT_IS_FUNCTIONAL
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (stat (os_dev, &st) < 0)
|
if (stat (os_dev, &st) < 0)
|
||||||
|
@ -266,7 +266,7 @@ find_partition (grub_disk_t dsk __attribute__ ((unused)),
|
||||||
char *
|
char *
|
||||||
grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
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;
|
struct stat st;
|
||||||
#endif
|
#endif
|
||||||
const char *drive;
|
const char *drive;
|
||||||
|
@ -275,7 +275,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
||||||
|
|
||||||
grub_util_info ("Looking for %s", os_dev);
|
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)
|
if (stat (os_dev, &st) < 0)
|
||||||
{
|
{
|
||||||
const char *errstr = strerror (errno);
|
const char *errstr = strerror (errno);
|
||||||
|
@ -415,7 +415,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
|
||||||
canon = canonicalize_file_name (os_dev);
|
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);
|
drive = find_system_device (canon ? : os_dev, &st, 0, 1);
|
||||||
#else
|
#else
|
||||||
drive = find_system_device (canon ? : os_dev, NULL, 0, 1);
|
drive = find_system_device (canon ? : os_dev, NULL, 0, 1);
|
||||||
|
@ -462,7 +462,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
||||||
int
|
int
|
||||||
grub_util_biosdisk_is_present (const char *os_dev)
|
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;
|
struct stat st;
|
||||||
|
|
||||||
if (stat (os_dev, &st) < 0)
|
if (stat (os_dev, &st) < 0)
|
||||||
|
|
Loading…
Reference in a new issue