From da6e6f17f32680314c57f37fd98ce8e836c9bbed Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 6 May 2010 08:45:39 +0530 Subject: [PATCH] cygwin emu build fixes --- bus/usb/emu/usb.c | 4 ++-- conf/any-emu.rmk | 2 +- include/grub/emu/misc.h | 7 +++++++ kern/emu/getroot.c | 9 ++------- kern/emu/misc.c | 20 ++++++++++++++++++++ util/misc.c | 26 -------------------------- 6 files changed, 32 insertions(+), 36 deletions(-) diff --git a/bus/usb/emu/usb.c b/bus/usb/emu/usb.c index a687eea9b..187857b5b 100644 --- a/bus/usb/emu/usb.c +++ b/bus/usb/emu/usb.c @@ -105,14 +105,14 @@ grub_usb_root_hub (grub_usb_controller_t controller __attribute__((unused))) grub_usb_err_t grub_usb_control_msg (grub_usb_device_t dev, grub_uint8_t reqtype, grub_uint8_t request, grub_uint16_t value, - grub_uint16_t index, grub_size_t size, char *data) + grub_uint16_t idx, grub_size_t size, char *data) { usb_dev_handle *devh; struct usb_device *d = dev->data; devh = usb_open (d); if (usb_control_msg (devh, reqtype, request, - value, index, data, size, 20) < 0) + value, idx, data, size, 20) < 0) { usb_close (devh); return GRUB_USB_ERR_STALL; diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index cb0ec873f..3f0df06aa 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -16,7 +16,7 @@ kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \ \ gnulib/progname.c disk/host.c kernel_img_HEADERS += datetime.h emu/misc.h -kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib +kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wno-unused -Wno-deprecated-declarations -Wno-undef -I$(srcdir)/gnulib kernel_img_LDFLAGS = $(COMMON_LDFLAGS) TARGET_NO_STRIP = yes diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 146e64aa9..e037e6be7 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -4,6 +4,13 @@ #include #include +#ifdef __CYGWIN__ +# include +# include +# include +# define DEV_CYGDRIVE_MAJOR 98 +#endif + #ifdef __NetBSD__ /* NetBSD uses /boot for its boot block. */ # define DEFAULT_DIRECTORY "/grub" diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index 10a65aa87..6875044da 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -19,6 +19,8 @@ #include #include +#include +#include #include #include #include @@ -27,13 +29,6 @@ #include #include -#ifdef __CYGWIN__ -# include -# include -# include -# define DEV_CYGDRIVE_MAJOR 98 -#endif - #ifdef __GNU__ #include #include diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 56195a851..4888f4a6b 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -176,6 +176,26 @@ grub_get_rtc (void) * GRUB_TICKS_PER_SECOND / 1000000)); } +#ifdef __CYGWIN__ +/* Convert POSIX path to Win32 path, + remove drive letter, replace backslashes. */ +static char * +get_win32_path (const char *path) +{ + char winpath[PATH_MAX]; + if (cygwin_conv_path (CCP_POSIX_TO_WIN_A, path, winpath, sizeof(winpath))) + grub_util_error ("cygwin_conv_path() failed"); + + int len = strlen (winpath); + int offs = (len > 2 && winpath[1] == ':' ? 2 : 0); + + int i; + for (i = offs; i < len; i++) + if (winpath[i] == '\\') + winpath[i] = '/'; + return xstrdup (winpath + offs); +} +#endif /* This function never prints trailing slashes (so that its output can be appended a slash unconditionally). */ diff --git a/util/misc.c b/util/misc.c index 1656d6b5b..6785eb00f 100644 --- a/util/misc.c +++ b/util/misc.c @@ -53,11 +53,6 @@ # include #endif -#ifdef __CYGWIN__ -# include -# define DEV_CYGDRIVE_MAJOR 98 -#endif - #ifdef __MINGW32__ #include #include @@ -304,27 +299,6 @@ canonicalize_file_name (const char *path) return ret; } -#ifdef __CYGWIN__ -/* Convert POSIX path to Win32 path, - remove drive letter, replace backslashes. */ -static char * -get_win32_path (const char *path) -{ - char winpath[PATH_MAX]; - if (cygwin_conv_path (CCP_POSIX_TO_WIN_A, path, winpath, sizeof(winpath))) - grub_util_error ("cygwin_conv_path() failed"); - - int len = strlen (winpath); - int offs = (len > 2 && winpath[1] == ':' ? 2 : 0); - - int i; - for (i = offs; i < len; i++) - if (winpath[i] == '\\') - winpath[i] = '/'; - return xstrdup (winpath + offs); -} -#endif - #ifdef GRUB_UTIL void grub_util_init_nls (void)