From 9dd6fd50b4e69a3e4b68120ece98e5657a453a5b Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Tue, 3 Aug 2010 23:51:48 +0200 Subject: [PATCH] 2010-08-03 Robert Millan Fix grub-emu build. * include/grub/util/misc.h: Move `' to ... * include/grub/emu/misc.h: ... here. * include/grub/util/misc.h (grub_get_libzfs_handle): Move function ... * include/grub/emu/misc.h (grub_get_libzfs_handle): ... here. * util/misc.c: Remove `'. [HAVE_LIBZFS] (libzfs_handle, fini_libzfs) (grub_get_libzfs_handle): Move to ... * kern/emu/misc.c [HAVE_LIBZFS] (__libzfs_handle, fini_libzfs) (grub_get_libzfs_handle): ... here. --- ChangeLog | 16 ++++++++++++++++ include/grub/emu/misc.h | 3 +++ include/grub/util/misc.h | 3 --- kern/emu/misc.c | 27 ++++++++++++++++++++++++++- util/misc.c | 22 ---------------------- 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4da9f96c..b3e7bc67f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2010-08-03 Robert Millan + + Fix grub-emu build. + + * include/grub/util/misc.h: Move `' to ... + * include/grub/emu/misc.h: ... here. + + * include/grub/util/misc.h (grub_get_libzfs_handle): Move function ... + * include/grub/emu/misc.h (grub_get_libzfs_handle): ... here. + + * util/misc.c: Remove `'. + [HAVE_LIBZFS] (libzfs_handle, fini_libzfs) + (grub_get_libzfs_handle): Move to ... + * kern/emu/misc.c [HAVE_LIBZFS] (__libzfs_handle, fini_libzfs) + (grub_get_libzfs_handle): ... here. + 2010-08-03 BVK Chaitanya * script/execute.c (grub_script_execute_cmdline): Check for NULL diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 5047a9406..70cf05e0d 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -21,6 +21,7 @@ #include #include +#include #ifdef __CYGWIN__ # include @@ -75,4 +76,6 @@ extern char * canonicalize_file_name (const char *path); int grub_device_mapper_supported (void); #endif +libzfs_handle_t *grub_get_libzfs_handle (void); + #endif /* GRUB_EMU_MISC_H */ diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index 7ce3d3291..48dfbb868 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -29,7 +29,6 @@ #include #include #include -#include char *grub_util_get_path (const char *dir, const char *file); size_t grub_util_get_fp_size (FILE *fp); @@ -61,6 +60,4 @@ char *canonicalize_file_name (const char *path); void grub_util_init_nls (void); -libzfs_handle_t *grub_get_libzfs_handle (void); - #endif /* ! GRUB_UTIL_MISC_HEADER */ diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 0d71ef3d6..0838dc3c0 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -45,8 +45,11 @@ # include #endif -#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) +#ifdef HAVE_LIBZFS # include +#endif + +#ifdef HAVE_LIBNVPAIR # include #endif @@ -246,6 +249,28 @@ get_win32_path (const char *path) } #endif +#ifdef HAVE_LIBZFS +static libzfs_handle_t *__libzfs_handle; + +static void +fini_libzfs (void) +{ + libzfs_fini (__libzfs_handle); +} + +libzfs_handle_t * +grub_get_libzfs_handle (void) +{ + if (! __libzfs_handle) + { + __libzfs_handle = libzfs_init (); + atexit (fini_libzfs); + } + + return __libzfs_handle; +} +#endif /* HAVE_LIBZFS */ + #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) /* Not ZFS-specific in itself, but for now it's only used by ZFS-related code. */ char * diff --git a/util/misc.c b/util/misc.c index 274c182c2..21dd211e1 100644 --- a/util/misc.c +++ b/util/misc.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -295,27 +294,6 @@ grub_util_init_nls (void) #endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */ } -#ifdef HAVE_LIBZFS -static libzfs_handle_t *libzfs_handle; - -static void -fini_libzfs (void) -{ - libzfs_fini (libzfs_handle); -} - -libzfs_handle_t * -grub_get_libzfs_handle (void) -{ - if (! libzfs_handle) - { - libzfs_handle = libzfs_init (); - atexit (fini_libzfs); - } - - return libzfs_handle; -} -#endif /* HAVE_LIBZFS */ #endif /* GRUB_UTIL */ int