From 98d3dc02fe195ff73350abec4112fe3af392fa65 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Sat, 5 Dec 2009 19:03:27 +0000 Subject: [PATCH 01/14] 2009-12-05 Carles Pina i Estany * gettext/gettext.c: Include `'. Define grub_gettext_msg, grub_gettext_msg_list. (grub_gettext_gettranslation_from_position): Return const char * and not char *. (grub_gettext_translate): Add the translated strings into a list, returns from the list if existing there. (grub_gettext_init_ext): Add \n at the end of grub_dprintf string. (grub_gettext_delete_list): Delete the list. (grub_gettext_env_write_lang): Call grub_gettext_delete_list when lang environment variable is changed. (GRUB_MOD_FINI): Call grub_gettext_delete_list. --- ChangeLog | 14 ++++++++++ gettext/gettext.c | 71 ++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78d534a3b..77b2165ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-12-05 Carles Pina i Estany + + * gettext/gettext.c: Include `'. Define grub_gettext_msg, + grub_gettext_msg_list. + (grub_gettext_gettranslation_from_position): Return const char * + and not char *. + (grub_gettext_translate): Add the translated strings into a list, + returns from the list if existing there. + (grub_gettext_init_ext): Add \n at the end of grub_dprintf string. + (grub_gettext_delete_list): Delete the list. + (grub_gettext_env_write_lang): Call grub_gettext_delete_list when + lang environment variable is changed. + (GRUB_MOD_FINI): Call grub_gettext_delete_list. + 2009-12-05 Vladimir Serbinenko Rename kernel.mod to kernel.img. diff --git a/gettext/gettext.c b/gettext/gettext.c index b2c468a02..65db73a78 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -17,6 +17,7 @@ * along with GRUB. If not, see . */ +#include #include #include #include @@ -41,6 +42,16 @@ static int grub_gettext_max; static const char *(*grub_gettext_original) (const char *s); +struct grub_gettext_msg +{ + struct grub_gettext_msg *next; + const char *name; + + const char *translated; +}; + +struct grub_gettext_msg *grub_gettext_msg_list = NULL; + #define GETTEXT_MAGIC_NUMBER 0 #define GETTEXT_FILE_FORMAT 4 #define GETTEXT_NUMBER_OF_STRINGS 8 @@ -79,7 +90,7 @@ grub_gettext_getstring_from_offset (grub_uint32_t offset, translation[length] = '\0'; } -static char * +static const char * grub_gettext_gettranslation_from_position (int position) { int offsettranslation; @@ -130,9 +141,18 @@ static const char * grub_gettext_translate (const char *orig) { char *current_string; - char *ret; + const char *ret; int min, max, current; + int found = 0; + + struct grub_gettext_msg *cur; + + cur = grub_named_list_find (GRUB_AS_NAMED_LIST (grub_gettext_msg_list), + orig); + + if (cur) + return cur->translated; if (fd_mo == 0) return orig; @@ -142,7 +162,7 @@ grub_gettext_translate (const char *orig) current = (max + min) / 2; - while (current != min && current != max) + while (current != min && current != max && found == 0) { current_string = grub_gettext_getstring_from_position (current); @@ -160,13 +180,31 @@ grub_gettext_translate (const char *orig) else if (grub_strcmp (current_string, orig) == 0) { grub_free (current_string); - return grub_gettext_gettranslation_from_position (current); + found = 1; } current = (max + min) / 2; } - ret = grub_malloc (grub_strlen (orig) + 1); - grub_strcpy (ret, orig); + ret = found ? grub_gettext_gettranslation_from_position (current) : orig; + + if (found) + { + cur = grub_zalloc (sizeof (*cur)); + + if (cur) + { + cur->name = grub_strdup (orig); + if (cur->name) + { + cur->translated = ret; + grub_list_push (GRUB_AS_LIST_P (&grub_gettext_msg_list), + GRUB_AS_LIST (cur)); + } + } + else + grub_errno = GRUB_ERR_NONE; + } + return ret; } @@ -222,7 +260,7 @@ grub_gettext_init_ext (const char *lang) locale_dir = grub_env_get ("locale_dir"); if (locale_dir == NULL) { - grub_dprintf ("gettext", "locale_dir variable is not set up."); + grub_dprintf ("gettext", "locale_dir variable is not set up.\n"); return; } @@ -259,12 +297,29 @@ grub_gettext_init_ext (const char *lang) } } +static void +grub_gettext_delete_list () +{ + struct grub_gettext_msg *item; + + while ((item = + grub_list_pop (GRUB_AS_LIST_P (&grub_gettext_msg_list))) != 0) + { + char *original = (char *) ((struct grub_gettext_msg *) item)->name; + grub_free (original); + + // Don't delete the translated message because could be in use. + } +} + static char * grub_gettext_env_write_lang (struct grub_env_var *var __attribute__ ((unused)), const char *val) { grub_gettext_init_ext (val); + grub_gettext_delete_list (); + return grub_strdup (val); } @@ -307,5 +362,7 @@ GRUB_MOD_FINI (gettext) if (fd_mo != 0) grub_file_close (fd_mo); + grub_gettext_delete_list (); + grub_gettext = grub_gettext_original; } From df91e6790082e250c1c04a4d8ca2154be7329f62 Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Sun, 6 Dec 2009 10:20:01 +0100 Subject: [PATCH 02/14] 2009-12-06 Felix Zielcke * util/misc.c (make_system_path_relative_to_its_root): Correctly cope with mount points. --- ChangeLog | 5 +++++ util/misc.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 77b2165ab..53667833e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-06 Felix Zielcke + + * util/misc.c (make_system_path_relative_to_its_root): Correctly cope with + mount points. + 2009-12-05 Carles Pina i Estany * gettext/gettext.c: Include `'. Define grub_gettext_msg, diff --git a/util/misc.c b/util/misc.c index 626851306..d46051efe 100644 --- a/util/misc.c +++ b/util/misc.c @@ -500,7 +500,17 @@ make_system_path_relative_to_its_root (const char *path) /* buf is another filesystem; we found it. */ if (st.st_dev != num) - break; + { + /* offset == 0 means path given is the mount point. */ + if (offset == 0) + { + free (buf); + free (buf2); + return strdup ("/"); + } + else + break; + } offset = p - buf; /* offset == 1 means root directory. */ From de6daa8b56a9bae8f27d240f108071ed24c30e2d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 7 Dec 2009 11:54:25 +0100 Subject: [PATCH 03/14] 2009-12-06 David S. Miller * disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Recognize anything even prefixed with 'cdrom' as a cdrom. --- ChangeLog | 5 +++++ disk/ieee1275/ofdisk.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 53667833e..479098cda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-06 David S. Miller + + * disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Recognize + anything even prefixed with 'cdrom' as a cdrom. + 2009-12-06 Felix Zielcke * util/misc.c (make_system_path_relative_to_its_root): Correctly cope with diff --git a/disk/ieee1275/ofdisk.c b/disk/ieee1275/ofdisk.c index ca257d6d1..a33d729e3 100644 --- a/disk/ieee1275/ofdisk.c +++ b/disk/ieee1275/ofdisk.c @@ -107,7 +107,7 @@ grub_ofdisk_iterate (int (*hook) (const char *name)) } if (! grub_strcmp (alias->type, "block") && - grub_strcmp (alias->name, "cdrom")) + grub_strncmp (alias->name, "cdrom", 5)) ret = hook (alias->name); return ret; } From d6ceebf1d9c0e112440f142c867f908293e31d75 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 7 Dec 2009 16:46:24 +0000 Subject: [PATCH 04/14] 2009-12-07 Colin Watson * configure.ac: Check for vasprintf. * util/misc.c (asprintf): Move allocation from here ... (vasprintf): ... to here. New function. (xasprintf): New function. * include/grub/util/misc.h (vasprintf, xasprintf): Add prototypes. * util/getroot.c (grub_util_get_grub_dev): Use xasprintf. * util/grub-mkfont.c (write_font): Likewise. * util/grub-probe.c (probe): Likewise. * util/hostdisk.c (make_device_name): Likewise. --- ChangeLog | 13 +++++++++++++ configure.ac | 2 +- include/grub/util/misc.h | 9 +++++++++ util/getroot.c | 8 ++++---- util/grub-editenv.c | 2 +- util/grub-mkfont.c | 4 ++-- util/grub-probe.c | 2 +- util/hostdisk.c | 10 +++++----- util/misc.c | 36 ++++++++++++++++++++++++++++++++---- 9 files changed, 68 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 479098cda..5acbe4945 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-12-07 Colin Watson + + * configure.ac: Check for vasprintf. + * util/misc.c (asprintf): Move allocation from here ... + (vasprintf): ... to here. New function. + (xasprintf): New function. + * include/grub/util/misc.h (vasprintf, xasprintf): Add + prototypes. + * util/getroot.c (grub_util_get_grub_dev): Use xasprintf. + * util/grub-mkfont.c (write_font): Likewise. + * util/grub-probe.c (probe): Likewise. + * util/hostdisk.c (make_device_name): Likewise. + 2009-12-06 David S. Miller * disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Recognize diff --git a/configure.ac b/configure.ac index b654adeed..474de70be 100644 --- a/configure.ac +++ b/configure.ac @@ -194,7 +194,7 @@ else fi # Check for functions. -AC_CHECK_FUNCS(posix_memalign memalign asprintf) +AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf) # For grub-mkisofs AC_HEADER_MAJOR diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index d0184d416..09108547c 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -57,12 +58,20 @@ void grub_util_write_image (const char *img, size_t size, FILE *out); void grub_util_write_image_at (const void *img, size_t size, off_t offset, FILE *out); +#ifndef HAVE_VASPRINTF + +int vasprintf (char **buf, const char *fmt, va_list ap); + +#endif + #ifndef HAVE_ASPRINTF int asprintf (char **buf, const char *fmt, ...); #endif +char *xasprintf (const char *fmt, ...); + #ifdef __MINGW32__ #define fseeko fseeko64 diff --git a/util/getroot.c b/util/getroot.c index a3c03d0b0..c6c229967 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -546,7 +546,7 @@ grub_util_get_grub_dev (const char *os_dev) if (q) *q = ','; - asprintf (&grub_dev, "md%s", p); + grub_dev = xasprintf ("md%s", p); free (p); } else if (os_dev[7] == '/' && os_dev[8] == 'd') @@ -561,7 +561,7 @@ grub_util_get_grub_dev (const char *os_dev) if (q) *q = ','; - asprintf (&grub_dev, "md%s", p); + grub_dev = xasprintf ("md%s", p); free (p); } else if (os_dev[7] >= '0' && os_dev[7] <= '9') @@ -574,7 +574,7 @@ grub_util_get_grub_dev (const char *os_dev) if (q) *q = ','; - asprintf (&grub_dev, "md%s", p); + grub_dev = xasprintf ("md%s", p); free (p); } else if (os_dev[7] == '/' && os_dev[8] >= '0' && os_dev[8] <= '9') @@ -587,7 +587,7 @@ grub_util_get_grub_dev (const char *os_dev) if (q) *q = ','; - asprintf (&grub_dev, "md%s", p); + grub_dev = xasprintf ("md%s", p); free (p); } else diff --git a/util/grub-editenv.c b/util/grub-editenv.c index 842c5a103..68fb23b15 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -107,7 +107,7 @@ create_envblk_file (const char *name) if (! buf) grub_util_error ("out of memory"); - asprintf (&namenew, "%s.new", name); + namenew = xasprintf ("%s.new", name); fp = fopen (namenew, "wb"); if (! fp) grub_util_error ("cannot open the file %s", namenew); diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c index 40d145fd3..9775e0803 100644 --- a/util/grub-mkfont.c +++ b/util/grub-mkfont.c @@ -366,8 +366,8 @@ write_font (struct grub_font_info *font_info, char *output_file) if (! style_name[0]) strcpy (style_name, " Regular"); - asprintf (&font_name, "%s %s %d", font_info->name, &style_name[1], - font_info->size); + font_name = xasprintf ("%s %s %d", font_info->name, &style_name[1], + font_info->size); write_string_section ("NAME", font_name, &offset, file); write_string_section ("FAMI", font_info->name, &offset, file); diff --git a/util/grub-probe.c b/util/grub-probe.c index 2b9784123..6d421445c 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -254,7 +254,7 @@ probe (const char *path, char *device_name) filebuf_via_sys = grub_util_read_image (path); rel_path = make_system_path_relative_to_its_root (path); - asprintf (&grub_path, "(%s)%s", drive_name, rel_path); + grub_path = xasprintf ("(%s)%s", drive_name, rel_path); free (rel_path); grub_util_info ("reading %s via GRUB facilities", grub_path); file = grub_file_open (grub_path); diff --git a/util/hostdisk.c b/util/hostdisk.c index 04c412300..11caaf407 100644 --- a/util/hostdisk.c +++ b/util/hostdisk.c @@ -679,14 +679,14 @@ make_device_name (int drive, int dos_part, int bsd_part) char *bsd_part_str = NULL; if (dos_part >= 0) - asprintf (&dos_part_str, ",%d", dos_part + 1); + dos_part_str = xasprintf (",%d", dos_part + 1); if (bsd_part >= 0) - asprintf (&bsd_part_str, ",%c", dos_part + 'a'); + bsd_part_str = xasprintf (",%c", dos_part + 'a'); - asprintf (&ret, "%s%s%s", map[drive].drive, - dos_part_str ? : "", - bsd_part_str ? : ""); + ret = xasprintf ("%s%s%s", map[drive].drive, + dos_part_str ? : "", + bsd_part_str ? : ""); if (dos_part_str) free (dos_part_str); diff --git a/util/misc.c b/util/misc.c index d46051efe..d75aa0952 100644 --- a/util/misc.c +++ b/util/misc.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -370,6 +371,19 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)), { } +#ifndef HAVE_VASPRINTF + +int +vasprintf (char **buf, const char *fmt, va_list ap) +{ + /* Should be large enough. */ + *buf = xmalloc (512); + + return vsprintf (*buf, fmt, ap); +} + +#endif + #ifndef HAVE_ASPRINTF int @@ -378,11 +392,8 @@ asprintf (char **buf, const char *fmt, ...) int status; va_list ap; - /* Should be large enough. */ - *buf = xmalloc (512); - va_start (ap, fmt); - status = vsprintf (*buf, fmt, ap); + status = vasprintf (*buf, fmt, ap); va_end (ap); return status; @@ -390,6 +401,23 @@ asprintf (char **buf, const char *fmt, ...) #endif +char * +xasprintf (const char *fmt, ...) +{ + va_list ap; + char *result; + + va_start (ap, fmt); + if (vasprintf (&result, fmt, ap) < 0) + { + if (errno == ENOMEM) + grub_util_error ("out of memory"); + return NULL; + } + + return result; +} + #ifdef __MINGW32__ void sync (void) From e3069ec1a5ac240fed7c6b4983fbc0ab0f568ef2 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Tue, 8 Dec 2009 00:08:52 +0000 Subject: [PATCH 05/14] 2009-12-08 Carles Pina i Estany * include/grub/misc.h (grub_printf_): New declaration. * kern/misc.c (grub_printf_): New definition. * normal/main.c (grub_normal_reader_init): Use `grub_printf_' and `N_' instead of `grub_printf' and `_'. * normal/menu_entry.c (store_completion): Likewise. (run): Likewise. (grub_menu_entry_run): Likewise. * normal/menu_text.c (grub_wait_after_message): Likewise. (notify_booting): Likewise. (notify_fallback): Likewise. (notify_execution_failure): Likewise. --- ChangeLog | 14 ++++++++++++++ include/grub/misc.h | 1 + kern/misc.c | 13 +++++++++++++ normal/main.c | 2 +- normal/menu_entry.c | 6 +++--- normal/menu_text.c | 10 +++++----- 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5acbe4945..dc475c96c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-12-08 Carles Pina i Estany + + * include/grub/misc.h (grub_printf_): New declaration. + * kern/misc.c (grub_printf_): New definition. + * normal/main.c (grub_normal_reader_init): Use `grub_printf_' and `N_' + instead of `grub_printf' and `_'. + * normal/menu_entry.c (store_completion): Likewise. + (run): Likewise. + (grub_menu_entry_run): Likewise. + * normal/menu_text.c (grub_wait_after_message): Likewise. + (notify_booting): Likewise. + (notify_fallback): Likewise. + (notify_execution_failure): Likewise. + 2009-12-07 Colin Watson * configure.ac: Check for vasprintf. diff --git a/include/grub/misc.h b/include/grub/misc.h index 79dafa831..1ab63ac0b 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -171,6 +171,7 @@ char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n); void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); grub_size_t EXPORT_FUNC(grub_strlen) (const char *s); int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); void EXPORT_FUNC(grub_real_dprintf) (const char *file, const int line, const char *condition, diff --git a/kern/misc.c b/kern/misc.c index 9f9a3ae65..4415b8204 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -126,6 +126,19 @@ grub_printf (const char *fmt, ...) return ret; } +int +grub_printf_ (const char *fmt, ...) +{ + va_list ap; + int ret; + + va_start (ap, fmt); + ret = grub_vprintf (_(fmt), ap); + va_end (ap); + + return ret; +} + #if defined (APPLE_CC) && ! defined (GRUB_UTIL) int grub_err_printf (const char *fmt, ...) diff --git a/normal/main.c b/normal/main.c index dcc91c649..f080a6971 100644 --- a/normal/main.c +++ b/normal/main.c @@ -509,7 +509,7 @@ grub_normal_reader_init (void) grub_normal_init_page (); grub_setcursor (1); - grub_printf (_("\ + grub_printf_ (N_("\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\ lists possible command completions. Anywhere else TAB lists possible\n\ device/file completions.%s ]\n\n"), diff --git a/normal/menu_entry.c b/normal/menu_entry.c index 18d4719dc..7a31c27af 100644 --- a/normal/menu_entry.c +++ b/normal/menu_entry.c @@ -837,7 +837,7 @@ store_completion (const char *item, grub_completion_type_t type, int count) grub_gotoxy (0, GRUB_TERM_HEIGHT - 3); grub_printf (" "); - grub_printf (_("Possible %s are:"), what); + grub_printf_ (N_("Possible %s are:"), what); grub_printf ("\n "); } @@ -1000,7 +1000,7 @@ run (struct screen *screen) grub_cls (); grub_printf (" "); - grub_printf (_("Booting a command list")); + grub_printf_ (N_("Booting a command list")); grub_printf ("\n\n"); @@ -1182,6 +1182,6 @@ grub_menu_entry_run (grub_menu_entry_t entry) grub_print_error (); grub_errno = GRUB_ERR_NONE; grub_putchar ('\n'); - grub_printf (_("Press any key to continue...")); + grub_printf_ (N_("Press any key to continue...")); (void) grub_getkey (); } diff --git a/normal/menu_text.c b/normal/menu_text.c index c40fd6374..bb1f52203 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -40,7 +40,7 @@ void grub_wait_after_message (void) { grub_putchar ('\n'); - grub_printf (_("Press any key to continue...")); + grub_printf_ (N_("Press any key to continue...")); (void) grub_getkey (); grub_putchar ('\n'); } @@ -206,7 +206,7 @@ entry is highlighted."); if (nested) { grub_printf ("\n "); - grub_printf (_("ESC to return previous menu.")); + grub_printf_ (N_("ESC to return previous menu.")); } } } @@ -627,7 +627,7 @@ notify_booting (grub_menu_entry_t entry, void *userdata __attribute__((unused))) { grub_printf (" "); - grub_printf (_("Booting \'%s\'"), entry->title); + grub_printf_ (N_("Booting \'%s\'"), entry->title); grub_printf ("\n\n"); } @@ -639,7 +639,7 @@ notify_fallback (grub_menu_entry_t entry, void *userdata __attribute__((unused))) { grub_printf ("\n "); - grub_printf (_("Falling back to \'%s\'"), entry->title); + grub_printf_ (N_("Falling back to \'%s\'"), entry->title); grub_printf ("\n\n"); grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS); } @@ -655,7 +655,7 @@ notify_execution_failure (void *userdata __attribute__((unused))) grub_errno = GRUB_ERR_NONE; } grub_printf ("\n "); - grub_printf (_("Failed to boot default entries.\n")); + grub_printf_ (N_("Failed to boot default entries.\n")); grub_wait_after_message (); } From 7c7b61062648818f957ab0aac1d391f1bb042875 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Tue, 8 Dec 2009 16:00:52 +0000 Subject: [PATCH 06/14] 2009-12-08 Robert Millan * conf/common.rmk [sparc64-ieee1275] (grub_mkdevicemap_SOURCES): Use `util/ieee1275/ofpath.c' and `util/ieee1275/devicemap.c' instead of `util/devicemap.c'. --- ChangeLog | 6 ++++++ conf/common.rmk | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dc475c96c..2c5df8421 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-08 Robert Millan + + * conf/common.rmk [sparc64-ieee1275] (grub_mkdevicemap_SOURCES): Use + `util/ieee1275/ofpath.c' and `util/ieee1275/devicemap.c' instead of + `util/devicemap.c'. + 2009-12-08 Carles Pina i Estany * include/grub/misc.h (grub_printf_): New declaration. diff --git a/conf/common.rmk b/conf/common.rmk index 896705526..56f17e4e7 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -3,7 +3,13 @@ sbin_UTILITIES += grub-mkdevicemap grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \ util/deviceiter.c \ - util/devicemap.c util/misc.c + util/misc.c + +ifeq ($(target_cpu)-$(platform), sparc64-ieee1275) +grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c +else +grub_mkdevicemap_SOURCES += util/devicemap.c +endif # For grub-mkelfimage. bin_UTILITIES += grub-mkelfimage From c631d9fb172da3537ecaef20e8479a002f22ec18 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 9 Dec 2009 16:20:17 +0000 Subject: [PATCH 07/14] 2009-12-09 Colin Watson * util/grub-mkconfig_lib.in: Don't set grub_probe or grub_mkrelpath if they're already set. This resolves the conflict between my grub-install change on 2009-10-06 and Felix' change on 2009-11-11, fixing the --grub-probe option again. * util/sparc64/ieee1275/grub-install.in: Revert the last piece of my change on 2009-10-06, so that we now once again source `${libdir}/grub/grub-mkconfig_lib' after options have been parsed. --- ChangeLog | 10 ++++++++++ util/grub-mkconfig_lib.in | 8 ++++++-- util/sparc64/ieee1275/grub-install.in | 6 +++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c5df8421..41bbb3518 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-12-09 Colin Watson + + * util/grub-mkconfig_lib.in: Don't set grub_probe or grub_mkrelpath + if they're already set. This resolves the conflict between my + grub-install change on 2009-10-06 and Felix' change on 2009-11-11, + fixing the --grub-probe option again. + * util/sparc64/ieee1275/grub-install.in: Revert the last piece of my + change on 2009-10-06, so that we now once again source + `${libdir}/grub/grub-mkconfig_lib' after options have been parsed. + 2009-12-08 Robert Millan * conf/common.rmk [sparc64-ieee1275] (grub_mkdevicemap_SOURCES): Use diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index 5b5dfd42a..8caf4f154 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -24,8 +24,12 @@ bindir=@bindir@ sbindir=@sbindir@ pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"` -grub_probe=${sbindir}/`echo grub-probe | sed ${transform}` -grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}` +if test "x$grub_probe" = x; then + grub_probe=${sbindir}/`echo grub-probe | sed ${transform}` +fi +if test "x$grub_mkrelpath" = x; then + grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}` +fi grub_warn () { diff --git a/util/sparc64/ieee1275/grub-install.in b/util/sparc64/ieee1275/grub-install.in index a03869cb3..5cfb858d7 100644 --- a/util/sparc64/ieee1275/grub-install.in +++ b/util/sparc64/ieee1275/grub-install.in @@ -31,9 +31,6 @@ target_cpu=@target_cpu@ platform=@platform@ pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}` -# for make_system_path_relative_to_its_root() -. ${libdir}/grub/grub-mkconfig_lib - grub_setup=${sbindir}/`echo grub-setup | sed ${transform}` grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}` grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}` @@ -120,6 +117,9 @@ for option in "$@"; do esac done +# for make_system_path_relative_to_its_root() +. ${libdir}/grub/grub-mkconfig_lib + if test "x$install_device" = x; then echo "install_device not specified." 1>&2 usage From 1a0f7f4553408e9294e3c9fba8ce47768b321dc8 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Wed, 9 Dec 2009 21:43:05 +0000 Subject: [PATCH 08/14] 2009-12-09 Bruce Dubbs Remove miscellaneous files in distclean target. * Makefile.in: Remove docs/{grub.info,version.texi,stamp-vti} --- ChangeLog | 6 ++++++ Makefile.in | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 41bbb3518..b145d0c7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-09 Bruce Dubbs + + Remove miscellaneous files in distclean target. + + * Makefile.in: Remove docs/{grub.info,version.texi,stamp-vti} + 2009-12-09 Colin Watson * util/grub-mkconfig_lib.in: Don't set grub_probe or grub_mkrelpath diff --git a/Makefile.in b/Makefile.in index c8187796b..9c7c735d7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -139,7 +139,9 @@ CLEANFILES = MOSTLYCLEANFILES = DISTCLEANFILES = config.status config.cache config.log config.h \ Makefile stamp-h include/grub/cpu include/grub/machine \ - gensymlist.sh genkernsyms.sh build_env.mk + gensymlist.sh genkernsyms.sh build_env.mk \ + docs/grub.info docs/version.texi docs/stamp-vti + MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \ $(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS) From e1f270654e836df3e7862e5a83e1be2dc5456884 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 10 Dec 2009 13:26:22 +0100 Subject: [PATCH 09/14] 2009-12-10 Vladimir Serbinenko * kern/device.c (grub_device_iterate): Ignore errors during first scan. Fixes amarsh bug. --- ChangeLog | 5 +++++ kern/device.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index b145d0c7d..e87ddefe3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-10 Vladimir Serbinenko + + * kern/device.c (grub_device_iterate): Ignore errors during first scan. + Fixes amarsh bug. + 2009-12-09 Bruce Dubbs Remove miscellaneous files in distclean target. diff --git a/kern/device.c b/kern/device.c index 83ae3dcc8..9f219949b 100644 --- a/kern/device.c +++ b/kern/device.c @@ -109,6 +109,8 @@ grub_device_iterate (int (*hook) (const char *name)) (void) grub_partition_iterate (dev->disk, iterate_partition); grub_device_close (dev); + grub_errno = GRUB_ERR_NONE; + p = ents; while (p != NULL) { From 2520d4b815b8a376251c153137441c2294f4d60a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 10 Dec 2009 14:37:42 +0100 Subject: [PATCH 10/14] 2009-12-10 Vladimir Serbinenko Eliminate hexdump 4Gib barrier. * commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_addr_t. * lib/arg.c (grub_arg_parse): Use grub_strtoull. --- ChangeLog | 7 +++++++ commands/hexdump.c | 6 +++--- lib/arg.c | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e87ddefe3..a1c5d5e89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-12-10 Vladimir Serbinenko + + Eliminate hexdump 4Gib barrier. + + * commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_addr_t. + * lib/arg.c (grub_arg_parse): Use grub_strtoull. + 2009-12-10 Vladimir Serbinenko * kern/device.c (grub_device_iterate): Ignore errors during first scan. diff --git a/commands/hexdump.c b/commands/hexdump.c index f59ba363c..4b3e3ef29 100644 --- a/commands/hexdump.c +++ b/commands/hexdump.c @@ -38,18 +38,18 @@ grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args) struct grub_arg_list *state = cmd->state; char buf[GRUB_DISK_SECTOR_SIZE * 4]; grub_ssize_t size, length; - grub_addr_t skip; + grub_disk_addr_t skip; int namelen; if (argc != 1) return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required"); namelen = grub_strlen (args[0]); - skip = (state[0].set) ? grub_strtoul (state[0].arg, 0, 0) : 0; + skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0; length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256; if (!grub_strcmp (args[0], "(mem)")) - hexdump (skip, (char *) skip, length); + hexdump (skip, (char *) (grub_addr_t) skip, length); else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')')) { grub_disk_t disk; diff --git a/lib/arg.c b/lib/arg.c index ed37986b6..24e9d5b15 100644 --- a/lib/arg.c +++ b/lib/arg.c @@ -355,7 +355,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv, { char *tail; - grub_strtoul (option, &tail, 0); + grub_strtoull (option, &tail, 0); if (tail == 0 || tail == option || *tail != '\0' || grub_errno) { grub_error (GRUB_ERR_BAD_ARGUMENT, From 71ee178adbbbac98857fba1f93e4e08468398a5d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 10 Dec 2009 14:39:54 +0100 Subject: [PATCH 11/14] 2009-12-10 Vladimir Serbinenko Eliminate grub-fstest 4Gib barrier. * util/grub-fstest.c (skip, leng): Use grub_disk_addr_t. (read_file): Fix error reporting. --- ChangeLog | 7 +++++++ util/grub-fstest.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1c5d5e89..4a9801412 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-12-10 Vladimir Serbinenko + + Eliminate grub-fstest 4Gib barrier. + + * util/grub-fstest.c (skip, leng): Use grub_disk_addr_t. + (read_file): Fix error reporting. + 2009-12-10 Vladimir Serbinenko Eliminate hexdump 4Gib barrier. diff --git a/util/grub-fstest.c b/util/grub-fstest.c index 03184b632..fa54fe414 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -85,7 +85,7 @@ execute_command (char *name, int n, char **args) #define BUF_SIZE 32256 -static grub_off_t skip, leng; +static grub_disk_addr_t skip, leng; static void read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len)) @@ -140,7 +140,7 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len)) if (skip > file->size) { - grub_util_error ("invalid skip value %d."); + grub_util_error ("invalid skip value %lld.", (unsigned long long) skip); return; } From 2e59983c8262aeb248f95022659c006ff449e682 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 10 Dec 2009 14:45:00 +0100 Subject: [PATCH 12/14] 2009-12-10 Vladimir Serbinenko Eliminate NTFS 4Gib barrier. * fs/ntfs.c (read_attr): Use grub_disk_addr_t and grub_size_t. (read_run_data): Likewise. (grub_ntfs_read_run_list): Likewise. (grub_ntfs_read_block): Likewise. (grub_ntfs_iterate_dir): Likewise. (read_mft): Likewise. (read_data): Likewise. Use COM_LOG_LEN. * fs/ntfscomp.c (read_block): Cast ctx->target_vcn & 0xF to unsigned to avoid 64-bit division * include/grub/ntfs.h (COM_LOG_LEN): New definition. (grub_ntfs_rlst): Use grub_disk_addr_t. --- ChangeLog | 17 +++++++++++++++ fs/ntfs.c | 51 ++++++++++++++++++++++++--------------------- fs/ntfscomp.c | 2 +- include/grub/ntfs.h | 3 ++- 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a9801412..573ac3bf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2009-12-10 Vladimir Serbinenko + + Eliminate NTFS 4Gib barrier. + + * fs/ntfs.c (read_attr): Use grub_disk_addr_t and grub_size_t. + (read_run_data): Likewise. + (grub_ntfs_read_run_list): Likewise. + (grub_ntfs_read_block): Likewise. + (grub_ntfs_iterate_dir): Likewise. + (read_mft): Likewise. + (read_data): Likewise. + Use COM_LOG_LEN. + * fs/ntfscomp.c (read_block): Cast ctx->target_vcn & 0xF to unsigned + to avoid 64-bit division + * include/grub/ntfs.h (COM_LOG_LEN): New definition. + (grub_ntfs_rlst): Use grub_disk_addr_t. + 2009-12-10 Vladimir Serbinenko Eliminate grub-fstest 4Gib barrier. diff --git a/fs/ntfs.c b/fs/ntfs.c index 163f3e0a8..c780887c6 100644 --- a/fs/ntfs.c +++ b/fs/ntfs.c @@ -63,7 +63,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic) static grub_err_t read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno); static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest, - grub_uint32_t ofs, grub_uint32_t len, + grub_disk_addr_t ofs, grub_size_t len, int cached, void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t @@ -72,7 +72,7 @@ static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest, unsigned length)); static grub_err_t read_data (struct grub_ntfs_attr *at, char *pa, char *dest, - grub_uint32_t ofs, grub_uint32_t len, + grub_disk_addr_t ofs, grub_size_t len, int cached, void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t @@ -260,9 +260,9 @@ locate_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft, } static char * -read_run_data (char *run, int nn, grub_uint32_t * val, int sig) +read_run_data (char *run, int nn, grub_disk_addr_t * val, int sig) { - grub_uint32_t r, v; + grub_disk_addr_t r, v; r = 0; v = 1; @@ -284,7 +284,7 @@ grub_err_t grub_ntfs_read_run_list (struct grub_ntfs_rlst * ctx) { int c1, c2; - grub_uint32_t val; + grub_disk_addr_t val; char *run; run = ctx->cur_run; @@ -335,25 +335,25 @@ grub_ntfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t block) struct grub_ntfs_rlst *ctx; ctx = (struct grub_ntfs_rlst *) node; - if ((grub_uint32_t) block >= ctx->next_vcn) + if (block >= ctx->next_vcn) { if (grub_ntfs_read_run_list (ctx)) return -1; return ctx->curr_lcn; } else - return (ctx->flags & RF_BLNK) ? 0 : ((grub_uint32_t) block - + return (ctx->flags & RF_BLNK) ? 0 : (block - ctx->curr_vcn + ctx->curr_lcn); } static grub_err_t -read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs, - grub_uint32_t len, int cached, +read_data (struct grub_ntfs_attr *at, char *pa, char *dest, + grub_disk_addr_t ofs, grub_size_t len, int cached, void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector, unsigned offset, unsigned length)) { - grub_uint32_t vcn; + grub_disk_addr_t vcn; struct grub_ntfs_rlst cc, *ctx; if (len == 0) @@ -388,7 +388,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs, { if ((ofs & (~(COM_LEN - 1))) == at->save_pos) { - grub_uint32_t n; + grub_disk_addr_t n; n = COM_LEN - (ofs - at->save_pos); if (n > len) @@ -411,11 +411,11 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs, at->save_pos = 1; } - vcn = ctx->target_vcn = (ofs / COM_LEN) * (COM_SEC / ctx->comp.spc); + vcn = ctx->target_vcn = (ofs >> COM_LOG_LEN) * (COM_SEC / ctx->comp.spc); ctx->target_vcn &= ~0xF; } else - vcn = ctx->target_vcn = (ofs >> BLK_SHR) / ctx->comp.spc; + vcn = ctx->target_vcn = grub_divmod64 (ofs >> BLK_SHR, ctx->comp.spc, 0); ctx->next_vcn = u32at (pa, 0x10); ctx->curr_lcn = 0; @@ -427,11 +427,13 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs, if (at->flags & AF_GPOS) { - grub_uint32_t st0, st1; + grub_disk_addr_t st0, st1; + grub_uint32_t m; + + grub_divmod64 (ofs >> BLK_SHR, ctx->comp.spc, &m); st0 = - (ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc + - ((ofs >> BLK_SHR) % ctx->comp.spc); + (ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc + m; st1 = st0 + 1; if (st1 == (ctx->next_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc) @@ -462,8 +464,8 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs, } static grub_err_t -read_attr (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs, - grub_uint32_t len, int cached, +read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs, + grub_size_t len, int cached, void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector, unsigned offset, unsigned length)) @@ -479,9 +481,9 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs, if (at->flags & AF_ALST) { char *pa; - grub_uint32_t vcn; + grub_disk_addr_t vcn; - vcn = ofs / (at->mft->data->spc << BLK_SHR); + vcn = grub_divmod64 (ofs, at->mft->data->spc << BLK_SHR, 0); pa = at->attr_nxt + u16at (at->attr_nxt, 4); while (pa < at->attr_end) { @@ -508,7 +510,7 @@ static grub_err_t read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno) { if (read_attr - (&data->mmft.attr, buf, mftno * (data->mft_size << BLK_SHR), + (&data->mmft.attr, buf, mftno * ((grub_disk_addr_t) data->mft_size << BLK_SHR), data->mft_size << BLK_SHR, 0, 0)) return grub_error (GRUB_ERR_BAD_FS, "Read MFT 0x%X fails", mftno); return fixup (data, buf, data->mft_size, "FILE"); @@ -640,7 +642,8 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, unsigned char *bitmap; struct grub_ntfs_attr attr, *at; char *cur_pos, *indx, *bmp; - int bitmap_len, ret = 0; + int ret = 0; + grub_size_t bitmap_len; struct grub_ntfs_file *mft; mft = (struct grub_ntfs_file *) dir; @@ -744,14 +747,14 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir, if (bitmap) { - grub_uint32_t v, i; + grub_disk_addr_t v, i; indx = grub_malloc (mft->data->idx_size << BLK_SHR); if (indx == NULL) goto done; v = 1; - for (i = 0; i < (grub_uint32_t) bitmap_len * 8; i++) + for (i = 0; i < (grub_disk_addr_t)bitmap_len * 8; i++) { if (*bitmap & v) { diff --git a/fs/ntfscomp.c b/fs/ntfscomp.c index 20c79ac07..6bb33ffb1 100644 --- a/fs/ntfscomp.c +++ b/fs/ntfscomp.c @@ -209,7 +209,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, int num) } } - nn = (16 - (ctx->target_vcn & 0xF)) / cpb; + nn = (16 - (unsigned) (ctx->target_vcn & 0xF)) / cpb; if (nn > num) nn = num; num -= nn; diff --git a/include/grub/ntfs.h b/include/grub/ntfs.h index 6482e964b..6f9d4ad6e 100644 --- a/include/grub/ntfs.h +++ b/include/grub/ntfs.h @@ -73,6 +73,7 @@ #define MAX_IDX (16384 >> BLK_SHR) #define COM_LEN 4096 +#define COM_LOG_LEN 12 #define COM_SEC (COM_LEN >> BLK_SHR) #define AF_ALST 1 @@ -164,7 +165,7 @@ struct grub_ntfs_comp struct grub_ntfs_rlst { int flags; - grub_uint32_t target_vcn, curr_vcn, next_vcn, curr_lcn; + grub_disk_addr_t target_vcn, curr_vcn, next_vcn, curr_lcn; char *cur_run; struct grub_ntfs_attr *attr; struct grub_ntfs_comp comp; From 0d56ed64d2b7d3d7dc3e4a245a2f0f0b9cb1f22d Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Thu, 10 Dec 2009 19:15:20 +0100 Subject: [PATCH 13/14] 2009-12-10 Felix Zielcke * disk/i386/pc/biosdisk.c (grub_biosdisk_open): Show the disk name in an error message. (grub_biosdisk_rw): Likewise. --- ChangeLog | 6 ++++++ disk/i386/pc/biosdisk.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 573ac3bf0..86a2a9d8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-10 Felix Zielcke + + * disk/i386/pc/biosdisk.c (grub_biosdisk_open): Show the disk + name in an error message. + (grub_biosdisk_rw): Likewise. + 2009-12-10 Vladimir Serbinenko Eliminate NTFS 4Gib barrier. diff --git a/disk/i386/pc/biosdisk.c b/disk/i386/pc/biosdisk.c index 0a6137fad..af184b1ba 100644 --- a/disk/i386/pc/biosdisk.c +++ b/disk/i386/pc/biosdisk.c @@ -169,7 +169,7 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) else { grub_free (data); - return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values"); + return grub_error (GRUB_ERR_BAD_DEVICE, "%s cannot get C/H/S values", disk->name); } } @@ -252,7 +252,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, 1024 /* cylinders */ * 256 /* heads */ * 63 /* spt */) - return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk"); + return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name); soff = ((grub_uint32_t) sector) % data->sectors + 1; head = ((grub_uint32_t) sector) / data->sectors; @@ -260,7 +260,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, coff = head / data->heads; if (coff >= data->cylinders) - return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk"); + return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name); if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive, coff, hoff, soff, size, segment)) @@ -268,9 +268,9 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, switch (cmd) { case GRUB_BIOSDISK_READ: - return grub_error (GRUB_ERR_READ_ERROR, "biosdisk read error"); + return grub_error (GRUB_ERR_READ_ERROR, "%s read error", disk->name); case GRUB_BIOSDISK_WRITE: - return grub_error (GRUB_ERR_WRITE_ERROR, "biosdisk write error"); + return grub_error (GRUB_ERR_WRITE_ERROR, "%s write error", disk->name); } } } From 8d0502d9b250fb924c5d7045cf9cdd6f4e146e09 Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Fri, 11 Dec 2009 11:11:34 +0100 Subject: [PATCH 14/14] 2009-12-11 Felix Zielcke * util/misc.c: Don't include twice. --- ChangeLog | 4 ++++ util/misc.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 86a2a9d8b..668cc3e88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-12-11 Felix Zielcke + + * util/misc.c: Don't include twice. + 2009-12-10 Felix Zielcke * disk/i386/pc/biosdisk.c (grub_biosdisk_open): Show the disk diff --git a/util/misc.c b/util/misc.c index d75aa0952..5896da0c8 100644 --- a/util/misc.c +++ b/util/misc.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include