From f0b94ded6d43e812690484b25a9d73051dba68df Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 14 Aug 2013 17:55:15 +0200 Subject: [PATCH] * grub-core/kern/emu/misc.c (grub_device_mapper_supported): Move from here ... * grub-core/kern/emu/hostdisk.c (grub_device_mapper_supported): ... to here. --- ChangeLog | 7 +++++++ grub-core/kern/emu/hostdisk.c | 35 +++++++++++++++++++++++++++++++++++ grub-core/kern/emu/misc.c | 34 ---------------------------------- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57e64c2dc..94a23607f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-08-14 Vladimir Serbinenko + + * grub-core/kern/emu/misc.c (grub_device_mapper_supported): Move from + here ... + * grub-core/kern/emu/hostdisk.c (grub_device_mapper_supported): ... to + here. + 2013-08-14 Vladimir Serbinenko * include/grub/i386/pc/biosdisk.h (grub_biosdisk_drp): Fix device_path diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c index 31423326c..3dbc6ca3f 100644 --- a/grub-core/kern/emu/hostdisk.c +++ b/grub-core/kern/emu/hostdisk.c @@ -404,6 +404,41 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk) #endif } +#ifdef HAVE_DEVICE_MAPPER +static void device_mapper_null_log (int level __attribute__ ((unused)), + const char *file __attribute__ ((unused)), + int line __attribute__ ((unused)), + int dm_errno __attribute__ ((unused)), + const char *f __attribute__ ((unused)), + ...) +{ +} + +int +grub_device_mapper_supported (void) +{ + static int supported = -1; + + if (supported == -1) + { + struct dm_task *dmt; + + /* Suppress annoying log messages. */ + dm_log_with_errno_init (&device_mapper_null_log); + + dmt = dm_task_create (DM_DEVICE_VERSION); + supported = (dmt != NULL); + if (dmt) + dm_task_destroy (dmt); + + /* Restore the original logger. */ + dm_log_with_errno_init (NULL); + } + + return supported; +} +#endif /* HAVE_DEVICE_MAPPER */ + int grub_util_device_is_mapped (const char *dev) { diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c index dc0a39521..c1668bad5 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -207,37 +207,3 @@ canonicalize_file_name (const char *path) return ret; } -#ifdef HAVE_DEVICE_MAPPER -static void device_mapper_null_log (int level __attribute__ ((unused)), - const char *file __attribute__ ((unused)), - int line __attribute__ ((unused)), - int dm_errno __attribute__ ((unused)), - const char *f __attribute__ ((unused)), - ...) -{ -} - -int -grub_device_mapper_supported (void) -{ - static int supported = -1; - - if (supported == -1) - { - struct dm_task *dmt; - - /* Suppress annoying log messages. */ - dm_log_with_errno_init (&device_mapper_null_log); - - dmt = dm_task_create (DM_DEVICE_VERSION); - supported = (dmt != NULL); - if (dmt) - dm_task_destroy (dmt); - - /* Restore the original logger. */ - dm_log_with_errno_init (NULL); - } - - return supported; -} -#endif /* HAVE_DEVICE_MAPPER */