From 5177ba140070771acf0a28b5223db580c9847674 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 24 Sep 2013 18:55:10 +0200 Subject: [PATCH] * util/getroot.c (grub_util_check_block_device): Move to ... * util/getroot_unix.c (grub_util_check_block_device): ... here. * util/getroot.c (grub_util_check_char_device): Move to ... * util/getroot_unix.c (grub_util_check_char_device): ... here. --- ChangeLog | 7 +++++++ util/getroot.c | 29 ----------------------------- util/getroot_unix.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ebd77ac9..7777c5619 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-09-24 Vladimir Serbinenko + + * util/getroot.c (grub_util_check_block_device): Move to ... + * util/getroot_unix.c (grub_util_check_block_device): ... here. + * util/getroot.c (grub_util_check_char_device): Move to ... + * util/getroot_unix.c (grub_util_check_char_device): ... here. + 2013-09-24 Vladimir Serbinenko * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_close): Fix diff --git a/util/getroot.c b/util/getroot.c index 0872bc0ae..65dee750b 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -473,35 +473,6 @@ grub_util_biosdisk_is_present (const char *os_dev) return ret; } -const char * -grub_util_check_block_device (const char *blk_dev) -{ - struct stat st; - - if (stat (blk_dev, &st) < 0) - grub_util_error (_("cannot stat `%s': %s"), blk_dev, - strerror (errno)); - - if (S_ISBLK (st.st_mode)) - return (blk_dev); - else - return 0; -} - -const char * -grub_util_check_char_device (const char *blk_dev) -{ - struct stat st; - - if (stat (blk_dev, &st) < 0) - grub_util_error (_("cannot stat `%s': %s"), blk_dev, strerror (errno)); - - if (S_ISCHR (st.st_mode)) - return (blk_dev); - else - return 0; -} - #ifdef HAVE_LIBZFS static libzfs_handle_t *__libzfs_handle; diff --git a/util/getroot_unix.c b/util/getroot_unix.c index 079f91628..ac82487ca 100644 --- a/util/getroot_unix.c +++ b/util/getroot_unix.c @@ -928,6 +928,35 @@ grub_util_biosdisk_is_floppy (grub_disk_t disk) return 0; } +const char * +grub_util_check_block_device (const char *blk_dev) +{ + struct stat st; + + if (stat (blk_dev, &st) < 0) + grub_util_error (_("cannot stat `%s': %s"), blk_dev, + strerror (errno)); + + if (S_ISBLK (st.st_mode)) + return (blk_dev); + else + return 0; +} + +const char * +grub_util_check_char_device (const char *blk_dev) +{ + struct stat st; + + if (stat (blk_dev, &st) < 0) + grub_util_error (_("cannot stat `%s': %s"), blk_dev, strerror (errno)); + + if (S_ISCHR (st.st_mode)) + return (blk_dev); + else + return 0; +} + #else void