From 47043f959f8ed8891b07ee6a9aaa72187b0f3b79 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 8 Apr 2013 14:35:26 +0200 Subject: [PATCH 001/187] * grub-core/normal/term.c: Few more fixes for menu entry editor rendering. Reported by: Andrey Borzenkov --- ChangeLog | 6 ++++++ grub-core/normal/menu_entry.c | 11 ++++++++++- grub-core/normal/term.c | 13 ++++++++++--- include/grub/term.h | 8 -------- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b90e7a45..0c97d42c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-08 Vladimir Serbinenko + + * grub-core/normal/term.c: Few more fixes for menu entry editor + rendering. + Reported by: Andrey Borzenkov + 2013-04-07 Vladimir Serbinenko * grub-core/normal/term.c: Few more fixes for menu entry editor diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c index 80f946485..e0407aa88 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c @@ -118,6 +118,15 @@ ensure_space (struct line *linep, int extra) return 1; } +/* The max column number of an entry. The last "-1" is for a + continuation marker. */ +static inline int +grub_term_entry_width (struct grub_term_output *term) +{ + return grub_term_border_width (term) - GRUB_TERM_MARGIN * 2 - 2; +} + + /* Return the number of lines occupied by this line on the screen. */ static int get_logical_num_lines (struct line *linep, struct per_term_screen *term_screen) @@ -150,7 +159,7 @@ print_empty_line (int y, struct per_term_screen *term_screen) GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1, y + GRUB_TERM_FIRST_ENTRY_Y); - for (i = 0; i < grub_term_entry_width (term_screen->term); i++) + for (i = 0; i < grub_term_entry_width (term_screen->term) + 1; i++) grub_putcode (' ', term_screen->term); } diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index d73d29c5f..f9620f6e5 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -787,13 +787,17 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual, grub_uint32_t contchar) { const struct grub_unicode_glyph *visual_ptr; + int since_last_nl = 1; for (visual_ptr = visual; visual_ptr < visual + visual_len; visual_ptr++) { - if (visual_ptr->base == '\n') - grub_print_spaces (term, margin_right); + if (visual_ptr->base == '\n' && contchar) + fill_margin (term, margin_right); + putglyph (visual_ptr, term, fixed_tab); + since_last_nl++; if (visual_ptr->base == '\n') { + since_last_nl = 0; if (state && ++state->num_lines >= (grub_ssize_t) grub_term_height (term) - 2) { @@ -811,6 +815,9 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual, } grub_free (visual_ptr->combining); } + if (contchar && since_last_nl) + fill_margin (term, margin_right); + return 0; } @@ -950,7 +957,7 @@ print_ucs4_real (const grub_uint32_t * str, else { ret = put_glyphs_terminal (visual_show, visual_len_show, margin_left, - contchar ? 0 : margin_right, + margin_right, term, state, fixed_tab, contchar); if (!ret) diff --git a/include/grub/term.h b/include/grub/term.h index 655a5e33b..565d14f7b 100644 --- a/include/grub/term.h +++ b/include/grub/term.h @@ -347,14 +347,6 @@ grub_term_border_width (struct grub_term_output *term) return grub_term_width (term) - GRUB_TERM_MARGIN * 2; } -/* The max column number of an entry. The last "-1" is for a - continuation marker. */ -static inline int -grub_term_entry_width (struct grub_term_output *term) -{ - return grub_term_border_width (term) - GRUB_TERM_MARGIN * 2 - 1; -} - static inline grub_uint16_t grub_term_getxy (struct grub_term_output *term) { From d4c4b8e1a085f92afcec36f6e590c6dfc51d0a1c Mon Sep 17 00:00:00 2001 From: Bryan Hundven Date: Mon, 8 Apr 2013 15:23:07 +0200 Subject: [PATCH 002/187] * docs/grub-dev.texi: Move @itemize after @subsection to satisfy texinfo-5.1. --- ChangeLog | 5 +++++ docs/grub-dev.texi | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0c97d42c0..3a241c02a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-08 Bryan Hundven + + * docs/grub-dev.texi: Move @itemize after @subsection to satisfy + texinfo-5.1. + 2013-04-08 Vladimir Serbinenko * grub-core/normal/term.c: Few more fixes for menu entry editor diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi index a4a38206e..f74c96602 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -1394,8 +1394,8 @@ grub_video_blit_glyph (&glyph, color, 0, 0); @node Bitmap API @section Bitmap API -@itemize @subsection grub_video_bitmap_create +@itemize @item Prototype: @example grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap, unsigned int width, unsigned int height, enum grub_video_blit_format blit_format) From ca53deb88f2e4613dd552422e70ce8afcfa71e0a Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Mon, 8 Apr 2013 19:51:33 +0200 Subject: [PATCH 003/187] * grub-core/term/i386/pc/console.c: Fix cursor moving algorithm. --- ChangeLog | 4 ++++ grub-core/term/i386/pc/console.c | 24 +++++++++--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a241c02a..9e08bea99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-08 Andrey Borzenkov + + * grub-core/term/i386/pc/console.c: Fix cursor moving algorithm. + 2013-04-08 Bryan Hundven * docs/grub-dev.texi: Move @itemize after @subsection to satisfy diff --git a/grub-core/term/i386/pc/console.c b/grub-core/term/i386/pc/console.c index ee6650bf9..358611a65 100644 --- a/grub-core/term/i386/pc/console.c +++ b/grub-core/term/i386/pc/console.c @@ -86,13 +86,9 @@ grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)), * Put the character C on the console. Because GRUB wants to write a * character with an attribute, this implementation is a bit tricky. * If C is a control character (CR, LF, BEL, BS), use INT 10, AH = 0Eh - * (TELETYPE OUTPUT). Otherwise, save the original position, put a space, - * save the current position, restore the original position, write the - * character and the attribute, and restore the current position. - * - * The reason why this is so complicated is that there is no easy way to - * get the height of the screen, and the TELETYPE OUTPUT BIOS call doesn't - * support setting a background attribute. + * (TELETYPE OUTPUT). Otherwise, use INT 10, AH = 9 to write character + * with attributes and advance cursor. If we are on the last column, + * let BIOS to wrap line correctly. */ static void grub_console_putchar_real (grub_uint8_t c) @@ -112,19 +108,18 @@ grub_console_putchar_real (grub_uint8_t c) /* get the current position */ pos = grub_console_getxy (NULL); + /* write the character with the attribute */ + int10_9 (c, 1); + /* check the column with the width */ if ((pos & 0xff00) >= (79 << 8)) { grub_console_putchar_real (0x0d); grub_console_putchar_real (0x0a); - /* get the current position */ - pos = grub_console_getxy (NULL); } + else + grub_console_gotoxy (NULL, ((pos & 0xff00) >> 8) + 1, (pos & 0xff)); - /* write the character with the attribute */ - int10_9 (c, 1); - - grub_console_gotoxy (NULL, ((pos & 0xff00) >> 8) + 1, (pos & 0xff)); } static void @@ -255,8 +250,7 @@ grub_console_getkeystatus (struct grub_term_input *term __attribute__ ((unused)) static grub_uint16_t grub_console_getwh (struct grub_term_output *term __attribute__ ((unused))) { - /* Due to current cursor moving algorithm we lost the last column. */ - return (79 << 8) | 25; + return (80 << 8) | 25; } static void From 18866643f74f8a674b624bc379a23cfc7f211658 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Mon, 8 Apr 2013 19:57:56 +0200 Subject: [PATCH 004/187] * grub-core/Makefile.core.def: Add kern/elfXX.c to elf module as extra_dist. --- ChangeLog | 5 +++++ grub-core/Makefile.core.def | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9e08bea99..083d86a53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-08 Andrey Borzenkov + + * grub-core/Makefile.core.def: Add kern/elfXX.c to elf module + as extra_dist. + 2013-04-08 Andrey Borzenkov * grub-core/term/i386/pc/console.c: Fix cursor moving algorithm. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 4b4c02473..fece8821e 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1316,6 +1316,8 @@ module = { module = { name = elf; common = kern/elf.c; + + extra_dist = kern/elfXX.c; }; module = { From d5e2a158e1f10f20d1c38f0bd385f97a2c052d92 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 9 Apr 2013 19:19:19 +0200 Subject: [PATCH 005/187] Fix ia64-efi image generation on big-endian machines. Deduplicate some code while on it. Reported by: Leif Lindholm. --- ChangeLog | 6 ++ grub-core/kern/ia64/dl.c | 135 ++---------------------- grub-core/kern/ia64/dl_helper.c | 159 ++++++++++++++++++++++++++-- include/grub/ia64/reloc.h | 42 ++++++++ util/grub-mkimage.c | 9 +- util/grub-mkimagexx.c | 178 ++++++-------------------------- 6 files changed, 243 insertions(+), 286 deletions(-) create mode 100644 include/grub/ia64/reloc.h diff --git a/ChangeLog b/ChangeLog index 083d86a53..e45ca3523 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-08 Vladimir Serbinenko + + Fix ia64-efi image generation on big-endian machines. Deduplicate + some code while on it. + Reported by: Leif Lindholm. + 2013-04-08 Andrey Borzenkov * grub-core/Makefile.core.def: Add kern/elfXX.c to elf module diff --git a/grub-core/kern/ia64/dl.c b/grub-core/kern/ia64/dl.c index 7c22b0b06..957ceaae6 100644 --- a/grub-core/kern/ia64/dl.c +++ b/grub-core/kern/ia64/dl.c @@ -23,6 +23,9 @@ #include #include #include +#include + +#define MASK19 ((1 << 19) - 1) /* Check if EHDR is a valid ELF header. */ grub_err_t @@ -41,126 +44,6 @@ grub_arch_dl_check_header (void *ehdr) #pragma GCC diagnostic ignored "-Wcast-align" -#define MASK20 ((1 << 20) - 1) -#define MASK19 ((1 << 19) - 1) - -struct unaligned_uint32 -{ - grub_uint32_t val; -} __attribute__ ((packed)); - -static void -add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value) -{ - struct unaligned_uint32 *p; - switch (addr & 3) - { - case 0: - p = (struct unaligned_uint32 *) ((addr & ~3ULL) + 2); - p->val = ((((((p->val >> 2) & MASK20) + value) & MASK20) << 2) - | (p->val & ~(MASK20 << 2))); - break; - case 1: - p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & ~3ULL) + 7); - p->val = ((((((p->val >> 3) & MASK20) + value) & MASK20) << 3) - | (p->val & ~(MASK20 << 3))); - break; - case 2: - p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & ~3ULL) + 12); - p->val = ((((((p->val >> 4) & MASK20) + value) & MASK20) << 4) - | (p->val & ~(MASK20 << 4))); - break; - } -} - -#define MASKF21 ( ((1 << 23) - 1) & ~((1 << 7) | (1 << 8)) ) - -static grub_uint32_t -add_value_to_slot_21_real (grub_uint32_t a, grub_uint32_t value) -{ - grub_uint32_t high, mid, low, c; - low = (a & 0x00007f); - mid = (a & 0x7fc000) >> 7; - high = (a & 0x003e00) << 7; - c = (low | mid | high) + value; - return (c & 0x7f) | ((c << 7) & 0x7fc000) | ((c >> 7) & 0x0003e00); //0x003e00 -} - -static void -add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value) -{ - struct unaligned_uint32 *p; - switch (addr & 3) - { - case 0: - p = (struct unaligned_uint32 *) ((addr & ~3ULL) + 2); - p->val = ((add_value_to_slot_21_real (((p->val >> 2) & MASKF21), value) & MASKF21) << 2) | (p->val & ~(MASKF21 << 2)); - break; - case 1: - p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & ~3ULL) + 7); - p->val = ((add_value_to_slot_21_real (((p->val >> 3) & MASKF21), value) & MASKF21) << 3) | (p->val & ~(MASKF21 << 3)); - break; - case 2: - p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & ~3ULL) + 12); - p->val = ((add_value_to_slot_21_real (((p->val >> 4) & MASKF21), value) & MASKF21) << 4) | (p->val & ~(MASKF21 << 4)); - break; - } -} - -static const grub_uint8_t nopm[5] = - { - /* [MLX] nop.m 0x0 */ - 0x05, 0x00, 0x00, 0x00, 0x01 - }; - -static const grub_uint8_t jump[0x20] = - { - /* ld8 r16=[r15],8 */ - 0x02, 0x80, 0x20, 0x1e, 0x18, 0x14, - /* mov r14=r1;; */ - 0xe0, 0x00, 0x04, 0x00, 0x42, 0x00, - /* nop.i 0x0 */ - 0x00, 0x00, 0x04, 0x00, - /* ld8 r1=[r15] */ - 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, - /* mov b6=r16 */ - 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, - /* br.few b6;; */ - 0x60, 0x00, 0x80, 0x00 - }; - -struct ia64_trampoline -{ - /* nop.m */ - grub_uint8_t nop[5]; - /* movl r15 = addr*/ - grub_uint8_t addr_hi[6]; - grub_uint8_t e0; - grub_uint8_t addr_lo[4]; - grub_uint8_t jump[0x20]; -}; - -static void -make_trampoline (struct ia64_trampoline *tr, grub_uint64_t addr) -{ - COMPILE_TIME_ASSERT (sizeof (struct ia64_trampoline) - == GRUB_IA64_DL_TRAMP_SIZE); - grub_memcpy (tr->nop, nopm, sizeof (tr->nop)); - tr->addr_hi[0] = ((addr & 0xc00000) >> 16); - tr->addr_hi[1] = (addr >> 24) & 0xff; - tr->addr_hi[2] = (addr >> 32) & 0xff; - tr->addr_hi[3] = (addr >> 40) & 0xff; - tr->addr_hi[4] = (addr >> 48) & 0xff; - tr->addr_hi[5] = (addr >> 56) & 0xff; - tr->e0 = 0xe0; - tr->addr_lo[0] = ((addr & 0x000f) << 4) | 0x01; - tr->addr_lo[1] = (((addr & 0x0070) >> 4) | ((addr & 0x070000) >> 11) - | ((addr & 0x200000) >> 17)); - tr->addr_lo[2] = ((addr & 0x1f80) >> 5) | ((addr & 0x180000) >> 19); - tr->addr_lo[3] = ((addr & 0xe000) >> 13) | 0x60; - grub_memcpy (tr->jump, jump, sizeof (tr->jump)); -} - /* Relocate symbols. */ grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) @@ -170,7 +53,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) Elf_Word entsize; unsigned i; grub_uint64_t *gp, *gpptr; - struct ia64_trampoline *tr; + struct grub_ia64_trampoline *tr; gp = (grub_uint64_t *) mod->base; gpptr = (grub_uint64_t *) mod->got; @@ -230,13 +113,13 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) case R_IA64_PCREL21B: { grub_uint64_t noff; - make_trampoline (tr, value); + grub_ia64_make_trampoline (tr, value); noff = ((char *) tr - (char *) (addr & ~3)) >> 4; - tr++; + tr = (struct grub_ia64_trampoline *) ((char *) tr + GRUB_IA64_DL_TRAMP_SIZE); if (noff & ~MASK19) return grub_error (GRUB_ERR_BAD_OS, "trampoline offset too big (%lx)", noff); - add_value_to_slot_20b (addr, noff); + grub_ia64_add_value_to_slot_20b (addr, noff); } break; case R_IA64_SEGREL64LSB: @@ -250,7 +133,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) *(grub_uint64_t *) addr += value - addr; break; case R_IA64_GPREL22: - add_value_to_slot_21 (addr, value - (grub_addr_t) gp); + grub_ia64_add_value_to_slot_21 (addr, value - (grub_addr_t) gp); break; case R_IA64_LTOFF22X: @@ -259,7 +142,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) value = *(grub_uint64_t *) sym->st_value + rel->r_addend; case R_IA64_LTOFF_FPTR22: *gpptr = value; - add_value_to_slot_21 (addr, (grub_addr_t) gpptr - (grub_addr_t) gp); + grub_ia64_add_value_to_slot_21 (addr, (grub_addr_t) gpptr - (grub_addr_t) gp); gpptr++; break; diff --git a/grub-core/kern/ia64/dl_helper.c b/grub-core/kern/ia64/dl_helper.c index 9394e32e2..e2209ca0a 100644 --- a/grub-core/kern/ia64/dl_helper.c +++ b/grub-core/kern/ia64/dl_helper.c @@ -22,9 +22,154 @@ #include #include #include +#include +#include #pragma GCC diagnostic ignored "-Wcast-align" +#define MASK20 ((1 << 20) - 1) +#define MASK3 (~(grub_addr_t) 3) + +void +grub_ia64_add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value) +{ + grub_uint32_t val; + switch (addr & 3) + { + case 0: + val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *) + (addr & MASK3) + 2))); + val = (((((val & MASK20) + value) & MASK20) << 2) + | (val & ~(MASK20 << 2))); + grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 2), + grub_cpu_to_le32 (val)); + break; + case 1: + val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *) + (addr & MASK3) + 7))); + val = ((((((val >> 3) & MASK20) + value) & MASK20) << 3) + | (val & ~(MASK20 << 3))); + grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 7), + grub_cpu_to_le32 (val)); + break; + case 2: + val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *) + (addr & MASK3) + 12))); + val = ((((((val >> 4) & MASK20) + value) & MASK20) << 4) + | (val & ~(MASK20 << 4))); + grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 12), + grub_cpu_to_le32 (val)); + break; + } +} + +#define MASKF21 ( ((1 << 23) - 1) & ~((1 << 7) | (1 << 8)) ) + +static grub_uint32_t +add_value_to_slot_21_real (grub_uint32_t a, grub_uint32_t value) +{ + grub_uint32_t high, mid, low, c; + low = (a & 0x00007f); + mid = (a & 0x7fc000) >> 7; + high = (a & 0x003e00) << 7; + c = (low | mid | high) + value; + return (c & 0x7f) | ((c << 7) & 0x7fc000) | ((c >> 7) & 0x0003e00); //0x003e00 +} + +void +grub_ia64_add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value) +{ + grub_uint32_t val; + switch (addr & 3) + { + case 0: + val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *) + (addr & MASK3) + 2))); + val = ((add_value_to_slot_21_real (((val >> 2) & MASKF21), value) + & MASKF21) << 2) | (val & ~(MASKF21 << 2)); + grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 2), + grub_cpu_to_le32 (val)); + break; + case 1: + val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *) + (addr & MASK3) + 7))); + val = ((add_value_to_slot_21_real (((val >> 3) & MASKF21), value) + & MASKF21) << 3) | (val & ~(MASKF21 << 3)); + grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 7), + grub_cpu_to_le32 (val)); + break; + case 2: + val = grub_le_to_cpu32 (grub_get_unaligned32 (((grub_uint8_t *) + (addr & MASK3) + 12))); + val = ((add_value_to_slot_21_real (((val >> 4) & MASKF21), value) + & MASKF21) << 4) | (val & ~(MASKF21 << 4)); + grub_set_unaligned32 (((grub_uint8_t *) (addr & MASK3) + 12), + grub_cpu_to_le32 (val)); + break; + } +} + +static const grub_uint8_t nopm[5] = + { + /* [MLX] nop.m 0x0 */ + 0x05, 0x00, 0x00, 0x00, 0x01 + }; + +#ifdef GRUB_UTIL +static grub_uint8_t jump[0x20] = + { + /* [MMI] add r15=r15,r1;; */ + 0x0b, 0x78, 0x3c, 0x02, 0x00, 0x20, + /* ld8 r16=[r15],8 */ + 0x00, 0x41, 0x3c, 0x30, 0x28, 0xc0, + /* mov r14=r1;; */ + 0x01, 0x08, 0x00, 0x84, + /* [MIB] ld8 r1=[r15] */ + 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, + /* mov b6=r16 */ + 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, + /* br.few b6;; */ + 0x60, 0x00, 0x80, 0x00 + }; +#else +static const grub_uint8_t jump[0x20] = + { + /* ld8 r16=[r15],8 */ + 0x02, 0x80, 0x20, 0x1e, 0x18, 0x14, + /* mov r14=r1;; */ + 0xe0, 0x00, 0x04, 0x00, 0x42, 0x00, + /* nop.i 0x0 */ + 0x00, 0x00, 0x04, 0x00, + /* ld8 r1=[r15] */ + 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, + /* mov b6=r16 */ + 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, + /* br.few b6;; */ + 0x60, 0x00, 0x80, 0x00 + }; +#endif + +void +grub_ia64_make_trampoline (struct grub_ia64_trampoline *tr, grub_uint64_t addr) +{ + COMPILE_TIME_ASSERT (sizeof (struct grub_ia64_trampoline) + == GRUB_IA64_DL_TRAMP_SIZE); + grub_memcpy (tr->nop, nopm, sizeof (tr->nop)); + tr->addr_hi[0] = ((addr & 0xc00000) >> 16); + tr->addr_hi[1] = (addr >> 24) & 0xff; + tr->addr_hi[2] = (addr >> 32) & 0xff; + tr->addr_hi[3] = (addr >> 40) & 0xff; + tr->addr_hi[4] = (addr >> 48) & 0xff; + tr->addr_hi[5] = (addr >> 56) & 0xff; + tr->e0 = 0xe0; + tr->addr_lo[0] = ((addr & 0x000f) << 4) | 0x01; + tr->addr_lo[1] = (((addr & 0x0070) >> 4) | ((addr & 0x070000) >> 11) + | ((addr & 0x200000) >> 17)); + tr->addr_lo[2] = ((addr & 0x1f80) >> 5) | ((addr & 0x180000) >> 19); + tr->addr_lo[3] = ((addr & 0xe000) >> 13) | 0x60; + grub_memcpy (tr->jump, jump, sizeof (tr->jump)); +} + void grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp, grub_size_t *got) @@ -35,26 +180,26 @@ grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp, unsigned i; /* Find a symbol table. */ - for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff)); + for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu64 (e->e_shoff)); i < grub_le_to_cpu16 (e->e_shnum); i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize))) - if (grub_le_to_cpu32 (s->sh_type) == SHT_SYMTAB) + if (s->sh_type == grub_cpu_to_le32_compile_time (SHT_SYMTAB)) break; if (i == grub_le_to_cpu16 (e->e_shnum)) return; - for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu32 (e->e_shoff)); + for (i = 0, s = (Elf64_Shdr *) ((char *) e + grub_le_to_cpu64 (e->e_shoff)); i < grub_le_to_cpu16 (e->e_shnum); i++, s = (Elf64_Shdr *) ((char *) s + grub_le_to_cpu16 (e->e_shentsize))) - if (grub_le_to_cpu32 (s->sh_type) == SHT_RELA) + if (s->sh_type == grub_cpu_to_le32_compile_time (SHT_RELA)) { Elf64_Rela *rel, *max; - for (rel = (Elf64_Rela *) ((char *) e + grub_le_to_cpu32 (s->sh_offset)), - max = rel + grub_le_to_cpu32 (s->sh_size) / grub_le_to_cpu16 (s->sh_entsize); + for (rel = (Elf64_Rela *) ((char *) e + grub_le_to_cpu64 (s->sh_offset)), + max = rel + grub_le_to_cpu64 (s->sh_size) / grub_le_to_cpu64 (s->sh_entsize); rel < max; rel++) - switch (ELF64_R_TYPE (grub_le_to_cpu32 (rel->r_info))) + switch (ELF64_R_TYPE (grub_le_to_cpu64 (rel->r_info))) { case R_IA64_PCREL21B: cntt++; diff --git a/include/grub/ia64/reloc.h b/include/grub/ia64/reloc.h new file mode 100644 index 000000000..4c02ab2e6 --- /dev/null +++ b/include/grub/ia64/reloc.h @@ -0,0 +1,42 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_IA64_RELOC_H +#define GRUB_IA64_RELOC_H 1 + +struct grub_ia64_trampoline; + +void +grub_ia64_add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value); +void +grub_ia64_add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value); +void +grub_ia64_make_trampoline (struct grub_ia64_trampoline *tr, grub_uint64_t addr); + +struct grub_ia64_trampoline +{ + /* nop.m */ + grub_uint8_t nop[5]; + /* movl r15 = addr*/ + grub_uint8_t addr_hi[6]; + grub_uint8_t e0; + grub_uint8_t addr_lo[4]; + grub_uint8_t jump[0x20]; +}; + +#endif diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index ecea5d4f1..dce2c295d 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -40,6 +40,7 @@ #include #include #include +#include #define _GNU_SOURCE 1 #include @@ -1201,10 +1202,10 @@ generate_image (const char *dir, const char *prefix, o->subsystem = grub_host_to_target16 (GRUB_PE32_SUBSYSTEM_EFI_APPLICATION); /* Do these really matter? */ - o->stack_reserve_size = grub_host_to_target32 (0x10000); - o->stack_commit_size = grub_host_to_target32 (0x10000); - o->heap_reserve_size = grub_host_to_target32 (0x10000); - o->heap_commit_size = grub_host_to_target32 (0x10000); + o->stack_reserve_size = grub_host_to_target64 (0x10000); + o->stack_commit_size = grub_host_to_target64 (0x10000); + o->heap_reserve_size = grub_host_to_target64 (0x10000); + o->heap_commit_size = grub_host_to_target64 (0x10000); o->num_data_directories = grub_host_to_target32 (GRUB_PE32_NUM_DATA_DIRECTORIES); diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c index 476d05eeb..b6b263d46 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -117,7 +117,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, if (image_target->elf_target == EM_IA_64 && ELF_ST_TYPE (sym->st_info) == STT_FUNC) { - *jptr = sym->st_value; + *jptr = grub_host_to_target64 (sym->st_value); sym->st_value = (char *) jptr - (char *) jumpers + jumpers_addr; jptr++; *jptr = 0; @@ -143,8 +143,8 @@ SUFFIX (get_symbol_address) (Elf_Ehdr *e, Elf_Shdr *s, Elf_Word i, Elf_Sym *sym; sym = (Elf_Sym *) ((char *) e - + grub_target_to_host32 (s->sh_offset) - + i * grub_target_to_host32 (s->sh_entsize)); + + grub_target_to_host (s->sh_offset) + + i * grub_target_to_host (s->sh_entsize)); return sym->st_value; } @@ -153,7 +153,7 @@ static Elf_Addr * SUFFIX (get_target_address) (Elf_Ehdr *e, Elf_Shdr *s, Elf_Addr offset, struct image_target_desc *image_target) { - return (Elf_Addr *) ((char *) e + grub_target_to_host32 (s->sh_offset) + offset); + return (Elf_Addr *) ((char *) e + grub_target_to_host (s->sh_offset) + offset); } #ifdef MKIMAGE_ELF64 @@ -182,128 +182,6 @@ SUFFIX (count_funcs) (Elf_Ehdr *e, Elf_Shdr *symtab_section, } #endif -#ifdef MKIMAGE_ELF64 -struct unaligned_uint32 -{ - grub_uint32_t val; -} __attribute__ ((packed)); - -#define MASK20 ((1 << 20) - 1) -#define MASK19 ((1 << 19) - 1) -#define MASK3 (~(grub_addr_t) 3) - -static void -add_value_to_slot_20b (grub_addr_t addr, grub_uint32_t value) -{ - struct unaligned_uint32 *p; - switch (addr & 3) - { - case 0: - p = (struct unaligned_uint32 *) ((addr & MASK3) + 2); - p->val = ((((((p->val >> 2) & MASK20) + value) & MASK20) << 2) - | (p->val & ~(MASK20 << 2))); - break; - case 1: - p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & MASK3) + 7); - p->val = ((((((p->val >> 3) & MASK20) + value) & MASK20) << 3) - | (p->val & ~(MASK20 << 3))); - break; - case 2: - p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & MASK3) + 12); - p->val = ((((((p->val >> 4) & MASK20) + value) & MASK20) << 4) - | (p->val & ~(MASK20 << 4))); - break; - } -} - -#define MASKF21 ( ((1 << 23) - 1) & ~((1 << 7) | (1 << 8)) ) - -static grub_uint32_t -add_value_to_slot_21_real (grub_uint32_t a, grub_uint32_t value) -{ - grub_uint32_t high, mid, low, c; - low = (a & 0x00007f); - mid = (a & 0x7fc000) >> 7; - high = (a & 0x003e00) << 7; - c = (low | mid | high) + value; - return (c & 0x7f) | ((c << 7) & 0x7fc000) | ((c >> 7) & 0x0003e00); //0x003e00 -} - -static void -add_value_to_slot_21 (grub_addr_t addr, grub_uint32_t value) -{ - struct unaligned_uint32 *p; - switch (addr & 3) - { - case 0: - p = (struct unaligned_uint32 *) ((addr & MASK3) + 2); - p->val = ((add_value_to_slot_21_real (((p->val >> 2) & MASKF21), value) & MASKF21) << 2) | (p->val & ~(MASKF21 << 2)); - break; - case 1: - p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & MASK3) + 7); - p->val = ((add_value_to_slot_21_real (((p->val >> 3) & MASKF21), value) & MASKF21) << 3) | (p->val & ~(MASKF21 << 3)); - break; - case 2: - p = (struct unaligned_uint32 *) ((grub_uint8_t *) (addr & MASK3) + 12); - p->val = ((add_value_to_slot_21_real (((p->val >> 4) & MASKF21), value) & MASKF21) << 4) | (p->val & ~(MASKF21 << 4)); - break; - } -} - - -struct ia64_kernel_trampoline -{ - /* nop.m */ - grub_uint8_t nop[5]; - /* movl r15 = addr*/ - grub_uint8_t addr_hi[6]; - grub_uint8_t e0; - grub_uint8_t addr_lo[4]; - grub_uint8_t jump[0x20]; -}; - -static grub_uint8_t nopm[5] = - { - /* [MLX] nop.m 0x0 */ - 0x05, 0x00, 0x00, 0x00, 0x01 - }; - -static grub_uint8_t jump[0x20] = - { - /* [MMI] add r15=r15,r1;; */ - 0x0b, 0x78, 0x3c, 0x02, 0x00, 0x20, - /* ld8 r16=[r15],8 */ - 0x00, 0x41, 0x3c, 0x30, 0x28, 0xc0, - /* mov r14=r1;; */ - 0x01, 0x08, 0x00, 0x84, - /* [MIB] ld8 r1=[r15] */ - 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, - /* mov b6=r16 */ - 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, - /* br.few b6;; */ - 0x60, 0x00, 0x80, 0x00 - }; - -static void -make_trampoline (struct ia64_kernel_trampoline *tr, grub_uint64_t addr) -{ - grub_memcpy (tr->nop, nopm, sizeof (tr->nop)); - tr->addr_hi[0] = ((addr & 0xc00000) >> 16); - tr->addr_hi[1] = (addr >> 24) & 0xff; - tr->addr_hi[2] = (addr >> 32) & 0xff; - tr->addr_hi[3] = (addr >> 40) & 0xff; - tr->addr_hi[4] = (addr >> 48) & 0xff; - tr->addr_hi[5] = (addr >> 56) & 0xff; - tr->e0 = 0xe0; - tr->addr_lo[0] = ((addr & 0x000f) << 4) | 0x01; - tr->addr_lo[1] = (((addr & 0x0070) >> 4) | ((addr & 0x070000) >> 11) - | ((addr & 0x200000) >> 17)); - tr->addr_lo[2] = ((addr & 0x1f80) >> 5) | ((addr & 0x180000) >> 19); - tr->addr_lo[3] = ((addr & 0xe000) >> 13) | 0x60; - grub_memcpy (tr->jump, jump, sizeof (tr->jump)); -} -#endif - /* Deal with relocation information. This function relocates addresses within the virtual address space starting from 0. So only relative addresses can be fully resolved. Absolute addresses must be relocated @@ -320,8 +198,9 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, Elf_Half i; Elf_Shdr *s; #ifdef MKIMAGE_ELF64 - struct ia64_kernel_trampoline *tr = (void *) (pe_target + tramp_off); + struct grub_ia64_trampoline *tr = (void *) (pe_target + tramp_off); grub_uint64_t *gpptr = (void *) (pe_target + got_off); +#define MASK19 ((1 << 19) - 1) #endif for (i = 0, s = sections; @@ -352,9 +231,9 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, strtab + grub_target_to_host32 (s->sh_name), strtab + grub_target_to_host32 (target_section->sh_name)); - rtab_size = grub_target_to_host32 (s->sh_size); - r_size = grub_target_to_host32 (s->sh_entsize); - rtab_offset = grub_target_to_host32 (s->sh_offset); + rtab_size = grub_target_to_host (s->sh_size); + r_size = grub_target_to_host (s->sh_entsize); + rtab_offset = grub_target_to_host (s->sh_offset); num_rs = rtab_size / r_size; for (j = 0, r = (Elf_Rela *) ((char *) e + rtab_offset); @@ -375,7 +254,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, ELF_R_SYM (info), image_target); addend = (s->sh_type == grub_target_to_host32 (SHT_RELA)) ? - r->r_addend : 0; + grub_target_to_host (r->r_addend) : 0; switch (image_target->elf_target) { @@ -461,14 +340,14 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, case R_IA64_PCREL21B: { grub_uint64_t noff; - make_trampoline (tr, addend + sym_addr); + grub_ia64_make_trampoline (tr, addend + sym_addr); noff = ((char *) tr - (char *) pe_target - target_section_addr - (offset & ~3)) >> 4; tr++; if (noff & ~MASK19) grub_util_error ("trampoline offset too big (%" PRIxGRUB_UINT64_T ")", noff); - add_value_to_slot_20b ((grub_addr_t) target, noff); + grub_ia64_add_value_to_slot_20b ((grub_addr_t) target, noff); } break; @@ -478,8 +357,8 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, Elf_Sym *sym; sym = (Elf_Sym *) ((char *) e - + grub_target_to_host32 (symtab_section->sh_offset) - + ELF_R_SYM (info) * grub_target_to_host32 (symtab_section->sh_entsize)); + + grub_target_to_host (symtab_section->sh_offset) + + ELF_R_SYM (info) * grub_target_to_host (symtab_section->sh_entsize)); if (ELF_ST_TYPE (sym->st_info) == STT_FUNC) sym_addr = grub_target_to_host64 (*(grub_uint64_t *) (pe_target + sym->st_value @@ -487,15 +366,15 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, } case R_IA64_LTOFF_FPTR22: *gpptr = grub_host_to_target64 (addend + sym_addr); - add_value_to_slot_21 ((grub_addr_t) target, - (char *) gpptr - (char *) pe_target - + image_target->vaddr_offset); + grub_ia64_add_value_to_slot_21 ((grub_addr_t) target, + (char *) gpptr - (char *) pe_target + + image_target->vaddr_offset); gpptr++; break; case R_IA64_GPREL22: - add_value_to_slot_21 ((grub_addr_t) target, - addend + sym_addr); + grub_ia64_add_value_to_slot_21 ((grub_addr_t) target, + addend + sym_addr); break; case R_IA64_PCREL64LSB: *target = grub_host_to_target64 (grub_target_to_host64 (*target) @@ -514,7 +393,8 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, + addend + sym_addr); grub_util_info ("relocating a direct entry to 0x%" PRIxGRUB_UINT64_T " at the offset 0x%llx", - *target, (unsigned long long) offset); + grub_target_to_host64 (*target), + (unsigned long long) offset); break; /* We treat LTOFF22X as LTOFF22, so we can ignore LDXMOV. */ @@ -650,8 +530,8 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out, for (i = 0, s = sections; i < num_sections; i++, s = (Elf_Shdr *) ((char *) s + section_entsize)) - if ((s->sh_type == grub_cpu_to_le32 (SHT_REL)) || - (s->sh_type == grub_cpu_to_le32 (SHT_RELA))) + if ((grub_target_to_host32 (s->sh_type) == SHT_REL) || + (grub_target_to_host32 (s->sh_type) == SHT_RELA)) { Elf_Rel *r; Elf_Word rtab_size, r_size, num_rs; @@ -662,9 +542,9 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out, grub_util_info ("translating the relocation section %s", strtab + grub_le_to_cpu32 (s->sh_name)); - rtab_size = grub_le_to_cpu32 (s->sh_size); - r_size = grub_le_to_cpu32 (s->sh_entsize); - rtab_offset = grub_le_to_cpu32 (s->sh_offset); + rtab_size = grub_target_to_host (s->sh_size); + r_size = grub_target_to_host (s->sh_entsize); + rtab_offset = grub_target_to_host (s->sh_offset); num_rs = rtab_size / r_size; section_address = section_addresses[grub_le_to_cpu32 (s->sh_info)]; @@ -676,8 +556,8 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out, Elf_Addr info; Elf_Addr offset; - offset = grub_le_to_cpu32 (r->r_offset); - info = grub_le_to_cpu32 (r->r_info); + offset = grub_target_to_host (r->r_offset); + info = grub_target_to_host (r->r_info); /* Necessary to relocate only absolute addresses. */ switch (image_target->elf_target) @@ -1027,7 +907,7 @@ SUFFIX (load_image) (const char *kernel_path, grub_size_t *exec_size, *kernel_sz = ALIGN_UP (*kernel_sz, 16); grub_ia64_dl_get_tramp_got_size (e, &tramp, &got); - tramp *= sizeof (struct ia64_kernel_trampoline); + tramp *= sizeof (struct grub_ia64_trampoline); ia64_toff = *kernel_sz; *kernel_sz += ALIGN_UP (tramp, 16); From 9277a306a72a79a8d6cd583c709d228682c9ec91 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Wed, 10 Apr 2013 15:57:40 +0200 Subject: [PATCH 006/187] * autogen.sh: Use "-h", not "-f", to test for existence of symbolic links under grub-core/lib/libgcrypt-grub/mpi. --- ChangeLog | 5 +++++ autogen.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e45ca3523..fd9c082cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-09 Andrey Borzenkov + + * autogen.sh: Use "-h", not "-f", to test for existence of symbolic + links under grub-core/lib/libgcrypt-grub/mpi. + 2013-04-08 Vladimir Serbinenko Fix ia64-efi image generation on big-endian machines. Deduplicate diff --git a/autogen.sh b/autogen.sh index 7a4b5c8be..d47650b9b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,7 +24,7 @@ ln -s ../../../grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10 cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul3.c mpih-lshift.c mpih-rshift.c; do - if [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then + if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then rm grub-core/lib/libgcrypt-grub/mpi/"$x" fi ln -s generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x" From 49818a594a0d4b19761d72bc9fb3e8092fde3b53 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 11 Apr 2013 00:08:27 +0200 Subject: [PATCH 007/187] Fix missing PVs if they don't contain "interesting" LV. Closes #38677. Fix few warining messages and leaks while on it. --- ChangeLog | 5 +++ grub-core/disk/diskfilter.c | 12 +----- grub-core/kern/emu/hostdisk.c | 4 +- util/getroot.c | 79 +++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd9c082cd..602fc9b3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-11 Vladimir Serbinenko + + Fix missing PVs if they don't contain "interesting" LV. Closes #38677. + Fix few warining messages and leaks while on it. + 2013-04-09 Andrey Borzenkov * autogen.sh: Use "-h", not "-f", to test for existence of symbolic diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c index 2ff47e911..c4eb97eb7 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -199,16 +199,8 @@ scan_disk (const char *name, int accept_diskfilter) scan_depth--; return 0; } - if (scan_disk_partition_iter (disk, 0, (void *) name)) - { - scan_depth--; - return 1; - } - if (grub_partition_iterate (disk, scan_disk_partition_iter, (void *) name)) - { - scan_depth--; - return 1; - } + scan_disk_partition_iter (disk, 0, (void *) name); + grub_partition_iterate (disk, scan_disk_partition_iter, (void *) name); grub_disk_close (disk); scan_depth--; return 0; diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c index 62a579bdd..4a5eee094 100644 --- a/grub-core/kern/emu/hostdisk.c +++ b/grub-core/kern/emu/hostdisk.c @@ -431,7 +431,7 @@ grub_util_get_dm_node_linear_info (const char *dev, uint64_t length, start; char *target, *params; char *ptr; - int major, minor; + int major = 0, minor = 0; int first = 1; grub_disk_addr_t partstart = 0; @@ -497,6 +497,8 @@ grub_util_get_dm_node_linear_info (const char *dev, dm_task_destroy (dmt); first = 0; + if (!dm_is_dm_major (major)) + break; } if (first) return 0; diff --git a/util/getroot.c b/util/getroot.c index 654d1e138..f65fd1ec5 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -243,6 +243,13 @@ exec_pipe (char **argv, int *fd) else if (mdadm_pid == 0) { /* Child. */ + + /* Close fd's. */ +#ifdef HAVE_DEVICE_MAPPER + dm_lib_release (); +#endif + grub_diskfilter_fini (); + /* Ensure child is not localised. */ setenv ("LC_ALL", "C", 1); @@ -1315,6 +1322,76 @@ grub_util_get_dev_abstraction (const char *os_dev) return GRUB_DEV_ABSTRACTION_NONE; } +static void +pull_lvm_by_command (const char *os_dev) +{ + char *argv[6]; + int fd; + pid_t pid; + FILE *mdadm; + char *buf = NULL; + size_t len = 0; + char *vgname; + const char *iptr; + char *optr; + + if (strncmp (os_dev, "/dev/mapper/", sizeof ("/dev/mapper/") - 1) + != 0) + return; + + vgname = xmalloc (strlen (os_dev + sizeof ("/dev/mapper/") - 1) + 1); + for (iptr = os_dev + sizeof ("/dev/mapper/") - 1, optr = vgname; *iptr; ) + if (*iptr != '-') + *optr++ = *iptr++; + else if (iptr[0] == '-' && iptr[1] == '-') + { + iptr += 2; + *optr++ = '-'; + } + else + break; + *optr = '\0'; + + /* execvp has inconvenient types, hence the casts. None of these + strings will actually be modified. */ + argv[0] = (char *) "vgs"; + argv[1] = (char *) "--options"; + argv[2] = (char *) "pv_name"; + argv[3] = (char *) "--noheadings"; + argv[4] = vgname; + argv[5] = NULL; + + pid = exec_pipe (argv, &fd); + free (vgname); + + if (!pid) + return; + + /* Parent. Read mdadm's output. */ + mdadm = fdopen (fd, "r"); + if (! mdadm) + { + grub_util_warn (_("Unable to open stream from %s: %s"), + "vgs", strerror (errno)); + goto out; + } + + while (getline (&buf, &len, mdadm) > 0) + { + char *ptr; + for (ptr = buf; ptr < buf + 2 && *ptr == ' '; ptr++); + if (*ptr == '\0') + continue; + *(ptr + strlen (ptr) - 1) = '\0'; + grub_util_pull_device (ptr); + } + +out: + close (fd); + waitpid (pid, NULL, 0); + free (buf); +} + #ifdef __linux__ static char * get_mdadm_uuid (const char *os_dev) @@ -1538,6 +1615,8 @@ grub_util_pull_device (const char *os_dev) break; case GRUB_DEV_ABSTRACTION_LVM: + pull_lvm_by_command (os_dev); + /* Fallthrough in case that lvm-tools are unavailable. */ case GRUB_DEV_ABSTRACTION_LUKS: #ifdef HAVE_DEVICE_MAPPER { From f4b1fa4f3cc27a3b509899863523f20cf4ab43e3 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Thu, 11 Apr 2013 15:11:14 +0200 Subject: [PATCH 008/187] * util/grub.d/30_os-prober.in: Add onstr to entries for visual distinction. --- ChangeLog | 5 +++++ util/grub.d/30_os-prober.in | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 602fc9b3f..bb6d97bf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-11 Andrey Borzenkov + + * util/grub.d/30_os-prober.in: Add onstr to entries for visual + distinction. + 2013-04-11 Vladimir Serbinenko Fix missing PVs if they don't contain "interesting" LV. Closes #38677. diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index e20d8b3d4..5500a3c42 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -195,7 +195,7 @@ EOF if [ "x$is_first_entry" = xtrue ]; then cat << EOF -menuentry '$(echo "$OS" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' { +menuentry '$(echo "$OS $onstr" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' { EOF save_default_entry | grub_add_tab printf '%s\n' "${prepare_boot_cache}" @@ -210,7 +210,7 @@ EOF cat << EOF } EOF - echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {" + echo "submenu '$(gettext_printf "Advanced options for %s" "${OS} $onstr" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {" is_first_entry=false fi title="${LLABEL} $onstr" From 93cd84df63d9916c5047049b5a4b6f950a4a3cde Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 11 Apr 2013 21:09:43 +0200 Subject: [PATCH 009/187] Use ACPI shutdown intests as traditional port was removed. --- ChangeLog | 4 ++ grub-core/tests/boot/kbsd.init-i386.S | 20 +-------- grub-core/tests/boot/kbsd.init-x86_64.S | 19 +-------- grub-core/tests/boot/kernel-8086.S | 21 +--------- grub-core/tests/boot/kernel-i386.S | 21 +--------- grub-core/tests/boot/kfreebsd.init-i386.S | 45 +++++++++------------ grub-core/tests/boot/kfreebsd.init-x86_64.S | 40 ++++++++---------- grub-core/tests/boot/linux.init-i386.S | 20 +-------- grub-core/tests/boot/linux.init-x86_64.S | 20 +-------- grub-core/tests/boot/qemu-shutdown-x86.S | 9 +++++ 10 files changed, 56 insertions(+), 163 deletions(-) create mode 100644 grub-core/tests/boot/qemu-shutdown-x86.S diff --git a/ChangeLog b/ChangeLog index bb6d97bf4..614748afc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-11 Vladimir Serbinenko + + Use ACPI shutdown intests as traditional port was removed. + 2013-04-11 Andrey Borzenkov * util/grub.d/30_os-prober.in: Add onstr to entries for visual diff --git a/grub-core/tests/boot/kbsd.init-i386.S b/grub-core/tests/boot/kbsd.init-i386.S index 7011c79ff..72ddb7c16 100644 --- a/grub-core/tests/boot/kbsd.init-i386.S +++ b/grub-core/tests/boot/kbsd.init-i386.S @@ -37,8 +37,6 @@ #define RESET_HALT 0x8 #define RESET_POWEROFF 0x800 -#define SHUTDOWN_PORT 0x8900 - .section ".init", "ax" .global start,_start start: @@ -72,23 +70,7 @@ _start: int $SYSCALL_INT addl $12, %esp - movw $SHUTDOWN_PORT, %dx - movb $'S', %al - outb %al, %dx - movb $'h', %al - outb %al, %dx - movb $'u', %al - outb %al, %dx - movb $'t', %al - outb %al, %dx - movb $'d', %al - outb %al, %dx - movb $'o', %al - outb %al, %dx - movb $'w', %al - outb %al, %dx - movb $'n', %al - outb %al, %dx +#include "qemu-shutdown-x86.S" /* shutdown. */ movl $SYSCALL_RESET, %eax diff --git a/grub-core/tests/boot/kbsd.init-x86_64.S b/grub-core/tests/boot/kbsd.init-x86_64.S index 81f810e2c..7486bc312 100644 --- a/grub-core/tests/boot/kbsd.init-x86_64.S +++ b/grub-core/tests/boot/kbsd.init-x86_64.S @@ -35,7 +35,6 @@ #define RESET_NOSYNC 0x4 #define RESET_HALT 0x8 #define RESET_POWEROFF 0x800 -#define SHUTDOWN_PORT 0x8900 .section ".init", "ax" .global start,_start @@ -61,23 +60,7 @@ _start: leaq iopl_arg, %rsi syscall - movw $SHUTDOWN_PORT, %dx - movb $'S', %al - outb %al, %dx - movb $'h', %al - outb %al, %dx - movb $'u', %al - outb %al, %dx - movb $'t', %al - outb %al, %dx - movb $'d', %al - outb %al, %dx - movb $'o', %al - outb %al, %dx - movb $'w', %al - outb %al, %dx - movb $'n', %al - outb %al, %dx +#include "qemu-shutdown-x86.S" /* shutdown. */ movq $SYSCALL_RESET, %rax diff --git a/grub-core/tests/boot/kernel-8086.S b/grub-core/tests/boot/kernel-8086.S index 20040dabc..510897c88 100644 --- a/grub-core/tests/boot/kernel-8086.S +++ b/grub-core/tests/boot/kernel-8086.S @@ -1,6 +1,4 @@ -#define SHUTDOWN_PORT 0x8900 - .text .globl _start _start: @@ -8,18 +6,6 @@ base: .code16 jmp cont -portmsg: - xorw %ax, %ax -1: - movb 0(%si), %al - test %ax, %ax - jz 1f - outb %al, %dx - incw %si - jmp 1b -1: - ret - serialmsg: 1: movb 0(%si), %bl @@ -50,17 +36,12 @@ cont: movw %ax, %ds lea message, %si call serialmsg - lea shutdown, %si - movw $SHUTDOWN_PORT, %dx - call portmsg +#include "qemu-shutdown-x86.S" 1: hlt jmp 1b -shutdown: - .ascii "Shutdown" - .byte 0 message: .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n" .byte 0 diff --git a/grub-core/tests/boot/kernel-i386.S b/grub-core/tests/boot/kernel-i386.S index 904b0d4c7..2154d3b2d 100644 --- a/grub-core/tests/boot/kernel-i386.S +++ b/grub-core/tests/boot/kernel-i386.S @@ -5,8 +5,6 @@ #include #endif -#define SHUTDOWN_PORT 0x8900 - .text /* Align 32 bits boundary. */ .align 8 @@ -38,17 +36,6 @@ multiboot_header: #endif .global start -portmsg: - xorl %eax, %eax -1: - movb 0(%esi), %al - test %eax, %eax - jz 1f - outb %al, %dx - incl %esi - jmp 1b -1: - ret serialmsg: 1: @@ -73,17 +60,13 @@ serialmsg: _start: lea message, %esi call serialmsg - lea shutdown, %esi - movw $SHUTDOWN_PORT, %dx - call portmsg + +#include "qemu-shutdown-x86.S" 1: hlt jmp 1b -shutdown: - .ascii "Shutdown" - .byte 0 message: .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n" .byte 0 diff --git a/grub-core/tests/boot/kfreebsd.init-i386.S b/grub-core/tests/boot/kfreebsd.init-i386.S index 12c94a036..a4481520a 100644 --- a/grub-core/tests/boot/kfreebsd.init-i386.S +++ b/grub-core/tests/boot/kfreebsd.init-i386.S @@ -24,13 +24,12 @@ #define SYSCALL_FSYNC 95 #define SYSCALL_ARCH 165 #define SYSCALL_EXIT 1 -#define SYSCALL_ARCH_IOPL 4 +#define SYSCALL_ARCH_IOPERM 4 #define SYSCALL_INT 0x80 #define RESET_NOSYNC 0x4 #define RESET_HALT 0x8 #define RESET_POWEROFF 0x4000 -#define SHUTDOWN_PORT 0x8900 .section ".init", "ax" .global start,_start @@ -64,31 +63,23 @@ _start: int $SYSCALL_INT addl $8, %esp - /* IOPL. */ + /* IOPERM. */ movl $SYSCALL_ARCH, %eax - pushl $iopl_arg - pushl $SYSCALL_ARCH_IOPL + pushl $iopl_arg1 + pushl $SYSCALL_ARCH_IOPERM pushl $0 int $SYSCALL_INT addl $12, %esp - - movw $SHUTDOWN_PORT, %dx - movb $'S', %al - outb %al, %dx - movb $'h', %al - outb %al, %dx - movb $'u', %al - outb %al, %dx - movb $'t', %al - outb %al, %dx - movb $'d', %al - outb %al, %dx - movb $'o', %al - outb %al, %dx - movb $'w', %al - outb %al, %dx - movb $'n', %al - outb %al, %dx + + /* IOPERM. */ + movl $SYSCALL_ARCH, %eax + pushl $iopl_arg2 + pushl $SYSCALL_ARCH_IOPERM + pushl $0 + int $SYSCALL_INT + addl $12, %esp + +#include "qemu-shutdown-x86.S" /* shutdown. */ movl $SYSCALL_RESET, %eax @@ -108,7 +99,11 @@ device: message: .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n" messageend: -iopl_arg: - .long SHUTDOWN_PORT +ioperm_arg1: + .long 0xcf8 + .long 8 .long 1 +ioperm_arg2: + .long 0x1000 + .long 8 .long 1 diff --git a/grub-core/tests/boot/kfreebsd.init-x86_64.S b/grub-core/tests/boot/kfreebsd.init-x86_64.S index 0a9ff511e..de7bab6ce 100644 --- a/grub-core/tests/boot/kfreebsd.init-x86_64.S +++ b/grub-core/tests/boot/kfreebsd.init-x86_64.S @@ -23,13 +23,12 @@ #define SYSCALL_WRITE 4 #define SYSCALL_RESET 55 #define SYSCALL_EXIT 1 -#define SYSCALL_ARCH_IOPL 4 +#define SYSCALL_ARCH_IOPERM 4 #define SYSCALL_FSYNC 95 #define RESET_NOSYNC 0x4 #define RESET_HALT 0x8 #define RESET_POWEROFF 0x4000 -#define SHUTDOWN_PORT 0x8900 .section ".init", "ax" .global start,_start @@ -53,29 +52,18 @@ _start: movq $SYSCALL_FSYNC, %rax syscall - /* IOPL. */ + /* IOPERM. */ movq $SYSCALL_ARCH, %rax - movq $SYSCALL_ARCH_IOPL, %rdi - leaq iopl_arg, %rsi + movq $SYSCALL_ARCH_IOPERM, %rdi + leaq ioperm_arg1, %rsi syscall - movw $SHUTDOWN_PORT, %dx - movb $'S', %al - outb %al, %dx - movb $'h', %al - outb %al, %dx - movb $'u', %al - outb %al, %dx - movb $'t', %al - outb %al, %dx - movb $'d', %al - outb %al, %dx - movb $'o', %al - outb %al, %dx - movb $'w', %al - outb %al, %dx - movb $'n', %al - outb %al, %dx + movq $SYSCALL_ARCH, %rax + movq $SYSCALL_ARCH_IOPERM, %rdi + leaq ioperm_arg2, %rsi + syscall + +#include "qemu-shutdown-x86.S" /* shutdown. */ movq $SYSCALL_RESET, %rax @@ -92,7 +80,11 @@ device: message: .ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n" messageend: -iopl_arg: - .long SHUTDOWN_PORT +ioperm_arg1: + .long 0xcf8 + .long 8 .long 1 +ioperm_arg2: + .long 0x1000 + .long 8 .long 1 diff --git a/grub-core/tests/boot/linux.init-i386.S b/grub-core/tests/boot/linux.init-i386.S index 5b0088e00..c0983ac0a 100644 --- a/grub-core/tests/boot/linux.init-i386.S +++ b/grub-core/tests/boot/linux.init-i386.S @@ -27,8 +27,6 @@ #define SHUTDOWN_MAGIC2 0x28121969 #define SHUTDOWN_MAGIC3 0x4321fedc -#define SHUTDOWN_PORT 0x8900 - .text .global start, _start _start: @@ -44,23 +42,7 @@ start: movl $3, %ebx int $SYSCALL_INT - movw $SHUTDOWN_PORT, %dx - movb $'S', %al - outb %al, %dx - movb $'h', %al - outb %al, %dx - movb $'u', %al - outb %al, %dx - movb $'t', %al - outb %al, %dx - movb $'d', %al - outb %al, %dx - movb $'o', %al - outb %al, %dx - movb $'w', %al - outb %al, %dx - movb $'n', %al - outb %al, %dx +#include "qemu-shutdown-x86.S" /* shutdown. */ movl $SYSCALL_RESET, %eax diff --git a/grub-core/tests/boot/linux.init-x86_64.S b/grub-core/tests/boot/linux.init-x86_64.S index fc32dfd91..90bdcc356 100644 --- a/grub-core/tests/boot/linux.init-x86_64.S +++ b/grub-core/tests/boot/linux.init-x86_64.S @@ -26,8 +26,6 @@ #define SHUTDOWN_MAGIC2 0x28121969 #define SHUTDOWN_MAGIC3 0x4321fedc -#define SHUTDOWN_PORT 0x8900 - .text .global start, _start _start: @@ -43,23 +41,7 @@ start: movq $3, %rdi syscall - movw $SHUTDOWN_PORT, %dx - movb $'S', %al - outb %al, %dx - movb $'h', %al - outb %al, %dx - movb $'u', %al - outb %al, %dx - movb $'t', %al - outb %al, %dx - movb $'d', %al - outb %al, %dx - movb $'o', %al - outb %al, %dx - movb $'w', %al - outb %al, %dx - movb $'n', %al - outb %al, %dx +#include "qemu-shutdown-x86.S" /* shutdown. */ movq $SYSCALL_RESET, %rax diff --git a/grub-core/tests/boot/qemu-shutdown-x86.S b/grub-core/tests/boot/qemu-shutdown-x86.S new file mode 100644 index 000000000..8f794fc4b --- /dev/null +++ b/grub-core/tests/boot/qemu-shutdown-x86.S @@ -0,0 +1,9 @@ + movl $0x80000b40, %eax + movw $0xcf8, %dx + outl %eax, %dx + movl $0x1001, %eax + movw $0xcfc, %dx + outl %eax, %dx + movw $0x2000, %ax + movw $0x1004, %dx + outw %ax, %dx From 053cfcddf13562161464e33e4b5572210adb281a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 11 Apr 2013 21:12:46 +0200 Subject: [PATCH 010/187] Import new gnulib. --- ChangeLog | 4 + build-aux/arg-nonnull.h | 26 - build-aux/c++defs.h | 271 ------- build-aux/config.rpath | 228 ++++-- build-aux/warn-on-use.h | 109 --- config.h.in | 2 + grub-core/Makefile.core.def | 2 +- grub-core/gnulib-fix-null-deref.diff | 13 + grub-core/gnulib-fix-width.diff | 231 ++++++ grub-core/gnulib-no-abort.diff | 30 + grub-core/gnulib-no-gets.diff | 10 + grub-core/gnulib/Makefile.am | 1020 ++++++++++++++++++-------- grub-core/gnulib/alloca.c | 31 +- grub-core/gnulib/alloca.in.h | 15 +- grub-core/gnulib/argp-ba.c | 8 +- grub-core/gnulib/argp-eexst.c | 2 +- grub-core/gnulib/argp-fmtstream.c | 73 +- grub-core/gnulib/argp-fmtstream.h | 34 +- grub-core/gnulib/argp-fs-xinl.c | 8 +- grub-core/gnulib/argp-help.c | 71 +- grub-core/gnulib/argp-namefrob.h | 28 +- grub-core/gnulib/argp-parse.c | 29 +- grub-core/gnulib/argp-pin.c | 3 +- grub-core/gnulib/argp-pv.c | 4 +- grub-core/gnulib/argp-pvh.c | 2 +- grub-core/gnulib/argp-xinl.c | 8 +- grub-core/gnulib/argp.h | 71 +- grub-core/gnulib/asnprintf.c | 5 +- grub-core/gnulib/basename-lgpl.c | 2 +- grub-core/gnulib/btowc.c | 2 +- grub-core/gnulib/config.charset | 7 +- grub-core/gnulib/dirname-lgpl.c | 8 +- grub-core/gnulib/dirname.h | 38 +- grub-core/gnulib/dosname.h | 53 ++ grub-core/gnulib/errno.in.h | 195 ++++- grub-core/gnulib/error.c | 27 +- grub-core/gnulib/error.h | 24 +- grub-core/gnulib/float+.h | 11 +- grub-core/gnulib/float.c | 33 + grub-core/gnulib/float.in.h | 138 +++- grub-core/gnulib/fnmatch.c | 16 +- grub-core/gnulib/fnmatch.in.h | 19 +- grub-core/gnulib/fnmatch_loop.c | 28 +- grub-core/gnulib/getdelim.c | 12 +- grub-core/gnulib/getline.c | 6 +- grub-core/gnulib/getopt.c | 159 ++-- grub-core/gnulib/getopt.in.h | 70 +- grub-core/gnulib/getopt1.c | 8 +- grub-core/gnulib/getopt_int.h | 18 +- grub-core/gnulib/gettext.h | 22 +- grub-core/gnulib/intprops.h | 316 +++++++- grub-core/gnulib/itold.c | 28 + grub-core/gnulib/langinfo.in.h | 19 +- grub-core/gnulib/localcharset.c | 45 +- grub-core/gnulib/localcharset.h | 5 +- grub-core/gnulib/locale.in.h | 216 ++++++ grub-core/gnulib/localeconv.c | 103 +++ grub-core/gnulib/malloc.c | 10 +- grub-core/gnulib/mbrtowc.c | 48 +- grub-core/gnulib/mbsinit.c | 18 +- grub-core/gnulib/mbsrtowcs-impl.h | 122 +++ grub-core/gnulib/mbsrtowcs-state.c | 4 +- grub-core/gnulib/mbsrtowcs.c | 108 +-- grub-core/gnulib/mbswidth.c | 199 +++++ grub-core/gnulib/mbswidth.h | 63 ++ grub-core/gnulib/mbtowc-impl.h | 44 ++ grub-core/gnulib/mbtowc.c | 26 + grub-core/gnulib/memchr.c | 2 +- grub-core/gnulib/mempcpy.c | 5 +- grub-core/gnulib/msvc-inval.c | 129 ++++ grub-core/gnulib/msvc-inval.h | 222 ++++++ grub-core/gnulib/msvc-nothrow.c | 49 ++ grub-core/gnulib/msvc-nothrow.h | 43 ++ grub-core/gnulib/nl_langinfo.c | 7 +- grub-core/gnulib/printf-args.c | 5 +- grub-core/gnulib/printf-args.h | 9 +- grub-core/gnulib/printf-parse.c | 55 +- grub-core/gnulib/printf-parse.h | 19 +- grub-core/gnulib/progname.c | 2 +- grub-core/gnulib/progname.h | 2 +- grub-core/gnulib/rawmemchr.c | 2 +- grub-core/gnulib/realloc.c | 16 +- grub-core/gnulib/ref-add.sin | 5 +- grub-core/gnulib/ref-del.sin | 5 +- grub-core/gnulib/regcomp.c | 348 +++++---- grub-core/gnulib/regex.c | 37 +- grub-core/gnulib/regex.h | 256 +++---- grub-core/gnulib/regex_internal.c | 99 ++- grub-core/gnulib/regex_internal.h | 148 ++-- grub-core/gnulib/regexec.c | 202 +++-- grub-core/gnulib/size_max.h | 5 +- grub-core/gnulib/sleep.c | 11 +- grub-core/gnulib/stdalign.in.h | 90 +++ grub-core/gnulib/stdbool.in.h | 56 +- grub-core/gnulib/stddef.in.h | 20 +- grub-core/gnulib/stdint.in.h | 286 +++++--- grub-core/gnulib/stdio-write.c | 148 ---- grub-core/gnulib/stdio.in.h | 450 +++++++++--- grub-core/gnulib/stdlib.in.h | 329 +++++++-- grub-core/gnulib/strcasecmp.c | 5 +- grub-core/gnulib/strchrnul.c | 2 +- grub-core/gnulib/streq.h | 12 +- grub-core/gnulib/strerror-override.c | 302 ++++++++ grub-core/gnulib/strerror-override.h | 56 ++ grub-core/gnulib/strerror.c | 354 +-------- grub-core/gnulib/string.in.h | 144 +++- grub-core/gnulib/strings.in.h | 47 +- grub-core/gnulib/stripslash.c | 4 +- grub-core/gnulib/strncasecmp.c | 5 +- grub-core/gnulib/strndup.c | 7 +- grub-core/gnulib/strnlen.c | 5 +- grub-core/gnulib/strnlen1.c | 2 +- grub-core/gnulib/strnlen1.h | 5 +- grub-core/gnulib/sys_types.in.h | 51 ++ grub-core/gnulib/sys_wait.in.h | 106 --- grub-core/gnulib/sysexits.in.h | 13 +- grub-core/gnulib/unistd.c | 3 + grub-core/gnulib/unistd.in.h | 508 +++++++++---- grub-core/gnulib/unitypes.in.h | 46 ++ grub-core/gnulib/uniwidth.in.h | 72 ++ grub-core/gnulib/uniwidth/cjk.h | 37 + grub-core/gnulib/uniwidth/width.c | 368 ++++++++++ grub-core/gnulib/vasnprintf.c | 137 ++-- grub-core/gnulib/vasnprintf.h | 19 +- grub-core/gnulib/verify.h | 150 +++- grub-core/gnulib/vsnprintf.c | 5 +- grub-core/gnulib/wchar.in.h | 636 +++++++++++++++- grub-core/gnulib/wcrtomb.c | 2 +- grub-core/gnulib/wctype-h.c | 4 + grub-core/gnulib/wctype.in.h | 374 ++++++---- grub-core/gnulib/wcwidth.c | 50 ++ grub-core/gnulib/xsize.c | 3 + grub-core/gnulib/xsize.h | 22 +- grub-core/kern/emu/argp_common.c | 1 + grub-core/kern/emu/error.c | 2 + grub-core/kern/emu/hostdisk.c | 2 + grub-core/kern/emu/hostfs.c | 3 + grub-core/kern/emu/main.c | 3 + grub-core/lib/posix_wrap/limits.h | 1 + grub-core/lib/posix_wrap/sys/types.h | 2 + include/grub/types.h | 4 + m4/00gnulib.m4 | 2 +- m4/alloca.m4 | 86 ++- m4/argp.m4 | 32 +- m4/asm-underscore.m4 | 48 -- m4/btowc.m4 | 25 +- m4/codeset.m4 | 2 +- m4/configmake.m4 | 50 ++ m4/dirname.m4 | 11 +- m4/dos.m4 | 71 -- m4/double-slash-root.m4 | 2 +- m4/eealloc.m4 | 31 + m4/errno_h.m4 | 28 +- m4/error.m4 | 20 +- m4/exponentd.m4 | 116 +++ m4/extensions.m4 | 54 +- m4/extern-inline.m4 | 65 ++ m4/fcntl-o.m4 | 89 ++- m4/float_h.m4 | 87 ++- m4/fnmatch.m4 | 117 +-- m4/getdelim.m4 | 30 +- m4/getline.m4 | 33 +- m4/getopt.m4 | 386 +++++----- m4/gettext.m4 | 8 +- m4/glibc2.m4 | 7 +- m4/glibc21.m4 | 14 +- m4/gnulib-cache.m4 | 25 +- m4/gnulib-common.m4 | 192 ++++- m4/gnulib-comp.m4 | 329 ++++++--- m4/gnulib-tool.m4 | 2 +- m4/iconv.m4 | 30 +- m4/include_next.m4 | 158 +++- m4/intdiv0.m4 | 8 +- m4/intl.m4 | 14 +- m4/intldir.m4 | 2 +- m4/intlmacosx.m4 | 14 +- m4/intmax.m4 | 2 +- m4/intmax_t.m4 | 2 +- m4/inttypes-pri.m4 | 2 +- m4/inttypes_h.m4 | 2 +- m4/langinfo_h.m4 | 2 +- m4/lcmessage.m4 | 2 +- m4/lib-ld.m4 | 60 +- m4/lib-link.m4 | 6 +- m4/lib-prefix.m4 | 2 +- m4/libunistring-base.m4 | 141 ++++ m4/localcharset.m4 | 2 +- m4/locale-fr.m4 | 161 ++-- m4/locale-ja.m4 | 97 ++- m4/locale-zh.m4 | 80 +- m4/locale_h.m4 | 122 +++ m4/localeconv.m4 | 22 + m4/lock.m4 | 12 +- m4/longlong.m4 | 87 ++- m4/malloc.m4 | 52 +- m4/math_h.m4 | 353 +++++++++ m4/mbrtowc.m4 | 251 ++++++- m4/mbsinit.m4 | 33 +- m4/mbsrtowcs.m4 | 66 +- m4/mbstate_t.m4 | 13 +- m4/mbswidth.m4 | 46 ++ m4/mbtowc.m4 | 19 + m4/memchr.m4 | 31 +- m4/mempcpy.m4 | 7 +- m4/mmap-anon.m4 | 18 +- m4/msvc-inval.m4 | 19 + m4/msvc-nothrow.m4 | 10 + m4/multiarch.m4 | 11 +- m4/nl_langinfo.m4 | 35 +- m4/nls.m4 | 2 +- m4/nocrash.m4 | 130 ++++ m4/off_t.m4 | 18 + m4/po.m4 | 35 +- m4/printf-posix.m4 | 2 +- m4/printf.m4 | 370 ++++++---- m4/progtest.m4 | 2 +- m4/rawmemchr.m4 | 7 +- m4/realloc.m4 | 52 +- m4/regex.m4 | 134 ++-- m4/size_max.m4 | 2 +- m4/sleep.m4 | 33 +- m4/ssize_t.m4 | 2 +- m4/stdalign.m4 | 52 ++ m4/stdbool.m4 | 17 +- m4/stddef_h.m4 | 10 +- m4/stdint.m4 | 40 +- m4/stdint_h.m4 | 2 +- m4/stdio_h.m4 | 95 ++- m4/stdlib_h.m4 | 49 +- m4/strcase.m4 | 15 +- m4/strchrnul.m4 | 37 +- m4/strerror.m4 | 116 +-- m4/string_h.m4 | 20 +- m4/strings_h.m4 | 23 +- m4/strndup.m4 | 20 +- m4/strnlen.m4 | 12 +- m4/sys_socket_h.m4 | 176 +++++ m4/sys_types_h.m4 | 24 + m4/sys_wait_h.m4 | 25 - m4/sysexits.m4 | 5 +- m4/threadlib.m4 | 97 +-- m4/uintmax_t.m4 | 2 +- m4/unistd_h.m4 | 137 ++-- m4/vasnprintf.m4 | 15 +- m4/visibility.m4 | 6 +- m4/vsnprintf.m4 | 20 +- m4/warn-on-use.m4 | 14 +- m4/wchar_h.m4 | 123 +++- m4/wchar_t.m4 | 2 +- m4/wcrtomb.m4 | 44 +- m4/wctype_h.m4 | 192 ++++- m4/wcwidth.m4 | 101 +++ m4/wint_t.m4 | 2 +- m4/xsize.m4 | 5 +- po/POTFILES.in | 39 +- 255 files changed, 12578 insertions(+), 4948 deletions(-) delete mode 100644 build-aux/arg-nonnull.h delete mode 100644 build-aux/c++defs.h delete mode 100644 build-aux/warn-on-use.h create mode 100644 grub-core/gnulib-fix-null-deref.diff create mode 100644 grub-core/gnulib-fix-width.diff create mode 100644 grub-core/gnulib-no-abort.diff create mode 100644 grub-core/gnulib-no-gets.diff create mode 100644 grub-core/gnulib/dosname.h create mode 100644 grub-core/gnulib/float.c create mode 100644 grub-core/gnulib/itold.c create mode 100644 grub-core/gnulib/locale.in.h create mode 100644 grub-core/gnulib/localeconv.c create mode 100644 grub-core/gnulib/mbsrtowcs-impl.h create mode 100644 grub-core/gnulib/mbswidth.c create mode 100644 grub-core/gnulib/mbswidth.h create mode 100644 grub-core/gnulib/mbtowc-impl.h create mode 100644 grub-core/gnulib/mbtowc.c create mode 100644 grub-core/gnulib/msvc-inval.c create mode 100644 grub-core/gnulib/msvc-inval.h create mode 100644 grub-core/gnulib/msvc-nothrow.c create mode 100644 grub-core/gnulib/msvc-nothrow.h create mode 100644 grub-core/gnulib/stdalign.in.h delete mode 100644 grub-core/gnulib/stdio-write.c create mode 100644 grub-core/gnulib/strerror-override.c create mode 100644 grub-core/gnulib/strerror-override.h create mode 100644 grub-core/gnulib/sys_types.in.h delete mode 100644 grub-core/gnulib/sys_wait.in.h create mode 100644 grub-core/gnulib/unistd.c create mode 100644 grub-core/gnulib/unitypes.in.h create mode 100644 grub-core/gnulib/uniwidth.in.h create mode 100644 grub-core/gnulib/uniwidth/cjk.h create mode 100644 grub-core/gnulib/uniwidth/width.c create mode 100644 grub-core/gnulib/wctype-h.c create mode 100644 grub-core/gnulib/wcwidth.c create mode 100644 grub-core/gnulib/xsize.c create mode 100644 grub-core/kern/emu/error.c delete mode 100644 m4/asm-underscore.m4 create mode 100644 m4/configmake.m4 delete mode 100644 m4/dos.m4 create mode 100644 m4/eealloc.m4 create mode 100644 m4/exponentd.m4 create mode 100644 m4/extern-inline.m4 create mode 100644 m4/libunistring-base.m4 create mode 100644 m4/locale_h.m4 create mode 100644 m4/localeconv.m4 create mode 100644 m4/math_h.m4 create mode 100644 m4/mbswidth.m4 create mode 100644 m4/mbtowc.m4 create mode 100644 m4/msvc-inval.m4 create mode 100644 m4/msvc-nothrow.m4 create mode 100644 m4/nocrash.m4 create mode 100644 m4/off_t.m4 create mode 100644 m4/stdalign.m4 create mode 100644 m4/sys_socket_h.m4 create mode 100644 m4/sys_types_h.m4 delete mode 100644 m4/sys_wait_h.m4 create mode 100644 m4/wcwidth.m4 diff --git a/ChangeLog b/ChangeLog index 614748afc..90aacbeec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-11 Vladimir Serbinenko + + Import new gnulib. + 2013-04-11 Vladimir Serbinenko Use ACPI shutdown intests as traditional port was removed. diff --git a/build-aux/arg-nonnull.h b/build-aux/arg-nonnull.h deleted file mode 100644 index 7e3e2db82..000000000 --- a/build-aux/arg-nonnull.h +++ /dev/null @@ -1,26 +0,0 @@ -/* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools - that the values passed as arguments n, ..., m must be non-NULL pointers. - n = 1 stands for the first argument, n = 2 for the second argument etc. */ -#ifndef _GL_ARG_NONNULL -# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 -# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) -# else -# define _GL_ARG_NONNULL(params) -# endif -#endif diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h deleted file mode 100644 index 0c2fad7a2..000000000 --- a/build-aux/c++defs.h +++ /dev/null @@ -1,271 +0,0 @@ -/* C++ compatible function declaration macros. - Copyright (C) 2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef _GL_CXXDEFS_H -#define _GL_CXXDEFS_H - -/* The three most frequent use cases of these macros are: - - * For providing a substitute for a function that is missing on some - platforms, but is declared and works fine on the platforms on which - it exists: - - #if @GNULIB_FOO@ - # if !@HAVE_FOO@ - _GL_FUNCDECL_SYS (foo, ...); - # endif - _GL_CXXALIAS_SYS (foo, ...); - _GL_CXXALIASWARN (foo); - #elif defined GNULIB_POSIXCHECK - ... - #endif - - * For providing a replacement for a function that exists on all platforms, - but is broken/insufficient and needs to be replaced on some platforms: - - #if @GNULIB_FOO@ - # if @REPLACE_FOO@ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef foo - # define foo rpl_foo - # endif - _GL_FUNCDECL_RPL (foo, ...); - _GL_CXXALIAS_RPL (foo, ...); - # else - _GL_CXXALIAS_SYS (foo, ...); - # endif - _GL_CXXALIASWARN (foo); - #elif defined GNULIB_POSIXCHECK - ... - #endif - - * For providing a replacement for a function that exists on some platforms - but is broken/insufficient and needs to be replaced on some of them and - is additionally either missing or undeclared on some other platforms: - - #if @GNULIB_FOO@ - # if @REPLACE_FOO@ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef foo - # define foo rpl_foo - # endif - _GL_FUNCDECL_RPL (foo, ...); - _GL_CXXALIAS_RPL (foo, ...); - # else - # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ - _GL_FUNCDECL_SYS (foo, ...); - # endif - _GL_CXXALIAS_SYS (foo, ...); - # endif - _GL_CXXALIASWARN (foo); - #elif defined GNULIB_POSIXCHECK - ... - #endif -*/ - -/* _GL_EXTERN_C declaration; - performs the declaration with C linkage. */ -#if defined __cplusplus -# define _GL_EXTERN_C extern "C" -#else -# define _GL_EXTERN_C extern -#endif - -/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); - declares a replacement function, named rpl_func, with the given prototype, - consisting of return type, parameters, and attributes. - Example: - _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) - _GL_ARG_NONNULL ((1))); - */ -#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ - _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) -#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ - _GL_EXTERN_C rettype rpl_func parameters_and_attributes - -/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); - declares the system function, named func, with the given prototype, - consisting of return type, parameters, and attributes. - Example: - _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) - _GL_ARG_NONNULL ((1))); - */ -#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ - _GL_EXTERN_C rettype func parameters_and_attributes - -/* _GL_CXXALIAS_RPL (func, rettype, parameters); - declares a C++ alias called GNULIB_NAMESPACE::func - that redirects to rpl_func, if GNULIB_NAMESPACE is defined. - Example: - _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); - */ -#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ - _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - rettype (*const func) parameters = ::rpl_func; \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); - is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); - except that the C function rpl_func may have a slightly different - declaration. A cast is used to silence the "invalid conversion" error - that would otherwise occur. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - rettype (*const func) parameters = \ - reinterpret_cast(::rpl_func); \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIAS_SYS (func, rettype, parameters); - declares a C++ alias called GNULIB_NAMESPACE::func - that redirects to the system provided function func, if GNULIB_NAMESPACE - is defined. - Example: - _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); - */ -#if defined __cplusplus && defined GNULIB_NAMESPACE - /* If we were to write - rettype (*const func) parameters = ::func; - like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls - better (remove an indirection through a 'static' pointer variable), - but then the _GL_CXXALIASWARN macro below would cause a warning not only - for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ -# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = ::func; \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); - is like _GL_CXXALIAS_SYS (func, rettype, parameters); - except that the C function func may have a slightly different declaration. - A cast is used to silence the "invalid conversion" error that would - otherwise occur. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = \ - reinterpret_cast(::func); \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); - is like _GL_CXXALIAS_SYS (func, rettype, parameters); - except that the C function is picked among a set of overloaded functions, - namely the one with rettype2 and parameters2. Two consecutive casts - are used to silence the "cannot find a match" and "invalid conversion" - errors that would otherwise occur. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE - /* The outer cast must be a reinterpret_cast. - The inner cast: When the function is defined as a set of overloaded - functions, it works as a static_cast<>, choosing the designated variant. - When the function is defined as a single variant, it works as a - reinterpret_cast<>. The parenthesized cast syntax works both ways. */ -# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = \ - reinterpret_cast( \ - (rettype2(*)parameters2)(::func)); \ - } \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#else -# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIASWARN (func); - causes a warning to be emitted when ::func is used but not when - GNULIB_NAMESPACE::func is used. func must be defined without overloaded - variants. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIASWARN(func) \ - _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) -# define _GL_CXXALIASWARN_1(func,namespace) \ - _GL_CXXALIASWARN_2 (func, namespace) -/* To work around GCC bug , - we enable the warning only when not optimizing. */ -# if !__OPTIMIZE__ -# define _GL_CXXALIASWARN_2(func,namespace) \ - _GL_WARN_ON_USE (func, \ - "The symbol ::" #func " refers to the system function. " \ - "Use " #namespace "::" #func " instead.") -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -# define _GL_CXXALIASWARN_2(func,namespace) \ - extern __typeof__ (func) func -# else -# define _GL_CXXALIASWARN_2(func,namespace) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -# endif -#else -# define _GL_CXXALIASWARN(func) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); - causes a warning to be emitted when the given overloaded variant of ::func - is used but not when GNULIB_NAMESPACE::func is used. */ -#if defined __cplusplus && defined GNULIB_NAMESPACE -# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ - _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ - GNULIB_NAMESPACE) -# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ - _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) -/* To work around GCC bug , - we enable the warning only when not optimizing. */ -# if !__OPTIMIZE__ -# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ - _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ - "The symbol ::" #func " refers to the system function. " \ - "Use " #namespace "::" #func " instead.") -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ - extern __typeof__ (func) func -# else -# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -# endif -#else -# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ - _GL_EXTERN_C int _gl_cxxalias_dummy -#endif - -#endif /* _GL_CXXDEFS_H */ diff --git a/build-aux/config.rpath b/build-aux/config.rpath index c492a93b6..c38b914d6 100755 --- a/build-aux/config.rpath +++ b/build-aux/config.rpath @@ -2,7 +2,7 @@ # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # -# Copyright 1996-2006 Free Software Foundation, Inc. +# Copyright 1996-2013 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # @@ -25,7 +25,7 @@ # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. -# All known linkers require a `.a' archive for static linking (except MSVC, +# All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so @@ -47,7 +47,7 @@ for cc_temp in $CC""; do done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` -# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. +# Code taken from libtool.m4's _LT_COMPILER_PIC. wl= if test "$GCC" = yes; then @@ -57,14 +57,7 @@ else aix*) wl='-Wl,' ;; - darwin*) - case $cc_basename in - xlc*) - wl='-Wl,' - ;; - esac - ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2* | cegcc*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' @@ -72,24 +65,37 @@ else irix5* | irix6* | nonstopux*) wl='-Wl,' ;; - newsos6) - ;; - linux*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in - icc* | ecc*) + ecc*) wl='-Wl,' ;; - pgcc | pgf77 | pgf90) + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + nagfor*) + wl='-Wl,-Wl,,' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; + xl* | bgxl* | bgf* | mpixl*) + wl='-Wl,' + ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + wl= + ;; *Sun\ C*) wl='-Wl,' ;; @@ -97,22 +103,36 @@ else ;; esac ;; + newsos6) + ;; + *nto* | *qnx*) + ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; - sco3.2v5*) + rdos*) ;; solaris*) - wl='-Wl,' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + wl='-Qoption ld ' + ;; + *) + wl='-Wl,' + ;; + esac ;; sunos4*) wl='-Qoption ld ' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; unicos*) wl='-Wl,' ;; @@ -121,7 +141,7 @@ else esac fi -# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= @@ -129,7 +149,7 @@ hardcode_direct=no hardcode_minus_L=no case "$host_os" in - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. @@ -155,22 +175,21 @@ if test "$with_gnu_ld" = yes; then # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in - aix3* | aix4* | aix5*) + aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we cannot use - # them. - ld_shlibs=no + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then @@ -179,7 +198,7 @@ if test "$with_gnu_ld" = yes; then ld_shlibs=no fi ;; - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' @@ -189,11 +208,13 @@ if test "$with_gnu_ld" = yes; then ld_shlibs=no fi ;; - interix3*) + haiku*) + ;; + interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; - linux*) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else @@ -251,7 +272,7 @@ else hardcode_direct=unsupported fi ;; - aix4* | aix5*) + aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. @@ -261,7 +282,7 @@ else # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes @@ -280,7 +301,7 @@ else strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct=yes + : else # We have old collect2 hardcode_direct=unsupported @@ -316,14 +337,18 @@ else fi ;; amigaos*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac ;; bsdi[45]*) ;; - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is @@ -333,24 +358,15 @@ else ;; darwin* | rhapsody*) hardcode_direct=no - if test "$GCC" = yes ; then + if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then : else - case $cc_basename in - xlc*) - ;; - *) - ld_shlibs=no - ;; - esac + ld_shlibs=no fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; - freebsd1*) - ld_shlibs=no - ;; freebsd2.2*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -359,7 +375,7 @@ else hardcode_direct=yes hardcode_minus_L=yes ;; - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; @@ -411,19 +427,25 @@ else hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; + *nto* | *qnx*) + ;; openbsd*) - hardcode_direct=yes - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi else - case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs=no fi ;; os2*) @@ -471,7 +493,7 @@ else ld_shlibs=yes fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' @@ -487,34 +509,58 @@ else fi # Check dynamic linker characteristics -# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) + library_names_spec='$libname.a' ;; - aix4* | aix5*) + aix[4-9]*) + library_names_spec='$libname$shrext' ;; amigaos*) + case "$host_cpu" in + powerpc*) + library_names_spec='$libname$shrext' ;; + m68k) + library_names_spec='$libname.a' ;; + esac ;; beos*) + library_names_spec='$libname$shrext' ;; bsdi[45]*) + library_names_spec='$libname$shrext' ;; - cygwin* | mingw* | pw32*) + cygwin* | mingw* | pw32* | cegcc*) shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib + library_names_spec='$libname$shrext' ;; dgux*) - ;; - freebsd1*) - ;; - kfreebsd*-gnu) + library_names_spec='$libname$shrext' ;; freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac ;; gnu*) + library_names_spec='$libname$shrext' + ;; + haiku*) + library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in @@ -528,10 +574,13 @@ case "$host_os" in shrext=.sl ;; esac + library_names_spec='$libname$shrext' ;; - interix3*) + interix[3-9]*) + library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= @@ -548,41 +597,62 @@ case "$host_os" in ;; linux*oldld* | linux*aout* | linux*coff*) ;; - linux*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) + library_names_spec='$libname$shrext' ;; knetbsd*-gnu) + library_names_spec='$libname$shrext' ;; netbsd*) + library_names_spec='$libname$shrext' ;; newsos6) + library_names_spec='$libname$shrext' ;; - nto-qnx*) + *nto* | *qnx*) + library_names_spec='$libname$shrext' ;; openbsd*) + library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll + library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) ;; solaris*) + library_names_spec='$libname$shrext' ;; sunos4*) + library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' ;; sysv4*MP*) + library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + tpf*) + library_names_spec='$libname$shrext' ;; uts4*) + library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. */ - -/* _GL_WARN_ON_USE (function, "literal string") issues a declaration - for FUNCTION which will then trigger a compiler warning containing - the text of "literal string" anywhere that function is called, if - supported by the compiler. If the compiler does not support this - feature, the macro expands to an unused extern declaration. - - This macro is useful for marking a function as a potential - portability trap, with the intent that "literal string" include - instructions on the replacement function that should be used - instead. However, one of the reasons that a function is a - portability trap is if it has the wrong signature. Declaring - FUNCTION with a different signature in C is a compilation error, so - this macro must use the same type as any existing declaration so - that programs that avoid the problematic FUNCTION do not fail to - compile merely because they included a header that poisoned the - function. But this implies that _GL_WARN_ON_USE is only safe to - use if FUNCTION is known to already have a declaration. Use of - this macro implies that there must not be any other macro hiding - the declaration of FUNCTION; but undefining FUNCTION first is part - of the poisoning process anyway (although for symbols that are - provided only via a macro, the result is a compilation error rather - than a warning containing "literal string"). Also note that in - C++, it is only safe to use if FUNCTION has no overloads. - - For an example, it is possible to poison 'getline' by: - - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], - [getline]) in configure.ac, which potentially defines - HAVE_RAW_DECL_GETLINE - - adding this code to a header that wraps the system : - #undef getline - #if HAVE_RAW_DECL_GETLINE - _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" - "not universally present; use the gnulib module getline"); - #endif - - It is not possible to directly poison global variables. But it is - possible to write a wrapper accessor function, and poison that - (less common usage, like &environ, will cause a compilation error - rather than issue the nice warning, but the end result of informing - the developer about their portability problem is still achieved): - #if HAVE_RAW_DECL_ENVIRON - static inline char ***rpl_environ (void) { return &environ; } - _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); - # undef environ - # define environ (*rpl_environ ()) - #endif - */ -#ifndef _GL_WARN_ON_USE - -# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) -/* A compiler attribute is available in gcc versions 4.3.0 and later. */ -# define _GL_WARN_ON_USE(function, message) \ -extern __typeof__ (function) function __attribute__ ((__warning__ (message))) -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -/* Verify the existence of the function. */ -# define _GL_WARN_ON_USE(function, message) \ -extern __typeof__ (function) function -# else /* Unsupported. */ -# define _GL_WARN_ON_USE(function, message) \ -_GL_WARN_EXTERN_C int _gl_warn_on_use -# endif -#endif - -/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") - is like _GL_WARN_ON_USE (function, "string"), except that the function is - declared with the given prototype, consisting of return type, parameters, - and attributes. - This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does - not work in this case. */ -#ifndef _GL_WARN_ON_USE_CXX -# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -extern rettype function parameters_and_attributes \ - __attribute__ ((__warning__ (msg))) -# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING -/* Verify the existence of the function. */ -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -extern rettype function parameters_and_attributes -# else /* Unsupported. */ -# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ -_GL_WARN_EXTERN_C int _gl_warn_on_use -# endif -#endif - -/* _GL_WARN_EXTERN_C declaration; - performs the declaration with C linkage. */ -#ifndef _GL_WARN_EXTERN_C -# if defined __cplusplus -# define _GL_WARN_EXTERN_C extern "C" -# else -# define _GL_WARN_EXTERN_C extern -# endif -#endif diff --git a/config.h.in b/config.h.in index 2e1f45909..065db78b8 100644 --- a/config.h.in +++ b/config.h.in @@ -49,4 +49,6 @@ #define RE_ENABLE_I18N 1 +#define __USE_GNU 1 + #endif diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index fece8821e..4c8e947c9 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -194,7 +194,7 @@ kernel = { emu = disk/host.c; emu = gnulib/progname.c; - emu = gnulib/error.c; + emu = kern/emu/error.c; emu = kern/emu/cache_s.S; emu = kern/emu/hostdisk.c; emu = kern/emu/hostfs.c; diff --git a/grub-core/gnulib-fix-null-deref.diff b/grub-core/gnulib-fix-null-deref.diff new file mode 100644 index 000000000..a2fba8c3b --- /dev/null +++ b/grub-core/gnulib-fix-null-deref.diff @@ -0,0 +1,13 @@ +=== modified file 'grub-core/gnulib/argp-parse.c' +--- grub-core/gnulib/argp-parse.c 2010-04-02 22:45:01 +0000 ++++ grub-core/gnulib/argp-parse.c 2011-04-10 13:25:52 +0000 +@@ -935,7 +935,7 @@ + void * + __argp_input (const struct argp *argp, const struct argp_state *state) + { +- if (state) ++ if (state && state->pstate) + { + struct group *group; + struct parser *parser = state->pstate; + diff --git a/grub-core/gnulib-fix-width.diff b/grub-core/gnulib-fix-width.diff new file mode 100644 index 000000000..ae77af6c9 --- /dev/null +++ b/grub-core/gnulib-fix-width.diff @@ -0,0 +1,231 @@ +diff --git a/lib/argp-fmtstream.c b/lib/argp-fmtstream.c +index 7aa317c..02406ff 100644 +--- a/lib/argp-fmtstream.c ++++ b/lib/argp-fmtstream.c +@@ -29,9 +29,11 @@ + #include + #include + #include ++#include + + #include "argp-fmtstream.h" + #include "argp-namefrob.h" ++#include "mbswidth.h" + + #ifndef ARGP_FMTSTREAM_USE_LINEWRAP + +@@ -116,6 +118,51 @@ weak_alias (__argp_fmtstream_free, argp_fmtstream_free) + #endif + #endif + ++ ++/* Return the pointer to the first character that doesn't fit in l columns. */ ++static inline const ptrdiff_t ++add_width (const char *ptr, const char *end, size_t l) ++{ ++ mbstate_t ps; ++ const char *ptr0 = ptr; ++ ++ memset (&ps, 0, sizeof (ps)); ++ ++ while (ptr < end) ++ { ++ wchar_t wc; ++ size_t s, k; ++ ++ s = mbrtowc (&wc, ptr, end - ptr, &ps); ++ if (s == (size_t) -1) ++ break; ++ if (s == (size_t) -2) ++ { ++ if (1 >= l) ++ break; ++ l--; ++ ptr++; ++ continue; ++ } ++ ++ if (wc == '\e' && ptr + 3 < end ++ && ptr[1] == '[' && (ptr[2] == '0' || ptr[2] == '1') ++ && ptr[3] == 'm') ++ { ++ ptr += 4; ++ continue; ++ } ++ ++ k = wcwidth (wc); ++ ++ if (k >= l) ++ break; ++ l -= k; ++ ptr += s; ++ } ++ return ptr - ptr0; ++} ++ + /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the + end of its buffer. This code is mostly from glibc stdio/linewrap.c. */ + void +@@ -168,14 +215,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + + if (!nl) + { ++ size_t display_width = mbsnwidth (buf, fs->p - buf, MBSW_STOP_AT_NUL); + /* The buffer ends in a partial line. */ + +- if (fs->point_col + len < fs->rmargin) ++ if (fs->point_col + display_width < fs->rmargin) + { + /* The remaining buffer text is a partial line and fits + within the maximum line width. Advance point for the + characters to be written and stop scanning. */ +- fs->point_col += len; ++ fs->point_col += display_width; + break; + } + else +@@ -183,14 +231,18 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + the end of the buffer. */ + nl = fs->p; + } +- else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin) +- { +- /* The buffer contains a full line that fits within the maximum +- line width. Reset point and scan the next line. */ +- fs->point_col = 0; +- buf = nl + 1; +- continue; +- } ++ else ++ { ++ size_t display_width = mbsnwidth (buf, nl - buf, MBSW_STOP_AT_NUL); ++ if (display_width < (ssize_t) fs->rmargin) ++ { ++ /* The buffer contains a full line that fits within the maximum ++ line width. Reset point and scan the next line. */ ++ fs->point_col = 0; ++ buf = nl + 1; ++ continue; ++ } ++ } + + /* This line is too long. */ + r = fs->rmargin - 1; +@@ -226,7 +278,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + char *p, *nextline; + int i; + +- p = buf + (r + 1 - fs->point_col); ++ p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); + while (p >= buf && !isblank ((unsigned char) *p)) + --p; + nextline = p + 1; /* This will begin the next line. */ +@@ -244,7 +296,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + { + /* A single word that is greater than the maximum line width. + Oh well. Put it on an overlong line by itself. */ +- p = buf + (r + 1 - fs->point_col); ++ p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); + /* Find the end of the long word. */ + if (p < nl) + do +@@ -278,7 +330,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + && fs->p > nextline) + { + /* The margin needs more blanks than we removed. */ +- if (fs->end - fs->p > fs->wmargin + 1) ++ if (mbsnwidth (fs->p, fs->end - fs->p, MBSW_STOP_AT_NUL) ++ > fs->wmargin + 1) + /* Make some space for them. */ + { + size_t mv = fs->p - nextline; +diff --git a/lib/argp-help.c b/lib/argp-help.c +index 354f1e2..2914f47 100644 +--- a/lib/argp-help.c ++++ b/lib/argp-help.c +@@ -50,6 +50,7 @@ + #include "argp.h" + #include "argp-fmtstream.h" + #include "argp-namefrob.h" ++#include "mbswidth.h" + + #ifndef SIZE_MAX + # define SIZE_MAX ((size_t) -1) +@@ -1452,7 +1453,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, + + /* Manually do line wrapping so that it (probably) won't get wrapped at + any embedded spaces. */ +- space (stream, 1 + nl - cp); ++ space (stream, 1 + mbsnwidth (cp, nl - cp, MBSW_STOP_AT_NUL)); + + __argp_fmtstream_write (stream, cp, nl - cp); + } +diff --git a/lib/mbswidth.c b/lib/mbswidth.c +index 7c2dfce..baa4f27 100644 +--- a/lib/mbswidth.c ++++ b/lib/mbswidth.c +@@ -90,6 +90,9 @@ mbsnwidth (const char *string, size_t nbytes, int flags) + p++; + width++; + break; ++ case '\0': ++ if (flags & MBSW_STOP_AT_NUL) ++ return width; + default: + /* If we have a multibyte sequence, scan it up to its end. */ + { +@@ -168,6 +171,9 @@ mbsnwidth (const char *string, size_t nbytes, int flags) + { + unsigned char c = (unsigned char) *p++; + ++ if (c == 0 && (flags & MBSW_STOP_AT_NUL)) ++ return width; ++ + if (isprint (c)) + { + if (width == INT_MAX) +diff --git a/lib/mbswidth.h b/lib/mbswidth.h +index e9c0b03..d7207c5 100644 +--- a/lib/mbswidth.h ++++ b/lib/mbswidth.h +@@ -45,6 +45,9 @@ extern "C" { + control characters and 1 otherwise. */ + #define MBSW_REJECT_UNPRINTABLE 2 + ++/* If this bit is set \0 is treated as the end of string. ++ Otherwise it's treated as a normal one column width character. */ ++#define MBSW_STOP_AT_NUL 4 + + /* Returns the number of screen columns needed for STRING. */ + #define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */ +diff --git a/modules/argp b/modules/argp +index 125046a..6f14d10 100644 +--- a/modules/argp ++++ b/modules/argp +@@ -40,6 +40,7 @@ stdalign + strerror + memchr + memmove ++mbswidth + + configure.ac: + gl_ARGP +diff --git a/modules/argp-tests b/modules/argp-tests +index 8f92a4d..0463927 100644 +--- a/modules/argp-tests ++++ b/modules/argp-tests +@@ -1,11 +1,13 @@ + Files: + tests/test-argp.c + tests/test-argp-2.sh ++tests/test-argp-2-utf.sh + + Depends-on: + progname + + Makefile.am: + TESTS += test-argp test-argp-2.sh +-check_PROGRAMS += test-argp ++TESTS += test-argp test-argp-2.sh test-argp-2-utf.sh ++check_PROGRAMS += test-argp test-argp-utf8 + test_argp_LDADD = $(LDADD) @LIBINTL@ diff --git a/grub-core/gnulib-no-abort.diff b/grub-core/gnulib-no-abort.diff new file mode 100644 index 000000000..8377338f7 --- /dev/null +++ b/grub-core/gnulib-no-abort.diff @@ -0,0 +1,30 @@ +=== modified file 'grub-core/gnulib/regcomp.c' +--- grub-core/gnulib/regcomp.c 2010-09-20 10:35:33 +0000 ++++ grub-core/gnulib/regcomp.c 2012-03-10 11:31:42 +0000 +@@ -549,13 +549,9 @@ regerror (int errcode, const regex_t *_R + if (BE (errcode < 0 + || errcode >= (int) (sizeof (__re_error_msgid_idx) + / sizeof (__re_error_msgid_idx[0])), 0)) +- /* Only error codes returned by the rest of the code should be passed +- to this routine. If we are given anything else, or if other regex +- code generates an invalid error code, then the program has a bug. +- Dump core so we can fix it. */ +- abort (); +- +- msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); ++ msg = gettext ("unknown regexp error"); ++ else ++ msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); + + msg_size = strlen (msg) + 1; /* Includes the null. */ + +@@ -1119,7 +1119,7 @@ + } + break; + default: +- abort (); ++ break; + } + + if (mb_chars || has_period) + diff --git a/grub-core/gnulib-no-gets.diff b/grub-core/gnulib-no-gets.diff new file mode 100644 index 000000000..1a9487e84 --- /dev/null +++ b/grub-core/gnulib-no-gets.diff @@ -0,0 +1,10 @@ +--- /tmp/x.diff 2013-04-11 16:51:42.777873536 +0200 ++++ grub-core/gnulib/stdio.in.h 2013-04-11 16:51:49.917873298 +0200 +@@ -700,7 +700,6 @@ + removed it. */ + #undef gets + #if HAVE_RAW_DECL_GETS +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + #endif + + diff --git a/grub-core/gnulib/Makefile.am b/grub-core/gnulib/Makefile.am index fb1525f00..3444397fe 100644 --- a/grub-core/gnulib/Makefile.am +++ b/grub-core/gnulib/Makefile.am @@ -1,17 +1,29 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2013 Free Software Foundation, Inc. # -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname regex +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname regex -AUTOMAKE_OPTIONS = 1.5 gnits +AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects SUBDIRS = noinst_HEADERS = @@ -39,12 +51,12 @@ EXTRA_libgnu_a_SOURCES = ## begin gnulib module alloca +libgnu_a_LIBADD += @ALLOCA@ +libgnu_a_DEPENDENCIES += @ALLOCA@ EXTRA_DIST += alloca.c EXTRA_libgnu_a_SOURCES += alloca.c -libgnu_a_LIBADD += @ALLOCA@ -libgnu_a_DEPENDENCIES += @ALLOCA@ ## end gnulib module alloca ## begin gnulib module alloca-opt @@ -53,42 +65,23 @@ BUILT_SOURCES += $(ALLOCA_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -alloca.h: alloca.in.h +if GL_GENERATE_ALLOCA_H +alloca.h: alloca.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/alloca.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +alloca.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += alloca.h alloca.h-t EXTRA_DIST += alloca.in.h ## end gnulib module alloca-opt -## begin gnulib module arg-nonnull - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += arg-nonnull.h -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/arg-nonnull.h, except that it has the copyright header cut off. -arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t - -ARG_NONNULL_H=arg-nonnull.h - -EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h - -## end gnulib module arg-nonnull - ## begin gnulib module argp libgnu_a_SOURCES += argp.h argp-ba.c argp-eexst.c \ @@ -107,47 +100,10 @@ EXTRA_libgnu_a_SOURCES += btowc.c ## end gnulib module btowc -## begin gnulib module c++defs - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += c++defs.h -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/c++defs.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += c++defs.h c++defs.h-t - -CXXDEFS_H=c++defs.h - -EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h - -## end gnulib module c++defs - ## begin gnulib module configmake -# Retrieve values of the variables through 'configure' followed by -# 'make', not directly through 'configure', so that a user who -# sets some of these variables consistently on the 'make' command -# line gets correct results. -# -# One advantage of this approach, compared to the classical -# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS, -# is that it protects against the use of undefined variables. -# If, say, $(libdir) is not set in the Makefile, LIBDIR is not -# defined by this module, and code using LIBDIR gives a -# compilation error. -# -# Another advantage is that 'make' output is shorter. -# -# Listed in the same order as the GNU makefile conventions. +# Listed in the same order as the GNU makefile conventions, and +# provided by autoconf 2.59c+. # The Automake-defined pkg* macros are appended, in the order # listed in the Automake 1.10a+ documentation. configmake.h: Makefile @@ -181,11 +137,7 @@ configmake.h: Makefile echo '#define PKGLIBDIR "$(pkglibdir)"'; \ echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ } | sed '/""/d' > $@-t && \ - if test -f $@ && cmp $@-t $@ > /dev/null; then \ - rm -f $@-t; \ - else \ - rm -f $@; mv $@-t $@; \ - fi + mv -f $@-t $@ BUILT_SOURCES += configmake.h CLEANFILES += configmake.h configmake.h-t @@ -194,24 +146,33 @@ CLEANFILES += configmake.h configmake.h-t ## begin gnulib module dirname-lgpl +libgnu_a_SOURCES += dirname-lgpl.c basename-lgpl.c stripslash.c -EXTRA_DIST += basename-lgpl.c dirname-lgpl.c dirname.h stripslash.c - -EXTRA_libgnu_a_SOURCES += basename-lgpl.c dirname-lgpl.c stripslash.c +EXTRA_DIST += dirname.h ## end gnulib module dirname-lgpl +## begin gnulib module dosname + + +EXTRA_DIST += dosname.h + +## end gnulib module dosname + ## begin gnulib module errno BUILT_SOURCES += $(ERRNO_H) # We need the following in order to create when the system # doesn't have one that is POSIX compliant. -errno.h: errno.in.h +if GL_GENERATE_ERRNO_H +errno.h: errno.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ @@ -222,6 +183,10 @@ errno.h: errno.in.h < $(srcdir)/errno.in.h; \ } > $@-t && \ mv $@-t $@ +else +errno.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += errno.h errno.h-t EXTRA_DIST += errno.in.h @@ -243,18 +208,28 @@ BUILT_SOURCES += $(FLOAT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -float.h: float.in.h +if GL_GENERATE_FLOAT_H +float.h: float.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ + -e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \ < $(srcdir)/float.in.h; \ } > $@-t && \ mv $@-t $@ +else +float.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += float.h float.h-t -EXTRA_DIST += float.in.h +EXTRA_DIST += float.c float.in.h itold.c + +EXTRA_libgnu_a_SOURCES += float.c itold.c ## end gnulib module float @@ -264,13 +239,18 @@ BUILT_SOURCES += $(FNMATCH_H) # We need the following in order to create when the system # doesn't have one that supports the required API. -fnmatch.h: fnmatch.in.h $(ARG_NONNULL_H) +if GL_GENERATE_FNMATCH_H +fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/fnmatch.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +fnmatch.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t EXTRA_DIST += fnmatch.c fnmatch.in.h fnmatch_loop.c @@ -303,12 +283,14 @@ BUILT_SOURCES += $(GETOPT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -getopt.h: getopt.in.h $(ARG_NONNULL_H) +getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/getopt.in.h; \ @@ -364,14 +346,16 @@ BUILT_SOURCES += langinfo.h # We need the following in order to create an empty placeholder for # when the system doesn't have one. -langinfo.h: langinfo.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \ - -e 's|@''GNULIB_NL_LANGINFO''@|$(GNULIB_NL_LANGINFO)|g' \ + -e 's/@''GNULIB_NL_LANGINFO''@/$(GNULIB_NL_LANGINFO)/g' \ -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \ -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \ -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \ @@ -463,6 +447,50 @@ EXTRA_DIST += config.charset ref-add.sin ref-del.sin ## end gnulib module localcharset +## begin gnulib module locale + +BUILT_SOURCES += locale.h + +# We need the following in order to create when the system +# doesn't have one that provides all definitions. +locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ + -e 's/@''GNULIB_LOCALECONV''@/$(GNULIB_LOCALECONV)/g' \ + -e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \ + -e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \ + -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ + -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ + -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \ + -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \ + -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ + -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/locale.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += locale.h locale.h-t + +EXTRA_DIST += locale.in.h + +## end gnulib module locale + +## begin gnulib module localeconv + + +EXTRA_DIST += localeconv.c + +EXTRA_libgnu_a_SOURCES += localeconv.c + +## end gnulib module localeconv + ## begin gnulib module malloc-gnu @@ -502,12 +530,27 @@ EXTRA_libgnu_a_SOURCES += mbsinit.c ## begin gnulib module mbsrtowcs -EXTRA_DIST += mbsrtowcs-state.c mbsrtowcs.c +EXTRA_DIST += mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c EXTRA_libgnu_a_SOURCES += mbsrtowcs-state.c mbsrtowcs.c ## end gnulib module mbsrtowcs +## begin gnulib module mbswidth + +libgnu_a_SOURCES += mbswidth.h mbswidth.c + +## end gnulib module mbswidth + +## begin gnulib module mbtowc + + +EXTRA_DIST += mbtowc-impl.h mbtowc.c + +EXTRA_libgnu_a_SOURCES += mbtowc.c + +## end gnulib module mbtowc + ## begin gnulib module memchr @@ -526,6 +569,24 @@ EXTRA_libgnu_a_SOURCES += mempcpy.c ## end gnulib module mempcpy +## begin gnulib module msvc-inval + + +EXTRA_DIST += msvc-inval.c msvc-inval.h + +EXTRA_libgnu_a_SOURCES += msvc-inval.c + +## end gnulib module msvc-inval + +## begin gnulib module msvc-nothrow + + +EXTRA_DIST += msvc-nothrow.c msvc-nothrow.h + +EXTRA_libgnu_a_SOURCES += msvc-nothrow.c + +## end gnulib module msvc-nothrow + ## begin gnulib module nl_langinfo @@ -583,18 +644,127 @@ EXTRA_libgnu_a_SOURCES += sleep.c ## end gnulib module sleep +## begin gnulib module snippet/_Noreturn + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all Makefile.am that +# need it. This is ensured by the applicability 'all' defined above. + +_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h + +EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h + +## end gnulib module snippet/_Noreturn + +## begin gnulib module snippet/arg-nonnull + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += arg-nonnull.h +# The arg-nonnull.h that gets inserted into generated .h files is the same as +# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut +# off. +arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_ARG_NONNULL/,$$p' \ + < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t + +ARG_NONNULL_H=arg-nonnull.h + +EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h + +## end gnulib module snippet/arg-nonnull + +## begin gnulib module snippet/c++defs + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += c++defs.h +# The c++defs.h that gets inserted into generated .h files is the same as +# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. +c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/_GL_CXXDEFS/,$$p' \ + < $(top_srcdir)/build-aux/snippet/c++defs.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += c++defs.h c++defs.h-t + +CXXDEFS_H=c++defs.h + +EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h + +## end gnulib module snippet/c++defs + +## begin gnulib module snippet/warn-on-use + +BUILT_SOURCES += warn-on-use.h +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut +# off. +warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/snippet/warn-on-use.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t + +WARN_ON_USE_H=warn-on-use.h + +EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h + +## end gnulib module snippet/warn-on-use + +## begin gnulib module stdalign + +BUILT_SOURCES += $(STDALIGN_H) + +# We need the following in order to create when the system +# doesn't have one that works. +if GL_GENERATE_STDALIGN_H +stdalign.h: stdalign.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/stdalign.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stdalign.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stdalign.h stdalign.h-t + +EXTRA_DIST += stdalign.in.h + +## end gnulib module stdalign + ## begin gnulib module stdbool BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create when the system # doesn't have one that works. -stdbool.h: stdbool.in.h +if GL_GENERATE_STDBOOL_H +stdbool.h: stdbool.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdbool.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdbool.h stdbool.h-t EXTRA_DIST += stdbool.in.h @@ -607,17 +777,24 @@ BUILT_SOURCES += $(STDDEF_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stddef.h: stddef.in.h +if GL_GENERATE_STDDEF_H +stddef.h: stddef.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ } > $@-t && \ mv $@-t $@ +else +stddef.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stddef.h stddef.h-t EXTRA_DIST += stddef.in.h @@ -630,17 +807,21 @@ BUILT_SOURCES += $(STDINT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdint.h: stdint.in.h +if GL_GENERATE_STDINT_H +stdint.h: stdint.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ @@ -660,6 +841,10 @@ stdint.h: stdint.in.h < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdint.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdint.h stdint.h-t EXTRA_DIST += stdint.in.h @@ -672,55 +857,71 @@ BUILT_SOURCES += stdio.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ - -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \ - -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ - -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ - -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ - -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \ - -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \ - -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ - -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \ - -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ - -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ - -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ - -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ - -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ - -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \ - -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ - -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ - -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ - -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ - -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \ - -e 's|@''GNULIB_POPEN''@|$(GNULIB_POPEN)|g' \ - -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \ - -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ - -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \ - -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \ - -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \ - -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \ - -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \ - -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \ - -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ - -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \ - -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \ - -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ - -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \ - -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \ - -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \ - -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ - -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ + -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \ + -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \ + -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \ + -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \ + -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \ + -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \ + -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \ + -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \ + -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \ + -e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \ + -e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \ + -e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \ + -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \ + -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \ + -e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \ + -e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \ + -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \ + -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \ + -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \ + -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \ + -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \ + -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \ + -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \ + -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \ + -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \ + -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \ + -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \ + -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \ + -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \ + -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \ + -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \ + -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \ + -e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \ + -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \ + -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \ + -e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \ + -e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \ + -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \ + -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \ + -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \ + -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \ < $(srcdir)/stdio.in.h | \ sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ + -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ + -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ @@ -729,11 +930,14 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ + -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \ + -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \ -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ + -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ @@ -754,6 +958,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ + -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \ -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ @@ -770,9 +975,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) mv $@-t $@ MOSTLYCLEANFILES += stdio.h stdio.h-t -EXTRA_DIST += stdio-write.c stdio.in.h - -EXTRA_libgnu_a_SOURCES += stdio-write.c +EXTRA_DIST += stdio.in.h ## end gnulib module stdio @@ -782,38 +985,49 @@ BUILT_SOURCES += stdlib.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ + $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ - -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \ - -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ - -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ - -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \ - -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ - -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ - -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ - -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ - -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ - -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ - -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ - -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ - -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \ - -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \ - -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ - -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ - -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ - -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \ - -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ - -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ - -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ - -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ - -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ - -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ - -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ - -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ + -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \ + -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \ + -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \ + -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \ + -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \ + -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \ + -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \ + -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \ + -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \ + -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ + -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ + -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ + -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \ + -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ + -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \ + -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ + -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ + -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ + -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ + -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ + -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ + -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ + -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ + -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ + -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ + -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \ + -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \ + -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \ + < $(srcdir)/stdlib.in.h | \ + sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ @@ -824,33 +1038,42 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ + -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \ -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ + -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ + -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ - -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ + -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \ + -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ - -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ + -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ + -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ + -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ + -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ + -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _Noreturn/r $(_NORETURN_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/stdlib.in.h; \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t @@ -893,54 +1116,70 @@ EXTRA_libgnu_a_SOURCES += strerror.c ## end gnulib module strerror +## begin gnulib module strerror-override + + +EXTRA_DIST += strerror-override.c strerror-override.h + +EXTRA_libgnu_a_SOURCES += strerror-override.c + +## end gnulib module strerror-override + ## begin gnulib module string BUILT_SOURCES += string.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ - -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ - -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ - -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ - -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ - -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ - -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ - -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ - -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ - -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ - -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ - -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ - -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ - -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ - -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ - -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \ - -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ - -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ - -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ - -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ - -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ - -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ - -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ - -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ - -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ - -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ - -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ - -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ - -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ - -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ - -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ - -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ - -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ - -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ - -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ + -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ + -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ + -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ + -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \ + -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \ + -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \ + -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \ + -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \ + -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \ + -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \ + -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \ + -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \ + -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \ + -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \ + -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \ + -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \ + -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \ + -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \ + -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \ + -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \ + -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \ + -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \ + -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \ + -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \ + -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \ + -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \ + -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \ + -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \ + -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \ + -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \ + -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \ + -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ + -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ + sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ + -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ @@ -956,15 +1195,18 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ @@ -989,14 +1231,20 @@ BUILT_SOURCES += strings.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -strings.h: strings.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) +strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ + -e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \ + -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \ -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/strings.in.h; \ @@ -1032,28 +1280,30 @@ libgnu_a_SOURCES += strnlen1.h strnlen1.c ## end gnulib module strnlen1 -## begin gnulib module sys_wait +## begin gnulib module sys_types -BUILT_SOURCES += sys/wait.h +BUILT_SOURCES += sys/types.h -# We need the following in order to create when the system -# has one that is incomplete. -sys/wait.h: sys_wait.in.h +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +sys/types.h: sys_types.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''NEXT_SYS_WAIT_H''@|$(NEXT_SYS_WAIT_H)|g' \ - < $(srcdir)/sys_wait.in.h; \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ + -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + < $(srcdir)/sys_types.in.h; \ } > $@-t && \ mv $@-t $@ -MOSTLYCLEANFILES += sys/wait.h sys/wait.h-t -MOSTLYCLEANDIRS += sys +MOSTLYCLEANFILES += sys/types.h sys/types.h-t -EXTRA_DIST += sys_wait.in.h +EXTRA_DIST += sys_types.in.h -## end gnulib module sys_wait +## end gnulib module sys_types ## begin gnulib module sysexits @@ -1061,16 +1311,23 @@ BUILT_SOURCES += $(SYSEXITS_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -sysexits.h: sysexits.in.h +if GL_GENERATE_SYSEXITS_H +sysexits.h: sysexits.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYSEXITS_H''@|$(NEXT_SYSEXITS_H)|g' \ < $(srcdir)/sysexits.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +sysexits.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += sysexits.h sysexits.h-t EXTRA_DIST += sysexits.in.h @@ -1080,56 +1337,69 @@ EXTRA_DIST += sysexits.in.h ## begin gnulib module unistd BUILT_SOURCES += unistd.h +libgnu_a_SOURCES += unistd.c # We need the following in order to create an empty placeholder for # when the system doesn't have one. -unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ - -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ - -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ - -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ - -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \ - -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ - -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ - -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ - -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ - -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ - -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ - -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ - -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ - -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ - -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ - -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ - -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ - -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \ - -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ - -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ - -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ - -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ - -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ - -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ - -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ - -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ - -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ - -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ - -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ - -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ - -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ - -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ - -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \ - -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ - -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ - -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ - -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ - -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ - -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ - -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \ - -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ + -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ + -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ + -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ + -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ + -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ + -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ + -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \ + -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ + -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ + -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ + -e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \ + -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ + -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ + -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ + -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \ + -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \ + -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \ + -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \ + -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \ + -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \ + -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ + -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ + -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ + -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \ + -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \ + -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \ + -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \ + -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \ + -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \ + -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \ + -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \ + -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \ + -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \ + -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \ + -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \ + -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \ + -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \ + -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ + -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ + -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ + -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ + -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \ + -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \ + -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \ + -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ @@ -1138,48 +1408,61 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ + -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ - -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ + -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ + -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ - -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ + -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ + -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ + -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ + -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \ + -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ - -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + | \ + sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ + -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ + -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ + -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ + -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ @@ -1202,6 +1485,48 @@ EXTRA_DIST += unistd.in.h ## end gnulib module unistd +## begin gnulib module unitypes + +BUILT_SOURCES += $(LIBUNISTRING_UNITYPES_H) + +unitypes.h: unitypes.in.h + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/unitypes.in.h; \ + } > $@-t && \ + mv -f $@-t $@ +MOSTLYCLEANFILES += unitypes.h unitypes.h-t + +EXTRA_DIST += unitypes.in.h + +## end gnulib module unitypes + +## begin gnulib module uniwidth/base + +BUILT_SOURCES += $(LIBUNISTRING_UNIWIDTH_H) + +uniwidth.h: uniwidth.in.h + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/uniwidth.in.h; \ + } > $@-t && \ + mv -f $@-t $@ +MOSTLYCLEANFILES += uniwidth.h uniwidth.h-t + +EXTRA_DIST += localcharset.h uniwidth.in.h + +## end gnulib module uniwidth/base + +## begin gnulib module uniwidth/width + +if LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH +libgnu_a_SOURCES += uniwidth/width.c +endif + +EXTRA_DIST += uniwidth/cjk.h + +## end gnulib module uniwidth/width + ## begin gnulib module vasnprintf @@ -1213,7 +1538,8 @@ EXTRA_libgnu_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c ## begin gnulib module verify -libgnu_a_SOURCES += verify.h + +EXTRA_DIST += verify.h ## end gnulib module verify @@ -1226,50 +1552,63 @@ EXTRA_libgnu_a_SOURCES += vsnprintf.c ## end gnulib module vsnprintf -## begin gnulib module warn-on-use - -BUILT_SOURCES += warn-on-use.h -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/warn-on-use.h, except that it has the copyright header cut off. -warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t - -WARN_ON_USE_H=warn-on-use.h - -EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h - -## end gnulib module warn-on-use - ## begin gnulib module wchar BUILT_SOURCES += wchar.h # We need the following in order to create when the system # version does not work standalone. -wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ - -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \ - -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \ - -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \ - -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \ - -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \ - -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \ - -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \ - -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \ - -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \ - -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \ - -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ - -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ + -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ + -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ + -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \ + -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \ + -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \ + -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \ + -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \ + -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \ + -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \ + -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \ + -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \ + -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \ + -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \ + -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \ + -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \ + -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \ + -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \ + -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \ + -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \ + -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \ + -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \ + -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \ + -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \ + -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \ + -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \ + -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \ + -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \ + -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \ + -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \ + -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \ + -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \ + -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \ + -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \ + -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \ + -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \ + -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \ + -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ + -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ + -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ + < $(srcdir)/wchar.in.h | \ + sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ @@ -1279,9 +1618,38 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \ -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \ -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \ + -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \ + -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \ + -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \ + -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \ + -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \ + -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \ + -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \ + -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \ + -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \ + -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \ + -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \ + -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \ + -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \ + -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \ + -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \ + -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \ + -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \ + -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \ + -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \ + -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \ + -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \ + -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \ + -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \ + -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \ + -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \ + -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ + -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ + -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ - -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ + | \ + sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \ @@ -1293,10 +1661,10 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ + -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/wchar.in.h; \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += wchar.h wchar.h-t @@ -1314,24 +1682,35 @@ EXTRA_libgnu_a_SOURCES += wcrtomb.c ## end gnulib module wcrtomb -## begin gnulib module wctype +## begin gnulib module wctype-h BUILT_SOURCES += wctype.h +libgnu_a_SOURCES += wctype-h.c # We need the following in order to create when the system # doesn't have one that works with the given compiler. -wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ + -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \ + -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \ + -e 's/@''GNULIB_WCTRANS''@/$(GNULIB_WCTRANS)/g' \ + -e 's/@''GNULIB_TOWCTRANS''@/$(GNULIB_TOWCTRANS)/g' \ -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ + -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \ + -e 's/@''HAVE_WCTRANS_T''@/$(HAVE_WCTRANS_T)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ + -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/wctype.in.h; \ @@ -1341,11 +1720,20 @@ MOSTLYCLEANFILES += wctype.h wctype.h-t EXTRA_DIST += wctype.in.h -## end gnulib module wctype +## end gnulib module wctype-h + +## begin gnulib module wcwidth + + +EXTRA_DIST += wcwidth.c + +EXTRA_libgnu_a_SOURCES += wcwidth.c + +## end gnulib module wcwidth ## begin gnulib module xsize -libgnu_a_SOURCES += xsize.h +libgnu_a_SOURCES += xsize.h xsize.c ## end gnulib module xsize diff --git a/grub-core/gnulib/alloca.c b/grub-core/gnulib/alloca.c index 75afdb960..ee0f01886 100644 --- a/grub-core/gnulib/alloca.c +++ b/grub-core/gnulib/alloca.c @@ -93,26 +93,15 @@ long i00afunc (); static int stack_dir; /* 1 or -1 once known. */ # define STACK_DIR stack_dir -static void -find_stack_direction (void) +static int +find_stack_direction (int *addr, int depth) { - static char *addr = NULL; /* Address of first `dummy', once known. */ - auto char dummy; /* To get stack address. */ - - if (addr == NULL) - { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); - - find_stack_direction (); /* Recurse once. */ - } - else - { - /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) - stack_dir = 1; /* Stack grew upward. */ - else - stack_dir = -1; /* Stack grew downward. */ - } + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; } # endif /* STACK_DIRECTION == 0 */ @@ -155,7 +144,7 @@ alloca (size_t size) # if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); + STACK_DIR = find_stack_direction (NULL, (size & 1) + 20); # endif /* Reclaim garbage, defined as all alloca'd storage that @@ -486,4 +475,4 @@ i00afunc (long address) # endif /* CRAY */ # endif /* no alloca */ -#endif /* not GCC version 3 */ +#endif /* not GCC 2 */ diff --git a/grub-core/gnulib/alloca.in.h b/grub-core/gnulib/alloca.in.h index 44f20b7a1..72d28ee30 100644 --- a/grub-core/gnulib/alloca.in.h +++ b/grub-core/gnulib/alloca.in.h @@ -1,6 +1,6 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2004, 2006-2010 Free Software Foundation, + Copyright (C) 1995, 1999, 2001-2004, 2006-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -14,9 +14,9 @@ General Public License for more details. You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ + License along with this program; if not, see + . + */ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H means there is a real alloca function. */ @@ -44,6 +44,13 @@ # define alloca _alloca # elif defined __DECC && defined __VMS # define alloca __ALLOCA +# elif defined __TANDEM && defined _TNS_E_TARGET +# ifdef __cplusplus +extern "C" +# endif +void *_alloca (unsigned short); +# pragma intrinsic (_alloca) +# define alloca _alloca # else # include # ifdef __cplusplus diff --git a/grub-core/gnulib/argp-ba.c b/grub-core/gnulib/argp-ba.c index 95feabb86..5abc9d00a 100644 --- a/grub-core/gnulib/argp-ba.c +++ b/grub-core/gnulib/argp-ba.c @@ -1,5 +1,5 @@ /* Default definition for ARGP_PROGRAM_BUG_ADDRESS. - Copyright (C) 1996, 1997, 1999, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1996-1997, 1999, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -19,11 +19,11 @@ /* If set by the user program, it should point to string that is the bug-reporting address for the program. It will be printed by argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help - messages), embedded in a sentence that says something like `Report bugs to - ADDR.'. */ + messages), embedded in a sentence that says something like "Report bugs to + ADDR." */ const char *argp_program_bug_address /* This variable should be zero-initialized. On most systems, putting it into - BSS is sufficient. Not so on MacOS X 10.3 and 10.4, see + BSS is sufficient. Not so on Mac OS X 10.3 and 10.4, see . */ #if defined __ELF__ diff --git a/grub-core/gnulib/argp-eexst.c b/grub-core/gnulib/argp-eexst.c index 115a8cd5d..a8bb77fcf 100644 --- a/grub-core/gnulib/argp-eexst.c +++ b/grub-core/gnulib/argp-eexst.c @@ -1,5 +1,5 @@ /* Default definition for ARGP_ERR_EXIT_STATUS - Copyright (C) 1997, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . diff --git a/grub-core/gnulib/argp-fmtstream.c b/grub-core/gnulib/argp-fmtstream.c index 248a09a3b..02406ff2a 100644 --- a/grub-core/gnulib/argp-fmtstream.c +++ b/grub-core/gnulib/argp-fmtstream.c @@ -1,5 +1,5 @@ /* Word-wrapping and line-truncating streams - Copyright (C) 1997-1999, 2001-2003, 2005, 2009-2010 Free Software + Copyright (C) 1997-1999, 2001-2003, 2005, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This package emulates glibc `line_wrap_stream' semantics for systems that +/* This package emulates glibc 'line_wrap_stream' semantics for systems that don't have that. */ #ifdef HAVE_CONFIG_H @@ -33,6 +33,7 @@ #include "argp-fmtstream.h" #include "argp-namefrob.h" +#include "mbswidth.h" #ifndef ARGP_FMTSTREAM_USE_LINEWRAP @@ -118,37 +119,16 @@ weak_alias (__argp_fmtstream_free, argp_fmtstream_free) #endif -size_t -__argp_get_display_len (const char *beg, const char *end) +/* Return the pointer to the first character that doesn't fit in l columns. */ +static inline const ptrdiff_t +add_width (const char *ptr, const char *end, size_t l) { - const char *ptr; - size_t r = 0; mbstate_t ps; + const char *ptr0 = ptr; memset (&ps, 0, sizeof (ps)); - for (ptr = beg; ptr < end && *ptr; ) - { - wchar_t wc; - size_t s; - - s = mbrtowc (&wc, ptr, end - ptr, &ps); - if (s == (size_t) -1) - break; - r += wcwidth (wc); - ptr += s; - } - return r; -} - -static inline char * -add_length (char *ptr, char *end, size_t l) -{ - mbstate_t ps; - - memset (&ps, 0, sizeof (ps)); - - while (ptr < end && *ptr) + while (ptr < end) { wchar_t wc; size_t s, k; @@ -156,13 +136,31 @@ add_length (char *ptr, char *end, size_t l) s = mbrtowc (&wc, ptr, end - ptr, &ps); if (s == (size_t) -1) break; + if (s == (size_t) -2) + { + if (1 >= l) + break; + l--; + ptr++; + continue; + } + + if (wc == '\e' && ptr + 3 < end + && ptr[1] == '[' && (ptr[2] == '0' || ptr[2] == '1') + && ptr[3] == 'm') + { + ptr += 4; + continue; + } + k = wcwidth (wc); + if (k >= l) break; l -= k; ptr += s; } - return ptr; + return ptr - ptr0; } /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the @@ -217,15 +215,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs) if (!nl) { - size_t display_len = __argp_get_display_len (buf, fs->p); + size_t display_width = mbsnwidth (buf, fs->p - buf, MBSW_STOP_AT_NUL); /* The buffer ends in a partial line. */ - if (fs->point_col + display_len < fs->rmargin) + if (fs->point_col + display_width < fs->rmargin) { /* The remaining buffer text is a partial line and fits within the maximum line width. Advance point for the characters to be written and stop scanning. */ - fs->point_col += display_len; + fs->point_col += display_width; break; } else @@ -235,8 +233,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs) } else { - size_t display_len = __argp_get_display_len (buf, nl); - if (display_len < (ssize_t) fs->rmargin) + size_t display_width = mbsnwidth (buf, nl - buf, MBSW_STOP_AT_NUL); + if (display_width < (ssize_t) fs->rmargin) { /* The buffer contains a full line that fits within the maximum line width. Reset point and scan the next line. */ @@ -280,7 +278,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) char *p, *nextline; int i; - p = add_length (buf, fs->p, (r + 1 - fs->point_col)); + p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); while (p >= buf && !isblank ((unsigned char) *p)) --p; nextline = p + 1; /* This will begin the next line. */ @@ -298,7 +296,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) { /* A single word that is greater than the maximum line width. Oh well. Put it on an overlong line by itself. */ - p = add_length (buf, fs->p, (r + 1 - fs->point_col)); + p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); /* Find the end of the long word. */ if (p < nl) do @@ -332,7 +330,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs) && fs->p > nextline) { /* The margin needs more blanks than we removed. */ - if (__argp_get_display_len (fs->p, fs->end) > fs->wmargin + 1) + if (mbsnwidth (fs->p, fs->end - fs->p, MBSW_STOP_AT_NUL) + > fs->wmargin + 1) /* Make some space for them. */ { size_t mv = fs->p - nextline; diff --git a/grub-core/gnulib/argp-fmtstream.h b/grub-core/gnulib/argp-fmtstream.h index 8a67817b1..000090ea6 100644 --- a/grub-core/gnulib/argp-fmtstream.h +++ b/grub-core/gnulib/argp-fmtstream.h @@ -1,5 +1,5 @@ /* Word-wrapping and line-truncating streams. - Copyright (C) 1997, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 1997, 2006-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This package emulates glibc `line_wrap_stream' semantics for systems that +/* This package emulates glibc 'line_wrap_stream' semantics for systems that don't have that. If the system does have it, it is just a wrapper for that. This header file is only used internally while compiling argp, and shouldn't be installed. */ @@ -28,16 +28,16 @@ #include #include -#ifndef __attribute__ /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. - We enable __attribute__ only if these are supported too, because + We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __attribute__(Spec) /* empty */ -# endif +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif #if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \ @@ -128,12 +128,12 @@ extern void argp_fmtstream_free (argp_fmtstream_t __fs); extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs, const char *__fmt, ...) - __attribute__ ((__format__ (printf, 2, 3))); + _GL_ATTRIBUTE_FORMAT ((printf, 2, 3)); extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs, const char *__fmt, ...) - __attribute__ ((__format__ (printf, 2, 3))); + _GL_ATTRIBUTE_FORMAT ((printf, 2, 3)); -#if _LIBC || !defined __OPTIMIZE__ +#if _LIBC extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); @@ -154,7 +154,7 @@ extern size_t argp_fmtstream_write (argp_fmtstream_t __fs, #define __argp_fmtstream_rmargin argp_fmtstream_rmargin #define __argp_fmtstream_wmargin argp_fmtstream_wmargin -#if _LIBC || !defined __OPTIMIZE__ +#if _LIBC /* Set __FS's left margin to LMARGIN and return the old value. */ extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin); @@ -184,7 +184,7 @@ extern void __argp_fmtstream_update (argp_fmtstream_t __fs); extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); -#ifdef __OPTIMIZE__ +#if !_LIBC || defined __OPTIMIZE__ /* Inline versions of above routines. */ #if !_LIBC @@ -197,6 +197,10 @@ extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); #define __argp_fmtstream_point argp_fmtstream_point #define __argp_fmtstream_update _argp_fmtstream_update #define __argp_fmtstream_ensure _argp_fmtstream_ensure +_GL_INLINE_HEADER_BEGIN +#ifndef ARGP_FS_EI +# define ARGP_FS_EI _GL_INLINE +#endif #endif #ifndef ARGP_FS_EI @@ -335,9 +339,6 @@ __argp_fmtstream_point (argp_fmtstream_t __fs) return __fs->point_col >= 0 ? __fs->point_col : 0; } -size_t -__argp_get_display_len (const char *beg, const char *end); - #if !_LIBC #undef __argp_fmtstream_putc #undef __argp_fmtstream_puts @@ -348,9 +349,10 @@ __argp_get_display_len (const char *beg, const char *end); #undef __argp_fmtstream_point #undef __argp_fmtstream_update #undef __argp_fmtstream_ensure +_GL_INLINE_HEADER_END #endif -#endif /* __OPTIMIZE__ */ +#endif /* !_LIBC || __OPTIMIZE__ */ #endif /* ARGP_FMTSTREAM_USE_LINEWRAP */ diff --git a/grub-core/gnulib/argp-fs-xinl.c b/grub-core/gnulib/argp-fs-xinl.c index 2c683f914..35547d93d 100644 --- a/grub-core/gnulib/argp-fs-xinl.c +++ b/grub-core/gnulib/argp-fs-xinl.c @@ -1,5 +1,5 @@ /* Real definitions for extern inline functions in argp-fmtstream.h - Copyright (C) 1997, 2003, 2004, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997, 2003-2004, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -20,7 +20,11 @@ # include #endif -#define ARGP_FS_EI +#ifdef _LIBC +# define ARGP_FS_EI +#else +# define ARGP_FS_EI _GL_EXTERN_INLINE +#endif #undef __OPTIMIZE__ #define __OPTIMIZE__ 1 #include "argp-fmtstream.h" diff --git a/grub-core/gnulib/argp-help.c b/grub-core/gnulib/argp-help.c index c82e38e75..2914f4723 100644 --- a/grub-core/gnulib/argp-help.c +++ b/grub-core/gnulib/argp-help.c @@ -1,5 +1,5 @@ -/* Hierarchial argument parsing help output - Copyright (C) 1995-2005, 2007, 2009-2010 Free Software Foundation, Inc. +/* Hierarchical argument parsing help output + Copyright (C) 1995-2005, 2007, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,7 @@ #include "argp.h" #include "argp-fmtstream.h" #include "argp-namefrob.h" +#include "mbswidth.h" #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) @@ -56,7 +58,7 @@ /* User-selectable (using an environment variable) formatting parameters. - These may be specified in an environment variable called `ARGP_HELP_FMT', + These may be specified in an environment variable called 'ARGP_HELP_FMT', with a contents like: VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2 Where VALn must be a positive integer. The list of variables is in the UPARAM_NAMES vector, below. */ @@ -73,13 +75,13 @@ #define RMARGIN 79 /* right margin used for wrapping */ /* User-selectable (using an environment variable) formatting parameters. - They must all be of type `int' for the parsing code to work. */ + They must all be of type 'int' for the parsing code to work. */ struct uparams { /* If true, arguments for an option are shown with both short and long - options, even when a given option has both, e.g. `-x ARG, --longx=ARG'. + options, even when a given option has both, e.g. '-x ARG, --longx=ARG'. If false, then if an option has both, the argument is only shown with - the long one, e.g., `-x, --longx=ARG', and a message indicating that + the long one, e.g., '-x, --longx=ARG', and a message indicating that this really means both is printed below the options. */ int dup_args; @@ -111,7 +113,7 @@ static struct uparams uparams = { struct uparam_name { const char *name; /* User name. */ - int is_bool; /* Whether it's `boolean'. */ + int is_bool; /* Whether it's 'boolean'. */ size_t uparams_offs; /* Location of the (int) field in UPARAMS. */ }; @@ -154,7 +156,7 @@ ARGP_HELP_FMT: %s value is less than or equal to %s"), uparams.valid = 1; } -/* Read user options from the environment, and fill in UPARAMS appropiately. */ +/* Read user options from the environment, and fill in UPARAMS appropriately. */ static void fill_in_uparams (const struct argp_state *state) { @@ -259,7 +261,7 @@ fill_in_uparams (const struct argp_state *state) /* Returns true if OPT is an alias for an earlier option. */ #define oalias(opt) ((opt)->flags & OPTION_ALIAS) -/* Returns true if OPT is an documentation-only entry. */ +/* Returns true if OPT is a documentation-only entry. */ #define odoc(opt) ((opt)->flags & OPTION_DOC) /* Returns true if OPT should not be translated */ @@ -277,11 +279,11 @@ fill_in_uparams (const struct argp_state *state) -xARG, -yARG, --long1=ARG, --long2=ARG Documentation... Where ARG will be omitted if there's no argument, for this option, or - will be surrounded by "[" and "]" appropiately if the argument is - optional. The documentation string is word-wrapped appropiately, and if + will be surrounded by "[" and "]" appropriately if the argument is + optional. The documentation string is word-wrapped appropriately, and if the list of options is long enough, it will be started on a separate line. If there are no short options for a given option, the first long option is - indented slighly in a way that's supposed to make most long options appear + indented slightly in a way that's supposed to make most long options appear to be in a separate column. For example, the following output (from ps): @@ -359,7 +361,7 @@ struct hol_entry /* A pointers into the HOL's short_options field, to the first short option letter for this entry. The order of the characters following this point corresponds to the order of options pointed to by OPT, and there are at - most NUM. A short option recorded in a option following OPT is only + most NUM. A short option recorded in an option following OPT is only valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's probably been shadowed by some other entry). */ char *short_options; @@ -570,7 +572,9 @@ hol_entry_short_iterate (const struct hol_entry *entry, } static inline int +#if __GNUC__ >= 3 __attribute__ ((always_inline)) +#endif hol_entry_long_iterate (const struct hol_entry *entry, int (*func)(const struct argp_option *opt, const struct argp_option *real, @@ -711,7 +715,7 @@ hol_cluster_is_child (const struct hol_cluster *cl1, return cl1 == cl2; } -/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail +/* Given the name of an OPTION_DOC option, modifies NAME to start at the tail that should be used for comparisons, and returns true iff it should be treated as a non-option. */ static int @@ -726,7 +730,7 @@ canon_doc_option (const char **name) /* Skip initial whitespace. */ while (isspace ((unsigned char) **name)) (*name)++; - /* Decide whether this looks like an option (leading `-') or not. */ + /* Decide whether this looks like an option (leading '-') or not. */ non_opt = (**name != '-'); /* Skip until part of name used for sorting. */ while (**name && !isalnum ((unsigned char) **name)) @@ -751,9 +755,9 @@ hol_entry_cmp (const struct hol_entry *entry1, if (entry1->cluster != entry2->cluster) { /* The entries are not within the same cluster, so we can't compare them - directly, we have to use the appropiate clustering level too. */ + directly, we have to use the appropriate clustering level too. */ if (! entry1->cluster) - /* ENTRY1 is at the `base level', not in a cluster, so we have to + /* ENTRY1 is at the "base level", not in a cluster, so we have to compare it's group number with that of the base cluster in which ENTRY2 resides. Note that if they're in the same group, the clustered option always comes laster. */ @@ -783,7 +787,7 @@ hol_entry_cmp (const struct hol_entry *entry1, doc2 = canon_doc_option (&long2); if (doc1 != doc2) - /* `documentation' options always follow normal options (or + /* "documentation" options always follow normal options (or documentation options that *look* like normal options). */ return doc1 - doc2; else if (!short1 && !short2 && long1 && long2) @@ -889,7 +893,8 @@ hol_append (struct hol *hol, struct hol *more) /* Fix up the short options pointers from HOL. */ for (e = entries, left = hol->num_entries; left > 0; e++, left--) - e->short_options += (short_options - hol->short_options); + e->short_options = + short_options + (e->short_options - hol->short_options); /* Now add the short options from MORE, fixing up its entries too. */ @@ -1020,7 +1025,7 @@ filter_doc (const char *doc, int key, const struct argp *argp, return doc; } -/* Prints STR as a header line, with the margin lines set appropiately, and +/* Prints STR as a header line, with the margin lines set appropriately, and notes the fact that groups should be separated with a blank line. ARGP is the argp that should dictate any user doc filtering to take place. Note that the previous wrap margin isn't restored, but the left margin is reset @@ -1142,7 +1147,7 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state, /* Now, long options. */ if (odoc (real)) - /* A `documentation' option. */ + /* A "documentation" option. */ { __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col); for (opt = real, num = entry->num; num > 0; opt++, num--) @@ -1436,7 +1441,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, const char *cp = fdoc; nl = __strchrnul (cp, '\n'); if (*nl != '\0') - /* This is a `multi-level' args doc; advance to the correct position + /* This is a "multi-level" args doc; advance to the correct position as determined by our state in LEVELS, and update LEVELS. */ { int i; @@ -1448,7 +1453,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, /* Manually do line wrapping so that it (probably) won't get wrapped at any embedded spaces. */ - space (stream, 1 + __argp_get_display_len (cp, nl)); + space (stream, 1 + mbsnwidth (cp, nl - cp, MBSW_STOP_AT_NUL)); __argp_fmtstream_write (stream, cp, nl - cp); } @@ -1477,9 +1482,9 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, } /* Print the documentation for ARGP to STREAM; if POST is false, then - everything preceeding a `\v' character in the documentation strings (or + everything preceding a '\v' character in the documentation strings (or the whole string, for those with none) is printed, otherwise, everything - following the `\v' character (nothing for strings without). Each separate + following the '\v' character (nothing for strings without). Each separate bit of documentation is separated a blank line, and if PRE_BLANK is true, then the first is as well. If FIRST_ONLY is true, only the first occurrence is output. Returns true if anything was output. */ @@ -1549,7 +1554,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state, free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */ if (post && argp->help_filter) - /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */ + /* Now see if we have to output an ARGP_KEY_HELP_EXTRA text. */ { text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input); if (text) @@ -1576,8 +1581,8 @@ argp_doc (const struct argp *argp, const struct argp_state *state, } /* Output a usage message for ARGP to STREAM. If called from - argp_state_help, STATE is the relevent parsing state. FLAGS are from the - set ARGP_HELP_*. NAME is what to use wherever a `program name' is + argp_state_help, STATE is the relevant parsing state. FLAGS are from the + set ARGP_HELP_*. NAME is what to use wherever a "program name" is needed. */ static void _help (const struct argp *argp, const struct argp_state *state, FILE *stream, @@ -1618,7 +1623,7 @@ _help (const struct argp *argp, const struct argp_state *state, FILE *stream, } if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE)) - /* Print a short `Usage:' message. */ + /* Print a short "Usage:" message. */ { int first_pattern = 1, more_patterns; size_t num_pattern_levels = argp_args_levels (argp); @@ -1678,7 +1683,7 @@ _help (const struct argp *argp, const struct argp_state *state, FILE *stream, if (flags & ARGP_HELP_SEE) { __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\ -Try `%s --help' or `%s --usage' for more information.\n"), +Try '%s --help' or '%s --usage' for more information.\n"), name, name); anything = 1; } @@ -1721,7 +1726,7 @@ Try `%s --help' or `%s --usage' for more information.\n"), } /* Output a usage message for ARGP to STREAM. FLAGS are from the set - ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */ + ARGP_HELP_*. NAME is what to use wherever a "program name" is needed. */ void __argp_help (const struct argp *argp, FILE *stream, unsigned flags, char *name) { @@ -1779,7 +1784,7 @@ weak_alias (__argp_state_help, argp_state_help) #endif /* If appropriate, print the printf string FMT and following args, preceded - by the program name and `:', to stderr, and followed by a `Try ... --help' + by the program name and ':', to stderr, and followed by a "Try ... --help" message, then exit (1). */ void __argp_error (const struct argp_state *state, const char *fmt, ...) @@ -1915,7 +1920,7 @@ __argp_failure (const struct argp_state *state, int status, int errnum, char const *s = NULL; putc_unlocked (':', stream); putc_unlocked (' ', stream); -#if _LIBC || (HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P) +#if _LIBC || (HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P && !defined strerror_r) s = __strerror_r (errnum, buf, sizeof buf); #elif HAVE_DECL_STRERROR_R if (__strerror_r (errnum, buf, sizeof buf) == 0) diff --git a/grub-core/gnulib/argp-namefrob.h b/grub-core/gnulib/argp-namefrob.h index 24581a626..6333958c6 100644 --- a/grub-core/gnulib/argp-namefrob.h +++ b/grub-core/gnulib/argp-namefrob.h @@ -1,5 +1,5 @@ /* Name frobnication for compiling argp outside of glibc - Copyright (C) 1997, 2003, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997, 2003, 2007, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -100,45 +100,45 @@ #endif #if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED # define feof_unlocked(x) feof (x) -# endif +#endif #if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED # define ferror_unlocked(x) ferror (x) -# endif +#endif #if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED # define fflush_unlocked(x) fflush (x) -# endif +#endif #if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED # define fgets_unlocked(x,y,z) fgets (x,y,z) -# endif +#endif #if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED # define fputc_unlocked(x,y) fputc (x,y) -# endif +#endif #if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED # define fputs_unlocked(x,y) fputs (x,y) -# endif +#endif #if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED # define fread_unlocked(w,x,y,z) fread (w,x,y,z) -# endif +#endif #if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) -# endif +#endif #if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED # define getc_unlocked(x) getc (x) -# endif +#endif #if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED # define getchar_unlocked() getchar () -# endif +#endif #if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED # define putc_unlocked(x,y) putc (x,y) -# endif +#endif #if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED # define putchar_unlocked(x) putchar (x) -# endif +#endif #endif /* !_LIBC */ #ifndef __set_errno -#define __set_errno(e) (errno = (e)) +# define __set_errno(e) (errno = (e)) #endif #if defined GNULIB_ARGP_DISABLE_DIRNAME diff --git a/grub-core/gnulib/argp-parse.c b/grub-core/gnulib/argp-parse.c index 9c054653c..67ea32c54 100644 --- a/grub-core/gnulib/argp-parse.c +++ b/grub-core/gnulib/argp-parse.c @@ -1,5 +1,5 @@ -/* Hierarchial argument parsing, layered over getopt - Copyright (C) 1995-2000, 2002-2004, 2009-2010 Free Software Foundation, Inc. +/* Hierarchical argument parsing, layered over getopt + Copyright (C) 1995-2000, 2002-2004, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -21,6 +21,7 @@ #endif #include +#include #include #include #include @@ -42,7 +43,6 @@ #include "argp.h" #include "argp-namefrob.h" -#define alignof(type) offsetof (struct { char c; type x; }, x) #define alignto(n, d) ((((n) + (d) - 1) / (d)) * (d)) /* Getopt return values. */ @@ -154,8 +154,9 @@ argp_version_parser (int key, char *arg, struct argp_state *state) else if (argp_program_version) fprintf (state->out_stream, "%s\n", argp_program_version); else - __argp_error (state, dgettext (state->root_argp->argp_domain, - "(PROGRAM ERROR) No version known!?")); + __argp_error (state, "%s", + dgettext (state->root_argp->argp_domain, + "(PROGRAM ERROR) No version known!?")); if (! (state->flags & ARGP_NO_EXIT)) exit (0); break; @@ -187,7 +188,7 @@ find_long_option (struct option *long_options, const char *name) } -/* The state of a `group' during parsing. Each group corresponds to a +/* The state of a "group" during parsing. Each group corresponds to a particular argp structure from the tree of such descending from the top level argp passed to argp_parse. */ struct group @@ -203,7 +204,7 @@ struct group particular short options is from. */ char *short_end; - /* The number of non-option args sucessfully handled by this parser. */ + /* The number of non-option args successfully handled by this parser. */ unsigned args_processed; /* This group's parser's parent's group. */ @@ -254,7 +255,7 @@ struct parser struct group *groups; /* The end of the GROUPS array. */ struct group *egroup; - /* An vector containing storage for the CHILD_INPUTS field in all groups. */ + /* A vector containing storage for the CHILD_INPUTS field in all groups. */ void **child_inputs; /* True if we think using getopt is still useful; if false, then @@ -385,7 +386,7 @@ convert_options (const struct argp *argp, return group; } -/* Find the merged set of getopt options, with keys appropiately prefixed. */ +/* Find the merged set of getopt options, with keys appropriately prefixed. */ static void parser_convert (struct parser *parser, const struct argp *argp, int flags) { @@ -439,7 +440,7 @@ calc_sizes (const struct argp *argp, struct parser_sizes *szs) int num_opts = 0; while (!__option_is_end (opt++)) num_opts++; - szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */ + szs->short_len += num_opts * 3; /* opt + up to 2 ':'s */ szs->long_len += num_opts; } } @@ -781,7 +782,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey) if (parser->state.quoted && parser->state.next < parser->state.quoted) /* The next argument pointer has been moved to before the quoted - region, so pretend we never saw the quoting `--', and give getopt + region, so pretend we never saw the quoting "--", and give getopt another chance. If the user hasn't removed it, getopt will just process it again. */ parser->state.quoted = 0; @@ -813,7 +814,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey) && strcmp (parser->state.argv[parser->state.next - 1], QUOTE) == 0) /* Not only is this the end of the options, but it's a - `quoted' region, which may have args that *look* like + "quoted" region, which may have args that *look* like options, so we definitely shouldn't try to use getopt past here, whatever happens. */ parser->state.quoted = parser->state.next; @@ -879,11 +880,11 @@ __argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags, #ifndef _LIBC if (!(flags & ARGP_PARSE_ARGV0)) { -#ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME +#if HAVE_DECL_PROGRAM_INVOCATION_NAME if (!program_invocation_name) program_invocation_name = argv[0]; #endif -#ifdef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME +#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME if (!program_invocation_short_name) program_invocation_short_name = __argp_base_name (argv[0]); #endif diff --git a/grub-core/gnulib/argp-pin.c b/grub-core/gnulib/argp-pin.c index eda4d958e..78cbb355b 100644 --- a/grub-core/gnulib/argp-pin.c +++ b/grub-core/gnulib/argp-pin.c @@ -1,5 +1,5 @@ /* Full and short program names for argp module - Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,4 +24,3 @@ char *program_invocation_short_name = 0; #ifndef HAVE_PROGRAM_INVOCATION_NAME char *program_invocation_name = 0; #endif - diff --git a/grub-core/gnulib/argp-pv.c b/grub-core/gnulib/argp-pv.c index e3227d322..c74070d12 100644 --- a/grub-core/gnulib/argp-pv.c +++ b/grub-core/gnulib/argp-pv.c @@ -1,5 +1,5 @@ /* Default definition for ARGP_PROGRAM_VERSION. - Copyright (C) 1996, 1997, 1999, 2006, 2009, 2010 Free Software Foundation, + Copyright (C) 1996-1997, 1999, 2006, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -23,7 +23,7 @@ ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ const char *argp_program_version /* This variable should be zero-initialized. On most systems, putting it into - BSS is sufficient. Not so on MacOS X 10.3 and 10.4, see + BSS is sufficient. Not so on Mac OS X 10.3 and 10.4, see . */ #if defined __ELF__ diff --git a/grub-core/gnulib/argp-pvh.c b/grub-core/gnulib/argp-pvh.c index fb98fc21c..885ff4b75 100644 --- a/grub-core/gnulib/argp-pvh.c +++ b/grub-core/gnulib/argp-pvh.c @@ -1,5 +1,5 @@ /* Default definition for ARGP_PROGRAM_VERSION_HOOK. - Copyright (C) 1996, 1997, 1999, 2004, 2009, 2010 Free Software Foundation, + Copyright (C) 1996-1997, 1999, 2004, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . diff --git a/grub-core/gnulib/argp-xinl.c b/grub-core/gnulib/argp-xinl.c index 6e7e20bba..04d8cf703 100644 --- a/grub-core/gnulib/argp-xinl.c +++ b/grub-core/gnulib/argp-xinl.c @@ -1,5 +1,5 @@ /* Real definitions for extern inline functions in argp.h - Copyright (C) 1997, 1998, 2004, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2004, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -27,7 +27,11 @@ #ifndef __USE_EXTERN_INLINES # define __USE_EXTERN_INLINES 1 #endif -#define ARGP_EI +#ifdef _LIBC +# define ARGP_EI +#else +# define ARGP_EI _GL_EXTERN_INLINE +#endif #undef __OPTIMIZE__ #define __OPTIMIZE__ 1 #include "argp.h" diff --git a/grub-core/gnulib/argp.h b/grub-core/gnulib/argp.h index 3667224a9..c4094a40c 100644 --- a/grub-core/gnulib/argp.h +++ b/grub-core/gnulib/argp.h @@ -1,5 +1,5 @@ -/* Hierarchial argument parsing, layered over getopt. - Copyright (C) 1995-1999, 2003-2010 Free Software Foundation, Inc. +/* Hierarchical argument parsing, layered over getopt. + Copyright (C) 1995-1999, 2003-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -34,16 +34,16 @@ # define __NTH(fct) fct __THROW #endif -#ifndef __attribute__ /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. - We enable __attribute__ only if these are supported too, because + We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __attribute__(Spec) /* empty */ -# endif +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif /* GCC 2.95 and later have "__restrict"; C99 compilers have @@ -94,7 +94,7 @@ struct argp_option /* The doc string for this option. If both NAME and KEY are 0, This string will be printed outdented from the normal option column, making it useful as a group header (it will be the first thing printed in its - group); in this usage, it's conventional to end the string with a `:'. + group); in this usage, it's conventional to end the string with a ':'. Write the initial value as N_("TEXT") if you want xgettext to collect it into a POT file. */ @@ -124,21 +124,21 @@ struct argp_option /* This option isn't actually an option (and so should be ignored by the actual option parser), but rather an arbitrary piece of documentation that should be displayed in much the same manner as the options. If this flag - is set, then the option NAME field is displayed unmodified (e.g., no `--' + is set, then the option NAME field is displayed unmodified (e.g., no '--' prefix is added) at the left-margin (where a *short* option would normally be displayed), and the documentation string in the normal place. The NAME field will be translated using gettext, unless OPTION_NO_TRANS is set (see below). For purposes of sorting, any leading whitespace and punctuation is - ignored, except that if the first non-whitespace character is not `-', this + ignored, except that if the first non-whitespace character is not '-', this entry is displayed after all options (and OPTION_DOC entries with a leading - `-') in the same group. */ + '-') in the same group. */ #define OPTION_DOC 0x8 -/* This option shouldn't be included in `long' usage messages (but is still +/* This option shouldn't be included in "long" usage messages (but is still included in help messages). This is mainly intended for options that are completely documented in an argp's ARGS_DOC field, in which case including the option in the generic usage list would be redundant. For instance, - if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to + if ARGS_DOC is "FOO BAR\n-x BLAH", and the '-x' option's purpose is to distinguish these two cases, -x should probably be marked OPTION_NO_USAGE. */ #define OPTION_NO_USAGE 0x10 @@ -167,7 +167,7 @@ typedef error_t (*argp_parser_t) (int key, char *arg, ARGP_ERR_UNKNOWN should be returned if they aren't understood. The sequence of keys to a parsing function is either (where each - uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key): + uppercased word should be prefixed by 'ARGP_KEY_' and opt is a user key): INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed @@ -238,15 +238,15 @@ struct argp argp_parser_t parser; /* A string describing what other arguments are wanted by this program. It - is only used by argp_usage to print the `Usage:' message. If it + is only used by argp_usage to print the "Usage:" message. If it contains newlines, the strings separated by them are considered alternative usage patterns, and printed on separate lines (lines after - the first are prefix by ` or: ' instead of `Usage:'). */ + the first are prefix by " or: " instead of "Usage:"). */ const char *args_doc; /* If non-NULL, a string containing extra text to be printed before and after the options in a long help message (separated by a vertical tab - `\v' character). + '\v' character). Write the initial value as N_("BEFORE-TEXT") "\v" N_("AFTER-TEXT") if you want xgettext to collect the two pieces of text into a POT file. */ const char *doc; @@ -265,7 +265,7 @@ struct argp defines, below, describing which other help text TEXT is. The function should return either TEXT, if it should be used as-is, a replacement string, which should be malloced, and will be freed by argp, or NULL, - meaning `print nothing'. The value for TEXT is *after* any translation + meaning "print nothing". The value for TEXT is *after* any translation has been done, so if any of the replacement text also needs translation, that should be done by the filter function. INPUT is either the input supplied to argp_parse, or NULL, if argp_help was called directly. */ @@ -278,7 +278,7 @@ struct argp }; /* Possible KEY arguments to a help filter function. */ -#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ +#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceding options. */ #define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ #define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ #define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; @@ -304,7 +304,7 @@ struct argp_child printing a header string, use a value of "". */ const char *header; - /* Where to group the child options relative to the other (`consolidated') + /* Where to group the child options relative to the other ("consolidated") options in the parent argp; the values are the same as the GROUP field in argp_option structs, but all child-groupings follow parent options at a particular group level. If both this field and HEADER are zero, then @@ -337,7 +337,7 @@ struct argp_state unsigned arg_num; /* If non-zero, the index in ARGV of the first argument following a special - `--' argument (which prevents anything following being interpreted as an + '--' argument (which prevents anything following being interpreted as an option). Only set once argument parsing has proceeded past this point. */ int quoted; @@ -399,7 +399,7 @@ struct argp_state /* Don't exit on errors (they may still result in error messages). */ #define ARGP_NO_EXIT 0x20 -/* Use the gnu getopt `long-only' rules for parsing arguments. */ +/* Use the gnu getopt "long-only" rules for parsing arguments. */ #define ARGP_LONG_ONLY 0x40 /* Turns off any message-printing/exiting options. */ @@ -456,7 +456,7 @@ extern void (*argp_program_version_hook) (FILE *__restrict __stream, the bug-reporting address for the program. It will be printed by argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help messages), embedded in a sentence that says something like - `Report bugs to ADDR.'. */ + "Report bugs to ADDR." */ extern const char *argp_program_bug_address; /* The exit status that argp will use when exiting due to a parsing error. @@ -467,7 +467,7 @@ extern error_t argp_err_exit_status; /* Flags for argp_help. */ #define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ #define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ -#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ +#define ARGP_HELP_SEE 0x04 /* a "Try ... for more help" message. */ #define ARGP_HELP_LONG 0x08 /* a long help message. */ #define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ #define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ @@ -506,7 +506,7 @@ extern void __argp_help (const struct argp *__restrict __argp, parsing routine (thus taking an argp_state structure as the first argument). They may or may not print an error message and exit, depending on the flags in STATE -- in any case, the caller should be prepared for - them *not* to exit, and should return an appropiate error after calling + them *not* to exit, and should return an appropriate error after calling them. [argp_usage & argp_error should probably be called argp_state_..., but they're used often enough that they should be short] */ @@ -519,21 +519,21 @@ extern void __argp_state_help (const struct argp_state *__restrict __state, FILE *__restrict __stream, unsigned int __flags); -#if _LIBC || !defined __USE_EXTERN_INLINES +#if _LIBC /* Possibly output the standard usage message for ARGP to stderr and exit. */ extern void argp_usage (const struct argp_state *__state); extern void __argp_usage (const struct argp_state *__state); #endif /* If appropriate, print the printf string FMT and following args, preceded - by the program name and `:', to stderr, and followed by a `Try ... --help' + by the program name and ':', to stderr, and followed by a "Try ... --help" message, then exit (1). */ extern void argp_error (const struct argp_state *__restrict __state, const char *__restrict __fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 2, 3)); extern void __argp_error (const struct argp_state *__restrict __state, const char *__restrict __fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 2, 3)); /* Similar to the standard gnu error-reporting function error(), but will respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print @@ -546,13 +546,13 @@ extern void __argp_error (const struct argp_state *__restrict __state, extern void argp_failure (const struct argp_state *__restrict __state, int __status, int __errnum, const char *__restrict __fmt, ...) - __attribute__ ((__format__ (__printf__, 4, 5))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 4, 5)); extern void __argp_failure (const struct argp_state *__restrict __state, int __status, int __errnum, const char *__restrict __fmt, ...) - __attribute__ ((__format__ (__printf__, 4, 5))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 4, 5)); -#if _LIBC || !defined __USE_EXTERN_INLINES +#if _LIBC /* Returns true if the option OPT is a valid short option. */ extern int _option_is_short (const struct argp_option *__opt) __THROW; extern int __option_is_short (const struct argp_option *__opt) __THROW; @@ -572,13 +572,17 @@ extern void *__argp_input (const struct argp *__restrict __argp, const struct argp_state *__restrict __state) __THROW; -#ifdef __USE_EXTERN_INLINES +#if !_LIBC || defined __USE_EXTERN_INLINES # if !_LIBC # define __argp_usage argp_usage # define __argp_state_help argp_state_help # define __option_is_short _option_is_short # define __option_is_end _option_is_end +_GL_INLINE_HEADER_BEGIN +# ifndef ARGP_EI +# define ARGP_EI _GL_INLINE +# endif # endif # ifndef ARGP_EI @@ -635,6 +639,7 @@ __NTH (__option_is_end (const struct argp_option *__opt)) # undef __argp_state_help # undef __option_is_short # undef __option_is_end +_GL_INLINE_HEADER_END # endif #endif /* Use extern inlines. */ diff --git a/grub-core/gnulib/asnprintf.c b/grub-core/gnulib/asnprintf.c index 3bd2229d5..76e228d86 100644 --- a/grub-core/gnulib/asnprintf.c +++ b/grub-core/gnulib/asnprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ #include diff --git a/grub-core/gnulib/basename-lgpl.c b/grub-core/gnulib/basename-lgpl.c index a35ff01c2..9307e8314 100644 --- a/grub-core/gnulib/basename-lgpl.c +++ b/grub-core/gnulib/basename-lgpl.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2010 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/grub-core/gnulib/btowc.c b/grub-core/gnulib/btowc.c index 8744602aa..6c7cbec9d 100644 --- a/grub-core/gnulib/btowc.c +++ b/grub-core/gnulib/btowc.c @@ -1,5 +1,5 @@ /* Convert unibyte character to wide character. - Copyright (C) 2008, 2010 Free Software Foundation, Inc. + Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify diff --git a/grub-core/gnulib/config.charset b/grub-core/gnulib/config.charset index aa7d00dba..a991419cd 100644 --- a/grub-core/gnulib/config.charset +++ b/grub-core/gnulib/config.charset @@ -1,7 +1,7 @@ #! /bin/sh # Output a system dependent table of character encoding aliases. # -# Copyright (C) 2000-2004, 2006-2010 Free Software Foundation, Inc. +# Copyright (C) 2000-2004, 2006-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,8 +14,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# with this program; if not, see . # # The table consists of lines of the form # ALIAS CANONICAL @@ -30,6 +29,8 @@ # The current list of GNU canonical charset names is as follows. # # name MIME? used by which systems +# (darwin = Mac OS X, woe32 = native Windows) +# # ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin cygwin # ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin # ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin diff --git a/grub-core/gnulib/dirname-lgpl.c b/grub-core/gnulib/dirname-lgpl.c index d4506e060..82f66301f 100644 --- a/grub-core/gnulib/dirname-lgpl.c +++ b/grub-core/gnulib/dirname-lgpl.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2010 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -25,7 +25,7 @@ /* Return the length of the prefix of FILE that will be used by dir_name. If FILE is in the working directory, this returns zero - even though `dir_name (FILE)' will return ".". Works properly even + even though 'dir_name (FILE)' will return ".". Works properly even if there are trailing slashes (by effectively ignoring them). */ size_t @@ -53,9 +53,9 @@ dir_len (char const *file) } -/* In general, we can't use the builtin `dirname' function if available, +/* In general, we can't use the builtin 'dirname' function if available, since it has different meanings in different environments. - In some environments the builtin `dirname' modifies its argument. + In some environments the builtin 'dirname' modifies its argument. Return the leading directories part of FILE, allocated with malloc. Works properly even if there are trailing slashes (by effectively diff --git a/grub-core/gnulib/dirname.h b/grub-core/gnulib/dirname.h index fb19508f7..4ad031200 100644 --- a/grub-core/gnulib/dirname.h +++ b/grub-core/gnulib/dirname.h @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003-2006, 2009-2010 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -21,53 +21,25 @@ # include # include +# include "dosname.h" # ifndef DIRECTORY_SEPARATOR # define DIRECTORY_SEPARATOR '/' # endif -# ifndef ISSLASH -# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) -# endif - -# ifndef FILE_SYSTEM_PREFIX_LEN -# if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX - /* This internal macro assumes ASCII, but all hosts that support drive - letters use ASCII. */ -# define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' \ - <= 'z' - 'a') -# define FILE_SYSTEM_PREFIX_LEN(Filename) \ - (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) -# else -# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 -# endif -# endif - -# ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 -# endif - # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 # endif -# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) -# else -# define IS_ABSOLUTE_FILE_NAME(F) \ - (ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F)) -# endif -# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) - # if GNULIB_DIRNAME char *base_name (char const *file); char *dir_name (char const *file); # endif char *mdir_name (char const *file); -size_t base_len (char const *file); -size_t dir_len (char const *file); -char *last_component (char const *file); +size_t base_len (char const *file) _GL_ATTRIBUTE_PURE; +size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE; +char *last_component (char const *file) _GL_ATTRIBUTE_PURE; bool strip_trailing_slashes (char *file); diff --git a/grub-core/gnulib/dosname.h b/grub-core/gnulib/dosname.h new file mode 100644 index 000000000..ba63ce4bd --- /dev/null +++ b/grub-core/gnulib/dosname.h @@ -0,0 +1,53 @@ +/* File names on MS-DOS/Windows systems. + + Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + From Paul Eggert and Jim Meyering. */ + +#ifndef _DOSNAME_H +#define _DOSNAME_H + +#if (defined _WIN32 || defined __WIN32__ || \ + defined __MSDOS__ || defined __CYGWIN__ || \ + defined __EMX__ || defined __DJGPP__) + /* This internal macro assumes ASCII, but all hosts that support drive + letters use ASCII. */ +# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \ + <= 'z' - 'a') +# define FILE_SYSTEM_PREFIX_LEN(Filename) \ + (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) +# ifndef __CYGWIN__ +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 +# endif +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#else +# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 +# define ISSLASH(C) ((C) == '/') +#endif + +#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 +#endif + +#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) +# else +# define IS_ABSOLUTE_FILE_NAME(F) \ + (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0) +#endif +#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) + +#endif /* DOSNAME_H_ */ diff --git a/grub-core/gnulib/errno.in.h b/grub-core/gnulib/errno.in.h index 140e5d134..49b35464b 100644 --- a/grub-core/gnulib/errno.in.h +++ b/grub-core/gnulib/errno.in.h @@ -1,6 +1,6 @@ /* A POSIX-like . - Copyright (C) 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2008-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,69 +13,137 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ -#ifndef _GL_ERRNO_H +#ifndef _@GUARD_PREFIX@_ERRNO_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_ERRNO_H@ -#ifndef _GL_ERRNO_H -#define _GL_ERRNO_H +#ifndef _@GUARD_PREFIX@_ERRNO_H +#define _@GUARD_PREFIX@_ERRNO_H /* On native Windows platforms, many macros are not defined. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value. */ -# define EWOULDBLOCK EAGAIN +/* These are the same values as defined by MSVC 10, for interoperability. */ -/* Values >= 100 seem safe to use. */ -# define ETXTBSY 100 -# define GNULIB_defined_ETXTBSY 1 +# ifndef ENOMSG +# define ENOMSG 122 +# define GNULIB_defined_ENOMSG 1 +# endif + +# ifndef EIDRM +# define EIDRM 111 +# define GNULIB_defined_EIDRM 1 +# endif + +# ifndef ENOLINK +# define ENOLINK 121 +# define GNULIB_defined_ENOLINK 1 +# endif + +# ifndef EPROTO +# define EPROTO 134 +# define GNULIB_defined_EPROTO 1 +# endif + +# ifndef EBADMSG +# define EBADMSG 104 +# define GNULIB_defined_EBADMSG 1 +# endif + +# ifndef EOVERFLOW +# define EOVERFLOW 132 +# define GNULIB_defined_EOVERFLOW 1 +# endif + +# ifndef ENOTSUP +# define ENOTSUP 129 +# define GNULIB_defined_ENOTSUP 1 +# endif + +# ifndef ENETRESET +# define ENETRESET 117 +# define GNULIB_defined_ENETRESET 1 +# endif + +# ifndef ECONNABORTED +# define ECONNABORTED 106 +# define GNULIB_defined_ECONNABORTED 1 +# endif + +# ifndef ECANCELED +# define ECANCELED 105 +# define GNULIB_defined_ECANCELED 1 +# endif + +# ifndef EOWNERDEAD +# define EOWNERDEAD 133 +# define GNULIB_defined_EOWNERDEAD 1 +# endif + +# ifndef ENOTRECOVERABLE +# define ENOTRECOVERABLE 127 +# define GNULIB_defined_ENOTRECOVERABLE 1 +# endif + +# ifndef EINPROGRESS +# define EINPROGRESS 112 +# define EALREADY 103 +# define ENOTSOCK 128 +# define EDESTADDRREQ 109 +# define EMSGSIZE 115 +# define EPROTOTYPE 136 +# define ENOPROTOOPT 123 +# define EPROTONOSUPPORT 135 +# define EOPNOTSUPP 130 +# define EAFNOSUPPORT 102 +# define EADDRINUSE 100 +# define EADDRNOTAVAIL 101 +# define ENETDOWN 116 +# define ENETUNREACH 118 +# define ECONNRESET 108 +# define ENOBUFS 119 +# define EISCONN 113 +# define ENOTCONN 126 +# define ETIMEDOUT 138 +# define ECONNREFUSED 107 +# define ELOOP 114 +# define EHOSTUNREACH 110 +# define EWOULDBLOCK 140 +# define GNULIB_defined_ESOCK 1 +# endif + +# ifndef ETXTBSY +# define ETXTBSY 139 +# define ENODATA 120 /* not required by POSIX */ +# define ENOSR 124 /* not required by POSIX */ +# define ENOSTR 125 /* not required by POSIX */ +# define ETIME 137 /* not required by POSIX */ +# define EOTHER 131 /* not required by POSIX */ +# define GNULIB_defined_ESTREAMS 1 +# endif /* These are intentionally the same values as the WSA* error numbers, defined in . */ -# define EINPROGRESS 10036 -# define EALREADY 10037 -# define ENOTSOCK 10038 -# define EDESTADDRREQ 10039 -# define EMSGSIZE 10040 -# define EPROTOTYPE 10041 -# define ENOPROTOOPT 10042 -# define EPROTONOSUPPORT 10043 # define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ -# define EOPNOTSUPP 10045 # define EPFNOSUPPORT 10046 /* not required by POSIX */ -# define EAFNOSUPPORT 10047 -# define EADDRINUSE 10048 -# define EADDRNOTAVAIL 10049 -# define ENETDOWN 10050 -# define ENETUNREACH 10051 -# define ENETRESET 10052 -# define ECONNABORTED 10053 -# define ECONNRESET 10054 -# define ENOBUFS 10055 -# define EISCONN 10056 -# define ENOTCONN 10057 # define ESHUTDOWN 10058 /* not required by POSIX */ # define ETOOMANYREFS 10059 /* not required by POSIX */ -# define ETIMEDOUT 10060 -# define ECONNREFUSED 10061 -# define ELOOP 10062 # define EHOSTDOWN 10064 /* not required by POSIX */ -# define EHOSTUNREACH 10065 # define EPROCLIM 10067 /* not required by POSIX */ # define EUSERS 10068 /* not required by POSIX */ # define EDQUOT 10069 # define ESTALE 10070 # define EREMOTE 10071 /* not required by POSIX */ -# define GNULIB_defined_ESOCK 1 +# define GNULIB_defined_EWINSOCK 1 # endif @@ -98,6 +166,7 @@ /* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. + Likewise, on NonStop Kernel, EDQUOT is not defined. Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. @@ -145,16 +214,66 @@ # define GNULIB_defined_ENOTSUP 1 # endif +# ifndef ENETRESET +# define ENETRESET 2011 +# define GNULIB_defined_ENETRESET 1 +# endif + +# ifndef ECONNABORTED +# define ECONNABORTED 2012 +# define GNULIB_defined_ECONNABORTED 1 +# endif + # ifndef ESTALE # define ESTALE 2009 # define GNULIB_defined_ESTALE 1 # endif +# ifndef EDQUOT +# define EDQUOT 2010 +# define GNULIB_defined_EDQUOT 1 +# endif + # ifndef ECANCELED # define ECANCELED 2008 # define GNULIB_defined_ECANCELED 1 # endif +/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not + defined. */ -#endif /* _GL_ERRNO_H */ -#endif /* _GL_ERRNO_H */ +# ifndef EOWNERDEAD +# if defined __sun + /* Use the same values as defined for Solaris >= 8, for + interoperability. */ +# define EOWNERDEAD 58 +# define ENOTRECOVERABLE 59 +# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + /* We have a conflict here: pthreads-win32 defines these values + differently than MSVC 10. It's hairy to decide which one to use. */ +# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS + /* Use the same values as defined by pthreads-win32, for + interoperability. */ +# define EOWNERDEAD 43 +# define ENOTRECOVERABLE 44 +# else + /* Use the same values as defined by MSVC 10, for + interoperability. */ +# define EOWNERDEAD 133 +# define ENOTRECOVERABLE 127 +# endif +# else +# define EOWNERDEAD 2013 +# define ENOTRECOVERABLE 2014 +# endif +# define GNULIB_defined_EOWNERDEAD 1 +# define GNULIB_defined_ENOTRECOVERABLE 1 +# endif + +# ifndef EILSEQ +# define EILSEQ 2015 +# define GNULIB_defined_EILSEQ 1 +# endif + +#endif /* _@GUARD_PREFIX@_ERRNO_H */ +#endif /* _@GUARD_PREFIX@_ERRNO_H */ diff --git a/grub-core/gnulib/error.c b/grub-core/gnulib/error.c index ed9dba0d2..865b29340 100644 --- a/grub-core/gnulib/error.c +++ b/grub-core/gnulib/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -54,7 +54,7 @@ function without parameters instead. */ void (*error_print_progname) (void); -/* This variable is incremented each time `error' is called. */ +/* This variable is incremented each time 'error' is called. */ unsigned int error_message_count; #ifdef _LIBC @@ -65,7 +65,7 @@ unsigned int error_message_count; # include # include -/* In GNU libc we want do not want to use the common name `error' directly. +/* In GNU libc we want do not want to use the common name 'error' directly. Instead make it a weak alias. */ extern void __error (int status, int errnum, const char *message, ...) __attribute__ ((__format__ (__printf__, 3, 4))); @@ -89,19 +89,25 @@ extern void __error_at_line (int status, int errnum, const char *file_name, # include # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Get declarations of the Win32 API functions. */ +/* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" # endif /* The gnulib override of fcntl is not needed in this file. */ # undef fcntl -# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P +# if !HAVE_DECL_STRERROR_R # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" # endif +# if STRERROR_R_CHAR_P char *strerror_r (); +# else +int strerror_r (); +# endif # endif /* The calling program should define program_name and set it to the @@ -115,13 +121,14 @@ extern char *program_name; #if !_LIBC /* Return non-zero if FD is open. */ -static inline int +static int is_open (int fd) { # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* On Win32: The initial state of unassigned standard file descriptors is - that they are open but point to an INVALID_HANDLE_VALUE. There is no - fcntl, and the gnulib replacement fcntl does not support F_GETFL. */ + /* On native Windows: The initial state of unassigned standard file + descriptors is that they are open but point to an INVALID_HANDLE_VALUE. + There is no fcntl, and the gnulib replacement fcntl does not support + F_GETFL. */ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; # else # ifndef F_GETFL @@ -132,7 +139,7 @@ is_open (int fd) } #endif -static inline void +static void flush_stdout (void) { #if !_LIBC diff --git a/grub-core/gnulib/error.h b/grub-core/gnulib/error.h index 9deef02d2..afcb0e10c 100644 --- a/grub-core/gnulib/error.h +++ b/grub-core/gnulib/error.h @@ -1,6 +1,6 @@ /* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 1995-1997, 2003, 2006, 2008-2013 Free Software Foundation, + Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -19,39 +19,39 @@ #ifndef _ERROR_H #define _ERROR_H 1 -#ifndef __attribute__ /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. - We enable __attribute__ only if these are supported too, because + We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __attribute__(Spec) /* empty */ -# endif +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif #ifdef __cplusplus extern "C" { #endif -/* Print a message with `fprintf (stderr, FORMAT, ...)'; +/* Print a message with 'fprintf (stderr, FORMAT, ...)'; if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). - If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ + If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) - __attribute__ ((__format__ (__printf__, 5, 6))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6)); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ extern void (*error_print_progname) (void); -/* This variable is incremented each time `error' is called. */ +/* This variable is incremented each time 'error' is called. */ extern unsigned int error_message_count; /* Sometimes we want to have at most one error per line. This diff --git a/grub-core/gnulib/float+.h b/grub-core/gnulib/float+.h index b55e5e6de..32fb790bb 100644 --- a/grub-core/gnulib/float+.h +++ b/grub-core/gnulib/float+.h @@ -1,5 +1,5 @@ /* Supplemental information about the floating-point formats. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2007. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #ifndef _FLOATPLUS_H #define _FLOATPLUS_H @@ -141,8 +140,8 @@ #define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) /* Verify that SIZEOF_FLT <= sizeof (float) etc. */ -typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1]; -typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1]; -typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1]; +typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1]; +typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1]; +typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1]; #endif /* _FLOATPLUS_H */ diff --git a/grub-core/gnulib/float.c b/grub-core/gnulib/float.c new file mode 100644 index 000000000..366945fa3 --- /dev/null +++ b/grub-core/gnulib/float.c @@ -0,0 +1,33 @@ +/* Auxiliary definitions for . + Copyright (C) 2011-2013 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ +const union gl_long_double_union gl_LDBL_MAX = + { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } }; +#elif defined __i386__ +const union gl_long_double_union gl_LDBL_MAX = + { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } }; +#else +/* This declaration is solely to ensure that after preprocessing + this file is never empty. */ +typedef int dummy; +#endif diff --git a/grub-core/gnulib/float.in.h b/grub-core/gnulib/float.in.h index caf822f1d..84e1950f9 100644 --- a/grub-core/gnulib/float.in.h +++ b/grub-core/gnulib/float.in.h @@ -1,6 +1,6 @@ /* A correct . - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,19 +15,21 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef _GL_FLOAT_H +#ifndef _@GUARD_PREFIX@_FLOAT_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_FLOAT_H@ -#ifndef _GL_FLOAT_H -#define _GL_FLOAT_H +#ifndef _@GUARD_PREFIX@_FLOAT_H +#define _@GUARD_PREFIX@_FLOAT_H /* 'long double' properties. */ + #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) /* Number of mantissa units, in base FLT_RADIX. */ # undef LDBL_MANT_DIG @@ -58,5 +60,129 @@ # define LDBL_MAX_10_EXP 4932 #endif -#endif /* _GL_FLOAT_H */ -#endif /* _GL_FLOAT_H */ +/* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of + precision in the compiler but 64 bits of precision at runtime. See + . */ +#if defined __i386__ && defined __FreeBSD__ +/* Number of mantissa units, in base FLT_RADIX. */ +# undef LDBL_MANT_DIG +# define LDBL_MANT_DIG 64 +/* Number of decimal digits that is sufficient for representing a number. */ +# undef LDBL_DIG +# define LDBL_DIG 18 +/* x-1 where x is the smallest representable number > 1. */ +# undef LDBL_EPSILON +# define LDBL_EPSILON 1.084202172485504434007452800869941711426e-19L /* 2^-63 */ +/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ +# undef LDBL_MAX_EXP +# define LDBL_MAX_EXP 16384 +/* Minimum positive normalized number. */ +# undef LDBL_MIN +# define LDBL_MIN 3.3621031431120935E-4932L /* = 0x1p-16382L */ +/* Maximum representable finite number. */ +# undef LDBL_MAX +/* LDBL_MAX is represented as { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }. + But the largest literal that GCC allows us to write is + 0x0.fffffffffffff8p16384L = { 0xFFFFF800, 0xFFFFFFFF, 32766 }. + So, define it like this through a reference to an external variable + + const unsigned int LDBL_MAX[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 32766 }; + extern const long double LDBL_MAX; + + Unfortunately, this is not a constant expression. */ +union gl_long_double_union + { + struct { unsigned int lo; unsigned int hi; unsigned int exponent; } xd; + long double ld; + }; +extern const union gl_long_double_union gl_LDBL_MAX; +# define LDBL_MAX (gl_LDBL_MAX.ld) +/* Minimum e such that 10^e is in the range of normalized numbers. */ +# undef LDBL_MIN_10_EXP +# define LDBL_MIN_10_EXP (-4931) +/* Maximum e such that 10^e is in the range of representable finite numbers. */ +# undef LDBL_MAX_10_EXP +# define LDBL_MAX_10_EXP 4932 +#endif + +/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are + wrong. + On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */ +#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +# undef LDBL_MIN_10_EXP +# define LDBL_MIN_10_EXP DBL_MIN_10_EXP +# undef LDBL_MIN +# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ +#endif +#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ +# undef LDBL_MAX +/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }. + It is not easy to define: + #define LDBL_MAX 1.79769313486231580793728971405302307166e308L + is too small, whereas + #define LDBL_MAX 1.79769313486231580793728971405302307167e308L + is too large. Apparently a bug in GCC decimal-to-binary conversion. + Also, I can't get values larger than + #define LDBL63 ((long double) (1ULL << 63)) + #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) + #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) + #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63) + #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL) + which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }. + So, define it like this through a reference to an external variable + + const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }; + extern const long double LDBL_MAX; + + or through a pointer cast + + #define LDBL_MAX \ + (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }) + + Unfortunately, this is not a constant expression, and the latter expression + does not work well when GCC is optimizing.. */ +union gl_long_double_union + { + struct { double hi; double lo; } dd; + long double ld; + }; +extern const union gl_long_double_union gl_LDBL_MAX; +# define LDBL_MAX (gl_LDBL_MAX.ld) +#endif + +/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong. + On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON + are wrong. */ +#if defined __sgi && (LDBL_MANT_DIG >= 106) +# undef LDBL_MANT_DIG +# define LDBL_MANT_DIG 106 +# if defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +# undef LDBL_MIN_10_EXP +# define LDBL_MIN_10_EXP DBL_MIN_10_EXP +# undef LDBL_MIN +# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ +# undef LDBL_EPSILON +# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ +# endif +#endif + +#if @REPLACE_ITOLD@ +/* Pull in a function that fixes the 'int' to 'long double' conversion + of glibc 2.7. */ +extern +# ifdef __cplusplus +"C" +# endif +void _Qp_itoq (long double *, int); +static void (*_gl_float_fix_itold) (long double *, int) = _Qp_itoq; +#endif + +#endif /* _@GUARD_PREFIX@_FLOAT_H */ +#endif /* _@GUARD_PREFIX@_FLOAT_H */ diff --git a/grub-core/gnulib/fnmatch.c b/grub-core/gnulib/fnmatch.c index d73e47dae..6a09e1a9b 100644 --- a/grub-core/gnulib/fnmatch.c +++ b/grub-core/gnulib/fnmatch.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-2007, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +11,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #ifndef _LIBC # include @@ -43,7 +41,7 @@ (HAVE_WCTYPE_H && HAVE_BTOWC && HAVE_ISWCTYPE \ && HAVE_WMEMCHR && (HAVE_WMEMCPY || HAVE_WMEMPCPY)) -/* For platform which support the ISO C amendement 1 functionality we +/* For platform which support the ISO C amendment 1 functionality we support user defined character classes. */ #if defined _LIBC || WIDE_CHAR_SUPPORT # include @@ -79,7 +77,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags); Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, + program understand 'configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU @@ -93,7 +91,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags); # if defined _LIBC || WIDE_CHAR_SUPPORT /* The GNU C library provides support for user-defined character classes - and the functions from ISO C amendement 1. */ + and the functions from ISO C amendment 1. */ # ifdef CHARCLASS_NAME_MAX # define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX # else @@ -120,7 +118,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags); # endif # else -# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ +# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, 'xdigit'. */ # define IS_CHAR_CLASS(string) \ (STREQ (string, "alpha") || STREQ (string, "upper") \ @@ -169,7 +167,6 @@ static int posixly_correct; # endif # endif # define MEMCHR(S, C, N) memchr (S, C, N) -# define STRCOLL(S1, S2) strcoll (S1, S2) # include "fnmatch_loop.c" @@ -197,7 +194,6 @@ static int posixly_correct; # endif # endif # define MEMCHR(S, C, N) wmemchr (S, C, N) -# define STRCOLL(S1, S2) wcscoll (S1, S2) # define WIDE_CHAR_VERSION 1 # undef IS_CHAR_CLASS diff --git a/grub-core/gnulib/fnmatch.in.h b/grub-core/gnulib/fnmatch.in.h index 8caab1959..d39ce2f1c 100644 --- a/grub-core/gnulib/fnmatch.in.h +++ b/grub-core/gnulib/fnmatch.in.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003, - 2005, 2007, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2013 Free + Software Foundation, Inc. This file is part of the GNU C Library. @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #ifndef _FNMATCH_H #define _FNMATCH_H 1 @@ -32,23 +31,23 @@ extern "C" { #undef FNM_NOESCAPE #undef FNM_PERIOD -/* Bits set in the FLAGS argument to `fnmatch'. */ -#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +/* Bits set in the FLAGS argument to 'fnmatch'. */ +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match '/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ -#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ +#define FNM_PERIOD (1 << 2) /* Leading '.' is matched only explicitly. */ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ -# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ +# define FNM_LEADING_DIR (1 << 3) /* Ignore '/...' after a match. */ # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ # define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */ #endif -/* Value returned by `fnmatch' if STRING does not match PATTERN. */ +/* Value returned by 'fnmatch' if STRING does not match PATTERN. */ #define FNM_NOMATCH 1 /* This value is returned if the implementation does not support - `fnmatch'. Since this is not the case here it will never be + 'fnmatch'. Since this is not the case here it will never be returned but the conformance test suites still require the symbol to be defined. */ #ifdef _XOPEN_SOURCE diff --git a/grub-core/gnulib/fnmatch_loop.c b/grub-core/gnulib/fnmatch_loop.c index 741c993ef..f57cd63f9 100644 --- a/grub-core/gnulib/fnmatch_loop.c +++ b/grub-core/gnulib/fnmatch_loop.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-2006, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -13,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ /* Match STRING against the file name pattern PATTERN, returning zero if it matches, nonzero if not. */ @@ -201,6 +199,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, case L_('['): { /* Nonzero if the sense of the character class is inverted. */ + const CHAR *p_init = p; + const CHAR *n_init = n; register bool not; CHAR cold; UCHAR fn; @@ -215,7 +215,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, return FNM_NOMATCH; if (*n == L_('/') && (flags & FNM_FILE_NAME)) - /* `/' cannot be matched. */ + /* '/' cannot be matched. */ return FNM_NOMATCH; not = (*p == L_('!') || (posixly_correct < 0 && *p == L_('^'))); @@ -381,7 +381,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, { /* We found a table entry. Now see whether the character we are currently at has the same - equivalance class value. */ + equivalence class value. */ int len = weights[idx & 0xffffff]; int32_t idx2; const UCHAR *np = (const UCHAR *) n; @@ -411,8 +411,13 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, } #endif else if (c == L_('\0')) - /* [ (unterminated) loses. */ - return FNM_NOMATCH; + { + /* [ unterminated, treat as normal character. */ + p = p_init; + n = n_init; + c = L_('['); + goto normal_match; + } else { bool is_range = false; @@ -630,7 +635,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, UCHAR cend = *p++; # ifdef WIDE_CHAR_VERSION - /* Search in the `names' array for the characters. */ + /* Search in the 'names' array for the characters. */ fcollseq = __collseq_table_lookup (collseq, fn); if (fcollseq == ~((uint32_t) 0)) /* XXX We don't know anything about the character @@ -833,7 +838,7 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, #else /* We use a boring value comparison of the character values. This is better than comparing using - `strcoll' since the latter would have surprising + 'strcoll' since the latter would have surprising and sometimes fatal consequences. */ UCHAR cend = *p++; @@ -1150,7 +1155,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, case L_('@'): do - /* I cannot believe it but `strcat' is actually acceptable + /* I cannot believe it but 'strcat' is actually acceptable here. Match the entire string with the prefix from the pattern list and the rest of the pattern following the pattern list. */ @@ -1208,7 +1213,6 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, #undef END #undef MEMPCPY #undef MEMCHR -#undef STRCOLL #undef STRLEN #undef STRCAT #undef L_ diff --git a/grub-core/gnulib/getdelim.c b/grub-core/gnulib/getdelim.c index 66d07b9ae..fdbcde2a2 100644 --- a/grub-core/gnulib/getdelim.c +++ b/grub-core/gnulib/getdelim.c @@ -1,6 +1,6 @@ /* getdelim.c --- Implementation of replacement getdelim function. - Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2013 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -13,18 +13,16 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program; if not, see . */ /* Ported from glibc by Simon Josefsson. */ -#include - /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */ #define _GL_ARG_NONNULL(params) +#include + #include #include diff --git a/grub-core/gnulib/getline.c b/grub-core/gnulib/getline.c index 30c076e87..1aa07b9c7 100644 --- a/grub-core/gnulib/getline.c +++ b/grub-core/gnulib/getline.c @@ -1,5 +1,5 @@ /* getline.c --- Implementation of replacement getline function. - Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -12,9 +12,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program; if not, see . */ /* Written by Simon Josefsson. */ diff --git a/grub-core/gnulib/getopt.c b/grub-core/gnulib/getopt.c index 3791f1293..ef0f4ceec 100644 --- a/grub-core/gnulib/getopt.c +++ b/grub-core/gnulib/getopt.c @@ -2,7 +2,7 @@ NOTE: getopt is part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2010 Free Software + Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -41,15 +41,15 @@ # include #endif -/* This version of `getopt' appears to the caller like standard Unix `getopt' +/* This version of 'getopt' appears to the caller like standard Unix 'getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. - As `getopt_long' works, it permutes the elements of ARGV so that, + As 'getopt_long' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. - Using `getopt' or setting the environment variable POSIXLY_CORRECT + Using 'getopt' or setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. @@ -58,24 +58,24 @@ #include "getopt_int.h" -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, +/* For communication from 'getopt' to the caller. + When 'getopt' finds an option that takes an argument, the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, + Also, when 'ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller - and for communication between successive calls to `getopt'. + and for communication between successive calls to 'getopt'. - On entry to `getopt', zero means this is the first call; initialize. + On entry to 'getopt', zero means this is the first call; initialize. - When `getopt' returns -1, this is the index of the first of the + When 'getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. - Otherwise, `optind' communicates from one call to the next + Otherwise, 'optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ @@ -137,7 +137,7 @@ extern char *__getopt_nonoption_flags; The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. - `first_nonopt' and `last_nonopt' are relocated so that they describe + 'first_nonopt' and 'last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void @@ -154,7 +154,7 @@ exchange (char **argv, struct _getopt_data *d) but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS - /* First make sure the handling of the `__getopt_nonoption_flags' + /* First make sure the handling of the '__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) @@ -291,48 +291,48 @@ _getopt_initialize (int argc _GL_UNUSED, If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' + (aside from the initial '-') are option characters. If 'getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can + If 'getopt' finds another option character, it returns that character, + updating 'optind' and 'nextchar' so that the next call to 'getopt' can resume the scan with the following option character or ARGV-element. - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element + If there are no more option characters, 'getopt' returns -1. + Then 'optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to + return '?' after printing an error message. If you set 'opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that + ARGV-element, is returned in 'optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. + it is returned in 'optarg', otherwise 'optarg' is set to zero. - If OPTSTRING starts with `-' or `+', it requests different methods of + If OPTSTRING starts with '-' or '+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - Long-named options begin with `--' instead of `-'. + Long-named options begin with '--' instead of '-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. + from the option name by a '=', or else the in next ARGV-element. + When 'getopt' finds a long-named option, it returns 0 if that option's + 'flag' field is nonzero, the value of the option's 'val' field + if the 'flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. - LONGOPTS is a vector of `struct option' terminated by an + LONGOPTS is a vector of 'struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. @@ -409,7 +409,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, d->__last_nonopt = d->optind; } - /* The special ARGV-element `--' means premature end of options. + /* The special ARGV-element '--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ @@ -479,23 +479,28 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, || !strchr (optstring, argv[d->optind][1]))))) { char *nameend; + unsigned int namelen; const struct option *p; const struct option *pfound = NULL; + struct option_list + { + const struct option *p; + struct option_list *next; + } *ambig_list = NULL; int exact = 0; - int ambig = 0; int indfound = -1; int option_index; for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; + namelen = nameend - d->__nextchar; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) + if (!strncmp (p->name, d->__nextchar, namelen)) { - if ((unsigned int) (nameend - d->__nextchar) - == (unsigned int) strlen (p->name)) + if (namelen == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -513,35 +518,71 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) - /* Second or later nonexact match found. */ - ambig = 1; + { + /* Second or later nonexact match found. */ + struct option_list *newp = malloc (sizeof (*newp)); + newp->p = p; + newp->next = ambig_list; + ambig_list = newp; + } } - if (ambig && !exact) + if (ambig_list != NULL && !exact) { if (print_errors) { + struct option_list first; + first.p = pfound; + first.next = ambig_list; + ambig_list = &first; + #if defined _LIBC && defined USE_IN_LIBIO - char *buf; + char *buf = NULL; + size_t buflen = 0; - if (__asprintf (&buf, _("%s: option '%s' is ambiguous\n"), - argv[0], argv[d->optind]) >= 0) + FILE *fp = open_memstream (&buf, &buflen); + if (fp != NULL) { - _IO_flockfile (stderr); + fprintf (fp, + _("%s: option '%s' is ambiguous; possibilities:"), + argv[0], argv[d->optind]); - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + do + { + fprintf (fp, " '--%s'", ambig_list->p->name); + ambig_list = ambig_list->next; + } + while (ambig_list != NULL); - __fxprintf (NULL, "%s", buf); + fputc_unlocked ('\n', fp); - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); + if (__builtin_expect (fclose (fp) != EOF, 1)) + { + _IO_flockfile (stderr); - free (buf); + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } } #else - fprintf (stderr, _("%s: option '%s' is ambiguous\n"), + fprintf (stderr, + _("%s: option '%s' is ambiguous; possibilities:"), argv[0], argv[d->optind]); + do + { + fprintf (stderr, " '--%s'", ambig_list->p->name); + ambig_list = ambig_list->next; + } + while (ambig_list != NULL); + + fputc ('\n', stderr); #endif } d->__nextchar += strlen (d->__nextchar); @@ -550,6 +591,13 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, return '?'; } + while (ambig_list != NULL) + { + struct option_list *pn = ambig_list->next; + free (ambig_list); + ambig_list = pn; + } + if (pfound != NULL) { option_index = indfound; @@ -740,7 +788,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, char c = *d->__nextchar++; const char *temp = strchr (optstring, c); - /* Increment `optind' when we start to process its last character. */ + /* Increment 'optind' when we start to process its last character. */ if (*d->__nextchar == '\0') ++d->optind; @@ -791,6 +839,9 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, int indfound = 0; int option_index; + if (longopts == NULL) + goto no_longs; + /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { @@ -836,7 +887,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, return c; } else - /* We already incremented `d->optind' once; + /* We already incremented 'd->optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; @@ -998,8 +1049,10 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, } return pfound->val; } - d->__nextchar = NULL; - return 'W'; /* Let the application handle it. */ + + no_longs: + d->__nextchar = NULL; + return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { @@ -1061,7 +1114,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, c = '?'; } else - /* We already incremented `optind' once; + /* We already incremented 'optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; d->__nextchar = NULL; @@ -1124,7 +1177,7 @@ __posix_getopt (int argc, char *const *argv, const char *optstring) #ifdef TEST /* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ + the above definition of 'getopt'. */ int main (int argc, char **argv) diff --git a/grub-core/gnulib/getopt.in.h b/grub-core/gnulib/getopt.in.h index 57a8e8992..d9c7d8144 100644 --- a/grub-core/gnulib/getopt.in.h +++ b/grub-core/gnulib/getopt.in.h @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2010 Free Software + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,11 +16,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef _GL_GETOPT_H +#ifndef _@GUARD_PREFIX@_GETOPT_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. We must also inform the replacement unistd.h to not recursively use @@ -31,10 +32,10 @@ # undef _GL_SYSTEM_GETOPT #endif -#ifndef _GL_GETOPT_H +#ifndef _@GUARD_PREFIX@_GETOPT_H #ifndef __need_getopt -# define _GL_GETOPT_H 1 +# define _@GUARD_PREFIX@_GETOPT_H 1 #endif /* Standalone applications should #define __GETOPT_PREFIX to an @@ -48,7 +49,9 @@ linkers. */ #if defined __GETOPT_PREFIX && !defined __need_getopt # if !@HAVE_GETOPT_H@ +# define __need_system_stdlib_h # include +# undef __need_system_stdlib_h # include # include # endif @@ -81,7 +84,7 @@ getopt_long_only can permute argv; this is required for backward compatibility (e.g., for LSB 2.0.1). - This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', + This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt', but it caused redefinition warnings if both unistd.h and getopt.h were included, since unistd.h includes getopt.h having previously defined __need_getopt. @@ -127,29 +130,29 @@ extern "C" { #endif -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, +/* For communication from 'getopt' to the caller. + When 'getopt' finds an option that takes an argument, the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, + Also, when 'ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller - and for communication between successive calls to `getopt'. + and for communication between successive calls to 'getopt'. - On entry to `getopt', zero means this is the first call; initialize. + On entry to 'getopt', zero means this is the first call; initialize. - When `getopt' returns -1, this is the index of the first of the + When 'getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. - Otherwise, `optind' communicates from one call to the next + Otherwise, 'optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; -/* Callers store zero here to inhibit the error message `getopt' prints +/* Callers store zero here to inhibit the error message 'getopt' prints for unrecognized options. */ extern int opterr; @@ -161,25 +164,26 @@ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is + of 'struct option' terminated by an element containing a name which is zero. - The field `has_arg' is: + The field 'has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but + If the field 'flag' is not NULL, it points to a variable that is set + to the value given in the field 'val' when the option is found, but left unchanged if the option is not found. - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero + To have a long-named option do something other than set an 'int' to + a compiled-in constant, such as set a value from 'optarg', set the + option's 'flag' field to zero and its 'val' field to a nonzero value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ + one). For long options that have a zero 'flag' field, 'getopt' + returns the contents of the 'val' field. */ +# if !GNULIB_defined_struct_option struct option { const char *name; @@ -189,8 +193,10 @@ struct option int *flag; int val; }; +# define GNULIB_defined_struct_option 1 +# endif -/* Names for the values of the `has_arg' field of `struct option'. */ +/* Names for the values of the 'has_arg' field of 'struct option'. */ # define no_argument 0 # define required_argument 1 @@ -204,23 +210,23 @@ struct option Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is + missing arguments, 'optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. + takes an argument, to be placed in 'optarg'. If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. + optional. This behavior is specific to the GNU 'getopt'. - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more + The argument '--' causes premature termination of argument + scanning, explicitly telling 'getopt' that there are no more options. - If OPTS begins with `-', then non-option arguments are treated as + If OPTS begins with '-', then non-option arguments are treated as arguments to the option '\1'. This behavior is specific to the GNU - `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in + 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in the environment, then do not permute arguments. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) @@ -245,5 +251,5 @@ extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt -#endif /* getopt.h */ -#endif /* getopt.h */ +#endif /* _@GUARD_PREFIX@_GETOPT_H */ +#endif /* _@GUARD_PREFIX@_GETOPT_H */ diff --git a/grub-core/gnulib/getopt1.c b/grub-core/gnulib/getopt1.c index 046d69f94..55a6b4eae 100644 --- a/grub-core/gnulib/getopt1.c +++ b/grub-core/gnulib/getopt1.c @@ -1,6 +1,6 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, - 1998, 2004, 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2013 Free Software + Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -141,11 +141,11 @@ main (int argc, char **argv) break; case 'c': - printf ("option c with value `%s'\n", optarg); + printf ("option c with value '%s'\n", optarg); break; case 'd': - printf ("option d with value `%s'\n", optarg); + printf ("option d with value '%s'\n", optarg); break; case '?': diff --git a/grub-core/gnulib/getopt_int.h b/grub-core/gnulib/getopt_int.h index 980b7507f..a6e4b9ea7 100644 --- a/grub-core/gnulib/getopt_int.h +++ b/grub-core/gnulib/getopt_int.h @@ -1,5 +1,5 @@ /* Internal declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2010 Free Software + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -40,7 +40,7 @@ extern int _getopt_internal (int ___argc, char **___argv, stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character + variable POSIXLY_CORRECT, or using '+' as the first character of the list of option characters, or by calling getopt. PERMUTE is the default. We permute the contents of ARGV as we @@ -52,12 +52,12 @@ extern int _getopt_internal (int ___argc, char **___argv, written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option - with character code 1. Using `-' as the first character of the + with character code 1. Using '-' as the first character of the list of option characters selects this mode of operation. - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + The special argument '--' forces an end of option-scanning regardless + of the value of 'ordering'. In the case of RETURN_IN_ORDER, only + '--' can cause 'getopt' to return -1 with 'optind' != ARGC. */ enum __ord { @@ -99,8 +99,8 @@ struct _getopt_data /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first - of them; `last_nonopt' is the index after the last of them. */ + been skipped. 'first_nonopt' is the index in ARGV of the first + of them; 'last_nonopt' is the index after the last of them. */ int __first_nonopt; int __last_nonopt; @@ -108,7 +108,7 @@ struct _getopt_data #if defined _LIBC && defined USE_NONOPTION_FLAGS int __nonoption_flags_max_len; int __nonoption_flags_len; -# endif +#endif }; /* The initializer is necessary to set OPTIND and OPTERR to their diff --git a/grub-core/gnulib/gettext.h b/grub-core/gnulib/gettext.h index 881ae3304..d0215715a 100644 --- a/grub-core/gnulib/gettext.h +++ b/grub-core/gnulib/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 @@ -54,7 +53,7 @@ it now, to make later inclusions of a NOP. */ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) # include -# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H # include # endif #endif @@ -93,6 +92,12 @@ #endif +/* Prefer gnulib's setlocale override over libintl's setlocale override. */ +#ifdef GNULIB_defined_setlocale +# undef setlocale +# define setlocale rpl_setlocale +#endif + /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. @@ -178,9 +183,12 @@ npgettext_aux (const char *domain, #include -#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ - (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ - /* || __STDC_VERSION__ >= 199901L */ ) +#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ + /* || __STDC_VERSION__ >= 199901L */ ) +# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 +#else +# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 +#endif #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #include diff --git a/grub-core/gnulib/intprops.h b/grub-core/gnulib/intprops.h index 46f4d47d7..b473052d1 100644 --- a/grub-core/gnulib/intprops.h +++ b/grub-core/gnulib/intprops.h @@ -1,7 +1,6 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 2001-2005, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,66 +17,303 @@ /* Written by Paul Eggert. */ -#ifndef GL_INTPROPS_H -# define GL_INTPROPS_H +#ifndef _GL_INTPROPS_H +#define _GL_INTPROPS_H -# include +#include + +/* Return an integer value, converted to the same type as the integer + expression E after integer type promotion. V is the unconverted value. */ +#define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) + +/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see + . */ +#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v)) /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ /* True if the arithmetic type T is an integer type. bool counts as an integer. */ -# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) /* True if negative values of the signed integer type T use two's complement, ones' complement, or signed magnitude representation, respectively. Much GNU code assumes two's complement, but some people like to be portable to all possible C hosts. */ -# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) +#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) + +/* True if the signed integer expression E uses two's complement. */ +#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1) /* True if the arithmetic type T is signed. */ -# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) -/* The maximum and minimum values for the integer type T. These +/* Return 1 if the integer expression E, after integer promotion, has + a signed type. */ +#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) + + +/* Minimum and maximum values for integer types and expressions. These macros have undefined behavior if T is signed and has padding bits. If this is a problem for you, please let us know how to fix it for your host. */ -# define TYPE_MINIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) -# define TYPE_MAXIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) -/* Return zero if T can be determined to be an unsigned type. - Otherwise, return 1. - When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a - tighter bound. Otherwise, it overestimates the true bound by one byte - when applied to unsigned types of size 2, 4, 16, ... bytes. - The symbol signed_type_or_expr__ is private to this header file. */ -# if __GNUC__ >= 2 -# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) -# else -# define signed_type_or_expr__(t) 1 -# endif +/* The maximum and minimum values for the integer type T. */ +#define TYPE_MINIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ + : ~ TYPE_MAXIMUM (t))) +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) + +/* The maximum and minimum values for the type of the expression E, + after integer promotion. E should not have side effects. */ +#define _GL_INT_MINIMUM(e) \ + (_GL_INT_SIGNED (e) \ + ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_CONVERT (e, 0)) +#define _GL_INT_MAXIMUM(e) \ + (_GL_INT_SIGNED (e) \ + ? _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_NEGATE_CONVERT (e, 1)) +#define _GL_SIGNED_INT_MAXIMUM(e) \ + (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) + + +/* Return 1 if the __typeof__ keyword works. This could be done by + 'configure', but for now it's easier to do it by hand. */ +#if 2 <= __GNUC__ || 0x5110 <= __SUNPRO_C +# define _GL_HAVE___TYPEOF__ 1 +#else +# define _GL_HAVE___TYPEOF__ 0 +#endif + +/* Return 1 if the integer type or expression T might be signed. Return 0 + if it is definitely unsigned. This macro does not evaluate its argument, + and expands to an integer constant expression. */ +#if _GL_HAVE___TYPEOF__ +# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define _GL_SIGNED_TYPE_OR_EXPR(t) 1 +#endif + +/* Bound on length of the string representing an unsigned integer + value representable in B bits. log10 (2.0) < 146/485. The + smallest value of B where this bound is not tight is 2621. */ +#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) /* Bound on length of the string representing an integer type or expression T. - Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485; - add 1 for integer division truncation; add 1 more for a minus sign - if needed. */ -# define INT_STRLEN_BOUND(t) \ - ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \ - + signed_type_or_expr__ (t) + 1) + Subtract 1 for the sign bit if T is signed, and then add 1 more for + a minus sign if needed. + + Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is + signed, this macro may overestimate the true bound by one byte when + applied to unsigned types of size 2, 4, 16, ... bytes. */ +#define INT_STRLEN_BOUND(t) \ + (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ + - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + + _GL_SIGNED_TYPE_OR_EXPR (t)) /* Bound on buffer size needed to represent an integer type or expression T, including the terminating null. */ -# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) -#endif /* GL_INTPROPS_H */ + +/* Range overflow checks. + + The INT__RANGE_OVERFLOW macros return 1 if the corresponding C + operators might not yield numerically correct answers due to + arithmetic overflow. They do not rely on undefined or + implementation-defined behavior. Their implementations are simple + and straightforward, but they are a bit harder to use than the + INT__OVERFLOW macros described below. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + Restrictions on *_RANGE_OVERFLOW macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, + so the arguments should not have side effects. The arithmetic + arguments (including the MIN and MAX arguments) must be of the same + integer type after the usual arithmetic conversions, and the type + must have minimum value MIN and maximum MAX. Unsigned types should + use a zero MIN of the proper type. + + These macros are tuned for constant MIN and MAX. For commutative + operations such as A + B, they are also tuned for constant B. */ + +/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (a) < (min) - (b) \ + : (max) - (b) < (a)) + +/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (max) + (b) < (a) \ + : (a) < (min) + (b)) + +/* Return 1 if - A would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ + ((min) < 0 \ + ? (a) < - (max) \ + : 0 < (a)) + +/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Avoid && and || as they tickle + bugs in Sun C 5.11 2010/08/13 and other compilers; see + . */ +#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (a) < (max) / (b) \ + : (b) == -1 \ + ? 0 \ + : (min) / (b) < (a)) \ + : (b) == 0 \ + ? 0 \ + : ((a) < 0 \ + ? (a) < (min) / (b) \ + : (max) / (b) < (a))) + +/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. */ +#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ + ((min) < 0 && (b) == -1 && (a) < - (max)) + +/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. + Mathematically, % should never overflow, but on x86-like hosts + INT_MIN % -1 traps, and the C standard permits this, so treat this + as an overflow too. */ +#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ + INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max) + +/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Here, MIN and MAX are for A only, and B need + not be of the same type as the other arguments. The C standard says that + behavior is undefined for shifts unless 0 <= B < wordwidth, and that when + A is negative then A << B has undefined behavior and A >> B has + implementation-defined behavior, but do not check these other + restrictions. */ +#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ + ((a) < 0 \ + ? (a) < (min) >> (b) \ + : (max) >> (b) < (a)) + + +/* The _GL*_OVERFLOW macros have the same restrictions as the + *_RANGE_OVERFLOW macros, except that they do not assume that operands + (e.g., A and B) have the same type as MIN and MAX. Instead, they assume + that the result (e.g., A + B) has that type. */ +#define _GL_ADD_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? (b) <= (a) + (b) \ + : (b) < 0 ? (a) <= (a) + (b) \ + : (a) + (b) < (b)) +#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? 1 \ + : (b) < 0 ? (a) - (b) <= (a) \ + : (a) < (b)) +#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ + || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (b) <= (a) + (b) - 1 \ + : (b) < 0 && (a) + (b) <= (a)) +#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ + : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) + +/* Return a nonzero value if A is a mathematical multiple of B, where + A is unsigned, B is negative, and MAX is the maximum value of A's + type. A's type must be the same as (A % B)'s type. Normally (A % + -B == 0) suffices, but things get tricky if -B would overflow. */ +#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ + (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \ + ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \ + ? (a) \ + : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \ + : (a) % - (b)) \ + == 0) + + +/* Integer overflow checks. + + The INT__OVERFLOW macros return 1 if the corresponding C operators + might not yield numerically correct answers due to arithmetic overflow. + They work correctly on all known practical hosts, and do not rely + on undefined behavior due to signed arithmetic overflow. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_OVERFLOW (i, j)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, so the + arguments should not have side effects. + + These macros are tuned for their last argument being a constant. + + Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, + A % B, and A << B would overflow, respectively. */ + +#define INT_ADD_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) +#define INT_SUBTRACT_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) +#define INT_NEGATE_OVERFLOW(a) \ + INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#define INT_MULTIPLY_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) +#define INT_DIVIDE_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW) +#define INT_REMAINDER_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW) +#define INT_LEFT_SHIFT_OVERFLOW(a, b) \ + INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \ + _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) + +/* Return 1 if the expression A B would overflow, + where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test, + assuming MIN and MAX are the minimum and maximum for the result type. + Arguments should be free of side effects. */ +#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ + op_result_overflow (a, b, \ + _GL_INT_MINIMUM (0 * (b) + (a)), \ + _GL_INT_MAXIMUM (0 * (b) + (a))) + +#endif /* _GL_INTPROPS_H */ diff --git a/grub-core/gnulib/itold.c b/grub-core/gnulib/itold.c new file mode 100644 index 000000000..9aabc7e46 --- /dev/null +++ b/grub-core/gnulib/itold.c @@ -0,0 +1,28 @@ +/* Replacement for 'int' to 'long double' conversion routine. + Copyright (C) 2011-2013 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +void +_Qp_itoq (long double *result, int a) +{ + /* Convert from 'int' to 'double', then from 'double' to 'long double'. */ + *result = (double) a; +} diff --git a/grub-core/gnulib/langinfo.in.h b/grub-core/gnulib/langinfo.in.h index 3a92647b9..5388ce624 100644 --- a/grub-core/gnulib/langinfo.in.h +++ b/grub-core/gnulib/langinfo.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around . - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,27 +12,27 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ /* * POSIX for platforms that lack it or have an incomplete one. * */ -#ifndef _GL_LANGINFO_H +#ifndef _@GUARD_PREFIX@_LANGINFO_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_LANGINFO_H@ # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@ #endif -#ifndef _GL_LANGINFO_H -#define _GL_LANGINFO_H +#ifndef _@GUARD_PREFIX@_LANGINFO_H +#define _@GUARD_PREFIX@_LANGINFO_H #if !@HAVE_LANGINFO_H@ @@ -40,7 +40,10 @@ /* A platform that lacks . */ /* Assume that it also lacks and the nl_item type. */ +# if !GNULIB_defined_nl_item typedef int nl_item; +# define GNULIB_defined_nl_item 1 +# endif /* nl_langinfo items of the LC_CTYPE category */ # define CODESET 10000 @@ -169,5 +172,5 @@ _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - " #endif -#endif /* _GL_LANGINFO_H */ -#endif /* _GL_LANGINFO_H */ +#endif /* _@GUARD_PREFIX@_LANGINFO_H */ +#endif /* _@GUARD_PREFIX@_LANGINFO_H */ diff --git a/grub-core/gnulib/localcharset.c b/grub-core/gnulib/localcharset.c index fa2207fe1..953cc1e70 100644 --- a/grub-core/gnulib/localcharset.c +++ b/grub-core/gnulib/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ /* Written by Bruno Haible . */ @@ -30,11 +29,11 @@ #include #if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET -# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */ +# define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */ #endif #if defined _WIN32 || defined __WIN32__ -# define WIN32_NATIVE +# define WINDOWS_NATIVE #endif #if defined __EMX__ @@ -44,7 +43,7 @@ # endif #endif -#if !defined WIN32_NATIVE +#if !defined WINDOWS_NATIVE # include # if HAVE_LANGINFO_CODESET # include @@ -57,7 +56,7 @@ # define WIN32_LEAN_AND_MEAN # include # endif -#elif defined WIN32_NATIVE +#elif defined WINDOWS_NATIVE # define WIN32_LEAN_AND_MEAN # include #endif @@ -83,7 +82,7 @@ #endif #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ - /* Win32, Cygwin, OS/2, DOS */ + /* Native Windows, Cygwin, OS/2, DOS */ # define ISSLASH(C) ((C) == '/' || (C) == '\\') #endif @@ -123,7 +122,7 @@ get_charset_aliases (void) cp = charset_aliases; if (cp == NULL) { -#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__) +#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__) const char *dir; const char *base = "charset.alias"; char *file_name; @@ -228,8 +227,7 @@ get_charset_aliases (void) { /* Out of memory. */ res_size = 0; - if (old_res_ptr != NULL) - free (old_res_ptr); + free (old_res_ptr); break; } strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); @@ -309,7 +307,7 @@ get_charset_aliases (void) "DECKOREAN" "\0" "EUC-KR" "\0"; # endif -# if defined WIN32_NATIVE || defined __CYGWIN__ +# if defined WINDOWS_NATIVE || defined __CYGWIN__ /* To avoid the troubles of installing a separate file in the same directory as the DLL and of retrieving the DLL's directory at runtime, simply inline the aliases here. */ @@ -361,7 +359,7 @@ locale_charset (void) const char *codeset; const char *aliases; -#if !(defined WIN32_NATIVE || defined OS2) +#if !(defined WINDOWS_NATIVE || defined OS2) # if HAVE_LANGINFO_CODESET @@ -408,10 +406,10 @@ locale_charset (void) } } - /* Woe32 has a function returning the locale's codepage as a number: - GetACP(). This encoding is used by Cygwin, unless the user has set - the environment variable CYGWIN=codepage:oem (which very few people - do). + /* The Windows API has a function returning the locale's codepage as a + number: GetACP(). This encoding is used by Cygwin, unless the user + has set the environment variable CYGWIN=codepage:oem (which very few + people do). Output directed to console windows needs to be converted (to GetOEMCP() if the console is using a raster font, or to GetConsoleOutputCP() if it is using a TrueType font). Cygwin does @@ -454,12 +452,12 @@ locale_charset (void) # endif -#elif defined WIN32_NATIVE +#elif defined WINDOWS_NATIVE static char buf[2 + 10 + 1]; - /* Woe32 has a function returning the locale's codepage as a number: - GetACP(). + /* The Windows API has a function returning the locale's codepage as a + number: GetACP(). When the output goes to a console window, it needs to be provided in GetOEMCP() encoding if the console is using a raster font, or in GetConsoleOutputCP() encoding if it is using a TrueType font. @@ -544,5 +542,12 @@ locale_charset (void) if (codeset[0] == '\0') codeset = "ASCII"; +#ifdef DARWIN7 + /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8" + (the default codeset) does not work when MB_CUR_MAX is 1. */ + if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX <= 1) + codeset = "ASCII"; +#endif + return codeset; } diff --git a/grub-core/gnulib/localcharset.h b/grub-core/gnulib/localcharset.h index 899b3bae7..c20982986 100644 --- a/grub-core/gnulib/localcharset.h +++ b/grub-core/gnulib/localcharset.h @@ -1,5 +1,5 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2003, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ #ifndef _LOCALCHARSET_H #define _LOCALCHARSET_H diff --git a/grub-core/gnulib/locale.in.h b/grub-core/gnulib/locale.in.h new file mode 100644 index 000000000..264161a6c --- /dev/null +++ b/grub-core/gnulib/locale.in.h @@ -0,0 +1,216 @@ +/* A POSIX . + Copyright (C) 2007-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#ifdef _GL_ALREADY_INCLUDING_LOCALE_H + +/* Special invocation conventions to handle Solaris header files + (through Solaris 10) when combined with gettext's libintl.h. */ + +#@INCLUDE_NEXT@ @NEXT_LOCALE_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_LOCALE_H + +#define _GL_ALREADY_INCLUDING_LOCALE_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_LOCALE_H@ + +#undef _GL_ALREADY_INCLUDING_LOCALE_H + +#ifndef _@GUARD_PREFIX@_LOCALE_H +#define _@GUARD_PREFIX@_LOCALE_H + +/* NetBSD 5.0 mis-defines NULL. */ +#include + +/* Mac OS X 10.5 defines the locale_t type in . */ +#if @HAVE_XLOCALE_H@ +# include +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C. + On systems that don't define it, use the same value as GNU libintl. */ +#if !defined LC_MESSAGES +# define LC_MESSAGES 1729 +#endif + +/* Bionic libc's 'struct lconv' is just a dummy. */ +#if @REPLACE_STRUCT_LCONV@ +# define lconv rpl_lconv +struct lconv +{ + /* All 'char *' are actually 'const char *'. */ + + /* Members that depend on the LC_NUMERIC category of the locale. See + */ + + /* Symbol used as decimal point. */ + char *decimal_point; + /* Symbol used to separate groups of digits to the left of the decimal + point. */ + char *thousands_sep; + /* Definition of the size of groups of digits to the left of the decimal + point. */ + char *grouping; + + /* Members that depend on the LC_MONETARY category of the locale. See + */ + + /* Symbol used as decimal point. */ + char *mon_decimal_point; + /* Symbol used to separate groups of digits to the left of the decimal + point. */ + char *mon_thousands_sep; + /* Definition of the size of groups of digits to the left of the decimal + point. */ + char *mon_grouping; + /* Sign used to indicate a value >= 0. */ + char *positive_sign; + /* Sign used to indicate a value < 0. */ + char *negative_sign; + + /* For formatting local currency. */ + /* Currency symbol (3 characters) followed by separator (1 character). */ + char *currency_symbol; + /* Number of digits after the decimal point. */ + char frac_digits; + /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it + comes after the number. */ + char p_cs_precedes; + /* For values >= 0: Position of the sign. */ + char p_sign_posn; + /* For values >= 0: Placement of spaces between currency symbol, sign, and + number. */ + char p_sep_by_space; + /* For values < 0: 1 if the currency symbol precedes the number, 0 if it + comes after the number. */ + char n_cs_precedes; + /* For values < 0: Position of the sign. */ + char n_sign_posn; + /* For values < 0: Placement of spaces between currency symbol, sign, and + number. */ + char n_sep_by_space; + + /* For formatting international currency. */ + /* Currency symbol (3 characters) followed by separator (1 character). */ + char *int_curr_symbol; + /* Number of digits after the decimal point. */ + char int_frac_digits; + /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it + comes after the number. */ + char int_p_cs_precedes; + /* For values >= 0: Position of the sign. */ + char int_p_sign_posn; + /* For values >= 0: Placement of spaces between currency symbol, sign, and + number. */ + char int_p_sep_by_space; + /* For values < 0: 1 if the currency symbol precedes the number, 0 if it + comes after the number. */ + char int_n_cs_precedes; + /* For values < 0: Position of the sign. */ + char int_n_sign_posn; + /* For values < 0: Placement of spaces between currency symbol, sign, and + number. */ + char int_n_sep_by_space; +}; +#endif + +#if @GNULIB_LOCALECONV@ +# if @REPLACE_LOCALECONV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef localeconv +# define localeconv rpl_localeconv +# endif +_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void)); +_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void)); +# else +_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void)); +# endif +_GL_CXXALIASWARN (localeconv); +#elif @REPLACE_STRUCT_LCONV@ +# undef localeconv +# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv +#elif defined GNULIB_POSIXCHECK +# undef localeconv +# if HAVE_RAW_DECL_LOCALECONV +_GL_WARN_ON_USE (localeconv, + "localeconv returns too few information on some platforms - " + "use gnulib module localeconv for portability"); +# endif +#endif + +#if @GNULIB_SETLOCALE@ +# if @REPLACE_SETLOCALE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setlocale +# define setlocale rpl_setlocale +# define GNULIB_defined_setlocale 1 +# endif +_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale)); +_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); +# else +_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale)); +# endif +_GL_CXXALIASWARN (setlocale); +#elif defined GNULIB_POSIXCHECK +# undef setlocale +# if HAVE_RAW_DECL_SETLOCALE +_GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - " + "use gnulib module setlocale for portability"); +# endif +#endif + +#if @GNULIB_DUPLOCALE@ +# if @REPLACE_DUPLOCALE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef duplocale +# define duplocale rpl_duplocale +# endif +_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); +# else +# if @HAVE_DUPLOCALE@ +_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); +# endif +# endif +# if @HAVE_DUPLOCALE@ +_GL_CXXALIASWARN (duplocale); +# endif +#elif defined GNULIB_POSIXCHECK +# undef duplocale +# if HAVE_RAW_DECL_DUPLOCALE +_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " + "use gnulib module duplocale for portability"); +# endif +#endif + +#endif /* _@GUARD_PREFIX@_LOCALE_H */ +#endif /* ! _GL_ALREADY_INCLUDING_LOCALE_H */ +#endif /* _@GUARD_PREFIX@_LOCALE_H */ diff --git a/grub-core/gnulib/localeconv.c b/grub-core/gnulib/localeconv.c new file mode 100644 index 000000000..7c7c77cfd --- /dev/null +++ b/grub-core/gnulib/localeconv.c @@ -0,0 +1,103 @@ +/* Query locale dependent information for formatting numbers. + Copyright (C) 2012-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#if HAVE_STRUCT_LCONV_DECIMAL_POINT + +/* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_* + members. */ + +struct lconv * +localeconv (void) +{ + static struct lconv result; +# undef lconv +# undef localeconv + struct lconv *sys_result = localeconv (); + + result.decimal_point = sys_result->decimal_point; + result.thousands_sep = sys_result->thousands_sep; + result.grouping = sys_result->grouping; + result.mon_decimal_point = sys_result->mon_decimal_point; + result.mon_thousands_sep = sys_result->mon_thousands_sep; + result.mon_grouping = sys_result->mon_grouping; + result.positive_sign = sys_result->positive_sign; + result.negative_sign = sys_result->negative_sign; + result.currency_symbol = sys_result->currency_symbol; + result.frac_digits = sys_result->frac_digits; + result.p_cs_precedes = sys_result->p_cs_precedes; + result.p_sign_posn = sys_result->p_sign_posn; + result.p_sep_by_space = sys_result->p_sep_by_space; + result.n_cs_precedes = sys_result->n_cs_precedes; + result.n_sign_posn = sys_result->n_sign_posn; + result.n_sep_by_space = sys_result->n_sep_by_space; + result.int_curr_symbol = sys_result->int_curr_symbol; + result.int_frac_digits = sys_result->int_frac_digits; + result.int_p_cs_precedes = sys_result->p_cs_precedes; + result.int_p_sign_posn = sys_result->p_sign_posn; + result.int_p_sep_by_space = sys_result->p_sep_by_space; + result.int_n_cs_precedes = sys_result->n_cs_precedes; + result.int_n_sign_posn = sys_result->n_sign_posn; + result.int_n_sep_by_space = sys_result->n_sep_by_space; + + return &result; +} + +#else + +/* Override for platforms where 'struct lconv' is a dummy. */ + +# include + +struct lconv * +localeconv (void) +{ + static /*const*/ struct lconv result = + { + /* decimal_point */ ".", + /* thousands_sep */ "", + /* grouping */ "", + /* mon_decimal_point */ "", + /* mon_thousands_sep */ "", + /* mon_grouping */ "", + /* positive_sign */ "", + /* negative_sign */ "", + /* currency_symbol */ "", + /* frac_digits */ CHAR_MAX, + /* p_cs_precedes */ CHAR_MAX, + /* p_sign_posn */ CHAR_MAX, + /* p_sep_by_space */ CHAR_MAX, + /* n_cs_precedes */ CHAR_MAX, + /* n_sign_posn */ CHAR_MAX, + /* n_sep_by_space */ CHAR_MAX, + /* int_curr_symbol */ "", + /* int_frac_digits */ CHAR_MAX, + /* int_p_cs_precedes */ CHAR_MAX, + /* int_p_sign_posn */ CHAR_MAX, + /* int_p_sep_by_space */ CHAR_MAX, + /* int_n_cs_precedes */ CHAR_MAX, + /* int_n_sign_posn */ CHAR_MAX, + /* int_n_sep_by_space */ CHAR_MAX + }; + + return &result; +} + +#endif diff --git a/grub-core/gnulib/malloc.c b/grub-core/gnulib/malloc.c index 4fa38ee41..908735d27 100644 --- a/grub-core/gnulib/malloc.c +++ b/grub-core/gnulib/malloc.c @@ -1,6 +1,6 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997-1998, 2006-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,11 +13,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ /* written by Jim Meyering and Bruno Haible */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ #ifdef malloc @@ -28,14 +28,10 @@ # define NEED_MALLOC_GNU 1 #endif -/* Specification. */ #include #include -/* Call the system's malloc below. */ -#undef malloc - /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ diff --git a/grub-core/gnulib/mbrtowc.c b/grub-core/gnulib/mbrtowc.c index 5c2650e95..5ee44aea4 100644 --- a/grub-core/gnulib/mbrtowc.c +++ b/grub-core/gnulib/mbrtowc.c @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -40,9 +40,6 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { char *pstate = (char *)ps; - if (pstate == NULL) - pstate = internal_state; - if (s == NULL) { pwc = NULL; @@ -54,6 +51,10 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) return (size_t)(-2); /* Here n > 0. */ + + if (pstate == NULL) + pstate = internal_state; + { size_t nstate = pstate[0]; char buf[4]; @@ -91,7 +92,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) /* Here m > 0. */ -# if __GLIBC__ +# if __GLIBC__ || defined __UCLIBC__ /* Work around bug */ mbtowc (NULL, NULL, 0); # endif @@ -127,7 +128,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { const char *encoding = locale_charset (); - if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) { /* Cf. unistr/u8-mblen.c. */ unsigned char c = (unsigned char) p[0]; @@ -184,7 +185,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) /* As a reference for this code, you can use the GNU libiconv implementation. Look for uses of the RET_TOOFEW macro. */ - if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) + if (STREQ_OPT (encoding, + "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)) { if (m == 1) { @@ -207,9 +209,12 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) } goto invalid; } - if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) - || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) - || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) + if (STREQ_OPT (encoding, + "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + || STREQ_OPT (encoding, + "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) + || STREQ_OPT (encoding, + "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)) { if (m == 1) { @@ -220,7 +225,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) } goto invalid; } - if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) + if (STREQ_OPT (encoding, + "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)) { if (m == 1) { @@ -238,7 +244,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) } goto invalid; } - if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) + if (STREQ_OPT (encoding, + "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) { if (m == 1) { @@ -271,7 +278,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) } goto invalid; } - if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) + if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) { if (m == 1) { @@ -321,7 +328,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) size_t rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { -# if MBRTOWC_NULL_ARG_BUG || MBRTOWC_RETVAL_BUG +# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG if (s == NULL) { pwc = NULL; @@ -334,7 +341,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { static mbstate_t internal_state; - /* Override mbrtowc's internal state. We can not call mbsinit() on the + /* Override mbrtowc's internal state. We cannot call mbsinit() on the hidden internal state, but we can call it on our variable. */ if (ps == NULL) ps = &internal_state; @@ -379,7 +386,16 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) return ret; } # else - return mbrtowc (pwc, s, n, ps); + { +# if MBRTOWC_NULL_ARG1_BUG + wchar_t dummy; + + if (pwc == NULL) + pwc = &dummy; +# endif + + return mbrtowc (pwc, s, n, ps); + } # endif } diff --git a/grub-core/gnulib/mbsinit.c b/grub-core/gnulib/mbsinit.c index 066ddfe5b..26fbb7fa2 100644 --- a/grub-core/gnulib/mbsinit.c +++ b/grub-core/gnulib/mbsinit.c @@ -1,5 +1,5 @@ /* Test for initial conversion state. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -22,6 +22,18 @@ #include "verify.h" +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + +/* On native Windows, 'mbstate_t' is defined as 'int'. */ + +int +mbsinit (const mbstate_t *ps) +{ + return ps == NULL || *ps == 0; +} + +#else + /* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs() and wcrtomb(), wcsrtombs(). We assume that @@ -43,5 +55,7 @@ mbsinit (const mbstate_t *ps) { const char *pstate = (const char *)ps; - return pstate[0] == 0; + return pstate == NULL || pstate[0] == 0; } + +#endif diff --git a/grub-core/gnulib/mbsrtowcs-impl.h b/grub-core/gnulib/mbsrtowcs-impl.h new file mode 100644 index 000000000..b50e9739b --- /dev/null +++ b/grub-core/gnulib/mbsrtowcs-impl.h @@ -0,0 +1,122 @@ +/* Convert string to wide string. + Copyright (C) 2008-2013 Free Software Foundation, Inc. + Written by Bruno Haible , 2008. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +size_t +mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) +{ + if (ps == NULL) + ps = &_gl_mbsrtowcs_state; + { + const char *src = *srcp; + + if (dest != NULL) + { + wchar_t *destptr = dest; + + for (; len > 0; destptr++, len--) + { + size_t src_avail; + size_t ret; + + /* An optimized variant of + src_avail = strnlen1 (src, MB_LEN_MAX); */ + if (src[0] == '\0') + src_avail = 1; + else if (src[1] == '\0') + src_avail = 2; + else if (src[2] == '\0') + src_avail = 3; + else if (MB_LEN_MAX <= 4 || src[3] == '\0') + src_avail = 4; + else + src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); + + /* Parse the next multibyte character. */ + ret = mbrtowc (destptr, src, src_avail, ps); + + if (ret == (size_t)(-2)) + /* Encountered a multibyte character that extends past a '\0' byte + or that is longer than MB_LEN_MAX bytes. Cannot happen. */ + abort (); + + if (ret == (size_t)(-1)) + goto bad_input; + if (ret == 0) + { + src = NULL; + /* Here mbsinit (ps). */ + break; + } + src += ret; + } + + *srcp = src; + return destptr - dest; + } + else + { + /* Ignore dest and len, don't store *srcp at the end, and + don't clobber *ps. */ + mbstate_t state = *ps; + size_t totalcount = 0; + + for (;; totalcount++) + { + size_t src_avail; + size_t ret; + + /* An optimized variant of + src_avail = strnlen1 (src, MB_LEN_MAX); */ + if (src[0] == '\0') + src_avail = 1; + else if (src[1] == '\0') + src_avail = 2; + else if (src[2] == '\0') + src_avail = 3; + else if (MB_LEN_MAX <= 4 || src[3] == '\0') + src_avail = 4; + else + src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); + + /* Parse the next multibyte character. */ + ret = mbrtowc (NULL, src, src_avail, &state); + + if (ret == (size_t)(-2)) + /* Encountered a multibyte character that extends past a '\0' byte + or that is longer than MB_LEN_MAX bytes. Cannot happen. */ + abort (); + + if (ret == (size_t)(-1)) + goto bad_input2; + if (ret == 0) + { + /* Here mbsinit (&state). */ + break; + } + src += ret; + } + + return totalcount; + } + + bad_input: + *srcp = src; + bad_input2: + errno = EILSEQ; + return (size_t)(-1); + } +} diff --git a/grub-core/gnulib/mbsrtowcs-state.c b/grub-core/gnulib/mbsrtowcs-state.c index 35045f657..5a0b8882b 100644 --- a/grub-core/gnulib/mbsrtowcs-state.c +++ b/grub-core/gnulib/mbsrtowcs-state.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2008-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ /* Internal state used by the functions mbsrtowcs() and mbsnrtowcs(). */ mbstate_t _gl_mbsrtowcs_state /* The state must initially be in the "initial state"; so, zero-initialize it. - On most systems, putting it into BSS is sufficient. Not so on MacOS X 10.3, + On most systems, putting it into BSS is sufficient. Not so on Mac OS X 10.3, see . When it needs an initializer, use 0 or {0} as initializer? 0 only works when mbstate_t is a scalar type (such as when gnulib defines it, or on diff --git a/grub-core/gnulib/mbsrtowcs.c b/grub-core/gnulib/mbsrtowcs.c index c577f36f2..116ff493b 100644 --- a/grub-core/gnulib/mbsrtowcs.c +++ b/grub-core/gnulib/mbsrtowcs.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -29,108 +29,4 @@ extern mbstate_t _gl_mbsrtowcs_state; -size_t -mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) -{ - if (ps == NULL) - ps = &_gl_mbsrtowcs_state; - { - const char *src = *srcp; - - if (dest != NULL) - { - wchar_t *destptr = dest; - - for (; len > 0; destptr++, len--) - { - size_t src_avail; - size_t ret; - - /* An optimized variant of - src_avail = strnlen1 (src, MB_LEN_MAX); */ - if (src[0] == '\0') - src_avail = 1; - else if (src[1] == '\0') - src_avail = 2; - else if (src[2] == '\0') - src_avail = 3; - else if (MB_LEN_MAX <= 4 || src[3] == '\0') - src_avail = 4; - else - src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); - - /* Parse the next multibyte character. */ - ret = mbrtowc (destptr, src, src_avail, ps); - - if (ret == (size_t)(-2)) - /* Encountered a multibyte character that extends past a '\0' byte - or that is longer than MB_LEN_MAX bytes. Cannot happen. */ - abort (); - - if (ret == (size_t)(-1)) - goto bad_input; - if (ret == 0) - { - src = NULL; - /* Here mbsinit (ps). */ - break; - } - src += ret; - } - - *srcp = src; - return destptr - dest; - } - else - { - /* Ignore dest and len, don't store *srcp at the end, and - don't clobber *ps. */ - mbstate_t state = *ps; - size_t totalcount = 0; - - for (;; totalcount++) - { - size_t src_avail; - size_t ret; - - /* An optimized variant of - src_avail = strnlen1 (src, MB_LEN_MAX); */ - if (src[0] == '\0') - src_avail = 1; - else if (src[1] == '\0') - src_avail = 2; - else if (src[2] == '\0') - src_avail = 3; - else if (MB_LEN_MAX <= 4 || src[3] == '\0') - src_avail = 4; - else - src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); - - /* Parse the next multibyte character. */ - ret = mbrtowc (NULL, src, src_avail, &state); - - if (ret == (size_t)(-2)) - /* Encountered a multibyte character that extends past a '\0' byte - or that is longer than MB_LEN_MAX bytes. Cannot happen. */ - abort (); - - if (ret == (size_t)(-1)) - goto bad_input2; - if (ret == 0) - { - /* Here mbsinit (&state). */ - break; - } - src += ret; - } - - return totalcount; - } - - bad_input: - *srcp = src; - bad_input2: - errno = EILSEQ; - return (size_t)(-1); - } -} +#include "mbsrtowcs-impl.h" diff --git a/grub-core/gnulib/mbswidth.c b/grub-core/gnulib/mbswidth.c new file mode 100644 index 000000000..baa4f2757 --- /dev/null +++ b/grub-core/gnulib/mbswidth.c @@ -0,0 +1,199 @@ +/* Determine the number of screen columns needed for a string. + Copyright (C) 2000-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible . */ + +#include + +/* Specification. */ +#include "mbswidth.h" + +/* Get MB_CUR_MAX. */ +#include + +#include + +/* Get isprint(). */ +#include + +/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */ +#include + +/* Get iswcntrl(). */ +#include + +/* Get INT_MAX. */ +#include + +/* Returns the number of columns needed to represent the multibyte + character string pointed to by STRING. If a non-printable character + occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. + With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is + the multibyte analogue of the wcswidth function. */ +int +mbswidth (const char *string, int flags) +{ + return mbsnwidth (string, strlen (string), flags); +} + +/* Returns the number of columns needed to represent the multibyte + character string pointed to by STRING of length NBYTES. If a + non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is + specified, -1 is returned. */ +int +mbsnwidth (const char *string, size_t nbytes, int flags) +{ + const char *p = string; + const char *plimit = p + nbytes; + int width; + + width = 0; + if (MB_CUR_MAX > 1) + { + while (p < plimit) + switch (*p) + { + case ' ': case '!': case '"': case '#': case '%': + case '&': case '\'': case '(': case ')': case '*': + case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': + case '?': + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': + case 'Z': + case '[': case '\\': case ']': case '^': case '_': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': + case 'z': case '{': case '|': case '}': case '~': + /* These characters are printable ASCII characters. */ + p++; + width++; + break; + case '\0': + if (flags & MBSW_STOP_AT_NUL) + return width; + default: + /* If we have a multibyte sequence, scan it up to its end. */ + { + mbstate_t mbstate; + memset (&mbstate, 0, sizeof mbstate); + do + { + wchar_t wc; + size_t bytes; + int w; + + bytes = mbrtowc (&wc, p, plimit - p, &mbstate); + + if (bytes == (size_t) -1) + /* An invalid multibyte sequence was encountered. */ + { + if (!(flags & MBSW_REJECT_INVALID)) + { + p++; + width++; + break; + } + else + return -1; + } + + if (bytes == (size_t) -2) + /* An incomplete multibyte character at the end. */ + { + if (!(flags & MBSW_REJECT_INVALID)) + { + p = plimit; + width++; + break; + } + else + return -1; + } + + if (bytes == 0) + /* A null wide character was encountered. */ + bytes = 1; + + w = wcwidth (wc); + if (w >= 0) + /* A printable multibyte character. */ + { + if (w > INT_MAX - width) + goto overflow; + width += w; + } + else + /* An unprintable multibyte character. */ + if (!(flags & MBSW_REJECT_UNPRINTABLE)) + { + if (!iswcntrl (wc)) + { + if (width == INT_MAX) + goto overflow; + width++; + } + } + else + return -1; + + p += bytes; + } + while (! mbsinit (&mbstate)); + } + break; + } + return width; + } + + while (p < plimit) + { + unsigned char c = (unsigned char) *p++; + + if (c == 0 && (flags & MBSW_STOP_AT_NUL)) + return width; + + if (isprint (c)) + { + if (width == INT_MAX) + goto overflow; + width++; + } + else if (!(flags & MBSW_REJECT_UNPRINTABLE)) + { + if (!iscntrl (c)) + { + if (width == INT_MAX) + goto overflow; + width++; + } + } + else + return -1; + } + return width; + + overflow: + return INT_MAX; +} diff --git a/grub-core/gnulib/mbswidth.h b/grub-core/gnulib/mbswidth.h new file mode 100644 index 000000000..d7207c58f --- /dev/null +++ b/grub-core/gnulib/mbswidth.h @@ -0,0 +1,63 @@ +/* Determine the number of screen columns needed for a string. + Copyright (C) 2000-2004, 2007, 2009-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Avoid a clash of our mbswidth() with a function of the same name defined + in UnixWare 7.1.1 . We need this #include before the #define + below. + However, we don't want to #include on all platforms because + - Tru64 with Desktop Toolkit C has a bug: must be included before + . + - BSD/OS 4.1 has a bug: and must be included before + . */ +#if HAVE_DECL_MBSWIDTH_IN_WCHAR_H +# include +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Optional flags to influence mbswidth/mbsnwidth behavior. */ + +/* If this bit is set, return -1 upon finding an invalid or incomplete + character. Otherwise, assume invalid characters have width 1. */ +#define MBSW_REJECT_INVALID 1 + +/* If this bit is set, return -1 upon finding a non-printable character. + Otherwise, assume unprintable characters have width 0 if they are + control characters and 1 otherwise. */ +#define MBSW_REJECT_UNPRINTABLE 2 + +/* If this bit is set \0 is treated as the end of string. + Otherwise it's treated as a normal one column width character. */ +#define MBSW_STOP_AT_NUL 4 + +/* Returns the number of screen columns needed for STRING. */ +#define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */ +extern int mbswidth (const char *string, int flags); + +/* Returns the number of screen columns needed for the NBYTES bytes + starting at BUF. */ +extern int mbsnwidth (const char *buf, size_t nbytes, int flags); + + +#ifdef __cplusplus +} +#endif diff --git a/grub-core/gnulib/mbtowc-impl.h b/grub-core/gnulib/mbtowc-impl.h new file mode 100644 index 000000000..767ab397c --- /dev/null +++ b/grub-core/gnulib/mbtowc-impl.h @@ -0,0 +1,44 @@ +/* Convert multibyte character to wide character. + Copyright (C) 2011-2013 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* We don't need a static internal state, because the encoding is not state + dependent, and when mbrtowc returns (size_t)(-2). we throw the result + away. */ + +int +mbtowc (wchar_t *pwc, const char *s, size_t n) +{ + if (s == NULL) + return 0; + else + { + mbstate_t state; + wchar_t wc; + size_t result; + + memset (&state, 0, sizeof (mbstate_t)); + result = mbrtowc (&wc, s, n, &state); + if (result == (size_t)-1 || result == (size_t)-2) + { + errno = EILSEQ; + return -1; + } + if (pwc != NULL) + *pwc = wc; + return (wc == 0 ? 0 : result); + } +} diff --git a/grub-core/gnulib/mbtowc.c b/grub-core/gnulib/mbtowc.c new file mode 100644 index 000000000..632f2e1db --- /dev/null +++ b/grub-core/gnulib/mbtowc.c @@ -0,0 +1,26 @@ +/* Convert multibyte character to wide character. + Copyright (C) 2011-2013 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +#include + +#include +#include +#include + +#include "mbtowc-impl.h" diff --git a/grub-core/gnulib/memchr.c b/grub-core/gnulib/memchr.c index 6c2b2d6c7..3db38a94c 100644 --- a/grub-core/gnulib/memchr.c +++ b/grub-core/gnulib/memchr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), diff --git a/grub-core/gnulib/mempcpy.c b/grub-core/gnulib/mempcpy.c index b624d69fd..5582368ed 100644 --- a/grub-core/gnulib/mempcpy.c +++ b/grub-core/gnulib/mempcpy.c @@ -1,5 +1,5 @@ /* Copy memory area and return pointer after last written byte. - Copyright (C) 2003, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2007, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #include diff --git a/grub-core/gnulib/msvc-inval.c b/grub-core/gnulib/msvc-inval.c new file mode 100644 index 000000000..72a6b6ee8 --- /dev/null +++ b/grub-core/gnulib/msvc-inval.c @@ -0,0 +1,129 @@ +/* Invalid parameter handler for MSVC runtime libraries. + Copyright (C) 2011-2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, see . */ + +#include + +/* Specification. */ +#include "msvc-inval.h" + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ + && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING) + +/* Get _invalid_parameter_handler type and _set_invalid_parameter_handler + declaration. */ +# include + +# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING + +static void cdecl +gl_msvc_invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, + unsigned int line, + uintptr_t dummy) +{ +} + +# else + +/* Get declarations of the native Windows API functions. */ +# define WIN32_LEAN_AND_MEAN +# include + +# if defined _MSC_VER + +static void cdecl +gl_msvc_invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, + unsigned int line, + uintptr_t dummy) +{ + RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); +} + +# else + +/* An index to thread-local storage. */ +static DWORD tls_index; +static int tls_initialized /* = 0 */; + +/* Used as a fallback only. */ +static struct gl_msvc_inval_per_thread not_per_thread; + +struct gl_msvc_inval_per_thread * +gl_msvc_inval_current (void) +{ + if (!tls_initialized) + { + tls_index = TlsAlloc (); + tls_initialized = 1; + } + if (tls_index == TLS_OUT_OF_INDEXES) + /* TlsAlloc had failed. */ + return ¬_per_thread; + else + { + struct gl_msvc_inval_per_thread *pointer = + (struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index); + if (pointer == NULL) + { + /* First call. Allocate a new 'struct gl_msvc_inval_per_thread'. */ + pointer = + (struct gl_msvc_inval_per_thread *) + malloc (sizeof (struct gl_msvc_inval_per_thread)); + if (pointer == NULL) + /* Could not allocate memory. Use the global storage. */ + pointer = ¬_per_thread; + TlsSetValue (tls_index, pointer); + } + return pointer; + } +} + +static void cdecl +gl_msvc_invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, + unsigned int line, + uintptr_t dummy) +{ + struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current (); + if (current->restart_valid) + longjmp (current->restart, 1); + else + /* An invalid parameter notification from outside the gnulib code. + Give the caller a chance to intervene. */ + RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); +} + +# endif + +# endif + +static int gl_msvc_inval_initialized /* = 0 */; + +void +gl_msvc_inval_ensure_handler (void) +{ + if (gl_msvc_inval_initialized == 0) + { + _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler); + gl_msvc_inval_initialized = 1; + } +} + +#endif diff --git a/grub-core/gnulib/msvc-inval.h b/grub-core/gnulib/msvc-inval.h new file mode 100644 index 000000000..dcb0353dc --- /dev/null +++ b/grub-core/gnulib/msvc-inval.h @@ -0,0 +1,222 @@ +/* Invalid parameter handler for MSVC runtime libraries. + Copyright (C) 2011-2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, see . */ + +#ifndef _MSVC_INVAL_H +#define _MSVC_INVAL_H + +/* With MSVC runtime libraries with the "invalid parameter handler" concept, + functions like fprintf(), dup2(), or close() crash when the caller passes + an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF) + instead. + This file defines macros that turn such an invalid parameter notification + into a non-local exit. An error code can then be produced at the target + of this exit. You can thus write code like + + TRY_MSVC_INVAL + { + + } + CATCH_MSVC_INVAL + { + + } + DONE_MSVC_INVAL; + + This entire block expands to a single statement. + + The handling of invalid parameters can be done in three ways: + + * The default way, which is reasonable for programs (not libraries): + AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [DEFAULT_HANDLING]) + + * The way for libraries that make "hairy" calls (like close(-1), or + fclose(fp) where fileno(fp) is closed, or simply getdtablesize()): + AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [HAIRY_LIBRARY_HANDLING]) + + * The way for libraries that make no "hairy" calls: + AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING]) + */ + +#define DEFAULT_HANDLING 0 +#define HAIRY_LIBRARY_HANDLING 1 +#define SANE_LIBRARY_HANDLING 2 + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ + && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING) +/* A native Windows platform with the "invalid parameter handler" concept, + and either DEFAULT_HANDLING or HAIRY_LIBRARY_HANDLING. */ + +# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING +/* Default handling. */ + +# ifdef __cplusplus +extern "C" { +# endif + +/* Ensure that the invalid parameter handler in installed that just returns. + Because we assume no other part of the program installs a different + invalid parameter handler, this solution is multithread-safe. */ +extern void gl_msvc_inval_ensure_handler (void); + +# ifdef __cplusplus +} +# endif + +# define TRY_MSVC_INVAL \ + do \ + { \ + gl_msvc_inval_ensure_handler (); \ + if (1) +# define CATCH_MSVC_INVAL \ + else +# define DONE_MSVC_INVAL \ + } \ + while (0) + +# else +/* Handling for hairy libraries. */ + +# include + +/* Gnulib can define its own status codes, as described in the page + "Raising Software Exceptions" on microsoft.com + . + Our status codes are composed of + - 0xE0000000, mandatory for all user-defined status codes, + - 0x474E550, a API identifier ("GNU"), + - 0, 1, 2, ..., used to distinguish different status codes from the + same API. */ +# define STATUS_GNULIB_INVALID_PARAMETER (0xE0000000 + 0x474E550 + 0) + +# if defined _MSC_VER +/* A compiler that supports __try/__except, as described in the page + "try-except statement" on microsoft.com + . + With __try/__except, we can use the multithread-safe exception handling. */ + +# ifdef __cplusplus +extern "C" { +# endif + +/* Ensure that the invalid parameter handler in installed that raises a + software exception with code STATUS_GNULIB_INVALID_PARAMETER. + Because we assume no other part of the program installs a different + invalid parameter handler, this solution is multithread-safe. */ +extern void gl_msvc_inval_ensure_handler (void); + +# ifdef __cplusplus +} +# endif + +# define TRY_MSVC_INVAL \ + do \ + { \ + gl_msvc_inval_ensure_handler (); \ + __try +# define CATCH_MSVC_INVAL \ + __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \ + ? EXCEPTION_EXECUTE_HANDLER \ + : EXCEPTION_CONTINUE_SEARCH) +# define DONE_MSVC_INVAL \ + } \ + while (0) + +# else +/* Any compiler. + We can only use setjmp/longjmp. */ + +# include + +# ifdef __cplusplus +extern "C" { +# endif + +struct gl_msvc_inval_per_thread +{ + /* The restart that will resume execution at the code between + CATCH_MSVC_INVAL and DONE_MSVC_INVAL. It is enabled only between + TRY_MSVC_INVAL and CATCH_MSVC_INVAL. */ + jmp_buf restart; + + /* Tells whether the contents of restart is valid. */ + int restart_valid; +}; + +/* Ensure that the invalid parameter handler in installed that passes + control to the gl_msvc_inval_restart if it is valid, or raises a + software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise. + Because we assume no other part of the program installs a different + invalid parameter handler, this solution is multithread-safe. */ +extern void gl_msvc_inval_ensure_handler (void); + +/* Return a pointer to the per-thread data for the current thread. */ +extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void); + +# ifdef __cplusplus +} +# endif + +# define TRY_MSVC_INVAL \ + do \ + { \ + struct gl_msvc_inval_per_thread *msvc_inval_current; \ + gl_msvc_inval_ensure_handler (); \ + msvc_inval_current = gl_msvc_inval_current (); \ + /* First, initialize gl_msvc_inval_restart. */ \ + if (setjmp (msvc_inval_current->restart) == 0) \ + { \ + /* Then, mark it as valid. */ \ + msvc_inval_current->restart_valid = 1; +# define CATCH_MSVC_INVAL \ + /* Execution completed. \ + Mark gl_msvc_inval_restart as invalid. */ \ + msvc_inval_current->restart_valid = 0; \ + } \ + else \ + { \ + /* Execution triggered an invalid parameter notification. \ + Mark gl_msvc_inval_restart as invalid. */ \ + msvc_inval_current->restart_valid = 0; +# define DONE_MSVC_INVAL \ + } \ + } \ + while (0) + +# endif + +# endif + +#else +/* A platform that does not need to the invalid parameter handler, + or when SANE_LIBRARY_HANDLING is desired. */ + +/* The braces here avoid GCC warnings like + "warning: suggest explicit braces to avoid ambiguous 'else'". */ +# define TRY_MSVC_INVAL \ + do \ + { \ + if (1) +# define CATCH_MSVC_INVAL \ + else +# define DONE_MSVC_INVAL \ + } \ + while (0) + +#endif + +#endif /* _MSVC_INVAL_H */ diff --git a/grub-core/gnulib/msvc-nothrow.c b/grub-core/gnulib/msvc-nothrow.c new file mode 100644 index 000000000..8d65472a8 --- /dev/null +++ b/grub-core/gnulib/msvc-nothrow.c @@ -0,0 +1,49 @@ +/* Wrappers that don't throw invalid parameter notifications + with MSVC runtime libraries. + Copyright (C) 2011-2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, see . */ + +#include + +/* Specification. */ +#include "msvc-nothrow.h" + +/* Get declarations of the native Windows API functions. */ +#define WIN32_LEAN_AND_MEAN +#include + +#include "msvc-inval.h" + +#undef _get_osfhandle + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +intptr_t +_gl_nothrow_get_osfhandle (int fd) +{ + intptr_t result; + + TRY_MSVC_INVAL + { + result = _get_osfhandle (fd); + } + CATCH_MSVC_INVAL + { + result = (intptr_t) INVALID_HANDLE_VALUE; + } + DONE_MSVC_INVAL; + + return result; +} +#endif diff --git a/grub-core/gnulib/msvc-nothrow.h b/grub-core/gnulib/msvc-nothrow.h new file mode 100644 index 000000000..5f521813d --- /dev/null +++ b/grub-core/gnulib/msvc-nothrow.h @@ -0,0 +1,43 @@ +/* Wrappers that don't throw invalid parameter notifications + with MSVC runtime libraries. + Copyright (C) 2011-2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, see . */ + +#ifndef _MSVC_NOTHROW_H +#define _MSVC_NOTHROW_H + +/* With MSVC runtime libraries with the "invalid parameter handler" concept, + functions like fprintf(), dup2(), or close() crash when the caller passes + an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF) + instead. + This file defines wrappers that turn such an invalid parameter notification + into an error code. */ + +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +/* Get original declaration of _get_osfhandle. */ +# include + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER + +/* Override _get_osfhandle. */ +extern intptr_t _gl_nothrow_get_osfhandle (int fd); +# define _get_osfhandle _gl_nothrow_get_osfhandle + +# endif + +#endif + +#endif /* _MSVC_NOTHROW_H */ diff --git a/grub-core/gnulib/nl_langinfo.c b/grub-core/gnulib/nl_langinfo.c index a3d0d11eb..771c9533a 100644 --- a/grub-core/gnulib/nl_langinfo.c +++ b/grub-core/gnulib/nl_langinfo.c @@ -1,6 +1,6 @@ /* nl_langinfo() replacement: query locale dependent information. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -97,7 +97,7 @@ rpl_nl_langinfo (nl_item item) strings, appended in memory. */ return "\0\0\0\0\0\0\0\0\0\0"; # endif -# if GNULIB_defined_YESEXPR +# if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS case YESEXPR: return "^[yY]"; case NOEXPR: @@ -141,7 +141,8 @@ nl_langinfo (nl_item item) { static char buf[2 + 10 + 1]; - /* Woe32 has a function returning the locale's codepage as a number. */ + /* The Windows API has a function returning the locale's codepage as + a number. */ sprintf (buf, "CP%u", GetACP ()); return buf; } diff --git a/grub-core/gnulib/printf-args.c b/grub-core/gnulib/printf-args.c index 46c03a21e..c27e6bc6b 100644 --- a/grub-core/gnulib/printf-args.c +++ b/grub-core/gnulib/printf-args.c @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2010 Free Software + Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ /* This file can be parametrized with the following macros: ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. diff --git a/grub-core/gnulib/printf-args.h b/grub-core/gnulib/printf-args.h index 2536ebafd..2a9c2a3f8 100644 --- a/grub-core/gnulib/printf-args.h +++ b/grub-core/gnulib/printf-args.h @@ -1,5 +1,5 @@ /* Decomposed printf argument list. - Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2010 Free Software + Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ #ifndef _PRINTF_ARGS_H #define _PRINTF_ARGS_H @@ -136,10 +135,14 @@ typedef struct } argument; +/* Number of directly allocated arguments (no malloc() needed). */ +#define N_DIRECT_ALLOC_ARGUMENTS 7 + typedef struct { size_t count; argument *arg; + argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS]; } arguments; diff --git a/grub-core/gnulib/printf-parse.c b/grub-core/gnulib/printf-parse.c index f612beb5b..23cacc1da 100644 --- a/grub-core/gnulib/printf-parse.c +++ b/grub-core/gnulib/printf-parse.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ /* This file can be parametrized with the following macros: CHAR_T The element type of the format string. @@ -63,6 +62,9 @@ /* malloc(), realloc(), free(). */ #include +/* memcpy(). */ +#include + /* errno. */ #include @@ -80,23 +82,20 @@ STATIC int PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) { - const CHAR_T *cp = format; /* pointer into format */ + const CHAR_T *cp = format; /* pointer into format */ size_t arg_posn = 0; /* number of regular arguments consumed */ - size_t d_allocated; /* allocated elements of d->dir */ - size_t a_allocated; /* allocated elements of a->arg */ + size_t d_allocated; /* allocated elements of d->dir */ + size_t a_allocated; /* allocated elements of a->arg */ size_t max_width_length = 0; size_t max_precision_length = 0; d->count = 0; - d_allocated = 1; - d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE)); - if (d->dir == NULL) - /* Out of memory. */ - goto out_of_memory_1; + d_allocated = N_DIRECT_ALLOC_DIRECTIVES; + d->dir = d->direct_alloc_dir; a->count = 0; - a_allocated = 0; - a->arg = NULL; + a_allocated = N_DIRECT_ALLOC_ARGUMENTS; + a->arg = a->direct_alloc_arg; #define REGISTER_ARG(_index_,_type_) \ { \ @@ -113,12 +112,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) if (size_overflow_p (memory_size)) \ /* Overflow, would lead to out of memory. */ \ goto out_of_memory; \ - memory = (argument *) (a->arg \ + memory = (argument *) (a->arg != a->direct_alloc_arg \ ? realloc (a->arg, memory_size) \ : malloc (memory_size)); \ if (memory == NULL) \ /* Out of memory. */ \ goto out_of_memory; \ + if (a->arg == a->direct_alloc_arg) \ + memcpy (memory, a->arg, a->count * sizeof (argument)); \ a->arg = memory; \ } \ while (a->count <= n) \ @@ -206,6 +207,13 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) dp->flags |= FLAG_ZERO; cp++; } +#if __GLIBC__ >= 2 && !defined __UCLIBC__ + else if (*cp == 'I') + { + dp->flags |= FLAG_LOCALIZED; + cp++; + } +#endif else break; } @@ -393,7 +401,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) cp++; } #if defined __APPLE__ && defined __MACH__ - /* On MacOS X 10.3, PRIdMAX is defined as "qd". + /* On Mac OS X 10.3, PRIdMAX is defined as "qd". We cannot change it to "lld" because PRIdMAX must also be understood by the system's printf routines. */ else if (*cp == 'q') @@ -412,7 +420,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) } #endif #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* On native Win32, PRIdMAX is defined as "I64d". + /* On native Windows, PRIdMAX is defined as "I64d". We cannot change it to "lld" because PRIdMAX must also be understood by the system's printf routines. */ else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') @@ -581,10 +589,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) if (size_overflow_p (memory_size)) /* Overflow, would lead to out of memory. */ goto out_of_memory; - memory = (DIRECTIVE *) realloc (d->dir, memory_size); + memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir + ? realloc (d->dir, memory_size) + : malloc (memory_size)); if (memory == NULL) /* Out of memory. */ goto out_of_memory; + if (d->dir == d->direct_alloc_dir) + memcpy (memory, d->dir, d->count * sizeof (DIRECTIVE)); d->dir = memory; } } @@ -603,19 +615,18 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) return 0; error: - if (a->arg) + if (a->arg != a->direct_alloc_arg) free (a->arg); - if (d->dir) + if (d->dir != d->direct_alloc_dir) free (d->dir); errno = EINVAL; return -1; out_of_memory: - if (a->arg) + if (a->arg != a->direct_alloc_arg) free (a->arg); - if (d->dir) + if (d->dir != d->direct_alloc_dir) free (d->dir); -out_of_memory_1: errno = ENOMEM; return -1; } diff --git a/grub-core/gnulib/printf-parse.h b/grub-core/gnulib/printf-parse.h index 0f2b70820..d8474bee1 100644 --- a/grub-core/gnulib/printf-parse.h +++ b/grub-core/gnulib/printf-parse.h @@ -1,5 +1,5 @@ /* Parse printf format string. - Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 Free Software + Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ #ifndef _PRINTF_PARSE_H #define _PRINTF_PARSE_H @@ -23,6 +22,10 @@ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. STATIC Set to 'static' to declare the function static. */ +#if HAVE_FEATURES_H +# include /* for __GLIBC__, __UCLIBC__ */ +#endif + #include "printf-args.h" @@ -33,6 +36,9 @@ #define FLAG_SPACE 8 /* space flag */ #define FLAG_ALT 16 /* # flag */ #define FLAG_ZERO 32 +#if __GLIBC__ >= 2 && !defined __UCLIBC__ +# define FLAG_LOCALIZED 64 /* I flag, uses localized digits */ +#endif /* arg_index value indicating that no argument is consumed. */ #define ARG_NONE (~(size_t)0) @@ -40,6 +46,9 @@ /* xxx_directive: A parsed directive. xxx_directives: A parsed format string. */ +/* Number of directly allocated directives (no malloc() needed). */ +#define N_DIRECT_ALLOC_DIRECTIVES 7 + /* A parsed directive. */ typedef struct { @@ -64,6 +73,7 @@ typedef struct char_directive *dir; size_t max_width_length; size_t max_precision_length; + char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } char_directives; @@ -93,6 +103,7 @@ typedef struct u8_directive *dir; size_t max_width_length; size_t max_precision_length; + u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u8_directives; @@ -120,6 +131,7 @@ typedef struct u16_directive *dir; size_t max_width_length; size_t max_precision_length; + u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u16_directives; @@ -147,6 +159,7 @@ typedef struct u32_directive *dir; size_t max_width_length; size_t max_precision_length; + u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; } u32_directives; diff --git a/grub-core/gnulib/progname.c b/grub-core/gnulib/progname.c index 1415e6a55..0c195e521 100644 --- a/grub-core/gnulib/progname.c +++ b/grub-core/gnulib/progname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/grub-core/gnulib/progname.h b/grub-core/gnulib/progname.h index 5ba303bd0..b4f3c2778 100644 --- a/grub-core/gnulib/progname.h +++ b/grub-core/gnulib/progname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/grub-core/gnulib/rawmemchr.c b/grub-core/gnulib/rawmemchr.c index 0a88777d9..a0298ce64 100644 --- a/grub-core/gnulib/rawmemchr.c +++ b/grub-core/gnulib/rawmemchr.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/grub-core/gnulib/realloc.c b/grub-core/gnulib/realloc.c index 053208f37..b51010a62 100644 --- a/grub-core/gnulib/realloc.c +++ b/grub-core/gnulib/realloc.c @@ -1,6 +1,6 @@ /* realloc() function that is glibc compatible. - Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2010 Free Software + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -18,6 +18,7 @@ /* written by Jim Meyering and Bruno Haible */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */ @@ -34,23 +35,10 @@ # define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1 #endif -/* Below we want to call the system's malloc and realloc. - Undefine the symbols here so that including provides a - declaration of malloc(), not of rpl_malloc(), and likewise for realloc. */ -#undef malloc -#undef realloc - -/* Specification. */ #include #include -/* Below we want to call the system's malloc and realloc. - Undefine the symbols, if they were defined by gnulib's - replacement. */ -#undef malloc -#undef realloc - /* Change the size of an allocated block of memory P to N bytes, with error checking. If N is zero, change it to 1. If P is NULL, use malloc. */ diff --git a/grub-core/gnulib/ref-add.sin b/grub-core/gnulib/ref-add.sin index dbb61df3d..112bcdc64 100644 --- a/grub-core/gnulib/ref-add.sin +++ b/grub-core/gnulib/ref-add.sin @@ -1,6 +1,6 @@ # Add this package to a list of references stored in a text file. # -# Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,8 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# with this program; if not, see . # # Written by Bruno Haible . # diff --git a/grub-core/gnulib/ref-del.sin b/grub-core/gnulib/ref-del.sin index 4c31a6eaf..6f7386847 100644 --- a/grub-core/gnulib/ref-del.sin +++ b/grub-core/gnulib/ref-del.sin @@ -1,6 +1,6 @@ # Remove this package from a list of references stored in a text file. # -# Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,8 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# with this program; if not, see . # # Written by Bruno Haible . # diff --git a/grub-core/gnulib/regcomp.c b/grub-core/gnulib/regcomp.c index ddea3fb65..596e0cf3e 100644 --- a/grub-core/gnulib/regcomp.c +++ b/grub-core/gnulib/regcomp.c @@ -1,22 +1,21 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 2002-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, size_t length, reg_syntax_t syntax); @@ -95,20 +94,20 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, re_charset_t *mbcset, Idx *char_class_alloc, - const unsigned char *class_name, + const char *class_name, reg_syntax_t syntax); #else /* not RE_ENABLE_I18N */ static reg_errcode_t build_equiv_class (bitset_t sbcset, const unsigned char *name); static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, - const unsigned char *class_name, + const char *class_name, reg_syntax_t syntax); #endif /* not RE_ENABLE_I18N */ static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, - const unsigned char *class_name, - const unsigned char *extra, + const char *class_name, + const char *extra, bool non_match, reg_errcode_t *err); static bin_tree_t *create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, @@ -207,7 +206,7 @@ static const size_t __re_error_msgid_idx[] = compiles PATTERN (of length LENGTH) and puts the result in BUFP. Returns 0 if the pattern was valid, otherwise an error string. - Assumes the `allocated' (and perhaps `buffer') and `translate' fields + Assumes the 'allocated' (and perhaps 'buffer') and 'translate' fields are set in BUFP on entry. */ #ifdef _LIBC @@ -242,7 +241,7 @@ re_compile_pattern (const char *pattern, size_t length, weak_alias (__re_compile_pattern, re_compile_pattern) #endif -/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can +/* Set by 're_set_syntax' to the current regexp syntax to recognize. Can also be assigned to arbitrarily: each pattern buffer stores its own syntax, so it can be changed between regex compilations. */ /* This has no initializer because initialized variables in Emacs @@ -274,7 +273,7 @@ int re_compile_fastmap (bufp) struct re_pattern_buffer *bufp; { - re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; + re_dfa_t *dfa = bufp->buffer; char *fastmap = bufp->fastmap; memset (fastmap, '\0', sizeof (char) * SBC_MAX); @@ -293,7 +292,7 @@ weak_alias (__re_compile_fastmap, re_compile_fastmap) #endif static inline void -__attribute ((always_inline)) +__attribute__ ((always_inline)) re_set_fastmap (char *fastmap, bool icase, int ch) { fastmap[ch] = 1; @@ -308,7 +307,7 @@ static void re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, char *fastmap) { - re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; + re_dfa_t *dfa = bufp->buffer; Idx node_cnt; bool icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE)); for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt) @@ -440,15 +439,15 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, PREG is a regex_t *. We do not expect any fields to be initialized, since POSIX says we shouldn't. Thus, we set - `buffer' to the compiled pattern; - `used' to the length of the compiled pattern; - `syntax' to RE_SYNTAX_POSIX_EXTENDED if the + 'buffer' to the compiled pattern; + 'used' to the length of the compiled pattern; + 'syntax' to RE_SYNTAX_POSIX_EXTENDED if the REG_EXTENDED bit in CFLAGS is set; otherwise, to RE_SYNTAX_POSIX_BASIC; - `newline_anchor' to REG_NEWLINE being set in CFLAGS; - `fastmap' to an allocated space for the fastmap; - `fastmap_accurate' to zero; - `re_nsub' to the number of subexpressions in PATTERN. + 'newline_anchor' to REG_NEWLINE being set in CFLAGS; + 'fastmap' to an allocated space for the fastmap; + 'fastmap_accurate' to zero; + 're_nsub' to the number of subexpressions in PATTERN. PATTERN is the address of the pattern string. @@ -551,10 +550,6 @@ regerror (int errcode, const regex_t *_Restrict_ preg, if (BE (errcode < 0 || errcode >= (int) (sizeof (__re_error_msgid_idx) / sizeof (__re_error_msgid_idx[0])), 0)) - /* Only error codes returned by the rest of the code should be passed - to this routine. If we are given anything else, or if other regex - code generates an invalid error code, then the program has a bug. - Dump core so we can fix it. */ msg = gettext ("unknown regexp error"); else msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); @@ -587,19 +582,23 @@ weak_alias (__regerror, regerror) static const bitset_t utf8_sb_map = { /* Set the first 128 bits. */ -# if 4 * BITSET_WORD_BITS < ASCII_CHARS -# error "bitset_word_t is narrower than 32 bits" -# elif 3 * BITSET_WORD_BITS < ASCII_CHARS +# ifdef __GNUC__ + [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX +# else +# if 4 * BITSET_WORD_BITS < ASCII_CHARS +# error "bitset_word_t is narrower than 32 bits" +# elif 3 * BITSET_WORD_BITS < ASCII_CHARS BITSET_WORD_MAX, BITSET_WORD_MAX, BITSET_WORD_MAX, -# elif 2 * BITSET_WORD_BITS < ASCII_CHARS +# elif 2 * BITSET_WORD_BITS < ASCII_CHARS BITSET_WORD_MAX, BITSET_WORD_MAX, -# elif 1 * BITSET_WORD_BITS < ASCII_CHARS +# elif 1 * BITSET_WORD_BITS < ASCII_CHARS BITSET_WORD_MAX, -# endif +# endif (BITSET_WORD_MAX >> (SBC_MAX % BITSET_WORD_BITS == 0 ? 0 : BITSET_WORD_BITS - SBC_MAX % BITSET_WORD_BITS)) +# endif }; #endif @@ -658,7 +657,7 @@ void regfree (preg) regex_t *preg; { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; if (BE (dfa != NULL, 1)) free_dfa_content (dfa); preg->buffer = NULL; @@ -719,7 +718,7 @@ re_comp (s) + __re_error_msgid_idx[(int) REG_ESPACE]); } - /* Since `re_exec' always passes NULL for the `regs' argument, we + /* Since 're_exec' always passes NULL for the 'regs' argument, we don't need to initialize the pattern buffer fields which affect it. */ /* Match anchors at newlines. */ @@ -730,7 +729,7 @@ re_comp (s) if (!ret) return NULL; - /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ + /* Yes, we're discarding 'const' here if !HAVE_LIBINTL. */ return (char *) gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]); } @@ -765,7 +764,7 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length, preg->regs_allocated = REGS_UNALLOCATED; /* Initialize the dfa. */ - dfa = (re_dfa_t *) preg->buffer; + dfa = preg->buffer; if (BE (preg->allocated < sizeof (re_dfa_t), 0)) { /* If zero allocated, but buffer is non-null, try to realloc @@ -874,7 +873,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) calculation below, and for similar doubling calculations elsewhere. And it's <= rather than <, because some of the doubling calculations add 1 afterwards. */ - if (BE (SIZE_MAX / max_object_size / 2 <= pat_len, 0)) + if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) / 2 <= pat_len, 0)) return REG_ESPACE; dfa->nodes_alloc = pat_len + 1; @@ -897,8 +896,10 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) != 0); #else codeset_name = nl_langinfo (CODESET); - if (strcasecmp (codeset_name, "UTF-8") == 0 - || strcasecmp (codeset_name, "UTF8") == 0) + if ((codeset_name[0] == 'U' || codeset_name[0] == 'u') + && (codeset_name[1] == 'T' || codeset_name[1] == 't') + && (codeset_name[2] == 'F' || codeset_name[2] == 'f') + && strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0) dfa->is_utf8 = 1; /* We check exhaustively in the loop below if this charset is a @@ -948,9 +949,43 @@ static void internal_function init_word_char (re_dfa_t *dfa) { - int i, j, ch; + int i = 0; + int j; + int ch = 0; dfa->word_ops_used = 1; - for (i = 0, ch = 0; i < BITSET_WORDS; ++i) + if (BE (dfa->map_notascii == 0, 1)) + { + bitset_word_t bits0 = 0x00000000; + bitset_word_t bits1 = 0x03ff0000; + bitset_word_t bits2 = 0x87fffffe; + bitset_word_t bits3 = 0x07fffffe; + if (BITSET_WORD_BITS == 64) + { + dfa->word_char[0] = bits1 << 31 << 1 | bits0; + dfa->word_char[1] = bits3 << 31 << 1 | bits2; + i = 2; + } + else if (BITSET_WORD_BITS == 32) + { + dfa->word_char[0] = bits0; + dfa->word_char[1] = bits1; + dfa->word_char[2] = bits2; + dfa->word_char[3] = bits3; + i = 4; + } + else + goto general_case; + ch = 128; + + if (BE (dfa->is_utf8, 1)) + { + memset (&dfa->word_char[i], '\0', (SBC_MAX - ch) / 8); + return; + } + } + + general_case: + for (; i < BITSET_WORDS; ++i) for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) if (isalnum (ch) || ch == '_') dfa->word_char[i] |= (bitset_word_t) 1 << j; @@ -961,7 +996,7 @@ init_word_char (re_dfa_t *dfa) static void free_workarea_compile (regex_t *preg) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; bin_tree_storage_t *storage, *next; for (storage = dfa->str_tree_storage; storage; storage = next) { @@ -1145,7 +1180,7 @@ optimize_utf8 (re_dfa_t *dfa) static reg_errcode_t analyze (regex_t *preg) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; reg_errcode_t ret; /* Allocate arrays. */ @@ -1326,7 +1361,7 @@ lower_subexps (void *extra, bin_tree_t *node) static bin_tree_t * lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; bin_tree_t *body = node->left; bin_tree_t *op, *cls, *tree1, *tree; @@ -1660,7 +1695,7 @@ calc_eclosure (re_dfa_t *dfa) /* If we have already calculated, skip it. */ if (dfa->eclosures[node_idx].nelem != 0) continue; - /* Calculate epsilon closure of `node_idx'. */ + /* Calculate epsilon closure of 'node_idx'. */ err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, true); if (BE (err != REG_NOERROR, 0)) return err; @@ -1710,14 +1745,14 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) { re_node_set eclosure_elem; Idx edest = dfa->edests[node].elems[i]; - /* If calculating the epsilon closure of `edest' is in progress, + /* If calculating the epsilon closure of 'edest' is in progress, return intermediate result. */ if (dfa->eclosures[edest].nelem == REG_MISSING) { incomplete = true; continue; } - /* If we haven't calculated the epsilon closure of `edest' yet, + /* If we haven't calculated the epsilon closure of 'edest' yet, calculate now. Otherwise use calculated epsilon closure. */ if (dfa->eclosures[edest].nelem == 0) { @@ -1727,11 +1762,11 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root) } else eclosure_elem = dfa->eclosures[edest]; - /* Merge the epsilon closure of `edest'. */ + /* Merge the epsilon closure of 'edest'. */ err = re_node_set_merge (&eclosure, &eclosure_elem); if (BE (err != REG_NOERROR, 0)) return err; - /* If the epsilon closure of `edest' is incomplete, + /* If the epsilon closure of 'edest' is incomplete, the epsilon closure of this node is also incomplete. */ if (dfa->eclosures[edest].nelem == 0) { @@ -2093,7 +2128,7 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax) /* Entry point of the parser. Parse the regular expression REGEXP and return the structure tree. - If an error is occured, ERR is set by error code, and return NULL. + If an error occurs, ERR is set by error code, and return NULL. This function build the following tree, from regular expression : CAT / \ @@ -2107,7 +2142,7 @@ static bin_tree_t * parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax, reg_errcode_t *err) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; bin_tree_t *tree, *eor, *root; re_token_t current_token; dfa->syntax = syntax; @@ -2135,13 +2170,13 @@ parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax, / \ - ALT means alternative, which represents the operator `|'. */ + ALT means alternative, which represents the operator '|'. */ static bin_tree_t * parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; bin_tree_t *tree, *branch = NULL; tree = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) @@ -2183,7 +2218,7 @@ parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { bin_tree_t *tree, *expr; - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; tree = parse_expression (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -2194,16 +2229,21 @@ parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token, expr = parse_expression (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && expr == NULL, 0)) { + if (tree != NULL) + postorder (tree, free_tree, NULL); return NULL; } if (tree != NULL && expr != NULL) { - tree = create_tree (dfa, tree, expr, CONCAT); - if (tree == NULL) + bin_tree_t *newtree = create_tree (dfa, tree, expr, CONCAT); + if (newtree == NULL) { + postorder (expr, free_tree, NULL); + postorder (tree, free_tree, NULL); *err = REG_ESPACE; return NULL; } + tree = newtree; } else if (tree == NULL) tree = expr; @@ -2222,7 +2262,7 @@ static bin_tree_t * parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; bin_tree_t *tree; switch (token->type) { @@ -2378,8 +2418,8 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, case OP_WORD: case OP_NOTWORD: tree = build_charclass_op (dfa, regexp->trans, - (const unsigned char *) "alnum", - (const unsigned char *) "_", + "alnum", + "_", token->type == OP_NOTWORD, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -2387,8 +2427,8 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, case OP_SPACE: case OP_NOTSPACE: tree = build_charclass_op (dfa, regexp->trans, - (const unsigned char *) "space", - (const unsigned char *) "", + "space", + "", token->type == OP_NOTSPACE, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -2438,7 +2478,7 @@ static bin_tree_t * parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; bin_tree_t *tree; size_t cur_nsub; cur_nsub = preg->re_nsub++; @@ -2452,7 +2492,11 @@ parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, { tree = parse_reg_exp (regexp, preg, token, syntax, nest, err); if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0)) - *err = REG_EPAREN; + { + if (tree != NULL) + postorder (tree, free_tree, NULL); + *err = REG_EPAREN; + } if (BE (*err != REG_NOERROR, 0)) return NULL; } @@ -2530,6 +2574,12 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, *err = REG_BADBR; return NULL; } + + if (BE (RE_DUP_MAX < (end == REG_MISSING ? start : end), 0)) + { + *err = REG_ESIZE; + return NULL; + } } else { @@ -2570,7 +2620,10 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, old_tree = NULL; if (elem->token.type == SUBEXP) - postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx); + { + uintptr_t subidx = elem->token.opr.idx; + postorder (elem, mark_opt_subexp, (void *) subidx); + } tree = create_tree (dfa, elem, NULL, (end == REG_MISSING ? OP_DUP_ASTERISK : OP_ALT)); @@ -2616,7 +2669,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, Build the range expression which starts from START_ELEM, and ends at END_ELEM. The result are written to MBCSET and SBCSET. RANGE_ALLOC is the allocated size of mbcset->range_starts, and - mbcset->range_ends, is a pointer argument sinse we may + mbcset->range_ends, is a pointer argument since we may update it. */ static reg_errcode_t @@ -2655,7 +2708,6 @@ build_range_exp (const reg_syntax_t syntax, wchar_t wc; wint_t start_wc; wint_t end_wc; - wchar_t cmp_buf[6] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'}; start_ch = ((start_elem->type == SB_CHAR) ? start_elem->opr.ch : ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0] @@ -2669,11 +2721,7 @@ build_range_exp (const reg_syntax_t syntax, ? __btowc (end_ch) : end_elem->opr.wch); if (start_wc == WEOF || end_wc == WEOF) return REG_ECOLLATE; - cmp_buf[0] = start_wc; - cmp_buf[4] = end_wc; - - if (BE ((syntax & RE_NO_EMPTY_RANGES) - && wcscoll (cmp_buf, cmp_buf + 4) > 0, 0)) + else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0)) return REG_ERANGE; /* Got valid collation sequence values, add them as a new entry. @@ -2714,9 +2762,7 @@ build_range_exp (const reg_syntax_t syntax, /* Build the table for single byte characters. */ for (wc = 0; wc < SBC_MAX; ++wc) { - cmp_buf[2] = wc; - if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 - && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) + if (start_wc <= wc && wc <= end_wc) bitset_set (sbcset, wc); } } @@ -2750,11 +2796,12 @@ build_range_exp (const reg_syntax_t syntax, static reg_errcode_t internal_function -build_collating_symbol (bitset_t sbcset, # ifdef RE_ENABLE_I18N - re_charset_t *mbcset, Idx *coll_sym_alloc, -# endif - const unsigned char *name) +build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, + Idx *coll_sym_alloc, const unsigned char *name) +# else /* not RE_ENABLE_I18N */ +build_collating_symbol (bitset_t sbcset, const unsigned char *name) +# endif /* not RE_ENABLE_I18N */ { size_t name_len = strlen ((const char *) name); if (BE (name_len != 1, 0)) @@ -2782,42 +2829,31 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, const int32_t *symb_table; const unsigned char *extra; - /* Local function for parse_bracket_exp used in _LIBC environement. - Seek the collating symbol entry correspondings to NAME. - Return the index of the symbol in the SYMB_TABLE. */ + /* Local function for parse_bracket_exp used in _LIBC environment. + Seek the collating symbol entry corresponding to NAME. + Return the index of the symbol in the SYMB_TABLE, + or -1 if not found. */ auto inline int32_t - __attribute ((always_inline)) - seek_collating_symbol_entry (name, name_len) - const unsigned char *name; - size_t name_len; + __attribute__ ((always_inline)) + seek_collating_symbol_entry (const unsigned char *name, size_t name_len) { - int32_t hash = elem_hash ((const char *) name, name_len); - int32_t elem = hash % table_size; - if (symb_table[2 * elem] != 0) - { - int32_t second = hash % (table_size - 2) + 1; + int32_t elem; - do - { - /* First compare the hashing value. */ - if (symb_table[2 * elem] == hash - /* Compare the length of the name. */ - && name_len == extra[symb_table[2 * elem + 1]] - /* Compare the name. */ - && memcmp (name, &extra[symb_table[2 * elem + 1] + 1], - name_len) == 0) - { - /* Yep, this is the entry. */ - break; - } - - /* Next entry. */ - elem += second; - } - while (symb_table[2 * elem] != 0); - } - return elem; + for (elem = 0; elem < table_size; elem++) + if (symb_table[2 * elem] != 0) + { + int32_t idx = symb_table[2 * elem + 1]; + /* Skip the name of collating element name. */ + idx += 1 + extra[idx]; + if (/* Compare the length of the name. */ + name_len == extra[idx] + /* Compare the name. */ + && memcmp (name, &extra[idx + 1], name_len) == 0) + /* Yep, this is the entry. */ + return elem; + } + return -1; } /* Local function for parse_bracket_exp used in _LIBC environment. @@ -2825,9 +2861,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, Return the value if succeeded, UINT_MAX otherwise. */ auto inline unsigned int - __attribute ((always_inline)) - lookup_collation_sequence_value (br_elem) - bracket_elem_t *br_elem; + __attribute__ ((always_inline)) + lookup_collation_sequence_value (bracket_elem_t *br_elem) { if (br_elem->type == SB_CHAR) { @@ -2855,7 +2890,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, int32_t elem, idx; elem = seek_collating_symbol_entry (br_elem->opr.name, sym_name_len); - if (symb_table[2 * elem] != 0) + if (elem != -1) { /* We found the entry. */ idx = symb_table[2 * elem + 1]; @@ -2873,7 +2908,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, /* Return the collation sequence value. */ return *(unsigned int *) (extra + idx); } - else if (symb_table[2 * elem] == 0 && sym_name_len == 1) + else if (sym_name_len == 1) { /* No valid character. Match it as a single byte character. */ @@ -2886,20 +2921,17 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, return UINT_MAX; } - /* Local function for parse_bracket_exp used in _LIBC environement. + /* Local function for parse_bracket_exp used in _LIBC environment. Build the range expression which starts from START_ELEM, and ends at END_ELEM. The result are written to MBCSET and SBCSET. RANGE_ALLOC is the allocated size of mbcset->range_starts, and - mbcset->range_ends, is a pointer argument sinse we may + mbcset->range_ends, is a pointer argument since we may update it. */ auto inline reg_errcode_t - __attribute ((always_inline)) - build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem) - re_charset_t *mbcset; - Idx *range_alloc; - bitset_t sbcset; - bracket_elem_t *start_elem, *end_elem; + __attribute__ ((always_inline)) + build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc, + bracket_elem_t *start_elem, bracket_elem_t *end_elem) { unsigned int ch; uint32_t start_collseq; @@ -2912,6 +2944,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, 0)) return REG_ERANGE; + /* FIXME: Implement rational ranges here, too. */ start_collseq = lookup_collation_sequence_value (start_elem); end_collseq = lookup_collation_sequence_value (end_elem); /* Check start/end collation sequence values. */ @@ -2970,33 +3003,30 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, return REG_NOERROR; } - /* Local function for parse_bracket_exp used in _LIBC environement. + /* Local function for parse_bracket_exp used in _LIBC environment. Build the collating element which is represented by NAME. The result are written to MBCSET and SBCSET. COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a - pointer argument sinse we may update it. */ + pointer argument since we may update it. */ auto inline reg_errcode_t - __attribute ((always_inline)) - build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name) - re_charset_t *mbcset; - Idx *coll_sym_alloc; - bitset_t sbcset; - const unsigned char *name; + __attribute__ ((always_inline)) + build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, + Idx *coll_sym_alloc, const unsigned char *name) { int32_t elem, idx; size_t name_len = strlen ((const char *) name); if (nrules != 0) { elem = seek_collating_symbol_entry (name, name_len); - if (symb_table[2 * elem] != 0) + if (elem != -1) { /* We found the entry. */ idx = symb_table[2 * elem + 1]; /* Skip the name of collating element name. */ idx += 1 + extra[idx]; } - else if (symb_table[2 * elem] == 0 && name_len == 1) + else if (name_len == 1) { /* No valid character, treat it as a normal character. */ @@ -3076,6 +3106,10 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, if (BE (sbcset == NULL, 0)) #endif /* RE_ENABLE_I18N */ { + re_free (sbcset); +#ifdef RE_ENABLE_I18N + re_free (mbcset); +#endif *err = REG_ESPACE; return NULL; } @@ -3235,7 +3269,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, #ifdef RE_ENABLE_I18N mbcset, &char_class_alloc, #endif /* RE_ENABLE_I18N */ - start_elem.opr.name, syntax); + (const char *) start_elem.opr.name, + syntax); if (BE (*err != REG_NOERROR, 0)) goto parse_bracket_exp_free_return; break; @@ -3414,7 +3449,7 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp, Build the equivalence class which is represented by NAME. The result are written to MBCSET and SBCSET. EQUIV_CLASS_ALLOC is the allocated size of mbcset->equiv_classes, - is a pointer argument sinse we may update it. */ + is a pointer argument since we may update it. */ static reg_errcode_t #ifdef RE_ENABLE_I18N @@ -3445,19 +3480,18 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); - idx1 = findidx (&cp); - if (BE (idx1 == 0 || cp < name + strlen ((const char *) name), 0)) + idx1 = findidx (&cp, -1); + if (BE (idx1 == 0 || *cp != '\0', 0)) /* This isn't a valid character. */ return REG_ECOLLATE; - /* Build single byte matcing table for this equivalence class. */ - char_buf[1] = (unsigned char) '\0'; + /* Build single byte matching table for this equivalence class. */ len = weights[idx1 & 0xffffff]; for (ch = 0; ch < SBC_MAX; ++ch) { char_buf[0] = ch; cp = char_buf; - idx2 = findidx (&cp); + idx2 = findidx (&cp, 1); /* idx2 = table[ch]; */ @@ -3510,20 +3544,20 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name) Build the character class which is represented by NAME. The result are written to MBCSET and SBCSET. CHAR_CLASS_ALLOC is the allocated size of mbcset->char_classes, - is a pointer argument sinse we may update it. */ + is a pointer argument since we may update it. */ static reg_errcode_t #ifdef RE_ENABLE_I18N build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, re_charset_t *mbcset, Idx *char_class_alloc, - const unsigned char *class_name, reg_syntax_t syntax) + const char *class_name, reg_syntax_t syntax) #else /* not RE_ENABLE_I18N */ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, - const unsigned char *class_name, reg_syntax_t syntax) + const char *class_name, reg_syntax_t syntax) #endif /* not RE_ENABLE_I18N */ { int i; - const char *name = (const char *) class_name; + const char *name = class_name; /* In case of REG_ICASE "upper" and "lower" match the both of upper and lower cases. */ @@ -3597,8 +3631,8 @@ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, static bin_tree_t * build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, - const unsigned char *class_name, - const unsigned char *extra, bool non_match, + const char *class_name, + const char *extra, bool non_match, reg_errcode_t *err) { re_bitset_ptr_t sbcset; @@ -3704,8 +3738,9 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, } /* This is intended for the expressions like "a{1,3}". - Fetch a number from `input', and return the number. + Fetch a number from 'input', and return the number. Return REG_MISSING if the number field is empty like "{,1}". + Return RE_DUP_MAX + 1 if the number field is too large. Return REG_ERROR if an error occurred. */ static Idx @@ -3724,8 +3759,9 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax) num = ((token->type != CHARACTER || c < '0' || '9' < c || num == REG_ERROR) ? REG_ERROR - : ((num == REG_MISSING) ? c - '0' : num * 10 + c - '0')); - num = (num > RE_DUP_MAX) ? REG_ERROR : num; + : num == REG_MISSING + ? c - '0' + : MIN (RE_DUP_MAX + 1, num * 10 + c - '0')); } return num; } @@ -3799,7 +3835,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node) { - Idx idx = (Idx) (long) extra; + Idx idx = (uintptr_t) extra; if (node->token.type == SUBEXP && node->token.opr.idx == idx) node->token.opt_subexp = 1; diff --git a/grub-core/gnulib/regex.c b/grub-core/gnulib/regex.c index ba0eebee7..5a0332e00 100644 --- a/grub-core/gnulib/regex.c +++ b/grub-core/gnulib/regex.c @@ -1,26 +1,35 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2005, 2006, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 2002-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ -#include +#ifndef _LIBC +# include -/* Make sure noone compiles this code with a C++ compiler. */ +# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ +# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +# endif +# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ +# pragma GCC diagnostic ignored "-Wold-style-definition" +# pragma GCC diagnostic ignored "-Wtype-limits" +# endif +#endif + +/* Make sure no one compiles this code with a C++ compiler. */ #if defined __cplusplus && defined _LIBC # error "This is C code, use a C compiler" #endif diff --git a/grub-core/gnulib/regex.h b/grub-core/gnulib/regex.h index 1c139d680..854c6edaf 100644 --- a/grub-core/gnulib/regex.h +++ b/grub-core/gnulib/regex.h @@ -1,23 +1,22 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1998, - 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software + Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ #ifndef _REGEX_H #define _REGEX_H 1 @@ -29,13 +28,10 @@ extern "C" { #endif -/* Define __USE_GNU_REGEX to declare GNU extensions that violate the +/* Define __USE_GNU to declare GNU extensions that violate the POSIX name space rules. */ -#undef __USE_GNU_REGEX -#if (defined _GNU_SOURCE \ - || (!defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE \ - && !defined _XOPEN_SOURCE)) -# define __USE_GNU_REGEX 1 +#ifdef _GNU_SOURCE +# define __USE_GNU 1 #endif #ifdef _REGEX_LARGE_OFFSETS @@ -46,16 +42,6 @@ extern "C" { supported within glibc itself, and glibc users should not define _REGEX_LARGE_OFFSETS. */ -/* The type of the offset of a byte within a string. - For historical reasons POSIX 1003.1-2004 requires that regoff_t be - at least as wide as off_t. However, many common POSIX platforms set - regoff_t to the more-sensible ssize_t and the Open Group has - signalled its intention to change the requirement to be that - regoff_t be at least as wide as ptrdiff_t and ssize_t; see XBD ERN - 60 (2005-08-25). We don't know of any hosts where ssize_t or - ptrdiff_t is wider than ssize_t, so ssize_t is safe. */ -typedef ssize_t regoff_t; - /* The type of nonnegative object indexes. Traditionally, GNU regex uses 'int' for these. Code that uses __re_idx_t should work regardless of whether the type is signed. */ @@ -70,10 +56,8 @@ typedef size_t __re_long_size_t; #else -/* Use types that are binary-compatible with the traditional GNU regex - implementation, which mishandles strings longer than INT_MAX. */ - -typedef int regoff_t; +/* The traditional GNU regex implementation mishandles strings longer + than INT_MAX. */ typedef int __re_idx_t; typedef unsigned int __re_size_t; typedef unsigned long int __re_long_size_t; @@ -94,8 +78,7 @@ typedef unsigned long int active_reg_t; add or remove a bit, only one other definition need change. */ typedef unsigned long int reg_syntax_t; -#ifdef __USE_GNU_REGEX - +#ifdef __USE_GNU /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ # define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) @@ -162,9 +145,9 @@ typedef unsigned long int reg_syntax_t; If not set, newline is literal. */ # define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) -/* If this bit is set, then `{...}' defines an interval, and \{ and \} +/* If this bit is set, then '{...}' defines an interval, and \{ and \} are literals. - If not set, then `\{...\}' defines an interval. */ + If not set, then '\{...\}' defines an interval. */ # define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) /* If this bit is set, (...) defines a group, and \( and \) are literals. @@ -226,8 +209,7 @@ typedef unsigned long int reg_syntax_t; /* If this bit is set, then no_sub will be set to 1 during re_compile_pattern. */ # define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1) - -#endif /* defined __USE_GNU_REGEX */ +#endif /* This global variable defines the particular regexp syntax to use (for some interfaces). When a regexp is compiled, the syntax used is @@ -235,7 +217,7 @@ typedef unsigned long int reg_syntax_t; already-compiled regexps. */ extern reg_syntax_t re_syntax_options; -#ifdef __USE_GNU_REGEX +#ifdef __USE_GNU /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so don't delete them!) */ @@ -247,16 +229,19 @@ extern reg_syntax_t re_syntax_options; | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CHAR_CLASSES \ | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) # define RE_SYNTAX_GNU_AWK \ - ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ - & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \ - | RE_CONTEXT_INVALID_OPS )) + ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ + | RE_INVALID_INTERVAL_ORD) \ + & ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS \ + | RE_CONTEXT_INVALID_OPS )) # define RE_SYNTAX_POSIX_AWK \ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ - | RE_INTERVALS | RE_NO_GNU_OPS) + | RE_INTERVALS | RE_NO_GNU_OPS \ + | RE_INVALID_INTERVAL_ORD) # define RE_SYNTAX_GREP \ (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ @@ -307,13 +292,12 @@ extern reg_syntax_t re_syntax_options; | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) /* [[[end syntaxes]]] */ -#endif /* defined __USE_GNU_REGEX */ - -#ifdef __USE_GNU_REGEX - /* Maximum number of duplicates an interval can allow. POSIX-conforming systems might define this in , but we want our value, so remove any previous define. */ +# ifdef _REGEX_INCLUDE_LIMITS_H +# include +# endif # ifdef RE_DUP_MAX # undef RE_DUP_MAX # endif @@ -321,16 +305,15 @@ extern reg_syntax_t re_syntax_options; /* RE_DUP_MAX is 2**15 - 1 because an earlier implementation stored the counter as a 2-byte signed integer. This is no longer true, so RE_DUP_MAX could be increased to (INT_MAX / 10 - 1), or to - ((SIZE_MAX - 2) / 10 - 1) if _REGEX_LARGE_OFFSETS is defined. + ((SIZE_MAX - 9) / 10) if _REGEX_LARGE_OFFSETS is defined. However, there would be a huge performance problem if someone actually used a pattern like a\{214748363\}, so RE_DUP_MAX retains its historical value. */ # define RE_DUP_MAX (0x7fff) - -#endif /* defined __USE_GNU_REGEX */ +#endif -/* POSIX `cflags' bits (i.e., information for `regcomp'). */ +/* POSIX 'cflags' bits (i.e., information for 'regcomp'). */ /* If this bit is set, then use extended regular expression syntax. If not set, then use basic regular expression syntax. */ @@ -350,7 +333,7 @@ extern reg_syntax_t re_syntax_options; #define REG_NOSUB (1 << 3) -/* POSIX `eflags' bits (i.e., information for regexec). */ +/* POSIX 'eflags' bits (i.e., information for regexec). */ /* If this bit is set, then the beginning-of-line operator doesn't match the beginning of the string (presumably because it's not the @@ -368,7 +351,7 @@ extern reg_syntax_t re_syntax_options; /* If any error codes are removed, changed, or added, update the - `__re_error_msgid' table in regcomp.c. */ + '__re_error_msgid' table in regcomp.c. */ typedef enum { @@ -393,11 +376,11 @@ typedef enum /* Error codes we've added. */ _REG_EEND, /* Premature end. */ - _REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ + _REG_ESIZE, /* Too large (e.g., repeat count too large). */ _REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ } reg_errcode_t; -#ifdef _XOPEN_SOURCE +#if defined _XOPEN_SOURCE || defined __USE_XOPEN2K # define REG_ENOSYS _REG_ENOSYS #endif #define REG_NOERROR _REG_NOERROR @@ -418,129 +401,127 @@ typedef enum #define REG_ESIZE _REG_ESIZE #define REG_ERPAREN _REG_ERPAREN -/* struct re_pattern_buffer normally uses member names like `buffer' - that POSIX does not allow. In POSIX mode these members have names - with leading `re_' (e.g., `re_buffer'). */ -#ifdef __USE_GNU_REGEX -# define _REG_RE_NAME(id) id -# define _REG_RM_NAME(id) id -#else -# define _REG_RE_NAME(id) re_##id -# define _REG_RM_NAME(id) rm_##id -#endif - -/* The user can specify the type of the re_translate member by - defining the macro RE_TRANSLATE_TYPE, which defaults to unsigned - char *. This pollutes the POSIX name space, so in POSIX mode just - use unsigned char *. */ -#ifdef __USE_GNU_REGEX -# ifndef RE_TRANSLATE_TYPE -# define RE_TRANSLATE_TYPE unsigned char * -# endif -# define REG_TRANSLATE_TYPE RE_TRANSLATE_TYPE -#else -# define REG_TRANSLATE_TYPE unsigned char * -#endif - /* This data structure represents a compiled pattern. Before calling - the pattern compiler, the fields `buffer', `allocated', `fastmap', - `translate', and `no_sub' can be set. After the pattern has been - compiled, the `re_nsub' field is available. All other fields are - private to the regex routines. */ + the pattern compiler, the fields 'buffer', 'allocated', 'fastmap', + and 'translate' can be set. After the pattern has been compiled, + the fields 're_nsub', 'not_bol' and 'not_eol' are available. All + other fields are private to the regex routines. */ -struct re_dfa_t; -typedef struct re_dfa_t re_dfa_t; +#ifndef RE_TRANSLATE_TYPE +# define __RE_TRANSLATE_TYPE unsigned char * +# ifdef __USE_GNU +# define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE +# endif +#endif + +#ifdef __USE_GNU +# define __REPB_PREFIX(name) name +#else +# define __REPB_PREFIX(name) __##name +#endif struct re_pattern_buffer { - /* Space that holds the compiled pattern. It is declared as - `unsigned char *' because its elements are sometimes used as - array indexes. */ - re_dfa_t *_REG_RE_NAME (buffer); + /* Space that holds the compiled pattern. The type + 'struct re_dfa_t' is private and is not declared here. */ + struct re_dfa_t *__REPB_PREFIX(buffer); - /* Number of bytes to which `buffer' points. */ - __re_long_size_t _REG_RE_NAME (allocated); + /* Number of bytes to which 'buffer' points. */ + __re_long_size_t __REPB_PREFIX(allocated); - /* Number of bytes actually used in `buffer'. */ - __re_long_size_t _REG_RE_NAME (used); + /* Number of bytes actually used in 'buffer'. */ + __re_long_size_t __REPB_PREFIX(used); /* Syntax setting with which the pattern was compiled. */ - reg_syntax_t _REG_RE_NAME (syntax); + reg_syntax_t __REPB_PREFIX(syntax); /* Pointer to a fastmap, if any, otherwise zero. re_search uses the fastmap, if there is one, to skip over impossible starting points for matches. */ - char *_REG_RE_NAME (fastmap); + char *__REPB_PREFIX(fastmap); /* Either a translate table to apply to all characters before comparing them, or zero for no translation. The translation is applied to a pattern when it is compiled and to a string when it is matched. */ - REG_TRANSLATE_TYPE _REG_RE_NAME (translate); + __RE_TRANSLATE_TYPE __REPB_PREFIX(translate); /* Number of subexpressions found by the compiler. */ size_t re_nsub; /* Zero if this pattern cannot match the empty string, one else. - Well, in truth it's used only in `re_search_2', to see whether or + Well, in truth it's used only in 're_search_2', to see whether or not we should use the fastmap, so we don't set this absolutely - perfectly; see `re_compile_fastmap' (the `duplicate' case). */ - unsigned int _REG_RE_NAME (can_be_null) : 1; + perfectly; see 're_compile_fastmap' (the "duplicate" case). */ + unsigned __REPB_PREFIX(can_be_null) : 1; - /* If REGS_UNALLOCATED, allocate space in the `regs' structure - for `max (RE_NREGS, re_nsub + 1)' groups. + /* If REGS_UNALLOCATED, allocate space in the 'regs' structure + for 'max (RE_NREGS, re_nsub + 1)' groups. If REGS_REALLOCATE, reallocate space if necessary. If REGS_FIXED, use what's there. */ -#ifdef __USE_GNU_REGEX +#ifdef __USE_GNU # define REGS_UNALLOCATED 0 # define REGS_REALLOCATE 1 # define REGS_FIXED 2 #endif - unsigned int _REG_RE_NAME (regs_allocated) : 2; + unsigned __REPB_PREFIX(regs_allocated) : 2; - /* Set to zero when `re_compile_pattern' compiles a pattern; set to - one by `re_compile_fastmap' if it updates the fastmap. */ - unsigned int _REG_RE_NAME (fastmap_accurate) : 1; + /* Set to zero when 're_compile_pattern' compiles a pattern; set to + one by 're_compile_fastmap' if it updates the fastmap. */ + unsigned __REPB_PREFIX(fastmap_accurate) : 1; - /* If set, `re_match_2' does not return information about + /* If set, 're_match_2' does not return information about subexpressions. */ - unsigned int _REG_RE_NAME (no_sub) : 1; + unsigned __REPB_PREFIX(no_sub) : 1; /* If set, a beginning-of-line anchor doesn't match at the beginning of the string. */ - unsigned int _REG_RE_NAME (not_bol) : 1; + unsigned __REPB_PREFIX(not_bol) : 1; /* Similarly for an end-of-line anchor. */ - unsigned int _REG_RE_NAME (not_eol) : 1; + unsigned __REPB_PREFIX(not_eol) : 1; /* If true, an anchor at a newline matches. */ - unsigned int _REG_RE_NAME (newline_anchor) : 1; - -/* [[[end pattern_buffer]]] */ + unsigned __REPB_PREFIX(newline_anchor) : 1; }; typedef struct re_pattern_buffer regex_t; +/* Type for byte offsets within the string. POSIX mandates this. */ +#ifdef _REGEX_LARGE_OFFSETS +/* POSIX 1003.1-2008 requires that regoff_t be at least as wide as + ptrdiff_t and ssize_t. We don't know of any hosts where ptrdiff_t + is wider than ssize_t, so ssize_t is safe. */ +typedef ssize_t regoff_t; +#else +/* The traditional GNU regex implementation mishandles strings longer + than INT_MAX. */ +typedef int regoff_t; +#endif + + +#ifdef __USE_GNU /* This is the structure we store register match data in. See regex.texinfo for a full description of what registers match. */ struct re_registers { - __re_size_t _REG_RM_NAME (num_regs); - regoff_t *_REG_RM_NAME (start); - regoff_t *_REG_RM_NAME (end); + __re_size_t num_regs; + regoff_t *start; + regoff_t *end; }; -/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, - `re_match_2' returns information about at least this many registers - the first time a `regs' structure is passed. */ -#if !defined RE_NREGS && defined __USE_GNU_REGEX -# define RE_NREGS 30 +/* If 'regs_allocated' is REGS_UNALLOCATED in the pattern buffer, + 're_match_2' returns information about at least this many registers + the first time a 'regs' structure is passed. */ +# ifndef RE_NREGS +# define RE_NREGS 30 +# endif #endif /* POSIX specification for registers. Aside from the different names than - `re_registers', POSIX uses an array of structures, instead of a + 're_registers', POSIX uses an array of structures, instead of a structure of arrays. */ typedef struct { @@ -550,13 +531,19 @@ typedef struct /* Declarations for routines. */ +#ifdef __USE_GNU /* Sets the current default syntax to SYNTAX, and return the old syntax. - You can also simply assign to the `re_syntax_options' variable. */ + You can also simply assign to the 're_syntax_options' variable. */ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax); /* Compile the regular expression PATTERN, with length LENGTH - and syntax given by the global `re_syntax_options', into the buffer - BUFFER. Return NULL if successful, and an error string if not. */ + and syntax given by the global 're_syntax_options', into the buffer + BUFFER. Return NULL if successful, and an error string if not. + + To free the allocated storage, you must call 'regfree' on BUFFER. + Note that the translate table must either have been initialised by + 'regcomp', with a malloc'ed value, or set to NULL before calling + 'regfree'. */ extern const char *re_compile_pattern (const char *__pattern, size_t __length, struct re_pattern_buffer *__buffer); @@ -578,7 +565,7 @@ extern regoff_t re_search (struct re_pattern_buffer *__buffer, struct re_registers *__regs); -/* Like `re_search', but search in the concatenation of STRING1 and +/* Like 're_search', but search in the concatenation of STRING1 and STRING2. Also, stop searching at index START + STOP. */ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer, const char *__string1, __re_idx_t __length1, @@ -588,14 +575,14 @@ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer, __re_idx_t __stop); -/* Like `re_search', but return how many characters in STRING the regexp +/* Like 're_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ extern regoff_t re_match (struct re_pattern_buffer *__buffer, const char *__string, __re_idx_t __length, __re_idx_t __start, struct re_registers *__regs); -/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ +/* Relates to 're_match' as 're_search_2' relates to 're_search'. */ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer, const char *__string1, __re_idx_t __length1, const char *__string2, __re_idx_t __length2, @@ -606,21 +593,22 @@ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer, /* Set REGS to hold NUM_REGS registers, storing them in STARTS and ENDS. Subsequent matches using BUFFER and REGS will use this memory for recording register information. STARTS and ENDS must be - allocated with malloc, and must each be at least `NUM_REGS * sizeof + allocated with malloc, and must each be at least 'NUM_REGS * sizeof (regoff_t)' bytes long. If NUM_REGS == 0, then subsequent matches should allocate their own register data. Unless this function is called, the first search or match using - BUFFER will allocate its own register data, without freeing the old - data. */ + BUFFER will allocate its own register data, without + freeing the old data. */ extern void re_set_registers (struct re_pattern_buffer *__buffer, struct re_registers *__regs, __re_size_t __num_regs, regoff_t *__starts, regoff_t *__ends); +#endif /* Use GNU */ -#if defined _REGEX_RE_COMP || defined _LIBC +#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD) # ifndef _CRAY /* 4.2 bsd compatibility. */ extern char *re_comp (const char *); @@ -648,7 +636,7 @@ extern int re_exec (const char *); #ifndef _Restrict_arr_ # if ((199901L <= __STDC_VERSION__ \ || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \ - && !__STRICT_ANSI__)) \ + && !defined __STRICT_ANSI__)) \ && !defined __GNUG__) # define _Restrict_arr_ _Restrict_ # else diff --git a/grub-core/gnulib/regex_internal.c b/grub-core/gnulib/regex_internal.c index 98b8d5d21..899b0ae67 100644 --- a/grub-core/gnulib/regex_internal.c +++ b/grub-core/gnulib/regex_internal.c @@ -1,22 +1,21 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 2002-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ static void re_string_construct_common (const char *str, Idx len, re_string_t *pstr, @@ -135,9 +134,9 @@ re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len) { wint_t *new_wcs; - /* Avoid overflow. */ - size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx)); - if (BE (SIZE_MAX / max_object_size < new_buf_len, 0)) + /* Avoid overflow in realloc. */ + const size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx)); + if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_buf_len, 0)) return REG_ESPACE; new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len); @@ -237,13 +236,8 @@ build_wcs_buffer (re_string_t *pstr) else p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx; mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); - if (BE (mbclen == (size_t) -2, 0)) - { - /* The buffer doesn't have enough space, finish to build. */ - pstr->cur_state = prev_st; - break; - } - else if (BE (mbclen == (size_t) -1 || mbclen == 0, 0)) + if (BE (mbclen == (size_t) -1 || mbclen == 0 + || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len), 0)) { /* We treat these cases as a singlebyte character. */ mbclen = 1; @@ -252,6 +246,12 @@ build_wcs_buffer (re_string_t *pstr) wc = pstr->trans[wc]; pstr->cur_state = prev_st; } + else if (BE (mbclen == (size_t) -2, 0)) + { + /* The buffer doesn't have enough space, finish to build. */ + pstr->cur_state = prev_st; + break; + } /* Write wide character and padding. */ pstr->wcs[byte_idx++] = wc; @@ -334,9 +334,11 @@ build_wcs_upper_buffer (re_string_t *pstr) for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) pstr->wcs[byte_idx++] = WEOF; } - else if (mbclen == (size_t) -1 || mbclen == 0) + else if (mbclen == (size_t) -1 || mbclen == 0 + || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len)) { - /* It is an invalid character or '\0'. Just use the byte. */ + /* It is an invalid character, an incomplete character + at the end of the string, or '\0'. Just use the byte. */ int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; pstr->mbs[byte_idx] = ch; /* And also cast it to wide char. */ @@ -449,7 +451,8 @@ build_wcs_upper_buffer (re_string_t *pstr) for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) pstr->wcs[byte_idx++] = WEOF; } - else if (mbclen == (size_t) -1 || mbclen == 0) + else if (mbclen == (size_t) -1 || mbclen == 0 + || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len)) { /* It is an invalid character or '\0'. Just use the byte. */ int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx]; @@ -496,8 +499,7 @@ re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc) rawbuf_idx < new_raw_idx;) { wchar_t wc2; - Idx remain_len; - remain_len = pstr->len - rawbuf_idx; + Idx remain_len = pstr->raw_len - rawbuf_idx; prev_st = pstr->cur_state; mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx, remain_len, &pstr->cur_state); @@ -733,21 +735,21 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) mbstate_t cur_state; wchar_t wc2; Idx mlen = raw + pstr->len - p; + unsigned char buf[6]; size_t mbclen; -#if 0 /* dead code: buf is set but never used */ - unsigned char buf[6]; + const unsigned char *pp = p; if (BE (pstr->trans != NULL, 0)) { int i = mlen < 6 ? mlen : 6; while (--i >= 0) buf[i] = pstr->trans[p[i]]; + pp = buf; } -#endif /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ memset (&cur_state, 0, sizeof (cur_state)); - mbclen = __mbrtowc (&wc2, (const char *) p, mlen, + mbclen = __mbrtowc (&wc2, (const char *) pp, mlen, &cur_state); if (raw + offset - p <= mbclen && mbclen < (size_t) -2) @@ -832,7 +834,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) } static unsigned char -internal_function __attribute ((pure)) +internal_function __attribute__ ((pure)) re_string_peek_byte_case (const re_string_t *pstr, Idx idx) { int ch; @@ -869,7 +871,7 @@ re_string_peek_byte_case (const re_string_t *pstr, Idx idx) } static unsigned char -internal_function __attribute ((pure)) +internal_function re_string_fetch_byte_case (re_string_t *pstr) { if (BE (!pstr->mbs_allocated, 1)) @@ -972,7 +974,7 @@ re_node_set_alloc (re_node_set *set, Idx size) set->alloc = size; set->nelem = 0; set->elems = re_malloc (Idx, size); - if (BE (set->elems == NULL, 0)) + if (BE (set->elems == NULL, 0) && (MALLOC_0_IS_NONNULL || size != 0)) return REG_ESPACE; return REG_NOERROR; } @@ -1352,7 +1354,7 @@ re_node_set_insert_last (re_node_set *set, Idx elem) Return true if SET1 and SET2 are equivalent. */ static bool -internal_function __attribute ((pure)) +internal_function __attribute__ ((pure)) re_node_set_compare (const re_node_set *set1, const re_node_set *set2) { Idx i; @@ -1367,7 +1369,7 @@ re_node_set_compare (const re_node_set *set1, const re_node_set *set2) /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */ static Idx -internal_function __attribute ((pure)) +internal_function __attribute__ ((pure)) re_node_set_contains (const re_node_set *set, Idx elem) { __re_size_t idx, right, mid; @@ -1413,13 +1415,12 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) Idx *new_nexts, *new_indices; re_node_set *new_edests, *new_eclosures; re_token_t *new_nodes; - size_t max_object_size = - MAX (sizeof (re_token_t), - MAX (sizeof (re_node_set), - sizeof (Idx))); - /* Avoid overflows. */ - if (BE (SIZE_MAX / 2 / max_object_size < dfa->nodes_alloc, 0)) + /* Avoid overflows in realloc. */ + const size_t max_object_size = MAX (sizeof (re_token_t), + MAX (sizeof (re_node_set), + sizeof (Idx))); + if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_nodes_alloc, 0)) return REG_MISSING; new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc); @@ -1442,11 +1443,9 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) dfa->nodes[dfa->nodes_len] = token; dfa->nodes[dfa->nodes_len].constraint = 0; #ifdef RE_ENABLE_I18N - { - int type = token.type; dfa->nodes[dfa->nodes_len].accept_mb = - (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET; - } + ((token.type == OP_PERIOD && dfa->mb_cur_max > 1) + || token.type == COMPLEX_BRACKET); #endif dfa->nexts[dfa->nodes_len] = REG_MISSING; re_node_set_init_empty (dfa->edests + dfa->nodes_len); @@ -1454,7 +1453,7 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) return dfa->nodes_len++; } -static inline re_hashval_t +static re_hashval_t internal_function calc_state_hash (const re_node_set *nodes, unsigned int context) { @@ -1551,7 +1550,7 @@ re_acquire_state_context (reg_errcode_t *err, const re_dfa_t *dfa, && re_node_set_compare (state->entrance_nodes, nodes)) return state; } - /* There are no appropriate state in `dfa', create the new one. */ + /* There are no appropriate state in 'dfa', create the new one. */ new_state = create_cd_newstate (dfa, nodes, context, hash); if (BE (new_state == NULL, 0)) *err = REG_ESPACE; @@ -1580,7 +1579,7 @@ register_state (const re_dfa_t *dfa, re_dfastate_t *newstate, { Idx elem = newstate->nodes.elems[i]; if (!IS_EPSILON_NODE (dfa->nodes[elem].type)) - if (BE (! re_node_set_insert_last (&newstate->non_eps_nodes, elem), 0)) + if (! re_node_set_insert_last (&newstate->non_eps_nodes, elem)) return REG_ESPACE; } @@ -1615,7 +1614,7 @@ free_state (re_dfastate_t *state) re_free (state); } -/* Create the new state which is independ of contexts. +/* Create the new state which is independent of contexts. Return the new state if succeeded, otherwise return NULL. */ static re_dfastate_t * diff --git a/grub-core/gnulib/regex_internal.h b/grub-core/gnulib/regex_internal.h index e5b6679d1..c467b2907 100644 --- a/grub-core/gnulib/regex_internal.h +++ b/grub-core/gnulib/regex_internal.h @@ -1,43 +1,36 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 2002-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ #ifndef _REGEX_INTERNAL_H #define _REGEX_INTERNAL_H 1 #include #include -#include #include #include #include #include -#ifndef _LIBC -# include "localcharset.h" -#endif -#if defined HAVE_LOCALE_H || defined _LIBC -# include -#endif - +#include #include #include +#include #include #if defined _LIBC # include @@ -67,7 +60,7 @@ # ifdef _LIBC # undef gettext # define gettext(msgid) \ - INTUSE(__dcgettext) (_libc_intl_domainname, msgid, LC_MESSAGES) + __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) # endif #else # define gettext(msgid) (msgid) @@ -79,12 +72,7 @@ # define gettext_noop(String) String #endif -/* For loser systems without the definition. */ -#ifndef SIZE_MAX -# define SIZE_MAX ((size_t) -1) -#endif - -#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC +#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC # define RE_ENABLE_I18N #endif @@ -92,9 +80,6 @@ # define BE(expr, val) __builtin_expect (expr, val) #else # define BE(expr, val) (expr) -# ifdef _LIBC -# define inline -# endif #endif /* Number of ASCII characters. */ @@ -111,22 +96,27 @@ /* Rename to standard API for using out of glibc. */ #ifndef _LIBC +# undef __wctype +# undef __iswctype # define __wctype wctype # define __iswctype iswctype # define __btowc btowc -# define __wcrtomb wcrtomb # define __mbrtowc mbrtowc +# define __wcrtomb wcrtomb # define __regfree regfree # define attribute_hidden #endif /* not _LIBC */ -#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) -# define __attribute(arg) __attribute__ (arg) -#else -# define __attribute(arg) +#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1) +# define __attribute__(arg) #endif typedef __re_idx_t Idx; +#ifdef _REGEX_LARGE_OFFSETS +# define IDX_MAX (SIZE_MAX - 2) +#else +# define IDX_MAX INT_MAX +#endif /* Special return value for failure to match. */ #define REG_MISSING ((Idx) -1) @@ -337,7 +327,7 @@ typedef struct Idx idx; /* for BACK_REF */ re_context_type ctx_type; /* for ANCHOR */ } opr; -#if __GNUC__ >= 2 && !__STRICT_ANSI__ +#if __GNUC__ >= 2 && !defined __STRICT_ANSI__ re_token_type_t type : 8; #else re_token_type_t type; @@ -413,27 +403,29 @@ struct re_string_t }; typedef struct re_string_t re_string_t; + +struct re_dfa_t; +typedef struct re_dfa_t re_dfa_t; + #ifndef _LIBC -# if defined __i386__ && !defined __EMX__ -# define internal_function __attribute ((regparm (3), stdcall)) -# else -# define internal_function -# endif +# define internal_function #endif +#ifndef NOT_IN_libc static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len) internal_function; -#ifdef RE_ENABLE_I18N +# ifdef RE_ENABLE_I18N static void build_wcs_buffer (re_string_t *pstr) internal_function; static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr) - internal_function; -#endif /* RE_ENABLE_I18N */ + internal_function; +# endif /* RE_ENABLE_I18N */ static void build_upper_buffer (re_string_t *pstr) internal_function; static void re_string_translate_buffer (re_string_t *pstr) internal_function; static unsigned int re_string_context_at (const re_string_t *input, Idx idx, int eflags) - internal_function __attribute ((pure)); + internal_function __attribute__ ((pure)); +#endif #define re_string_peek_byte(pstr, offset) \ ((pstr)->mbs[(pstr)->cur_idx + offset]) #define re_string_fetch_byte(pstr) \ @@ -451,7 +443,9 @@ static unsigned int re_string_context_at (const re_string_t *input, Idx idx, #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) -#include +#if defined _LIBC || HAVE_ALLOCA +# include +#endif #ifndef _LIBC # if HAVE_ALLOCA @@ -468,9 +462,18 @@ static unsigned int re_string_context_at (const re_string_t *input, Idx idx, # endif #endif +#ifdef _LIBC +# define MALLOC_0_IS_NONNULL 1 +#elif !defined MALLOC_0_IS_NONNULL +# define MALLOC_0_IS_NONNULL 0 +#endif + #ifndef MAX # define MAX(a,b) ((a) < (b) ? (b) : (a)) #endif +#ifndef MIN +# define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t))) #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t))) @@ -486,8 +489,8 @@ struct bin_tree_t re_token_t token; - /* `node_idx' is the index in dfa->nodes, if `type' == 0. - Otherwise `type' indicate the type of this node. */ + /* 'node_idx' is the index in dfa->nodes, if 'type' == 0. + Otherwise 'type' indicate the type of this node. */ Idx node_idx; }; typedef struct bin_tree_t bin_tree_t; @@ -540,9 +543,9 @@ struct re_dfastate_t struct re_dfastate_t **trtable, **word_trtable; unsigned int context : 4; unsigned int halt : 1; - /* If this state can accept `multi byte'. + /* If this state can accept "multi byte". Note that we refer to multibyte characters, and multi character - collating elements as `multi byte'. */ + collating elements as "multi byte". */ unsigned int accept_mb : 1; /* If this state has backreference node(s). */ unsigned int has_backref : 1; @@ -671,7 +674,7 @@ struct re_dfa_t re_bitset_ptr_t sb_char; int str_tree_storage_idx; - /* number of subexpressions `re_nsub' is in regex_t. */ + /* number of subexpressions 're_nsub' is in regex_t. */ re_hashval_t state_hash_mask; Idx init_node; Idx nbackref; /* The number of backreference in this dfa. */ @@ -728,33 +731,33 @@ typedef struct } bracket_elem_t; -/* Inline functions for bitset_t operation. */ +/* Functions for bitset_t operation. */ -static inline void +static void bitset_set (bitset_t set, Idx i) { set[i / BITSET_WORD_BITS] |= (bitset_word_t) 1 << i % BITSET_WORD_BITS; } -static inline void +static void bitset_clear (bitset_t set, Idx i) { set[i / BITSET_WORD_BITS] &= ~ ((bitset_word_t) 1 << i % BITSET_WORD_BITS); } -static inline bool +static bool bitset_contain (const bitset_t set, Idx i) { return (set[i / BITSET_WORD_BITS] >> i % BITSET_WORD_BITS) & 1; } -static inline void +static void bitset_empty (bitset_t set) { memset (set, '\0', sizeof (bitset_t)); } -static inline void +static void bitset_set_all (bitset_t set) { memset (set, -1, sizeof (bitset_word_t) * (SBC_MAX / BITSET_WORD_BITS)); @@ -763,13 +766,13 @@ bitset_set_all (bitset_t set) ((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1; } -static inline void +static void bitset_copy (bitset_t dest, const bitset_t src) { memcpy (dest, src, sizeof (bitset_t)); } -static inline void +static void __attribute__ ((unused)) bitset_not (bitset_t set) { int bitset_i; @@ -781,7 +784,7 @@ bitset_not (bitset_t set) & ~set[BITSET_WORDS - 1]); } -static inline void +static void __attribute__ ((unused)) bitset_merge (bitset_t dest, const bitset_t src) { int bitset_i; @@ -789,7 +792,7 @@ bitset_merge (bitset_t dest, const bitset_t src) dest[bitset_i] |= src[bitset_i]; } -static inline void +static void __attribute__ ((unused)) bitset_mask (bitset_t dest, const bitset_t src) { int bitset_i; @@ -798,9 +801,9 @@ bitset_mask (bitset_t dest, const bitset_t src) } #ifdef RE_ENABLE_I18N -/* Inline functions for re_string. */ -static inline int -internal_function __attribute ((pure)) +/* Functions for re_string. */ +static int +internal_function __attribute__ ((pure, unused)) re_string_char_size_at (const re_string_t *pstr, Idx idx) { int byte_idx; @@ -812,8 +815,8 @@ re_string_char_size_at (const re_string_t *pstr, Idx idx) return byte_idx; } -static inline wint_t -internal_function __attribute ((pure)) +static wint_t +internal_function __attribute__ ((pure, unused)) re_string_wchar_at (const re_string_t *pstr, Idx idx) { if (pstr->mb_cur_max == 1) @@ -821,15 +824,15 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx) return (wint_t) pstr->wcs[idx]; } +# ifndef NOT_IN_libc static int -internal_function __attribute ((pure)) +internal_function __attribute__ ((pure, unused)) re_string_elem_size_at (const re_string_t *pstr, Idx idx) { -# ifdef _LIBC +# ifdef _LIBC const unsigned char *p, *extra; const int32_t *table, *indirect; - int32_t tmp; -# include +# include uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules != 0) @@ -840,13 +843,14 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); p = pstr->mbs + idx; - tmp = findidx (&p); + findidx (&p, pstr->len - idx); return p - pstr->mbs - idx; } else -# endif /* _LIBC */ +# endif /* _LIBC */ return 1; } +# endif #endif /* RE_ENABLE_I18N */ #ifndef __GNUC_PREREQ diff --git a/grub-core/gnulib/regexec.c b/grub-core/gnulib/regexec.c index dc449ce52..f632cd47b 100644 --- a/grub-core/gnulib/regexec.c +++ b/grub-core/gnulib/regexec.c @@ -1,22 +1,21 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 2002-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public + License along with the GNU C Library; if not, see + . */ static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, Idx n) internal_function; @@ -52,9 +51,8 @@ static regoff_t re_search_stub (struct re_pattern_buffer *bufp, regoff_t range, Idx stop, struct re_registers *regs, bool ret_len) internal_function; -static unsigned int re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, - Idx nregs, int regs_allocated) - internal_function; +static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, + Idx nregs, int regs_allocated) internal_function; static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx) internal_function; static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match, @@ -201,7 +199,7 @@ static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa, static bool check_node_accept (const re_match_context_t *mctx, const re_token_t *node, Idx idx) internal_function; -static reg_errcode_t extend_buffers (re_match_context_t *mctx) +static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len) internal_function; /* Entry point for POSIX code. */ @@ -210,11 +208,11 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx) string STRING. If NMATCH is zero or REG_NOSUB was set in the cflags argument to - `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at + 'regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at least NMATCH elements, and we set them to the offsets of the corresponding matched substrings. - EFLAGS specifies `execution flags' which affect matching: if + EFLAGS specifies "execution flags" which affect matching: if REG_NOTBOL is set, then ^ does not match at the beginning of the string; if REG_NOTEOL is set, then $ does not match at the end. @@ -231,7 +229,7 @@ regexec (preg, string, nmatch, pmatch, eflags) reg_errcode_t err; Idx start, length; #ifdef _LIBC - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *dfa = preg->buffer; #endif if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND)) @@ -366,7 +364,6 @@ weak_alias (__re_search_2, re_search_2) #endif static regoff_t -internal_function re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, @@ -414,7 +411,6 @@ re_search_2_stub (struct re_pattern_buffer *bufp, otherwise the position of the match is returned. */ static regoff_t -internal_function re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, Idx stop, struct re_registers *regs, @@ -426,7 +422,7 @@ re_search_stub (struct re_pattern_buffer *bufp, regoff_t rval; int eflags = 0; #ifdef _LIBC - re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; + re_dfa_t *dfa = bufp->buffer; #endif Idx last_start = start + range; @@ -478,9 +474,9 @@ re_search_stub (struct re_pattern_buffer *bufp, rval = 0; - /* I hope we needn't fill ther regs with -1's when no match was found. */ + /* I hope we needn't fill their regs with -1's when no match was found. */ if (result != REG_NOERROR) - rval = -1; + rval = result == REG_NOMATCH ? -1 : -2; else if (regs != NULL) { /* If caller wants register contents data back, copy them. */ @@ -506,15 +502,14 @@ re_search_stub (struct re_pattern_buffer *bufp, return rval; } -static unsigned int -internal_function +static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, int regs_allocated) { int rval = REGS_REALLOCATE; Idx i; Idx need_regs = nregs + 1; - /* We need one extra element beyond `num_regs' for the `-1' marker GNU code + /* We need one extra element beyond 'num_regs' for the '-1' marker GNU code uses. */ /* Have the register data arrays been allocated? */ @@ -637,7 +632,7 @@ re_exec (s) (0 <= LAST_START && LAST_START <= LENGTH) */ static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ re_search_internal (const regex_t *preg, const char *string, Idx length, Idx start, Idx last_start, Idx stop, @@ -645,7 +640,7 @@ re_search_internal (const regex_t *preg, int eflags) { reg_errcode_t err; - const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer; + const re_dfa_t *dfa = preg->buffer; Idx left_lim, right_lim; int incr; bool fl_longest_match; @@ -720,7 +715,8 @@ re_search_internal (const regex_t *preg, if (nmatch > 1 || dfa->has_mb_node) { /* Avoid overflow. */ - if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= mctx.input.bufs_len, 0)) + if (BE ((MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) + <= mctx.input.bufs_len), 0)) { err = REG_ESPACE; goto free_return; @@ -740,7 +736,7 @@ re_search_internal (const regex_t *preg, mctx.input.tip_context = (eflags & REG_NOTBOL) ? CONTEXT_BEGBUF : CONTEXT_NEWLINE | CONTEXT_BEGBUF; - /* Check incrementally whether of not the input string match. */ + /* Check incrementally whether the input string matches. */ incr = (last_start < start) ? -1 : 1; left_lim = (last_start < start) ? last_start : start; right_lim = (last_start < start) ? start : last_start; @@ -922,7 +918,7 @@ re_search_internal (const regex_t *preg, goto free_return; } - /* At last, add the offset to the each registers, since we slided + /* At last, add the offset to each register, since we slid the buffers so that we could assume that the matching starts from 0. */ for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) @@ -972,7 +968,7 @@ re_search_internal (const regex_t *preg, } static reg_errcode_t -internal_function __attribute_warn_unused_result__ +__attribute_warn_unused_result__ prune_impossible_nodes (re_match_context_t *mctx) { const re_dfa_t *const dfa = mctx->dfa; @@ -988,7 +984,7 @@ prune_impossible_nodes (re_match_context_t *mctx) halt_node = mctx->last_node; /* Avoid overflow. */ - if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= match_last, 0)) + if (BE (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) <= match_last, 0)) return REG_ESPACE; sifted_states = re_malloc (re_dfastate_t *, match_last + 1); @@ -1068,7 +1064,7 @@ prune_impossible_nodes (re_match_context_t *mctx) since initial states may have constraints like "\<", "^", etc.. */ static inline re_dfastate_t * -__attribute ((always_inline)) internal_function +__attribute__ ((always_inline)) internal_function acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, Idx idx) { @@ -1106,7 +1102,7 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, FL_LONGEST_MATCH means we want the POSIX longest matching. If P_MATCH_FIRST is not NULL, and the match fails, it is set to the next place where we may want to try matching. - Note that the matcher assume that the maching starts from the current + Note that the matcher assumes that the matching starts from the current index of the buffer. */ static Idx @@ -1175,11 +1171,12 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, re_dfastate_t *old_state = cur_state; Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1; - if (BE (next_char_idx >= mctx->input.bufs_len, 0) + if ((BE (next_char_idx >= mctx->input.bufs_len, 0) + && mctx->input.bufs_len < mctx->input.len) || (BE (next_char_idx >= mctx->input.valid_len, 0) && mctx->input.valid_len < mctx->input.len)) { - err = extend_buffers (mctx); + err = extend_buffers (mctx, next_char_idx + 1); if (BE (err != REG_NOERROR, 0)) { assert (err == REG_ESPACE); @@ -1436,7 +1433,7 @@ internal_function __attribute_warn_unused_result__ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *pmatch, bool fl_backtrack) { - const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer; + const re_dfa_t *dfa = preg->buffer; Idx idx, cur_node; re_node_set eps_via_nodes; struct re_fail_stack_t *fs; @@ -1608,21 +1605,21 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, and sift the nodes in each states according to the following rules. Updated state_log will be wrote to STATE_LOG. - Rules: We throw away the Node `a' in the STATE_LOG[STR_IDX] if... + Rules: We throw away the Node 'a' in the STATE_LOG[STR_IDX] if... 1. When STR_IDX == MATCH_LAST(the last index in the state_log): - If `a' isn't the LAST_NODE and `a' can't epsilon transit to - the LAST_NODE, we throw away the node `a'. - 2. When 0 <= STR_IDX < MATCH_LAST and `a' accepts - string `s' and transit to `b': + If 'a' isn't the LAST_NODE and 'a' can't epsilon transit to + the LAST_NODE, we throw away the node 'a'. + 2. When 0 <= STR_IDX < MATCH_LAST and 'a' accepts + string 's' and transit to 'b': i. If 'b' isn't in the STATE_LOG[STR_IDX+strlen('s')], we throw - away the node `a'. + away the node 'a'. ii. If 'b' is in the STATE_LOG[STR_IDX+strlen('s')] but 'b' is - thrown away, we throw away the node `a'. + thrown away, we throw away the node 'a'. 3. When 0 <= STR_IDX < MATCH_LAST and 'a' epsilon transit to 'b': i. If 'b' isn't in the STATE_LOG[STR_IDX], we throw away the - node `a'. + node 'a'. ii. If 'b' is in the STATE_LOG[STR_IDX] but 'b' is thrown away, - we throw away the node `a'. */ + we throw away the node 'a'. */ #define STATE_NODE_CONTAINS(state,node) \ ((state) != NULL && re_node_set_contains (&(state)->nodes, node)) @@ -1695,11 +1692,11 @@ build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx i; /* Then build the next sifted state. - We build the next sifted state on `cur_dest', and update - `sifted_states[str_idx]' with `cur_dest'. + We build the next sifted state on 'cur_dest', and update + 'sifted_states[str_idx]' with 'cur_dest'. Note: - `cur_dest' is the sifted state from `state_log[str_idx + 1]'. - `cur_src' points the node_set of the old `state_log[str_idx]' + 'cur_dest' is the sifted state from 'state_log[str_idx + 1]'. + 'cur_src' points the node_set of the old 'state_log[str_idx]' (with the epsilon nodes pre-filtered out). */ for (i = 0; i < cur_src->nelem; i++) { @@ -1712,7 +1709,7 @@ build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, assert (!IS_EPSILON_NODE (type)); #endif #ifdef RE_ENABLE_I18N - /* If the node may accept `multi byte'. */ + /* If the node may accept "multi byte". */ if (dfa->nodes[prev_node].accept_mb) naccepted = sift_states_iter_mb (mctx, sctx, prev_node, str_idx, sctx->last_str_idx); @@ -1753,12 +1750,13 @@ clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx) { Idx top = mctx->state_log_top; - if (next_state_log_idx >= mctx->input.bufs_len + if ((next_state_log_idx >= mctx->input.bufs_len + && mctx->input.bufs_len < mctx->input.len) || (next_state_log_idx >= mctx->input.valid_len && mctx->input.valid_len < mctx->input.len)) { reg_errcode_t err; - err = extend_buffers (mctx); + err = extend_buffers (mctx, next_state_log_idx + 1); if (BE (err != REG_NOERROR, 0)) return err; } @@ -2268,17 +2266,17 @@ sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, { const re_dfa_t *const dfa = mctx->dfa; int naccepted; - /* Check the node can accept `multi byte'. */ + /* Check the node can accept "multi byte". */ naccepted = check_node_accept_bytes (dfa, node_idx, &mctx->input, str_idx); if (naccepted > 0 && str_idx + naccepted <= max_str_idx && !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted], dfa->nexts[node_idx])) - /* The node can't accept the `multi byte', or the + /* The node can't accept the "multi byte", or the destination was already thrown away, then the node - could't accept the current input `multi byte'. */ + could't accept the current input "multi byte". */ naccepted = 0; /* Otherwise, it is sure that the node could accept - `naccepted' bytes input. */ + 'naccepted' bytes input. */ return naccepted; } #endif /* RE_ENABLE_I18N */ @@ -2457,7 +2455,7 @@ find_recover_state (reg_errcode_t *err, re_match_context_t *mctx) /* From the node set CUR_NODES, pick up the nodes whose types are OP_OPEN_SUBEXP and which have corresponding back references in the regular expression. And register them to use them later for evaluating the - correspoding back references. */ + corresponding back references. */ static reg_errcode_t internal_function @@ -2568,7 +2566,7 @@ transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate) if (naccepted == 0) continue; - /* The node can accepts `naccepted' bytes. */ + /* The node can accepts 'naccepted' bytes. */ dest_idx = re_string_cur_idx (&mctx->input) + naccepted; mctx->max_mb_elem_len = ((mctx->max_mb_elem_len < naccepted) ? naccepted : mctx->max_mb_elem_len); @@ -2620,7 +2618,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) const re_token_t *node = dfa->nodes + node_idx; re_node_set *new_dest_nodes; - /* Check whether `node' is a backreference or not. */ + /* Check whether 'node' is a backreference or not. */ if (node->type != OP_BACK_REF) continue; @@ -2632,14 +2630,14 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) continue; } - /* `node' is a backreference. + /* 'node' is a backreference. Check the substring which the substring matched. */ bkc_idx = mctx->nbkref_ents; err = get_subexp (mctx, node_idx, cur_str_idx); if (BE (err != REG_NOERROR, 0)) goto free_return; - /* And add the epsilon closures (which is `new_dest_nodes') of + /* And add the epsilon closures (which is 'new_dest_nodes') of the backreference to appropriate state_log. */ #ifdef DEBUG assert (dfa->nexts[node_idx] != REG_MISSING); @@ -2663,7 +2661,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) dest_state = mctx->state_log[dest_str_idx]; prev_nelem = ((mctx->state_log[cur_str_idx] == NULL) ? 0 : mctx->state_log[cur_str_idx]->nodes.nelem); - /* Add `new_dest_node' to state_log. */ + /* Add 'new_dest_node' to state_log. */ if (dest_state == NULL) { mctx->state_log[dest_str_idx] @@ -2815,7 +2813,7 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx) if (bkref_str_off >= mctx->input.len) break; - err = extend_buffers (mctx); + err = extend_buffers (mctx, bkref_str_off + 1); if (BE (err != REG_NOERROR, 0)) return err; @@ -2937,9 +2935,12 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, { re_dfastate_t **new_array; Idx old_alloc = path->alloc; - Idx new_alloc = old_alloc + last_str + mctx->max_mb_elem_len + 1; - if (BE (new_alloc < old_alloc, 0) - || BE (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc, 0)) + Idx incr_alloc = last_str + mctx->max_mb_elem_len + 1; + Idx new_alloc; + if (BE (IDX_MAX - old_alloc < incr_alloc, 0)) + return REG_ESPACE; + new_alloc = old_alloc + incr_alloc; + if (BE (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc, 0)) return REG_ESPACE; new_array = re_realloc (path->array, re_dfastate_t *, new_alloc); if (BE (new_array == NULL, 0)) @@ -3102,7 +3103,7 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, assert (!IS_EPSILON_NODE (type)); #endif #ifdef RE_ENABLE_I18N - /* If the node may accept `multi byte'. */ + /* If the node may accept "multi byte". */ if (dfa->nodes[cur_node].accept_mb) { naccepted = check_node_accept_bytes (dfa, cur_node, &mctx->input, @@ -3359,7 +3360,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) bitset_word_t elem, mask; bool dests_node_malloced = false; bool dest_states_malloced = false; - Idx ndests; /* Number of the destination states from `state'. */ + Idx ndests; /* Number of the destination states from 'state'. */ re_dfastate_t **trtable; re_dfastate_t **dest_states = NULL, **dest_states_word, **dest_states_nl; re_node_set follows, *dests_node; @@ -3373,8 +3374,8 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) } *dests_alloc; /* We build DFA states which corresponds to the destination nodes - from `state'. `dests_node[i]' represents the nodes which i-th - destination state contains, and `dests_ch[i]' represents the + from 'state'. 'dests_node[i]' represents the nodes which i-th + destination state contains, and 'dests_ch[i]' represents the characters which i-th destination state accepts. */ if (__libc_use_alloca (sizeof (struct dests_alloc))) dests_alloc = (struct dests_alloc *) alloca (sizeof (struct dests_alloc)); @@ -3388,20 +3389,23 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) dests_node = dests_alloc->dests_node; dests_ch = dests_alloc->dests_ch; - /* Initialize transiton table. */ + /* Initialize transition table. */ state->word_trtable = state->trtable = NULL; - /* At first, group all nodes belonging to `state' into several + /* At first, group all nodes belonging to 'state' into several destinations. */ ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch); if (BE (! REG_VALID_NONZERO_INDEX (ndests), 0)) { if (dests_node_malloced) free (dests_alloc); + /* Return false in case of an error, true otherwise. */ if (ndests == 0) { state->trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); + if (BE (state->trtable == NULL, 0)) + return false; return true; } return false; @@ -3591,13 +3595,13 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, reg_errcode_t err; bool ok; Idx i, j, k; - Idx ndests; /* Number of the destinations from `state'. */ + Idx ndests; /* Number of the destinations from 'state'. */ bitset_t accepts; /* Characters a node can accept. */ const re_node_set *cur_nodes = &state->nodes; bitset_empty (accepts); ndests = 0; - /* For all the nodes belonging to `state', */ + /* For all the nodes belonging to 'state', */ for (i = 0; i < cur_nodes->nelem; ++i) { re_token_t *node = &dfa->nodes[cur_nodes->elems[i]]; @@ -3640,7 +3644,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, else continue; - /* Check the `accepts' and sift the characters which are not + /* Check the 'accepts' and sift the characters which are not match it the context. */ if (constraint) { @@ -3699,7 +3703,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, } } - /* Then divide `accepts' into DFA states, or create a new + /* Then divide 'accepts' into DFA states, or create a new state. Above, we make sure that accepts is not empty. */ for (j = 0; j < ndests; ++j) { @@ -3712,7 +3716,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, if (type == CHARACTER && !bitset_contain (dests_ch[j], node->opr.c)) continue; - /* Enumerate the intersection set of this state and `accepts'. */ + /* Enumerate the intersection set of this state and 'accepts'. */ has_intersec = 0; for (k = 0; k < BITSET_WORDS; ++k) has_intersec |= intersec[k] = accepts[k] & dests_ch[j][k]; @@ -3720,7 +3724,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, if (!has_intersec) continue; - /* Then check if this state is a subset of `accepts'. */ + /* Then check if this state is a subset of 'accepts'. */ not_subset = not_consumed = 0; for (k = 0; k < BITSET_WORDS; ++k) { @@ -3728,8 +3732,8 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, not_consumed |= accepts[k] = accepts[k] & ~dests_ch[j][k]; } - /* If this state isn't a subset of `accepts', create a - new group state, which has the `remains'. */ + /* If this state isn't a subset of 'accepts', create a + new group state, which has the 'remains'. */ if (not_subset) { bitset_copy (dests_ch[ndests], remains); @@ -3768,7 +3772,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, } #ifdef RE_ENABLE_I18N -/* Check how many bytes the node `dfa->nodes[node_idx]' accepts. +/* Check how many bytes the node 'dfa->nodes[node_idx]' accepts. Return the number of the bytes the node accepts. STR_IDX is the current index of the input string. @@ -3895,7 +3899,6 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, const int32_t *table, *indirect; const unsigned char *weights, *extra; const char *collseqwc; - int32_t idx; /* This #include defines a local function! */ # include @@ -3933,6 +3936,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, in_collseq = find_collation_sequence_value (pin, elem_len); } /* match with range expression? */ + /* FIXME: Implement rational ranges here, too. */ for (i = 0; i < cset->nranges; ++i) if (cset->range_starts[i] <= in_collseq && in_collseq <= cset->range_ends[i]) @@ -3953,7 +3957,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB); indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); - int32_t idx = findidx (&cp); + int32_t idx = findidx (&cp, elem_len); if (idx > 0) for (i = 0; i < cset->nequiv_classes; ++i) { @@ -3984,18 +3988,9 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, # endif /* _LIBC */ { /* match with range expression? */ -#if __GNUC__ >= 2 && ! (__STDC_VERSION__ < 199901L && __STRICT_ANSI__) - wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'}; -#else - wchar_t cmp_buf[] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'}; - cmp_buf[2] = wc; -#endif for (i = 0; i < cset->nranges; ++i) { - cmp_buf[0] = cset->range_starts[i]; - cmp_buf[4] = cset->range_ends[i]; - if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 - && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) + if (cset->range_starts[i] <= wc && wc <= cset->range_ends[i]) { match_len = char_len; goto check_node_accept_bytes_match; @@ -4065,7 +4060,7 @@ find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len) /* Skip the collation sequence value. */ idx += sizeof (uint32_t); /* Skip the wide char sequence of the collating element. */ - idx = idx + sizeof (uint32_t) * (extra[idx] + 1); + idx = idx + sizeof (uint32_t) * (*(int32_t *) (extra + idx) + 1); /* If we found the entry, return the sequence value. */ if (found) return *(uint32_t *) (extra + idx); @@ -4133,17 +4128,20 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node, static reg_errcode_t internal_function __attribute_warn_unused_result__ -extend_buffers (re_match_context_t *mctx) +extend_buffers (re_match_context_t *mctx, int min_len) { reg_errcode_t ret; re_string_t *pstr = &mctx->input; /* Avoid overflow. */ - if (BE (SIZE_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0)) + if (BE (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) / 2 + <= pstr->bufs_len, 0)) return REG_ESPACE; - /* Double the lengthes of the buffers. */ - ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2); + /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ + ret = re_string_realloc_buffers (pstr, + MAX (min_len, + MIN (pstr->len, pstr->bufs_len * 2))); if (BE (ret != REG_NOERROR, 0)) return ret; @@ -4206,7 +4204,7 @@ match_ctx_init (re_match_context_t *mctx, int eflags, Idx n) size_t max_object_size = MAX (sizeof (struct re_backref_cache_entry), sizeof (re_sub_match_top_t *)); - if (BE (SIZE_MAX / max_object_size < n, 0)) + if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < n, 0)) return REG_ESPACE; mctx->bkref_ents = re_malloc (struct re_backref_cache_entry, n); diff --git a/grub-core/gnulib/size_max.h b/grub-core/gnulib/size_max.h index 56d5a9b1c..5f3312404 100644 --- a/grub-core/gnulib/size_max.h +++ b/grub-core/gnulib/size_max.h @@ -1,5 +1,5 @@ /* size_max.h -- declare SIZE_MAX through system headers - Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #ifndef GNULIB_SIZE_MAX_H #define GNULIB_SIZE_MAX_H diff --git a/grub-core/gnulib/sleep.c b/grub-core/gnulib/sleep.c index 213e5bd29..4c97d7dfa 100644 --- a/grub-core/gnulib/sleep.c +++ b/grub-core/gnulib/sleep.c @@ -1,5 +1,5 @@ /* Pausing execution of the current thread. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2007. This program is free software: you can redistribute it and/or modify @@ -35,7 +35,7 @@ sleep (unsigned int seconds) unsigned int remaining; /* Sleep for 1 second many times, because - 1. Sleep is not interruptiple by Ctrl-C, + 1. Sleep is not interruptible by Ctrl-C, 2. we want to avoid arithmetic overflow while multiplying with 1000. */ for (remaining = seconds; remaining > 0; remaining--) Sleep (1000); @@ -50,13 +50,14 @@ sleep (unsigned int seconds) /* Guarantee unlimited sleep and a reasonable return value. Cygwin 1.5.x rejects attempts to sleep more than 49.7 days (2**32 milliseconds), but uses uninitialized memory which results in a - garbage answer. */ + garbage answer. Similarly, Linux 2.6.9 with glibc 2.3.4 has a too + small return value when asked to sleep more than 24.85 days. */ unsigned int rpl_sleep (unsigned int seconds) { /* This requires int larger than 16 bits. */ - verify (UINT_MAX / 49 / 24 / 60 / 60); - const unsigned int limit = 49 * 24 * 60 * 60; + verify (UINT_MAX / 24 / 24 / 60 / 60); + const unsigned int limit = 24 * 24 * 60 * 60; while (limit < seconds) { unsigned int result; diff --git a/grub-core/gnulib/stdalign.in.h b/grub-core/gnulib/stdalign.in.h new file mode 100644 index 000000000..c3a67321b --- /dev/null +++ b/grub-core/gnulib/stdalign.in.h @@ -0,0 +1,90 @@ +/* A substitute for ISO C11 . + + Copyright 2011-2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +/* Written by Paul Eggert and Bruno Haible. */ + +#ifndef _GL_STDALIGN_H +#define _GL_STDALIGN_H + +/* ISO C11 for platforms that lack it. + + References: + ISO C11 (latest free draft + ) + sections 6.5.3.4, 6.7.5, 7.15. + C++11 (latest free draft + ) + section 18.10. */ + +/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment + requirement of a structure member (i.e., slot or field) that is of + type TYPE, as an integer constant expression. + + This differs from GCC's __alignof__ operator, which can yield a + better-performing alignment for an object of that type. For + example, on x86 with GCC, __alignof__ (double) and __alignof__ + (long long) are 8, whereas alignof (double) and alignof (long long) + are 4 unless the option '-malign-double' is used. + + The result cannot be used as a value for an 'enum' constant, if you + want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ +#include +#if defined __cplusplus + template struct __alignof_helper { char __a; __t __b; }; +# define _Alignof(type) offsetof (__alignof_helper, __b) +#else +# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) +#endif +#define alignof _Alignof +#define __alignof_is_defined 1 + +/* alignas (A), also known as _Alignas (A), aligns a variable or type + to the alignment A, where A is an integer constant expression. For + example: + + int alignas (8) foo; + struct s { int a; int alignas (8) bar; }; + + aligns the address of FOO and the offset of BAR to be multiples of 8. + + A should be a power of two that is at least the type's alignment + and at most the implementation's alignment limit. This limit is + 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable + to MSVC through at least version 10.0, A should be an integer + constant, as MSVC does not support expressions such as 1 << 3. + To be portable to Sun C 5.11, do not align auto variables to + anything stricter than their default alignment. + + The following C11 requirements are not supported here: + + - If A is zero, alignas has no effect. + - alignas can be used multiple times; the strictest one wins. + - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). + + */ + +#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C +# define _Alignas(a) __attribute__ ((__aligned__ (a))) +#elif 1300 <= _MSC_VER +# define _Alignas(a) __declspec (align (a)) +#endif +#ifdef _Alignas +# define alignas _Alignas +# define __alignas_is_defined 1 +#endif + +#endif /* _GL_STDALIGN_H */ diff --git a/grub-core/gnulib/stdbool.in.h b/grub-core/gnulib/stdbool.in.h index 574c281a8..7c1577277 100644 --- a/grub-core/gnulib/stdbool.in.h +++ b/grub-core/gnulib/stdbool.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc. +/* Copyright (C) 2001-2003, 2006-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #ifndef _GL_STDBOOL_H #define _GL_STDBOOL_H @@ -67,24 +66,19 @@ # undef true #endif -/* For the sake of symbolic names in gdb, we define true and false as - enum constants, not only as macros. - It is tempting to write - typedef enum { false = 0, true = 1 } _Bool; - so that gdb prints values of type 'bool' symbolically. But if we do - this, values of type '_Bool' may promote to 'int' or 'unsigned int' - (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' - (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the - enum; this ensures that '_Bool' promotes to 'int'. */ -#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) +#ifdef __cplusplus +# define _Bool bool +# define bool bool +#else +# if defined __BEOS__ && !defined __HAIKU__ /* A compiler known to have 'bool'. */ /* If the compiler already has both 'bool' and '_Bool', we can assume they are the same types. */ -# if !@HAVE__BOOL@ +# if !@HAVE__BOOL@ typedef bool _Bool; -# endif -#else -# if !defined __GNUC__ +# endif +# else +# if !defined __GNUC__ /* If @HAVE__BOOL@: Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when the built-in _Bool type is used. See @@ -104,19 +98,35 @@ typedef bool _Bool; "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. The only benefit of the enum, debuggability, is not important with these compilers. So use 'signed char' and no enum. */ -# define _Bool signed char -# else +# define _Bool signed char +# else /* With this compiler, trust the _Bool type if the compiler has it. */ -# if !@HAVE__BOOL@ +# if !@HAVE__BOOL@ + /* For the sake of symbolic names in gdb, define true and false as + enum constants, not only as macros. + It is tempting to write + typedef enum { false = 0, true = 1 } _Bool; + so that gdb prints values of type 'bool' symbolically. But then + values of type '_Bool' might promote to 'int' or 'unsigned int' + (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' + (see ISO C 99 6.3.1.1.(2)). So add a negative value to the + enum; this ensures that '_Bool' promotes to 'int'. */ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; +# endif # endif # endif +# define bool _Bool #endif -#define bool _Bool /* The other macros must be usable in preprocessor directives. */ -#define false 0 -#define true 1 +#ifdef __cplusplus +# define false false +# define true true +#else +# define false 0 +# define true 1 +#endif + #define __bool_true_false_are_defined 1 #endif /* _GL_STDBOOL_H */ diff --git a/grub-core/gnulib/stddef.in.h b/grub-core/gnulib/stddef.in.h index 08778a233..40f0536aa 100644 --- a/grub-core/gnulib/stddef.in.h +++ b/grub-core/gnulib/stddef.in.h @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 , for platforms that have issues. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ /* Written by Eric Blake. */ @@ -26,6 +25,7 @@ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ #if defined __need_wchar_t || defined __need_size_t \ || defined __need_ptrdiff_t || defined __need_NULL \ @@ -37,9 +37,9 @@ remember if special invocation has ever been used to obtain wint_t, in which case we need to clean up NULL yet again. */ -# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T) +# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) # ifdef __need_wint_t -# undef _GL_STDDEF_H +# undef _@GUARD_PREFIX@_STDDEF_H # define _GL_STDDEF_WINT_T # endif # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ @@ -48,14 +48,14 @@ #else /* Normal invocation convention. */ -# ifndef _GL_STDDEF_H +# ifndef _@GUARD_PREFIX@_STDDEF_H /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ -# ifndef _GL_STDDEF_H -# define _GL_STDDEF_H +# ifndef _@GUARD_PREFIX@_STDDEF_H +# define _@GUARD_PREFIX@_STDDEF_H /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ #if @REPLACE_NULL@ @@ -81,6 +81,6 @@ # define wchar_t int #endif -# endif /* _GL_STDDEF_H */ -# endif /* _GL_STDDEF_H */ +# endif /* _@GUARD_PREFIX@_STDDEF_H */ +# endif /* _@GUARD_PREFIX@_STDDEF_H */ #endif /* __need_XXX */ diff --git a/grub-core/gnulib/stdint.in.h b/grub-core/gnulib/stdint.in.h index 5da5f1788..2db8b2e37 100644 --- a/grub-core/gnulib/stdint.in.h +++ b/grub-core/gnulib/stdint.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2013 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -13,19 +13,19 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ /* * ISO C 99 for platforms that lack it. * */ -#ifndef _GL_STDINT_H +#ifndef _@GUARD_PREFIX@_STDINT_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ /* When including a system file that in turn includes , use the system , not our substitute. This avoids @@ -33,6 +33,16 @@ . */ #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H +/* On Android (Bionic libc), includes this file before + having defined 'time_t'. Therefore in this case avoid including + other system header files; just include the system's . + Ideally we should test __BIONIC__ here, but it is only defined after + has been included; hence test __ANDROID__ instead. */ +#if defined __ANDROID__ \ + && defined _SYS_TYPES_H_ && !defined __need_size_t +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#else + /* Get those types that are already defined in other system include files, so that we can "#define int8_t signed char" below without worrying about a later system include file containing a "typedef @@ -48,28 +58,40 @@ diagnostics. */ # define __STDINT_H__ # endif + + /* Some pre-C++11 implementations need this. */ +# ifdef __cplusplus +# ifndef __STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS 1 +# endif +# ifndef __STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS 1 +# endif +# endif + /* Other systems may have an incomplete or buggy . Include it before , since any "#include " in would reinclude us, skipping our contents because - _GL_STDINT_H is defined. + _@GUARD_PREFIX@_STDINT_H is defined. The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_STDINT_H@ #endif -#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H -#define _GL_STDINT_H +#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _@GUARD_PREFIX@_STDINT_H /* defines some of the stdint.h types as well, on glibc, IRIX 6.5, and OpenBSD 3.8 (via ). AIX 5.2 isn't needed and causes troubles. - MacOS X 10.4.6 includes (which is us), but + Mac OS X 10.4.6 includes (which is us), but relies on the system definitions, so include after @NEXT_STDINT_H@. */ #if @HAVE_SYS_TYPES_H@ && ! defined _AIX # include #endif -/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ +/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, + LONG_MIN, LONG_MAX, ULONG_MAX. */ #include #if @HAVE_INTTYPES_H@ @@ -92,7 +114,7 @@ #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H -/* Minimum and maximum values for a integer type under the usual assumption. +/* Minimum and maximum values for an integer type under the usual assumption. Return an unspecified value if BITS == 0, adding a check to pacify picky compilers. */ @@ -107,6 +129,8 @@ warnings in the signed case. */ \ ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) +#if !GNULIB_defined_stdint_types + /* 7.18.1.1. Exact-width integer types */ /* Here we assume a standard architecture where the hardware integer @@ -133,40 +157,54 @@ typedef unsigned int gl_uint32_t; #define int32_t gl_int32_t #define uint32_t gl_uint32_t +/* If the system defines INT64_MAX, assume int64_t works. That way, + if the underlying platform defines int64_t to be a 64-bit long long + int, the code below won't mistakenly define it to be a 64-bit long + int, which would mess up C++ name mangling. We must use #ifdef + rather than #if, to avoid an error with HP-UX 10.20 cc. */ + +#ifdef INT64_MAX +# define GL_INT64_T +#else /* Do not undefine int64_t if gnulib is not being used with 64-bit types, since otherwise it breaks platforms like Tandem/NSK. */ -#if LONG_MAX >> 31 >> 31 == 1 -# undef int64_t +# if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t typedef long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -#elif defined _MSC_VER -# undef int64_t +# define int64_t gl_int64_t +# define GL_INT64_T +# elif defined _MSC_VER +# undef int64_t typedef __int64 gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -#elif @HAVE_LONG_LONG_INT@ -# undef int64_t +# define int64_t gl_int64_t +# define GL_INT64_T +# elif @HAVE_LONG_LONG_INT@ +# undef int64_t typedef long long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T +# define int64_t gl_int64_t +# define GL_INT64_T +# endif #endif -#if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# undef uint64_t +#ifdef UINT64_MAX +# define GL_UINT64_T +#else +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t typedef unsigned long int gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T -#elif defined _MSC_VER -# undef uint64_t +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif defined _MSC_VER +# undef uint64_t typedef unsigned __int64 gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T -#elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# undef uint64_t +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t typedef unsigned long long int gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# endif #endif /* Avoid collision with Solaris 2.5.1 etc. */ @@ -209,8 +247,9 @@ typedef unsigned long long int gl_uint64_t; /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types - are taken from the same list of types. Assume that 'long int' - is fast enough for all narrower integers. */ + are taken from the same list of types. The following code normally + uses types consistent with glibc, as that lessens the chance of + incompatibility with older GNU hosts. */ #undef int_fast8_t #undef uint_fast8_t @@ -220,12 +259,21 @@ typedef unsigned long long int gl_uint64_t; #undef uint_fast32_t #undef int_fast64_t #undef uint_fast64_t -typedef long int gl_int_fast8_t; -typedef unsigned long int gl_uint_fast8_t; -typedef long int gl_int_fast16_t; -typedef unsigned long int gl_uint_fast16_t; +typedef signed char gl_int_fast8_t; +typedef unsigned char gl_uint_fast8_t; + +#ifdef __sun +/* Define types compatible with SunOS 5.10, so that code compiled under + earlier SunOS versions works with code compiled under SunOS 5.10. */ +typedef int gl_int_fast32_t; +typedef unsigned int gl_uint_fast32_t; +#else typedef long int gl_int_fast32_t; typedef unsigned long int gl_uint_fast32_t; +#endif +typedef gl_int_fast32_t gl_int_fast16_t; +typedef gl_uint_fast32_t gl_uint_fast16_t; + #define int_fast8_t gl_int_fast8_t #define uint_fast8_t gl_uint_fast8_t #define int_fast16_t gl_int_fast16_t @@ -253,37 +301,49 @@ typedef unsigned long int gl_uintptr_t; /* Note: These types are compiler dependent. It may be unwise to use them in public header files. */ -#undef intmax_t -#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +/* If the system defines INTMAX_MAX, assume that intmax_t works, and + similarly for UINTMAX_MAX and uintmax_t. This avoids problems with + assuming one type where another is used by the system. */ + +#ifndef INTMAX_MAX +# undef INTMAX_C +# undef intmax_t +# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 typedef long long int gl_intmax_t; -# define intmax_t gl_intmax_t -#elif defined GL_INT64_T -# define intmax_t int64_t -#else +# define intmax_t gl_intmax_t +# elif defined GL_INT64_T +# define intmax_t int64_t +# else typedef long int gl_intmax_t; -# define intmax_t gl_intmax_t +# define intmax_t gl_intmax_t +# endif #endif -#undef uintmax_t -#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +#ifndef UINTMAX_MAX +# undef UINTMAX_C +# undef uintmax_t +# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 typedef unsigned long long int gl_uintmax_t; -# define uintmax_t gl_uintmax_t -#elif defined GL_UINT64_T -# define uintmax_t uint64_t -#else +# define uintmax_t gl_uintmax_t +# elif defined GL_UINT64_T +# define uintmax_t uint64_t +# else typedef unsigned long int gl_uintmax_t; -# define uintmax_t gl_uintmax_t +# define uintmax_t gl_uintmax_t +# endif #endif /* Verify that intmax_t and uintmax_t have the same size. Too much code breaks if this is not the case. If this check fails, the reason is likely to be found in the autoconf macros. */ -typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1]; +typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) + ? 1 : -1]; + +#define GNULIB_defined_stdint_types 1 +#endif /* !GNULIB_defined_stdint_types */ /* 7.18.2. Limits of specified-width integer types */ -#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS - /* 7.18.2.1. Limits of exact-width integer types */ /* Here we assume a standard architecture where the hardware integer @@ -310,17 +370,14 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - #define INT32_MAX 2147483647 #define UINT32_MAX 4294967295U -#undef INT64_MIN -#undef INT64_MAX -#ifdef GL_INT64_T +#if defined GL_INT64_T && ! defined INT64_MAX /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 evaluates the latter incorrectly in preprocessor expressions. */ # define INT64_MIN (- INTMAX_C (1) << 63) # define INT64_MAX INTMAX_C (9223372036854775807) #endif -#undef UINT64_MAX -#ifdef GL_UINT64_T +#if defined GL_UINT64_T && ! defined UINT64_MAX # define UINT64_MAX UINTMAX_C (18446744073709551615) #endif @@ -372,23 +429,29 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - #undef INT_FAST8_MIN #undef INT_FAST8_MAX #undef UINT_FAST8_MAX -#define INT_FAST8_MIN LONG_MIN -#define INT_FAST8_MAX LONG_MAX -#define UINT_FAST8_MAX ULONG_MAX +#define INT_FAST8_MIN SCHAR_MIN +#define INT_FAST8_MAX SCHAR_MAX +#define UINT_FAST8_MAX UCHAR_MAX #undef INT_FAST16_MIN #undef INT_FAST16_MAX #undef UINT_FAST16_MAX -#define INT_FAST16_MIN LONG_MIN -#define INT_FAST16_MAX LONG_MAX -#define UINT_FAST16_MAX ULONG_MAX +#define INT_FAST16_MIN INT_FAST32_MIN +#define INT_FAST16_MAX INT_FAST32_MAX +#define UINT_FAST16_MAX UINT_FAST32_MAX #undef INT_FAST32_MIN #undef INT_FAST32_MAX #undef UINT_FAST32_MAX -#define INT_FAST32_MIN LONG_MIN -#define INT_FAST32_MAX LONG_MAX -#define UINT_FAST32_MAX ULONG_MAX +#ifdef __sun +# define INT_FAST32_MIN INT_MIN +# define INT_FAST32_MAX INT_MAX +# define UINT_FAST32_MAX UINT_MAX +#else +# define INT_FAST32_MIN LONG_MIN +# define INT_FAST32_MAX LONG_MAX +# define UINT_FAST32_MAX ULONG_MAX +#endif #undef INT_FAST64_MIN #undef INT_FAST64_MAX @@ -413,21 +476,23 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - /* 7.18.2.5. Limits of greatest-width integer types */ -#undef INTMAX_MIN -#undef INTMAX_MAX -#ifdef INT64_MAX -# define INTMAX_MIN INT64_MIN -# define INTMAX_MAX INT64_MAX -#else -# define INTMAX_MIN INT32_MIN -# define INTMAX_MAX INT32_MAX +#ifndef INTMAX_MAX +# undef INTMAX_MIN +# ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +# else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +# endif #endif -#undef UINTMAX_MAX -#ifdef UINT64_MAX -# define UINTMAX_MAX UINT64_MAX -#else -# define UINTMAX_MAX UINT32_MAX +#ifndef UINTMAX_MAX +# ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +# else +# define UINTMAX_MAX UINT32_MAX +# endif #endif /* 7.18.3. Limits of other integer types */ @@ -475,10 +540,16 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - /* wchar_t limits */ /* Get WCHAR_MIN, WCHAR_MAX. - This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested - includes -> -> -> , and the latter includes + This include is not on the top, above, because on OSF/1 4.0 we have a + sequence of nested includes + -> -> -> , and the latter includes and assumes its types are already defined. */ -#if ! (defined WCHAR_MIN && defined WCHAR_MAX) +#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ +# include +# include +# include # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H # include # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H @@ -498,12 +569,8 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - #define WINT_MAX \ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) -#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ - /* 7.18.4. Macros for integer constants */ -#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS - /* 7.18.4.1. Macros for minimum-width integer constants */ /* According to ISO C 99 Technical Corrigendum 1 */ @@ -544,25 +611,26 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - /* 7.18.4.2. Macros for greatest-width integer constants */ -#undef INTMAX_C -#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define INTMAX_C(x) x##LL -#elif defined GL_INT64_T -# define INTMAX_C(x) INT64_C(x) -#else -# define INTMAX_C(x) x##L +#ifndef INTMAX_C +# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +# elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +# else +# define INTMAX_C(x) x##L +# endif #endif -#undef UINTMAX_C -#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define UINTMAX_C(x) x##ULL -#elif defined GL_UINT64_T -# define UINTMAX_C(x) UINT64_C(x) -#else -# define UINTMAX_C(x) x##UL +#ifndef UINTMAX_C +# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +# elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +# else +# define UINTMAX_C(x) x##UL +# endif #endif -#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ - -#endif /* _GL_STDINT_H */ -#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ +#endif /* _@GUARD_PREFIX@_STDINT_H */ +#endif /* !(defined __ANDROID__ && ...) */ +#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ diff --git a/grub-core/gnulib/stdio-write.c b/grub-core/gnulib/stdio-write.c deleted file mode 100644 index a6a0eb143..000000000 --- a/grub-core/gnulib/stdio-write.c +++ /dev/null @@ -1,148 +0,0 @@ -/* POSIX compatible FILE stream write function. - Copyright (C) 2008-2010 Free Software Foundation, Inc. - Written by Bruno Haible , 2008. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include - -/* Specification. */ -#include - -/* Replace these functions only if module 'sigpipe' is requested. */ -#if GNULIB_SIGPIPE - -/* On native Windows platforms, SIGPIPE does not exist. When write() is - called on a pipe with no readers, WriteFile() fails with error - GetLastError() = ERROR_NO_DATA, and write() in consequence fails with - error EINVAL. This write() function is at the basis of the function - which flushes the buffer of a FILE stream. */ - -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -# include -# include -# include - -# define WIN32_LEAN_AND_MEAN /* avoid including junk */ -# include - -# define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \ - if (ferror (stream)) \ - return (EXPRESSION); \ - else \ - { \ - RETTYPE ret; \ - SetLastError (0); \ - ret = (EXPRESSION); \ - if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \ - { \ - int fd = fileno (stream); \ - if (fd >= 0 \ - && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\ - { \ - /* Try to raise signal SIGPIPE. */ \ - raise (SIGPIPE); \ - /* If it is currently blocked or ignored, change errno from \ - EINVAL to EPIPE. */ \ - errno = EPIPE; \ - } \ - } \ - return ret; \ - } - -# if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */ -int -printf (const char *format, ...) -{ - int retval; - va_list args; - - va_start (args, format); - retval = vfprintf (stdout, format, args); - va_end (args); - - return retval; -} -# endif - -# if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */ -int -fprintf (FILE *stream, const char *format, ...) -{ - int retval; - va_list args; - - va_start (args, format); - retval = vfprintf (stream, format, args); - va_end (args); - - return retval; -} -# endif - -# if !REPLACE_VPRINTF_POSIX /* avoid collision with vprintf.c */ -int -vprintf (const char *format, va_list args) -{ - return vfprintf (stdout, format, args); -} -# endif - -# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vfprintf.c */ -int -vfprintf (FILE *stream, const char *format, va_list args) -#undef vfprintf -{ - CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF) -} -# endif - -int -putchar (int c) -{ - return fputc (c, stdout); -} - -int -fputc (int c, FILE *stream) -#undef fputc -{ - CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF) -} - -int -fputs (const char *string, FILE *stream) -#undef fputs -{ - CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF) -} - -int -puts (const char *string) -#undef puts -{ - FILE *stream = stdout; - CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF) -} - -size_t -fwrite (const void *ptr, size_t s, size_t n, FILE *stream) -#undef fwrite -{ - CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n) -} - -# endif -#endif diff --git a/grub-core/gnulib/stdio.in.h b/grub-core/gnulib/stdio.in.h index a8b00c617..e1d28cebf 100644 --- a/grub-core/gnulib/stdio.in.h +++ b/grub-core/gnulib/stdio.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,47 +13,104 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ -#if defined __need_FILE || defined __need___FILE -/* Special invocation convention inside glibc header files. */ +#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H +/* Special invocation convention: + - Inside glibc header files. + - On OSF/1 5.1 we have a sequence of nested includes + -> -> -> -> + -> -> -> . + In this situation, the functions are not yet declared, therefore we cannot + provide the C++ aliases. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ #else /* Normal invocation convention. */ -#ifndef _GL_STDIO_H +#ifndef _@GUARD_PREFIX@_STDIO_H + +#define _GL_ALREADY_INCLUDING_STDIO_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ -#ifndef _GL_STDIO_H -#define _GL_STDIO_H +#undef _GL_ALREADY_INCLUDING_STDIO_H + +#ifndef _@GUARD_PREFIX@_STDIO_H +#define _@GUARD_PREFIX@_STDIO_H /* Get va_list. Needed on many systems, including glibc 2.8. */ #include #include -/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8. */ +/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 + and eglibc 2.11.2. + May also define off_t to a 64-bit type on native Windows. */ #include -#ifndef __attribute__ /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. - We enable __attribute__ only if these are supported too, because + We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __attribute__(Spec) /* empty */ -# endif +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ +#endif + +/* _GL_ATTRIBUTE_FORMAT_PRINTF + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument)) +#else +# define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) +#endif + +/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF, + except that it indicates to GCC that the supported format string directives + are the ones of the system printf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) + +/* _GL_ATTRIBUTE_FORMAT_SCANF + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) +#else +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) +#endif + +/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, + except that it indicates to GCC that the supported format string directives + are the ones of the system scanf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) + +/* Solaris 10 declares renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ + && ! defined __GLIBC__ +# include #endif @@ -74,13 +131,13 @@ # define dprintf rpl_dprintf # endif _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); # else # if !@HAVE_DPRINTF@ _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); @@ -113,6 +170,26 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " "use gnulib module fclose for portable POSIX compliance"); #endif +#if @GNULIB_FDOPEN@ +# if @REPLACE_FDOPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fdopen +# define fdopen rpl_fdopen +# endif +_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); +# else +_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); +# endif +_GL_CXXALIASWARN (fdopen); +#elif defined GNULIB_POSIXCHECK +# undef fdopen +/* Assume fdopen is always declared. */ +_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " + "use gnulib module fdopen for portability"); +#endif + #if @GNULIB_FFLUSH@ /* Flush all pending data on STREAM according to POSIX rules. Both output and seekable input streams are supported. @@ -137,12 +214,33 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " "use gnulib module fflush for portable POSIX compliance"); #endif -/* It is very rare that the developer ever has full control of stdin, - so any use of gets warrants an unconditional warning; besides, C11 - removed it. */ -#undef gets -#if HAVE_RAW_DECL_GETS -_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); +#if @GNULIB_FGETC@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fgetc +# define fgetc rpl_fgetc +# endif +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); +# endif +_GL_CXXALIASWARN (fgetc); +#endif + +#if @GNULIB_FGETS@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fgets +# define fgets rpl_fgets +# endif +_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream) + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); +# else +_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); +# endif +_GL_CXXALIASWARN (fgets); #endif #if @GNULIB_FOPEN@ @@ -161,20 +259,26 @@ _GL_CXXALIASWARN (fopen); #elif defined GNULIB_POSIXCHECK # undef fopen /* Assume fopen is always declared. */ -_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - " +_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " "use gnulib module fopen for portability"); #endif #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ - || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) + || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define fprintf rpl_fprintf # endif # define GNULIB_overrides_fprintf 1 +# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); +# else +_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# endif _GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); # else _GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); @@ -220,7 +324,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " #endif #if @GNULIB_FPUTC@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fputc # define fputc rpl_fputc @@ -234,7 +338,7 @@ _GL_CXXALIASWARN (fputc); #endif #if @GNULIB_FPUTS@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fputs # define fputs rpl_fputs @@ -248,6 +352,21 @@ _GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); _GL_CXXALIASWARN (fputs); #endif +#if @GNULIB_FREAD@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fread +# define fread rpl_fread +# endif +_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream) + _GL_ARG_NONNULL ((4))); +_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); +# else +_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); +# endif +_GL_CXXALIASWARN (fread); +#endif + #if @GNULIB_FREOPEN@ # if @REPLACE_FREOPEN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -267,10 +386,27 @@ _GL_CXXALIASWARN (freopen); #elif defined GNULIB_POSIXCHECK # undef freopen /* Assume freopen is always declared. */ -_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - " +_GL_WARN_ON_USE (freopen, + "freopen on native Windows platforms is not POSIX compliant - " "use gnulib module freopen for portability"); #endif +#if @GNULIB_FSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fscanf +# define fscanf rpl_fscanf +# endif +_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); +# else +_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); +# endif +_GL_CXXALIASWARN (fscanf); +#endif + /* Set up the following warnings, based on which modules are in use. GNU Coding Standards discourage the use of fseek, since it imposes @@ -338,29 +474,13 @@ _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); # else -# if ! @HAVE_FSEEKO@ +# if ! @HAVE_DECL_FSEEKO@ _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); # endif _GL_CXXALIASWARN (fseeko); -# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@ - /* Provide an fseek function that is consistent with fseeko. */ - /* In order to avoid that fseek gets defined as a macro here, the - developer can request the 'fseek' module. */ -# undef fseek -# define fseek rpl_fseek -static inline int _GL_ARG_NONNULL ((1)) -rpl_fseek (FILE *fp, long offset, int whence) -{ -# if @REPLACE_FSEEKO@ - return rpl_fseeko (fp, offset, whence); -# else - return fseeko (fp, offset, whence); -# endif -} -# endif #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ # undef fseek @@ -414,28 +534,12 @@ _GL_CXXALIASWARN (ftell); _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); # else -# if ! @HAVE_FTELLO@ +# if ! @HAVE_DECL_FTELLO@ _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); # endif _GL_CXXALIASWARN (ftello); -# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@ - /* Provide an ftell function that is consistent with ftello. */ - /* In order to avoid that ftell gets defined as a macro here, the - developer can request the 'ftell' module. */ -# undef ftell -# define ftell rpl_ftell -static inline long _GL_ARG_NONNULL ((1)) -rpl_ftell (FILE *f) -{ -# if @REPLACE_FTELLO@ - return rpl_ftello (f); -# else - return ftello (f); -# endif -} -# endif #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ # undef ftell @@ -457,7 +561,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " #if @GNULIB_FWRITE@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef fwrite # define fwrite rpl_fwrite @@ -470,10 +574,51 @@ _GL_CXXALIAS_RPL (fwrite, size_t, # else _GL_CXXALIAS_SYS (fwrite, size_t, (const void *ptr, size_t s, size_t n, FILE *stream)); + +/* Work around bug 11959 when fortifying glibc 2.4 through 2.15 + , + which sometimes causes an unwanted diagnostic for fwrite calls. + This affects only function declaration attributes under certain + versions of gcc, and is not needed for C++. */ +# if (0 < __USE_FORTIFY_LEVEL \ + && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ + && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ + && !defined __cplusplus) +# undef fwrite +# define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; }) +# endif # endif _GL_CXXALIASWARN (fwrite); #endif +#if @GNULIB_GETC@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getc +# define getc rpl_fgetc +# endif +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); +# endif +_GL_CXXALIASWARN (getc); +#endif + +#if @GNULIB_GETCHAR@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getchar +# define getchar rpl_getchar +# endif +_GL_FUNCDECL_RPL (getchar, int, (void)); +_GL_CXXALIAS_RPL (getchar, int, (void)); +# else +_GL_CXXALIAS_SYS (getchar, int, (void)); +# endif +_GL_CXXALIASWARN (getchar); +#endif + #if @GNULIB_GETDELIM@ /* Read input, up to (and including) the next occurrence of DELIMITER, from STREAM, store it in *LINEPTR (and NUL-terminate it). @@ -550,6 +695,14 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " # endif #endif +/* It is very rare that the developer ever has full control of stdin, + so any use of gets warrants an unconditional warning; besides, C11 + removed it. */ +#undef gets +#if HAVE_RAW_DECL_GETS +#endif + + #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ struct obstack; /* Grow an obstack with formatted output. Return the number of @@ -563,7 +716,7 @@ struct obstack; # endif _GL_FUNCDECL_RPL (obstack_printf, int, (struct obstack *obs, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_printf, int, (struct obstack *obs, const char *format, ...)); @@ -571,7 +724,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int, # if !@HAVE_DECL_OBSTACK_PRINTF@ _GL_FUNCDECL_SYS (obstack_printf, int, (struct obstack *obs, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (obstack_printf, int, @@ -584,7 +737,7 @@ _GL_CXXALIASWARN (obstack_printf); # endif _GL_FUNCDECL_RPL (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args)); @@ -592,7 +745,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int, # if !@HAVE_DECL_OBSTACK_PRINTF@ _GL_FUNCDECL_SYS (obstack_vprintf, int, (struct obstack *obs, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (obstack_vprintf, int, @@ -601,6 +754,20 @@ _GL_CXXALIAS_SYS (obstack_vprintf, int, _GL_CXXALIASWARN (obstack_vprintf); #endif +#if @GNULIB_PCLOSE@ +# if !@HAVE_PCLOSE@ +_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); +_GL_CXXALIASWARN (pclose); +#elif defined GNULIB_POSIXCHECK +# undef pclose +# if HAVE_RAW_DECL_PCLOSE +_GL_WARN_ON_USE (pclose, "pclose is unportable - " + "use gnulib module pclose for more portability"); +# endif +#endif + #if @GNULIB_PERROR@ /* Print a message to standard error, describing the value of ERRNO, (if STRING is not NULL and not empty) prefixed with STRING and ": ", @@ -632,6 +799,10 @@ _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); # else +# if !@HAVE_POPEN@ +_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2))); +# endif _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); # endif _GL_CXXALIASWARN (popen); @@ -645,23 +816,35 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ - || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) + || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if defined __GNUC__ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) /* Don't break __attribute__((format(printf,M,N))). */ # define printf __printf__ # endif +# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL_1 (__printf__, int, (const char *format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) - __attribute__ ((__format__ (__printf__, 1, 2))) + _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) _GL_ARG_NONNULL ((1))); +# else +_GL_FUNCDECL_RPL_1 (__printf__, int, + (const char *format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +# endif _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); # else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define printf rpl_printf +# endif _GL_FUNCDECL_RPL (printf, int, (const char *format, ...) - __attribute__ ((__format__ (__printf__, 1, 2))) + _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); # endif @@ -682,7 +865,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " #endif #if @GNULIB_PUTC@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putc # define putc rpl_fputc @@ -696,7 +879,7 @@ _GL_CXXALIASWARN (putc); #endif #if @GNULIB_PUTCHAR@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef putchar # define putchar rpl_putchar @@ -710,7 +893,7 @@ _GL_CXXALIASWARN (putchar); #endif #if @GNULIB_PUTS@ -# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef puts # define puts rpl_puts @@ -794,6 +977,37 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - " # endif #endif +#if @GNULIB_SCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if defined __GNUC__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef scanf +/* Don't break __attribute__((format(scanf,M,N))). */ +# define scanf __scanf__ +# endif +_GL_FUNCDECL_RPL_1 (__scanf__, int, + (const char *format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...)); +# else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef scanf +# define scanf rpl_scanf +# endif +_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); +# endif +# else +_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); +# endif +_GL_CXXALIASWARN (scanf); +#endif + #if @GNULIB_SNPRINTF@ # if @REPLACE_SNPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -801,7 +1015,7 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - " # endif _GL_FUNCDECL_RPL (snprintf, int, (char *str, size_t size, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))) + _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (snprintf, int, (char *str, size_t size, const char *format, ...)); @@ -809,7 +1023,7 @@ _GL_CXXALIAS_RPL (snprintf, int, # if !@HAVE_DECL_SNPRINTF@ _GL_FUNCDECL_SYS (snprintf, int, (char *str, size_t size, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))) + _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (snprintf, int, @@ -824,9 +1038,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " # endif #endif -/* Some people would argue that sprintf should be handled like gets - (for example, OpenBSD issues a link warning for both functions), - since both can cause security holes due to buffer overruns. +/* Some people would argue that all sprintf uses should be warned about + (for example, OpenBSD issues a link warning for it), + since it can cause security holes due to buffer overruns. However, we believe that sprintf can be used safely, and is more efficient than snprintf in those safe cases; and as proof of our belief, we use sprintf in several gnulib modules. So this header @@ -839,7 +1053,7 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " # define sprintf rpl_sprintf # endif _GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); # else @@ -884,7 +1098,7 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " # endif _GL_FUNCDECL_RPL (asprintf, int, (char **result, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (asprintf, int, (char **result, const char *format, ...)); @@ -892,7 +1106,7 @@ _GL_CXXALIAS_RPL (asprintf, int, # if !@HAVE_VASPRINTF@ _GL_FUNCDECL_SYS (asprintf, int, (char **result, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (asprintf, int, @@ -905,7 +1119,7 @@ _GL_CXXALIASWARN (asprintf); # endif _GL_FUNCDECL_RPL (vasprintf, int, (char **result, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vasprintf, int, (char **result, const char *format, va_list args)); @@ -913,7 +1127,7 @@ _GL_CXXALIAS_RPL (vasprintf, int, # if !@HAVE_VASPRINTF@ _GL_FUNCDECL_SYS (vasprintf, int, (char **result, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (vasprintf, int, @@ -928,13 +1142,13 @@ _GL_CXXALIASWARN (vasprintf); # define vdprintf rpl_vdprintf # endif _GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); # else # if !@HAVE_VDPRINTF@ _GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((2))); # endif /* Need to cast, because on Solaris, the third parameter will likely be @@ -953,14 +1167,20 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ - || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) + || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vfprintf rpl_vfprintf # endif # define GNULIB_overrides_vfprintf 1 +# if @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); +# else +_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# endif _GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); # else /* Need to cast, because on Solaris, the third parameter is @@ -981,16 +1201,41 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " "POSIX compliance"); #endif +#if @GNULIB_VFSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vfscanf +# define vfscanf rpl_vfscanf +# endif +_GL_FUNCDECL_RPL (vfscanf, int, + (FILE *stream, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (vfscanf, int, + (FILE *stream, const char *format, va_list args)); +# else +_GL_CXXALIAS_SYS (vfscanf, int, + (FILE *stream, const char *format, va_list args)); +# endif +_GL_CXXALIASWARN (vfscanf); +#endif + #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ - || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@) + || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vprintf rpl_vprintf # endif # define GNULIB_overrides_vprintf 1 +# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 1, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) _GL_ARG_NONNULL ((1))); +# else +_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) + _GL_ARG_NONNULL ((1))); +# endif _GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); # else /* Need to cast, because on Solaris, the second parameter is @@ -1010,6 +1255,22 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " "POSIX compliance"); #endif +#if @GNULIB_VSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vscanf +# define vscanf rpl_vscanf +# endif +_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args)); +# else +_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args)); +# endif +_GL_CXXALIASWARN (vscanf); +#endif + #if @GNULIB_VSNPRINTF@ # if @REPLACE_VSNPRINTF@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1017,7 +1278,7 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " # endif _GL_FUNCDECL_RPL (vsnprintf, int, (char *str, size_t size, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (vsnprintf, int, (char *str, size_t size, const char *format, va_list args)); @@ -1025,7 +1286,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int, # if !@HAVE_DECL_VSNPRINTF@ _GL_FUNCDECL_SYS (vsnprintf, int, (char *str, size_t size, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (vsnprintf, int, @@ -1047,7 +1308,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " # endif _GL_FUNCDECL_RPL (vsprintf, int, (char *str, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vsprintf, int, (char *str, const char *format, va_list args)); @@ -1067,7 +1328,6 @@ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " "POSIX compliance"); #endif - -#endif /* _GL_STDIO_H */ -#endif /* _GL_STDIO_H */ +#endif /* _@GUARD_PREFIX@_STDIO_H */ +#endif /* _@GUARD_PREFIX@_STDIO_H */ #endif diff --git a/grub-core/gnulib/stdlib.in.h b/grub-core/gnulib/stdlib.in.h index f4309ed73..c9552480e 100644 --- a/grub-core/gnulib/stdlib.in.h +++ b/grub-core/gnulib/stdlib.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 1995, 2001-2004, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,28 +18,30 @@ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ -#if defined __need_malloc_and_calloc -/* Special invocation convention inside glibc header files. */ +#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc +/* Special invocation conventions inside some gnulib header files, + and inside some glibc header files, respectively. */ #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ #else /* Normal invocation convention. */ -#ifndef _GL_STDLIB_H +#ifndef _@GUARD_PREFIX@_STDLIB_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ -#ifndef _GL_STDLIB_H -#define _GL_STDLIB_H +#ifndef _@GUARD_PREFIX@_STDLIB_H +#define _@GUARD_PREFIX@_STDLIB_H /* NetBSD 5.0 mis-defines NULL. */ #include /* MirBSD 10 defines WEXITSTATUS in , not in . */ -#ifndef WEXITSTATUS +#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS # include #endif @@ -48,18 +50,28 @@ # include #endif +/* Native Windows platforms declare mktemp() in . */ +#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +# include +#endif + +#if @GNULIB_RANDOM_R@ + /* OSF/1 5.1 declares 'struct random_data' in , which is included - from if _REENTRANT is defined. Include it always. */ -#if @HAVE_RANDOM_H@ -# include -#endif + from if _REENTRANT is defined. Include it whenever we need + 'struct random_data'. */ +# if @HAVE_RANDOM_H@ +# include +# endif -#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \ - || defined GNULIB_POSIXCHECK -# include -#endif +# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ +# include +# endif -#if !@HAVE_STRUCT_RANDOM_DATA@ +# if !@HAVE_STRUCT_RANDOM_DATA@ +/* Define 'struct random_data'. + But allow multiple gnulib generated replacements to coexist. */ +# if !GNULIB_defined_struct_random_data struct random_data { int32_t *fptr; /* Front pointer. */ @@ -70,21 +82,29 @@ struct random_data int rand_sep; /* Distance between front and rear. */ int32_t *end_ptr; /* Pointer behind state table. */ }; +# define GNULIB_defined_struct_random_data 1 +# endif +# endif #endif -#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) -/* On MacOS X 10.3, only declares mkstemp. */ +#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) +/* On Mac OS X 10.3, only declares mkstemp. */ +/* On Mac OS X 10.5, only declares mkstemps. */ /* On Cygwin 1.7.1, only declares getsubopt. */ /* But avoid namespace pollution on glibc systems and native Windows. */ # include #endif -#ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) -# define __attribute__(Spec) /* empty */ -# endif +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ #endif +/* The definition of _Noreturn is copied here. */ + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -110,7 +130,7 @@ struct random_data /* Terminate the current process with the given return code, without running the 'atexit' handlers. */ # if !@HAVE__EXIT@ -_GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__))); +_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); # endif _GL_CXXALIAS_SYS (_Exit, void, (int status)); _GL_CXXALIASWARN (_Exit); @@ -127,7 +147,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " /* Parse a signed decimal integer. Returns the value of the integer. Errors are not detected. */ # if !@HAVE_ATOLL@ -_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (atoll, long long, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); _GL_CXXALIASWARN (atoll); @@ -177,7 +199,8 @@ _GL_CXXALIASWARN (canonicalize_file_name); #elif defined GNULIB_POSIXCHECK # undef canonicalize_file_name # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME -_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - " +_GL_WARN_ON_USE (canonicalize_file_name, + "canonicalize_file_name is unportable - " "use gnulib module canonicalize-lgpl for portability"); # endif #endif @@ -240,14 +263,19 @@ _GL_CXXALIASWARN (grantpt); #elif defined GNULIB_POSIXCHECK # undef grantpt # if HAVE_RAW_DECL_GRANTPT -_GL_WARN_ON_USE (ptsname, "grantpt is not portable - " +_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " "use gnulib module grantpt for portability"); # endif #endif +/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not + rely on GNU or POSIX semantics for malloc and realloc (for example, + by never specifying a zero size), so it does not need malloc or + realloc to be redefined. */ #if @GNULIB_MALLOC_POSIX@ # if @REPLACE_MALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) # undef malloc # define malloc rpl_malloc # endif @@ -257,13 +285,28 @@ _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); # endif _GL_CXXALIASWARN (malloc); -#elif defined GNULIB_POSIXCHECK +#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC # undef malloc /* Assume malloc is always declared. */ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " "use gnulib module malloc-posix for portability"); #endif +/* Convert a multibyte character to a wide character. */ +#if @GNULIB_MBTOWC@ +# if @REPLACE_MBTOWC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbtowc +# define mbtowc rpl_mbtowc +# endif +_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# else +_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +# endif +_GL_CXXALIASWARN (mbtowc); +#endif + #if @GNULIB_MKDTEMP@ /* Create a unique temporary directory from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; @@ -396,13 +439,38 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " # endif #endif +#if @GNULIB_POSIX_OPENPT@ +/* Return an FD open to the master side of a pseudo-terminal. Flags should + include O_RDWR, and may also include O_NOCTTY. */ +# if !@HAVE_POSIX_OPENPT@ +_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); +# endif +_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); +_GL_CXXALIASWARN (posix_openpt); +#elif defined GNULIB_POSIXCHECK +# undef posix_openpt +# if HAVE_RAW_DECL_POSIX_OPENPT +_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " + "use gnulib module posix_openpt for portability"); +# endif +#endif + #if @GNULIB_PTSNAME@ /* Return the pathname of the pseudo-terminal slave associated with the master FD is open on, or NULL on errors. */ -# if !@HAVE_PTSNAME@ +# if @REPLACE_PTSNAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ptsname +# define ptsname rpl_ptsname +# endif +_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); +_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); +# else +# if !@HAVE_PTSNAME@ _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); -# endif +# endif _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); +# endif _GL_CXXALIASWARN (ptsname); #elif defined GNULIB_POSIXCHECK # undef ptsname @@ -412,6 +480,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " # endif #endif +#if @GNULIB_PTSNAME_R@ +/* Set the pathname of the pseudo-terminal slave associated with + the master FD is open on and return 0, or set errno and return + non-zero on errors. */ +# if @REPLACE_PTSNAME_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ptsname_r +# define ptsname_r rpl_ptsname_r +# endif +_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +# else +# if !@HAVE_PTSNAME_R@ +_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +# endif +_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +# endif +_GL_CXXALIASWARN (ptsname_r); +#elif defined GNULIB_POSIXCHECK +# undef ptsname_r +# if HAVE_RAW_DECL_PTSNAME_R +_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " + "use gnulib module ptsname_r for portability"); +# endif +#endif + #if @GNULIB_PUTENV@ # if @REPLACE_PUTENV@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -435,12 +529,83 @@ _GL_CXXALIASWARN (putenv); # endif #endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (random, long, (void)); +# endif +_GL_CXXALIAS_SYS (random, long, (void)); +_GL_CXXALIASWARN (random); +#elif defined GNULIB_POSIXCHECK +# undef random +# if HAVE_RAW_DECL_RANDOM +_GL_WARN_ON_USE (random, "random is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); +# endif +_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed)); +_GL_CXXALIASWARN (srandom); +#elif defined GNULIB_POSIXCHECK +# undef srandom +# if HAVE_RAW_DECL_SRANDOM +_GL_WARN_ON_USE (srandom, "srandom is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); +_GL_CXXALIASWARN (initstate); +#elif defined GNULIB_POSIXCHECK +# undef initstate +# if HAVE_RAW_DECL_INITSTATE_R +_GL_WARN_ON_USE (initstate, "initstate is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state)); +_GL_CXXALIASWARN (setstate); +#elif defined GNULIB_POSIXCHECK +# undef setstate +# if HAVE_RAW_DECL_SETSTATE_R +_GL_WARN_ON_USE (setstate, "setstate is unportable - " + "use gnulib module random for portability"); +# endif +#endif + + #if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef random_r +# define random_r rpl_random_r +# endif +_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); +# else +# if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) _GL_ARG_NONNULL ((1, 2))); -# endif +# endif _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); +# endif _GL_CXXALIASWARN (random_r); #elif defined GNULIB_POSIXCHECK # undef random_r @@ -451,13 +616,25 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - " #endif #if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef srandom_r +# define srandom_r rpl_srandom_r +# endif +_GL_FUNCDECL_RPL (srandom_r, int, + (unsigned int seed, struct random_data *rand_state) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (srandom_r, int, + (unsigned int seed, struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (srandom_r, int, (unsigned int seed, struct random_data *rand_state) _GL_ARG_NONNULL ((2))); -# endif +# endif _GL_CXXALIAS_SYS (srandom_r, int, (unsigned int seed, struct random_data *rand_state)); +# endif _GL_CXXALIASWARN (srandom_r); #elif defined GNULIB_POSIXCHECK # undef srandom_r @@ -468,15 +645,29 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " #endif #if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef initstate_r +# define initstate_r rpl_initstate_r +# endif +_GL_FUNCDECL_RPL (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state) + _GL_ARG_NONNULL ((2, 4))); +_GL_CXXALIAS_RPL (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, struct random_data *rand_state) _GL_ARG_NONNULL ((2, 4))); -# endif +# endif _GL_CXXALIAS_SYS (initstate_r, int, (unsigned int seed, char *buf, size_t buf_size, struct random_data *rand_state)); +# endif _GL_CXXALIASWARN (initstate_r); #elif defined GNULIB_POSIXCHECK # undef initstate_r @@ -487,13 +678,25 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " #endif #if @GNULIB_RANDOM_R@ -# if !@HAVE_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setstate_r +# define setstate_r rpl_setstate_r +# endif +_GL_FUNCDECL_RPL (setstate_r, int, + (char *arg_state, struct random_data *rand_state) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ _GL_FUNCDECL_SYS (setstate_r, int, (char *arg_state, struct random_data *rand_state) _GL_ARG_NONNULL ((1, 2))); -# endif +# endif _GL_CXXALIAS_SYS (setstate_r, int, (char *arg_state, struct random_data *rand_state)); +# endif _GL_CXXALIASWARN (setstate_r); #elif defined GNULIB_POSIXCHECK # undef setstate_r @@ -506,7 +709,8 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " #if @GNULIB_REALLOC_POSIX@ # if @REPLACE_REALLOC@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) # undef realloc # define realloc rpl_realloc # endif @@ -516,7 +720,7 @@ _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); # endif _GL_CXXALIASWARN (realloc); -#elif defined GNULIB_POSIXCHECK +#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC # undef realloc /* Assume realloc is always declared. */ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " @@ -563,6 +767,22 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " # endif #endif +#if @GNULIB_SECURE_GETENV@ +/* Look up NAME in the environment, returning 0 in insecure situations. */ +# if !@HAVE_SECURE_GETENV@ +_GL_FUNCDECL_SYS (secure_getenv, char *, + (char const *name) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); +_GL_CXXALIASWARN (secure_getenv); +#elif defined GNULIB_POSIXCHECK +# undef secure_getenv +# if HAVE_RAW_DECL_SECURE_GETENV +_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " + "use gnulib module secure_getenv for portability"); +# endif +#endif + #if @GNULIB_SETENV@ /* Set NAME to VALUE in the environment. If REPLACE is nonzero, overwrite an existing value. */ @@ -577,7 +797,7 @@ _GL_FUNCDECL_RPL (setenv, int, _GL_CXXALIAS_RPL (setenv, int, (const char *name, const char *value, int replace)); # else -# if !@HAVE_SETENV@ +# if !@HAVE_DECL_SETENV@ _GL_FUNCDECL_SYS (setenv, int, (const char *name, const char *value, int replace) _GL_ARG_NONNULL ((1))); @@ -585,7 +805,9 @@ _GL_FUNCDECL_SYS (setenv, int, _GL_CXXALIAS_SYS (setenv, int, (const char *name, const char *value, int replace)); # endif +# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) _GL_CXXALIASWARN (setenv); +# endif #elif defined GNULIB_POSIXCHECK # undef setenv # if HAVE_RAW_DECL_SETENV @@ -695,12 +917,14 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); # else -# if !@HAVE_UNSETENV@ +# if !@HAVE_DECL_UNSETENV@ _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); # endif +# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) _GL_CXXALIASWARN (unsetenv); +# endif #elif defined GNULIB_POSIXCHECK # undef unsetenv # if HAVE_RAW_DECL_UNSETENV @@ -709,7 +933,22 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " # endif #endif - -#endif /* _GL_STDLIB_H */ -#endif /* _GL_STDLIB_H */ +/* Convert a wide character to a multibyte character. */ +#if @GNULIB_WCTOMB@ +# if @REPLACE_WCTOMB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wctomb +# define wctomb rpl_wctomb +# endif +_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); +_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); +# else +_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); +# endif +_GL_CXXALIASWARN (wctomb); +#endif + + +#endif /* _@GUARD_PREFIX@_STDLIB_H */ +#endif /* _@GUARD_PREFIX@_STDLIB_H */ #endif diff --git a/grub-core/gnulib/strcasecmp.c b/grub-core/gnulib/strcasecmp.c index 612c80fdc..0f0a742ff 100644 --- a/grub-core/gnulib/strcasecmp.c +++ b/grub-core/gnulib/strcasecmp.c @@ -1,5 +1,5 @@ /* Case-insensitive string comparison function. - Copyright (C) 1998-1999, 2005-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2007, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #include diff --git a/grub-core/gnulib/strchrnul.c b/grub-core/gnulib/strchrnul.c index f834d3434..f6b072274 100644 --- a/grub-core/gnulib/strchrnul.c +++ b/grub-core/gnulib/strchrnul.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/grub-core/gnulib/streq.h b/grub-core/gnulib/streq.h index aa65bb8e1..12c1867c8 100644 --- a/grub-core/gnulib/streq.h +++ b/grub-core/gnulib/streq.h @@ -1,5 +1,5 @@ /* Optimized string comparison. - Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -9,7 +9,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -21,8 +21,8 @@ #include -/* STREQ allows to optimize string comparison with a small literal string. - STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) +/* STREQ_OPT allows to optimize string comparison with a small literal string. + STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) is semantically equivalent to strcmp (s, "EUC-KR") == 0 just faster. */ @@ -163,12 +163,12 @@ streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, return 0; } -#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ +#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28) #else -#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ +#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \ (strcmp (s1, s2) == 0) #endif diff --git a/grub-core/gnulib/strerror-override.c b/grub-core/gnulib/strerror-override.c new file mode 100644 index 000000000..d0ed2fb86 --- /dev/null +++ b/grub-core/gnulib/strerror-override.c @@ -0,0 +1,302 @@ +/* strerror-override.c --- POSIX compatible system error routine + + Copyright (C) 2010-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Bruno Haible , 2010. */ + +#include + +#include "strerror-override.h" + +#include + +#if GNULIB_defined_EWINSOCK /* native Windows platforms */ +# if HAVE_WINSOCK2_H +# include +# endif +#endif + +/* If ERRNUM maps to an errno value defined by gnulib, return a string + describing the error. Otherwise return NULL. */ +const char * +strerror_override (int errnum) +{ + /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ + switch (errnum) + { +#if REPLACE_STRERROR_0 + case 0: + return "Success"; +#endif + +#if GNULIB_defined_ESOCK /* native Windows platforms with older */ + case EINPROGRESS: + return "Operation now in progress"; + case EALREADY: + return "Operation already in progress"; + case ENOTSOCK: + return "Socket operation on non-socket"; + case EDESTADDRREQ: + return "Destination address required"; + case EMSGSIZE: + return "Message too long"; + case EPROTOTYPE: + return "Protocol wrong type for socket"; + case ENOPROTOOPT: + return "Protocol not available"; + case EPROTONOSUPPORT: + return "Protocol not supported"; + case EOPNOTSUPP: + return "Operation not supported"; + case EAFNOSUPPORT: + return "Address family not supported by protocol"; + case EADDRINUSE: + return "Address already in use"; + case EADDRNOTAVAIL: + return "Cannot assign requested address"; + case ENETDOWN: + return "Network is down"; + case ENETUNREACH: + return "Network is unreachable"; + case ECONNRESET: + return "Connection reset by peer"; + case ENOBUFS: + return "No buffer space available"; + case EISCONN: + return "Transport endpoint is already connected"; + case ENOTCONN: + return "Transport endpoint is not connected"; + case ETIMEDOUT: + return "Connection timed out"; + case ECONNREFUSED: + return "Connection refused"; + case ELOOP: + return "Too many levels of symbolic links"; + case EHOSTUNREACH: + return "No route to host"; + case EWOULDBLOCK: + return "Operation would block"; +#endif +#if GNULIB_defined_ESTREAMS /* native Windows platforms with older */ + case ETXTBSY: + return "Text file busy"; + case ENODATA: + return "No data available"; + case ENOSR: + return "Out of streams resources"; + case ENOSTR: + return "Device not a stream"; + case ETIME: + return "Timer expired"; + case EOTHER: + return "Other error"; +#endif +#if GNULIB_defined_EWINSOCK /* native Windows platforms */ + case ESOCKTNOSUPPORT: + return "Socket type not supported"; + case EPFNOSUPPORT: + return "Protocol family not supported"; + case ESHUTDOWN: + return "Cannot send after transport endpoint shutdown"; + case ETOOMANYREFS: + return "Too many references: cannot splice"; + case EHOSTDOWN: + return "Host is down"; + case EPROCLIM: + return "Too many processes"; + case EUSERS: + return "Too many users"; + case EDQUOT: + return "Disk quota exceeded"; + case ESTALE: + return "Stale NFS file handle"; + case EREMOTE: + return "Object is remote"; +# if HAVE_WINSOCK2_H + /* WSA_INVALID_HANDLE maps to EBADF */ + /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ + /* WSA_INVALID_PARAMETER maps to EINVAL */ + case WSA_OPERATION_ABORTED: + return "Overlapped operation aborted"; + case WSA_IO_INCOMPLETE: + return "Overlapped I/O event object not in signaled state"; + case WSA_IO_PENDING: + return "Overlapped operations will complete later"; + /* WSAEINTR maps to EINTR */ + /* WSAEBADF maps to EBADF */ + /* WSAEACCES maps to EACCES */ + /* WSAEFAULT maps to EFAULT */ + /* WSAEINVAL maps to EINVAL */ + /* WSAEMFILE maps to EMFILE */ + /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ + /* WSAEINPROGRESS maps to EINPROGRESS */ + /* WSAEALREADY maps to EALREADY */ + /* WSAENOTSOCK maps to ENOTSOCK */ + /* WSAEDESTADDRREQ maps to EDESTADDRREQ */ + /* WSAEMSGSIZE maps to EMSGSIZE */ + /* WSAEPROTOTYPE maps to EPROTOTYPE */ + /* WSAENOPROTOOPT maps to ENOPROTOOPT */ + /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */ + /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ + /* WSAEOPNOTSUPP maps to EOPNOTSUPP */ + /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ + /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */ + /* WSAEADDRINUSE maps to EADDRINUSE */ + /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */ + /* WSAENETDOWN maps to ENETDOWN */ + /* WSAENETUNREACH maps to ENETUNREACH */ + /* WSAENETRESET maps to ENETRESET */ + /* WSAECONNABORTED maps to ECONNABORTED */ + /* WSAECONNRESET maps to ECONNRESET */ + /* WSAENOBUFS maps to ENOBUFS */ + /* WSAEISCONN maps to EISCONN */ + /* WSAENOTCONN maps to ENOTCONN */ + /* WSAESHUTDOWN is ESHUTDOWN */ + /* WSAETOOMANYREFS is ETOOMANYREFS */ + /* WSAETIMEDOUT maps to ETIMEDOUT */ + /* WSAECONNREFUSED maps to ECONNREFUSED */ + /* WSAELOOP maps to ELOOP */ + /* WSAENAMETOOLONG maps to ENAMETOOLONG */ + /* WSAEHOSTDOWN is EHOSTDOWN */ + /* WSAEHOSTUNREACH maps to EHOSTUNREACH */ + /* WSAENOTEMPTY maps to ENOTEMPTY */ + /* WSAEPROCLIM is EPROCLIM */ + /* WSAEUSERS is EUSERS */ + /* WSAEDQUOT is EDQUOT */ + /* WSAESTALE is ESTALE */ + /* WSAEREMOTE is EREMOTE */ + case WSASYSNOTREADY: + return "Network subsystem is unavailable"; + case WSAVERNOTSUPPORTED: + return "Winsock.dll version out of range"; + case WSANOTINITIALISED: + return "Successful WSAStartup not yet performed"; + case WSAEDISCON: + return "Graceful shutdown in progress"; + case WSAENOMORE: case WSA_E_NO_MORE: + return "No more results"; + case WSAECANCELLED: case WSA_E_CANCELLED: + return "Call was canceled"; + case WSAEINVALIDPROCTABLE: + return "Procedure call table is invalid"; + case WSAEINVALIDPROVIDER: + return "Service provider is invalid"; + case WSAEPROVIDERFAILEDINIT: + return "Service provider failed to initialize"; + case WSASYSCALLFAILURE: + return "System call failure"; + case WSASERVICE_NOT_FOUND: + return "Service not found"; + case WSATYPE_NOT_FOUND: + return "Class type not found"; + case WSAEREFUSED: + return "Database query was refused"; + case WSAHOST_NOT_FOUND: + return "Host not found"; + case WSATRY_AGAIN: + return "Nonauthoritative host not found"; + case WSANO_RECOVERY: + return "Nonrecoverable error"; + case WSANO_DATA: + return "Valid name, no data record of requested type"; + /* WSA_QOS_* omitted */ +# endif +#endif + +#if GNULIB_defined_ENOMSG + case ENOMSG: + return "No message of desired type"; +#endif + +#if GNULIB_defined_EIDRM + case EIDRM: + return "Identifier removed"; +#endif + +#if GNULIB_defined_ENOLINK + case ENOLINK: + return "Link has been severed"; +#endif + +#if GNULIB_defined_EPROTO + case EPROTO: + return "Protocol error"; +#endif + +#if GNULIB_defined_EMULTIHOP + case EMULTIHOP: + return "Multihop attempted"; +#endif + +#if GNULIB_defined_EBADMSG + case EBADMSG: + return "Bad message"; +#endif + +#if GNULIB_defined_EOVERFLOW + case EOVERFLOW: + return "Value too large for defined data type"; +#endif + +#if GNULIB_defined_ENOTSUP + case ENOTSUP: + return "Not supported"; +#endif + +#if GNULIB_defined_ENETRESET + case ENETRESET: + return "Network dropped connection on reset"; +#endif + +#if GNULIB_defined_ECONNABORTED + case ECONNABORTED: + return "Software caused connection abort"; +#endif + +#if GNULIB_defined_ESTALE + case ESTALE: + return "Stale NFS file handle"; +#endif + +#if GNULIB_defined_EDQUOT + case EDQUOT: + return "Disk quota exceeded"; +#endif + +#if GNULIB_defined_ECANCELED + case ECANCELED: + return "Operation canceled"; +#endif + +#if GNULIB_defined_EOWNERDEAD + case EOWNERDEAD: + return "Owner died"; +#endif + +#if GNULIB_defined_ENOTRECOVERABLE + case ENOTRECOVERABLE: + return "State not recoverable"; +#endif + +#if GNULIB_defined_EILSEQ + case EILSEQ: + return "Invalid or incomplete multibyte or wide character"; +#endif + + default: + return NULL; + } +} diff --git a/grub-core/gnulib/strerror-override.h b/grub-core/gnulib/strerror-override.h new file mode 100644 index 000000000..3b8f24b99 --- /dev/null +++ b/grub-core/gnulib/strerror-override.h @@ -0,0 +1,56 @@ +/* strerror-override.h --- POSIX compatible system error routine + + Copyright (C) 2010-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _GL_STRERROR_OVERRIDE_H +# define _GL_STRERROR_OVERRIDE_H + +# include +# include + +/* Reasonable buffer size that should never trigger ERANGE; if this + proves too small, we intentionally abort(), to remind us to fix + this value. */ +# define STACKBUF_LEN 256 + +/* If ERRNUM maps to an errno value defined by gnulib, return a string + describing the error. Otherwise return NULL. */ +# if REPLACE_STRERROR_0 \ + || GNULIB_defined_ESOCK \ + || GNULIB_defined_ESTREAMS \ + || GNULIB_defined_EWINSOCK \ + || GNULIB_defined_ENOMSG \ + || GNULIB_defined_EIDRM \ + || GNULIB_defined_ENOLINK \ + || GNULIB_defined_EPROTO \ + || GNULIB_defined_EMULTIHOP \ + || GNULIB_defined_EBADMSG \ + || GNULIB_defined_EOVERFLOW \ + || GNULIB_defined_ENOTSUP \ + || GNULIB_defined_ENETRESET \ + || GNULIB_defined_ECONNABORTED \ + || GNULIB_defined_ESTALE \ + || GNULIB_defined_EDQUOT \ + || GNULIB_defined_ECANCELED \ + || GNULIB_defined_EOWNERDEAD \ + || GNULIB_defined_ENOTRECOVERABLE \ + || GNULIB_defined_EILSEQ +extern const char *strerror_override (int errnum); +# else +# define strerror_override(ignored) NULL +# endif + +#endif /* _GL_STRERROR_OVERRIDE_H */ diff --git a/grub-core/gnulib/strerror.c b/grub-core/gnulib/strerror.c index 46153abf5..80a2f2eea 100644 --- a/grub-core/gnulib/strerror.c +++ b/grub-core/gnulib/strerror.c @@ -1,6 +1,6 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,334 +17,54 @@ #include +/* Specification. */ #include -#if REPLACE_STRERROR +#include +#include +#include +#include -# include -# include - -# if GNULIB_defined_ESOCK /* native Windows platforms */ -# if HAVE_WINSOCK2_H -# include -# endif -# endif - -# include "intprops.h" +#include "intprops.h" +#include "strerror-override.h" +#include "verify.h" /* Use the system functions, not the gnulib overrides in this file. */ -# undef sprintf - -# undef strerror -# if ! HAVE_DECL_STRERROR -# define strerror(n) NULL -# endif +#undef sprintf char * -rpl_strerror (int n) +strerror (int n) +#undef strerror { - char const *msg = NULL; - /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ - switch (n) - { -# if GNULIB_defined_ETXTBSY - case ETXTBSY: - msg = "Text file busy"; - break; -# endif - -# if GNULIB_defined_ESOCK /* native Windows platforms */ - /* EWOULDBLOCK is the same as EAGAIN. */ - case EINPROGRESS: - msg = "Operation now in progress"; - break; - case EALREADY: - msg = "Operation already in progress"; - break; - case ENOTSOCK: - msg = "Socket operation on non-socket"; - break; - case EDESTADDRREQ: - msg = "Destination address required"; - break; - case EMSGSIZE: - msg = "Message too long"; - break; - case EPROTOTYPE: - msg = "Protocol wrong type for socket"; - break; - case ENOPROTOOPT: - msg = "Protocol not available"; - break; - case EPROTONOSUPPORT: - msg = "Protocol not supported"; - break; - case ESOCKTNOSUPPORT: - msg = "Socket type not supported"; - break; - case EOPNOTSUPP: - msg = "Operation not supported"; - break; - case EPFNOSUPPORT: - msg = "Protocol family not supported"; - break; - case EAFNOSUPPORT: - msg = "Address family not supported by protocol"; - break; - case EADDRINUSE: - msg = "Address already in use"; - break; - case EADDRNOTAVAIL: - msg = "Cannot assign requested address"; - break; - case ENETDOWN: - msg = "Network is down"; - break; - case ENETUNREACH: - msg = "Network is unreachable"; - break; - case ENETRESET: - msg = "Network dropped connection on reset"; - break; - case ECONNABORTED: - msg = "Software caused connection abort"; - break; - case ECONNRESET: - msg = "Connection reset by peer"; - break; - case ENOBUFS: - msg = "No buffer space available"; - break; - case EISCONN: - msg = "Transport endpoint is already connected"; - break; - case ENOTCONN: - msg = "Transport endpoint is not connected"; - break; - case ESHUTDOWN: - msg = "Cannot send after transport endpoint shutdown"; - break; - case ETOOMANYREFS: - msg = "Too many references: cannot splice"; - break; - case ETIMEDOUT: - msg = "Connection timed out"; - break; - case ECONNREFUSED: - msg = "Connection refused"; - break; - case ELOOP: - msg = "Too many levels of symbolic links"; - break; - case EHOSTDOWN: - msg = "Host is down"; - break; - case EHOSTUNREACH: - msg = "No route to host"; - break; - case EPROCLIM: - msg = "Too many processes"; - break; - case EUSERS: - msg = "Too many users"; - break; - case EDQUOT: - msg = "Disk quota exceeded"; - break; - case ESTALE: - msg = "Stale NFS file handle"; - break; - case EREMOTE: - msg = "Object is remote"; - break; -# if HAVE_WINSOCK2_H - /* WSA_INVALID_HANDLE maps to EBADF */ - /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ - /* WSA_INVALID_PARAMETER maps to EINVAL */ - case WSA_OPERATION_ABORTED: - msg = "Overlapped operation aborted"; - break; - case WSA_IO_INCOMPLETE: - msg = "Overlapped I/O event object not in signaled state"; - break; - case WSA_IO_PENDING: - msg = "Overlapped operations will complete later"; - break; - /* WSAEINTR maps to EINTR */ - /* WSAEBADF maps to EBADF */ - /* WSAEACCES maps to EACCES */ - /* WSAEFAULT maps to EFAULT */ - /* WSAEINVAL maps to EINVAL */ - /* WSAEMFILE maps to EMFILE */ - /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ - /* WSAEINPROGRESS is EINPROGRESS */ - /* WSAEALREADY is EALREADY */ - /* WSAENOTSOCK is ENOTSOCK */ - /* WSAEDESTADDRREQ is EDESTADDRREQ */ - /* WSAEMSGSIZE is EMSGSIZE */ - /* WSAEPROTOTYPE is EPROTOTYPE */ - /* WSAENOPROTOOPT is ENOPROTOOPT */ - /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */ - /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ - /* WSAEOPNOTSUPP is EOPNOTSUPP */ - /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ - /* WSAEAFNOSUPPORT is EAFNOSUPPORT */ - /* WSAEADDRINUSE is EADDRINUSE */ - /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */ - /* WSAENETDOWN is ENETDOWN */ - /* WSAENETUNREACH is ENETUNREACH */ - /* WSAENETRESET is ENETRESET */ - /* WSAECONNABORTED is ECONNABORTED */ - /* WSAECONNRESET is ECONNRESET */ - /* WSAENOBUFS is ENOBUFS */ - /* WSAEISCONN is EISCONN */ - /* WSAENOTCONN is ENOTCONN */ - /* WSAESHUTDOWN is ESHUTDOWN */ - /* WSAETOOMANYREFS is ETOOMANYREFS */ - /* WSAETIMEDOUT is ETIMEDOUT */ - /* WSAECONNREFUSED is ECONNREFUSED */ - /* WSAELOOP is ELOOP */ - /* WSAENAMETOOLONG maps to ENAMETOOLONG */ - /* WSAEHOSTDOWN is EHOSTDOWN */ - /* WSAEHOSTUNREACH is EHOSTUNREACH */ - /* WSAENOTEMPTY maps to ENOTEMPTY */ - /* WSAEPROCLIM is EPROCLIM */ - /* WSAEUSERS is EUSERS */ - /* WSAEDQUOT is EDQUOT */ - /* WSAESTALE is ESTALE */ - /* WSAEREMOTE is EREMOTE */ - case WSASYSNOTREADY: - msg = "Network subsystem is unavailable"; - break; - case WSAVERNOTSUPPORTED: - msg = "Winsock.dll version out of range"; - break; - case WSANOTINITIALISED: - msg = "Successful WSAStartup not yet performed"; - break; - case WSAEDISCON: - msg = "Graceful shutdown in progress"; - break; - case WSAENOMORE: case WSA_E_NO_MORE: - msg = "No more results"; - break; - case WSAECANCELLED: case WSA_E_CANCELLED: - msg = "Call was canceled"; - break; - case WSAEINVALIDPROCTABLE: - msg = "Procedure call table is invalid"; - break; - case WSAEINVALIDPROVIDER: - msg = "Service provider is invalid"; - break; - case WSAEPROVIDERFAILEDINIT: - msg = "Service provider failed to initialize"; - break; - case WSASYSCALLFAILURE: - msg = "System call failure"; - break; - case WSASERVICE_NOT_FOUND: - msg = "Service not found"; - break; - case WSATYPE_NOT_FOUND: - msg = "Class type not found"; - break; - case WSAEREFUSED: - msg = "Database query was refused"; - break; - case WSAHOST_NOT_FOUND: - msg = "Host not found"; - break; - case WSATRY_AGAIN: - msg = "Nonauthoritative host not found"; - break; - case WSANO_RECOVERY: - msg = "Nonrecoverable error"; - break; - case WSANO_DATA: - msg = "Valid name, no data record of requested type"; - break; - /* WSA_QOS_* omitted */ -# endif -# endif - -# if GNULIB_defined_ENOMSG - case ENOMSG: - msg = "No message of desired type"; - break; -# endif - -# if GNULIB_defined_EIDRM - case EIDRM: - msg = "Identifier removed"; - break; -# endif - -# if GNULIB_defined_ENOLINK - case ENOLINK: - msg = "Link has been severed"; - break; -# endif - -# if GNULIB_defined_EPROTO - case EPROTO: - msg = "Protocol error"; - break; -# endif - -# if GNULIB_defined_EMULTIHOP - case EMULTIHOP: - msg = "Multihop attempted"; - break; -# endif - -# if GNULIB_defined_EBADMSG - case EBADMSG: - msg = "Bad message"; - break; -# endif - -# if GNULIB_defined_EOVERFLOW - case EOVERFLOW: - msg = "Value too large for defined data type"; - break; -# endif - -# if GNULIB_defined_ENOTSUP - case ENOTSUP: - msg = "Not supported"; - break; -# endif - -# if GNULIB_defined_ESTALE - case ESTALE: - msg = "Stale NFS file handle"; - break; -# endif - -# if GNULIB_defined_ECANCELED - case ECANCELED: - msg = "Operation canceled"; - break; -# endif - } + static char buf[STACKBUF_LEN]; + size_t len; + /* Cast away const, due to the historical signature of strerror; + callers should not be modifying the string. */ + const char *msg = strerror_override (n); if (msg) return (char *) msg; - { - char *result = strerror (n); + msg = strerror (n); - if (result == NULL || result[0] == '\0') - { - static char const fmt[] = "Unknown error (%d)"; - static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; - sprintf (msg_buf, fmt, n); - return msg_buf; - } + /* Our strerror_r implementation might use the system's strerror + buffer, so all other clients of strerror have to see the error + copied into a buffer that we manage. This is not thread-safe, + even if the system strerror is, but portable programs shouldn't + be using strerror if they care about thread-safety. */ + if (!msg || !*msg) + { + static char const fmt[] = "Unknown error %d"; + verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n)); + sprintf (buf, fmt, n); + errno = EINVAL; + return buf; + } - return result; - } + /* Fix STACKBUF_LEN if this ever aborts. */ + len = strlen (msg); + if (sizeof buf <= len) + abort (); + + return memcpy (buf, msg, len + 1); } - -#endif diff --git a/grub-core/gnulib/string.in.h b/grub-core/gnulib/string.in.h index 49c711d8f..d7a6c9c92 100644 --- a/grub-core/gnulib/string.in.h +++ b/grub-core/gnulib/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,20 +13,20 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ -#ifndef _GL_STRING_H +#ifndef _@GUARD_PREFIX@_STRING_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ -#ifndef _GL_STRING_H -#define _GL_STRING_H +#ifndef _@GUARD_PREFIX@_STRING_H +#define _@GUARD_PREFIX@_STRING_H /* NetBSD 5.0 mis-defines NULL. */ #include @@ -36,13 +36,8 @@ # include #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define __attribute__(Spec) /* empty */ -# endif -#endif -/* The attribute __pure__ was added in gcc 2.96. */ +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else @@ -50,8 +45,8 @@ #endif /* NetBSD 5.0 declares strsignal in , not in . */ -/* But avoid namespace pollution on glibc systems. */ -#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) \ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ && ! defined __GLIBC__ # include #endif @@ -63,6 +58,36 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Find the index of the least-significant set bit. */ +#if @GNULIB_FFSL@ +# if !@HAVE_FFSL@ +_GL_FUNCDECL_SYS (ffsl, int, (long int i)); +# endif +_GL_CXXALIAS_SYS (ffsl, int, (long int i)); +_GL_CXXALIASWARN (ffsl); +#elif defined GNULIB_POSIXCHECK +# undef ffsl +# if HAVE_RAW_DECL_FFSL +_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); +# endif +#endif + + +/* Find the index of the least-significant set bit. */ +#if @GNULIB_FFSLL@ +# if !@HAVE_FFSLL@ +_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); +# endif +_GL_CXXALIAS_SYS (ffsll, int, (long long int i)); +_GL_CXXALIASWARN (ffsll); +#elif defined GNULIB_POSIXCHECK +# undef ffsll +# if HAVE_RAW_DECL_FFSLL +_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); +# endif +#endif + + /* Return the first instance of C within N bytes of S, or NULL. */ #if @GNULIB_MEMCHR@ # if @REPLACE_MEMCHR@ @@ -86,7 +111,7 @@ _GL_CXXALIAS_SYS_CAST2 (memchr, void *, (void const *__s, int __c, size_t __n), void const *, (void const *__s, int __c, size_t __n)); # endif -# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); _GL_CXXALIASWARN1 (memchr, void const *, @@ -171,7 +196,7 @@ _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) _GL_CXXALIAS_SYS_CAST2 (memrchr, void *, (void const *, int, size_t), void const *, (void const *, int, size_t)); -# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); @@ -201,7 +226,7 @@ _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) _GL_CXXALIAS_SYS_CAST2 (rawmemchr, void *, (void const *__s, int __c_in), void const *, (void const *__s, int __c_in)); -# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); @@ -281,18 +306,29 @@ _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings " /* Find the first occurrence of C in S or the final NUL byte. */ #if @GNULIB_STRCHRNUL@ -# if ! @HAVE_STRCHRNUL@ +# if @REPLACE_STRCHRNUL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strchrnul rpl_strchrnul +# endif +_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strchrnul, char *, + (const char *str, int ch)); +# else +# if ! @HAVE_STRCHRNUL@ _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); -# endif +# endif /* On some systems, this function is defined as an overloaded function: extern "C++" { const char * std::strchrnul (const char *, int); } extern "C++" { char * std::strchrnul (char *, int); } */ _GL_CXXALIAS_SYS_CAST2 (strchrnul, char *, (char const *__s, int __c_in), char const *, (char const *__s, int __c_in)); -# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); @@ -438,7 +474,7 @@ _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) _GL_CXXALIAS_SYS_CAST2 (strpbrk, char *, (char const *__s, char const *__accept), const char *, (char const *__s, char const *__accept)); -# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); _GL_CXXALIASWARN1 (strpbrk, char const *, @@ -540,7 +576,7 @@ _GL_CXXALIAS_SYS_CAST2 (strstr, char *, (const char *haystack, const char *needle), const char *, (const char *haystack, const char *needle)); # endif -# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strstr, const char *, @@ -589,7 +625,7 @@ _GL_CXXALIAS_SYS_CAST2 (strcasestr, char *, (const char *haystack, const char *needle), const char *, (const char *haystack, const char *needle)); # endif -# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \ +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); _GL_CXXALIASWARN1 (strcasestr, const char *, @@ -688,10 +724,14 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbslen rpl_mbslen # endif -_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); # else -_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); # endif _GL_CXXALIASWARN (mbslen); @@ -701,6 +741,7 @@ _GL_CXXALIASWARN (mbslen); /* Return the number of multibyte characters in the character string starting at STRING and ending at STRING + LEN. */ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1)); #endif @@ -714,10 +755,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) # define mbschr rpl_mbschr /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); # else _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); # endif @@ -729,15 +772,17 @@ _GL_CXXALIASWARN (mbschr); and return a pointer to it. Return NULL if C is not found in STRING. Unlike strrchr(), this function works correctly in multibyte locales with encodings such as GB18030. */ -# if defined __hpux +# if defined __hpux || defined __INTERIX # if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ +# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ # endif _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); # else _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); # endif @@ -750,6 +795,7 @@ _GL_CXXALIASWARN (mbsrchr); Unlike strstr(), this function works correctly in multibyte locales with encodings different from UTF-8. */ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -761,6 +807,7 @@ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) different lengths! Unlike strcasecmp(), this function works correctly in multibyte locales. */ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -775,6 +822,7 @@ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) Unlike strncasecmp(), this function works correctly in multibyte locales. But beware that N is not a byte count but a character count! */ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -788,6 +836,7 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) Unlike strncasecmp(), this function works correctly in multibyte locales. */ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -798,6 +847,7 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) strlen (haystack) < strlen (needle) ! Unlike strcasestr(), this function works correctly in multibyte locales. */ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -808,6 +858,7 @@ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) if none exists. Unlike strcspn(), this function works correctly in multibyte locales. */ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -821,10 +872,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); # else _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); # endif @@ -838,6 +891,7 @@ _GL_CXXALIASWARN (mbspbrk); if none exists. Unlike strspn(), this function works correctly in multibyte locales. */ _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -901,6 +955,35 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - " "use gnulib module strerror to guarantee non-NULL result"); #endif +/* Map any int, typically from errno, into an error message. Multithread-safe. + Uses the POSIX declaration, not the glibc declaration. */ +#if @GNULIB_STRERROR_R@ +# if @REPLACE_STRERROR_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strerror_r +# define strerror_r rpl_strerror_r +# endif +_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); +# else +# if !@HAVE_DECL_STRERROR_R@ +_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); +# endif +# if @HAVE_DECL_STRERROR_R@ +_GL_CXXALIASWARN (strerror_r); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror_r +# if HAVE_RAW_DECL_STRERROR_R +_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " + "use gnulib module strerror_r-posix for portability"); +# endif +#endif + #if @GNULIB_STRSIGNAL@ # if @REPLACE_STRSIGNAL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -928,6 +1011,7 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " #if @GNULIB_STRVERSCMP@ # if !@HAVE_STRVERSCMP@ _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); @@ -941,5 +1025,5 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " #endif -#endif /* _GL_STRING_H */ -#endif /* _GL_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ diff --git a/grub-core/gnulib/strings.in.h b/grub-core/gnulib/strings.in.h index c726a1623..4469f86ca 100644 --- a/grub-core/gnulib/strings.in.h +++ b/grub-core/gnulib/strings.in.h @@ -1,6 +1,6 @@ /* A substitute . - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,21 +13,36 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ -#ifndef _GL_STRINGS_H +#ifndef _@GUARD_PREFIX@_STRINGS_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ + +/* Minix 3.1.8 has a bug: must be included before . + But avoid namespace pollution on glibc systems. */ +#if defined __minix && !defined __GLIBC__ +# include +#endif /* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_STRINGS_H@ +#if @HAVE_STRINGS_H@ +# @INCLUDE_NEXT@ @NEXT_STRINGS_H@ +#endif -#ifndef _GL_STRINGS_H -#define _GL_STRINGS_H +#ifndef _@GUARD_PREFIX@_STRINGS_H +#define _@GUARD_PREFIX@_STRINGS_H +#if ! @HAVE_DECL_STRNCASECMP@ +/* Get size_t. */ +# include +#endif + + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -38,6 +53,20 @@ extern "C" { #endif + /* Find the index of the least-significant set bit. */ +#if @GNULIB_FFS@ +# if !@HAVE_FFS@ +_GL_FUNCDECL_SYS (ffs, int, (int i)); +# endif +_GL_CXXALIAS_SYS (ffs, int, (int i)); +_GL_CXXALIASWARN (ffs); +#elif defined GNULIB_POSIXCHECK +# undef ffs +# if HAVE_RAW_DECL_FFS +_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module"); +# endif +#endif + /* Compare strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. @@ -89,5 +118,5 @@ _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " } #endif -#endif /* _GL_STRING_H */ -#endif /* _GL_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ diff --git a/grub-core/gnulib/stripslash.c b/grub-core/gnulib/stripslash.c index 3a5996fd9..0e452a95e 100644 --- a/grub-core/gnulib/stripslash.c +++ b/grub-core/gnulib/stripslash.c @@ -1,6 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003-2006, 2009-2010 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -35,7 +35,7 @@ strip_trailing_slashes (char *file) bool had_slash; /* last_component returns "" for file system roots, but we need to turn - `///' into `/'. */ + "///" into "/". */ if (! *base) base = file; base_lim = base + base_len (base); diff --git a/grub-core/gnulib/strncasecmp.c b/grub-core/gnulib/strncasecmp.c index 8c806a6b0..35840bc01 100644 --- a/grub-core/gnulib/strncasecmp.c +++ b/grub-core/gnulib/strncasecmp.c @@ -1,5 +1,5 @@ /* strncasecmp.c -- case insensitive string comparator - Copyright (C) 1998-1999, 2005-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2007, 2009-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #include diff --git a/grub-core/gnulib/strndup.c b/grub-core/gnulib/strndup.c index 3de3dbc5a..e60268b86 100644 --- a/grub-core/gnulib/strndup.c +++ b/grub-core/gnulib/strndup.c @@ -1,7 +1,7 @@ /* A replacement function, for systems that lack strndup. - Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006, 2007, 2009, - 2010 Free Software Foundation, Inc. + Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2013 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #include diff --git a/grub-core/gnulib/strnlen.c b/grub-core/gnulib/strnlen.c index f1ec356dc..57fdfe770 100644 --- a/grub-core/gnulib/strnlen.c +++ b/grub-core/gnulib/strnlen.c @@ -1,5 +1,5 @@ /* Find the length of STRING, but scan at most MAXLEN characters. - Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #include diff --git a/grub-core/gnulib/strnlen1.c b/grub-core/gnulib/strnlen1.c index b8cd2bff0..0c22d21ed 100644 --- a/grub-core/gnulib/strnlen1.c +++ b/grub-core/gnulib/strnlen1.c @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/grub-core/gnulib/strnlen1.h b/grub-core/gnulib/strnlen1.h index dfaf62dcb..7c65e3161 100644 --- a/grub-core/gnulib/strnlen1.h +++ b/grub-core/gnulib/strnlen1.h @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,8 @@ extern "C" { /* Find the length of STRING + 1, but scan at most MAXLEN bytes. If no '\0' terminator is found in that many characters, return MAXLEN. */ /* This is the same as strnlen (string, maxlen - 1) + 1. */ -extern size_t strnlen1 (const char *string, size_t maxlen); +extern size_t strnlen1 (const char *string, size_t maxlen) + _GL_ATTRIBUTE_PURE; #ifdef __cplusplus diff --git a/grub-core/gnulib/sys_types.in.h b/grub-core/gnulib/sys_types.in.h new file mode 100644 index 000000000..d7da35623 --- /dev/null +++ b/grub-core/gnulib/sys_types.in.h @@ -0,0 +1,51 @@ +/* Provide a more complete sys/types.h. + + Copyright (C) 2011-2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#ifndef _@GUARD_PREFIX@_SYS_TYPES_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ + +#ifndef _@GUARD_PREFIX@_SYS_TYPES_H +#define _@GUARD_PREFIX@_SYS_TYPES_H + +/* Override off_t if Large File Support is requested on native Windows. */ +#if @WINDOWS_64_BIT_OFF_T@ +/* Same as int64_t in . */ +# if defined _MSC_VER +# define off_t __int64 +# else +# define off_t long long int +# endif +/* Indicator, for gnulib internal purposes. */ +# define _GL_WINDOWS_64_BIT_OFF_T 1 +#endif + +/* MSVC 9 defines size_t in , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + +#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ +#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ diff --git a/grub-core/gnulib/sys_wait.in.h b/grub-core/gnulib/sys_wait.in.h deleted file mode 100644 index 009fa219b..000000000 --- a/grub-core/gnulib/sys_wait.in.h +++ /dev/null @@ -1,106 +0,0 @@ -/* A POSIX-like . - Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - - -#ifndef _GL_SYS_WAIT_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif - -/* The include_next requires a split double-inclusion guard. */ -#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) -# @INCLUDE_NEXT@ @NEXT_SYS_WAIT_H@ -#endif - -#ifndef _GL_SYS_WAIT_H -#define _GL_SYS_WAIT_H - -#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) -/* Unix API. */ - -/* The following macros apply to an argument x, that is a status of a process, - as returned by waitpid(). - On nearly all systems, including Linux/x86, WEXITSTATUS are bits 15..8 and - WTERMSIG are bits 7..0, while BeOS uses the opposite. Therefore programs - have to use the abstract macros. */ - -/* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x) - is true. */ -# ifndef WIFSIGNALED -# define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f) -# endif -# ifndef WIFEXITED -# define WIFEXITED(x) (WTERMSIG (x) == 0) -# endif -# ifndef WIFSTOPPED -# define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f) -# endif - -/* The termination signal. Only to be accessed if WIFSIGNALED(x) is true. */ -# ifndef WTERMSIG -# define WTERMSIG(x) ((x) & 0x7f) -# endif - -/* The exit status. Only to be accessed if WIFEXITED(x) is true. */ -# ifndef WEXITSTATUS -# define WEXITSTATUS(x) (((x) >> 8) & 0xff) -# endif - -/* True if the process dumped core. Not standardized by POSIX. */ -# ifndef WCOREDUMP -# define WCOREDUMP(x) ((x) & 0x80) -# endif - -# ifdef __cplusplus -extern "C" { -# endif - -/* Declarations of functions. */ - -# ifdef __cplusplus -} -# endif - -#else -/* Native Windows API. */ - -# include - -# define waitpid(pid,statusp,options) _cwait (statusp, pid, WAIT_CHILD) - -/* The following macros apply to an argument x, that is a status of a process, - as returned by waitpid() or, equivalently, _cwait() or GetExitCodeProcess(). - This value is simply an 'int', not composed of bit fields. */ - -/* When an unhandled fatal signal terminates a process, the exit code is 3. */ -# define WIFSIGNALED(x) ((x) == 3) -# define WIFEXITED(x) ((x) != 3) -# define WIFSTOPPED(x) 0 - -/* The signal that terminated a process is not known posthum. */ -# define WTERMSIG(x) SIGTERM - -# define WEXITSTATUS(x) (x) - -/* There are no core dumps. */ -# define WCOREDUMP(x) 0 - -#endif - -#endif /* _GL_SYS_WAIT_H */ -#endif /* _GL_SYS_WAIT_H */ diff --git a/grub-core/gnulib/sysexits.in.h b/grub-core/gnulib/sysexits.in.h index 45255dfa5..fa8db8386 100644 --- a/grub-core/gnulib/sysexits.in.h +++ b/grub-core/gnulib/sysexits.in.h @@ -1,5 +1,5 @@ /* exit() exit codes for some BSD system programs. - Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,11 +16,12 @@ /* Written by Simon Josefsson based on sysexits(3) man page */ -#ifndef _GL_SYSEXITS_H +#ifndef _@GUARD_PREFIX@_SYSEXITS_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ #if @HAVE_SYSEXITS_H@ @@ -42,8 +43,8 @@ #endif -#ifndef _GL_SYSEXITS_H -#define _GL_SYSEXITS_H +#ifndef _@GUARD_PREFIX@_SYSEXITS_H +#define _@GUARD_PREFIX@_SYSEXITS_H #if !@HAVE_SYSEXITS_H@ @@ -67,5 +68,5 @@ #endif -#endif /* _GL_SYSEXITS_H */ -#endif /* _GL_SYSEXITS_H */ +#endif /* _@GUARD_PREFIX@_SYSEXITS_H */ +#endif /* _@GUARD_PREFIX@_SYSEXITS_H */ diff --git a/grub-core/gnulib/unistd.c b/grub-core/gnulib/unistd.c new file mode 100644 index 000000000..6c6a8e268 --- /dev/null +++ b/grub-core/gnulib/unistd.c @@ -0,0 +1,3 @@ +#include +#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE +#include "unistd.h" diff --git a/grub-core/gnulib/unistd.in.h b/grub-core/gnulib/unistd.in.h index 26a4cbd6a..2ea9af436 100644 --- a/grub-core/gnulib/unistd.in.h +++ b/grub-core/gnulib/unistd.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around . - Copyright (C) 2003-2010 Free Software Foundation, Inc. + Copyright (C) 2003-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,30 +12,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ + +#ifndef _@GUARD_PREFIX@_UNISTD_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif - -/* Special invocation convention: - - On mingw, several headers, including , include , - but we need to ensure that both the system and - are completely included before we replace gethostname. */ -#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ - && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H -/* is being indirectly included for the first time from - ; avoid declaring any overrides. */ -# if @HAVE_UNISTD_H@ -# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ -# else -# error unexpected; report this to bug-gnulib@gnu.org -# endif -# define _GL_WINSOCK2_H_WITNESS - -/* Normal invocation. */ -#elif !defined _GL_UNISTD_H +@PRAGMA_COLUMNS@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_UNISTD_H@ @@ -50,8 +34,8 @@ # undef _GL_INCLUDING_WINSOCK2_H #endif -#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H -#define _GL_UNISTD_H +#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H +#define _@GUARD_PREFIX@_UNISTD_H /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ #include @@ -60,32 +44,66 @@ /* Cygwin 1.7.1 declares symlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ - || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \ + || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ + && defined __CYGWIN__)) \ && ! defined __GLIBC__ # include #endif /* Cygwin 1.7.1 declares unlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ -#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ +#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ + && ! defined __GLIBC__ # include #endif /* mingw fails to declare _exit in . */ -/* mingw, BeOS, Haiku declare environ in , not in . */ +/* mingw, MSVC, BeOS, Haiku declare environ in , not in + . */ /* Solaris declares getcwd not only in but also in . */ +/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system is + included here. */ /* But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ +#if !defined __GLIBC__ && !defined __osf__ +# define __need_system_stdlib_h # include +# undef __need_system_stdlib_h #endif -/* mingw declares getcwd in , not in . */ -#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ +/* Native Windows platforms declare chdir, getcwd, rmdir in + and/or , not in . + They also declare access(), chmod(), close(), dup(), dup2(), isatty(), + lseek(), read(), unlink(), write() in . */ +#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \ + || defined GNULIB_POSIXCHECK) \ && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) +# include /* mingw32, mingw64 */ +# include /* mingw64, MSVC 9 */ +#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \ + || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \ + || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) # include #endif -#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ +/* AIX and OSF/1 5.1 declare getdomainname in , not in . + NonStop Kernel declares gethostname in , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ + || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ + && !defined __GLIBC__ +# include +#endif + +/* MSVC defines off_t in . + May also define off_t to a 64-bit type on native Windows. */ +#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@ +/* Get off_t. */ +# include +#endif + +#if (@GNULIB_READ@ || @GNULIB_WRITE@ \ + || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) /* Get ssize_t. */ # include @@ -94,9 +112,15 @@ /* Get getopt(), optarg, optind, opterr, optopt. But avoid namespace pollution on glibc systems. */ #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT +# define __need_getopt # include #endif +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_UNISTD_INLINE +# define _GL_UNISTD_INLINE _GL_INLINE +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -104,78 +128,77 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ -#if @GNULIB_GETHOSTNAME@ -/* Get all possible declarations of gethostname(). */ -# if @UNISTD_H_HAVE_WINSOCK2_H@ -# if !defined _GL_SYS_SOCKET_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef socket -# define socket socket_used_without_including_sys_socket_h -# undef connect -# define connect connect_used_without_including_sys_socket_h -# undef accept -# define accept accept_used_without_including_sys_socket_h -# undef bind -# define bind bind_used_without_including_sys_socket_h -# undef getpeername -# define getpeername getpeername_used_without_including_sys_socket_h -# undef getsockname -# define getsockname getsockname_used_without_including_sys_socket_h -# undef getsockopt -# define getsockopt getsockopt_used_without_including_sys_socket_h -# undef listen -# define listen listen_used_without_including_sys_socket_h -# undef recv -# define recv recv_used_without_including_sys_socket_h -# undef send -# define send send_used_without_including_sys_socket_h -# undef recvfrom -# define recvfrom recvfrom_used_without_including_sys_socket_h -# undef sendto -# define sendto sendto_used_without_including_sys_socket_h -# undef setsockopt -# define setsockopt setsockopt_used_without_including_sys_socket_h -# undef shutdown -# define shutdown shutdown_used_without_including_sys_socket_h -# else - _GL_WARN_ON_USE (socket, - "socket() used without including "); - _GL_WARN_ON_USE (connect, - "connect() used without including "); - _GL_WARN_ON_USE (accept, - "accept() used without including "); - _GL_WARN_ON_USE (bind, - "bind() used without including "); - _GL_WARN_ON_USE (getpeername, - "getpeername() used without including "); - _GL_WARN_ON_USE (getsockname, - "getsockname() used without including "); - _GL_WARN_ON_USE (getsockopt, - "getsockopt() used without including "); - _GL_WARN_ON_USE (listen, - "listen() used without including "); - _GL_WARN_ON_USE (recv, - "recv() used without including "); - _GL_WARN_ON_USE (send, - "send() used without including "); - _GL_WARN_ON_USE (recvfrom, - "recvfrom() used without including "); - _GL_WARN_ON_USE (sendto, - "sendto() used without including "); - _GL_WARN_ON_USE (setsockopt, - "setsockopt() used without including "); - _GL_WARN_ON_USE (shutdown, - "shutdown() used without including "); -# endif +/* Hide some function declarations from . */ + +#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ +# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef socket +# define socket socket_used_without_including_sys_socket_h +# undef connect +# define connect connect_used_without_including_sys_socket_h +# undef accept +# define accept accept_used_without_including_sys_socket_h +# undef bind +# define bind bind_used_without_including_sys_socket_h +# undef getpeername +# define getpeername getpeername_used_without_including_sys_socket_h +# undef getsockname +# define getsockname getsockname_used_without_including_sys_socket_h +# undef getsockopt +# define getsockopt getsockopt_used_without_including_sys_socket_h +# undef listen +# define listen listen_used_without_including_sys_socket_h +# undef recv +# define recv recv_used_without_including_sys_socket_h +# undef send +# define send send_used_without_including_sys_socket_h +# undef recvfrom +# define recvfrom recvfrom_used_without_including_sys_socket_h +# undef sendto +# define sendto sendto_used_without_including_sys_socket_h +# undef setsockopt +# define setsockopt setsockopt_used_without_including_sys_socket_h +# undef shutdown +# define shutdown shutdown_used_without_including_sys_socket_h +# else + _GL_WARN_ON_USE (socket, + "socket() used without including "); + _GL_WARN_ON_USE (connect, + "connect() used without including "); + _GL_WARN_ON_USE (accept, + "accept() used without including "); + _GL_WARN_ON_USE (bind, + "bind() used without including "); + _GL_WARN_ON_USE (getpeername, + "getpeername() used without including "); + _GL_WARN_ON_USE (getsockname, + "getsockname() used without including "); + _GL_WARN_ON_USE (getsockopt, + "getsockopt() used without including "); + _GL_WARN_ON_USE (listen, + "listen() used without including "); + _GL_WARN_ON_USE (recv, + "recv() used without including "); + _GL_WARN_ON_USE (send, + "send() used without including "); + _GL_WARN_ON_USE (recvfrom, + "recvfrom() used without including "); + _GL_WARN_ON_USE (sendto, + "sendto() used without including "); + _GL_WARN_ON_USE (setsockopt, + "setsockopt() used without including "); + _GL_WARN_ON_USE (shutdown, + "shutdown() used without including "); # endif -# if !defined _GL_SYS_SELECT_H -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef select -# define select select_used_without_including_sys_select_h -# else - _GL_WARN_ON_USE (select, - "select() used without including "); -# endif +# endif +# if !defined _@GUARD_PREFIX@_SYS_SELECT_H +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef select +# define select select_used_without_including_sys_select_h +# else + _GL_WARN_ON_USE (select, + "select() used without including "); # endif # endif #endif @@ -211,12 +234,24 @@ _GL_WARN_ON_USE (access, "the access function is a security risk - " #endif +#if @GNULIB_CHDIR@ +_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); +_GL_CXXALIASWARN (chdir); +#elif defined GNULIB_POSIXCHECK +# undef chdir +# if HAVE_RAW_DECL_CHDIR +_GL_WARN_ON_USE (chown, "chdir is not always in - " + "use gnulib module chdir for portability"); +# endif +#endif + + #if @GNULIB_CHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - . */ + See the POSIX:2008 specification + . */ + See the POSIX:2008 specification + . */ # if @REPLACE_DUP2@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dup2 rpl_dup2 @@ -355,7 +398,7 @@ extern char **environ; # endif #elif defined GNULIB_POSIXCHECK # if HAVE_RAW_DECL_ENVIRON -static inline char *** +_GL_UNISTD_INLINE char *** rpl_environ (void) { return &environ; @@ -413,8 +456,8 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " /* Change the process' current working directory to the directory on which the given file descriptor is open. Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - . */ + See the POSIX:2008 specification + . */ # if ! @HAVE_FCHDIR@ _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); @@ -425,6 +468,10 @@ _GL_EXTERN_C void _gl_unregister_fd (int fd); _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); _GL_EXTERN_C const char *_gl_directory_name (int fd); +# else +# if !@HAVE_DECL_FCHDIR@ +_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); +# endif # endif _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); _GL_CXXALIASWARN (fchdir); @@ -467,11 +514,30 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " #endif -#if @GNULIB_FSYNC@ +#if @GNULIB_FDATASYNC@ /* Synchronize changes to a file. Return 0 if successful, otherwise -1 and errno set. - See POSIX:2001 specification - . */ + See POSIX:2008 specification + . */ +# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ +_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); +_GL_CXXALIASWARN (fdatasync); +#elif defined GNULIB_POSIXCHECK +# undef fdatasync +# if HAVE_RAW_DECL_FDATASYNC +_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " + "use gnulib module fdatasync for portability"); +# endif +#endif + + +#if @GNULIB_FSYNC@ +/* Synchronize changes, including metadata, to a file. + Return 0 if successful, otherwise -1 and errno set. + See POSIX:2008 specification + . */ # if !@HAVE_FSYNC@ _GL_FUNCDECL_SYS (fsync, int, (int fd)); # endif @@ -489,12 +555,21 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - " #if @GNULIB_FTRUNCATE@ /* Change the size of the file to which FD is opened to become equal to LENGTH. Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - . */ -# if !@HAVE_FTRUNCATE@ + See the POSIX:2008 specification + . */ +# if @REPLACE_FTRUNCATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ftruncate +# define ftruncate rpl_ftruncate +# endif +_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); +_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); +# else +# if !@HAVE_FTRUNCATE@ _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); -# endif +# endif _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); +# endif _GL_CXXALIASWARN (ftruncate); #elif defined GNULIB_POSIXCHECK # undef ftruncate @@ -510,8 +585,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " of BUF. Return BUF if successful, or NULL if the directory couldn't be determined or SIZE was too small. - See the POSIX:2001 specification - . + See the POSIX:2008 specification + . Additionally, the gnulib module 'getcwd' guarantees the following GNU extension: If BUF is NULL, an array is allocated with 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as @@ -548,13 +623,21 @@ _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " Null terminate it if the name is shorter than LEN. If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. Return 0 if successful, otherwise set errno and return -1. */ -# if !@HAVE_GETDOMAINNAME@ +# if @REPLACE_GETDOMAINNAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getdomainname +# define getdomainname rpl_getdomainname +# endif +_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); +# else +# if !@HAVE_DECL_GETDOMAINNAME@ _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); # endif -/* Need to cast, because on MacOS X 10.5 systems, the second parameter is - int len. */ -_GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len)); _GL_CXXALIASWARN (getdomainname); #elif defined GNULIB_POSIXCHECK # undef getdomainname @@ -632,7 +715,8 @@ _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) _GL_ARG_NONNULL ((1))); # endif -/* Need to cast, because on Solaris 10 systems, the second parameter is +/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second + parameter is int len. */ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); # endif @@ -689,13 +773,22 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ -# if !@HAVE_DECL_GETLOGIN_R@ +# if @REPLACE_GETLOGIN_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getlogin_r rpl_getlogin_r +# endif +_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); +# else +# if !@HAVE_DECL_GETLOGIN_R@ _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) _GL_ARG_NONNULL ((1))); -# endif +# endif /* Need to cast, because on Solaris 10 systems, the second argument is int size. */ _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); +# endif _GL_CXXALIASWARN (getlogin_r); #elif defined GNULIB_POSIXCHECK # undef getlogin_r @@ -762,11 +855,14 @@ _GL_CXXALIAS_RPL (getpagesize, int, (void)); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getpagesize() _gl_getpagesize () # else -static inline int +# if !GNULIB_defined_getpagesize_function +_GL_UNISTD_INLINE int getpagesize () { return _gl_getpagesize (); } +# define GNULIB_defined_getpagesize_function 1 +# endif # endif # endif # endif @@ -833,12 +929,49 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " #endif +#if @GNULIB_GROUP_MEMBER@ +/* Determine whether group id is in calling user's group list. */ +# if !@HAVE_GROUP_MEMBER@ +_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); +# endif +_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); +_GL_CXXALIASWARN (group_member); +#elif defined GNULIB_POSIXCHECK +# undef group_member +# if HAVE_RAW_DECL_GROUP_MEMBER +_GL_WARN_ON_USE (group_member, "group_member is unportable - " + "use gnulib module group-member for portability"); +# endif +#endif + + +#if @GNULIB_ISATTY@ +# if @REPLACE_ISATTY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef isatty +# define isatty rpl_isatty +# endif +_GL_FUNCDECL_RPL (isatty, int, (int fd)); +_GL_CXXALIAS_RPL (isatty, int, (int fd)); +# else +_GL_CXXALIAS_SYS (isatty, int, (int fd)); +# endif +_GL_CXXALIASWARN (isatty); +#elif defined GNULIB_POSIXCHECK +# undef isatty +# if HAVE_RAW_DECL_ISATTY +_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " + "use gnulib module isatty for portability"); +# endif +#endif + + #if @GNULIB_LCHOWN@ /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE to GID (if GID is not -1). Do not follow symbolic links. Return 0 if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - . */ + See the POSIX:2008 specification + . */ # if @REPLACE_LCHOWN@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lchown @@ -867,8 +1000,8 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " #if @GNULIB_LINK@ /* Create a new hard link for an existing file. Return 0 if successful, otherwise -1 and errno set. - See POSIX:2001 specification - . */ + See POSIX:2008 specification + . */ # if @REPLACE_LINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define link rpl_link @@ -933,8 +1066,8 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - " #if @GNULIB_LSEEK@ /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. Return the new offset if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - . */ + See the POSIX:2008 specification + . */ # if @REPLACE_LSEEK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lseek rpl_lseek @@ -954,6 +1087,24 @@ _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " #endif +#if @GNULIB_PIPE@ +/* Create a pipe, defaulting to O_BINARY mode. + Store the read-end as fd[0] and the write-end as fd[1]. + Return 0 upon success, or -1 with errno set upon failure. */ +# if !@HAVE_PIPE@ +_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); +_GL_CXXALIASWARN (pipe); +#elif defined GNULIB_POSIXCHECK +# undef pipe +# if HAVE_RAW_DECL_PIPE +_GL_WARN_ON_USE (pipe, "pipe is unportable - " + "use gnulib module pipe-posix for portability"); +# endif +#endif + + #if @GNULIB_PIPE2@ /* Create a pipe, applying the given flags when opening the read-end of the pipe and the write-end of the pipe. @@ -986,10 +1137,12 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " #if @GNULIB_PREAD@ /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. Return the number of bytes placed into BUF if successful, otherwise - set errno and return -1. 0 indicates EOF. See the POSIX:2001 - specification . */ + set errno and return -1. 0 indicates EOF. + See the POSIX:2008 specification + . */ # if @REPLACE_PREAD@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pread # define pread rpl_pread # endif _GL_FUNCDECL_RPL (pread, ssize_t, @@ -1020,10 +1173,11 @@ _GL_WARN_ON_USE (pread, "pread is unportable - " /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. Return the number of bytes written if successful, otherwise set errno and return -1. 0 indicates nothing written. See the - POSIX:2001 specification - . */ + POSIX:2008 specification + . */ # if @REPLACE_PWRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pwrite # define pwrite rpl_pwrite # endif _GL_FUNCDECL_RPL (pwrite, ssize_t, @@ -1050,12 +1204,34 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " #endif +#if @GNULIB_READ@ +/* Read up to COUNT bytes from file descriptor FD into the buffer starting + at BUF. See the POSIX:2008 specification + . */ +# if @REPLACE_READ@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef read +# define read rpl_read +# endif +_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); +# else +/* Need to cast, because on mingw, the third parameter is + unsigned int count + and the return type is 'int'. */ +_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); +# endif +_GL_CXXALIASWARN (read); +#endif + + #if @GNULIB_READLINK@ /* Read the contents of the symbolic link FILE and place the first BUFSIZE bytes of it into BUF. Return the number of bytes placed into BUF if successful, otherwise -1 and errno set. - See the POSIX:2001 specification - . */ + See the POSIX:2008 specification + . */ # if @REPLACE_READLINK@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define readlink rpl_readlink @@ -1123,11 +1299,38 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " #endif +#if @GNULIB_SETHOSTNAME@ +/* Set the host name of the machine. + The host name may or may not be fully qualified. + + Put LEN bytes of NAME into the host name. + Return 0 if successful, otherwise, set errno and return -1. + + Platforms with no ability to set the hostname return -1 and set + errno = ENOSYS. */ +# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ +_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) + _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 + and FreeBSD 6.4 the second parameter is int. On Solaris 11 + 2011-10, the first parameter is not const. */ +_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); +_GL_CXXALIASWARN (sethostname); +#elif defined GNULIB_POSIXCHECK +# undef sethostname +# if HAVE_RAW_DECL_SETHOSTNAME +_GL_WARN_ON_USE (sethostname, "sethostname is unportable - " + "use gnulib module sethostname for portability"); +# endif +#endif + + #if @GNULIB_SLEEP@ /* Pause the execution of the current thread for N seconds. Returns the number of seconds left to sleep. - See the POSIX:2001 specification - . */ + See the POSIX:2008 specification + . */ # if @REPLACE_SLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef sleep @@ -1208,7 +1411,7 @@ _GL_FUNCDECL_RPL (ttyname_r, int, _GL_CXXALIAS_RPL (ttyname_r, int, (int fd, char *buf, size_t buflen)); # else -# if !@HAVE_TTYNAME_R@ +# if !@HAVE_DECL_TTYNAME_R@ _GL_FUNCDECL_SYS (ttyname_r, int, (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); # endif @@ -1276,7 +1479,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " /* Pause the execution of the current thread for N microseconds. Returns 0 on completion, or -1 on range error. See the POSIX:2001 specification - . */ + . */ # if @REPLACE_USLEEP@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef usleep @@ -1302,9 +1505,9 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " #if @GNULIB_WRITE@ /* Write up to COUNT bytes starting at BUF to file descriptor FD. - See the POSIX:2001 specification - . */ -# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@ + See the POSIX:2008 specification + . */ +# if @REPLACE_WRITE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef write # define write rpl_write @@ -1321,6 +1524,7 @@ _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); _GL_CXXALIASWARN (write); #endif +_GL_INLINE_HEADER_END -#endif /* _GL_UNISTD_H */ -#endif /* _GL_UNISTD_H */ +#endif /* _@GUARD_PREFIX@_UNISTD_H */ +#endif /* _@GUARD_PREFIX@_UNISTD_H */ diff --git a/grub-core/gnulib/unitypes.in.h b/grub-core/gnulib/unitypes.in.h new file mode 100644 index 000000000..06eef05ce --- /dev/null +++ b/grub-core/gnulib/unitypes.in.h @@ -0,0 +1,46 @@ +/* Elementary types and macros for the GNU UniString library. + Copyright (C) 2002, 2005-2006, 2009-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _UNITYPES_H +#define _UNITYPES_H + +/* Get uint8_t, uint16_t, uint32_t. */ +#include + +/* Type representing a Unicode character. */ +typedef uint32_t ucs4_t; + +/* Attribute of a function whose result depends only on the arguments + (not pointers!) and which has no side effects. */ +#ifndef _UC_ATTRIBUTE_CONST +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _UC_ATTRIBUTE_CONST __attribute__ ((__const__)) +# else +# define _UC_ATTRIBUTE_CONST +# endif +#endif + +/* Attribute of a function whose result depends only on the arguments + (possibly pointers) and global memory, and which has no side effects. */ +#ifndef _UC_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _UC_ATTRIBUTE_PURE +# endif +#endif + +#endif /* _UNITYPES_H */ diff --git a/grub-core/gnulib/uniwidth.in.h b/grub-core/gnulib/uniwidth.in.h new file mode 100644 index 000000000..8931cc9b0 --- /dev/null +++ b/grub-core/gnulib/uniwidth.in.h @@ -0,0 +1,72 @@ +/* Display width functions. + Copyright (C) 2001-2002, 2005, 2007, 2009-2013 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _UNIWIDTH_H +#define _UNIWIDTH_H + +#include "unitypes.h" + +/* Get size_t. */ +#include + +/* Get locale_charset() declaration. */ +#include "localcharset.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Display width. */ + +/* These functions are locale dependent. The encoding argument identifies + the encoding (e.g. "ISO-8859-2" for Polish). */ + +/* Determine number of column positions required for UC. */ +extern int + uc_width (ucs4_t uc, const char *encoding) + _UC_ATTRIBUTE_PURE; + +/* Determine number of column positions required for first N units + (or fewer if S ends before this) in S. */ +extern int + u8_width (const uint8_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u16_width (const uint16_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u32_width (const uint32_t *s, size_t n, const char *encoding) + _UC_ATTRIBUTE_PURE; + +/* Determine number of column positions required for S. */ +extern int + u8_strwidth (const uint8_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u16_strwidth (const uint16_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; +extern int + u32_strwidth (const uint32_t *s, const char *encoding) + _UC_ATTRIBUTE_PURE; + + +#ifdef __cplusplus +} +#endif + +#endif /* _UNIWIDTH_H */ diff --git a/grub-core/gnulib/uniwidth/cjk.h b/grub-core/gnulib/uniwidth/cjk.h new file mode 100644 index 000000000..11b14dfec --- /dev/null +++ b/grub-core/gnulib/uniwidth/cjk.h @@ -0,0 +1,37 @@ +/* Test for CJK encoding. + Copyright (C) 2001-2002, 2005-2007, 2009-2013 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "streq.h" + +static int +is_cjk_encoding (const char *encoding) +{ + if (0 + /* Legacy Japanese encodings */ + || STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0) + /* Legacy Chinese encodings */ + || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0) + || STREQ_OPT (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0) + || STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0) + || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0) + /* Legacy Korean encodings */ + || STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) + || STREQ_OPT (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0) + || STREQ_OPT (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0)) + return 1; + return 0; +} diff --git a/grub-core/gnulib/uniwidth/width.c b/grub-core/gnulib/uniwidth/width.c new file mode 100644 index 000000000..173d0872c --- /dev/null +++ b/grub-core/gnulib/uniwidth/width.c @@ -0,0 +1,368 @@ +/* Determine display width of Unicode character. + Copyright (C) 2001-2002, 2006-2013 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "uniwidth.h" + +#include "cjk.h" + +/* + * Non-spacing attribute table. + * Consists of: + * - Non-spacing characters; generated from PropList.txt or + * "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt" + * - Format control characters; generated from + * "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt" + * - Zero width characters; generated from + * "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt" + */ +static const unsigned char nonspacing_table_data[27*64] = { + /* 0x0000-0x01ff */ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, /* 0x0080-0x00bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00c0-0x00ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0100-0x013f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0140-0x017f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0180-0x01bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x01c0-0x01ff */ + /* 0x0200-0x03ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0200-0x023f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0240-0x027f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0280-0x02bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x02c0-0x02ff */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x0300-0x033f */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x0340-0x037f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0380-0x03bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x03c0-0x03ff */ + /* 0x0400-0x05ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0400-0x043f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0440-0x047f */ + 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0480-0x04bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04c0-0x04ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0500-0x053f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0540-0x057f */ + 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, /* 0x0580-0x05bf */ + 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */ + /* 0x0600-0x07ff */ + 0x0f, 0x00, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */ + 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */ + 0x00, 0x00, 0xc0, 0xbf, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */ + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */ + 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */ + 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x07c0-0x07ff */ + /* 0x0800-0x09ff */ + 0x00, 0x00, 0xc0, 0xfb, 0xef, 0x3e, 0x00, 0x00, /* 0x0800-0x083f */ + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08c0-0x08ff */ + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, /* 0x0900-0x093f */ + 0xfe, 0x21, 0xfe, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */ + 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x09c0-0x09ff */ + /* 0x0a00-0x0bff */ + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a00-0x0a3f */ + 0x86, 0x39, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, /* 0x0a40-0x0a7f */ + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a80-0x0abf */ + 0xbe, 0x21, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0ac0-0x0aff */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0x0b00-0x0b3f */ + 0x1e, 0x20, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0b40-0x0b7f */ + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */ + 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */ + /* 0x0c00-0x0dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x0c00-0x0c3f */ + 0xc1, 0x3d, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */ + 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d00-0x0d3f */ + 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */ + 0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */ + /* 0x0e00-0x0fff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x07, /* 0x0e00-0x0e3f */ + 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0e40-0x0e7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1b, /* 0x0e80-0x0ebf */ + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */ + 0xdf, 0xe0, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */ + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */ + /* 0x1000-0x11ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xfd, 0x66, /* 0x1000-0x103f */ + 0x00, 0x00, 0x00, 0xc3, 0x01, 0x00, 0x1e, 0x00, /* 0x1040-0x107f */ + 0x64, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1140-0x117f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1180-0x11bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c0-0x11ff */ + /* 0x1200-0x13ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1200-0x123f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1240-0x127f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1280-0x12bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x12c0-0x12ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1300-0x133f */ + 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1380-0x13bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13c0-0x13ff */ + /* 0x1600-0x17ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1600-0x163f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1640-0x167f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1680-0x16bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16c0-0x16ff */ + 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, /* 0x1700-0x173f */ + 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1740-0x177f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */ + 0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */ + /* 0x1800-0x19ff */ + 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */ + 0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x04, 0x0e, /* 0x1900-0x193f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */ + /* 0x1a00-0x1bff */ + 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */ + 0x00, 0x00, 0x40, 0x7f, 0xe5, 0x1f, 0xf8, 0x9f, /* 0x1a40-0x1a7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1a80-0x1abf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ac0-0x1aff */ + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */ + 0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */ + 0x03, 0x00, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x00, /* 0x1b80-0x1bbf */ + 0x00, 0x00, 0x00, 0x00, 0x40, 0xa3, 0x03, 0x00, /* 0x1bc0-0x1bff */ + /* 0x1c00-0x1dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x00, /* 0x1c00-0x1c3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */ + 0x00, 0x00, 0xf7, 0xff, 0xfd, 0x21, 0x00, 0x00, /* 0x1cc0-0x1cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */ + 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, /* 0x1dc0-0x1dff */ + /* 0x2000-0x21ff */ + 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */ + 0x00, 0x00, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, /* 0x2040-0x207f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */ + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* 0x20c0-0x20ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2140-0x217f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2180-0x21bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x21c0-0x21ff */ + /* 0x2c00-0x2dff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c00-0x2c3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c40-0x2c7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c80-0x2cbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, /* 0x2cc0-0x2cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d00-0x2d3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x2d40-0x2d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d80-0x2dbf */ + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x2dc0-0x2dff */ + /* 0x3000-0x31ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, /* 0x3000-0x303f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */ + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3100-0x313f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3140-0x317f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3180-0x31bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */ + /* 0xa600-0xa7ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa600-0xa63f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x30, /* 0xa640-0xa67f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa680-0xa6bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0xa6c0-0xa6ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa700-0xa73f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa740-0xa77f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa780-0xa7bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa7c0-0xa7ff */ + /* 0xa800-0xa9ff */ + 0x44, 0x08, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0xa800-0xa83f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */ + 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, /* 0xa8c0-0xa8ff */ + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, /* 0xa900-0xa93f */ + 0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */ + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x13, /* 0xa980-0xa9bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */ + /* 0xaa00-0xabff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x66, 0x00, /* 0xaa00-0xaa3f */ + 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xaa40-0xaa7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0xc1, /* 0xaa80-0xaabf */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xaac0-0xaaff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab00-0xab3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab40-0xab7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab80-0xabbf */ + 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00, /* 0xabc0-0xabff */ + /* 0xfa00-0xfbff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa80-0xfabf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfac0-0xfaff */ + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0xfb00-0xfb3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb40-0xfb7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */ + /* 0xfe00-0xffff */ + 0xff, 0xff, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, /* 0xfe00-0xfe3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff00-0xff3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff40-0xff7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff80-0xffbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, /* 0xffc0-0xffff */ + /* 0x10000-0x101ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10000-0x1003f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10040-0x1007f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10080-0x100bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x100c0-0x100ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10100-0x1013f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10140-0x1017f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10180-0x101bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, /* 0x101c0-0x101ff */ + /* 0x10a00-0x10bff */ + 0x6e, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, /* 0x10a00-0x10a3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a40-0x10a7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a80-0x10abf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b00-0x10b3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */ + /* 0x11000-0x111ff */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11000-0x1103f */ + 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11040-0x1107f */ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x26, /* 0x11080-0x110bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x110c0-0x110ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11100-0x1113f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11140-0x1117f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11180-0x111bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */ + /* 0x1d000-0x1d1ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xf8, 0xff, /* 0x1d140-0x1d17f */ + 0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d1c0-0x1d1ff */ + /* 0x1d200-0x1d3ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d200-0x1d23f */ + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d240-0x1d27f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d280-0x1d2bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d2c0-0x1d2ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d300-0x1d33f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d340-0x1d37f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d380-0x1d3bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1d3c0-0x1d3ff */ +}; +static const signed char nonspacing_table_ind[240] = { + 0, 1, 2, 3, 4, 5, 6, 7, /* 0x0000-0x0fff */ + 8, 9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */ + 14, -1, -1, -1, -1, -1, 15, -1, /* 0x2000-0x2fff */ + 16, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */ + -1, -1, -1, 17, 18, 19, -1, -1, /* 0xa000-0xafff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xd000-0xdfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */ + -1, -1, -1, -1, -1, 20, -1, 21, /* 0xf000-0xffff */ + 22, -1, -1, -1, -1, 23, -1, -1, /* 0x10000-0x10fff */ + 24, -1, -1, -1, -1, -1, -1, -1, /* 0x11000-0x11fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x16000-0x16fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1b000-0x1bfff */ + -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */ + 25, 26, -1, -1, -1, -1, -1, -1 /* 0x1d000-0x1dfff */ +}; + +/* Determine number of column positions required for UC. */ +int +uc_width (ucs4_t uc, const char *encoding) +{ + /* Test for non-spacing or control character. */ + if ((uc >> 9) < 240) + { + int ind = nonspacing_table_ind[uc >> 9]; + if (ind >= 0) + if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1) + { + if (uc > 0 && uc < 0xa0) + return -1; + else + return 0; + } + } + else if ((uc >> 9) == (0xe0000 >> 9)) + { + if (uc >= 0xe0100) + { + if (uc <= 0xe01ef) + return 0; + } + else + { + if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001) + return 0; + } + } + /* Test for double-width character. + * Generated from "grep '^[^;]\{4,5\};[WF]' EastAsianWidth.txt" + * and "grep '^[^;]\{4,5\};[^WF]' EastAsianWidth.txt" + */ + if (uc >= 0x1100 + && ((uc < 0x1160) /* Hangul Jamo */ + || (uc >= 0x2329 && uc < 0x232b) /* Angle Brackets */ + || (uc >= 0x2e80 && uc < 0xa4d0 /* CJK ... Yi */ + && !(uc == 0x303f) && !(uc >= 0x4dc0 && uc < 0x4e00)) + || (uc >= 0xac00 && uc < 0xd7a4) /* Hangul Syllables */ + || (uc >= 0xf900 && uc < 0xfb00) /* CJK Compatibility Ideographs */ + || (uc >= 0xfe10 && uc < 0xfe20) /* Presentation Forms for Vertical */ + || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */ + || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */ + || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */ + || (uc >= 0x20000 && uc <= 0x2ffff) /* Supplementary Ideographic Plane */ + || (uc >= 0x30000 && uc <= 0x3ffff) /* Tertiary Ideographic Plane */ + ) ) + return 2; + /* In ancient CJK encodings, Cyrillic and most other characters are + double-width as well. */ + if (uc >= 0x00A1 && uc < 0xFF61 && uc != 0x20A9 + && is_cjk_encoding (encoding)) + return 2; + return 1; +} diff --git a/grub-core/gnulib/vasnprintf.c b/grub-core/gnulib/vasnprintf.c index e618901ba..8fdab32ea 100644 --- a/grub-core/gnulib/vasnprintf.c +++ b/grub-core/gnulib/vasnprintf.c @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2010 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ /* This file can be parametrized with the following macros: VASNPRINTF The name of the function being defined. @@ -88,6 +87,8 @@ /* Checked size_t computations. */ #include "xsize.h" +#include "verify.h" + #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL # include # include "float+.h" @@ -274,10 +275,10 @@ decimal_point_char (void) { const char *point; /* Determine it in a multithread-safe way. We know nl_langinfo is - multithread-safe on glibc systems and MacOS X systems, but is not required + multithread-safe on glibc systems and Mac OS X systems, but is not required to be multithread-safe by POSIX. sprintf(), however, is multithread-safe. localeconv() is rarely multithread-safe. */ -# if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined __MACH__)) +# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__)) point = nl_langinfo (RADIXCHAR); # elif 1 char pointbuf[5]; @@ -322,11 +323,11 @@ is_infinite_or_zerol (long double x) typedef unsigned int mp_limb_t; # define GMP_LIMB_BITS 32 -typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS) - 1]; +verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS); typedef unsigned long long mp_twolimb_t; # define GMP_TWOLIMB_BITS 64 -typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS) - 1]; +verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS); /* Representation of a bignum >= 0. */ typedef struct @@ -551,32 +552,61 @@ divide (mpn_t a, mpn_t b, mpn_t *q) size_t s; { mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ - s = 31; - if (msd >= 0x10000) + /* Determine s = GMP_LIMB_BITS - integer_length (msd). + Code copied from gnulib's integer_length.c. */ +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + s = __builtin_clz (msd); +# else +# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT + if (GMP_LIMB_BITS <= DBL_MANT_BIT) { - msd = msd >> 16; - s -= 16; + /* Use 'double' operations. + Assumes an IEEE 754 'double' implementation. */ +# define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7) +# define DBL_EXP_BIAS (DBL_EXP_MASK / 2 - 1) +# define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + union { double value; unsigned int word[NWORDS]; } m; + + /* Use a single integer to floating-point conversion. */ + m.value = msd; + + s = GMP_LIMB_BITS + - (((m.word[DBL_EXPBIT0_WORD] >> DBL_EXPBIT0_BIT) & DBL_EXP_MASK) + - DBL_EXP_BIAS); } - if (msd >= 0x100) + else +# undef NWORDS +# endif { - msd = msd >> 8; - s -= 8; - } - if (msd >= 0x10) - { - msd = msd >> 4; - s -= 4; - } - if (msd >= 0x4) - { - msd = msd >> 2; - s -= 2; - } - if (msd >= 0x2) - { - msd = msd >> 1; - s -= 1; + s = 31; + if (msd >= 0x10000) + { + msd = msd >> 16; + s -= 16; + } + if (msd >= 0x100) + { + msd = msd >> 8; + s -= 8; + } + if (msd >= 0x10) + { + msd = msd >> 4; + s -= 4; + } + if (msd >= 0x4) + { + msd = msd >> 2; + s -= 2; + } + if (msd >= 0x2) + { + msd = msd >> 1; + s -= 1; + } } +# endif } /* 0 <= s < GMP_LIMB_BITS. Copy b, shifting it left by s bits. */ @@ -883,9 +913,9 @@ decode_long_double (long double x, int *ep, mpn_t *mp) y = frexpl (x, &exp); if (!(y >= 0.0L && y < 1.0L)) abort (); - /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the + /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the latter is an integer. */ - /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs. + /* Convert the mantissa (y * 2^LDBL_MANT_BIT) to a sequence of limbs. I'm not sure whether it's safe to cast a 'long double' value between 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', @@ -933,11 +963,11 @@ decode_long_double (long double x, int *ep, mpn_t *mp) abort (); m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; } -#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess - precision. */ +# if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess + precision. */ if (!(y == 0.0L)) abort (); -#endif +# endif /* Normalise. */ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) m.nlimbs--; @@ -971,9 +1001,9 @@ decode_double (double x, int *ep, mpn_t *mp) y = frexp (x, &exp); if (!(y >= 0.0 && y < 1.0)) abort (); - /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the + /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * 2^DBL_MANT_BIT), and the latter is an integer. */ - /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs. + /* Convert the mantissa (y * 2^DBL_MANT_BIT) to a sequence of limbs. I'm not sure whether it's safe to cast a 'double' value between 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 'double' values between 0 and 2^16 (to 'unsigned int' or 'int', @@ -1500,7 +1530,7 @@ is_borderline (const char *digits, size_t precision) /* Returns the number of TCHAR_T units needed as temporary space for the result of sprintf or SNPRINTF of a single conversion directive. */ -static inline size_t +static size_t MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, arg_type type, int flags, size_t width, int has_precision, size_t precision, int pad_ourselves) @@ -1751,8 +1781,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, return NULL; #define CLEANUP() \ - free (d.dir); \ - if (a.arg) \ + if (d.dir != d.direct_alloc_dir) \ + free (d.dir); \ + if (a.arg != a.direct_alloc_arg) \ free (a.arg); if (PRINTF_FETCHARGS (args, &a) < 0) @@ -2621,7 +2652,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, size_t characters; # if !DCHAR_IS_TCHAR /* This code assumes that TCHAR_T is 'char'. */ - typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1]; + verify (sizeof (TCHAR_T) == 1); TCHAR_T *tmpsrc; DCHAR_T *tmpdst; size_t tmpdst_len; @@ -2782,7 +2813,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, if (has_width) { # if ENABLE_UNISTDIO - /* Outside POSIX, it's preferrable to compare the width + /* Outside POSIX, it's preferable to compare the width against the number of _characters_ of the converted value. */ w = DCHAR_MBSNLEN (result + length, characters); @@ -4597,6 +4628,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, TCHAR_T *fbp; unsigned int prefix_count; int prefixes[2] IF_LINT (= { 0 }); + int orig_errno; #if !USE_SNPRINTF size_t tmp_length; TCHAR_T tmpbuf[700]; @@ -4751,6 +4783,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, *fbp++ = ' '; if (flags & FLAG_ALT) *fbp++ = '#'; +#if __GLIBC__ >= 2 && !defined __UCLIBC__ + if (flags & FLAG_LOCALIZED) + *fbp++ = 'I'; +#endif if (!pad_ourselves) { if (flags & FLAG_ZERO) @@ -4834,20 +4870,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #endif *fbp = dp->conversion; #if USE_SNPRINTF -# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) +# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) fbp[1] = '%'; fbp[2] = 'n'; fbp[3] = '\0'; # else /* On glibc2 systems from glibc >= 2.3 - probably also older - ones - we know that snprintf's returns value conforms to - ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. + ones - we know that snprintf's return value conforms to + ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 and + gl_SNPRINTF_TRUNCATION_C99 pass. Therefore we can avoid using %n in this situation. On glibc2 systems from 2004-10-18 or newer, the use of %n in format strings in writable memory may crash the program (if compiled with _FORTIFY_SOURCE=2), so we should avoid it in this situation. */ - /* On native Win32 systems (such as mingw), we can avoid using + /* On native Windows systems (such as mingw), we can avoid using %n because: - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, snprintf does not write more than the specified number @@ -4856,7 +4893,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf allows us to recognize the case of an insufficient buffer size: it returns -1 in this case. - On native Win32 systems (such as mingw) where the OS is + On native Windows systems (such as mingw) where the OS is Windows Vista, the use of %n in format strings by default crashes the program. See and @@ -4900,6 +4937,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, *(TCHAR_T *) (result + length) = '\0'; #endif + orig_errno = errno; + for (;;) { int count = -1; @@ -5284,8 +5323,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, DCHAR_T *tmpdst; size_t tmpdst_len; /* This code assumes that TCHAR_T is 'char'. */ - typedef int TCHAR_T_verify - [2 * (sizeof (TCHAR_T) == 1) - 1]; + verify (sizeof (TCHAR_T) == 1); # if USE_SNPRINTF tmpsrc = (TCHAR_T *) (result + length); # else @@ -5378,7 +5416,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { size_t w; # if ENABLE_UNISTDIO - /* Outside POSIX, it's preferrable to compare the width + /* Outside POSIX, it's preferable to compare the width against the number of _characters_ of the converted value. */ w = DCHAR_MBSNLEN (result + length, count); @@ -5498,6 +5536,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, length += count; break; } + errno = orig_errno; #undef pad_ourselves #undef prec_ourselves } diff --git a/grub-core/gnulib/vasnprintf.h b/grub-core/gnulib/vasnprintf.h index a689bad25..7658f505e 100644 --- a/grub-core/gnulib/vasnprintf.h +++ b/grub-core/gnulib/vasnprintf.h @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ #ifndef _VASNPRINTF_H #define _VASNPRINTF_H @@ -24,16 +23,16 @@ /* Get size_t. */ #include -#ifndef __attribute__ /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. - We enable __attribute__ only if these are supported too, because + We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __attribute__(Spec) /* empty */ -# endif +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif #ifdef __cplusplus @@ -69,9 +68,9 @@ extern "C" { # define vasnprintf rpl_vasnprintf #endif extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 3, 0))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0)); #ifdef __cplusplus } diff --git a/grub-core/gnulib/verify.h b/grub-core/gnulib/verify.h index 4ad780c8f..cb8e90b54 100644 --- a/grub-core/gnulib/verify.h +++ b/grub-core/gnulib/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,21 +17,39 @@ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ -#ifndef VERIFY_H -# define VERIFY_H 1 +#ifndef _GL_VERIFY_H +# define _GL_VERIFY_H + + +/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11. + This is supported by GCC 4.6.0 and later, in C mode, and its use + here generates easier-to-read diagnostics when verify (R) fails. + + Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11. + This will likely be supported by future GCC versions, in C++ mode. + + Use this only with GCC. If we were willing to slow 'configure' + down we could also use it with other compilers, but since this + affects only the quality of diagnostics, why bother? */ +# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus +# define _GL_HAVE__STATIC_ASSERT 1 +# endif +/* The condition (99 < __GNUC__) is temporary, until we know about the + first G++ release that supports static_assert. */ +# if (99 < __GNUC__) && defined __cplusplus +# define _GL_HAVE_STATIC_ASSERT 1 +# endif /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. - There are two macros, since no single macro can be used in all - contexts in C. verify_true (R) is for scalar contexts, including - integer constant expression contexts. verify (R) is for declaration - contexts, e.g., the top level. + If _Static_assert works, verify (R) uses it directly. Similarly, + _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct + that is an operand of sizeof. - Symbols ending in "__" are private to this header. - - The code below uses several ideas. + The code below uses several ideas for C++ compilers, and for C + compilers that do not support _Static_assert: * The first step is ((R) ? 1 : -1). Given an expression R, of integral or boolean or floating-point type, this yields an @@ -39,7 +57,9 @@ constant and nonnegative. * Next this expression W is wrapped in a type - struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: W; + }. If W is negative, this yields a compile-time error. No compiler can deal with a bit-field of negative size. @@ -53,7 +73,7 @@ void function (int n) { verify (n < 0); } - * For the verify macro, the struct verify_type__ will need to + * For the verify macro, the struct _gl_verify_type will need to somehow be embedded into a declaration. To be portable, this declaration must declare an object, a constant, a function, or a typedef name. If the declared entity uses the type directly, @@ -91,11 +111,11 @@ Which of the following alternatives can be used? extern int dummy [sizeof (struct {...})]; - extern int dummy [sizeof (struct verify_type__ {...})]; + extern int dummy [sizeof (struct _gl_verify_type {...})]; extern void dummy (int [sizeof (struct {...})]); - extern void dummy (int [sizeof (struct verify_type__ {...})]); + extern void dummy (int [sizeof (struct _gl_verify_type {...})]); extern int (*dummy (void)) [sizeof (struct {...})]; - extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; + extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; In the second and sixth case, the struct type is exported to the outer scope; two such declarations therefore collide. GCC warns @@ -105,19 +125,17 @@ extern int (*dummy (void)) [sizeof (struct {...})]; * GCC warns about duplicate declarations of the dummy function if - -Wredundant_decls is used. GCC 4.3 and later have a builtin + -Wredundant-decls is used. GCC 4.3 and later have a builtin __COUNTER__ macro that can let us generate unique identifiers for each dummy function, to suppress this warning. - * This implementation exploits the fact that GCC does not warn about - the last declaration mentioned above. If a future version of GCC - introduces a warning for this, the problem could be worked around - by using code specialized to GCC, just as __COUNTER__ is already - being used if available. + * This implementation exploits the fact that older versions of GCC, + which do not support _Static_assert, also do not warn about the + last declaration mentioned above. - #if 4 <= __GNUC__ - # define verify(R) [another version to keep GCC happy] - #endif + * GCC warns if -Wnested-externs is enabled and verify() is used + within a function body; but inside a function, you can always + arrange to use verify_expr() instead. * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ @@ -140,24 +158,88 @@ possible. */ # define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) -/* Verify requirement R at compile-time, as an integer constant expression. - Return 1. */ +/* Verify requirement R at compile-time, as an integer constant expression + that returns 1. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. */ + +# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ + (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) # ifdef __cplusplus +# if !GNULIB_defined_struct__gl_verify_type template - struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; -# define verify_true(R) \ - (!!sizeof (verify_type__<(R) ? 1 : -1>)) + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: w; + }; +# define GNULIB_defined_struct__gl_verify_type 1 +# endif +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + _gl_verify_type<(R) ? 1 : -1> +# elif defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { \ + _Static_assert (R, DIAGNOSTIC); \ + int _gl_dummy; \ + } # else -# define verify_true(R) \ - (!!sizeof \ - (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } # endif +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. + + Unfortunately, unlike C11, this implementation must appear as an + ordinary declaration, and cannot appear inside struct { ... }. */ + +# ifdef _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY _Static_assert +# else +# define _GL_VERIFY(R, DIAGNOSTIC) \ + extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ + [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] +# endif + +/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ +# ifdef _GL_STATIC_ASSERT_H +# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert +# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) +# endif +# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert +# define static_assert _Static_assert /* C11 requires this #define. */ +# endif +# endif + +/* @assert.h omit start@ */ + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. */ + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. This is equivalent to verify_expr (R, 1). + + verify_true is obsolescent; please use verify_expr instead. */ + +# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") + +/* Verify requirement R at compile-time. Return the value of the + expression E. */ + +# define verify_expr(R, E) \ + (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) + /* Verify requirement R at compile-time, as a declaration without a trailing ';'. */ -# define verify(R) \ - extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] +# define verify(R) _GL_VERIFY (R, "verify (" #R ")") + +/* @assert.h omit end@ */ #endif diff --git a/grub-core/gnulib/vsnprintf.c b/grub-core/gnulib/vsnprintf.c index d447cc2d5..7d4dfbed9 100644 --- a/grub-core/gnulib/vsnprintf.c +++ b/grub-core/gnulib/vsnprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2013 Free Software Foundation, Inc. Written by Simon Josefsson and Yoann Vandoorselaere . This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ #ifdef HAVE_CONFIG_H # include diff --git a/grub-core/gnulib/wchar.in.h b/grub-core/gnulib/wchar.in.h index 88d47dbc0..b6e436279 100644 --- a/grub-core/gnulib/wchar.in.h +++ b/grub-core/gnulib/wchar.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 , for platforms that have issues. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ /* Written by Eric Blake. */ @@ -29,6 +28,7 @@ #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ #if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H /* Special invocation convention: @@ -48,17 +48,25 @@ #else /* Normal invocation convention. */ -#ifndef _GL_WCHAR_H +#ifndef _@GUARD_PREFIX@_WCHAR_H #define _GL_ALREADY_INCLUDING_WCHAR_H +#if @HAVE_FEATURES_H@ +# include /* for __GLIBC__ */ +#endif + /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.0.1 has a bug: , and must be included before . + In some builds of uClibc, is nonexistent and wchar_t is defined + by . But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include +#endif +#ifndef __GLIBC__ # include # include #endif @@ -72,8 +80,16 @@ #undef _GL_ALREADY_INCLUDING_WCHAR_H -#ifndef _GL_WCHAR_H -#define _GL_WCHAR_H +#ifndef _@GUARD_PREFIX@_WCHAR_H +#define _@GUARD_PREFIX@_WCHAR_H + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -89,6 +105,18 @@ # define WEOF -1 # endif #else +/* MSVC defines wint_t as 'unsigned short' in . + This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be + "unchanged by default argument promotions". Override it. */ +# if defined _MSC_VER +# if !GNULIB_defined_wint_t +# include +typedef unsigned int rpl_wint_t; +# undef wint_t +# define wint_t rpl_wint_t +# define GNULIB_defined_wint_t 1 +# endif +# endif # ifndef WEOF # define WEOF ((wint_t) -1) # endif @@ -99,10 +127,12 @@ On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for implementing mbrtowc for encodings like UTF-8. */ #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ +# if !GNULIB_defined_mbstate_t typedef int rpl_mbstate_t; -# undef mbstate_t -# define mbstate_t rpl_mbstate_t -# define GNULIB_defined_mbstate_t 1 +# undef mbstate_t +# define mbstate_t rpl_mbstate_t +# define GNULIB_defined_mbstate_t 1 +# endif #endif @@ -113,11 +143,11 @@ typedef int rpl_mbstate_t; # undef btowc # define btowc rpl_btowc # endif -_GL_FUNCDECL_RPL (btowc, wint_t, (int c)); +_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (btowc, wint_t, (int c)); # else # if !@HAVE_BTOWC@ -_GL_FUNCDECL_SYS (btowc, wint_t, (int c)); +_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (btowc, wint_t, (int c)); # endif @@ -138,12 +168,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - " # undef wctob # define wctob rpl_wctob # endif -_GL_FUNCDECL_RPL (wctob, int, (wint_t wc)); +_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); # else # if !defined wctob && !@HAVE_DECL_WCTOB@ /* wctob is provided by gnulib, or wctob exists but is not declared. */ -_GL_FUNCDECL_SYS (wctob, int, (wint_t wc)); +_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); # endif @@ -404,12 +434,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " # undef wcwidth # define wcwidth rpl_wcwidth # endif -_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t)); +_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); # else # if !@HAVE_DECL_WCWIDTH@ /* wcwidth exists but is not declared. */ -_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t)); +_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); # endif _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); # endif @@ -423,6 +453,576 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " #endif -#endif /* _GL_WCHAR_H */ -#endif /* _GL_WCHAR_H */ +/* Search N wide characters of S for C. */ +#if @GNULIB_WMEMCHR@ +# if !@HAVE_WMEMCHR@ +_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) + _GL_ATTRIBUTE_PURE); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t); + wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wmemchr, + wchar_t *, (const wchar_t *, wchar_t, size_t), + const wchar_t *, (const wchar_t *, wchar_t, size_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, + (const wchar_t *s, wchar_t c, size_t n)); +# else +_GL_CXXALIASWARN (wmemchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wmemchr +# if HAVE_RAW_DECL_WMEMCHR +_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " + "use gnulib module wmemchr for portability"); +# endif +#endif + + +/* Compare N wide characters of S1 and S2. */ +#if @GNULIB_WMEMCMP@ +# if !@HAVE_WMEMCMP@ +_GL_FUNCDECL_SYS (wmemcmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wmemcmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +_GL_CXXALIASWARN (wmemcmp); +#elif defined GNULIB_POSIXCHECK +# undef wmemcmp +# if HAVE_RAW_DECL_WMEMCMP +_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " + "use gnulib module wmemcmp for portability"); +# endif +#endif + + +/* Copy N wide characters of SRC to DEST. */ +#if @GNULIB_WMEMCPY@ +# if !@HAVE_WMEMCPY@ +_GL_FUNCDECL_SYS (wmemcpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wmemcpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wmemcpy); +#elif defined GNULIB_POSIXCHECK +# undef wmemcpy +# if HAVE_RAW_DECL_WMEMCPY +_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " + "use gnulib module wmemcpy for portability"); +# endif +#endif + + +/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for + overlapping memory areas. */ +#if @GNULIB_WMEMMOVE@ +# if !@HAVE_WMEMMOVE@ +_GL_FUNCDECL_SYS (wmemmove, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wmemmove, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wmemmove); +#elif defined GNULIB_POSIXCHECK +# undef wmemmove +# if HAVE_RAW_DECL_WMEMMOVE +_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " + "use gnulib module wmemmove for portability"); +# endif +#endif + + +/* Set N wide characters of S to C. */ +#if @GNULIB_WMEMSET@ +# if !@HAVE_WMEMSET@ +_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +# endif +_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); +_GL_CXXALIASWARN (wmemset); +#elif defined GNULIB_POSIXCHECK +# undef wmemset +# if HAVE_RAW_DECL_WMEMSET +_GL_WARN_ON_USE (wmemset, "wmemset is unportable - " + "use gnulib module wmemset for portability"); +# endif +#endif + + +/* Return the number of wide characters in S. */ +#if @GNULIB_WCSLEN@ +# if !@HAVE_WCSLEN@ +_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); +_GL_CXXALIASWARN (wcslen); +#elif defined GNULIB_POSIXCHECK +# undef wcslen +# if HAVE_RAW_DECL_WCSLEN +_GL_WARN_ON_USE (wcslen, "wcslen is unportable - " + "use gnulib module wcslen for portability"); +# endif +#endif + + +/* Return the number of wide characters in S, but at most MAXLEN. */ +#if @GNULIB_WCSNLEN@ +# if !@HAVE_WCSNLEN@ +_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); +_GL_CXXALIASWARN (wcsnlen); +#elif defined GNULIB_POSIXCHECK +# undef wcsnlen +# if HAVE_RAW_DECL_WCSNLEN +_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " + "use gnulib module wcsnlen for portability"); +# endif +#endif + + +/* Copy SRC to DEST. */ +#if @GNULIB_WCSCPY@ +# if !@HAVE_WCSCPY@ +_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +# endif +_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +_GL_CXXALIASWARN (wcscpy); +#elif defined GNULIB_POSIXCHECK +# undef wcscpy +# if HAVE_RAW_DECL_WCSCPY +_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " + "use gnulib module wcscpy for portability"); +# endif +#endif + + +/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ +#if @GNULIB_WCPCPY@ +# if !@HAVE_WCPCPY@ +_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +# endif +_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)); +_GL_CXXALIASWARN (wcpcpy); +#elif defined GNULIB_POSIXCHECK +# undef wcpcpy +# if HAVE_RAW_DECL_WCPCPY +_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " + "use gnulib module wcpcpy for portability"); +# endif +#endif + + +/* Copy no more than N wide characters of SRC to DEST. */ +#if @GNULIB_WCSNCPY@ +# if !@HAVE_WCSNCPY@ +_GL_FUNCDECL_SYS (wcsncpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcsncpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wcsncpy); +#elif defined GNULIB_POSIXCHECK +# undef wcsncpy +# if HAVE_RAW_DECL_WCSNCPY +_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " + "use gnulib module wcsncpy for portability"); +# endif +#endif + + +/* Copy no more than N characters of SRC to DEST, returning the address of + the last character written into DEST. */ +#if @GNULIB_WCPNCPY@ +# if !@HAVE_WCPNCPY@ +_GL_FUNCDECL_SYS (wcpncpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcpncpy, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wcpncpy); +#elif defined GNULIB_POSIXCHECK +# undef wcpncpy +# if HAVE_RAW_DECL_WCPNCPY +_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " + "use gnulib module wcpncpy for portability"); +# endif +#endif + + +/* Append SRC onto DEST. */ +#if @GNULIB_WCSCAT@ +# if !@HAVE_WCSCAT@ +_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); +# endif +_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)); +_GL_CXXALIASWARN (wcscat); +#elif defined GNULIB_POSIXCHECK +# undef wcscat +# if HAVE_RAW_DECL_WCSCAT +_GL_WARN_ON_USE (wcscat, "wcscat is unportable - " + "use gnulib module wcscat for portability"); +# endif +#endif + + +/* Append no more than N wide characters of SRC onto DEST. */ +#if @GNULIB_WCSNCAT@ +# if !@HAVE_WCSNCAT@ +_GL_FUNCDECL_SYS (wcsncat, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcsncat, wchar_t *, + (wchar_t *dest, const wchar_t *src, size_t n)); +_GL_CXXALIASWARN (wcsncat); +#elif defined GNULIB_POSIXCHECK +# undef wcsncat +# if HAVE_RAW_DECL_WCSNCAT +_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " + "use gnulib module wcsncat for portability"); +# endif +#endif + + +/* Compare S1 and S2. */ +#if @GNULIB_WCSCMP@ +# if !@HAVE_WCSCMP@ +_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); +_GL_CXXALIASWARN (wcscmp); +#elif defined GNULIB_POSIXCHECK +# undef wcscmp +# if HAVE_RAW_DECL_WCSCMP +_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " + "use gnulib module wcscmp for portability"); +# endif +#endif + + +/* Compare no more than N wide characters of S1 and S2. */ +#if @GNULIB_WCSNCMP@ +# if !@HAVE_WCSNCMP@ +_GL_FUNCDECL_SYS (wcsncmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcsncmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +_GL_CXXALIASWARN (wcsncmp); +#elif defined GNULIB_POSIXCHECK +# undef wcsncmp +# if HAVE_RAW_DECL_WCSNCMP +_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " + "use gnulib module wcsncmp for portability"); +# endif +#endif + + +/* Compare S1 and S2, ignoring case. */ +#if @GNULIB_WCSCASECMP@ +# if !@HAVE_WCSCASECMP@ +_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); +_GL_CXXALIASWARN (wcscasecmp); +#elif defined GNULIB_POSIXCHECK +# undef wcscasecmp +# if HAVE_RAW_DECL_WCSCASECMP +_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " + "use gnulib module wcscasecmp for portability"); +# endif +#endif + + +/* Compare no more than N chars of S1 and S2, ignoring case. */ +#if @GNULIB_WCSNCASECMP@ +# if !@HAVE_WCSNCASECMP@ +_GL_FUNCDECL_SYS (wcsncasecmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcsncasecmp, int, + (const wchar_t *s1, const wchar_t *s2, size_t n)); +_GL_CXXALIASWARN (wcsncasecmp); +#elif defined GNULIB_POSIXCHECK +# undef wcsncasecmp +# if HAVE_RAW_DECL_WCSNCASECMP +_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " + "use gnulib module wcsncasecmp for portability"); +# endif +#endif + + +/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE + category of the current locale. */ +#if @GNULIB_WCSCOLL@ +# if !@HAVE_WCSCOLL@ +_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); +# endif +_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); +_GL_CXXALIASWARN (wcscoll); +#elif defined GNULIB_POSIXCHECK +# undef wcscoll +# if HAVE_RAW_DECL_WCSCOLL +_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " + "use gnulib module wcscoll for portability"); +# endif +#endif + + +/* Transform S2 into array pointed to by S1 such that if wcscmp is applied + to two transformed strings the result is the as applying 'wcscoll' to the + original strings. */ +#if @GNULIB_WCSXFRM@ +# if !@HAVE_WCSXFRM@ +_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); +# endif +_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n)); +_GL_CXXALIASWARN (wcsxfrm); +#elif defined GNULIB_POSIXCHECK +# undef wcsxfrm +# if HAVE_RAW_DECL_WCSXFRM +_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " + "use gnulib module wcsxfrm for portability"); +# endif +#endif + + +/* Duplicate S, returning an identical malloc'd string. */ +#if @GNULIB_WCSDUP@ +# if !@HAVE_WCSDUP@ +_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s)); +# endif +_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s)); +_GL_CXXALIASWARN (wcsdup); +#elif defined GNULIB_POSIXCHECK +# undef wcsdup +# if HAVE_RAW_DECL_WCSDUP +_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " + "use gnulib module wcsdup for portability"); +# endif +#endif + + +/* Find the first occurrence of WC in WCS. */ +#if @GNULIB_WCSCHR@ +# if !@HAVE_WCSCHR@ +_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) + _GL_ATTRIBUTE_PURE); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcschr (const wchar_t *, wchar_t); + wchar_t * std::wcschr (wchar_t *, wchar_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcschr, + wchar_t *, (const wchar_t *, wchar_t), + const wchar_t *, (const wchar_t *, wchar_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); +_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); +# else +_GL_CXXALIASWARN (wcschr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcschr +# if HAVE_RAW_DECL_WCSCHR +_GL_WARN_ON_USE (wcschr, "wcschr is unportable - " + "use gnulib module wcschr for portability"); +# endif +#endif + + +/* Find the last occurrence of WC in WCS. */ +#if @GNULIB_WCSRCHR@ +# if !@HAVE_WCSRCHR@ +_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) + _GL_ATTRIBUTE_PURE); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcsrchr (const wchar_t *, wchar_t); + wchar_t * std::wcsrchr (wchar_t *, wchar_t); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcsrchr, + wchar_t *, (const wchar_t *, wchar_t), + const wchar_t *, (const wchar_t *, wchar_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); +_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); +# else +_GL_CXXALIASWARN (wcsrchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcsrchr +# if HAVE_RAW_DECL_WCSRCHR +_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " + "use gnulib module wcsrchr for portability"); +# endif +#endif + + +/* Return the length of the initial segmet of WCS which consists entirely + of wide characters not in REJECT. */ +#if @GNULIB_WCSCSPN@ +# if !@HAVE_WCSCSPN@ +_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); +_GL_CXXALIASWARN (wcscspn); +#elif defined GNULIB_POSIXCHECK +# undef wcscspn +# if HAVE_RAW_DECL_WCSCSPN +_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " + "use gnulib module wcscspn for portability"); +# endif +#endif + + +/* Return the length of the initial segmet of WCS which consists entirely + of wide characters in ACCEPT. */ +#if @GNULIB_WCSSPN@ +# if !@HAVE_WCSSPN@ +_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); +_GL_CXXALIASWARN (wcsspn); +#elif defined GNULIB_POSIXCHECK +# undef wcsspn +# if HAVE_RAW_DECL_WCSSPN +_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " + "use gnulib module wcsspn for portability"); +# endif +#endif + + +/* Find the first occurrence in WCS of any character in ACCEPT. */ +#if @GNULIB_WCSPBRK@ +# if !@HAVE_WCSPBRK@ +_GL_FUNCDECL_SYS (wcspbrk, wchar_t *, + (const wchar_t *wcs, const wchar_t *accept) + _GL_ATTRIBUTE_PURE); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *); + wchar_t * std::wcspbrk (wchar_t *, const wchar_t *); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcspbrk, + wchar_t *, (const wchar_t *, const wchar_t *), + const wchar_t *, (const wchar_t *, const wchar_t *)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcspbrk, wchar_t *, + (wchar_t *wcs, const wchar_t *accept)); +_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, + (const wchar_t *wcs, const wchar_t *accept)); +# else +_GL_CXXALIASWARN (wcspbrk); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcspbrk +# if HAVE_RAW_DECL_WCSPBRK +_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " + "use gnulib module wcspbrk for portability"); +# endif +#endif + + +/* Find the first occurrence of NEEDLE in HAYSTACK. */ +#if @GNULIB_WCSSTR@ +# if !@HAVE_WCSSTR@ +_GL_FUNCDECL_SYS (wcsstr, wchar_t *, + (const wchar_t *haystack, const wchar_t *needle) + _GL_ATTRIBUTE_PURE); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { + const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *); + wchar_t * std::wcsstr (wchar_t *, const wchar_t *); + } */ +_GL_CXXALIAS_SYS_CAST2 (wcsstr, + wchar_t *, (const wchar_t *, const wchar_t *), + const wchar_t *, (const wchar_t *, const wchar_t *)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (wcsstr, wchar_t *, + (wchar_t *haystack, const wchar_t *needle)); +_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, + (const wchar_t *haystack, const wchar_t *needle)); +# else +_GL_CXXALIASWARN (wcsstr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcsstr +# if HAVE_RAW_DECL_WCSSTR +_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " + "use gnulib module wcsstr for portability"); +# endif +#endif + + +/* Divide WCS into tokens separated by characters in DELIM. */ +#if @GNULIB_WCSTOK@ +# if !@HAVE_WCSTOK@ +_GL_FUNCDECL_SYS (wcstok, wchar_t *, + (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +# endif +_GL_CXXALIAS_SYS (wcstok, wchar_t *, + (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); +_GL_CXXALIASWARN (wcstok); +#elif defined GNULIB_POSIXCHECK +# undef wcstok +# if HAVE_RAW_DECL_WCSTOK +_GL_WARN_ON_USE (wcstok, "wcstok is unportable - " + "use gnulib module wcstok for portability"); +# endif +#endif + + +/* Determine number of column positions required for first N wide + characters (or fewer if S ends before this) in S. */ +#if @GNULIB_WCSWIDTH@ +# if @REPLACE_WCSWIDTH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wcswidth +# define wcswidth rpl_wcswidth +# endif +_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) + _GL_ATTRIBUTE_PURE); +_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); +# else +# if !@HAVE_WCSWIDTH@ +_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) + _GL_ATTRIBUTE_PURE); +# endif +_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); +# endif +_GL_CXXALIASWARN (wcswidth); +#elif defined GNULIB_POSIXCHECK +# undef wcswidth +# if HAVE_RAW_DECL_WCSWIDTH +_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " + "use gnulib module wcswidth for portability"); +# endif +#endif + + +#endif /* _@GUARD_PREFIX@_WCHAR_H */ +#endif /* _@GUARD_PREFIX@_WCHAR_H */ #endif diff --git a/grub-core/gnulib/wcrtomb.c b/grub-core/gnulib/wcrtomb.c index e7345f698..da42809bc 100644 --- a/grub-core/gnulib/wcrtomb.c +++ b/grub-core/gnulib/wcrtomb.c @@ -1,5 +1,5 @@ /* Convert wide character to multibyte character. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2013 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify diff --git a/grub-core/gnulib/wctype-h.c b/grub-core/gnulib/wctype-h.c new file mode 100644 index 000000000..bb5f847e3 --- /dev/null +++ b/grub-core/gnulib/wctype-h.c @@ -0,0 +1,4 @@ +/* Normally this would be wctype.c, but that name's already taken. */ +#include +#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE +#include "wctype.h" diff --git a/grub-core/gnulib/wctype.in.h b/grub-core/gnulib/wctype.in.h index 12c8975fe..0cd02d5a3 100644 --- a/grub-core/gnulib/wctype.in.h +++ b/grub-core/gnulib/wctype.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 , for platforms that lack it. - Copyright (C) 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2006-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ /* Written by Bruno Haible and Paul Eggert. */ @@ -26,11 +25,12 @@ * wctrans_t, and wctype_t are not yet implemented. */ -#ifndef _GL_WCTYPE_H +#ifndef _@GUARD_PREFIX@_WCTYPE_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif +@PRAGMA_COLUMNS@ #if @HAVE_WINT_T@ /* Solaris 2.5 has a bug: must be included before . @@ -51,13 +51,31 @@ # @INCLUDE_NEXT@ @NEXT_WCTYPE_H@ #endif -#ifndef _GL_WCTYPE_H -#define _GL_WCTYPE_H +#ifndef _@GUARD_PREFIX@_WCTYPE_H +#define _@GUARD_PREFIX@_WCTYPE_H + +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_WCTYPE_INLINE +# define _GL_WCTYPE_INLINE _GL_INLINE +#endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Solaris 2.6 includes which includes which + #defines a number of identifiers in the application namespace. Revert + these #defines. */ +#ifdef __sun +# undef multibyte +# undef eucw1 +# undef eucw2 +# undef eucw3 +# undef scrw1 +# undef scrw2 +# undef scrw3 +#endif + /* Define wint_t and WEOF. (Also done in wchar.in.h.) */ #if !@HAVE_WINT_T@ && !defined wint_t # define wint_t int @@ -65,153 +83,171 @@ # define WEOF -1 # endif #else +/* MSVC defines wint_t as 'unsigned short' in . + This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be + "unchanged by default argument promotions". Override it. */ +# if defined _MSC_VER +# if !GNULIB_defined_wint_t +# include +typedef unsigned int rpl_wint_t; +# undef wint_t +# define wint_t rpl_wint_t +# define GNULIB_defined_wint_t 1 +# endif +# endif # ifndef WEOF # define WEOF ((wint_t) -1) # endif #endif +#if !GNULIB_defined_wctype_functions + /* FreeBSD 4.4 to 4.11 has but lacks the functions. Linux libc5 has and the functions but they are broken. Assume all 11 functions (all isw* except iswblank) are implemented the same way, or not at all. */ -#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ +# if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ /* IRIX 5.3 has macros but no functions, its isw* macros refer to an undefined variable _ctmp_ and to macros like _P, and they refer to system functions like _iswctype that are not in the standard C library. Rather than try to get ancient buggy implementations like this to work, just disable them. */ -# undef iswalnum -# undef iswalpha -# undef iswblank -# undef iswcntrl -# undef iswdigit -# undef iswgraph -# undef iswlower -# undef iswprint -# undef iswpunct -# undef iswspace -# undef iswupper -# undef iswxdigit -# undef towlower -# undef towupper +# undef iswalnum +# undef iswalpha +# undef iswblank +# undef iswcntrl +# undef iswdigit +# undef iswgraph +# undef iswlower +# undef iswprint +# undef iswpunct +# undef iswspace +# undef iswupper +# undef iswxdigit +# undef towlower +# undef towupper /* Linux libc5 has and the functions but they are broken. */ -# if @REPLACE_ISWCNTRL@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define iswalnum rpl_iswalnum -# define iswalpha rpl_iswalpha -# define iswblank rpl_iswblank -# define iswcntrl rpl_iswcntrl -# define iswdigit rpl_iswdigit -# define iswgraph rpl_iswgraph -# define iswlower rpl_iswlower -# define iswprint rpl_iswprint -# define iswpunct rpl_iswpunct -# define iswspace rpl_iswspace -# define iswupper rpl_iswupper -# define iswxdigit rpl_iswxdigit -# define towlower rpl_towlower -# define towupper rpl_towupper +# if @REPLACE_ISWCNTRL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define iswalnum rpl_iswalnum +# define iswalpha rpl_iswalpha +# define iswblank rpl_iswblank +# define iswcntrl rpl_iswcntrl +# define iswdigit rpl_iswdigit +# define iswgraph rpl_iswgraph +# define iswlower rpl_iswlower +# define iswprint rpl_iswprint +# define iswpunct rpl_iswpunct +# define iswspace rpl_iswspace +# define iswupper rpl_iswupper +# define iswxdigit rpl_iswxdigit +# endif +# endif +# if @REPLACE_TOWLOWER@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define towlower rpl_towlower +# define towupper rpl_towupper +# endif # endif -# endif -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswalnum -# else +# else iswalnum -# endif +# endif (wint_t wc) { return ((wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')); } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswalpha -# else +# else iswalpha -# endif +# endif (wint_t wc) { return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswblank -# else +# else iswblank -# endif +# endif (wint_t wc) { return wc == ' ' || wc == '\t'; } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswcntrl -# else +# else iswcntrl -# endif +# endif (wint_t wc) { return (wc & ~0x1f) == 0 || wc == 0x7f; } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswdigit -# else +# else iswdigit -# endif +# endif (wint_t wc) { return wc >= '0' && wc <= '9'; } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswgraph -# else +# else iswgraph -# endif +# endif (wint_t wc) { return wc >= '!' && wc <= '~'; } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswlower -# else +# else iswlower -# endif +# endif (wint_t wc) { return wc >= 'a' && wc <= 'z'; } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswprint -# else +# else iswprint -# endif +# endif (wint_t wc) { return wc >= ' ' && wc <= '~'; } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswpunct -# else +# else iswpunct -# endif +# endif (wint_t wc) { return (wc >= '!' && wc <= '~' @@ -219,86 +255,78 @@ iswpunct || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))); } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswspace -# else +# else iswspace -# endif +# endif (wint_t wc) { return (wc == ' ' || wc == '\t' || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'); } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswupper -# else +# else iswupper -# endif +# endif (wint_t wc) { return wc >= 'A' && wc <= 'Z'; } -static inline int -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE int +# if @REPLACE_ISWCNTRL@ rpl_iswxdigit -# else +# else iswxdigit -# endif +# endif (wint_t wc) { return ((wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F')); } -static inline wint_t -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE wint_t +# if @REPLACE_TOWLOWER@ rpl_towlower -# else +# else towlower -# endif +# endif (wint_t wc) { return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); } -static inline wint_t -# if @REPLACE_ISWCNTRL@ +_GL_WCTYPE_INLINE wint_t +# if @REPLACE_TOWLOWER@ rpl_towupper -# else +# else towupper -# endif +# endif (wint_t wc) { return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); } -#elif ! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@ +# elif @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@) /* Only the iswblank function is missing. */ -# if @REPLACE_ISWBLANK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define iswblank rpl_iswblank +# if @REPLACE_ISWBLANK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define iswblank rpl_iswblank +# endif +_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); +# else +_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); # endif + # endif -static inline int -# if @REPLACE_ISWBLANK@ -rpl_iswblank -# else -iswblank -# endif - (wint_t wc) -{ - return wc == ' ' || wc == '\t'; -} - -#endif - -#if defined __MINGW32__ +# if defined __MINGW32__ /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. The functions towlower and towupper are implemented in the MSVCRT library @@ -313,30 +341,32 @@ iswblank result register. We need to fix this by adding a zero-extend from wchar_t to wint_t after the call. */ -static inline wint_t +_GL_WCTYPE_INLINE wint_t rpl_towlower (wint_t wc) { return (wint_t) (wchar_t) towlower (wc); } -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define towlower rpl_towlower -# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define towlower rpl_towlower +# endif -static inline wint_t +_GL_WCTYPE_INLINE wint_t rpl_towupper (wint_t wc) { return (wint_t) (wchar_t) towupper (wc); } -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define towupper rpl_towupper -# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define towupper rpl_towupper +# endif -#endif /* __MINGW32__ */ +# endif /* __MINGW32__ */ + +# define GNULIB_defined_wctype_functions 1 +#endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc)); _GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc)); -_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); _GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc)); _GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc)); _GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc)); @@ -349,11 +379,6 @@ _GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc)); #else _GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc)); _GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc)); -# if @REPLACE_ISWBLANK@ -_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); -# else -_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); -# endif _GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc)); _GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc)); _GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc)); @@ -366,7 +391,6 @@ _GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc)); #endif _GL_CXXALIASWARN (iswalnum); _GL_CXXALIASWARN (iswalpha); -_GL_CXXALIASWARN (iswblank); _GL_CXXALIASWARN (iswcntrl); _GL_CXXALIASWARN (iswdigit); _GL_CXXALIASWARN (iswgraph); @@ -377,7 +401,55 @@ _GL_CXXALIASWARN (iswspace); _GL_CXXALIASWARN (iswupper); _GL_CXXALIASWARN (iswxdigit); -#if @REPLACE_ISWCNTRL@ || defined __MINGW32__ +#if @GNULIB_ISWBLANK@ +# if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@ +_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc)); +# else +_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc)); +# endif +_GL_CXXALIASWARN (iswblank); +#endif + +#if !@HAVE_WCTYPE_T@ +# if !GNULIB_defined_wctype_t +typedef void * wctype_t; +# define GNULIB_defined_wctype_t 1 +# endif +#endif + +/* Get a descriptor for a wide character property. */ +#if @GNULIB_WCTYPE@ +# if !@HAVE_WCTYPE_T@ +_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name)); +# endif +_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); +_GL_CXXALIASWARN (wctype); +#elif defined GNULIB_POSIXCHECK +# undef wctype +# if HAVE_RAW_DECL_WCTYPE +_GL_WARN_ON_USE (wctype, "wctype is unportable - " + "use gnulib module wctype for portability"); +# endif +#endif + +/* Test whether a wide character has a given property. + The argument WC must be either a wchar_t value or WEOF. + The argument DESC must have been returned by the wctype() function. */ +#if @GNULIB_ISWCTYPE@ +# if !@HAVE_WCTYPE_T@ +_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); +# endif +_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); +_GL_CXXALIASWARN (iswctype); +#elif defined GNULIB_POSIXCHECK +# undef iswctype +# if HAVE_RAW_DECL_ISWCTYPE +_GL_WARN_ON_USE (iswctype, "iswctype is unportable - " + "use gnulib module iswctype for portability"); +# endif +#endif + +#if @REPLACE_TOWLOWER@ || defined __MINGW32__ _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc)); _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); #else @@ -387,6 +459,46 @@ _GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc)); _GL_CXXALIASWARN (towlower); _GL_CXXALIASWARN (towupper); +#if !@HAVE_WCTRANS_T@ +# if !GNULIB_defined_wctrans_t +typedef void * wctrans_t; +# define GNULIB_defined_wctrans_t 1 +# endif +#endif -#endif /* _GL_WCTYPE_H */ -#endif /* _GL_WCTYPE_H */ +/* Get a descriptor for a wide character case conversion. */ +#if @GNULIB_WCTRANS@ +# if !@HAVE_WCTRANS_T@ +_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name)); +# endif +_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); +_GL_CXXALIASWARN (wctrans); +#elif defined GNULIB_POSIXCHECK +# undef wctrans +# if HAVE_RAW_DECL_WCTRANS +_GL_WARN_ON_USE (wctrans, "wctrans is unportable - " + "use gnulib module wctrans for portability"); +# endif +#endif + +/* Perform a given case conversion on a wide character. + The argument WC must be either a wchar_t value or WEOF. + The argument DESC must have been returned by the wctrans() function. */ +#if @GNULIB_TOWCTRANS@ +# if !@HAVE_WCTRANS_T@ +_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); +# endif +_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); +_GL_CXXALIASWARN (towctrans); +#elif defined GNULIB_POSIXCHECK +# undef towctrans +# if HAVE_RAW_DECL_TOWCTRANS +_GL_WARN_ON_USE (towctrans, "towctrans is unportable - " + "use gnulib module towctrans for portability"); +# endif +#endif + +_GL_INLINE_HEADER_END + +#endif /* _@GUARD_PREFIX@_WCTYPE_H */ +#endif /* _@GUARD_PREFIX@_WCTYPE_H */ diff --git a/grub-core/gnulib/wcwidth.c b/grub-core/gnulib/wcwidth.c new file mode 100644 index 000000000..253fcaa65 --- /dev/null +++ b/grub-core/gnulib/wcwidth.c @@ -0,0 +1,50 @@ +/* Determine the number of screen columns needed for a character. + Copyright (C) 2006-2007, 2010-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +/* Get iswprint. */ +#include + +#include "localcharset.h" +#include "streq.h" +#include "uniwidth.h" + +int +wcwidth (wchar_t wc) +#undef wcwidth +{ + /* In UTF-8 locales, use a Unicode aware width function. */ + const char *encoding = locale_charset (); + if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0 ,0)) + { + /* We assume that in a UTF-8 locale, a wide character is the same as a + Unicode character. */ + return uc_width (wc, encoding); + } + else + { + /* Otherwise, fall back to the system's wcwidth function. */ +#if HAVE_WCWIDTH + return wcwidth (wc); +#else + return wc == 0 ? 0 : iswprint (wc) ? 1 : -1; +#endif + } +} diff --git a/grub-core/gnulib/xsize.c b/grub-core/gnulib/xsize.c new file mode 100644 index 000000000..4b4914c2c --- /dev/null +++ b/grub-core/gnulib/xsize.c @@ -0,0 +1,3 @@ +#include +#define XSIZE_INLINE _GL_EXTERN_INLINE +#include "xsize.h" diff --git a/grub-core/gnulib/xsize.h b/grub-core/gnulib/xsize.h index fbd63290d..2922f3530 100644 --- a/grub-core/gnulib/xsize.h +++ b/grub-core/gnulib/xsize.h @@ -1,6 +1,6 @@ /* xsize.h -- Checked size_t computations. - Copyright (C) 2003, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2008-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see . */ #ifndef _XSIZE_H #define _XSIZE_H @@ -28,6 +27,11 @@ # include #endif +_GL_INLINE_HEADER_BEGIN +#ifndef XSIZE_INLINE +# define XSIZE_INLINE _GL_INLINE +#endif + /* The size of memory objects is often computed through expressions of type size_t. Example: void* p = malloc (header_size + n * element_size). @@ -49,7 +53,7 @@ ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) /* Sum of two sizes, with overflow check. */ -static inline size_t +XSIZE_INLINE size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif @@ -60,7 +64,7 @@ xsum (size_t size1, size_t size2) } /* Sum of three sizes, with overflow check. */ -static inline size_t +XSIZE_INLINE size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif @@ -70,7 +74,7 @@ xsum3 (size_t size1, size_t size2, size_t size3) } /* Sum of four sizes, with overflow check. */ -static inline size_t +XSIZE_INLINE size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif @@ -80,7 +84,7 @@ xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) } /* Maximum of two sizes, with overflow check. */ -static inline size_t +XSIZE_INLINE size_t #if __GNUC__ >= 3 __attribute__ ((__pure__)) #endif @@ -93,7 +97,7 @@ xmax (size_t size1, size_t size2) /* Multiplication of a count with an element size, with overflow check. The count must be >= 0 and the element size must be > 0. - This is a macro, not an inline function, so that it works correctly even + This is a macro, not a function, so that it works correctly even when N is of a wider type and N > SIZE_MAX. */ #define xtimes(N, ELSIZE) \ ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) @@ -105,4 +109,6 @@ xmax (size_t size1, size_t size2) #define size_in_bounds_p(SIZE) \ ((SIZE) != SIZE_MAX) +_GL_INLINE_HEADER_END + #endif /* _XSIZE_H */ diff --git a/grub-core/kern/emu/argp_common.c b/grub-core/kern/emu/argp_common.c index d6080ba25..e519b529e 100644 --- a/grub-core/kern/emu/argp_common.c +++ b/grub-core/kern/emu/argp_common.c @@ -18,6 +18,7 @@ */ #include +#include #define _GNU_SOURCE 1 #include diff --git a/grub-core/kern/emu/error.c b/grub-core/kern/emu/error.c new file mode 100644 index 000000000..559412afc --- /dev/null +++ b/grub-core/kern/emu/error.c @@ -0,0 +1,2 @@ +#include +#include "../../gnulib/error.c" diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c index 4a5eee094..31423326c 100644 --- a/grub-core/kern/emu/hostdisk.c +++ b/grub-core/kern/emu/hostdisk.c @@ -17,6 +17,8 @@ * along with GRUB. If not, see . */ +#include + #include #include #include diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c index 46bf5e8cb..0bb323281 100644 --- a/grub-core/kern/emu/hostfs.c +++ b/grub-core/kern/emu/hostfs.c @@ -16,6 +16,9 @@ * You should have received a copy of the GNU General Public License * along with GRUB. If not, see . */ + +#include + #define _BSD_SOURCE #include #include diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c index 0418aae64..4a8890516 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -16,6 +16,9 @@ * along with GRUB. If not, see . */ +#include +#include + #include #include #include diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h index 588e5899a..955295403 100644 --- a/grub-core/lib/posix_wrap/limits.h +++ b/grub-core/lib/posix_wrap/limits.h @@ -25,6 +25,7 @@ #define USHRT_MAX GRUB_USHRT_MAX #define UINT_MAX GRUB_UINT_MAX #define ULONG_MAX GRUB_ULONG_MAX +#define SIZE_MAX GRUB_SIZE_MAX #define SHRT_MAX GRUB_SHRT_MAX #define INT_MAX GRUB_INT_MAX diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h index 62a26728d..c88a96ee5 100644 --- a/grub-core/lib/posix_wrap/sys/types.h +++ b/grub-core/lib/posix_wrap/sys/types.h @@ -51,6 +51,8 @@ typedef grub_uint16_t u16; #define HAVE_BYTE_TYPEDEF 1 typedef grub_uint8_t byte; +typedef grub_addr_t uintptr_t; + #define SIZEOF_UNSIGNED_LONG GRUB_CPU_SIZEOF_LONG #define SIZEOF_UNSIGNED_INT 4 #define SIZEOF_UNSIGNED_LONG_LONG 8 diff --git a/include/grub/types.h b/include/grub/types.h index 7c56f400f..775e03ab8 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -90,6 +90,8 @@ typedef grub_uint64_t grub_addr_t; typedef grub_uint64_t grub_size_t; typedef grub_int64_t grub_ssize_t; +# define GRUB_SIZE_MAX 18446744073709551615UL + # if GRUB_CPU_SIZEOF_LONG == 8 # define PRIxGRUB_SIZE "lx" # define PRIxGRUB_ADDR "lx" @@ -106,6 +108,8 @@ typedef grub_uint32_t grub_addr_t; typedef grub_uint32_t grub_size_t; typedef grub_int32_t grub_ssize_t; +# define GRUB_SIZE_MAX 4294967295UL + # define PRIxGRUB_SIZE "x" # define PRIxGRUB_ADDR "x" # define PRIuGRUB_SIZE "u" diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4 index 301469b31..d4ad759fd 100644 --- a/m4/00gnulib.m4 +++ b/m4/00gnulib.m4 @@ -1,5 +1,5 @@ # 00gnulib.m4 serial 2 -dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/alloca.m4 b/m4/alloca.m4 index f3ee34380..270abd0cd 100644 --- a/m4/alloca.m4 +++ b/m4/alloca.m4 @@ -1,5 +1,5 @@ -# alloca.m4 serial 9 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation, +# alloca.m4 serial 14 +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2013 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,10 +7,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ALLOCA], [ - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - AC_REQUIRE([AC_FUNC_ALLOCA]) if test $ac_cv_func_alloca_works = no; then gl_PREREQ_ALLOCA @@ -40,8 +36,86 @@ AC_DEFUN([gl_FUNC_ALLOCA], ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) + AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) ]) # Prerequisites of lib/alloca.c. # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. AC_DEFUN([gl_PREREQ_ALLOCA], [:]) + +# This works around a bug in autoconf <= 2.68. +# See . + +m4_version_prereq([2.69], [] ,[ + +# This is taken from the following Autoconf patch: +# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 + +# _AC_LIBOBJ_ALLOCA +# ----------------- +# Set up the LIBOBJ replacement of 'alloca'. Well, not exactly +# AC_LIBOBJ since we actually set the output variable 'ALLOCA'. +# Nevertheless, for Automake, AC_LIBSOURCES it. +m4_define([_AC_LIBOBJ_ALLOCA], +[# The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. +AC_LIBSOURCES(alloca.c) +AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl +AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.]) + +AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray, +[AC_EGREP_CPP(webecray, +[#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif +], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + AC_CHECK_FUNC($ac_func, + [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, + [Define to one of '_getb67', 'GETB67', + 'getb67' for Cray-2 and Cray-YMP + systems. This function is required for + 'alloca.c' support on those systems.]) + break]) + done +fi + +AC_CACHE_CHECK([stack direction for C alloca], + [ac_cv_c_stack_direction], +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_INCLUDES_DEFAULT +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +}])], + [ac_cv_c_stack_direction=1], + [ac_cv_c_stack_direction=-1], + [ac_cv_c_stack_direction=0])]) +AH_VERBATIM([STACK_DIRECTION], +[/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +@%:@undef STACK_DIRECTION])dnl +AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) +])# _AC_LIBOBJ_ALLOCA +]) diff --git a/m4/argp.m4 b/m4/argp.m4 index d3ca5bacc..4445d8e6c 100644 --- a/m4/argp.m4 +++ b/m4/argp.m4 @@ -1,5 +1,5 @@ -# argp.m4 serial 11 -dnl Copyright (C) 2003-2010 Free Software Foundation, Inc. +# argp.m4 serial 14 +dnl Copyright (C) 2003-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,23 +9,15 @@ AC_DEFUN([gl_ARGP], AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt - dnl always. - gl_REPLACE_GETOPT - dnl Note: gl_REPLACE_GETOPT does AC_LIBOBJ([getopt]), AC_LIBOBJ([getopt1]). - AC_CHECK_DECL([program_invocation_name], - [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_NAME], [1], - [Define if program_invocation_name is declared])], - [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_NAME], [1], - [Define to 1 to add extern declaration of program_invocation_name to argp.h])], - [#include ]) - AC_CHECK_DECL([program_invocation_short_name], - [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME], [1], - [Define if program_invocation_short_name is declared])], - [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_SHORT_NAME], [1], - [Define to 1 to add extern declaration of program_invocation_short_name to argp.h])], - [#include ]) + AC_CHECK_DECLS([program_invocation_name], [], + [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_NAME], [1], + [Define to 1 to add extern declaration of program_invocation_name to argp.h])], + [[#include ]]) + AC_CHECK_DECLS([program_invocation_short_name], [], + [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_SHORT_NAME], [1], + [Define to 1 to add extern declaration of program_invocation_short_name to argp.h])], + [[#include ]]) # Check if program_invocation_name and program_invocation_short_name # are defined elsewhere. It is improbable that only one of them will @@ -63,3 +55,7 @@ AC_DEFUN([gl_ARGP], AC_CHECK_FUNCS_ONCE([flockfile funlockfile]) AC_CHECK_HEADERS_ONCE([features.h linewrap.h]) ]) + +dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt +dnl always. +AC_DEFUN([gl_REPLACE_GETOPT_ALWAYS], []) diff --git a/m4/asm-underscore.m4 b/m4/asm-underscore.m4 deleted file mode 100644 index 1736cc432..000000000 --- a/m4/asm-underscore.m4 +++ /dev/null @@ -1,48 +0,0 @@ -# asm-underscore.m4 serial 1 -dnl Copyright (C) 2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp. - -# gl_ASM_SYMBOL_PREFIX -# Tests for the prefix of C symbols at the assembly language level and the -# linker level. This prefix is either an underscore or empty. Defines the -# C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to -# a stringified variant of this prefix. - -AC_DEFUN([gl_ASM_SYMBOL_PREFIX], -[ - dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because - dnl 1. It works only for GCC. - dnl 2. It is incorrectly defined on some platforms, in some GCC versions. - AC_CACHE_CHECK( - [whether C symbols are prefixed with underscore at the linker level], - [gl_cv_prog_as_underscore], - [cat > conftest.c </dev/null 2>&1 - if grep _foo conftest.s >/dev/null ; then - gl_cv_prog_as_underscore=yes - else - gl_cv_prog_as_underscore=no - fi - rm -f conftest* - ]) - if test $gl_cv_prog_as_underscore = yes; then - USER_LABEL_PREFIX=_ - else - USER_LABEL_PREFIX= - fi - AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX], - [Define to the prefix of C symbols at the assembler and linker level, - either an underscore or empty.]) - ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' - AC_SUBST([ASM_SYMBOL_PREFIX]) -]) diff --git a/m4/btowc.m4 b/m4/btowc.m4 index b16b1f020..978a06e9a 100644 --- a/m4/btowc.m4 +++ b/m4/btowc.m4 @@ -1,5 +1,5 @@ -# btowc.m4 serial 7 -dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. +# btowc.m4 serial 10 +dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -28,8 +28,14 @@ AC_DEFUN([gl_FUNC_BTOWC], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ -#include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -69,8 +75,14 @@ changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include -#include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -96,11 +108,6 @@ int main () *) REPLACE_BTOWC=1 ;; esac fi - if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then - gl_REPLACE_WCHAR_H - AC_LIBOBJ([btowc]) - gl_PREREQ_BTOWC - fi ]) # Prerequisites of lib/btowc.c. diff --git a/m4/codeset.m4 b/m4/codeset.m4 index f722b2e86..c2761be2a 100644 --- a/m4/codeset.m4 +++ b/m4/codeset.m4 @@ -1,5 +1,5 @@ # codeset.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/configmake.m4 b/m4/configmake.m4 new file mode 100644 index 000000000..823ffc0dd --- /dev/null +++ b/m4/configmake.m4 @@ -0,0 +1,50 @@ +# configmake.m4 serial 1 +dnl Copyright (C) 2010-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# gl_CONFIGMAKE_PREP +# ------------------ +# Guarantee all of the standard directory variables, even when used with +# autoconf 2.59 (datarootdir wasn't supported until 2.59c) or automake +# 1.9.6 (pkglibexecdir wasn't supported until 1.10b.). +AC_DEFUN([gl_CONFIGMAKE_PREP], +[ + dnl Technically, datadir should default to datarootdir. But if + dnl autoconf is too old to provide datarootdir, then reversing the + dnl definition is a reasonable compromise. Only AC_SUBST a variable + dnl if it was not already defined earlier by autoconf. + if test "x$datarootdir" = x; then + AC_SUBST([datarootdir], ['${datadir}']) + fi + dnl Copy the approach used in autoconf 2.60. + if test "x$docdir" = x; then + AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])]) + fi + dnl The remaining variables missing from autoconf 2.59 are easier. + if test "x$htmldir" = x; then + AC_SUBST([htmldir], ['${docdir}']) + fi + if test "x$dvidir" = x; then + AC_SUBST([dvidir], ['${docdir}']) + fi + if test "x$pdfdir" = x; then + AC_SUBST([pdfdir], ['${docdir}']) + fi + if test "x$psdir" = x; then + AC_SUBST([psdir], ['${docdir}']) + fi + if test "x$lispdir" = x; then + AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp']) + fi + if test "x$localedir" = x; then + AC_SUBST([localedir], ['${datarootdir}/locale']) + fi + + dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely + dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe. + AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}']) +]) diff --git a/m4/dirname.m4 b/m4/dirname.m4 index 576b5bead..5897a2a8b 100644 --- a/m4/dirname.m4 +++ b/m4/dirname.m4 @@ -1,5 +1,5 @@ -#serial 8 -*- autoconf -*- -dnl Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc. +#serial 10 -*- autoconf -*- +dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,18 +7,11 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_DIRNAME], [ AC_REQUIRE([gl_DIRNAME_LGPL]) - AC_LIBOBJ([basename]) - AC_LIBOBJ([dirname]) ]) AC_DEFUN([gl_DIRNAME_LGPL], [ - AC_LIBOBJ([basename-lgpl]) - AC_LIBOBJ([dirname-lgpl]) - AC_LIBOBJ([stripslash]) - dnl Prerequisites of lib/dirname.h. - AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, diff --git a/m4/dos.m4 b/m4/dos.m4 deleted file mode 100644 index 5660542be..000000000 --- a/m4/dos.m4 +++ /dev/null @@ -1,71 +0,0 @@ -#serial 11 -*- autoconf -*- - -# Define some macros required for proper operation of code in lib/*.c -# on MSDOS/Windows systems. - -# Copyright (C) 2000-2001, 2004-2006, 2009-2010 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# From Jim Meyering. - -AC_DEFUN([gl_AC_DOS], - [ - AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos], - [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ -#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ -neither MSDOS nor Windows -#endif]])], - [ac_cv_win_or_dos=yes], - [ac_cv_win_or_dos=no]) - ]) - - if test x"$ac_cv_win_or_dos" = xyes; then - ac_fs_accepts_drive_letter_prefix=1 - ac_fs_backslash_is_file_name_separator=1 - AC_CACHE_CHECK([whether drive letter can start relative path], - [ac_cv_drive_letter_can_be_relative], - [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ -#if defined __CYGWIN__ -drive letters are always absolute -#endif]])], - [ac_cv_drive_letter_can_be_relative=yes], - [ac_cv_drive_letter_can_be_relative=no]) - ]) - if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then - ac_fs_drive_letter_can_be_relative=1 - else - ac_fs_drive_letter_can_be_relative=0 - fi - else - ac_fs_accepts_drive_letter_prefix=0 - ac_fs_backslash_is_file_name_separator=0 - ac_fs_drive_letter_can_be_relative=0 - fi - - AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX], - $ac_fs_accepts_drive_letter_prefix, - [Define on systems for which file names may have a so-called - `drive letter' prefix, define this to compute the length of that - prefix, including the colon.]) - - AH_VERBATIM(ISSLASH, - [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR -# define ISSLASH(C) ((C) == '/' || (C) == '\\') -#else -# define ISSLASH(C) ((C) == '/') -#endif]) - - AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR], - $ac_fs_backslash_is_file_name_separator, - [Define if the backslash character may also serve as a file name - component separator.]) - - AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE], - $ac_fs_drive_letter_can_be_relative, - [Define if a drive letter prefix denotes a relative path if it is - not followed by a file name component separator.]) - ]) diff --git a/m4/double-slash-root.m4 b/m4/double-slash-root.m4 index 66a79c0f2..bd6f86714 100644 --- a/m4/double-slash-root.m4 +++ b/m4/double-slash-root.m4 @@ -1,5 +1,5 @@ # double-slash-root.m4 serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/eealloc.m4 b/m4/eealloc.m4 new file mode 100644 index 000000000..c640ec129 --- /dev/null +++ b/m4/eealloc.m4 @@ -0,0 +1,31 @@ +# eealloc.m4 serial 3 +dnl Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_EEALLOC], +[ + AC_REQUIRE([gl_EEMALLOC]) + AC_REQUIRE([gl_EEREALLOC]) +]) + +AC_DEFUN([gl_EEMALLOC], +[ + _AC_FUNC_MALLOC_IF( + [gl_cv_func_malloc_0_nonnull=1], + [gl_cv_func_malloc_0_nonnull=0]) + AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull], + [If malloc(0) is != NULL, define this to 1. Otherwise define this + to 0.]) +]) + +AC_DEFUN([gl_EEREALLOC], +[ + _AC_FUNC_REALLOC_IF( + [gl_cv_func_realloc_0_nonnull=1], + [gl_cv_func_realloc_0_nonnull=0]) + AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull], + [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this + to 0.]) +]) diff --git a/m4/errno_h.m4 b/m4/errno_h.m4 index d02a03936..c813ea583 100644 --- a/m4/errno_h.m4 +++ b/m4/errno_h.m4 @@ -1,5 +1,5 @@ -# errno_h.m4 serial 6 -dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. +# errno_h.m4 serial 12 +dnl Copyright (C) 2004, 2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,6 +10,9 @@ AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ AC_EGREP_CPP([booboo],[ #include +#if !defined ETXTBSY +booboo +#endif #if !defined ENOMSG booboo #endif @@ -34,11 +37,29 @@ booboo #if !defined ENOTSUP booboo #endif +#if !defined ENETRESET +booboo +#endif +#if !defined ECONNABORTED +booboo +#endif #if !defined ESTALE booboo #endif +#if !defined EDQUOT +booboo +#endif #if !defined ECANCELED booboo +#endif +#if !defined EOWNERDEAD +booboo +#endif +#if !defined ENOTRECOVERABLE +booboo +#endif +#if !defined EILSEQ +booboo #endif ], [gl_cv_header_errno_h_complete=no], @@ -47,10 +68,11 @@ booboo if test $gl_cv_header_errno_h_complete = yes; then ERRNO_H='' else - gl_CHECK_NEXT_HEADERS([errno.h]) + gl_NEXT_HEADERS([errno.h]) ERRNO_H='errno.h' fi AC_SUBST([ERRNO_H]) + AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) gl_REPLACE_ERRNO_VALUE([ENOLINK]) gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) diff --git a/m4/error.m4 b/m4/error.m4 index dd5a197b6..29e6fdc9c 100644 --- a/m4/error.m4 +++ b/m4/error.m4 @@ -1,6 +1,6 @@ -#serial 13 +#serial 14 -# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc. +# Copyright (C) 1996-1998, 2001-2004, 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -8,16 +8,8 @@ AC_DEFUN([gl_ERROR], [ - AC_FUNC_ERROR_AT_LINE - dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). - gl_PREREQ_ERROR -]) - -# Redefine AC_FUNC_ERROR_AT_LINE, because it is no longer maintained in -# Autoconf. -AC_DEFUN([AC_FUNC_ERROR_AT_LINE], -[ - AC_LIBSOURCES([error.h, error.c])dnl + dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer + dnl maintained in Autoconf and because it invokes AC_LIBOBJ. AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -25,15 +17,11 @@ AC_DEFUN([AC_FUNC_ERROR_AT_LINE], [[error_at_line (0, 0, "", 0, "an error occurred");]])], [ac_cv_lib_error_at_line=yes], [ac_cv_lib_error_at_line=no])]) - if test $ac_cv_lib_error_at_line = no; then - AC_LIBOBJ([error]) - fi ]) # Prerequisites of lib/error.c. AC_DEFUN([gl_PREREQ_ERROR], [ AC_REQUIRE([AC_FUNC_STRERROR_R]) - AC_REQUIRE([AC_C_INLINE]) : ]) diff --git a/m4/exponentd.m4 b/m4/exponentd.m4 new file mode 100644 index 000000000..09df468c9 --- /dev/null +++ b/m4/exponentd.m4 @@ -0,0 +1,116 @@ +# exponentd.m4 serial 3 +dnl Copyright (C) 2007-2008, 2010-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], +[ + AC_CACHE_CHECK([where to find the exponent in a 'double'], + [gl_cv_cc_double_expbit0], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (double x) +{ + memory_double m; + size_t i; + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + ]])], + [gl_cv_cc_double_expbit0=`cat conftest.out`], + [gl_cv_cc_double_expbit0="unknown"], + [ + dnl On ARM, there are two 'double' floating-point formats, used by + dnl different sets of instructions: The older FPA instructions assume + dnl that they are stored in big-endian word order, while the words + dnl (like integer types) are stored in little-endian byte order. + dnl The newer VFP instructions assume little-endian order + dnl consistently. + AC_EGREP_CPP([mixed_endianness], [ +#if defined arm || defined __arm || defined __arm__ + mixed_endianness +#endif + ], + [gl_cv_cc_double_expbit0="unknown"], + [ + pushdef([AC_MSG_CHECKING],[:])dnl + pushdef([AC_MSG_RESULT],[:])dnl + pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl + AC_C_BIGENDIAN( + [gl_cv_cc_double_expbit0="word 0 bit 20"], + [gl_cv_cc_double_expbit0="word 1 bit 20"], + [gl_cv_cc_double_expbit0="unknown"]) + popdef([AC_MSG_RESULT_UNQUOTED])dnl + popdef([AC_MSG_RESULT])dnl + popdef([AC_MSG_CHECKING])dnl + ]) + ]) + rm -f conftest.out + ]) + case "$gl_cv_cc_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` + AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word], + [Define as the word index where to find the exponent of 'double'.]) + AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit], + [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.]) + ;; + esac +]) diff --git a/m4/extensions.m4 b/m4/extensions.m4 index 7d9458a8d..07ba376c0 100644 --- a/m4/extensions.m4 +++ b/m4/extensions.m4 @@ -1,14 +1,14 @@ -# serial 9 -*- Autoconf -*- +# serial 13 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly +# 2.70 or later everywhere, but since Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. @@ -30,6 +30,7 @@ # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. +# # Remember that #undef in AH_VERBATIM gets replaced with #define by # AC_DEFINE. The goal here is to define all known feature-enabling # macros, then, if reports of conflicts are made, disable macros that @@ -38,35 +39,31 @@ AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], - [Define to 1 if you need to in order for `stat' and other + [Define to 1 if you need to in order for 'stat' and other things to work.]) AC_DEFINE([_POSIX_1_SOURCE], [2], [Define to 2 if the system does not provide POSIX.1 features except with this defined.]) AC_DEFINE([_MINIX], [1], [Define to 1 if on MINIX.]) + AC_DEFINE([_NETBSD_SOURCE], [1], + [Define to 1 to make NetBSD features available. MINIX 3 needs this.]) fi - dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, - dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already - dnl provided. - case "$host_os" in - hpux*) - AC_DEFINE([_XOPEN_SOURCE], [500], - [Define to 500 only on HP-UX.]) - ;; - esac - - AH_VERBATIM([__EXTENSIONS__], +dnl Use a different key than __EXTENSIONS__, as that name broke existing +dnl configure.ac when using autoheader 2.62. + AH_VERBATIM([USE_SYSTEM_EXTENSIONS], [/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif +/* Enable general extensions on OS X. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE @@ -79,6 +76,12 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif +/* Enable X/Open extensions if necessary. HP-UX 11.11 defines + mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of + whether compiling with -Ae or -D_HPUX_SOURCE=1. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ @@ -95,9 +98,26 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) + AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], + [ac_cv_should_define__xopen_source], + [ac_cv_should_define__xopen_source=no + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include + mbstate_t x;]])], + [], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #define _XOPEN_SOURCE 500 + #include + mbstate_t x;]])], + [ac_cv_should_define__xopen_source=yes])])]) + test $ac_cv_should_define__xopen_source = yes && + AC_DEFINE([_XOPEN_SOURCE], [500]) ])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 new file mode 100644 index 000000000..0152f2932 --- /dev/null +++ b/m4/extern-inline.m4 @@ -0,0 +1,65 @@ +dnl 'extern inline' a la ISO C99. + +dnl Copyright 2012-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_EXTERN_INLINE], +[ + AH_VERBATIM([extern_inline], +[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'. + _GL_EXTERN_INLINE is a portable alternative to 'extern inline'. + _GL_INLINE_HEADER_BEGIN contains useful stuff to put + in an include file, before uses of _GL_INLINE. + It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic, + when FOO is an inline function in the header; see + . + _GL_INLINE_HEADER_END contains useful stuff to put + in the same include file, after uses of _GL_INLINE. + + Suppress extern inline with HP-UX cc, as it appears to be broken; see + . + + Suppress the use of extern inline on Apple's platforms, + as Libc-825.25 (2012-09-19) is incompatible with it; see + . + Perhaps Apple will fix this some day. */ +#if ((__GNUC__ \ + ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + : 199901L <= __STDC_VERSION__ && !defined __HP_cc) \ + && !defined __APPLE__) +# define _GL_INLINE inline +# define _GL_EXTERN_INLINE extern inline +#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__ +# if __GNUC_GNU_INLINE__ + /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ +# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) +# else +# define _GL_INLINE extern inline +# endif +# define _GL_EXTERN_INLINE extern +#else +# define _GL_INLINE static _GL_UNUSED +# define _GL_EXTERN_INLINE static _GL_UNUSED +#endif + +#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ +# define _GL_INLINE_HEADER_CONST_PRAGMA +# else +# define _GL_INLINE_HEADER_CONST_PRAGMA \ + _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") +# endif +# define _GL_INLINE_HEADER_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ + _GL_INLINE_HEADER_CONST_PRAGMA +# define _GL_INLINE_HEADER_END \ + _Pragma ("GCC diagnostic pop") +#else +# define _GL_INLINE_HEADER_BEGIN +# define _GL_INLINE_HEADER_END +#endif]) +]) diff --git a/m4/fcntl-o.m4 b/m4/fcntl-o.m4 index 1adacc8ab..87cc4bd2d 100644 --- a/m4/fcntl-o.m4 +++ b/m4/fcntl-o.m4 @@ -1,5 +1,5 @@ -# fcntl-o.m4 serial 2 -dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc. +# fcntl-o.m4 serial 4 +dnl Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -17,12 +17,21 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], [AC_REQUIRE([AC_GNU_SOURCE])]) + + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CHECK_FUNCS_ONCE([symlink]) AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include #include - #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + # include + # defined sleep(n) _sleep ((n) * 1000) + #endif #include #ifndef O_NOATIME #define O_NOATIME 0 @@ -37,34 +46,74 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], }; ]], [[ - int status = !constants; + int result = !constants; + #if HAVE_SYMLINK { static char const sym[] = "conftest.sym"; - if (symlink (".", sym) != 0 - || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) - status |= 32; + if (symlink ("/dev/null", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } + if (unlink (sym) != 0 || symlink (".", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_RDONLY | O_NOFOLLOW); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } unlink (sym); } + #endif { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME); - char c; - struct stat st0, st1; - if (fd < 0 - || fstat (fd, &st0) != 0 - || sleep (1) != 0 - || read (fd, &c, 1) != 1 - || close (fd) != 0 - || stat (file, &st1) != 0 - || st0.st_atime != st1.st_atime) - status |= 64; + if (fd < 0) + result |= 8; + else + { + struct stat st0; + if (fstat (fd, &st0) != 0) + result |= 16; + else + { + char c; + sleep (1); + if (read (fd, &c, 1) != 1) + result |= 24; + else + { + if (close (fd) != 0) + result |= 32; + else + { + struct stat st1; + if (stat (file, &st1) != 0) + result |= 40; + else + if (st0.st_atime != st1.st_atime) + result |= 64; + } + } + } + } } - return status;]])], + return result;]])], [gl_cv_header_working_fcntl_h=yes], [case $? in #( - 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( *) gl_cv_header_working_fcntl_h='no';; esac], [gl_cv_header_working_fcntl_h=cross-compiling])]) diff --git a/m4/float_h.m4 b/m4/float_h.m4 index f6099db40..397f2d1fa 100644 --- a/m4/float_h.m4 +++ b/m4/float_h.m4 @@ -1,5 +1,5 @@ -# float_h.m4 serial 4 -dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +# float_h.m4 serial 9 +dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,11 +9,90 @@ AC_DEFUN([gl_FLOAT_H], AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) FLOAT_H= + REPLACE_FLOAT_LDBL=0 case "$host_os" in - beos* | openbsd* | mirbsd*) + aix* | beos* | openbsd* | mirbsd* | irix*) FLOAT_H=float.h - gl_CHECK_NEXT_HEADERS([float.h]) + ;; + freebsd*) + case "$host_cpu" in +changequote(,)dnl + i[34567]86 ) +changequote([,])dnl + FLOAT_H=float.h + ;; + x86_64 ) + # On x86_64 systems, the C compiler may still be generating + # 32-bit code. + AC_EGREP_CPP([yes], + [#if defined __LP64__ || defined __x86_64__ || defined __amd64__ + yes + #endif], + [], + [FLOAT_H=float.h]) + ;; + esac + ;; + linux*) + case "$host_cpu" in + powerpc*) + FLOAT_H=float.h + ;; + esac ;; esac + case "$host_os" in + aix* | freebsd* | linux*) + if test -n "$FLOAT_H"; then + REPLACE_FLOAT_LDBL=1 + fi + ;; + esac + + dnl Test against glibc-2.7 Linux/SPARC64 bug. + REPLACE_ITOLD=0 + AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], + [gl_cv_func_itold_works], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +int i = -1; +volatile long double ld; +int main () +{ + ld += i * 1.0L; + if (ld > 0) + return 1; + return 0; +}]])], + [gl_cv_func_itold_works=yes], + [gl_cv_func_itold_works=no], + [case "$host" in + sparc*-*-linux*) + AC_EGREP_CPP([yes], + [#if defined __LP64__ || defined __arch64__ + yes + #endif], + [gl_cv_func_itold_works="guessing no"], + [gl_cv_func_itold_works="guessing yes"]) + ;; + *) gl_cv_func_itold_works="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_itold_works" in + *no) + REPLACE_ITOLD=1 + dnl We add the workaround to but also to , + dnl to increase the chances that the fix function gets pulled in. + FLOAT_H=float.h + ;; + esac + + if test -n "$FLOAT_H"; then + gl_NEXT_HEADERS([float.h]) + fi AC_SUBST([FLOAT_H]) + AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"]) + AC_SUBST([REPLACE_ITOLD]) ]) diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4 index 212ead572..fa0ba4d22 100644 --- a/m4/fnmatch.m4 +++ b/m4/fnmatch.m4 @@ -1,6 +1,6 @@ -# Check for fnmatch - serial 4. +# Check for fnmatch - serial 9. -# Copyright (C) 2000-2007, 2009-2010 Free Software Foundation, Inc. +# Copyright (C) 2000-2007, 2009-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -20,7 +20,9 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX], AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) FNMATCH_H= - gl_fnmatch_required_lowercase=`echo $gl_fnmatch_required | tr 'A-Z' 'a-z'` + gl_fnmatch_required_lowercase=` + echo $gl_fnmatch_required | LC_ALL=C tr '[[A-Z]]' '[[a-z]]' + ` gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}" AC_CACHE_CHECK([for working $gl_fnmatch_required fnmatch], [$gl_fnmatch_cache_var], @@ -58,33 +60,62 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX], static char const a01[] = { 'a' + 1, 0 }; static char const bs_1[] = { '\\\\' - 1, 0 }; static char const bs01[] = { '\\\\' + 1, 0 }; - return - !(n ("a*", "", 0) - && y ("a*", "abc", 0) - && n ("d*/*1", "d/s/1", FNM_PATHNAME) - && y ("a\\\\bc", "abc", 0) - && n ("a\\\\bc", "abc", FNM_NOESCAPE) - && y ("*x", ".x", 0) - && n ("*x", ".x", FNM_PERIOD) - && y (Apat, "\\\\", 0) && y (Apat, "A", 0) - && y (apat, "\\\\", 0) && y (apat, "a", 0) - && n (Apat, A_1, 0) == ('A' < '\\\\') - && n (apat, a_1, 0) == ('a' < '\\\\') - && y (Apat, A01, 0) == ('A' < '\\\\') - && y (apat, a01, 0) == ('a' < '\\\\') - && y (Apat, bs_1, 0) == ('A' < '\\\\') - && y (apat, bs_1, 0) == ('a' < '\\\\') - && n (Apat, bs01, 0) == ('A' < '\\\\') - && n (apat, bs01, 0) == ('a' < '\\\\') - $gl_fnmatch_gnu_start - && y ("xxXX", "xXxX", FNM_CASEFOLD) - && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH) - && n ("d*/*1", "d/s/1", FNM_FILE_NAME) - && y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) - && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) - && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR) - $gl_fnmatch_gnu_end - ); + int result = 0; + if (!n ("a*", "", 0)) + return 1; + if (!y ("a*", "abc", 0)) + return 1; + if (!y ("[/b", "[/b", 0)) /*"]]"*/ /* glibc Bugzilla bug 12378 */ + return 1; + if (!n ("d*/*1", "d/s/1", FNM_PATHNAME)) + return 2; + if (!y ("a\\\\bc", "abc", 0)) + return 3; + if (!n ("a\\\\bc", "abc", FNM_NOESCAPE)) + return 3; + if (!y ("*x", ".x", 0)) + return 4; + if (!n ("*x", ".x", FNM_PERIOD)) + return 4; + if (!y (Apat, "\\\\", 0)) + return 5; + if (!y (Apat, "A", 0)) + return 5; + if (!y (apat, "\\\\", 0)) + return 5; + if (!y (apat, "a", 0)) + return 5; + if (!(n (Apat, A_1, 0) == ('A' < '\\\\'))) + return 5; + if (!(n (apat, a_1, 0) == ('a' < '\\\\'))) + return 5; + if (!(y (Apat, A01, 0) == ('A' < '\\\\'))) + return 5; + if (!(y (apat, a01, 0) == ('a' < '\\\\'))) + return 5; + if (!(y (Apat, bs_1, 0) == ('A' < '\\\\'))) + return 5; + if (!(y (apat, bs_1, 0) == ('a' < '\\\\'))) + return 5; + if (!(n (Apat, bs01, 0) == ('A' < '\\\\'))) + return 5; + if (!(n (apat, bs01, 0) == ('a' < '\\\\'))) + return 5; + $gl_fnmatch_gnu_start + if (!y ("xxXX", "xXxX", FNM_CASEFOLD)) + result |= 8; + if (!y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)) + result |= 16; + if (!n ("d*/*1", "d/s/1", FNM_FILE_NAME)) + result |= 32; + if (!y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + if (!y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + if (!y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)) + result |= 64; + $gl_fnmatch_gnu_end + return result; ]])], [eval "$gl_fnmatch_cache_var=yes"], [eval "$gl_fnmatch_cache_var=no"], @@ -97,19 +128,9 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX], rm -f "$gl_source_base/fnmatch.h" else FNMATCH_H=fnmatch.h - AC_LIBOBJ([fnmatch]) - dnl We must choose a different name for our function, since on ELF systems - dnl a broken fnmatch() in libc.so would override our fnmatch() if it is - dnl compiled into a shared library. - AC_DEFINE_UNQUOTED([fnmatch], [${gl_fnmatch_required_lowercase}_fnmatch], - [Define to a replacement function name for fnmatch().]) - dnl Prerequisites of lib/fnmatch.c. - AC_REQUIRE([AC_TYPE_MBSTATE_T]) - AC_CHECK_DECLS([isblank], [], [], [#include ]) - AC_CHECK_FUNCS_ONCE([btowc isblank iswctype mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy]) - AC_CHECK_HEADERS_ONCE([wctype.h]) fi AC_SUBST([FNMATCH_H]) + AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"]) ]) # Request a POSIX compliant fnmatch function with GNU extensions. @@ -119,3 +140,17 @@ AC_DEFUN([gl_FUNC_FNMATCH_GNU], AC_REQUIRE([gl_FUNC_FNMATCH_POSIX]) ]) + +AC_DEFUN([gl_PREREQ_FNMATCH], +[ + dnl We must choose a different name for our function, since on ELF systems + dnl a broken fnmatch() in libc.so would override our fnmatch() if it is + dnl compiled into a shared library. + AC_DEFINE_UNQUOTED([fnmatch], [${gl_fnmatch_required_lowercase}_fnmatch], + [Define to a replacement function name for fnmatch().]) + dnl Prerequisites of lib/fnmatch.c. + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + AC_CHECK_DECLS([isblank], [], [], [[#include ]]) + AC_CHECK_FUNCS_ONCE([btowc isblank iswctype mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy]) + AC_CHECK_HEADERS_ONCE([wctype.h]) +]) diff --git a/m4/getdelim.m4 b/m4/getdelim.m4 index 4beb1501c..36f66a108 100644 --- a/m4/getdelim.m4 +++ b/m4/getdelim.m4 @@ -1,6 +1,6 @@ -# getdelim.m4 serial 6 +# getdelim.m4 serial 10 -dnl Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,6 +19,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], AC_CHECK_FUNCS_ONCE([getdelim]) if test $ac_cv_func_getdelim = yes; then + HAVE_GETDELIM=1 dnl Found it in some library. Verify that it works. AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim], [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data @@ -38,7 +39,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], size_t siz = 0; int len = getdelim (&line, &siz, '\n', in); if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) - return 1; + return 2; } { /* Test result for a NULL buffer and a non-zero size. @@ -46,7 +47,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], char *line = NULL; size_t siz = (size_t)(~0) / 4; if (getdelim (&line, &siz, '\n', in) == -1) - return 1; + return 3; } return 0; } @@ -57,29 +58,26 @@ AC_DEFUN([gl_FUNC_GETDELIM], [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ >= 2) + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ Lucky GNU user #endif #endif ], - [gl_cv_func_working_getdelim=yes], - [gl_cv_func_working_getdelim=no])] + [gl_cv_func_working_getdelim="guessing yes"], + [gl_cv_func_working_getdelim="guessing no"])] )]) + case "$gl_cv_func_working_getdelim" in + *no) + REPLACE_GETDELIM=1 + ;; + esac else - gl_cv_func_working_getdelim=no + HAVE_GETDELIM=0 fi if test $ac_cv_have_decl_getdelim = no; then HAVE_DECL_GETDELIM=0 fi - - if test $gl_cv_func_working_getdelim = no; then - if test $ac_cv_func_getdelim = yes; then - REPLACE_GETDELIM=1 - fi - AC_LIBOBJ([getdelim]) - gl_PREREQ_GETDELIM - fi ]) # Prerequisites of lib/getdelim.c. diff --git a/m4/getline.m4 b/m4/getline.m4 index 83005600d..342bc9905 100644 --- a/m4/getline.m4 +++ b/m4/getline.m4 @@ -1,6 +1,6 @@ -# getline.m4 serial 21 +# getline.m4 serial 26 -dnl Copyright (C) 1998-2003, 2005-2007, 2009-2010 Free Software Foundation, +dnl Copyright (C) 1998-2003, 2005-2007, 2009-2013 Free Software Foundation, dnl Inc. dnl dnl This file is free software; the Free Software Foundation @@ -46,7 +46,7 @@ AC_DEFUN([gl_FUNC_GETLINE], size_t siz = 0; int len = getline (&line, &siz, in); if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) - return 1; + return 2; } { /* Test result for a NULL buffer and a non-zero size. @@ -54,7 +54,7 @@ AC_DEFUN([gl_FUNC_GETLINE], char *line = NULL; size_t siz = (size_t)(~0) / 4; if (getline (&line, &siz, in) == -1) - return 1; + return 3; } return 0; } @@ -65,13 +65,13 @@ AC_DEFUN([gl_FUNC_GETLINE], [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ >= 2) + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ Lucky GNU user #endif #endif ], - [am_cv_func_working_getline=yes], - [am_cv_func_working_getline=no])] + [am_cv_func_working_getline="guessing yes"], + [am_cv_func_working_getline="guessing no"])] )]) fi @@ -79,19 +79,18 @@ AC_DEFUN([gl_FUNC_GETLINE], HAVE_DECL_GETLINE=0 fi - if test $am_cv_func_working_getline = no; then - dnl Set REPLACE_GETLINE always: Even if we have not found the broken - dnl getline function among $LIBS, it may exist in libinet and the - dnl executable may be linked with -linet. - REPLACE_GETLINE=1 - AC_LIBOBJ([getline]) - - gl_PREREQ_GETLINE - fi + case "$am_cv_func_working_getline" in + *no) + dnl Set REPLACE_GETLINE always: Even if we have not found the broken + dnl getline function among $LIBS, it may exist in libinet and the + dnl executable may be linked with -linet. + REPLACE_GETLINE=1 + ;; + esac ]) # Prerequisites of lib/getline.c. AC_DEFUN([gl_PREREQ_GETLINE], [ - gl_FUNC_GETDELIM + : ]) diff --git a/m4/getopt.m4 b/m4/getopt.m4 index d05e9d914..50f450919 100644 --- a/m4/getopt.m4 +++ b/m4/getopt.m4 @@ -1,5 +1,5 @@ -# getopt.m4 serial 31 -dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc. +# getopt.m4 serial 44 +dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,10 +9,22 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX], [ m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - gl_GETOPT_IFELSE([ - gl_REPLACE_GETOPT - ], - []) + AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) + dnl Other modules can request the gnulib implementation of the getopt + dnl functions unconditionally, by defining gl_REPLACE_GETOPT_ALWAYS. + dnl argp.m4 does this. + m4_ifdef([gl_REPLACE_GETOPT_ALWAYS], [ + REPLACE_GETOPT=1 + ], [ + REPLACE_GETOPT=0 + if test -n "$gl_replace_getopt"; then + REPLACE_GETOPT=1 + fi + ]) + if test $REPLACE_GETOPT = 1; then + dnl Arrange for getopt.h to be created. + gl_GETOPT_SUBSTITUTE_HEADER + fi ]) # Request a POSIX compliant getopt function with GNU extensions (such as @@ -25,27 +37,6 @@ AC_DEFUN([gl_FUNC_GETOPT_GNU], AC_REQUIRE([gl_FUNC_GETOPT_POSIX]) ]) -# Request the gnulib implementation of the getopt functions unconditionally. -# argp.m4 uses this. -AC_DEFUN([gl_REPLACE_GETOPT], -[ - dnl Arrange for getopt.h to be created. - gl_GETOPT_SUBSTITUTE_HEADER - dnl Arrange for unistd.h to include getopt.h. - GNULIB_UNISTD_H_GETOPT=1 - dnl Arrange to compile the getopt implementation. - AC_LIBOBJ([getopt]) - AC_LIBOBJ([getopt1]) - gl_PREREQ_GETOPT -]) - -# emacs' configure.in uses this. -AC_DEFUN([gl_GETOPT_IFELSE], -[ - AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) - AS_IF([test -n "$gl_replace_getopt"], [$1], [$2]) -]) - # Determine whether to replace the entire getopt facility. AC_DEFUN([gl_GETOPT_CHECK_HEADERS], [ @@ -56,7 +47,6 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS], AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) gl_CHECK_NEXT_HEADERS([getopt.h]) - AC_CHECK_HEADERS_ONCE([getopt.h]) if test $ac_cv_header_getopt_h = yes; then HAVE_GETOPT_H=1 else @@ -76,25 +66,6 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS], AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes]) fi - dnl BSD getopt_long uses an incompatible method to reset option processing. - dnl Existence of the variable, in and of itself, is not a reason to replace - dnl getopt, but knowledge of the variable is needed to determine how to - dnl reset and whether a reset reparses the environment. - dnl Solaris supports neither optreset nor optind=0, but keeps no state that - dnl needs a reset beyond setting optind=1; detect Solaris by getopt_clip. - if test -z "$gl_replace_getopt"; then - AC_CHECK_DECLS([optreset], [], - [AC_CHECK_DECLS([getopt_clip], [], [], - [[#include ]]) - ], - [[#include ]]) - fi - - dnl mingw's getopt (in libmingwex.a) does weird things when the options - dnl strings starts with '+' and it's not the first call. Some internal state - dnl is left over from earlier calls, and neither setting optind = 0 nor - dnl setting optreset = 1 get rid of this internal state. - dnl POSIX is silent on optind vs. optreset, so we allow either behavior. dnl POSIX 2008 does not specify leading '+' behavior, but see dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on dnl the next version of POSIX. For now, we only guarantee leading '+' @@ -103,105 +74,124 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS], AC_CACHE_CHECK([whether getopt is POSIX compatible], [gl_cv_func_getopt_posix], [ - dnl This test fails on mingw and succeeds on many other platforms. - AC_RUN_IFELSE([AC_LANG_SOURCE([[ + dnl Merging these three different test programs into a single one + dnl would require a reset mechanism. On BSD systems, it can be done + dnl through 'optreset'; on some others (glibc), it can be done by + dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1, + dnl Solaris 9, musl libc), there is no such mechanism. + if test $cross_compiling = no; then + dnl Sanity check. Succeeds everywhere (except on MSVC, + dnl which lacks and getopt() entirely). + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #include #include -#if !HAVE_DECL_OPTRESET && !HAVE_DECL_GETOPT_CLIP -# define OPTIND_MIN 0 -#else -# define OPTIND_MIN 1 -#endif +int +main () +{ + static char program[] = "program"; + static char a[] = "-a"; + static char foo[] = "foo"; + static char bar[] = "bar"; + char *argv[] = { program, a, foo, bar, NULL }; + int c; + + c = getopt (4, argv, "ab"); + if (!(c == 'a')) + return 1; + c = getopt (4, argv, "ab"); + if (!(c == -1)) + return 2; + if (!(optind == 2)) + return 3; + return 0; +} +]])], + [gl_cv_func_getopt_posix=maybe], + [gl_cv_func_getopt_posix=no]) + if test $gl_cv_func_getopt_posix = maybe; then + dnl Sanity check with '+'. Succeeds everywhere (except on MSVC, + dnl which lacks and getopt() entirely). + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include int main () { - { - int argc = 0; - char *argv[10]; - int c; - - argv[argc++] = "program"; - argv[argc++] = "-a"; - argv[argc++] = "foo"; - argv[argc++] = "bar"; - argv[argc] = NULL; - optind = OPTIND_MIN; - opterr = 0; - - c = getopt (argc, argv, "ab"); - if (!(c == 'a')) - return 1; - c = getopt (argc, argv, "ab"); - if (!(c == -1)) - return 2; - if (!(optind == 2)) - return 3; - } - /* Some internal state exists at this point. */ - { - int argc = 0; - char *argv[10]; - int c; - - argv[argc++] = "program"; - argv[argc++] = "donald"; - argv[argc++] = "-p"; - argv[argc++] = "billy"; - argv[argc++] = "duck"; - argv[argc++] = "-a"; - argv[argc++] = "bar"; - argv[argc] = NULL; - optind = OPTIND_MIN; - opterr = 0; - - c = getopt (argc, argv, "+abp:q:"); - if (!(c == -1)) - return 4; - if (!(strcmp (argv[0], "program") == 0)) - return 5; - if (!(strcmp (argv[1], "donald") == 0)) - return 6; - if (!(strcmp (argv[2], "-p") == 0)) - return 7; - if (!(strcmp (argv[3], "billy") == 0)) - return 8; - if (!(strcmp (argv[4], "duck") == 0)) - return 9; - if (!(strcmp (argv[5], "-a") == 0)) - return 10; - if (!(strcmp (argv[6], "bar") == 0)) - return 11; - if (!(optind == 1)) - return 12; - } - /* Detect MacOS 10.5, AIX 7.1 bug. */ - { - char *argv[3] = { "program", "-ab", NULL }; - optind = OPTIND_MIN; - opterr = 0; - if (getopt (2, argv, "ab:") != 'a') - return 13; - if (getopt (2, argv, "ab:") != '?') - return 14; - if (optopt != 'b') - return 15; - if (optind != 2) - return 16; - } + static char program[] = "program"; + static char donald[] = "donald"; + static char p[] = "-p"; + static char billy[] = "billy"; + static char duck[] = "duck"; + static char a[] = "-a"; + static char bar[] = "bar"; + char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; + int c; + c = getopt (7, argv, "+abp:q:"); + if (!(c == -1)) + return 4; + if (!(strcmp (argv[0], "program") == 0)) + return 5; + if (!(strcmp (argv[1], "donald") == 0)) + return 6; + if (!(strcmp (argv[2], "-p") == 0)) + return 7; + if (!(strcmp (argv[3], "billy") == 0)) + return 8; + if (!(strcmp (argv[4], "duck") == 0)) + return 9; + if (!(strcmp (argv[5], "-a") == 0)) + return 10; + if (!(strcmp (argv[6], "bar") == 0)) + return 11; + if (!(optind == 1)) + return 12; return 0; } ]])], - [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no], - [case "$host_os" in - mingw*) gl_cv_func_getopt_posix="guessing no";; - darwin* | aix*) gl_cv_func_getopt_posix="guessing no";; - *) gl_cv_func_getopt_posix="guessing yes";; - esac - ]) + [gl_cv_func_getopt_posix=maybe], + [gl_cv_func_getopt_posix=no]) + fi + if test $gl_cv_func_getopt_posix = maybe; then + dnl Detect Mac OS X 10.5, AIX 7.1, mingw bug. + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include + +int +main () +{ + static char program[] = "program"; + static char ab[] = "-ab"; + char *argv[3] = { program, ab, NULL }; + if (getopt (2, argv, "ab:") != 'a') + return 13; + if (getopt (2, argv, "ab:") != '?') + return 14; + if (optopt != 'b') + return 15; + if (optind != 2) + return 16; + return 0; +} +]])], + [gl_cv_func_getopt_posix=yes], + [gl_cv_func_getopt_posix=no]) + fi + else + case "$host_os" in + darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; + *) gl_cv_func_getopt_posix="guessing yes";; + esac + fi ]) case "$gl_cv_func_getopt_posix" in *no) gl_replace_getopt=yes ;; @@ -230,63 +220,83 @@ dnl is ambiguous with environment values that contain newlines. [AC_LANG_PROGRAM([[#include #include #include + ]GL_NOCRASH[ ]], [[ + int result = 0; + + nocrash_init(); + /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, - and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, + and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. */ { - char *myargv[3]; - myargv[0] = "conftest"; - myargv[1] = "-+"; - myargv[2] = 0; + static char conftest[] = "conftest"; + static char plus[] = "-+"; + char *argv[3] = { conftest, plus, NULL }; opterr = 0; - if (getopt (2, myargv, "+a") != '?') - return 1; + if (getopt (2, argv, "+a") != '?') + result |= 1; } /* This code succeeds on glibc 2.8, mingw, - and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, + and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ { - char *argv[] = { "program", "-p", "foo", "bar", NULL }; + static char program[] = "program"; + static char p[] = "-p"; + static char foo[] = "foo"; + static char bar[] = "bar"; + char *argv[] = { program, p, foo, bar, NULL }; optind = 1; if (getopt (4, argv, "p::") != 'p') - return 2; - if (optarg != NULL) - return 3; - if (getopt (4, argv, "p::") != -1) - return 4; - if (optind != 2) - return 5; + result |= 2; + else if (optarg != NULL) + result |= 4; + else if (getopt (4, argv, "p::") != -1) + result |= 6; + else if (optind != 2) + result |= 8; } /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ { - char *argv[] = { "program", "foo", "-p", NULL }; + static char program[] = "program"; + static char foo[] = "foo"; + static char p[] = "-p"; + char *argv[] = { program, foo, p, NULL }; optind = 0; if (getopt (3, argv, "-p") != 1) - return 6; - if (getopt (3, argv, "-p") != 'p') - return 7; + result |= 16; + else if (getopt (3, argv, "-p") != 'p') + result |= 16; } /* This code fails on glibc 2.11. */ { - char *argv[] = { "program", "-b", "-a", NULL }; + static char program[] = "program"; + static char b[] = "-b"; + static char a[] = "-a"; + char *argv[] = { program, b, a, NULL }; optind = opterr = 0; if (getopt (3, argv, "+:a:b") != 'b') - return 8; - if (getopt (3, argv, "+:a:b") != ':') - return 9; + result |= 32; + else if (getopt (3, argv, "+:a:b") != ':') + result |= 32; } - return 0; + /* This code dumps core on glibc 2.14. */ + { + static char program[] = "program"; + static char w[] = "-W"; + static char dummy[] = "dummy"; + char *argv[] = { program, w, dummy, NULL }; + optind = opterr = 1; + if (getopt (3, argv, "W;") != 'W') + result |= 64; + } + return result; ]])], [gl_cv_func_getopt_gnu=yes], [gl_cv_func_getopt_gnu=no], - [dnl Cross compiling. Guess based on host and declarations. - case $host_os:$ac_cv_have_decl_optreset in - *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;; - *:yes) gl_cv_func_getopt_gnu=no;; - *) gl_cv_func_getopt_gnu=yes;; - esac + [dnl Cross compiling. Assume the worst, even on glibc platforms. + gl_cv_func_getopt_gnu="guessing no" ]) case $gl_had_POSIXLY_CORRECT in exported) ;; @@ -294,13 +304,54 @@ dnl is ambiguous with environment values that contain newlines. *) AS_UNSET([POSIXLY_CORRECT]) ;; esac ]) - if test "$gl_cv_func_getopt_gnu" = "no"; then + if test "$gl_cv_func_getopt_gnu" != yes; then gl_replace_getopt=yes + else + AC_CACHE_CHECK([for working GNU getopt_long function], + [gl_cv_func_getopt_long_gnu], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #include + ]], + [[static const struct option long_options[] = + { + { "xtremely-",no_argument, NULL, 1003 }, + { "xtra", no_argument, NULL, 1001 }, + { "xtreme", no_argument, NULL, 1002 }, + { "xtremely", no_argument, NULL, 1003 }, + { NULL, 0, NULL, 0 } + }; + /* This code fails on OpenBSD 5.0. */ + { + static char program[] = "program"; + static char xtremel[] = "--xtremel"; + char *argv[] = { program, xtremel, NULL }; + int option_index; + optind = 1; opterr = 0; + if (getopt_long (2, argv, "", long_options, &option_index) != 1003) + return 1; + } + return 0; + ]])], + [gl_cv_func_getopt_long_gnu=yes], + [gl_cv_func_getopt_long_gnu=no], + [dnl Cross compiling. Guess no on OpenBSD, yes otherwise. + case "$host_os" in + openbsd*) gl_cv_func_getopt_long_gnu="guessing no";; + *) gl_cv_func_getopt_long_gnu="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_getopt_long_gnu" in + *yes) ;; + *) gl_replace_getopt=yes ;; + esac fi fi ]) -# emacs' configure.in uses this. AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], [ GETOPT_H=getopt.h @@ -311,7 +362,6 @@ AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], ]) # Prerequisites of lib/getopt*. -# emacs' configure.in uses this. AC_DEFUN([gl_PREREQ_GETOPT], [ AC_CHECK_DECLS_ONCE([getenv]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 979c52c19..8d1f0665c 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,5 +1,5 @@ -# gettext.m4 serial 64 (gettext-0.18.2) -dnl Copyright (C) 1995-2010 Free Software Foundation, Inc. +# gettext.m4 serial 66 (gettext-0.18.2) +dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -35,7 +35,7 @@ dnl will be ignored. If NEEDSYMBOL is specified and is dnl 'need-formatstring-macros', then GNU gettext implementations that don't dnl support the ISO C 99 formatstring macros will be ignored. dnl INTLDIR is used to find the intl libraries. If empty, -dnl the value `$(top_builddir)/intl/' is used. +dnl the value '$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled @@ -97,7 +97,7 @@ AC_DEFUN([AM_GNU_GETTEXT], AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) - dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. + dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation. gt_INTL_MACOSX dnl Set USE_NLS. diff --git a/m4/glibc2.m4 b/m4/glibc2.m4 index f148c12c4..0e5068266 100644 --- a/m4/glibc2.m4 +++ b/m4/glibc2.m4 @@ -1,5 +1,6 @@ -# glibc2.m4 serial 2 -dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. +# glibc2.m4 serial 3 +dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2013 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -15,7 +16,7 @@ AC_DEFUN([gt_GLIBC2], [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ >= 2) + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ Lucky GNU user #endif #endif diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 index 68ada9d4d..613fb2a41 100644 --- a/m4/glibc21.m4 +++ b/m4/glibc21.m4 @@ -1,23 +1,27 @@ -# glibc21.m4 serial 4 -dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc. +# glibc21.m4 serial 5 +dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2013 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -# Test for the GNU C Library, version 2.1 or newer. +# Test for the GNU C Library, version 2.1 or newer, or uClibc. # From Bruno Haible. AC_DEFUN([gl_GLIBC21], [ - AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer], + AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], [ac_cv_gnu_library_2_1], - [AC_EGREP_CPP([Lucky GNU user], + [AC_EGREP_CPP([Lucky], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif +#endif +#ifdef __UCLIBC__ + Lucky user #endif ], [ac_cv_gnu_library_2_1=yes], diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index 3c094bc19..408918440 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -1,9 +1,21 @@ -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2013 Free Software Foundation, Inc. # -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. @@ -15,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname regex +# gnulib-tool --import --dir=. --lib=libgnu --source-base=grub-core/gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error fnmatch getdelim getline gettext progname regex # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -39,4 +51,5 @@ gl_LIB([libgnu]) gl_MAKEFILE_NAME([]) gl_MACRO_PREFIX([gl]) gl_PO_DOMAIN([]) +gl_WITNESS_C_MACRO([]) gl_VC_FILES([false]) diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 4c7ac30d0..0ae5a9ec6 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ -# gnulib-common.m4 serial 20 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# gnulib-common.m4 serial 33 +dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,11 +12,25 @@ AC_DEFUN([gl_COMMON], [ AC_REQUIRE([gl_COMMON_BODY]) ]) AC_DEFUN([gl_COMMON_BODY], [ + AH_VERBATIM([_Noreturn], +[/* The _Noreturn keyword of C11. */ +#if ! (defined _Noreturn \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif +]) AH_VERBATIM([isoc99_inline], [/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. - __APPLE__ && __MACH__ test for MacOS X. + __APPLE__ && __MACH__ test for Mac OS X. __APPLE_CC__ tests for the Apple compiler and its version. __STDC_VERSION__ tests for the C99 mode. */ #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ @@ -34,6 +48,20 @@ AC_DEFUN([gl_COMMON_BODY], [ /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED + +/* The __pure__ attribute was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +/* The __const__ attribute was added in gcc 2.95. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif ]) dnl Preparation for running test programs: dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not @@ -47,16 +75,49 @@ AC_DEFUN([gl_COMMON_BODY], [ # expands to a C preprocessor expression that evaluates to 1 or 0, depending # whether a gnulib module that has been requested shall be considered present # or not. -AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) +m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) # gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) # sets the shell variable that indicates the presence of the given module to # a C preprocessor expression that will evaluate to 1. AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], [ - GNULIB_[]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION + gl_MODULE_INDICATOR_SET_VARIABLE_AUX( + [GNULIB_[]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], + [gl_MODULE_INDICATOR_CONDITION]) +]) + +# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable]) +# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION. +# The shell variable's value is a C preprocessor expression that evaluates +# to 0 or 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX], +[ + m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1], + [ + dnl Simplify the expression VALUE || 1 to 1. + $1=1 + ], + [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1], + [gl_MODULE_INDICATOR_CONDITION])]) +]) + +# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition]) +# modifies the shell variable to include the given condition. The shell +# variable's value is a C preprocessor expression that evaluates to 0 or 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR], +[ + dnl Simplify the expression 1 || CONDITION to 1. + if test "$[]$1" != 1; then + dnl Simplify the expression 0 || CONDITION to CONDITION. + if test "$[]$1" = 0; then + $1=$2 + else + $1="($[]$1 || $2)" + fi + fi ]) # gl_MODULE_INDICATOR([modulename]) @@ -102,6 +163,40 @@ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [Define to 1 when the gnulib module $1 should be tested.]) ]) +# gl_ASSERT_NO_GNULIB_POSIXCHECK +# asserts that there will never be a need to #define GNULIB_POSIXCHECK. +# and thereby enables an optimization of configure and config.h. +# Used by Emacs. +AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK], +[ + dnl Override gl_WARN_ON_USE_PREPARE. + dnl But hide this definition from 'aclocal'. + AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], []) +]) + +# gl_ASSERT_NO_GNULIB_TESTS +# asserts that there will be no gnulib tests in the scope of the configure.ac +# and thereby enables an optimization of config.h. +# Used by Emacs. +AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS], +[ + dnl Override gl_MODULE_INDICATOR_FOR_TESTS. + AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], []) +]) + +# Test whether exists. +# Set HAVE_FEATURES_H. +AC_DEFUN([gl_FEATURES_H], +[ + AC_CHECK_HEADERS_ONCE([features.h]) + if test $ac_cv_header_features_h = yes; then + HAVE_FEATURES_H=1 + else + HAVE_FEATURES_H=0 + fi + AC_SUBST([HAVE_FEATURES_H]) +]) + # m4_foreach_w # is a backport of autoconf-2.59c's m4_foreach_w. # Remove this macro when we can assume autoconf >= 2.60. @@ -117,11 +212,90 @@ m4_ifndef([AS_VAR_IF], [m4_define([AS_VAR_IF], [AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) +# gl_PROG_CC_C99 +# Modifies the value of the shell variable CC in an attempt to make $CC +# understand ISO C99 source code. +# This is like AC_PROG_CC_C99, except that +# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60, +# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC +# , +# but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99 +# . +# Remaining problems: +# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options +# to CC twice +# . +# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard. +AC_DEFUN([gl_PROG_CC_C99], +[ + dnl Change that version number to the minimum Autoconf version that supports + dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls. + m4_version_prereq([9.0], + [AC_REQUIRE([AC_PROG_CC_C99])], + [AC_REQUIRE([AC_PROG_CC_STDC])]) +]) + +# gl_PROG_AR_RANLIB +# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler. +# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override +# the values. +AC_DEFUN([gl_PROG_AR_RANLIB], +[ + dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler + dnl as "cc", and GCC as "gcc". They have different object file formats and + dnl library formats. In particular, the GNU binutils programs ar, ranlib + dnl produce libraries that work only with gcc, not with cc. + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], + [ + AC_EGREP_CPP([Amsterdam], + [ +#ifdef __ACK__ +Amsterdam +#endif + ], + [gl_cv_c_amsterdam_compiler=yes], + [gl_cv_c_amsterdam_compiler=no]) + ]) + if test -z "$AR"; then + if test $gl_cv_c_amsterdam_compiler = yes; then + AR='cc -c.a' + if test -z "$ARFLAGS"; then + ARFLAGS='-o' + fi + else + dnl Use the Automake-documented default values for AR and ARFLAGS, + dnl but prefer ${host}-ar over ar (useful for cross-compiling). + AC_CHECK_TOOL([AR], [ar], [ar]) + if test -z "$ARFLAGS"; then + ARFLAGS='cru' + fi + fi + else + if test -z "$ARFLAGS"; then + ARFLAGS='cru' + fi + fi + AC_SUBST([AR]) + AC_SUBST([ARFLAGS]) + if test -z "$RANLIB"; then + if test $gl_cv_c_amsterdam_compiler = yes; then + RANLIB=':' + else + dnl Use the ranlib program if it is available. + AC_PROG_RANLIB + fi + fi + AC_SUBST([RANLIB]) +]) + # AC_PROG_MKDIR_P # is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix # for interoperability with automake-1.9.6 from autoconf-2.62. # Remove this macro when we can assume autoconf >= 2.62 or # autoconf >= 2.60 && automake >= 1.10. +# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness. +m4_ifndef([AC_AUTOCONF_VERSION],[ m4_ifdef([AC_PROG_MKDIR_P], [ dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. m4_define([AC_PROG_MKDIR_P], @@ -132,13 +306,15 @@ m4_ifdef([AC_PROG_MKDIR_P], [ [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake MKDIR_P='$(mkdir_p)' AC_SUBST([MKDIR_P])])]) +]) # AC_C_RESTRICT # This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, # so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ # works. # This definition can be removed once autoconf >= 2.62 can be assumed. -m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1],[ +# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness. +m4_ifndef([AC_AUTOCONF_VERSION],[ AC_DEFUN([AC_C_RESTRICT], [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], [ac_cv_c_restrict=no diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index d3490c932..7a19f60d8 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -1,10 +1,22 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2013 Free Software Foundation, Inc. # -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. @@ -25,20 +37,21 @@ AC_DEFUN([gl_EARLY], m4_pattern_allow([^gl_ES$])dnl a valid locale name m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable - AC_REQUIRE([AC_PROG_RANLIB]) + AC_REQUIRE([gl_PROG_AR_RANLIB]) + AC_REQUIRE([AM_PROG_CC_C_O]) # Code from module alloca: # Code from module alloca-opt: - # Code from module arg-nonnull: # Code from module argp: # Code from module btowc: - # Code from module c++defs: # Code from module configmake: # Code from module dirname-lgpl: + # Code from module dosname: # Code from module double-slash-root: # Code from module errno: # Code from module error: # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + # Code from module extern-inline: # Code from module float: # Code from module fnmatch: # Code from module getdelim: @@ -52,22 +65,34 @@ AC_DEFUN([gl_EARLY], # Code from module intprops: # Code from module langinfo: # Code from module localcharset: + # Code from module locale: + # Code from module localeconv: # Code from module malloc-gnu: # Code from module malloc-posix: # Code from module mbrtowc: # Code from module mbsinit: # Code from module mbsrtowcs: + # Code from module mbswidth: + # Code from module mbtowc: # Code from module memchr: # Code from module mempcpy: + # Code from module msvc-inval: + # Code from module msvc-nothrow: # Code from module multiarch: # Code from module nl_langinfo: + # Code from module nocrash: # Code from module progname: # Code from module rawmemchr: # Code from module realloc-posix: # Code from module regex: # Code from module size_max: # Code from module sleep: + # Code from module snippet/_Noreturn: + # Code from module snippet/arg-nonnull: + # Code from module snippet/c++defs: + # Code from module snippet/warn-on-use: # Code from module ssize_t: + # Code from module stdalign: # Code from module stdbool: # Code from module stddef: # Code from module stdint: @@ -77,21 +102,25 @@ AC_DEFUN([gl_EARLY], # Code from module strchrnul: # Code from module streq: # Code from module strerror: + # Code from module strerror-override: # Code from module string: # Code from module strings: # Code from module strndup: # Code from module strnlen: # Code from module strnlen1: - # Code from module sys_wait: + # Code from module sys_types: # Code from module sysexits: # Code from module unistd: + # Code from module unitypes: + # Code from module uniwidth/base: + # Code from module uniwidth/width: # Code from module vasnprintf: # Code from module verify: # Code from module vsnprintf: - # Code from module warn-on-use: # Code from module wchar: # Code from module wcrtomb: - # Code from module wctype: + # Code from module wctype-h: + # Code from module wcwidth: # Code from module xsize: ]) @@ -111,158 +140,244 @@ AC_DEFUN([gl_INIT], m4_pushdef([gl_LIBSOURCES_DIR], []) gl_COMMON gl_source_base='grub-core/gnulib' - # Code from module alloca: - # Code from module alloca-opt: gl_FUNC_ALLOCA - # Code from module arg-nonnull: - # Code from module argp: gl_ARGP m4_ifdef([AM_XGETTEXT_OPTION], [AM_][XGETTEXT_OPTION([--flag=argp_error:2:c-format]) AM_][XGETTEXT_OPTION([--flag=argp_failure:4:c-format])]) - # Code from module btowc: gl_FUNC_BTOWC + if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then + AC_LIBOBJ([btowc]) + gl_PREREQ_BTOWC + fi gl_WCHAR_MODULE_INDICATOR([btowc]) - # Code from module c++defs: - # Code from module configmake: - # Code from module dirname-lgpl: + gl_CONFIGMAKE_PREP gl_DIRNAME_LGPL - # Code from module double-slash-root: gl_DOUBLE_SLASH_ROOT - # Code from module errno: gl_HEADER_ERRNO_H - # Code from module error: gl_ERROR + if test $ac_cv_lib_error_at_line = no; then + AC_LIBOBJ([error]) + gl_PREREQ_ERROR + fi m4_ifdef([AM_XGETTEXT_OPTION], [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) - # Code from module extensions: - # Code from module float: + AC_REQUIRE([gl_EXTERN_INLINE]) gl_FLOAT_H - # Code from module fnmatch: + if test $REPLACE_FLOAT_LDBL = 1; then + AC_LIBOBJ([float]) + fi + if test $REPLACE_ITOLD = 1; then + AC_LIBOBJ([itold]) + fi gl_FUNC_FNMATCH_POSIX - # Code from module getdelim: + if test -n "$FNMATCH_H"; then + AC_LIBOBJ([fnmatch]) + gl_PREREQ_FNMATCH + fi gl_FUNC_GETDELIM + if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then + AC_LIBOBJ([getdelim]) + gl_PREREQ_GETDELIM + fi gl_STDIO_MODULE_INDICATOR([getdelim]) - # Code from module getline: gl_FUNC_GETLINE + if test $REPLACE_GETLINE = 1; then + AC_LIBOBJ([getline]) + gl_PREREQ_GETLINE + fi gl_STDIO_MODULE_INDICATOR([getline]) - # Code from module getopt-gnu: gl_FUNC_GETOPT_GNU + if test $REPLACE_GETOPT = 1; then + AC_LIBOBJ([getopt]) + AC_LIBOBJ([getopt1]) + gl_PREREQ_GETOPT + dnl Arrange for unistd.h to include getopt.h. + GNULIB_GL_UNISTD_H_GETOPT=1 + fi + AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT]) gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu]) - # Code from module getopt-posix: gl_FUNC_GETOPT_POSIX - # Code from module gettext: + if test $REPLACE_GETOPT = 1; then + AC_LIBOBJ([getopt]) + AC_LIBOBJ([getopt1]) + gl_PREREQ_GETOPT + dnl Arrange for unistd.h to include getopt.h. + GNULIB_GL_UNISTD_H_GETOPT=1 + fi + AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT]) dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac. AM_GNU_GETTEXT_VERSION([0.18.1]) - # Code from module gettext-h: AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) - # Code from module havelib: - # Code from module include_next: - # Code from module intprops: - # Code from module langinfo: gl_LANGINFO_H - # Code from module localcharset: gl_LOCALCHARSET - LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\"" + LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\"" AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) - # Code from module malloc-gnu: + gl_LOCALE_H + gl_FUNC_LOCALECONV + if test $REPLACE_LOCALECONV = 1; then + AC_LIBOBJ([localeconv]) + gl_PREREQ_LOCALECONV + fi + gl_LOCALE_MODULE_INDICATOR([localeconv]) gl_FUNC_MALLOC_GNU + if test $REPLACE_MALLOC = 1; then + AC_LIBOBJ([malloc]) + fi gl_MODULE_INDICATOR([malloc-gnu]) - # Code from module malloc-posix: gl_FUNC_MALLOC_POSIX + if test $REPLACE_MALLOC = 1; then + AC_LIBOBJ([malloc]) + fi gl_STDLIB_MODULE_INDICATOR([malloc-posix]) - # Code from module mbrtowc: gl_FUNC_MBRTOWC + if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then + AC_LIBOBJ([mbrtowc]) + gl_PREREQ_MBRTOWC + fi gl_WCHAR_MODULE_INDICATOR([mbrtowc]) - # Code from module mbsinit: gl_FUNC_MBSINIT + if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then + AC_LIBOBJ([mbsinit]) + gl_PREREQ_MBSINIT + fi gl_WCHAR_MODULE_INDICATOR([mbsinit]) - # Code from module mbsrtowcs: gl_FUNC_MBSRTOWCS + if test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1; then + AC_LIBOBJ([mbsrtowcs]) + AC_LIBOBJ([mbsrtowcs-state]) + gl_PREREQ_MBSRTOWCS + fi gl_WCHAR_MODULE_INDICATOR([mbsrtowcs]) - # Code from module memchr: + gl_MBSWIDTH + gl_FUNC_MBTOWC + if test $REPLACE_MBTOWC = 1; then + AC_LIBOBJ([mbtowc]) + gl_PREREQ_MBTOWC + fi + gl_STDLIB_MODULE_INDICATOR([mbtowc]) gl_FUNC_MEMCHR + if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then + AC_LIBOBJ([memchr]) + gl_PREREQ_MEMCHR + fi gl_STRING_MODULE_INDICATOR([memchr]) - # Code from module mempcpy: gl_FUNC_MEMPCPY + if test $HAVE_MEMPCPY = 0; then + AC_LIBOBJ([mempcpy]) + gl_PREREQ_MEMPCPY + fi gl_STRING_MODULE_INDICATOR([mempcpy]) - # Code from module multiarch: + gl_MSVC_INVAL + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + AC_LIBOBJ([msvc-inval]) + fi + gl_MSVC_NOTHROW + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + AC_LIBOBJ([msvc-nothrow]) + fi gl_MULTIARCH - # Code from module nl_langinfo: gl_FUNC_NL_LANGINFO + if test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1; then + AC_LIBOBJ([nl_langinfo]) + fi gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) - # Code from module progname: AC_CHECK_DECLS([program_invocation_name], [], [], [#include ]) AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include ]) - # Code from module rawmemchr: gl_FUNC_RAWMEMCHR + if test $HAVE_RAWMEMCHR = 0; then + AC_LIBOBJ([rawmemchr]) + gl_PREREQ_RAWMEMCHR + fi gl_STRING_MODULE_INDICATOR([rawmemchr]) - # Code from module realloc-posix: gl_FUNC_REALLOC_POSIX + if test $REPLACE_REALLOC = 1; then + AC_LIBOBJ([realloc]) + fi gl_STDLIB_MODULE_INDICATOR([realloc-posix]) - # Code from module regex: gl_REGEX - # Code from module size_max: + if test $ac_use_included_regex = yes; then + AC_LIBOBJ([regex]) + gl_PREREQ_REGEX + fi gl_SIZE_MAX - # Code from module sleep: gl_FUNC_SLEEP + if test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1; then + AC_LIBOBJ([sleep]) + fi gl_UNISTD_MODULE_INDICATOR([sleep]) - # Code from module ssize_t: gt_TYPE_SSIZE_T - # Code from module stdbool: + gl_STDALIGN_H AM_STDBOOL_H - # Code from module stddef: gl_STDDEF_H - # Code from module stdint: gl_STDINT_H - # Code from module stdio: gl_STDIO_H - # Code from module stdlib: gl_STDLIB_H - # Code from module strcase: gl_STRCASE - # Code from module strchrnul: + if test $HAVE_STRCASECMP = 0; then + AC_LIBOBJ([strcasecmp]) + gl_PREREQ_STRCASECMP + fi + if test $HAVE_STRNCASECMP = 0; then + AC_LIBOBJ([strncasecmp]) + gl_PREREQ_STRNCASECMP + fi gl_FUNC_STRCHRNUL + if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then + AC_LIBOBJ([strchrnul]) + gl_PREREQ_STRCHRNUL + fi gl_STRING_MODULE_INDICATOR([strchrnul]) - # Code from module streq: - # Code from module strerror: gl_FUNC_STRERROR + if test $REPLACE_STRERROR = 1; then + AC_LIBOBJ([strerror]) + fi + gl_MODULE_INDICATOR([strerror]) gl_STRING_MODULE_INDICATOR([strerror]) - # Code from module string: + AC_REQUIRE([gl_HEADER_ERRNO_H]) + AC_REQUIRE([gl_FUNC_STRERROR_0]) + if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then + AC_LIBOBJ([strerror-override]) + gl_PREREQ_SYS_H_WINSOCK2 + fi gl_HEADER_STRING_H - # Code from module strings: gl_HEADER_STRINGS_H - # Code from module strndup: gl_FUNC_STRNDUP + if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then + AC_LIBOBJ([strndup]) + fi gl_STRING_MODULE_INDICATOR([strndup]) - # Code from module strnlen: gl_FUNC_STRNLEN + if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then + AC_LIBOBJ([strnlen]) + gl_PREREQ_STRNLEN + fi gl_STRING_MODULE_INDICATOR([strnlen]) - # Code from module strnlen1: - # Code from module sys_wait: - gl_SYS_WAIT_H + gl_SYS_TYPES_H AC_PROG_MKDIR_P - # Code from module sysexits: gl_SYSEXITS - # Code from module unistd: gl_UNISTD_H - # Code from module vasnprintf: + gl_LIBUNISTRING_LIBHEADER([0.9], [unitypes.h]) + gl_LIBUNISTRING_LIBHEADER([0.9], [uniwidth.h]) + gl_LIBUNISTRING_MODULE([0.9.4], [uniwidth/width]) gl_FUNC_VASNPRINTF - # Code from module verify: - # Code from module vsnprintf: gl_FUNC_VSNPRINTF gl_STDIO_MODULE_INDICATOR([vsnprintf]) - # Code from module warn-on-use: - # Code from module wchar: gl_WCHAR_H - # Code from module wcrtomb: gl_FUNC_WCRTOMB + if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then + AC_LIBOBJ([wcrtomb]) + gl_PREREQ_WCRTOMB + fi gl_WCHAR_MODULE_INDICATOR([wcrtomb]) - # Code from module wctype: gl_WCTYPE_H - # Code from module xsize: + gl_FUNC_WCWIDTH + if test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1; then + AC_LIBOBJ([wcwidth]) + fi + gl_WCHAR_MODULE_INDICATOR([wcwidth]) gl_XSIZE # End of code from modules m4_ifval(gl_LIBSOURCES_LIST, [ @@ -404,10 +519,11 @@ AC_DEFUN([gltests_LIBSOURCES], [ # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ - build-aux/arg-nonnull.h - build-aux/c++defs.h build-aux/config.rpath - build-aux/warn-on-use.h + build-aux/snippet/_Noreturn.h + build-aux/snippet/arg-nonnull.h + build-aux/snippet/c++defs.h + build-aux/snippet/warn-on-use.h lib/alloca.c lib/alloca.in.h lib/argp-ba.c @@ -429,10 +545,12 @@ AC_DEFUN([gl_FILE_LIST], [ lib/config.charset lib/dirname-lgpl.c lib/dirname.h + lib/dosname.h lib/errno.in.h lib/error.c lib/error.h lib/float+.h + lib/float.c lib/float.in.h lib/fnmatch.c lib/fnmatch.in.h @@ -445,17 +563,29 @@ AC_DEFUN([gl_FILE_LIST], [ lib/getopt_int.h lib/gettext.h lib/intprops.h + lib/itold.c lib/langinfo.in.h lib/localcharset.c lib/localcharset.h + lib/locale.in.h + lib/localeconv.c lib/malloc.c lib/mbrtowc.c lib/mbsinit.c + lib/mbsrtowcs-impl.h lib/mbsrtowcs-state.c lib/mbsrtowcs.c + lib/mbswidth.c + lib/mbswidth.h + lib/mbtowc-impl.h + lib/mbtowc.c lib/memchr.c lib/memchr.valgrind lib/mempcpy.c + lib/msvc-inval.c + lib/msvc-inval.h + lib/msvc-nothrow.c + lib/msvc-nothrow.h lib/nl_langinfo.c lib/printf-args.c lib/printf-args.h @@ -476,16 +606,18 @@ AC_DEFUN([gl_FILE_LIST], [ lib/regexec.c lib/size_max.h lib/sleep.c + lib/stdalign.in.h lib/stdbool.in.h lib/stddef.in.h lib/stdint.in.h - lib/stdio-write.c lib/stdio.in.h lib/stdlib.in.h lib/strcasecmp.c lib/strchrnul.c lib/strchrnul.valgrind lib/streq.h + lib/strerror-override.c + lib/strerror-override.h lib/strerror.c lib/string.in.h lib/strings.in.h @@ -495,29 +627,39 @@ AC_DEFUN([gl_FILE_LIST], [ lib/strnlen.c lib/strnlen1.c lib/strnlen1.h - lib/sys_wait.in.h + lib/sys_types.in.h lib/sysexits.in.h + lib/unistd.c lib/unistd.in.h + lib/unitypes.in.h + lib/uniwidth.in.h + lib/uniwidth/cjk.h + lib/uniwidth/width.c lib/vasnprintf.c lib/vasnprintf.h lib/verify.h lib/vsnprintf.c lib/wchar.in.h lib/wcrtomb.c + lib/wctype-h.c lib/wctype.in.h + lib/wcwidth.c + lib/xsize.c lib/xsize.h m4/00gnulib.m4 m4/alloca.m4 m4/argp.m4 - m4/asm-underscore.m4 m4/btowc.m4 m4/codeset.m4 + m4/configmake.m4 m4/dirname.m4 - m4/dos.m4 m4/double-slash-root.m4 + m4/eealloc.m4 m4/errno_h.m4 m4/error.m4 + m4/exponentd.m4 m4/extensions.m4 + m4/extern-inline.m4 m4/fcntl-o.m4 m4/float_h.m4 m4/fnmatch.m4 @@ -543,23 +685,33 @@ AC_DEFUN([gl_FILE_LIST], [ m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 + m4/libunistring-base.m4 m4/localcharset.m4 m4/locale-fr.m4 m4/locale-ja.m4 m4/locale-zh.m4 + m4/locale_h.m4 + m4/localeconv.m4 m4/lock.m4 m4/longlong.m4 m4/malloc.m4 + m4/math_h.m4 m4/mbrtowc.m4 m4/mbsinit.m4 m4/mbsrtowcs.m4 m4/mbstate_t.m4 + m4/mbswidth.m4 + m4/mbtowc.m4 m4/memchr.m4 m4/mempcpy.m4 m4/mmap-anon.m4 + m4/msvc-inval.m4 + m4/msvc-nothrow.m4 m4/multiarch.m4 m4/nl_langinfo.m4 m4/nls.m4 + m4/nocrash.m4 + m4/off_t.m4 m4/po.m4 m4/printf-posix.m4 m4/printf.m4 @@ -570,6 +722,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/size_max.m4 m4/sleep.m4 m4/ssize_t.m4 + m4/stdalign.m4 m4/stdbool.m4 m4/stddef_h.m4 m4/stdint.m4 @@ -583,7 +736,8 @@ AC_DEFUN([gl_FILE_LIST], [ m4/strings_h.m4 m4/strndup.m4 m4/strnlen.m4 - m4/sys_wait_h.m4 + m4/sys_socket_h.m4 + m4/sys_types_h.m4 m4/sysexits.m4 m4/threadlib.m4 m4/uintmax_t.m4 @@ -596,6 +750,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/wchar_t.m4 m4/wcrtomb.m4 m4/wctype_h.m4 + m4/wcwidth.m4 m4/wint_t.m4 m4/xsize.m4 ]) diff --git a/m4/gnulib-tool.m4 b/m4/gnulib-tool.m4 index 69e7733b9..f3dea1a9f 100644 --- a/m4/gnulib-tool.m4 +++ b/m4/gnulib-tool.m4 @@ -1,5 +1,5 @@ # gnulib-tool.m4 serial 2 -dnl Copyright (C) 2004-2005, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2005, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/iconv.m4 b/m4/iconv.m4 index 425145c0a..a50364656 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -1,5 +1,5 @@ -# iconv.m4 serial 15 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc. +# iconv.m4 serial 18 (gettext-0.18.2) +dnl Copyright (C) 2000-2002, 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -78,6 +78,7 @@ AC_DEFUN([AM_ICONV_LINK], #include int main () { + int result = 0; /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { @@ -94,7 +95,8 @@ int main () (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) - return 1; + result |= 1; + iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from @@ -113,7 +115,8 @@ int main () (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) - return 1; + result |= 2; + iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ @@ -131,7 +134,8 @@ int main () (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) - return 1; + result |= 4; + iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ @@ -150,7 +154,8 @@ int main () (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) - return 1; + result |= 8; + iconv_close (cd_88591_to_utf8); } } #endif @@ -164,8 +169,8 @@ int main () && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) /* Try HP-UX names. */ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) - return 1; - return 0; + result |= 16; + return result; }]])], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], @@ -237,7 +242,7 @@ extern #ifdef __cplusplus "C" #endif -#if defined(__STDC__) || defined(__cplusplus) +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); @@ -252,5 +257,12 @@ size_t iconv(); $am_cv_proto_iconv]) AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], [Define as const if the declaration of iconv() needs const.]) + dnl Also substitute ICONV_CONST in the gnulib generated . + m4_ifdef([gl_ICONV_H_DEFAULTS], + [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + if test -n "$am_cv_proto_iconv_arg1"; then + ICONV_CONST="const" + fi + ]) fi ]) diff --git a/m4/include_next.m4 b/m4/include_next.m4 index 51a719b0a..108d94567 100644 --- a/m4/include_next.m4 +++ b/m4/include_next.m4 @@ -1,5 +1,5 @@ -# include_next.m4 serial 15 -dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. +# include_next.m4 serial 23 +dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -24,6 +24,13 @@ dnl does not warn about some things, and on some systems (Solaris and Interix) dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead dnl of plain '__STDC__'. +dnl +dnl PRAGMA_COLUMNS can be used in files that override system header files, so +dnl as to avoid compilation errors on HP NonStop systems when the gnulib file +dnl is included by a system header file that does a "#pragma COLUMNS 80" (which +dnl has the effect of truncating the lines of that file and all files that it +dnl includes to 80 columns) and the gnulib file has lines longer than 80 +dnl columns. AC_DEFUN([gl_INCLUDE_NEXT], [ @@ -98,6 +105,24 @@ dnl We intentionally avoid using AC_LANG_SOURCE here. AC_SUBST([INCLUDE_NEXT]) AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) AC_SUBST([PRAGMA_SYSTEM_HEADER]) + AC_CACHE_CHECK([whether system header files limit the line length], + [gl_cv_pragma_columns], + [dnl HP NonStop systems, which define __TANDEM, have this misfeature. + AC_EGREP_CPP([choke me], + [ +#ifdef __TANDEM +choke me +#endif + ], + [gl_cv_pragma_columns=yes], + [gl_cv_pragma_columns=no]) + ]) + if test $gl_cv_pragma_columns = yes; then + PRAGMA_COLUMNS="#pragma COLUMNS 10000" + else + PRAGMA_COLUMNS= + fi + AC_SUBST([PRAGMA_COLUMNS]) ]) # gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) @@ -118,68 +143,121 @@ dnl We intentionally avoid using AC_LANG_SOURCE here. # even if the compiler does not support include_next. # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". -# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. +# Use '""', not '<>', so that the /// cannot be confused with a C99 comment. # Note: This macro assumes that the header file is not empty after # preprocessing, i.e. it does not only define preprocessor macros but also # provides some type/enum definitions or function/variable declarations. +# +# This macro also checks whether each header exists, by invoking +# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument. AC_DEFUN([gl_CHECK_NEXT_HEADERS], +[ + gl_NEXT_HEADERS_INTERNAL([$1], [check]) +]) + +# gl_NEXT_HEADERS(HEADER1 HEADER2 ...) +# ------------------------------------ +# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist. +# This is suitable for headers like that are standardized by C89 +# and therefore can be assumed to exist. +AC_DEFUN([gl_NEXT_HEADERS], +[ + gl_NEXT_HEADERS_INTERNAL([$1], [assume]) +]) + +# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS. +AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], [ AC_REQUIRE([gl_INCLUDE_NEXT]) AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_HEADERS_ONCE([$1]) + m4_if([$2], [check], + [AC_CHECK_HEADERS_ONCE([$1]) + ]) + +dnl FIXME: gl_next_header and gl_header_exists must be used unquoted +dnl until we can assume autoconf 2.64 or newer. m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], [gl_cv_next_]m4_defn([gl_HEADER_NAME])) if test $gl_cv_have_include_next = yes; then - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) else AC_CACHE_CHECK( [absolute name of <]m4_defn([gl_HEADER_NAME])[>], m4_defn([gl_next_header]), - [AS_VAR_PUSHDEF([gl_header_exists], - [ac_cv_header_]m4_defn([gl_HEADER_NAME])) - if test AS_VAR_GET(gl_header_exists) = yes; then - AC_LANG_CONFTEST( - [AC_LANG_SOURCE( - [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] - )]) - dnl AIX "xlc -E" and "cc -E" omit #line directives for header files - dnl that contain only a #include of other header files and no - dnl non-comment tokens of their own. This leads to a failure to - dnl detect the absolute name of , , - dnl and others. The workaround is to force preservation of comments - dnl through option -C. This ensures all necessary #line directives - dnl are present. GCC supports option -C as well. - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - dnl eval is necessary to expand gl_absname_cpp. - dnl Ultrix and Pyramid sh refuse to redirect output of eval, - dnl so use subshell. - AS_VAR_SET([gl_next_header], - ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | - sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ - s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"']) - else - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) - fi - AS_VAR_POPDEF([gl_header_exists])]) + [m4_if([$2], [check], + [AS_VAR_PUSHDEF([gl_header_exists], + [ac_cv_header_]m4_defn([gl_HEADER_NAME])) + if test AS_VAR_GET(gl_header_exists) = yes; then + AS_VAR_POPDEF([gl_header_exists]) + ]) + AC_LANG_CONFTEST( + [AC_LANG_SOURCE( + [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] + )]) + dnl AIX "xlc -E" and "cc -E" omit #line directives for header + dnl files that contain only a #include of other header files and + dnl no non-comment tokens of their own. This leads to a failure + dnl to detect the absolute name of , , + dnl and others. The workaround is to force preservation + dnl of comments through option -C. This ensures all necessary + dnl #line directives are present. GCC supports option -C as well. + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac +changequote(,) + case "$host_os" in + mingw*) + dnl For the sake of native Windows compilers (excluding gcc), + dnl treat backslash as a directory separator, like /. + dnl Actually, these compilers use a double-backslash as + dnl directory separator, inside the + dnl # line "filename" + dnl directives. + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + dnl A sed expression that turns a string into a basic regular + dnl expression, for use within "/.../". + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' +changequote([,]) + gl_header_literal_regex=`echo ']m4_defn([gl_HEADER_NAME])[' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ +changequote(,)dnl + s|^/[^/]|//&| +changequote([,])dnl + p + q + }' + dnl eval is necessary to expand gl_absname_cpp. + dnl Ultrix and Pyramid sh refuse to redirect output of eval, + dnl so use subshell. + AS_VAR_SET(gl_next_header, + ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + sed -n "$gl_absolute_header_sed"`'"']) + m4_if([$2], [check], + [else + AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) + fi + ]) + ]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), - [AS_VAR_GET([gl_next_header])]) + [AS_VAR_GET(gl_next_header)]) if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'gl_HEADER_NAME'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) + gl_next_as_first_directive=AS_VAR_GET(gl_next_header) fi AC_SUBST( AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4 index 9b27ff1b7..74d0e80d2 100644 --- a/m4/intdiv0.m4 +++ b/m4/intdiv0.m4 @@ -1,5 +1,5 @@ -# intdiv0.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002, 2007-2008, 2010 Free Software Foundation, Inc. +# intdiv0.m4 serial 6 (gettext-0.18.2) +dnl Copyright (C) 2002, 2007-2008, 2010-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,7 +18,7 @@ AC_DEFUN([gt_INTDIV0], changequote(,)dnl case "$host_os" in macos* | darwin[6-9]* | darwin[1-9][0-9]*) - # On MacOS X 10.2 or newer, just assume the same as when cross- + # On Mac OS X 10.2 or newer, just assume the same as when cross- # compiling. If we were to perform the real test, 1 Crash Report # dialog window would pop up. case "$host_cpu" in @@ -60,7 +60,7 @@ int main () z = x / y; nan = y / y; - exit (1); + exit (2); } ]])], [gt_cv_int_divbyzero_sigfpe=yes], diff --git a/m4/intl.m4 b/m4/intl.m4 index d84bc4a9b..486b5cc64 100644 --- a/m4/intl.m4 +++ b/m4/intl.m4 @@ -1,5 +1,5 @@ -# intl.m4 serial 17b -dnl Copyright (C) 1995-2010 Free Software Foundation, Inc. +# intl.m4 serial 22 (gettext-0.18.2) +dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -17,7 +17,7 @@ dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2009. -AC_PREREQ([2.53]) +AC_PREREQ([2.60]) dnl Checks for all prerequisites of the intl subdirectory, dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, @@ -25,7 +25,7 @@ dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. AC_DEFUN([AM_INTL_SUBDIR], [ AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + AC_REQUIRE([AC_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([gt_GLIBC2])dnl @@ -55,7 +55,7 @@ AC_DEFUN([AM_INTL_SUBDIR], [AC_DEFINE([ptrdiff_t], [long], [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) ]) - AC_CHECK_HEADERS([stddef.h stdlib.h string.h]) + AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h]) AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \ snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) @@ -295,6 +295,6 @@ AC_DEFUN([gt_CHECK_DECL], else gt_value=0 fi - AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], - [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) + AC_DEFINE_UNQUOTED([HAVE_DECL_]m4_translit($1, [a-z], [A-Z]), [$gt_value], + [Define to 1 if you have the declaration of '$1', and to 0 if you don't.]) ]) diff --git a/m4/intldir.m4 b/m4/intldir.m4 index ebae76d36..388ecd6fd 100644 --- a/m4/intldir.m4 +++ b/m4/intldir.m4 @@ -1,5 +1,5 @@ # intldir.m4 serial 2 (gettext-0.18) -dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/intlmacosx.m4 b/m4/intlmacosx.m4 index f0f7c9872..ab97d39f9 100644 --- a/m4/intlmacosx.m4 +++ b/m4/intlmacosx.m4 @@ -1,5 +1,5 @@ -# intlmacosx.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2004-2010 Free Software Foundation, Inc. +# intlmacosx.m4 serial 5 (gettext-0.18.2) +dnl Copyright (C) 2004-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -13,11 +13,11 @@ dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package package is covered by the GNU General Public License. dnl They are *not* in the public domain. -dnl Checks for special options needed on MacOS X. +dnl Checks for special options needed on Mac OS X. dnl Defines INTL_MACOSX_LIBS. AC_DEFUN([gt_INTL_MACOSX], [ - dnl Check for API introduced in MacOS X 10.2. + dnl Check for API introduced in Mac OS X 10.2. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], [gt_cv_func_CFPreferencesCopyAppValue], [gt_save_LIBS="$LIBS" @@ -31,9 +31,9 @@ AC_DEFUN([gt_INTL_MACOSX], LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], - [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) + [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi - dnl Check for API introduced in MacOS X 10.3. + dnl Check for API introduced in Mac OS X 10.3. AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" @@ -46,7 +46,7 @@ AC_DEFUN([gt_INTL_MACOSX], LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFLocaleCopyCurrent = yes; then AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], - [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) + [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then diff --git a/m4/intmax.m4 b/m4/intmax.m4 index 2c0f2afe5..18733a52e 100644 --- a/m4/intmax.m4 +++ b/m4/intmax.m4 @@ -1,5 +1,5 @@ # intmax.m4 serial 6 (gettext-0.18.2) -dnl Copyright (C) 2002-2005, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2005, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/intmax_t.m4 b/m4/intmax_t.m4 index 493e4a932..6ea70531c 100644 --- a/m4/intmax_t.m4 +++ b/m4/intmax_t.m4 @@ -1,5 +1,5 @@ # intmax_t.m4 serial 8 -dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation, +dnl Copyright (C) 1997-2004, 2006-2007, 2009-2013 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4 index ee96bcd97..e5a1e0571 100644 --- a/m4/inttypes-pri.m4 +++ b/m4/inttypes-pri.m4 @@ -1,5 +1,5 @@ # inttypes-pri.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1997-2002, 2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2002, 2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4 index 9d8f92692..5f05ac58c 100644 --- a/m4/inttypes_h.m4 +++ b/m4/inttypes_h.m4 @@ -1,5 +1,5 @@ # inttypes_h.m4 serial 10 -dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/langinfo_h.m4 b/m4/langinfo_h.m4 index adc445e85..73bef8bce 100644 --- a/m4/langinfo_h.m4 +++ b/m4/langinfo_h.m4 @@ -1,5 +1,5 @@ # langinfo_h.m4 serial 7 -dnl Copyright (C) 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4 index 232da73b6..d62a175fc 100644 --- a/m4/lcmessage.m4 +++ b/m4/lcmessage.m4 @@ -1,5 +1,5 @@ # lcmessage.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation, +dnl Copyright (C) 1995-2002, 2004-2005, 2008-2013 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 index 294db72e1..c145e478e 100644 --- a/m4/lib-ld.m4 +++ b/m4/lib-ld.m4 @@ -1,33 +1,39 @@ -# lib-ld.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc. +# lib-ld.m4 serial 6 +dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. +dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid +dnl collision with libtool.m4. -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +[# I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 /dev/null 2>&1; do + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` + while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" @@ -78,23 +85,26 @@ else fi AC_CACHE_VAL([acl_cv_path_LD], [if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do + IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + case `"$acl_cv_path_LD" -v 2>&1 = the given VERSION. +dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is +dnl true if the source files of Module should be compiled. +dnl This macro is to be used for public libunistring API, not for +dnl undocumented API. +dnl +dnl You have to bump the VERSION argument to the next projected version +dnl number each time you make a change that affects the behaviour of the +dnl functions defined in Module (even if the sources of Module itself do not +dnl change). + +AC_DEFUN([gl_LIBUNISTRING_MODULE], +[ + AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) + dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from + dnl gl_LIBUNISTRING_CORE if that macro has been run. + AM_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]), + [gl_LIBUNISTRING_VERSION_CMP([$1])]) +]) + +dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile]) +dnl Declares that HeaderFile should be created, unless we are linking +dnl with libunistring and its version is >= the given VERSION. +dnl HeaderFile should be relative to the lib directory and end in '.h'. +dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty). +dnl +dnl When we are linking with the already installed libunistring and its version +dnl is < VERSION, we create HeaderFile here, because we may compile functions +dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed +dnl version. +dnl When we are linking with the already installed libunistring and its version +dnl is > VERSION, we don't create HeaderFile here: it could cause compilation +dnl errors in other libunistring header files if some types are missing. +dnl +dnl You have to bump the VERSION argument to the next projected version +dnl number each time you make a non-comment change to the HeaderFile. + +AC_DEFUN([gl_LIBUNISTRING_LIBHEADER], +[ + AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) + dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from + dnl gl_LIBUNISTRING_CORE if that macro has been run. + if gl_LIBUNISTRING_VERSION_CMP([$1]); then + LIBUNISTRING_[]AS_TR_CPP([$2])='$2' + else + LIBUNISTRING_[]AS_TR_CPP([$2])= + fi + AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2])) +]) + +dnl Miscellaneous preparations/initializations. + +AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE], +[ + dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point. + m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])]) + + AC_REQUIRE([AC_PROG_AWK]) + +dnl Sed expressions to extract the parts of a version number. +changequote(,) +gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +changequote([,]) + + if test "$HAVE_LIBUNISTRING" = yes; then + LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"` + LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"` + LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"` + fi +]) + +dnl gl_LIBUNISTRING_VERSION_CMP([VERSION]) +dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION +dnl is less than the VERSION argument. +AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP], +[ { test "$HAVE_LIBUNISTRING" != yes \ + || { + dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least. + AS_LITERAL_IF([$1], + [dnl This is the optimized variant, that assumes the argument is a literal: + m4_pushdef([requested_version_major], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])]) + m4_pushdef([requested_version_minor], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) + m4_pushdef([requested_version_subminor], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) + test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \ + && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \ + || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor + } + } + } + m4_popdef([requested_version_subminor]) + m4_popdef([requested_version_minor]) + m4_popdef([requested_version_major]) + ], + [dnl This is the unoptimized variant: + requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"` + requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"` + requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"` + test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \ + && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \ + || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor + } + } + } + ]) + } + }]) + +dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the +dnl same as ORIG, otherwise to 0. +m4_define([gl_LIBUNISTRING_ARG_OR_ZERO], [m4_if([$1], [$2], [0], [$1])]) diff --git a/m4/localcharset.m4 b/m4/localcharset.m4 index ee2e801bd..2e93e5818 100644 --- a/m4/localcharset.m4 +++ b/m4/localcharset.m4 @@ -1,5 +1,5 @@ # localcharset.m4 serial 7 -dnl Copyright (C) 2002, 2004, 2006, 2009, 2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004, 2006, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/locale-fr.m4 b/m4/locale-fr.m4 index 001f53906..ef199e397 100644 --- a/m4/locale-fr.m4 +++ b/m4/locale-fr.m4 @@ -1,5 +1,5 @@ -# locale-fr.m4 serial 11 -dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. +# locale-fr.m4 serial 17 +dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -25,17 +25,30 @@ struct tm t; char buf[16]; int main () { /* Check whether the given locale name is recognized by the system. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +#else if (setlocale (LC_ALL, "") == NULL) return 1; +#endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) return 1; } #endif @@ -50,46 +63,67 @@ int main () { one byte long. This excludes the UTF-8 encoding. */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; +#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; +#endif return 0; } changequote([,])dnl ])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the usual locale name. - if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr_FR - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr_FR.ISO-8859-1 - else - # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. - if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr_FR.ISO8859-1 + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Test for the native Windows locale name. + if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=French_France.1252 else - # Test for the HP-UX locale name. - if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr_FR.iso88591 + # None found. + gt_cv_locale_fr=none + fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the usual locale name. + if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.ISO-8859-1 else - # Test for the Solaris 7 locale name. - if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr + # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. + if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.ISO8859-1 else - # None found. - gt_cv_locale_fr=none + # Test for the HP-UX locale name. + if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.iso88591 + else + # Test for the Solaris 7 locale name. + if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr + else + # None found. + gt_cv_locale_fr=none + fi + fi fi fi fi - fi - fi + ;; + esac fi rm -fr conftest* ]) @@ -119,9 +153,19 @@ int main () { variables, and all locales use the UTF-8 encoding. */ #if !(defined __BEOS__ || defined __HAIKU__) /* Check whether the given locale name is recognized by the system. */ +# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else if (setlocale (LC_ALL, "") == NULL) return 1; +# endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, @@ -147,36 +191,57 @@ int main () { || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') return 1; #endif +#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; +#endif return 0; } changequote([,])dnl ])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the usual locale name. - if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR.UTF-8 - else - # Test for the Solaris 7 locale name. - if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr.UTF-8 + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi - fi - fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the usual locale name. + if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR.UTF-8 + else + # Test for the Solaris 7 locale name. + if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr.UTF-8 + else + # None found. + gt_cv_locale_fr_utf8=none + fi + fi + fi + ;; + esac fi rm -fr conftest* ]) diff --git a/m4/locale-ja.m4 b/m4/locale-ja.m4 index 0eedaf149..132a3e779 100644 --- a/m4/locale-ja.m4 +++ b/m4/locale-ja.m4 @@ -1,5 +1,5 @@ -# locale-ja.m4 serial 7 -dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. +# locale-ja.m4 serial 12 +dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -27,17 +27,30 @@ int main () { const char *p; /* Check whether the given locale name is recognized by the system. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +#else if (setlocale (LC_ALL, "") == NULL) return 1; +#endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) return 1; } #endif @@ -52,7 +65,7 @@ int main () if (MB_CUR_MAX == 1) return 1; /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding. */ + This excludes the UTF-8 encoding (except on MirBSD). */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) @@ -63,42 +76,58 @@ int main () changequote([,])dnl ])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the AIX locale name. - if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.EUC-JP - else - # Test for the HP-UX, OSF/1, NetBSD locale name. - if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.eucJP + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Note that on native Windows, the Japanese locale is + # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we + # cannot use it here. + gt_cv_locale_ja=none + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the AIX locale name. + if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP else - # Test for the IRIX, FreeBSD locale name. - if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.EUC + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.EUC-JP else - # Test for the Solaris 7 locale name. - if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja + # Test for the HP-UX, OSF/1, NetBSD locale name. + if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.eucJP else - # Special test for NetBSD 1.6. - if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then - gt_cv_locale_ja=ja_JP.eucJP + # Test for the IRIX, FreeBSD locale name. + if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.EUC else - # None found. - gt_cv_locale_ja=none + # Test for the Solaris 7 locale name. + if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja + else + # Special test for NetBSD 1.6. + if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then + gt_cv_locale_ja=ja_JP.eucJP + else + # None found. + gt_cv_locale_ja=none + fi + fi fi fi fi fi - fi - fi + ;; + esac fi rm -fr conftest* ]) diff --git a/m4/locale-zh.m4 b/m4/locale-zh.m4 index 777fd1418..4eed73f40 100644 --- a/m4/locale-zh.m4 +++ b/m4/locale-zh.m4 @@ -1,5 +1,5 @@ -# locale-zh.m4 serial 6 -dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc. +# locale-zh.m4 serial 12 +dnl Copyright (C) 2003, 2005-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -28,17 +28,30 @@ int main () { const char *p; /* Check whether the given locale name is recognized by the system. */ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +#else if (setlocale (LC_ALL, "") == NULL) return 1; +#endif /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On MacOS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) is empty, and the behaviour of Tcl 8.4 in this locale is not useful. On OpenBSD 4.0, when an unsupported locale is specified, setlocale() succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ #if HAVE_LANGINFO_CODESET { const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) return 1; } #endif @@ -49,7 +62,7 @@ int main () if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; #endif /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding. */ + This excludes the UTF-8 encoding (except on MirBSD). */ t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; for (p = buf; *p != '\0'; p++) @@ -64,22 +77,47 @@ int main () changequote([,])dnl ])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the locale name without encoding suffix. - if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=zh_CN - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=zh_CN.GB18030 - else - # None found. + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=Chinese_China.54936 + else + # None found. + gt_cv_locale_zh_CN=none + fi + ;; + solaris2.8) + # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are + # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. + # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. gt_cv_locale_zh_CN=none - fi - fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the locale name without encoding suffix. + if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=zh_CN + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=zh_CN.GB18030 + else + # None found. + gt_cv_locale_zh_CN=none + fi + fi + ;; + esac else # If there was a link error, due to mblen(), the system is so old that # it certainly doesn't have a chinese locale. diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 new file mode 100644 index 000000000..8bd12e80e --- /dev/null +++ b/m4/locale_h.m4 @@ -0,0 +1,122 @@ +# locale_h.m4 serial 19 +dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_LOCALE_H], +[ + dnl Use AC_REQUIRE here, so that the default behavior below is expanded + dnl once only, before all statements that occur in other macros. + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + + dnl Persuade glibc to define locale_t and the int_p_*, int_n_* + dnl members of 'struct lconv'. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + dnl If is replaced, then must also be replaced. + AC_REQUIRE([gl_STDDEF_H]) + + dnl Solaris 11 2011-11 defines the int_p_*, int_n_* members of 'struct lconv' + dnl only if _LCONV_C99 is defined. + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + solaris*) + AC_DEFINE([_LCONV_C99], [1], [Define to 1 on Solaris.]) + ;; + esac + + AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001], + [gl_cv_header_locale_h_posix2001], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = LC_MESSAGES; + int y = sizeof (((struct lconv *) 0)->decimal_point);]], + [[]])], + [gl_cv_header_locale_h_posix2001=yes], + [gl_cv_header_locale_h_posix2001=no])]) + + dnl Check for . + AC_CHECK_HEADERS_ONCE([xlocale.h]) + if test $ac_cv_header_xlocale_h = yes; then + HAVE_XLOCALE_H=1 + dnl Check whether use of locale_t requires inclusion of , + dnl e.g. on Mac OS X 10.5. If does not define locale_t by + dnl itself, we assume that will do so. + AC_CACHE_CHECK([whether locale.h defines locale_t], + [gl_cv_header_locale_has_locale_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + locale_t x;]], + [[]])], + [gl_cv_header_locale_has_locale_t=yes], + [gl_cv_header_locale_has_locale_t=no]) + ]) + if test $gl_cv_header_locale_has_locale_t = yes; then + gl_cv_header_locale_h_needs_xlocale_h=no + else + gl_cv_header_locale_h_needs_xlocale_h=yes + fi + else + HAVE_XLOCALE_H=0 + gl_cv_header_locale_h_needs_xlocale_h=no + fi + AC_SUBST([HAVE_XLOCALE_H]) + + dnl Check whether 'struct lconv' is complete. + dnl Bionic libc's 'struct lconv' is just a dummy. + dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x, + dnl mingw, MSVC 9, it lacks the int_p_* and int_n_* members. + AC_CACHE_CHECK([whether struct lconv is properly defined], + [gl_cv_sys_struct_lconv_ok], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + struct lconv l; + int x = sizeof (l.decimal_point); + int y = sizeof (l.int_p_cs_precedes);]], + [[]])], + [gl_cv_sys_struct_lconv_ok=yes], + [gl_cv_sys_struct_lconv_ok=no]) + ]) + if test $gl_cv_sys_struct_lconv_ok = no; then + REPLACE_STRUCT_LCONV=1 + fi + + dnl is always overridden, because of GNULIB_POSIXCHECK. + gl_NEXT_HEADERS([locale.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include +/* Some systems provide declarations in a non-standard header. */ +#if HAVE_XLOCALE_H +# include +#endif + ]], + [setlocale duplocale]) +]) + +AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_LOCALE_H_DEFAULTS], +[ + GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV]) + GNULIB_SETLOCALE=0; AC_SUBST([GNULIB_SETLOCALE]) + GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) + REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) + REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) + REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) + REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) +]) diff --git a/m4/localeconv.m4 b/m4/localeconv.m4 new file mode 100644 index 000000000..b8bb5964b --- /dev/null +++ b/m4/localeconv.m4 @@ -0,0 +1,22 @@ +# localeconv.m4 serial 1 +dnl Copyright (C) 2012-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_LOCALECONV], +[ + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + AC_REQUIRE([gl_LOCALE_H]) + + if test $REPLACE_STRUCT_LCONV = 1; then + REPLACE_LOCALECONV=1 + fi +]) + +# Prerequisites of lib/localeconv.c. +AC_DEFUN([gl_PREREQ_LOCALECONV], +[ + AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [], + [[#include ]]) +]) diff --git a/m4/lock.m4 b/m4/lock.m4 index f71c66459..d3fc1eff0 100644 --- a/m4/lock.m4 +++ b/m4/lock.m4 @@ -1,5 +1,5 @@ -# lock.m4 serial 11 (gettext-0.18.2) -dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. +# lock.m4 serial 13 (gettext-0.18.2) +dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,7 +10,7 @@ AC_DEFUN([gl_LOCK], [ AC_REQUIRE([gl_THREADLIB]) if test "$gl_threads_api" = posix; then - # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the + # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the # pthread_rwlock_* functions. AC_CHECK_TYPE([pthread_rwlock_t], [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], @@ -35,7 +35,5 @@ return !x; gl_PREREQ_LOCK ]) -# Prerequisites of lib/lock.c. -AC_DEFUN([gl_PREREQ_LOCK], [ - AC_REQUIRE([AC_C_INLINE]) -]) +# Prerequisites of lib/glthread/lock.c. +AC_DEFUN([gl_PREREQ_LOCK], [:]) diff --git a/m4/longlong.m4 b/m4/longlong.m4 index cca3c1a90..3af6ab5aa 100644 --- a/m4/longlong.m4 +++ b/m4/longlong.m4 @@ -1,5 +1,5 @@ -# longlong.m4 serial 14 -dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc. +# longlong.m4 serial 17 +dnl Copyright (C) 1999-2007, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.61, but can be removed once we -# assume 2.62 everywhere. +# This fixes a bug in Autoconf 2.61, and can be faster +# than what's in Autoconf 2.62 through 2.68. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be @@ -16,44 +16,48 @@ dnl From Paul Eggert. AC_DEFUN([AC_TYPE_LONG_LONG_INT], [ + AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], - [AC_LINK_IFELSE( - [_AC_TYPE_LONG_LONG_SNIPPET], - [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. - dnl If cross compiling, assume the bug isn't important, since - dnl nobody cross compiles for this platform as far as we know. - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[@%:@include - @%:@ifndef LLONG_MAX - @%:@ define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - @%:@ define LLONG_MAX (HALF - 1 + HALF) - @%:@endif]], - [[long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0;]])], - [ac_cv_type_long_long_int=yes], - [ac_cv_type_long_long_int=no], - [ac_cv_type_long_long_int=yes])], - [ac_cv_type_long_long_int=no])]) + [ac_cv_type_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int + if test $ac_cv_type_long_long_int = yes; then + dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. + dnl If cross compiling, assume the bug is not important, since + dnl nobody cross compiles for this platform as far as we know. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include + @%:@ifndef LLONG_MAX + @%:@ define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + @%:@ define LLONG_MAX (HALF - 1 + HALF) + @%:@endif]], + [[long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0;]])], + [], + [ac_cv_type_long_long_int=no], + [:]) + fi + fi]) if test $ac_cv_type_long_long_int = yes; then AC_DEFINE([HAVE_LONG_LONG_INT], [1], - [Define to 1 if the system has the type `long long int'.]) + [Define to 1 if the system has the type 'long long int'.]) fi ]) # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.61, but can be removed once we -# assume 2.62 everywhere. +# This fixes a bug in Autoconf 2.61, and can be faster +# than what's in Autoconf 2.62 through 2.68. # Note: If the type 'unsigned long long int' exists but is only 32 bits # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT @@ -64,13 +68,16 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ AC_CACHE_CHECK([for unsigned long long int], [ac_cv_type_unsigned_long_long_int], - [AC_LINK_IFELSE( - [_AC_TYPE_LONG_LONG_SNIPPET], - [ac_cv_type_unsigned_long_long_int=yes], - [ac_cv_type_unsigned_long_long_int=no])]) + [ac_cv_type_unsigned_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [], + [ac_cv_type_unsigned_long_long_int=no]) + fi]) if test $ac_cv_type_unsigned_long_long_int = yes; then AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], - [Define to 1 if the system has the type `unsigned long long int'.]) + [Define to 1 if the system has the type 'unsigned long long int'.]) fi ]) diff --git a/m4/malloc.m4 b/m4/malloc.m4 index 7a749254a..4b24a0b11 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -1,9 +1,47 @@ -# malloc.m4 serial 12 -dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +# malloc.m4 serial 14 +dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +m4_version_prereq([2.70], [] ,[ + +# This is taken from the following Autoconf patch: +# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 +AC_DEFUN([_AC_FUNC_MALLOC_IF], +[ + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles + AC_CHECK_HEADERS([stdlib.h]) + AC_CACHE_CHECK([for GNU libc compatible malloc], + [ac_cv_func_malloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H + # include + #else + char *malloc (); + #endif + ]], + [[return ! malloc (0);]]) + ], + [ac_cv_func_malloc_0_nonnull=yes], + [ac_cv_func_malloc_0_nonnull=no], + [case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* \ + | hpux* | solaris* | cygwin* | mingw*) + ac_cv_func_malloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_malloc_0_nonnull=no ;; + esac + ]) + ]) + AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2]) +])# _AC_FUNC_MALLOC_IF + +]) + # gl_FUNC_MALLOC_GNU # ------------------ # Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if @@ -17,7 +55,7 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU], [Define to 1 if your system has a GNU libc compatible 'malloc' function, and to 0 otherwise.])], [AC_DEFINE([HAVE_MALLOC_GNU], [0]) - gl_REPLACE_MALLOC + REPLACE_MALLOC=1 ]) ]) @@ -33,7 +71,7 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX], AC_DEFINE([HAVE_MALLOC_POSIX], [1], [Define if the 'malloc' function is POSIX compliant.]) else - gl_REPLACE_MALLOC + REPLACE_MALLOC=1 fi ]) @@ -58,9 +96,3 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX], [gl_cv_func_malloc_posix=no]) ]) ]) - -AC_DEFUN([gl_REPLACE_MALLOC], -[ - AC_LIBOBJ([malloc]) - REPLACE_MALLOC=1 -]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 new file mode 100644 index 000000000..bf0845fd1 --- /dev/null +++ b/m4/math_h.m4 @@ -0,0 +1,353 @@ +# math_h.m4 serial 114 +dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MATH_H], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([math.h]) + + AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[/* Solaris 10 has a broken definition of NAN. Other platforms + fail to provide NAN, or provide it only in C99 mode; this + test only needs to fail when NAN is provided but wrong. */ + float f = 1.0f; +#ifdef NAN + f = NAN; +#endif + return f == 0;]])], + [gl_cv_header_math_nan_works=yes], + [gl_cv_header_math_nan_works=no])]) + if test $gl_cv_header_math_nan_works = no; then + REPLACE_NAN=1 + fi + AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], + [[/* Solaris 10 has a broken definition of HUGE_VAL. */ + double d = HUGE_VAL; + return d == 0;]])], + [gl_cv_header_math_huge_val_works=yes], + [gl_cv_header_math_huge_val_works=no])]) + if test $gl_cv_header_math_huge_val_works = no; then + REPLACE_HUGE_VAL=1 + fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include ]], + [acosf acosl asinf asinl atanf atanl + cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf + expf expl exp2 exp2f exp2l expm1 expm1f expm1l + fabsf fabsl floorf floorl fma fmaf fmal + fmod fmodf fmodl frexpf frexpl hypotf hypotl + ilogb ilogbf ilogbl + ldexpf ldexpl + log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l + logb logbf logbl + modf modff modfl powf + remainder remainderf remainderl + rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl + tanf tanl tanhf trunc truncf truncl]) +]) + +AC_DEFUN([gl_MATH_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_MATH_H_DEFAULTS], +[ + GNULIB_ACOSF=0; AC_SUBST([GNULIB_ACOSF]) + GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) + GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF]) + GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) + GNULIB_ATANF=0; AC_SUBST([GNULIB_ATANF]) + GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL]) + GNULIB_ATAN2F=0; AC_SUBST([GNULIB_ATAN2F]) + GNULIB_CBRT=0; AC_SUBST([GNULIB_CBRT]) + GNULIB_CBRTF=0; AC_SUBST([GNULIB_CBRTF]) + GNULIB_CBRTL=0; AC_SUBST([GNULIB_CBRTL]) + GNULIB_CEIL=0; AC_SUBST([GNULIB_CEIL]) + GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) + GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) + GNULIB_COPYSIGN=0; AC_SUBST([GNULIB_COPYSIGN]) + GNULIB_COPYSIGNF=0; AC_SUBST([GNULIB_COPYSIGNF]) + GNULIB_COPYSIGNL=0; AC_SUBST([GNULIB_COPYSIGNL]) + GNULIB_COSF=0; AC_SUBST([GNULIB_COSF]) + GNULIB_COSL=0; AC_SUBST([GNULIB_COSL]) + GNULIB_COSHF=0; AC_SUBST([GNULIB_COSHF]) + GNULIB_EXPF=0; AC_SUBST([GNULIB_EXPF]) + GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL]) + GNULIB_EXP2=0; AC_SUBST([GNULIB_EXP2]) + GNULIB_EXP2F=0; AC_SUBST([GNULIB_EXP2F]) + GNULIB_EXP2L=0; AC_SUBST([GNULIB_EXP2L]) + GNULIB_EXPM1=0; AC_SUBST([GNULIB_EXPM1]) + GNULIB_EXPM1F=0; AC_SUBST([GNULIB_EXPM1F]) + GNULIB_EXPM1L=0; AC_SUBST([GNULIB_EXPM1L]) + GNULIB_FABSF=0; AC_SUBST([GNULIB_FABSF]) + GNULIB_FABSL=0; AC_SUBST([GNULIB_FABSL]) + GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR]) + GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) + GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) + GNULIB_FMA=0; AC_SUBST([GNULIB_FMA]) + GNULIB_FMAF=0; AC_SUBST([GNULIB_FMAF]) + GNULIB_FMAL=0; AC_SUBST([GNULIB_FMAL]) + GNULIB_FMOD=0; AC_SUBST([GNULIB_FMOD]) + GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF]) + GNULIB_FMODL=0; AC_SUBST([GNULIB_FMODL]) + GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF]) + GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) + GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) + GNULIB_HYPOT=0; AC_SUBST([GNULIB_HYPOT]) + GNULIB_HYPOTF=0; AC_SUBST([GNULIB_HYPOTF]) + GNULIB_HYPOTL=0; AC_SUBST([GNULIB_HYPOTL]) + GNULIB_ILOGB=0; AC_SUBST([GNULIB_ILOGB]) + GNULIB_ILOGBF=0; AC_SUBST([GNULIB_ILOGBF]) + GNULIB_ILOGBL=0; AC_SUBST([GNULIB_ILOGBL]) + GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE]) + GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF]) + GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN]) + GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF]) + GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) + GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) + GNULIB_LDEXPF=0; AC_SUBST([GNULIB_LDEXPF]) + GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) + GNULIB_LOG=0; AC_SUBST([GNULIB_LOG]) + GNULIB_LOGF=0; AC_SUBST([GNULIB_LOGF]) + GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL]) + GNULIB_LOG10=0; AC_SUBST([GNULIB_LOG10]) + GNULIB_LOG10F=0; AC_SUBST([GNULIB_LOG10F]) + GNULIB_LOG10L=0; AC_SUBST([GNULIB_LOG10L]) + GNULIB_LOG1P=0; AC_SUBST([GNULIB_LOG1P]) + GNULIB_LOG1PF=0; AC_SUBST([GNULIB_LOG1PF]) + GNULIB_LOG1PL=0; AC_SUBST([GNULIB_LOG1PL]) + GNULIB_LOG2=0; AC_SUBST([GNULIB_LOG2]) + GNULIB_LOG2F=0; AC_SUBST([GNULIB_LOG2F]) + GNULIB_LOG2L=0; AC_SUBST([GNULIB_LOG2L]) + GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB]) + GNULIB_LOGBF=0; AC_SUBST([GNULIB_LOGBF]) + GNULIB_LOGBL=0; AC_SUBST([GNULIB_LOGBL]) + GNULIB_MODF=0; AC_SUBST([GNULIB_MODF]) + GNULIB_MODFF=0; AC_SUBST([GNULIB_MODFF]) + GNULIB_MODFL=0; AC_SUBST([GNULIB_MODFL]) + GNULIB_POWF=0; AC_SUBST([GNULIB_POWF]) + GNULIB_REMAINDER=0; AC_SUBST([GNULIB_REMAINDER]) + GNULIB_REMAINDERF=0; AC_SUBST([GNULIB_REMAINDERF]) + GNULIB_REMAINDERL=0; AC_SUBST([GNULIB_REMAINDERL]) + GNULIB_RINT=0; AC_SUBST([GNULIB_RINT]) + GNULIB_RINTF=0; AC_SUBST([GNULIB_RINTF]) + GNULIB_RINTL=0; AC_SUBST([GNULIB_RINTL]) + GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) + GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) + GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) + GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) + GNULIB_SINF=0; AC_SUBST([GNULIB_SINF]) + GNULIB_SINL=0; AC_SUBST([GNULIB_SINL]) + GNULIB_SINHF=0; AC_SUBST([GNULIB_SINHF]) + GNULIB_SQRTF=0; AC_SUBST([GNULIB_SQRTF]) + GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL]) + GNULIB_TANF=0; AC_SUBST([GNULIB_TANF]) + GNULIB_TANL=0; AC_SUBST([GNULIB_TANL]) + GNULIB_TANHF=0; AC_SUBST([GNULIB_TANHF]) + GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) + GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) + GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) + HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) + HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) + HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) + HAVE_ATANF=1; AC_SUBST([HAVE_ATANF]) + HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) + HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F]) + HAVE_CBRT=1; AC_SUBST([HAVE_CBRT]) + HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF]) + HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL]) + HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) + HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) + HAVE_COSF=1; AC_SUBST([HAVE_COSF]) + HAVE_COSL=1; AC_SUBST([HAVE_COSL]) + HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) + HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) + HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) + HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1]) + HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F]) + HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) + HAVE_FABSL=1; AC_SUBST([HAVE_FABSL]) + HAVE_FMA=1; AC_SUBST([HAVE_FMA]) + HAVE_FMAF=1; AC_SUBST([HAVE_FMAF]) + HAVE_FMAL=1; AC_SUBST([HAVE_FMAL]) + HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) + HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) + HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) + HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) + HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) + HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) + HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF]) + HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL]) + HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) + HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) + HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) + HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF]) + HAVE_LOGF=1; AC_SUBST([HAVE_LOGF]) + HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) + HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F]) + HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L]) + HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P]) + HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF]) + HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) + HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) + HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) + HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) + HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) + HAVE_POWF=1; AC_SUBST([HAVE_POWF]) + HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER]) + HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) + HAVE_RINT=1; AC_SUBST([HAVE_RINT]) + HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) + HAVE_SINF=1; AC_SUBST([HAVE_SINF]) + HAVE_SINL=1; AC_SUBST([HAVE_SINL]) + HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) + HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF]) + HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) + HAVE_TANF=1; AC_SUBST([HAVE_TANF]) + HAVE_TANL=1; AC_SUBST([HAVE_TANL]) + HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) + HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) + HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) + HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) + HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF]) + HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL]) + HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) + HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) + HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF]) + HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) + HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) + HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2]) + HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F]) + HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L]) + HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L]) + HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) + HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) + HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) + HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) + HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) + HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) + HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2]) + HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F]) + HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L]) + HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) + HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER]) + HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL]) + HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF]) + HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) + HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) + HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) + HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) + HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) + HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) + HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) + HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) + HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) + REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF]) + REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL]) + REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) + REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) + REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) + REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) + REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) + REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) + REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L]) + REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL]) + REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR]) + REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) + REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) + REPLACE_FMA=0; AC_SUBST([REPLACE_FMA]) + REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF]) + REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL]) + REPLACE_FMOD=0; AC_SUBST([REPLACE_FMOD]) + REPLACE_FMODF=0; AC_SUBST([REPLACE_FMODF]) + REPLACE_FMODL=0; AC_SUBST([REPLACE_FMODL]) + REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) + REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) + REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) + REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) + REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) + REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) + REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL]) + REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB]) + REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF]) + REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) + REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) + REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) + REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) + REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) + REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) + REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL]) + REPLACE_LOG10=0; AC_SUBST([REPLACE_LOG10]) + REPLACE_LOG10F=0; AC_SUBST([REPLACE_LOG10F]) + REPLACE_LOG10L=0; AC_SUBST([REPLACE_LOG10L]) + REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P]) + REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF]) + REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL]) + REPLACE_LOG2=0; AC_SUBST([REPLACE_LOG2]) + REPLACE_LOG2F=0; AC_SUBST([REPLACE_LOG2F]) + REPLACE_LOG2L=0; AC_SUBST([REPLACE_LOG2L]) + REPLACE_LOGB=0; AC_SUBST([REPLACE_LOGB]) + REPLACE_LOGBF=0; AC_SUBST([REPLACE_LOGBF]) + REPLACE_LOGBL=0; AC_SUBST([REPLACE_LOGBL]) + REPLACE_MODF=0; AC_SUBST([REPLACE_MODF]) + REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF]) + REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL]) + REPLACE_NAN=0; AC_SUBST([REPLACE_NAN]) + REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER]) + REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF]) + REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL]) + REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) + REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) + REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) + REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) + REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC]) + REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) + REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) + REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) + REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) +]) + +# gl_LONG_DOUBLE_VS_DOUBLE +# determines whether 'long double' and 'double' have the same representation. +# Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines +# HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. +# The currently known platforms where this is the case are: +# Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. +AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], +[ + AC_CACHE_CHECK([whether long double and double are the same], + [gl_cv_long_double_equals_double], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[typedef int check[sizeof (long double) == sizeof (double) + && LDBL_MANT_DIG == DBL_MANT_DIG + && LDBL_MAX_EXP == DBL_MAX_EXP + && LDBL_MIN_EXP == DBL_MIN_EXP + ? 1 : -1]; + ]])], + [gl_cv_long_double_equals_double=yes], + [gl_cv_long_double_equals_double=no]) + ]) + if test $gl_cv_long_double_equals_double = yes; then + AC_DEFINE([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE], [1], + [Define to 1 if 'long double' and 'double' have the same representation.]) + HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1 + else + HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0 + fi + AC_SUBST([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]) +]) diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4 index 28b9c43bf..4c9f38861 100644 --- a/m4/mbrtowc.m4 +++ b/m4/mbrtowc.m4 @@ -1,5 +1,5 @@ -# mbrtowc.m4 serial 18 -dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation, +# mbrtowc.m4 serial 25 +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2013 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,16 +15,40 @@ AC_DEFUN([gl_FUNC_MBRTOWC], AC_CHECK_FUNCS_ONCE([mbrtowc]) if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 + AC_CHECK_DECLS([mbrtowc],,, [[ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +]]) + if test $ac_cv_have_decl_mbrtowc = yes; then + dnl On Minix 3.1.8, the system's declares mbrtowc() although + dnl it does not have the function. Avoid a collision with gnulib's + dnl replacement. + REPLACE_MBRTOWC=1 + fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBRTOWC=1 else - gl_MBRTOWC_NULL_ARG + gl_MBRTOWC_NULL_ARG1 + gl_MBRTOWC_NULL_ARG2 gl_MBRTOWC_RETVAL gl_MBRTOWC_NUL_RETVAL - case "$gl_cv_func_mbrtowc_null_arg" in + case "$gl_cv_func_mbrtowc_null_arg1" in *yes) ;; - *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], + *) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1], + [Define if the mbrtowc function has the NULL pwc argument bug.]) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_null_arg2" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1], [Define if the mbrtowc function has the NULL string argument bug.]) REPLACE_MBRTOWC=1 ;; @@ -45,11 +69,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC], esac fi fi - if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then - gl_REPLACE_WCHAR_H - AC_LIBOBJ([mbrtowc]) - gl_PREREQ_MBRTOWC - fi ]) dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that @@ -80,9 +99,6 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN], else REPLACE_MBSTATE_T=1 fi - if test $REPLACE_MBSTATE_T = 1; then - gl_REPLACE_WCHAR_H - fi ]) dnl Test whether mbrtowc puts the state into non-initial state when parsing an @@ -112,6 +128,13 @@ changequote([,])dnl [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -162,6 +185,13 @@ changequote([,])dnl #include #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -188,25 +218,95 @@ int main () ]) ]) -dnl Test whether mbrtowc supports a NULL string argument correctly. -dnl Result is gl_cv_func_mbrtowc_null_arg. +dnl Test whether mbrtowc supports a NULL pwc argument correctly. +dnl Result is gl_cv_func_mbrtowc_null_arg1. -AC_DEFUN([gl_MBRTOWC_NULL_ARG], +AC_DEFUN([gl_MBRTOWC_NULL_ARG1], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], + [gl_cv_func_mbrtowc_null_arg1], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. +changequote(,)dnl + case "$host_os" in + # Guess no on Solaris. + solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; + esac +changequote([,])dnl + if test $LOCALE_FR_UTF8 != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +int main () +{ + int result = 0; + + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + char input[] = "\303\237er"; + mbstate_t state; + wchar_t wc; + size_t ret; + + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 5, &state); + if (ret != 2) + result |= 1; + if (!mbsinit (&state)) + result |= 2; + + memset (&state, '\0', sizeof (mbstate_t)); + ret = mbrtowc (NULL, input, 5, &state); + if (ret != 2) /* Solaris 7 fails here: ret is -1. */ + result |= 4; + if (!mbsinit (&state)) + result |= 8; + } + return result; +}]])], + [gl_cv_func_mbrtowc_null_arg1=yes], + [gl_cv_func_mbrtowc_null_arg1=no], + [:]) + fi + ]) +]) + +dnl Test whether mbrtowc supports a NULL string argument correctly. +dnl Result is gl_cv_func_mbrtowc_null_arg2. + +AC_DEFUN([gl_MBRTOWC_NULL_ARG2], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], - [gl_cv_func_mbrtowc_null_arg], + [gl_cv_func_mbrtowc_null_arg2], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. changequote(,)dnl case "$host_os" in # Guess no on OSF/1. - osf*) gl_cv_func_mbrtowc_null_arg="guessing no" ;; + osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;; # Guess yes otherwise. - *) gl_cv_func_mbrtowc_null_arg="guessing yes" ;; + *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR_UTF8 != none; then @@ -214,6 +314,13 @@ changequote([,])dnl [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -232,8 +339,8 @@ int main () } return 0; }]])], - [gl_cv_func_mbrtowc_null_arg=yes], - [gl_cv_func_mbrtowc_null_arg=no], + [gl_cv_func_mbrtowc_null_arg2=yes], + [gl_cv_func_mbrtowc_null_arg2=no], [:]) fi ]) @@ -249,7 +356,7 @@ AC_DEFUN([gl_MBRTOWC_RETVAL], AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether mbrtowc has a correct return value], [gl_cv_func_mbrtowc_retval], [ @@ -257,20 +364,30 @@ AC_DEFUN([gl_MBRTOWC_RETVAL], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on HP-UX and Solaris. - hpux* | solaris*) gl_cv_func_mbrtowc_retval="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_retval="guessing yes" ;; + # Guess no on HP-UX, Solaris, native Windows. + hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_retval="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then + if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ + || { case "$host_os" in mingw*) true;; *) false;; esac; }; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { + int result = 0; + int found_some_locale = 0; /* This fails on Solaris. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { @@ -283,8 +400,9 @@ int main () { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 1) - return 1; + result |= 1; } + found_some_locale = 1; } /* This fails on HP-UX 11.11. */ if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) @@ -298,13 +416,63 @@ int main () { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 2) - return 1; + result |= 2; } + found_some_locale = 1; } - return 0; + /* This fails on native Windows. */ + if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) + { + char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) + { + input[3] = '\0'; + if (mbrtowc (&wc, input + 4, 4, &state) != 1) + result |= 4; + } + found_some_locale = 1; + } + if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) + { + char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) + { + input[3] = '\0'; + if (mbrtowc (&wc, input + 4, 4, &state) != 1) + result |= 8; + } + found_some_locale = 1; + } + if (setlocale (LC_ALL, "Chinese_China.936") != NULL) + { + char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) + { + input[3] = '\0'; + if (mbrtowc (&wc, input + 4, 4, &state) != 1) + result |= 16; + } + found_some_locale = 1; + } + return (found_some_locale ? result : 77); }]])], [gl_cv_func_mbrtowc_retval=yes], - [gl_cv_func_mbrtowc_retval=no], + [if test $? != 77; then + gl_cv_func_mbrtowc_retval=no + fi + ], [:]) fi ]) @@ -336,6 +504,13 @@ changequote([,])dnl [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -366,10 +541,8 @@ AC_DEFUN([gl_PREREQ_MBRTOWC], [ dnl From Paul Eggert -dnl This override of an autoconf macro can be removed when autoconf 2.60 or -dnl newer can be assumed everywhere. +dnl This is an override of an autoconf macro. -m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.60]),[-1],[ AC_DEFUN([AC_FUNC_MBRTOWC], [ dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. @@ -377,7 +550,14 @@ AC_DEFUN([AC_FUNC_MBRTOWC], gl_cv_func_mbrtowc, [AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[#include ]], + [[/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include ]], [[wchar_t wc; char const s[] = ""; size_t n = 1; @@ -390,4 +570,3 @@ AC_DEFUN([AC_FUNC_MBRTOWC], [Define to 1 if mbrtowc and mbstate_t are properly declared.]) fi ]) -]) diff --git a/m4/mbsinit.m4 b/m4/mbsinit.m4 index 46c106fc4..2e6d0921a 100644 --- a/m4/mbsinit.m4 +++ b/m4/mbsinit.m4 @@ -1,5 +1,5 @@ -# mbsinit.m4 serial 4 -dnl Copyright (C) 2008, 2010 Free Software Foundation, Inc. +# mbsinit.m4 serial 8 +dnl Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MBSINIT], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN @@ -14,16 +15,34 @@ AC_DEFUN([gl_FUNC_MBSINIT], AC_CHECK_FUNCS_ONCE([mbsinit]) if test $ac_cv_func_mbsinit = no; then HAVE_MBSINIT=0 + AC_CHECK_DECLS([mbsinit],,, [[ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +]]) + if test $ac_cv_have_decl_mbsinit = yes; then + dnl On Minix 3.1.8, the system's declares mbsinit() although + dnl it does not have the function. Avoid a collision with gnulib's + dnl replacement. + REPLACE_MBSINIT=1 + fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBSINIT=1 + else + dnl On mingw, mbsinit() always returns 1, which is inappropriate for + dnl states produced by mbrtowc() for an incomplete multibyte character + dnl in multibyte locales. + case "$host_os" in + mingw*) REPLACE_MBSINIT=1 ;; + esac fi fi - if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then - gl_REPLACE_WCHAR_H - AC_LIBOBJ([mbsinit]) - gl_PREREQ_MBSINIT - fi ]) # Prerequisites of lib/mbsinit.c. diff --git a/m4/mbsrtowcs.m4 b/m4/mbsrtowcs.m4 index e854337ff..c4934c281 100644 --- a/m4/mbsrtowcs.m4 +++ b/m4/mbsrtowcs.m4 @@ -1,5 +1,5 @@ -# mbsrtowcs.m4 serial 7 -dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. +# mbsrtowcs.m4 serial 13 +dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -14,6 +14,22 @@ AC_DEFUN([gl_FUNC_MBSRTOWCS], AC_CHECK_FUNCS_ONCE([mbsrtowcs]) if test $ac_cv_func_mbsrtowcs = no; then HAVE_MBSRTOWCS=0 + AC_CHECK_DECLS([mbsrtowcs],,, [[ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +]]) + if test $ac_cv_have_decl_mbsrtowcs = yes; then + dnl On Minix 3.1.8, the system's declares mbsrtowcs() although + dnl it does not have the function. Avoid a collision with gnulib's + dnl replacement. + REPLACE_MBSRTOWCS=1 + fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_MBSRTOWCS=1 @@ -25,12 +41,6 @@ AC_DEFUN([gl_FUNC_MBSRTOWCS], esac fi fi - if test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1; then - gl_REPLACE_WCHAR_H - AC_LIBOBJ([mbsrtowcs]) - AC_LIBOBJ([mbsrtowcs-state]) - gl_PREREQ_MBSRTOWCS - fi ]) dnl Test whether mbsrtowcs works. @@ -39,6 +49,7 @@ dnl Result is gl_cv_func_mbsrtowcs_works. AC_DEFUN([gl_MBSRTOWCS_WORKS], [ AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_ZH_CN]) @@ -50,20 +61,41 @@ AC_DEFUN([gl_MBSRTOWCS_WORKS], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on HP-UX and Solaris. - hpux* | solaris*) gl_cv_func_mbsrtowcs_works="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbsrtowcs_works="guessing yes" ;; + # Guess no on HP-UX, Solaris, mingw. + hpux* | solaris* | mingw*) gl_cv_func_mbsrtowcs_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbsrtowcs_works="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then + if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { + int result = 0; + /* Test whether the function supports a NULL destination argument. + This fails on native Windows. */ + if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) + { + const char input[] = "\337er"; + const char *src = input; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbsrtowcs (NULL, &src, 1, &state) != 3 + || src != input) + result |= 1; + } /* Test whether the function works when started with a conversion state in non-initial state. This fails on HP-UX 11.11 and Solaris 10. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) @@ -77,7 +109,7 @@ int main () { const char *src = input + 2; if (mbsrtowcs (NULL, &src, 10, &state) != 4) - return 1; + result |= 2; } } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) @@ -91,7 +123,7 @@ int main () { const char *src = input + 4; if (mbsrtowcs (NULL, &src, 10, &state) != 3) - return 1; + result |= 4; } } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) @@ -105,10 +137,10 @@ int main () { const char *src = input + 2; if (mbsrtowcs (NULL, &src, 10, &state) != 4) - return 1; + result |= 8; } } - return 0; + return result; }]])], [gl_cv_func_mbsrtowcs_works=yes], [gl_cv_func_mbsrtowcs_works=no], diff --git a/m4/mbstate_t.m4 b/m4/mbstate_t.m4 index 3e2df29f8..ed0011798 100644 --- a/m4/mbstate_t.m4 +++ b/m4/mbstate_t.m4 @@ -1,5 +1,5 @@ -# mbstate_t.m4 serial 12 -dnl Copyright (C) 2000-2002, 2008-2010 Free Software Foundation, Inc. +# mbstate_t.m4 serial 13 +dnl Copyright (C) 2000-2002, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -20,7 +20,14 @@ AC_DEFUN([AC_TYPE_MBSTATE_T], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT[ -# include ]], +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include ]], [[mbstate_t x; return sizeof x;]])], [ac_cv_type_mbstate_t=yes], [ac_cv_type_mbstate_t=no])]) diff --git a/m4/mbswidth.m4 b/m4/mbswidth.m4 new file mode 100644 index 000000000..39760fcd2 --- /dev/null +++ b/m4/mbswidth.m4 @@ -0,0 +1,46 @@ +# mbswidth.m4 serial 18 +dnl Copyright (C) 2000-2002, 2004, 2006-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl autoconf tests required for use of mbswidth.c +dnl From Bruno Haible. + +AC_DEFUN([gl_MBSWIDTH], +[ + AC_CHECK_HEADERS_ONCE([wchar.h]) + AC_CHECK_FUNCS_ONCE([isascii mbsinit]) + + dnl UnixWare 7.1.1 has a declaration of a function mbswidth() + dnl that clashes with ours. + AC_CACHE_CHECK([whether mbswidth is declared in ], + [ac_cv_have_decl_mbswidth], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include + ]], + [[ + char *p = (char *) mbswidth; + return !p; + ]])], + [ac_cv_have_decl_mbswidth=yes], + [ac_cv_have_decl_mbswidth=no])]) + if test $ac_cv_have_decl_mbswidth = yes; then + ac_val=1 + else + ac_val=0 + fi + AC_DEFINE_UNQUOTED([HAVE_DECL_MBSWIDTH_IN_WCHAR_H], [$ac_val], + [Define to 1 if you have a declaration of mbswidth() in , and to 0 otherwise.]) + + AC_TYPE_MBSTATE_T +]) diff --git a/m4/mbtowc.m4 b/m4/mbtowc.m4 new file mode 100644 index 000000000..e47946196 --- /dev/null +++ b/m4/mbtowc.m4 @@ -0,0 +1,19 @@ +# mbtowc.m4 serial 2 +dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_MBTOWC], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + + if false; then + REPLACE_MBTOWC=1 + fi +]) + +# Prerequisites of lib/mbtowc.c. +AC_DEFUN([gl_PREREQ_MBTOWC], [ + : +]) diff --git a/m4/memchr.m4 b/m4/memchr.m4 index b05a79a02..2d8abe75d 100644 --- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -1,5 +1,5 @@ -# memchr.m4 serial 9 -dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc. +# memchr.m4 serial 12 +dnl Copyright (C) 2002-2004, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,10 +11,16 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) - dnl These days, we assume memchr is present. But just in case... AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([memchr]) - if test $ac_cv_func_memchr = yes; then + m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [ + dnl These days, we assume memchr is present. But if support for old + dnl platforms is desired: + AC_CHECK_FUNCS_ONCE([memchr]) + if test $ac_cv_func_memchr = no; then + HAVE_MEMCHR=0 + fi + ]) + if test $HAVE_MEMCHR = 1; then # Detect platform-specific bugs in some versions of glibc: # memchr should not dereference anything with length 0 # http://bugzilla.redhat.com/499689 @@ -35,6 +41,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], # endif #endif ]], [[ + int result = 0; char *fence = NULL; #if HAVE_SYS_MMAN_H && HAVE_MPROTECT # if HAVE_MAP_ANONYMOUS @@ -58,26 +65,20 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], if (fence) { if (memchr (fence, 0, 0)) - return 1; + result |= 1; strcpy (fence - 9, "12345678"); if (memchr (fence - 9, 0, 79) != fence - 1) - return 2; + result |= 2; if (memchr (fence - 1, 0, 3) != fence - 1) - return 3; + result |= 4; } - return 0; + return result; ]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], [dnl Be pessimistic for now. gl_cv_func_memchr_works="guessing no"])]) if test "$gl_cv_func_memchr_works" != yes; then REPLACE_MEMCHR=1 fi - else - HAVE_MEMCHR=0 - fi - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then - AC_LIBOBJ([memchr]) - gl_PREREQ_MEMCHR fi ]) diff --git a/m4/mempcpy.m4 b/m4/mempcpy.m4 index 12df771e4..a48f2d107 100644 --- a/m4/mempcpy.m4 +++ b/m4/mempcpy.m4 @@ -1,5 +1,5 @@ -# mempcpy.m4 serial 10 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2010 Free Software Foundation, +# mempcpy.m4 serial 11 +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2013 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,10 +14,9 @@ AC_DEFUN([gl_FUNC_MEMPCPY], AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS([mempcpy]) + AC_CHECK_FUNCS([mempcpy]) if test $ac_cv_func_mempcpy = no; then HAVE_MEMPCPY=0 - gl_PREREQ_MEMPCPY fi ]) diff --git a/m4/mmap-anon.m4 b/m4/mmap-anon.m4 index a6b7b9ac3..9b60ddfa4 100644 --- a/m4/mmap-anon.m4 +++ b/m4/mmap-anon.m4 @@ -1,5 +1,5 @@ -# mmap-anon.m4 serial 8 -dnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc. +# mmap-anon.m4 serial 10 +dnl Copyright (C) 2005, 2007, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,16 +9,12 @@ dnl with or without modifications, as long as this notice is preserved. # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS # and MAP_ANON exist and have the same value. # - On HP-UX, only MAP_ANONYMOUS exists. -# - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. +# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be # used. AC_DEFUN([gl_FUNC_MMAP_ANON], [ - dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - dnl Persuade glibc to define MAP_ANONYMOUS. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -31,18 +27,18 @@ AC_DEFUN([gl_FUNC_MMAP_ANON], gl_have_mmap_anonymous=no if test $gl_have_mmap = yes; then AC_MSG_CHECKING([for MAP_ANONYMOUS]) - AC_EGREP_CPP([I cant identify this map.], [ + AC_EGREP_CPP([I cannot identify this map], [ #include #ifdef MAP_ANONYMOUS - I cant identify this map. + I cannot identify this map #endif ], [gl_have_mmap_anonymous=yes]) if test $gl_have_mmap_anonymous != yes; then - AC_EGREP_CPP([I cant identify this map.], [ + AC_EGREP_CPP([I cannot identify this map], [ #include #ifdef MAP_ANON - I cant identify this map. + I cannot identify this map #endif ], [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], diff --git a/m4/msvc-inval.m4 b/m4/msvc-inval.m4 new file mode 100644 index 000000000..9a6a47a74 --- /dev/null +++ b/m4/msvc-inval.m4 @@ -0,0 +1,19 @@ +# msvc-inval.m4 serial 1 +dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MSVC_INVAL], +[ + AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler]) + if test $ac_cv_func__set_invalid_parameter_handler = yes; then + HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 + AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1], + [Define to 1 on MSVC platforms that have the "invalid parameter handler" + concept.]) + else + HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 + fi + AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER]) +]) diff --git a/m4/msvc-nothrow.m4 b/m4/msvc-nothrow.m4 new file mode 100644 index 000000000..a39618a41 --- /dev/null +++ b/m4/msvc-nothrow.m4 @@ -0,0 +1,10 @@ +# msvc-nothrow.m4 serial 1 +dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MSVC_NOTHROW], +[ + AC_REQUIRE([gl_MSVC_INVAL]) +]) diff --git a/m4/multiarch.m4 b/m4/multiarch.m4 index 389bd2bba..552ec7e71 100644 --- a/m4/multiarch.m4 +++ b/m4/multiarch.m4 @@ -1,12 +1,12 @@ -# multiarch.m4 serial 5 -dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +# multiarch.m4 serial 7 +dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Determine whether the compiler is or may be producing universal binaries. # -# On MacOS X 10.5 and later systems, the user can create libraries and +# On Mac OS X 10.5 and later systems, the user can create libraries and # executables that work on multiple system types--known as "fat" or # "universal" binaries--by specifying multiple '-arch' options to the # compiler but only a single '-arch' option to the preprocessor. Like @@ -16,8 +16,7 @@ dnl with or without modifications, as long as this notice is preserved. # CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ # CPP="gcc -E" CXXCPP="g++ -E" # -# Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the -# beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly. +# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly. AC_DEFUN_ONCE([gl_MULTIARCH], [ @@ -55,8 +54,6 @@ AC_DEFUN_ONCE([gl_MULTIARCH], done ]) if test $gl_cv_c_multiarch = yes; then - AC_DEFINE([AA_APPLE_UNIVERSAL_BUILD], [1], - [Define if the compiler is building for multiple architectures of Apple platforms at once.]) APPLE_UNIVERSAL_BUILD=1 else APPLE_UNIVERSAL_BUILD=0 diff --git a/m4/nl_langinfo.m4 b/m4/nl_langinfo.m4 index ad456a264..25e210155 100644 --- a/m4/nl_langinfo.m4 +++ b/m4/nl_langinfo.m4 @@ -1,5 +1,5 @@ -# nl_langinfo.m4 serial 3 -dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# nl_langinfo.m4 serial 5 +dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,17 +9,42 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) AC_REQUIRE([gl_LANGINFO_H]) AC_CHECK_FUNCS_ONCE([nl_langinfo]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles if test $ac_cv_func_nl_langinfo = yes; then - if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1; then + # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. + AC_CACHE_CHECK([whether YESEXPR works], + [gl_cv_func_nl_langinfo_yesexpr_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[#include +]], [[return !*nl_langinfo(YESEXPR); +]])], + [gl_cv_func_nl_langinfo_yesexpr_works=yes], + [gl_cv_func_nl_langinfo_yesexpr_works=no], + [ + case "$host_os" in + # Guess no on irix systems. + irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";; + # Guess yes elsewhere. + *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";; + esac + ]) + ]) + case $gl_cv_func_nl_langinfo_yesexpr_works in + *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;; + *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;; + esac + AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], + [$FUNC_NL_LANGINFO_YESEXPR_WORKS], + [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) + if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1 \ + && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1; then : else REPLACE_NL_LANGINFO=1 AC_DEFINE([REPLACE_NL_LANGINFO], [1], [Define if nl_langinfo exists but is overridden by gnulib.]) - AC_LIBOBJ([nl_langinfo]) fi else HAVE_NL_LANGINFO=0 - AC_LIBOBJ([nl_langinfo]) fi ]) diff --git a/m4/nls.m4 b/m4/nls.m4 index 003704c4b..8f8a147be 100644 --- a/m4/nls.m4 +++ b/m4/nls.m4 @@ -1,5 +1,5 @@ # nls.m4 serial 5 (gettext-0.18) -dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation, +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/m4/nocrash.m4 b/m4/nocrash.m4 new file mode 100644 index 000000000..105b884f1 --- /dev/null +++ b/m4/nocrash.m4 @@ -0,0 +1,130 @@ +# nocrash.m4 serial 4 +dnl Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. + +AC_PREREQ([2.13]) + +dnl Expands to some code for use in .c programs that will cause the configure +dnl test to exit instead of crashing. This is useful to avoid triggering +dnl action from a background debugger and to avoid core dumps. +dnl Usage: ... +dnl ]GL_NOCRASH[ +dnl ... +dnl int main() { nocrash_init(); ... } +AC_DEFUN([GL_NOCRASH],[[ +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif +]]) diff --git a/m4/off_t.m4 b/m4/off_t.m4 new file mode 100644 index 000000000..d355d0131 --- /dev/null +++ b/m4/off_t.m4 @@ -0,0 +1,18 @@ +# off_t.m4 serial 1 +dnl Copyright (C) 2012-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check whether to override the 'off_t' type. +dnl Set WINDOWS_64_BIT_OFF_T. + +AC_DEFUN([gl_TYPE_OFF_T], +[ + m4_ifdef([gl_LARGEFILE], [ + AC_REQUIRE([gl_LARGEFILE]) + ], [ + WINDOWS_64_BIT_OFF_T=0 + ]) + AC_SUBST([WINDOWS_64_BIT_OFF_T]) +]) diff --git a/m4/po.m4 b/m4/po.m4 index 47f36a41a..f39572343 100644 --- a/m4/po.m4 +++ b/m4/po.m4 @@ -1,5 +1,5 @@ -# po.m4 serial 17 (gettext-0.18) -dnl Copyright (C) 1995-2010 Free Software Foundation, Inc. +# po.m4 serial 20 (gettext-0.18.2) +dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -17,14 +17,14 @@ dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. -AC_PREREQ([2.50]) +AC_PREREQ([2.60]) dnl Checks for all prerequisites of the po subdirectory. AC_DEFUN([AM_PO_SUBDIRS], [ AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + AC_REQUIRE([AC_PROG_MKDIR_P])dnl AC_REQUIRE([AM_NLS])dnl dnl Release version of the gettext macros. This is used to ensure that @@ -102,7 +102,7 @@ changequote([,])dnl case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. @@ -118,7 +118,8 @@ changequote([,])dnl if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + gt_tab=`printf '\t'` + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration @@ -129,12 +130,12 @@ changequote([,])dnl test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake < 1.5. + # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. - # Hide the ALL_LINGUAS assigment from automake < 1.5. + # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES @@ -226,7 +227,7 @@ AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], changequote(,)dnl # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. @@ -254,6 +255,7 @@ EOT fi # A sed script that extracts the value of VARIABLE from a Makefile. + tab=`printf '\t'` sed_x_variable=' # Test if the hold space is empty. x @@ -261,9 +263,9 @@ s/P/P/ x ta # Yes it was empty. Look if we have the expected variable definition. -/^[ ]*VARIABLE[ ]*=/{ +/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{ # Seen the first line of the variable definition. - s/^[ ]*VARIABLE[ ]*=// + s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=// ba } bd @@ -315,7 +317,7 @@ changequote([,])dnl sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` fi - # Hide the ALL_LINGUAS assigment from automake < 1.5. + # Hide the ALL_LINGUAS assignment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) @@ -405,14 +407,15 @@ changequote([,])dnl fi sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp" + tab=`printf '\t'` if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` cat >> "$ac_file.tmp" <> "$ac_file.tmp" <= 5. freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. + # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on OpenBSD >= 3.9. @@ -70,8 +71,8 @@ changequote(,)dnl gl_cv_func_printf_sizes_c99="guessing no";; openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; - solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_printf_sizes_c99="guessing no";; @@ -102,19 +103,20 @@ AC_DEFUN([gl_PRINTF_LONG_DOUBLE], static char buf[10000]; int main () { + int result = 0; buf[0] = '\0'; if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.750000 33") != 0) - return 1; + result |= 1; buf[0] = '\0'; if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.750000e+00 33") != 0) - return 1; + result |= 2; buf[0] = '\0'; if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 || strcmp (buf, "1.75 33") != 0) - return 1; - return 0; + result |= 4; + return result; }]])], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], @@ -175,39 +177,40 @@ static char buf[10000]; static double zero = 0.0; int main () { - if (sprintf (buf, "%f", 1.0 / 0.0) < 0 + int result = 0; + if (sprintf (buf, "%f", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%f", -1.0 / 0.0) < 0 + result |= 1; + if (sprintf (buf, "%f", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%f", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%e", 1.0 / 0.0) < 0 + result |= 2; + if (sprintf (buf, "%e", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%e", -1.0 / 0.0) < 0 + result |= 4; + if (sprintf (buf, "%e", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 4; if (sprintf (buf, "%e", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%g", 1.0 / 0.0) < 0 + result |= 8; + if (sprintf (buf, "%g", 1.0 / zero) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%g", -1.0 / 0.0) < 0 + result |= 16; + if (sprintf (buf, "%g", -1.0 / zero) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 16; if (sprintf (buf, "%g", zero / zero) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 32; /* This test fails on HP-UX 10.20. */ if (have_minus_zero ()) if (sprintf (buf, "%g", - zero) < 0 || strcmp (buf, "-0") != 0) - return 1; - return 0; + result |= 64; + return result; }]])], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], @@ -219,7 +222,7 @@ changequote(,)dnl # Guess yes on FreeBSD >= 6. freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on MacOS X >= 10.3. + # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; darwin*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on HP-UX >= 11. @@ -248,6 +251,7 @@ AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gl_BIGENDIAN]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl The user can set or unset the variable gl_printf_safe to indicate dnl that he wishes a safe handling of non-IEEE-754 'long double' values. @@ -289,35 +293,36 @@ static char buf[10000]; static long double zeroL = 0.0L; int main () { + int result = 0; nocrash_init(); - if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 + if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 + result |= 1; + if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 + result |= 1; + if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 + result |= 1; + if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Le", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; - if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 + result |= 1; + if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - return 1; - if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 + result |= 1; + if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; -#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) + result |= 1; +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ # ifdef WORDS_BIGENDIAN @@ -335,13 +340,13 @@ int main () { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; } { /* Signalling NaN. */ @@ -349,81 +354,81 @@ int main () { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 2; } { /* Pseudo-NaN. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 4; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 4; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 4; } { /* Pseudo-Infinity. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 8; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 8; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 8; } { /* Pseudo-Zero. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 16; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 16; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 16; } { /* Unnormalized number. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 32; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 32; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 32; } { /* Pseudo-Denormal. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; if (sprintf (buf, "%Lf", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 64; if (sprintf (buf, "%Le", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 64; if (sprintf (buf, "%Lg", x.value) < 0 || !strisnan (buf, 0, strlen (buf))) - return 1; + result |= 64; } #endif - return 0; + return result; }]])], [gl_cv_func_printf_infinite_long_double=yes], [gl_cv_func_printf_infinite_long_double=no], @@ -439,16 +444,9 @@ changequote(,)dnl # Guess yes on FreeBSD >= 6. freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on MacOS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; - darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on HP-UX >= 11. hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_infinite_long_double="guessing no";; - netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; # If we don't know, assume the worst. *) gl_cv_func_printf_infinite_long_double="guessing no";; esac @@ -481,48 +479,50 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_A], #include #include static char buf[100]; +static double zero = 0.0; int main () { + int result = 0; if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "0x1.922p+1 33") != 0 && strcmp (buf, "0x3.244p+0 33") != 0 && strcmp (buf, "0x6.488p-1 33") != 0 && strcmp (buf, "0xc.91p-2 33") != 0)) - return 1; + result |= 1; if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "-0X1.922P+1 33") != 0 && strcmp (buf, "-0X3.244P+0 33") != 0 && strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0XC.91P-2 33") != 0)) - return 1; + result |= 2; /* This catches a FreeBSD 6.1 bug: it doesn't round. */ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x1.83p+0 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0 && strcmp (buf, "0x6.0ap-2 33") != 0 && strcmp (buf, "0xc.14p-3 33") != 0)) - return 1; + result |= 4; /* This catches a FreeBSD 6.1 bug. See */ - if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 + if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 || buf[0] == '0') - return 1; - /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ + result |= 8; + /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ if (sprintf (buf, "%.1a", 1.999) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 && strcmp (buf, "0x4.0p-1") != 0 && strcmp (buf, "0x8.0p-2") != 0)) - return 1; - /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a + result |= 16; + /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a glibc 2.4 bug . */ if (sprintf (buf, "%.1La", 1.999L) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 && strcmp (buf, "0x4.0p-1") != 0 && strcmp (buf, "0x8.0p-2") != 0)) - return 1; - return 0; + result |= 32; + return result; }]])], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no], @@ -533,7 +533,7 @@ int main () AC_EGREP_CPP([BZ2908], [ #include #ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ BZ2908 #endif #endif @@ -564,19 +564,21 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_F], #include #include static char buf[100]; +static double zero = 0.0; int main () { + int result = 0; if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 || strcmp (buf, "1234567.000000 33") != 0) - return 1; - if (sprintf (buf, "%F", 1.0 / 0.0) < 0 + result |= 1; + if (sprintf (buf, "%F", 1.0 / zero) < 0 || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) - return 1; + result |= 2; /* This catches a Cygwin 1.5.x bug. */ if (sprintf (buf, "%.F", 1234.0) < 0 || strcmp (buf, "1234") != 0) - return 1; - return 0; + result |= 4; + return result; }]])], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no], @@ -588,12 +590,12 @@ changequote(,)dnl # Guess yes on FreeBSD >= 6. freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on MacOS X >= 10.3. + # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; darwin*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on Solaris >= 2.10. - solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; - solaris*) gl_cv_func_printf_directive_f="guessing yes";; + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # If we don't know, assume the worst. *) gl_cv_func_printf_directive_f="guessing no";; esac @@ -616,12 +618,27 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include +#include #include +#ifdef _MSC_VER +/* See page about "Parameter Validation" on msdn.microsoft.com. */ +static void cdecl +invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, unsigned int line, + uintptr_t dummy) +{ + exit (1); +} +#endif static char fmtstring[10]; static char buf[100]; int main () { int count = -1; +#ifdef _MSC_VER + _set_invalid_parameter_handler (invalid_parameter_handler); +#endif /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) support %n in format strings in read-only memory but not in writable memory. */ @@ -637,7 +654,8 @@ int main () [ changequote(,)dnl case "$host_os" in - *) gl_cv_func_printf_directive_n="guessing yes";; + mingw*) gl_cv_func_printf_directive_n="guessing no";; + *) gl_cv_func_printf_directive_n="guessing yes";; esac changequote([,])dnl ]) @@ -671,6 +689,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], #include int main () { + int result = 0; char buf[100]; /* Test whether %ls works at all. This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on @@ -680,7 +699,7 @@ int main () buf[0] = '\0'; if (sprintf (buf, "%ls", wstring) < 0 || strcmp (buf, "abc") != 0) - return 1; + result |= 1; } /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an assertion failure inside libc), but not on OpenBSD 4.0. */ @@ -689,7 +708,7 @@ int main () buf[0] = '\0'; if (sprintf (buf, "%ls", wstring) < 0 || strcmp (buf, "a") != 0) - return 1; + result |= 2; } /* Test whether precisions in %ls are supported as specified in ISO C 99 section 7.19.6.1: @@ -704,9 +723,9 @@ int main () buf[0] = '\0'; if (sprintf (buf, "%.2ls", wstring) < 0 || strcmp (buf, "ab") != 0) - return 1; + result |= 8; } - return 0; + return result; }]])], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no], @@ -862,9 +881,10 @@ AC_DEFUN([gl_PRINTF_FLAG_ZERO], #include #include static char buf[100]; +static double zero = 0.0; int main () { - if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 + if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 || (strcmp (buf, " inf") != 0 && strcmp (buf, " infinity") != 0)) return 1; @@ -889,8 +909,11 @@ changequote([,])dnl dnl Test whether the *printf family of functions supports large precisions. dnl On mingw, precisions larger than 512 are treated like 512, in integer, -dnl floating-point or pointer output. On BeOS, precisions larger than 1044 -dnl crash the program. +dnl floating-point or pointer output. On Solaris 10/x86, precisions larger +dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC, +dnl precisions larger than 510 in floating-point output yield wrong results. +dnl On AIX 7.1, precisions larger than 998 in floating-point output yield +dnl wrong results. On BeOS, precisions larger than 1044 crash the program. dnl Result is gl_cv_func_printf_precision. AC_DEFUN([gl_PRINTF_PRECISION], @@ -907,20 +930,30 @@ AC_DEFUN([gl_PRINTF_PRECISION], static char buf[5000]; int main () { + int result = 0; #ifdef __BEOS__ /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ return 1; #endif if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) - return 1; - return 0; + result |= 1; + if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) + result |= 2; + if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 + || buf[0] != '1') + result |= 4; + if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5 + || buf[0] != '1') + result |= 4; + return result; }]])], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no], [ changequote(,)dnl case "$host_os" in - # Guess no only on native Win32 and BeOS systems. + # Guess no only on Solaris, native Windows, and BeOS systems. + solaris*) gl_cv_func_printf_precision="guessing no" ;; mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; beos*) gl_cv_func_printf_precision="guessing no" ;; *) gl_cv_func_printf_precision="guessing yes" ;; @@ -995,8 +1028,9 @@ int main() changequote([,])dnl ])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then - (./conftest + (./conftest 2>&AS_MESSAGE_LOG_FD result=$? + _AS_ECHO_LOG([\$? = $result]) if test $result != 0 && test $result != 77; then result=1; fi exit $result ) >/dev/null 2>/dev/null @@ -1010,7 +1044,7 @@ changequote([,])dnl fi rm -fr conftest* else - dnl A universal build on Apple MacOS X platforms. + dnl A universal build on Apple Mac OS X platforms. dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode. dnl But we need a configuration result that is valid in both modes. gl_cv_func_printf_enomem="guessing no" @@ -1063,6 +1097,7 @@ AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf truncates the result as in C99], [gl_cv_func_snprintf_truncation_c99], [ @@ -1070,11 +1105,25 @@ AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], [AC_LANG_SOURCE([[ #include #include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif static char buf[100]; int main () { strcpy (buf, "ABCDEF"); - snprintf (buf, 3, "%d %d", 4567, 89); + my_snprintf (buf, 3, "%d %d", 4567, 89); if (memcmp (buf, "45\0DEF", 6) != 0) return 1; return 0; @@ -1089,7 +1138,7 @@ changequote(,)dnl # Guess yes on FreeBSD >= 5. freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. + # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on OpenBSD >= 3.9. @@ -1097,7 +1146,8 @@ changequote(,)dnl gl_cv_func_snprintf_truncation_c99="guessing no";; openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_snprintf_truncation_c99="guessing no";; solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; @@ -1143,6 +1193,7 @@ AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], [gl_cv_func_snprintf_retval_c99], [ @@ -1150,12 +1201,30 @@ AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99], [AC_LANG_SOURCE([[ #include #include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif static char buf[100]; int main () { strcpy (buf, "ABCDEF"); - if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) + if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) return 1; + if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) + return 2; + if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) + return 3; return 0; }]])], [gl_cv_func_snprintf_retval_c99=yes], @@ -1168,16 +1237,16 @@ changequote(,)dnl # Guess yes on FreeBSD >= 5. freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. + # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on OpenBSD >= 3.9. openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) gl_cv_func_snprintf_retval_c99="guessing no";; openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; - solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; @@ -1203,6 +1272,7 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], [gl_cv_func_snprintf_directive_n], [ @@ -1210,6 +1280,20 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], [AC_LANG_SOURCE([[ #include #include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif static char fmtstring[10]; static char buf[100]; int main () @@ -1219,7 +1303,7 @@ int main () support %n in format strings in read-only memory but not in writable memory. */ strcpy (fmtstring, "%d %n"); - snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); + my_snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); if (count != 6) return 1; return 0; @@ -1234,11 +1318,12 @@ changequote(,)dnl # Guess yes on FreeBSD >= 5. freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; - # Guess yes on MacOS X >= 10.3. + # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";; + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_snprintf_directive_n="guessing no";; solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; @@ -1270,16 +1355,31 @@ dnl Result is gl_cv_func_snprintf_size1. AC_DEFUN([gl_SNPRINTF_SIZE1], [ AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_SNPRINTF_PRESENCE]) AC_CACHE_CHECK([whether snprintf respects a size of 1], [gl_cv_func_snprintf_size1], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +#endif int main() { static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; - snprintf (buf, 1, "%d", 12345); + my_snprintf (buf, 1, "%d", 12345); return buf[1] != 'E'; }]])], [gl_cv_func_snprintf_size1=yes], @@ -1360,13 +1460,14 @@ changequote(,)dnl # Guess yes on FreeBSD >= 5. freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on MacOS X >= 10.3. + # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Cygwin. cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Solaris >= 2.6. - solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + solaris2.[0-5] | solaris2.[0-5].*) + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on AIX >= 4. aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; @@ -1439,24 +1540,31 @@ dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . -dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . . +dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . +dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . -dnl Solaris 10 . . # # # . . # . . . # . . . . . . . . -dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . . +dnl Solaris 11 2011-11 . . # # # . . # . . . # . . . . . . . . +dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . +dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # -dnl AIX 5.2, 7.1 . . # # # . . . . . . # . . . . . . . . -dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . . +dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . . +dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . +dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . . dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # +dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . -dnl Haiku . . . # # # . # . . . . . ? . . . . . . -dnl BeOS # # . # # # . ? # . ? . # ? . . . . . . -dnl mingw # # # # # # . . # # . # # ? . # # # . . +dnl Haiku . . . # # # . # . . . . . ? . . ? . . . +dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . +dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . +dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . +dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . +dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . . diff --git a/m4/progtest.m4 b/m4/progtest.m4 index 9ffa5c020..7b3912329 100644 --- a/m4/progtest.m4 +++ b/m4/progtest.m4 @@ -1,5 +1,5 @@ # progtest.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1996-2003, 2005, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 1996-2003, 2005, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/rawmemchr.m4 b/m4/rawmemchr.m4 index 2a25a4904..8c500547c 100644 --- a/m4/rawmemchr.m4 +++ b/m4/rawmemchr.m4 @@ -1,5 +1,5 @@ -# rawmemchr.m4 serial 1 -dnl Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# rawmemchr.m4 serial 2 +dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,10 +10,9 @@ AC_DEFUN([gl_FUNC_RAWMEMCHR], AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS([rawmemchr]) + AC_CHECK_FUNCS([rawmemchr]) if test $ac_cv_func_rawmemchr = no; then HAVE_RAWMEMCHR=0 - gl_PREREQ_RAWMEMCHR fi ]) diff --git a/m4/realloc.m4 b/m4/realloc.m4 index 01c1234f7..d477fb470 100644 --- a/m4/realloc.m4 +++ b/m4/realloc.m4 @@ -1,9 +1,47 @@ -# realloc.m4 serial 11 -dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. +# realloc.m4 serial 13 +dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +m4_version_prereq([2.70], [] ,[ + +# This is taken from the following Autoconf patch: +# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 +AC_DEFUN([_AC_FUNC_REALLOC_IF], +[ + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles + AC_CHECK_HEADERS([stdlib.h]) + AC_CACHE_CHECK([for GNU libc compatible realloc], + [ac_cv_func_realloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H + # include + #else + char *realloc (); + #endif + ]], + [[return ! realloc (0, 0);]]) + ], + [ac_cv_func_realloc_0_nonnull=yes], + [ac_cv_func_realloc_0_nonnull=no], + [case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* \ + | hpux* | solaris* | cygwin* | mingw*) + ac_cv_func_realloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_realloc_0_nonnull=no ;; + esac + ]) + ]) + AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2]) +])# AC_FUNC_REALLOC + +]) + # gl_FUNC_REALLOC_GNU # ------------------- # Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace @@ -17,7 +55,7 @@ AC_DEFUN([gl_FUNC_REALLOC_GNU], [Define to 1 if your system has a GNU libc compatible 'realloc' function, and to 0 otherwise.])], [AC_DEFINE([HAVE_REALLOC_GNU], [0]) - gl_REPLACE_REALLOC + REPLACE_REALLOC=1 ]) ])# gl_FUNC_REALLOC_GNU @@ -33,12 +71,6 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX], AC_DEFINE([HAVE_REALLOC_POSIX], [1], [Define if the 'realloc' function is POSIX compliant.]) else - gl_REPLACE_REALLOC + REPLACE_REALLOC=1 fi ]) - -AC_DEFUN([gl_REPLACE_REALLOC], -[ - AC_LIBOBJ([realloc]) - REPLACE_REALLOC=1 -]) diff --git a/m4/regex.m4 b/m4/regex.m4 index 38f1dd76b..3334c1041 100644 --- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,7 +1,6 @@ -# serial 56 +# serial 64 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 1996-2001, 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,8 +13,6 @@ AC_PREREQ([2.50]) AC_DEFUN([gl_REGEX], [ - AC_CHECK_HEADERS_ONCE([locale.h]) - AC_ARG_WITH([included-regex], [AS_HELP_STRING([--without-included-regex], [don't compile regex; this is the default on systems @@ -30,31 +27,41 @@ AC_DEFUN([gl_REGEX], # following run test, then default to *not* using the included regex.c. # If cross compiling, assume the test would fail and use the included # regex.c. + AC_CHECK_DECLS_ONCE([alarm]) AC_CACHE_CHECK([for working re_compile_pattern], [gl_cv_func_re_compile_pattern_working], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT[ - #if HAVE_LOCALE_H + [[#include + #include - #endif - #include - #include - ]], - [[static struct re_pattern_buffer regex; + #include + #include + #if HAVE_DECL_ALARM + # include + # include + #endif + ]], + [[int result = 0; + static struct re_pattern_buffer regex; unsigned char folded_chars[UCHAR_MAX + 1]; int i; const char *s; struct re_registers regs; - #if HAVE_LOCALE_H - /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html - This test needs valgrind to catch the bug on Debian - GNU/Linux 3.1 x86, but it might catch the bug better - on other platforms and it shouldn't hurt to try the - test here. */ - if (setlocale (LC_ALL, "en_US.UTF-8")) +#if HAVE_DECL_ALARM + /* Some builds of glibc go into an infinite loop on this test. */ + signal (SIGALRM, SIG_DFL); + alarm (2); +#endif + if (setlocale (LC_ALL, "en_US.UTF-8")) + { { + /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html + This test needs valgrind to catch the bug on Debian + GNU/Linux 3.1 x86, but it might catch the bug better + on other platforms and it shouldn't hurt to try the + test here. */ static char const pat[] = "insert into"; static char const data[] = "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; @@ -63,26 +70,46 @@ AC_DEFUN([gl_REGEX], memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) - return 1; - if (re_search (®ex, data, sizeof data - 1, - 0, sizeof data - 1, ®s) - != -1) - return 1; - if (! setlocale (LC_ALL, "C")) - return 1; + result |= 1; + else if (re_search (®ex, data, sizeof data - 1, + 0, sizeof data - 1, ®s) + != -1) + result |= 1; } - #endif + + { + /* This test is from glibc bug 15078. + The test case is from Andreas Schwab in + . + */ + static char const pat[] = "[^x]x"; + static char const data[] = + "\xe1\x80\x80\xe1\x80\xbb\xe1\x80\xbd\xe1\x80\x94\xe1\x80" + "\xba\xe1\x80\xaf\xe1\x80\x95\xe1\x80\xbax"; + re_set_syntax (0); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern (pat, sizeof pat - 1, ®ex); + if (s) + result |= 1; + else if (re_search (®ex, data, sizeof data - 1, + 0, sizeof data - 1, 0) + != 21) + result |= 1; + } + + if (! setlocale (LC_ALL, "C")) + return 1; + } /* This test is from glibc bug 3957, reported by Andrew Mackey. */ re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[^x]b", 6, ®ex); if (s) - return 1; - + result |= 2; /* This should fail, but succeeds for glibc-2.5. */ - if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) - return 1; + else if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) + result |= 2; /* This regular expression is from Spencer ere test number 75 in grep-2.3. */ @@ -94,7 +121,7 @@ AC_DEFUN([gl_REGEX], s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); /* This should fail with _Invalid character class name_ error. */ if (!s) - return 1; + result |= 4; /* Ensure that [b-a] is diagnosed as invalid, when using RE_NO_EMPTY_RANGES. */ @@ -102,34 +129,31 @@ AC_DEFUN([gl_REGEX], memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[b-a]", 6, ®ex); if (s == 0) - return 1; + result |= 8; /* This should succeed, but does not for glibc-2.1.3. */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("{1", 2, ®ex); - if (s) - return 1; + result |= 8; /* The following example is derived from a problem report against gawk from Jorge Stolfi . */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[an\371]*n", 7, ®ex); if (s) - return 1; - + result |= 8; /* This should match, but does not for glibc-2.2.1. */ - if (re_match (®ex, "an", 2, 0, ®s) != 2) - return 1; + else if (re_match (®ex, "an", 2, 0, ®s) != 2) + result |= 8; memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) - return 1; - + result |= 8; /* glibc-2.2.93 does not work with a negative RANGE argument. */ - if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) - return 1; + else if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) + result |= 8; /* The version of regex.c in older versions of gnulib ignored RE_ICASE. Detect that problem too. */ @@ -137,10 +161,9 @@ AC_DEFUN([gl_REGEX], memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) - return 1; - - if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) - return 1; + result |= 16; + else if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) + result |= 16; /* Catch a bug reported by Vin Shelton in http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html @@ -151,12 +174,12 @@ AC_DEFUN([gl_REGEX], memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); if (s) - return 1; + result |= 32; /* REG_STARTEND was added to glibc on 2004-01-15. Reject older versions. */ if (! REG_STARTEND) - return 1; + result |= 64; #if 0 /* It would be nice to reject hosts whose regoff_t values are too @@ -167,10 +190,11 @@ AC_DEFUN([gl_REGEX], when compiling --without-included-regex. */ if (sizeof (regoff_t) < sizeof (ptrdiff_t) || sizeof (regoff_t) < sizeof (ssize_t)) - return 1; + result |= 64; #endif - return 0;]])], + return result; + ]])], [gl_cv_func_re_compile_pattern_working=yes], [gl_cv_func_re_compile_pattern_working=no], dnl When crosscompiling, assume it is not working. @@ -185,6 +209,9 @@ AC_DEFUN([gl_REGEX], esac if test $ac_use_included_regex = yes; then + AC_DEFINE([_REGEX_INCLUDE_LIMITS_H], [1], + [Define if you want to include , so that it + consistently overrides 's RE_DUP_MAX.]) AC_DEFINE([_REGEX_LARGE_OFFSETS], [1], [Define if you want regoff_t to be at least as wide POSIX requires.]) AC_DEFINE([re_syntax_options], [rpl_re_syntax_options], @@ -217,8 +244,6 @@ AC_DEFUN([gl_REGEX], [Define to rpl_regerror if the replacement should be used.]) AC_DEFINE([regfree], [rpl_regfree], [Define to rpl_regfree if the replacement should be used.]) - AC_LIBOBJ([regex]) - gl_PREREQ_REGEX fi ]) @@ -229,7 +254,8 @@ AC_DEFUN([gl_PREREQ_REGEX], AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) + AC_REQUIRE([gl_EEMALLOC]) AC_CHECK_HEADERS([libintl.h]) AC_CHECK_FUNCS_ONCE([isblank iswctype wcscoll]) - AC_CHECK_DECLS([isblank], [], [], [#include ]) + AC_CHECK_DECLS([isblank], [], [], [[#include ]]) ]) diff --git a/m4/size_max.m4 b/m4/size_max.m4 index f3b1a9dfb..4b247abc0 100644 --- a/m4/size_max.m4 +++ b/m4/size_max.m4 @@ -1,5 +1,5 @@ # size_max.m4 serial 10 -dnl Copyright (C) 2003, 2005-2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/sleep.m4 b/m4/sleep.m4 index a5ec65520..a27baa6d5 100644 --- a/m4/sleep.m4 +++ b/m4/sleep.m4 @@ -1,5 +1,5 @@ -# sleep.m4 serial 3 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# sleep.m4 serial 7 +dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,16 +7,16 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SLEEP], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl We expect to see the declaration of sleep() in a header file. dnl Older versions of mingw have a sleep() function that is an alias to dnl _sleep() in MSVCRT. It has a different signature than POSIX sleep(): dnl it takes the number of milliseconds as argument and returns void. dnl mingw does not declare this function. - AC_CHECK_DECLS([sleep], , , [#include ]) + AC_CHECK_DECLS([sleep], , , [[#include ]]) AC_CHECK_FUNCS_ONCE([sleep]) if test $ac_cv_have_decl_sleep != yes; then HAVE_SLEEP=0 - AC_LIBOBJ([sleep]) else dnl Cygwin 1.5.x has a bug where sleep can't exceed 49.7 days. AC_CACHE_CHECK([for working sleep], [gl_cv_func_sleep_works], @@ -38,12 +38,25 @@ handle_alarm (int sig) signal (SIGALRM, handle_alarm); alarm (1); remaining = sleep (pentecost); - return !(pentecost - 10 < remaining && remaining <= pentecost);]])], + if (remaining > pentecost) + return 3; + if (remaining <= pentecost - 10) + return 4; + return 0; + ]])], [gl_cv_func_sleep_works=yes], [gl_cv_func_sleep_works=no], - [gl_cv_func_sleep_works="guessing no"])]) - if test "$gl_cv_func_sleep_works" != yes; then - REPLACE_SLEEP=1 - AC_LIBOBJ([sleep]) - fi + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_sleep_works="guessing yes" ;; + # If we don't know, assume the worst. + *) gl_cv_func_sleep_works="guessing no" ;; + esac + ])]) + case "$gl_cv_func_sleep_works" in + *yes) ;; + *) + REPLACE_SLEEP=1 + ;; + esac fi ]) diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4 index e4c160b50..633813434 100644 --- a/m4/ssize_t.m4 +++ b/m4/ssize_t.m4 @@ -1,5 +1,5 @@ # ssize_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2001-2003, 2006, 2010 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2003, 2006, 2010-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 new file mode 100644 index 000000000..a866ff670 --- /dev/null +++ b/m4/stdalign.m4 @@ -0,0 +1,52 @@ +# Check for stdalign.h that conforms to C11. + +dnl Copyright 2011-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Prepare for substituting if it is not supported. + +AC_DEFUN([gl_STDALIGN_H], +[ + AC_CACHE_CHECK([for working stdalign.h], + [gl_cv_header_working_stdalign_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + + /* Test that alignof yields a result consistent with offsetof. + This catches GCC bug 52023 + . */ + #ifdef __cplusplus + template struct alignof_helper { char a; t b; }; + # define ao(type) offsetof (alignof_helper, b) + #else + # define ao(type) offsetof (struct { char a; type b; }, b) + #endif + char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1]; + char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; + char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; + + /* Test _Alignas only on platforms where gnulib can help. */ + #if \ + (__GNUC__ || __IBMC__ || __IBMCPP__ \ + || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER) + struct alignas_test { char c; char alignas (8) alignas_8; }; + char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 + ? 1 : -1]; + #endif + ]])], + [gl_cv_header_working_stdalign_h=yes], + [gl_cv_header_working_stdalign_h=no])]) + + if test $gl_cv_header_working_stdalign_h = yes; then + STDALIGN_H='' + else + STDALIGN_H='stdalign.h' + fi + + AC_SUBST([STDALIGN_H]) + AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"]) +]) diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 index 1efe59ea1..80d5559ab 100644 --- a/m4/stdbool.m4 +++ b/m4/stdbool.m4 @@ -1,17 +1,17 @@ # Check for stdbool.h that conforms to C99. -dnl Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -#serial 3 +#serial 5 # Prepare for substituting if it is not supported. AC_DEFUN([AM_STDBOOL_H], [ - AC_REQUIRE([AC_HEADER_STDBOOL]) + AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) # Define two additional variables used in the Makefile substitution. @@ -21,6 +21,7 @@ AC_DEFUN([AM_STDBOOL_H], STDBOOL_H='stdbool.h' fi AC_SUBST([STDBOOL_H]) + AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) if test "$ac_cv_type__Bool" = yes; then HAVE__BOOL=1 @@ -33,11 +34,9 @@ AC_DEFUN([AM_STDBOOL_H], # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) -# This version of the macro is needed in autoconf <= 2.67. Autoconf has -# it built in since 2.60, but we want the tweaks from the 2.68 version -# to avoid rejecting xlc and clang due to relying on extensions. +# This version of the macro is needed in autoconf <= 2.68. -AC_DEFUN([AC_HEADER_STDBOOL], +AC_DEFUN([AC_CHECK_HEADER_STDBOOL], [AC_CACHE_CHECK([for stdbool.h that conforms to C99], [ac_cv_header_stdbool_h], [AC_COMPILE_IFELSE( @@ -98,6 +97,4 @@ AC_DEFUN([AC_HEADER_STDBOOL], [ac_cv_header_stdbool_h=yes], [ac_cv_header_stdbool_h=no])]) AC_CHECK_TYPES([_Bool]) - if test $ac_cv_header_stdbool_h = yes; then - AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.]) - fi]) +]) diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 index c3ae56943..5da8ab1ec 100644 --- a/m4/stddef_h.m4 +++ b/m4/stddef_h.m4 @@ -1,6 +1,6 @@ dnl A placeholder for POSIX 2008 , for platforms that have issues. -# stddef_h.m4 serial 2 -dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# stddef_h.m4 serial 4 +dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,6 +9,7 @@ AC_DEFUN([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) + STDDEF_H= if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h @@ -24,8 +25,10 @@ AC_DEFUN([gl_STDDEF_H], REPLACE_NULL=1 STDDEF_H=stddef.h fi + AC_SUBST([STDDEF_H]) + AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) if test -n "$STDDEF_H"; then - gl_CHECK_NEXT_HEADERS([stddef.h]) + gl_NEXT_HEADERS([stddef.h]) fi ]) @@ -41,5 +44,4 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) - STDDEF_H=''; AC_SUBST([STDDEF_H]) ]) diff --git a/m4/stdint.m4 b/m4/stdint.m4 index c5e813a96..27cdcdb9a 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,5 +1,5 @@ -# stdint.m4 serial 35 -dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. +# stdint.m4 serial 43 +dnl Copyright (C) 2001-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert and Bruno Haible. dnl Test whether is supported or must be substituted. -AC_DEFUN([gl_STDINT_H], +AC_DEFUN_ONCE([gl_STDINT_H], [ AC_PREREQ([2.59])dnl @@ -27,6 +27,15 @@ AC_DEFUN([gl_STDINT_H], fi AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) + dnl Check for , in the same way as gl_WCHAR_H does. + AC_CHECK_HEADERS_ONCE([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) + dnl Check for . dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. if test $ac_cv_header_inttypes_h = yes; then @@ -60,8 +69,6 @@ AC_DEFUN([gl_STDINT_H], [gl_cv_header_working_stdint_h=no AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #include /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ @@ -145,9 +152,11 @@ uintmax_t j = UINTMAX_MAX; #include /* for CHAR_BIT */ #define TYPE_MINIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) #define TYPE_MAXIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + ((t) ((t) 0 < (t) -1 \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) struct s { int check_PTRDIFF: PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) @@ -208,8 +217,6 @@ struct s { dnl This detects a bug on HP-UX 11.23/ia64. AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ #include ] @@ -259,7 +266,7 @@ static const char *macro_values[] = || strncmp (value, "((int)"/*)*/, 6) == 0 || strncmp (value, "((signed short)"/*)*/, 15) == 0 || strncmp (value, "((signed char)"/*)*/, 14) == 0) - return 1; + return mv - macro_values + 1; } return 0; ]])], @@ -290,14 +297,11 @@ static const char *macro_values[] = fi AC_SUBST([HAVE_SYS_BITYPES_H]) - dnl Check for (missing in Linux uClibc when built without wide - dnl character support). - AC_CHECK_HEADERS_ONCE([wchar.h]) - gl_STDINT_TYPE_PROPERTIES STDINT_H=stdint.h fi AC_SUBST([STDINT_H]) + AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) ]) dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) @@ -458,6 +462,14 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], fi gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], [gl_STDINT_INCLUDES]) + + dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99 + dnl requirement that wint_t is "unchanged by default argument promotions". + dnl In this case gnulib's and override wint_t. + dnl Set the variable BITSIZEOF_WINT_T accordingly. + if test $BITSIZEOF_WINT_T -lt 32; then + BITSIZEOF_WINT_T=32 + fi ]) dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4 index 670c0cc2b..511ab4e9c 100644 --- a/m4/stdint_h.m4 +++ b/m4/stdint_h.m4 @@ -1,5 +1,5 @@ # stdint_h.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index d3edb4266..ebade067d 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,5 +1,5 @@ -# stdio_h.m4 serial 31 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# stdio_h.m4 serial 43 +dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,9 +7,32 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDIO_H], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([gl_ASM_SYMBOL_PREFIX]) - gl_CHECK_NEXT_HEADERS([stdio.h]) + gl_NEXT_HEADERS([stdio.h]) + + dnl No need to create extra modules for these functions. Everyone who uses + dnl likely needs them. + GNULIB_FSCANF=1 + gl_MODULE_INDICATOR([fscanf]) + GNULIB_SCANF=1 + gl_MODULE_INDICATOR([scanf]) + GNULIB_FGETC=1 + GNULIB_GETC=1 + GNULIB_GETCHAR=1 + GNULIB_FGETS=1 + GNULIB_FREAD=1 + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING + dnl or GNULIB_NONBLOCKING redundant. + m4_ifdef([gl_NONBLOCKING_IO], [ + gl_NONBLOCKING_IO + if test $gl_cv_have_nonblocking != yes; then + REPLACE_STDIO_READ_FUNCS=1 + AC_LIBOBJ([stdio-read]) + fi + ]) + dnl No need to create extra modules for these functions. Everyone who uses dnl likely needs them. GNULIB_FPRINTF=1 @@ -22,9 +45,11 @@ AC_DEFUN([gl_STDIO_H], GNULIB_FPUTS=1 GNULIB_PUTS=1 GNULIB_FWRITE=1 - dnl This ifdef is just an optimization, to avoid performing a configure - dnl check whose result is not used. It does not make the test of - dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant. + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or + dnl GNULIB_SIGPIPE redundant. m4_ifdef([gl_SIGNAL_SIGPIPE], [ gl_SIGNAL_SIGPIPE if test $gl_cv_header_signal_h_SIGPIPE != yes; then @@ -32,13 +57,25 @@ AC_DEFUN([gl_STDIO_H], AC_LIBOBJ([stdio-write]) fi ]) + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING + dnl or GNULIB_NONBLOCKING redundant. + m4_ifdef([gl_NONBLOCKING_IO], [ + gl_NONBLOCKING_IO + if test $gl_cv_have_nonblocking != yes; then + REPLACE_STDIO_WRITE_FUNCS=1 + AC_LIBOBJ([stdio-write]) + fi + ]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by both C89 and C11. gl_WARN_ON_USE_PREPARE([[#include - ]], [dprintf fpurge fseeko ftello getdelim getline gets popen renameat - snprintf tmpfile vdprintf vsnprintf]) + ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen + renameat snprintf tmpfile vdprintf vsnprintf]) ]) AC_DEFUN([gl_STDIO_MODULE_INDICATOR], @@ -54,23 +91,31 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], [ GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) + GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN]) GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) + GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC]) + GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS]) GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) + GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD]) GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) + GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF]) GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) + GNULIB_GETC=0; AC_SUBST([GNULIB_GETC]) + GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR]) GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) + GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE]) GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) @@ -81,11 +126,15 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) + GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF]) GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) + GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING]) GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) + GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF]) + GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF]) GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) @@ -95,6 +144,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) + HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) + HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) @@ -103,11 +154,14 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) + HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE]) + HAVE_POPEN=1; AC_SUBST([HAVE_POPEN]) HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) + REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN]) REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) @@ -128,6 +182,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) + REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS]) REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) @@ -137,23 +192,3 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) ]) - -dnl Code shared by fseeko and ftello. Determine if large files are supported, -dnl but stdin does not start as a large file by default. -AC_DEFUN([gl_STDIN_LARGE_OFFSET], - [ - AC_CACHE_CHECK([whether stdin defaults to large file offsets], - [gl_cv_var_stdin_large_offset], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], -[[#if defined __SL64 && defined __SCLE /* cygwin */ - /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making - fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and - it is easier to do a version check than building a runtime test. */ -# include -# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25) - choke me -# endif -#endif]])], - [gl_cv_var_stdin_large_offset=yes], - [gl_cv_var_stdin_large_offset=no])]) -]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index fc150197b..2027ab3c1 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,5 +1,5 @@ -# stdlib_h.m4 serial 30 -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +# stdlib_h.m4 serial 42 +dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,21 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDLIB_H], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([stdlib.h]) - AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT]) - if test $ac_cv_header_random_h = yes; then - HAVE_RANDOM_H=1 - else - HAVE_RANDOM_H=0 - fi - AC_SUBST([HAVE_RANDOM_H]) - AC_CHECK_TYPES([struct random_data], - [], [HAVE_STRUCT_RANDOM_DATA=0], - [[#include - #if HAVE_RANDOM_H - # include - #endif - ]]) + gl_NEXT_HEADERS([stdlib.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not @@ -33,10 +19,11 @@ AC_DEFUN([gl_STDLIB_H], #if HAVE_RANDOM_H # include #endif - ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp - mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r - setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt - unsetenv]) + ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt + initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps + posix_openpt ptsname ptsname_r random random_r realpath rpmatch + secure_getenv setenv setstate setstate_r srandom srandom_r + strtod strtoll strtoull unlockpt unsetenv]) ]) AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], @@ -58,23 +45,30 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) + GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) + GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT]) GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) + GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) + GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) + GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) + GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) + GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) @@ -87,26 +81,37 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) + HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) + HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) + HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) + HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) + HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) + HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) - HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV]) + HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) + REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) + REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) + REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) ]) diff --git a/m4/strcase.m4 b/m4/strcase.m4 index 33de423a0..22bf57c95 100644 --- a/m4/strcase.m4 +++ b/m4/strcase.m4 @@ -1,5 +1,5 @@ -# strcase.m4 serial 10 -dnl Copyright (C) 2002, 2005-2010 Free Software Foundation, Inc. +# strcase.m4 serial 11 +dnl Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -13,19 +13,20 @@ AC_DEFUN([gl_STRCASE], AC_DEFUN([gl_FUNC_STRCASECMP], [ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) - AC_REPLACE_FUNCS([strcasecmp]) + AC_CHECK_FUNCS([strcasecmp]) if test $ac_cv_func_strcasecmp = no; then HAVE_STRCASECMP=0 - gl_PREREQ_STRCASECMP fi ]) AC_DEFUN([gl_FUNC_STRNCASECMP], [ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) - AC_REPLACE_FUNCS([strncasecmp]) - if test $ac_cv_func_strncasecmp = no; then - gl_PREREQ_STRNCASECMP + AC_CHECK_FUNCS([strncasecmp]) + if test $ac_cv_func_strncasecmp = yes; then + HAVE_STRNCASECMP=1 + else + HAVE_STRNCASECMP=0 fi AC_CHECK_DECLS([strncasecmp]) if test $ac_cv_have_decl_strncasecmp = no; then diff --git a/m4/strchrnul.m4 b/m4/strchrnul.m4 index 0072e60e7..b59eda9d7 100644 --- a/m4/strchrnul.m4 +++ b/m4/strchrnul.m4 @@ -1,5 +1,5 @@ -# strchrnul.m4 serial 7 -dnl Copyright (C) 2003, 2007, 2009, 2010 Free Software Foundation, Inc. +# strchrnul.m4 serial 9 +dnl Copyright (C) 2003, 2007, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,10 +10,39 @@ AC_DEFUN([gl_FUNC_STRCHRNUL], AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS([strchrnul]) + AC_CHECK_FUNCS([strchrnul]) if test $ac_cv_func_strchrnul = no; then HAVE_STRCHRNUL=0 - gl_PREREQ_STRCHRNUL + else + AC_CACHE_CHECK([whether strchrnul works], + [gl_cv_func_strchrnul_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include /* for strchrnul */ +]], [[const char *buf = "a"; + return strchrnul (buf, 'b') != buf + 1; + ]])], + [gl_cv_func_strchrnul_works=yes], + [gl_cv_func_strchrnul_works=no], + [dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10 + AC_EGREP_CPP([Lucky user], + [ +#if defined __CYGWIN__ + #include + #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9) + Lucky user + #endif +#else + Lucky user +#endif + ], + [gl_cv_func_strchrnul_works="guessing yes"], + [gl_cv_func_strchrnul_works="guessing no"]) + ]) + ]) + case "$gl_cv_func_strchrnul_works" in + *yes) ;; + *) REPLACE_STRCHRNUL=1 ;; + esac fi ]) diff --git a/m4/strerror.m4 b/m4/strerror.m4 index 1649b2451..3989844b2 100644 --- a/m4/strerror.m4 +++ b/m4/strerror.m4 @@ -1,68 +1,96 @@ -# strerror.m4 serial 9 -dnl Copyright (C) 2002, 2007-2010 Free Software Foundation, Inc. +# strerror.m4 serial 17 +dnl Copyright (C) 2002, 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRERROR], -[ - AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE]) - if test $REPLACE_STRERROR = 1; then - AC_LIBOBJ([strerror]) - AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR], - [Define this to 1 if strerror is broken.]) - fi -]) - -# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ). -AC_DEFUN([gl_FUNC_STRERROR_SEPARATE], [ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REQUIRE([gl_HEADER_ERRNO_H]) - if test -z "$ERRNO_H"; then + AC_REQUIRE([gl_FUNC_STRERROR_0]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ + AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) + ]) + if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then AC_CACHE_CHECK([for working strerror function], [gl_cv_func_working_strerror], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include ]], - [[return !*strerror (-2);]])], + [[if (!*strerror (-2)) return 1;]])], [gl_cv_func_working_strerror=yes], [gl_cv_func_working_strerror=no], - [dnl Assume crossbuild works if it compiles. - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], - [[return !*strerror (-2);]])], - [gl_cv_func_working_strerror=yes], - [gl_cv_func_working_strerror=no]) - ]) + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_working_strerror="guessing yes" ;; + # If we don't know, assume the worst. + *) gl_cv_func_working_strerror="guessing no" ;; + esac + ]) + ]) + case "$gl_cv_func_working_strerror" in + *yes) ;; + *) + dnl The system's strerror() fails to return a string for out-of-range + dnl integers. Replace it. + REPLACE_STRERROR=1 + ;; + esac + m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ + dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's + dnl buffer, we must replace strerror. + case "$gl_cv_func_strerror_r_works" in + *no) REPLACE_STRERROR=1 ;; + esac ]) - if test $gl_cv_func_working_strerror = no; then - dnl The system's strerror() fails to return a string for out-of-range - dnl integers. Replace it. - REPLACE_STRERROR=1 - fi else dnl The system's strerror() cannot know about the new errno values we add - dnl to . Replace it. + dnl to , or any fix for strerror(0). Replace it. REPLACE_STRERROR=1 fi - if test $REPLACE_STRERROR = 1; then - gl_PREREQ_STRERROR - fi ]) -# Prerequisites of lib/strerror.c. -AC_DEFUN([gl_PREREQ_STRERROR], [ - AC_CHECK_DECLS([strerror]) - AC_CHECK_HEADERS_ONCE([sys/socket.h]) - if test $ac_cv_header_sys_socket_h != yes; then - dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make - dnl the check for those headers unconditional; yet cygwin reports - dnl that the headers are present but cannot be compiled (since on - dnl cygwin, all socket information should come from sys/socket.h). - AC_CHECK_HEADERS([winsock2.h]) - fi +dnl Detect if strerror(0) passes (that is, does not set errno, and does not +dnl return a string that matches strerror(-1)). +AC_DEFUN([gl_FUNC_STRERROR_0], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + REPLACE_STRERROR_0=0 + AC_CACHE_CHECK([whether strerror(0) succeeds], + [gl_cv_func_strerror_0_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + ]], + [[int result = 0; + char *str; + errno = 0; + str = strerror (0); + if (!*str) result |= 1; + if (errno) result |= 2; + if (strstr (str, "nknown") || strstr (str, "ndefined")) + result |= 4; + return result;]])], + [gl_cv_func_strerror_0_works=yes], + [gl_cv_func_strerror_0_works=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; + # If we don't know, assume the worst. + *) gl_cv_func_strerror_0_works="guessing no" ;; + esac + ]) + ]) + case "$gl_cv_func_strerror_0_works" in + *yes) ;; + *) + REPLACE_STRERROR_0=1 + AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0) + does not return a message implying success.]) + ;; + esac ]) diff --git a/m4/string_h.m4 b/m4/string_h.m4 index 1977aecf9..cc5fbbb32 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -1,11 +1,11 @@ # Configure a GNU-like replacement for . -# Copyright (C) 2007-2010 Free Software Foundation, Inc. +# Copyright (C) 2007-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 17 +# serial 21 # Written by Paul Eggert. @@ -20,16 +20,16 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - gl_CHECK_NEXT_HEADERS([string.h]) + gl_NEXT_HEADERS([string.h]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include ]], - [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup - strncat strndup strnlen strpbrk strsep strcasestr strtok_r strsignal - strverscmp]) + [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul + strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r + strerror_r strsignal strverscmp]) ]) AC_DEFUN([gl_STRING_MODULE_INDICATOR], @@ -43,6 +43,8 @@ AC_DEFUN([gl_STRING_MODULE_INDICATOR], AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], [ + GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) + GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) @@ -75,10 +77,13 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) + GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R]) GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) + HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) @@ -94,6 +99,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) + HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) @@ -102,7 +108,9 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) + REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) diff --git a/m4/strings_h.m4 b/m4/strings_h.m4 index 4374c7cbe..76ef2424e 100644 --- a/m4/strings_h.m4 +++ b/m4/strings_h.m4 @@ -1,7 +1,7 @@ -# Configure a replacement for . -# serial 3 +# Configure a replacement for . +# serial 6 -# Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. +# Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,12 +16,23 @@ AC_DEFUN([gl_HEADER_STRINGS_H], AC_DEFUN([gl_HEADER_STRINGS_H_BODY], [ AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([strings.h]) + if test $ac_cv_header_strings_h = yes; then + HAVE_STRINGS_H=1 + else + HAVE_STRINGS_H=0 + fi + AC_SUBST([HAVE_STRINGS_H]) dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include - ]], [strcasecmp strncasecmp]) + gl_WARN_ON_USE_PREPARE([[ + /* Minix 3.1.8 has a bug: must be included before + . */ + #include + #include + ]], [ffs strcasecmp strncasecmp]) ]) AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], @@ -33,7 +44,9 @@ AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS], [ + GNULIB_FFS=0; AC_SUBST([GNULIB_FFS]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FFS=1; AC_SUBST([HAVE_FFS]) HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) ]) diff --git a/m4/strndup.m4 b/m4/strndup.m4 index b3567d898..a1f82743f 100644 --- a/m4/strndup.m4 +++ b/m4/strndup.m4 @@ -1,5 +1,5 @@ -# strndup.m4 serial 18 -dnl Copyright (C) 2002-2003, 2005-2010 Free Software Foundation, Inc. +# strndup.m4 serial 21 +dnl Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,13 +18,18 @@ AC_DEFUN([gl_FUNC_STRNDUP], fi if test $ac_cv_func_strndup = yes; then + HAVE_STRNDUP=1 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works], [AC_RUN_IFELSE([ AC_LANG_PROGRAM([[#include #include ]], [[ -#ifndef HAVE_DECL_STRNDUP - extern char *strndup (const char *, size_t); +#if !HAVE_DECL_STRNDUP + extern + #ifdef __cplusplus + "C" + #endif + char *strndup (const char *, size_t); #endif char *s; s = strndup ("some longer string", 15); @@ -42,12 +47,9 @@ changequote(,)dnl changequote([,])dnl ])]) case $gl_cv_func_strndup_works in - *no) - REPLACE_STRNDUP=1 - AC_LIBOBJ([strndup]) - ;; + *no) REPLACE_STRNDUP=1 ;; esac else - AC_LIBOBJ([strndup]) + HAVE_STRNDUP=0 fi ]) diff --git a/m4/strnlen.m4 b/m4/strnlen.m4 index 52bb838f9..eae82b772 100644 --- a/m4/strnlen.m4 +++ b/m4/strnlen.m4 @@ -1,5 +1,5 @@ -# strnlen.m4 serial 12 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation, +# strnlen.m4 serial 13 +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -16,16 +16,14 @@ AC_DEFUN([gl_FUNC_STRNLEN], if test $ac_cv_have_decl_strnlen = no; then HAVE_DECL_STRNLEN=0 else - AC_FUNC_STRNLEN + m4_pushdef([AC_LIBOBJ], [:]) dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]). + AC_FUNC_STRNLEN + m4_popdef([AC_LIBOBJ]) if test $ac_cv_func_strnlen_working = no; then REPLACE_STRNLEN=1 fi fi - if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then - AC_LIBOBJ([strnlen]) - gl_PREREQ_STRNLEN - fi ]) # Prerequisites of lib/strnlen.c. diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 new file mode 100644 index 000000000..94863776d --- /dev/null +++ b/m4/sys_socket_h.m4 @@ -0,0 +1,176 @@ +# sys_socket_h.m4 serial 23 +dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson. + +AC_DEFUN([gl_HEADER_SYS_SOCKET], +[ + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have + dnl old-style declarations (with return type 'int' instead of 'ssize_t') + dnl unless _POSIX_PII_SOCKET is defined. + case "$host_os" in + osf*) + AC_DEFINE([_POSIX_PII_SOCKET], [1], + [Define to 1 in order to get the POSIX compatible declarations + of socket functions.]) + ;; + esac + + AC_CACHE_CHECK([whether is self-contained], + [gl_cv_header_sys_socket_h_selfcontained], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], + [gl_cv_header_sys_socket_h_selfcontained=yes], + [gl_cv_header_sys_socket_h_selfcontained=no]) + ]) + if test $gl_cv_header_sys_socket_h_selfcontained = yes; then + dnl If the shutdown function exists, should define + dnl SHUT_RD, SHUT_WR, SHUT_RDWR. + AC_CHECK_FUNCS([shutdown]) + if test $ac_cv_func_shutdown = yes; then + AC_CACHE_CHECK([whether defines the SHUT_* macros], + [gl_cv_header_sys_socket_h_shut], + [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])], + [gl_cv_header_sys_socket_h_shut=yes], + [gl_cv_header_sys_socket_h_shut=no]) + ]) + if test $gl_cv_header_sys_socket_h_shut = no; then + SYS_SOCKET_H='sys/socket.h' + fi + fi + fi + # We need to check for ws2tcpip.h now. + gl_PREREQ_SYS_H_SOCKET + AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ + /* sys/types.h is not needed according to POSIX, but the + sys/socket.h in i386-unknown-freebsd4.10 and + powerpc-apple-darwin5.5 required it. */ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +]) + if test $ac_cv_type_struct_sockaddr_storage = no; then + HAVE_STRUCT_SOCKADDR_STORAGE=0 + fi + if test $ac_cv_type_sa_family_t = no; then + HAVE_SA_FAMILY_T=0 + fi + if test $ac_cv_type_struct_sockaddr_storage != no; then + AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], + [], + [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0], + [#include + #ifdef HAVE_SYS_SOCKET_H + #include + #endif + #ifdef HAVE_WS2TCPIP_H + #include + #endif + ]) + fi + if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ + || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then + SYS_SOCKET_H='sys/socket.h' + fi + gl_PREREQ_SYS_H_WINSOCK2 + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* Some systems require prerequisite headers. */ +#include +#include + ]], [socket connect accept bind getpeername getsockname getsockopt + listen recv send recvfrom sendto setsockopt shutdown accept4]) +]) + +AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], +[ + dnl Check prerequisites of the replacement. + AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) + gl_CHECK_NEXT_HEADERS([sys/socket.h]) + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_SYS_SOCKET_H=1 + HAVE_WS2TCPIP_H=0 + else + HAVE_SYS_SOCKET_H=0 + if test $ac_cv_header_ws2tcpip_h = yes; then + HAVE_WS2TCPIP_H=1 + else + HAVE_WS2TCPIP_H=0 + fi + fi + AC_SUBST([HAVE_SYS_SOCKET_H]) + AC_SUBST([HAVE_WS2TCPIP_H]) +]) + +# Common prerequisites of the replacement and of the +# replacement. +# Sets and substitutes HAVE_WINSOCK2_H. +AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], +[ + m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) + m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) + AC_CHECK_HEADERS_ONCE([sys/socket.h]) + if test $ac_cv_header_sys_socket_h != yes; then + dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make + dnl the check for those headers unconditional; yet cygwin reports + dnl that the headers are present but cannot be compiled (since on + dnl cygwin, all socket information should come from sys/socket.h). + AC_CHECK_HEADERS([winsock2.h]) + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + AC_SUBST([HAVE_WINSOCK2_H]) +]) + +AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], +[ + GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) + GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) + GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) + GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) + GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) + GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) + GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) + GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) + GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) + GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) + GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) + GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) + GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) + GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) + GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) + HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) + HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; + AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) + HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) + HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) +]) diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4 new file mode 100644 index 000000000..d15c1b370 --- /dev/null +++ b/m4/sys_types_h.m4 @@ -0,0 +1,24 @@ +# sys_types_h.m4 serial 5 +dnl Copyright (C) 2011-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_SYS_TYPES_H], +[ + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) + gl_NEXT_HEADERS([sys/types.h]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + + dnl Whether to override the 'off_t' type. + AC_REQUIRE([gl_TYPE_OFF_T]) +]) + +AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], +[ +]) diff --git a/m4/sys_wait_h.m4 b/m4/sys_wait_h.m4 deleted file mode 100644 index b0d23fac7..000000000 --- a/m4/sys_wait_h.m4 +++ /dev/null @@ -1,25 +0,0 @@ -# sys_wait_h.m4 serial 4 -dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_SYS_WAIT_H], -[ - AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS]) - - dnl is always overridden, because of GNULIB_POSIXCHECK. - gl_CHECK_NEXT_HEADERS([sys/wait.h]) -]) - -AC_DEFUN([gl_SYS_WAIT_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -]) - -AC_DEFUN([gl_SYS_WAIT_H_DEFAULTS], -[ - dnl Assume proper GNU behavior unless another module says otherwise. -]) diff --git a/m4/sysexits.m4 b/m4/sysexits.m4 index b3baa51ca..bd8abaa0d 100644 --- a/m4/sysexits.m4 +++ b/m4/sysexits.m4 @@ -1,5 +1,5 @@ -# sysexits.m4 serial 5 -dnl Copyright (C) 2003, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. +# sysexits.m4 serial 6 +dnl Copyright (C) 2003, 2005, 2007, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -40,4 +40,5 @@ AC_DEFUN([gl_SYSEXITS], fi AC_SUBST([HAVE_SYSEXITS_H]) AC_SUBST([SYSEXITS_H]) + AM_CONDITIONAL([GL_GENERATE_SYSEXITS_H], [test -n "$SYSEXITS_H"]) ]) diff --git a/m4/threadlib.m4 b/m4/threadlib.m4 index bff01bc5e..26bdeb58a 100644 --- a/m4/threadlib.m4 +++ b/m4/threadlib.m4 @@ -1,5 +1,5 @@ -# threadlib.m4 serial 6 (gettext-0.18.2) -dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. +# threadlib.m4 serial 10 (gettext-0.18.2) +dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,8 +9,13 @@ dnl From Bruno Haible. dnl gl_THREADLIB dnl ------------ dnl Tests for a multithreading library to be used. +dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO +dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the +dnl default is 'no', otherwise it is system dependent. In both cases, the user +dnl can change the choice through the options --enable-threads=choice or +dnl --disable-threads. dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, -dnl USE_PTH_THREADS, USE_WIN32_THREADS +dnl USE_PTH_THREADS, USE_WINDOWS_THREADS dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with dnl libtool). @@ -44,10 +49,12 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY], [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. - m4_divert_text([DEFAULTS], [gl_use_threads_default=]) + m4_ifdef([gl_THREADLIB_DEFAULT_NO], + [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], + [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) AC_ARG_ENABLE([threads], -AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) -AC_HELP_STRING([--disable-threads], [build without multithread safety]), +AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ +AC_HELP_STRING([--disable-threads], [build without multithread safety])]), [gl_use_threads=$enableval], [if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" @@ -243,7 +250,7 @@ int main () AC_LIB_LINKFLAGS([pth]) gl_have_pth= gl_save_LIBS="$LIBS" - LIBS="$LIBS -lpth" + LIBS="$LIBS $LIBPTH" AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[pth_self();]])], [gl_have_pth=yes]) @@ -269,17 +276,19 @@ int main () fi fi if test -z "$gl_have_pthread"; then - if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then - if { case "$host_os" in - mingw*) true;; - *) false;; - esac - }; then - gl_threads_api=win32 - AC_DEFINE([USE_WIN32_THREADS], [1], - [Define if the Win32 multithreading API can be used.]) - fi - fi + case "$gl_use_threads" in + yes | windows | win32) # The 'win32' is for backward compatibility. + if { case "$host_os" in + mingw*) true;; + *) false;; + esac + }; then + gl_threads_api=windows + AC_DEFINE([USE_WINDOWS_THREADS], [1], + [Define if the native Windows multithreading API can be used.]) + fi + ;; + esac fi fi AC_MSG_CHECKING([for multithread API to use]) @@ -310,50 +319,50 @@ AC_DEFUN([gl_DISABLE_THREADS], [ dnl Survey of platforms: dnl -dnl Platform Available Compiler Supports test-lock -dnl flavours option weak result -dnl --------------- --------- --------- -------- --------- -dnl Linux 2.4/glibc posix -lpthread Y OK +dnl Platform Available Compiler Supports test-lock +dnl flavours option weak result +dnl --------------- --------- --------- -------- --------- +dnl Linux 2.4/glibc posix -lpthread Y OK dnl -dnl GNU Hurd/glibc posix +dnl GNU Hurd/glibc posix dnl -dnl FreeBSD 5.3 posix -lc_r Y -dnl posix -lkse ? Y -dnl posix -lpthread ? Y -dnl posix -lthr Y +dnl FreeBSD 5.3 posix -lc_r Y +dnl posix -lkse ? Y +dnl posix -lpthread ? Y +dnl posix -lthr Y dnl -dnl FreeBSD 5.2 posix -lc_r Y -dnl posix -lkse Y -dnl posix -lthr Y +dnl FreeBSD 5.2 posix -lc_r Y +dnl posix -lkse Y +dnl posix -lthr Y dnl -dnl FreeBSD 4.0,4.10 posix -lc_r Y OK +dnl FreeBSD 4.0,4.10 posix -lc_r Y OK dnl -dnl NetBSD 1.6 -- +dnl NetBSD 1.6 -- dnl -dnl OpenBSD 3.4 posix -lpthread Y OK +dnl OpenBSD 3.4 posix -lpthread Y OK dnl -dnl MacOS X 10.[123] posix -lpthread Y OK +dnl Mac OS X 10.[123] posix -lpthread Y OK dnl -dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK -dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK +dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK +dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK dnl -dnl HP-UX 11 posix -lpthread N (cc) OK +dnl HP-UX 11 posix -lpthread N (cc) OK dnl Y (gcc) dnl -dnl IRIX 6.5 posix -lpthread Y 0.5 +dnl IRIX 6.5 posix -lpthread Y 0.5 dnl -dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK +dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK dnl -dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK +dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK dnl -lpthread (gcc) Y dnl -dnl Cygwin posix -lpthread Y OK +dnl Cygwin posix -lpthread Y OK dnl -dnl Any of the above pth -lpth 0.0 +dnl Any of the above pth -lpth 0.0 dnl -dnl Mingw win32 N OK +dnl Mingw windows N OK dnl -dnl BeOS 5 -- +dnl BeOS 5 -- dnl dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is dnl turned off: diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4 index 03b51bcfe..c6ff80067 100644 --- a/m4/uintmax_t.m4 +++ b/m4/uintmax_t.m4 @@ -1,5 +1,5 @@ # uintmax_t.m4 serial 12 -dnl Copyright (C) 1997-2004, 2007-2010 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 48d06c742..32dcfa582 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,5 +1,5 @@ -# unistd_h.m4 serial 46 -dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. +# unistd_h.m4 serial 66 +dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,11 +11,8 @@ AC_DEFUN([gl_UNISTD_H], dnl Use AC_REQUIRE here, so that the default behavior below is expanded dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - AC_REQUIRE([AC_C_INLINE]) gl_CHECK_NEXT_HEADERS([unistd.h]) - - AC_CHECK_HEADERS_ONCE([unistd.h]) if test $ac_cv_header_unistd_h = yes; then HAVE_UNISTD_H=1 else @@ -23,11 +20,20 @@ AC_DEFUN([gl_UNISTD_H], fi AC_SUBST([HAVE_UNISTD_H]) + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Determine WINDOWS_64_BIT_OFF_T. + AC_REQUIRE([gl_TYPE_OFF_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include + gl_WARN_ON_USE_PREPARE([[ +#if HAVE_UNISTD_H +# include +#endif /* Some systems declare various items in the wrong headers. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include # include # include @@ -35,12 +41,13 @@ AC_DEFUN([gl_UNISTD_H], # include # endif #endif - ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat - fsync ftruncate getcwd getdomainname getdtablesize getgroups - gethostname getlogin getlogin_r getpagesize getusershell setusershell - endusershell lchown link linkat lseek pipe2 pread pwrite readlink - readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat - usleep]) + ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat + fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups + gethostname getlogin getlogin_r getpagesize + getusershell setusershell endusershell + group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite + readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r + unlink unlinkat usleep]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], @@ -54,46 +61,54 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ - GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) - GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) - GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) - GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) - GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) - GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) - GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) - GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) - GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) - GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) - GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) - GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) - GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) - GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) - GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) - GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) - GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) - GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) - GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) - GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) - GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) - GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) - GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) - GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) - GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) - GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) - GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) - GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) - GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) - GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) - GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) - GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) - GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) - GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) - GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) - GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) - GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) - GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) - GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) - GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) + GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) + GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) + GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) + GNULIB_DUP=0; AC_SUBST([GNULIB_DUP]) + GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) + GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) + GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) + GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) + GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) + GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) + GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) + GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC]) + GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) + GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) + GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) + GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) + GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) + GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) + GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) + GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) + GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) + GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) + GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) + GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) + GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY]) + GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) + GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) + GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) + GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) + GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) + GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) + GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) + GNULIB_READ=0; AC_SUBST([GNULIB_READ]) + GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) + GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) + GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) + GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME]) + GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) + GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) + GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) + GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) + GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) + GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) + GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) + GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) + GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) + GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) @@ -102,32 +117,39 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) + HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) - HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) + HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) + HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) + HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME]) HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) - HAVE_TTYNAME_R=1; AC_SUBST([HAVE_TTYNAME_R]) HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) + HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) + HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) + HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) + HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME]) + HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) @@ -135,15 +157,20 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) + REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) + REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) + REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) + REPLACE_READ=0; AC_SUBST([REPLACE_READ]) REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) diff --git a/m4/vasnprintf.m4 b/m4/vasnprintf.m4 index ebe3c52cd..d730e435a 100644 --- a/m4/vasnprintf.m4 +++ b/m4/vasnprintf.m4 @@ -1,5 +1,5 @@ -# vasnprintf.m4 serial 31 -dnl Copyright (C) 2002-2004, 2006-2010 Free Software Foundation, Inc. +# vasnprintf.m4 serial 36 +dnl Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -29,7 +29,7 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], gl_PREREQ_ASNPRINTF ]) -# Prequisites of lib/printf-args.h, lib/printf-args.c. +# Prerequisites of lib/printf-args.h, lib/printf-args.c. AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) @@ -37,9 +37,10 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], AC_REQUIRE([gt_TYPE_WINT_T]) ]) -# Prequisites of lib/printf-parse.h, lib/printf-parse.c. +# Prerequisites of lib/printf-parse.h, lib/printf-parse.c. AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ + AC_REQUIRE([gl_FEATURES_H]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) @@ -54,7 +55,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], # Prerequisites of lib/vasnprintf.c. AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], [ - AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_WCHAR_T]) @@ -62,7 +62,10 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). - AC_CHECK_DECLS([_snprintf], , , [#include ]) + AC_CHECK_DECLS([_snprintf], , , [[#include ]]) + dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization + dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. + AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) dnl We can avoid a lot of code by assuming that snprintf's return value dnl conforms to ISO C99. So check that. AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) diff --git a/m4/visibility.m4 b/m4/visibility.m4 index 19cd8f3d3..6cbd7e5f2 100644 --- a/m4/visibility.m4 +++ b/m4/visibility.m4 @@ -1,5 +1,5 @@ -# visibility.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2005, 2008, 2010 Free Software Foundation, Inc. +# visibility.m4 serial 5 (gettext-0.18.2) +dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,7 +12,7 @@ dnl __attribute__((__visibility__("hidden"))) and dnl __attribute__((__visibility__("default"))). dnl Does *not* test for __visibility__("protected") - which has tricky dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on -dnl MacOS X. +dnl Mac OS X. dnl Does *not* test for __visibility__("internal") - which has processor dnl dependent semantics. dnl Does *not* test for #pragma GCC visibility push(hidden) - which is diff --git a/m4/vsnprintf.m4 b/m4/vsnprintf.m4 index ed189c238..4900764ee 100644 --- a/m4/vsnprintf.m4 +++ b/m4/vsnprintf.m4 @@ -1,9 +1,13 @@ -# vsnprintf.m4 serial 5 -dnl Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc. +# vsnprintf.m4 serial 6 +dnl Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, +dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib +dnl must guarantee that the decision for replacing vsnprintf is a superset +dnl of the reasons checked by libintl. AC_DEFUN([gl_FUNC_VSNPRINTF], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) @@ -13,7 +17,17 @@ AC_DEFUN([gl_FUNC_VSNPRINTF], gl_SNPRINTF_SIZE1 case "$gl_cv_func_snprintf_size1" in *yes) - gl_cv_func_vsnprintf_usable=yes + gl_SNPRINTF_RETVAL_C99 + case "$gl_cv_func_snprintf_retval_c99" in + *yes) + gl_PRINTF_POSITIONS + case "$gl_cv_func_printf_positions" in + *yes) + gl_cv_func_vsnprintf_usable=yes + ;; + esac + ;; + esac ;; esac fi diff --git a/m4/warn-on-use.m4 b/m4/warn-on-use.m4 index 42daae87b..e43beebd9 100644 --- a/m4/warn-on-use.m4 +++ b/m4/warn-on-use.m4 @@ -1,5 +1,5 @@ -# warn-on-use.m4 serial 2 -dnl Copyright (C) 2010 Free Software Foundation, Inc. +# warn-on-use.m4 serial 5 +dnl Copyright (C) 2010-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,8 +18,8 @@ dnl with or without modifications, as long as this notice is preserved. # some systems declare functions in the wrong header, then INCLUDES # should do likewise. # -# If you assume C89, then it is generally safe to assume declarations -# for functions declared in that standard (such as gets) without +# It is generally safe to assume declarations for functions declared +# in the intersection of C89 and C11 (such as printf) without # needing gl_WARN_ON_USE_PREPARE. AC_DEFUN([gl_WARN_ON_USE_PREPARE], [ @@ -27,6 +27,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), [Define to 1 if ]m4_defn([gl_decl])[ is declared even after undefining macros.])])dnl +dnl FIXME: gl_Symbol must be used unquoted until we can assume +dnl autoconf 2.64 or newer. for gl_func in m4_flatten([$2]); do AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl AC_CACHE_CHECK([whether $gl_func is declared without a macro], @@ -35,8 +37,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], [@%:@undef $gl_func (void) $gl_func;])], [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) - AS_VAR_IF(gl_Symbol, [yes], - [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) + AS_VAR_IF(gl_Symbol, [yes], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) dnl shortcut - if the raw declaration exists, then set a cache dnl variable to allow skipping any later AC_CHECK_DECL efforts eval ac_cv_have_decl_$gl_func=yes]) diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index 8cae82dd0..bedb15a44 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -1,13 +1,13 @@ dnl A placeholder for ISO C99 , for platforms that have issues. -dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar_h.m4 serial 33 +# wchar_h.m4 serial 39 AC_DEFUN([gl_WCHAR_H], [ @@ -17,7 +17,6 @@ AC_DEFUN([gl_WCHAR_H], dnl Check for (missing in Linux uClibc when built without wide dnl character support). dnl is always overridden, because of GNULIB_POSIXCHECK. - AC_CHECK_HEADERS_ONCE([wchar.h]) gl_CHECK_NEXT_HEADERS([wchar.h]) if test $ac_cv_header_wchar_h = yes; then HAVE_WCHAR_H=1 @@ -26,6 +25,8 @@ AC_DEFUN([gl_WCHAR_H], fi AC_SUBST([HAVE_WCHAR_H]) + AC_REQUIRE([gl_FEATURES_H]) + AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then HAVE_WINT_T=1 @@ -37,15 +38,23 @@ AC_DEFUN([gl_WCHAR_H], dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ -/* Some systems require additional headers. */ -#ifndef __GLIBC__ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include # include # include #endif #include - ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb - wcsrtombs wcsnrtombs wcwidth]) + ]], + [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb + wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset + wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp + wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr + wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth + ]) ]) dnl Check whether is usable at all. @@ -61,6 +70,13 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], [gl_cv_header_wchar_h_correct_inline=yes AC_LANG_CONFTEST([ AC_LANG_SOURCE([[#define wcstod renamed_wcstod +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include extern int zero (void); int main () { return zero(); } @@ -69,6 +85,13 @@ int main () { return zero(); } mv conftest.$ac_objext conftest1.$ac_objext AC_LANG_CONFTEST([ AC_LANG_SOURCE([[#define wcstod renamed_wcstod +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int zero (void) { return 0; } ]])]) @@ -96,13 +119,6 @@ Configuration aborted.]) fi ]) -dnl Unconditionally enables the replacement of . -AC_DEFUN([gl_REPLACE_WCHAR_H], -[ - dnl This is a no-op, because is always overridden. - : -]) - AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. @@ -114,17 +130,45 @@ AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], AC_DEFUN([gl_WCHAR_H_DEFAULTS], [ - GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) - GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) - GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) - GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) - GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) - GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) - GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) - GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) - GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) - GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) - GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) + GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) + GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) + GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) + GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) + GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) + GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) + GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) + GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) + GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) + GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) + GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) + GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR]) + GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP]) + GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY]) + GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE]) + GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET]) + GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN]) + GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN]) + GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY]) + GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY]) + GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY]) + GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY]) + GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT]) + GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT]) + GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP]) + GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP]) + GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP]) + GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP]) + GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL]) + GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM]) + GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP]) + GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR]) + GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR]) + GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN]) + GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN]) + GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK]) + GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR]) + GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK]) + GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) @@ -135,6 +179,34 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) + HAVE_WMEMCHR=1; AC_SUBST([HAVE_WMEMCHR]) + HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP]) + HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY]) + HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE]) + HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET]) + HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN]) + HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN]) + HAVE_WCSCPY=1; AC_SUBST([HAVE_WCSCPY]) + HAVE_WCPCPY=1; AC_SUBST([HAVE_WCPCPY]) + HAVE_WCSNCPY=1; AC_SUBST([HAVE_WCSNCPY]) + HAVE_WCPNCPY=1; AC_SUBST([HAVE_WCPNCPY]) + HAVE_WCSCAT=1; AC_SUBST([HAVE_WCSCAT]) + HAVE_WCSNCAT=1; AC_SUBST([HAVE_WCSNCAT]) + HAVE_WCSCMP=1; AC_SUBST([HAVE_WCSCMP]) + HAVE_WCSNCMP=1; AC_SUBST([HAVE_WCSNCMP]) + HAVE_WCSCASECMP=1; AC_SUBST([HAVE_WCSCASECMP]) + HAVE_WCSNCASECMP=1; AC_SUBST([HAVE_WCSNCASECMP]) + HAVE_WCSCOLL=1; AC_SUBST([HAVE_WCSCOLL]) + HAVE_WCSXFRM=1; AC_SUBST([HAVE_WCSXFRM]) + HAVE_WCSDUP=1; AC_SUBST([HAVE_WCSDUP]) + HAVE_WCSCHR=1; AC_SUBST([HAVE_WCSCHR]) + HAVE_WCSRCHR=1; AC_SUBST([HAVE_WCSRCHR]) + HAVE_WCSCSPN=1; AC_SUBST([HAVE_WCSCSPN]) + HAVE_WCSSPN=1; AC_SUBST([HAVE_WCSSPN]) + HAVE_WCSPBRK=1; AC_SUBST([HAVE_WCSPBRK]) + HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR]) + HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) + HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) @@ -149,4 +221,5 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) + REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) ]) diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4 index a133e6ad5..e1e1e699d 100644 --- a/m4/wchar_t.m4 +++ b/m4/wchar_t.m4 @@ -1,5 +1,5 @@ # wchar_t.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/wcrtomb.m4 b/m4/wcrtomb.m4 index 0de262e61..f56b5bae9 100644 --- a/m4/wcrtomb.m4 +++ b/m4/wcrtomb.m4 @@ -1,5 +1,5 @@ -# wcrtomb.m4 serial 6 -dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. +# wcrtomb.m4 serial 11 +dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -14,6 +14,22 @@ AC_DEFUN([gl_FUNC_WCRTOMB], AC_CHECK_FUNCS_ONCE([wcrtomb]) if test $ac_cv_func_wcrtomb = no; then HAVE_WCRTOMB=0 + AC_CHECK_DECLS([wcrtomb],,, [[ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +]]) + if test $ac_cv_have_decl_wcrtomb = yes; then + dnl On Minix 3.1.8, the system's declares wcrtomb() although + dnl it does not have the function. Avoid a collision with gnulib's + dnl replacement. + REPLACE_WCRTOMB=1 + fi else if test $REPLACE_MBSTATE_T = 1; then REPLACE_WCRTOMB=1 @@ -43,32 +59,39 @@ changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include -#include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { + int result = 0; if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) - return 1; + result |= 1; } if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) - return 1; + result |= 2; } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) - return 1; + result |= 4; } if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) - return 1; + result |= 8; } - return 0; + return result; }]])], [gl_cv_func_wcrtomb_retval=yes], [gl_cv_func_wcrtomb_retval=no], @@ -81,11 +104,6 @@ int main () esac fi fi - if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then - gl_REPLACE_WCHAR_H - AC_LIBOBJ([wcrtomb]) - gl_PREREQ_WCRTOMB - fi ]) # Prerequisites of lib/wcrtomb.c. diff --git a/m4/wctype_h.m4 b/m4/wctype_h.m4 index bc6b6e791..82ada0eee 100644 --- a/m4/wctype_h.m4 +++ b/m4/wctype_h.m4 @@ -1,8 +1,8 @@ -# wctype_h.m4 serial 8 +# wctype_h.m4 serial 18 dnl A placeholder for ISO C99 , for platforms that lack it. -dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,6 +11,7 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_WCTYPE_H], [ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([iswcntrl]) @@ -20,24 +21,6 @@ AC_DEFUN([gl_WCTYPE_H], HAVE_ISWCNTRL=0 fi AC_SUBST([HAVE_ISWCNTRL]) - AC_CHECK_FUNCS_ONCE([iswblank]) - AC_CHECK_DECLS_ONCE([iswblank]) - if test $ac_cv_func_iswblank = yes; then - HAVE_ISWBLANK=1 - REPLACE_ISWBLANK=0 - else - HAVE_ISWBLANK=0 - if test $ac_cv_have_decl_iswblank = yes; then - REPLACE_ISWBLANK=1 - else - REPLACE_ISWBLANK=0 - fi - fi - AC_SUBST([HAVE_ISWBLANK]) - AC_SUBST([REPLACE_ISWBLANK]) - - AC_CHECK_HEADERS_ONCE([wctype.h]) - AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then @@ -47,39 +30,180 @@ AC_DEFUN([gl_WCTYPE_H], fi AC_SUBST([HAVE_WINT_T]) + gl_CHECK_NEXT_HEADERS([wctype.h]) if test $ac_cv_header_wctype_h = yes; then if test $ac_cv_func_iswcntrl = yes; then dnl Linux libc5 has an iswprint function that returns 0 for all arguments. dnl The other functions are likely broken in the same way. AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ - #include - #include - #include - #include - #include - int main () { return iswprint ('x') == 0; }]])], + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + /* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #include + int main () { return iswprint ('x') == 0; } + ]])], [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include #if __GNU_LIBRARY__ == 1 Linux libc5 i18n is broken. #endif]], [])], - [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) + [gl_cv_func_iswcntrl_works="guessing yes"], + [gl_cv_func_iswcntrl_works="guessing no"]) ]) ]) fi - gl_CHECK_NEXT_HEADERS([wctype.h]) HAVE_WCTYPE_H=1 else HAVE_WCTYPE_H=0 fi AC_SUBST([HAVE_WCTYPE_H]) - if test "$gl_cv_func_iswcntrl_works" = no; then - REPLACE_ISWCNTRL=1 - else - REPLACE_ISWCNTRL=0 - fi + case "$gl_cv_func_iswcntrl_works" in + *yes) REPLACE_ISWCNTRL=0 ;; + *) REPLACE_ISWCNTRL=1 ;; + esac AC_SUBST([REPLACE_ISWCNTRL]) + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + dnl Redefine all of iswcntrl, ..., iswxdigit in . + : + fi + + if test $REPLACE_ISWCNTRL = 1; then + REPLACE_TOWLOWER=1 + else + AC_CHECK_FUNCS([towlower]) + if test $ac_cv_func_towlower = yes; then + REPLACE_TOWLOWER=0 + else + AC_CHECK_DECLS([towlower],,, + [[/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #if HAVE_WCTYPE_H + # include + #endif + ]]) + if test $ac_cv_have_decl_towlower = yes; then + dnl On Minix 3.1.8, the system's declares towlower() and + dnl towupper() although it does not have the functions. Avoid a + dnl collision with gnulib's replacement. + REPLACE_TOWLOWER=1 + else + REPLACE_TOWLOWER=0 + fi + fi + fi + AC_SUBST([REPLACE_TOWLOWER]) + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then + dnl Redefine towlower, towupper in . + : + fi + + dnl We assume that the wctype() and iswctype() functions exist if and only + dnl if the type wctype_t is defined in or in if that + dnl exists. + dnl HP-UX 11.00 declares all these in and lacks . + AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #if HAVE_WCTYPE_H + # include + #endif + wctype_t a; + ]], + [[]])], + [gl_cv_type_wctype_t=yes], + [gl_cv_type_wctype_t=no]) + ]) + if test $gl_cv_type_wctype_t = no; then + HAVE_WCTYPE_T=0 + fi + + dnl We assume that the wctrans() and towctrans() functions exist if and only + dnl if the type wctrans_t is defined in . + AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #include + wctrans_t a; + ]], + [[]])], + [gl_cv_type_wctrans_t=yes], + [gl_cv_type_wctrans_t=no]) + ]) + if test $gl_cv_type_wctrans_t = no; then + HAVE_WCTRANS_T=0 + fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include +# include +# include +# include +#endif +#include + ]], + [wctype iswctype wctrans towctrans + ]) +]) + +AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_WCTYPE_H_DEFAULTS], +[ + GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK]) + GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE]) + GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE]) + GNULIB_WCTRANS=0; AC_SUBST([GNULIB_WCTRANS]) + GNULIB_TOWCTRANS=0; AC_SUBST([GNULIB_TOWCTRANS]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) + HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) + HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) + REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) ]) diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4 new file mode 100644 index 000000000..740f81ee1 --- /dev/null +++ b/m4/wcwidth.m4 @@ -0,0 +1,101 @@ +# wcwidth.m4 serial 23 +dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_WCWIDTH], +[ + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade glibc to declare wcwidth(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gt_TYPE_WCHAR_T]) + AC_REQUIRE([gt_TYPE_WINT_T]) + + AC_CHECK_HEADERS_ONCE([wchar.h]) + AC_CHECK_FUNCS_ONCE([wcwidth]) + + AC_CHECK_DECLS([wcwidth], [], [], [[ +/* AIX 3.2.5 declares wcwidth in . */ +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include +]]) + if test $ac_cv_have_decl_wcwidth != yes; then + HAVE_DECL_WCWIDTH=0 + fi + + if test $ac_cv_func_wcwidth = yes; then + HAVE_WCWIDTH=1 + dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. + dnl On OpenBSD 5.0, wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1. + dnl On OSF/1 5.1, wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. + dnl This leads to bugs in 'ls' (coreutils). + AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales], + [gl_cv_func_wcwidth_works], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +/* AIX 3.2.5 declares wcwidth in . */ +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include +#if !HAVE_DECL_WCWIDTH +extern +# ifdef __cplusplus +"C" +# endif +int wcwidth (int); +#endif +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL) + { + if (wcwidth (0x0301) > 0) + result |= 1; + if (wcwidth (0x05B0) > 0) + result |= 2; + if (wcwidth (0x200B) > 0) + result |= 4; + } + return result; +}]])], + [gl_cv_func_wcwidth_works=yes], + [gl_cv_func_wcwidth_works=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc and AIX 7 systems. + *-gnu* | aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; + *) gl_cv_func_wcwidth_works="guessing no";; + esac +changequote([,])dnl + ]) + ]) + case "$gl_cv_func_wcwidth_works" in + *yes) ;; + *no) REPLACE_WCWIDTH=1 ;; + esac + else + HAVE_WCWIDTH=0 + fi + dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not + dnl have the wcwidth function, then it does not declare it. +]) diff --git a/m4/wint_t.m4 b/m4/wint_t.m4 index 58ef86556..d7cd3db93 100644 --- a/m4/wint_t.m4 +++ b/m4/wint_t.m4 @@ -1,5 +1,5 @@ # wint_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/xsize.m4 b/m4/xsize.m4 index b653693a3..8ea9f2cd3 100644 --- a/m4/xsize.m4 +++ b/m4/xsize.m4 @@ -1,5 +1,5 @@ -# xsize.m4 serial 4 -dnl Copyright (C) 2003-2004, 2008-2010 Free Software Foundation, Inc. +# xsize.m4 serial 5 +dnl Copyright (C) 2003-2004, 2008-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -8,6 +8,5 @@ AC_DEFUN([gl_XSIZE], [ dnl Prerequisites of lib/xsize.h. AC_REQUIRE([gl_SIZE_MAX]) - AC_REQUIRE([AC_C_INLINE]) AC_CHECK_HEADERS([stdint.h]) ]) diff --git a/po/POTFILES.in b/po/POTFILES.in index ec7991423..ac394189c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,3 @@ -./build-aux/arg-nonnull.h -./build-aux/c++defs.h -./build-aux/warn-on-use.h ./grub-core/boot/decompressor/minilib.c ./grub-core/boot/decompressor/none.c ./grub-core/boot/decompressor/xz.c @@ -168,6 +165,7 @@ ./grub-core/fs/ntfs.c ./grub-core/fs/ntfscomp.c ./grub-core/fs/odc.c +./grub-core/fs/proc.c ./grub-core/fs/reiserfs.c ./grub-core/fs/romfs.c ./grub-core/fs/sfs.c @@ -226,9 +224,11 @@ ./grub-core/gnulib/btowc.c ./grub-core/gnulib/dirname.h ./grub-core/gnulib/dirname-lgpl.c +./grub-core/gnulib/dosname.h ./grub-core/gnulib/errno.in.h ./grub-core/gnulib/error.c ./grub-core/gnulib/error.h +./grub-core/gnulib/float.c ./grub-core/gnulib/float+.h ./grub-core/gnulib/float.in.h ./grub-core/gnulib/fnmatch.c @@ -242,16 +242,28 @@ ./grub-core/gnulib/getopt_int.h ./grub-core/gnulib/gettext.h ./grub-core/gnulib/intprops.h +./grub-core/gnulib/itold.c ./grub-core/gnulib/langinfo.in.h ./grub-core/gnulib/localcharset.c ./grub-core/gnulib/localcharset.h +./grub-core/gnulib/localeconv.c +./grub-core/gnulib/locale.in.h ./grub-core/gnulib/malloc.c ./grub-core/gnulib/mbrtowc.c ./grub-core/gnulib/mbsinit.c ./grub-core/gnulib/mbsrtowcs.c +./grub-core/gnulib/mbsrtowcs-impl.h ./grub-core/gnulib/mbsrtowcs-state.c +./grub-core/gnulib/mbswidth.c +./grub-core/gnulib/mbswidth.h +./grub-core/gnulib/mbtowc.c +./grub-core/gnulib/mbtowc-impl.h ./grub-core/gnulib/memchr.c ./grub-core/gnulib/mempcpy.c +./grub-core/gnulib/msvc-inval.c +./grub-core/gnulib/msvc-inval.h +./grub-core/gnulib/msvc-nothrow.c +./grub-core/gnulib/msvc-nothrow.h ./grub-core/gnulib/nl_langinfo.c ./grub-core/gnulib/printf-args.c ./grub-core/gnulib/printf-args.h @@ -269,16 +281,18 @@ ./grub-core/gnulib/regex_internal.h ./grub-core/gnulib/size_max.h ./grub-core/gnulib/sleep.c +./grub-core/gnulib/stdalign.in.h ./grub-core/gnulib/stdbool.in.h ./grub-core/gnulib/stddef.in.h ./grub-core/gnulib/stdint.in.h ./grub-core/gnulib/stdio.in.h -./grub-core/gnulib/stdio-write.c ./grub-core/gnulib/stdlib.in.h ./grub-core/gnulib/strcasecmp.c ./grub-core/gnulib/strchrnul.c ./grub-core/gnulib/streq.h ./grub-core/gnulib/strerror.c +./grub-core/gnulib/strerror-override.c +./grub-core/gnulib/strerror-override.h ./grub-core/gnulib/string.in.h ./grub-core/gnulib/strings.in.h ./grub-core/gnulib/stripslash.c @@ -288,15 +302,23 @@ ./grub-core/gnulib/strnlen1.h ./grub-core/gnulib/strnlen.c ./grub-core/gnulib/sysexits.in.h -./grub-core/gnulib/sys_wait.in.h +./grub-core/gnulib/sys_types.in.h +./grub-core/gnulib/unistd.c ./grub-core/gnulib/unistd.in.h +./grub-core/gnulib/unitypes.in.h +./grub-core/gnulib/uniwidth/cjk.h +./grub-core/gnulib/uniwidth.in.h +./grub-core/gnulib/uniwidth/width.c ./grub-core/gnulib/vasnprintf.c ./grub-core/gnulib/vasnprintf.h ./grub-core/gnulib/verify.h ./grub-core/gnulib/vsnprintf.c ./grub-core/gnulib/wchar.in.h ./grub-core/gnulib/wcrtomb.c +./grub-core/gnulib/wctype-h.c ./grub-core/gnulib/wctype.in.h +./grub-core/gnulib/wcwidth.c +./grub-core/gnulib/xsize.c ./grub-core/gnulib/xsize.h ./grub-core/hello/hello.c ./grub-core/hook/datehook.c @@ -553,6 +575,7 @@ ./grub-core/loader/i386/pc/pxechainloader.c ./grub-core/loader/i386/xnu.c ./grub-core/loader/ia64/efi/linux.c +./grub-core/loader/linux.c ./grub-core/loader/lzss.c ./grub-core/loader/macho32.c ./grub-core/loader/macho64.c @@ -646,6 +669,7 @@ ./grub-core/tests/lib/functional_test.c ./grub-core/tests/lib/test.c ./grub-core/tests/test_blockarg.c +./grub-core/unidata.c ./grub-core/video/bitmap.c ./grub-core/video/bitmap_scale.c ./grub-core/video/bochs.c @@ -732,6 +756,8 @@ ./include/grub/font.h ./include/grub/fs.h ./include/grub/fshelp.h +./include/grub/gcrypt/g10lib.h +./include/grub/gcrypt/gcrypt.h ./include/grub/gcrypt/gpg-error.h ./include/grub/gcry/types.h ./include/grub/gdb.h @@ -811,6 +837,7 @@ ./include/grub/ia64/efi/memory.h ./include/grub/ia64/efi/time.h ./include/grub/ia64/kernel.h +./include/grub/ia64/reloc.h ./include/grub/ia64/setjmp.h ./include/grub/ia64/time.h ./include/grub/ia64/types.h @@ -834,6 +861,7 @@ ./include/grub/lib/LzmaTypes.h ./include/grub/libpciaccess.h ./include/grub/libusb.h +./include/grub/linux.h ./include/grub/list.h ./include/grub/loader.h ./include/grub/lvm.h @@ -905,6 +933,7 @@ ./include/grub/powerpc/time.h ./include/grub/powerpc/types.h ./include/grub/priority_queue.h +./include/grub/procfs.h ./include/grub/pubkey.h ./include/grub/reader.h ./include/grub/reed_solomon.h From 48f39bb4df5b903aaa66db9fdc6679571bff0dd9 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 11 Apr 2013 21:46:21 +0200 Subject: [PATCH 011/187] * docs/grub.texi: Fix description of GRUB_CMDLINE_XEN and GRUB_CMDLINE_XEN_DEFAULT. Reported by: Marc Warne (GigaTux) --- ChangeLog | 6 ++++++ docs/grub.texi | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90aacbeec..70f007486 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-11 Vladimir Serbinenko + + * docs/grub.texi: Fix description of GRUB_CMDLINE_XEN and + GRUB_CMDLINE_XEN_DEFAULT. + Reported by: Marc Warne (GigaTux) + 2013-04-11 Vladimir Serbinenko Import new gnulib. diff --git a/docs/grub.texi b/docs/grub.texi index bd366a67d..f6f95068a 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1290,9 +1290,8 @@ As @samp{GRUB_CMDLINE_LINUX}, but for GNU Mach. @item GRUB_CMDLINE_XEN @itemx GRUB_CMDLINE_XEN_DEFAULT -The values of these options are appended to the values of -@samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux -and Xen menu entries. +The values of these options are passed to Xen hypervisor Xen menu entries, +for all respectively normal entries. @item GRUB_CMDLINE_LINUX_XEN_REPLACE @item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT From a79b8a1584f904d9007d6dd8f1887057d3d90155 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 11 Apr 2013 23:15:26 +0200 Subject: [PATCH 012/187] Merge powerpc grub-mkrescue flavour with common. Use xorriso HFS+ feature for it. --- ChangeLog | 5 + Makefile.util.def | 38 ++- configure.ac | 1 + docs/man/grub-render-label.h2m | 3 + grub-core/Makefile.core.def | 6 + grub-core/boot/powerpc/grub.chrp.in | 172 +++++++++++ grub-core/font/font.c | 6 +- grub-core/font/font_cmd.c | 2 +- grub-core/video/video.c | 8 + include/grub/font.h | 2 +- include/grub/video.h | 5 + util/grub-mkrescue.in | 80 +++++ util/grub-render-label.c | 393 +++++++++++++++++++++++++ util/powerpc/ieee1275/grub-mkrescue.in | 146 --------- 14 files changed, 707 insertions(+), 160 deletions(-) create mode 100644 docs/man/grub-render-label.h2m create mode 100644 grub-core/boot/powerpc/grub.chrp.in create mode 100644 util/grub-render-label.c delete mode 100644 util/powerpc/ieee1275/grub-mkrescue.in diff --git a/ChangeLog b/ChangeLog index 70f007486..0d62509d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-11 Vladimir Serbinenko + + Merge powerpc grub-mkrescue flavour with common. Use xorriso HFS+ + feature for it. + 2013-04-11 Vladimir Serbinenko * docs/grub.texi: Fix description of GRUB_CMDLINE_XEN and diff --git a/Makefile.util.def b/Makefile.util.def index 513dc3858..bd286fc55 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -59,6 +59,17 @@ library = { common = grub-core/disk/mdraid1x_linux.c; common = grub-core/disk/raid5_recover.c; common = grub-core/disk/raid6_recover.c; + common = grub-core/font/font.c; + common = grub-core/gfxmenu/font.c; + common = grub-core/normal/charset.c; + common = grub-core/video/fb/fbblit.c; + common = grub-core/video/fb/fbutil.c; + common = grub-core/video/fb/fbfill.c; + common = grub-core/video/fb/video_fb.c; + common = grub-core/video/video.c; + common = grub-core/video/colors.c; + common = grub-core/unidata.c; + common = grub-core/io/bufio.c; common = grub-core/fs/affs.c; common = grub-core/fs/afs.c; common = grub-core/fs/bfs.c; @@ -451,15 +462,8 @@ script = { script = { mansection = 1; name = grub-mkrescue; - x86 = util/grub-install_header; - x86 = util/grub-mkrescue.in; - mips_qemu_mips = util/grub-install_header; - mips_qemu_mips = util/grub-mkrescue.in; - mips_loongson = util/grub-install_header; - mips_loongson = util/grub-mkrescue.in; - ia64_efi = util/grub-install_header; - ia64_efi = util/grub-mkrescue.in; - powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in; + common = util/grub-install_header; + common = util/grub-mkrescue.in; enable = i386_pc; enable = i386_efi; enable = x86_64_efi; @@ -763,3 +767,19 @@ program = { ldadd = grub-core/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; + +program = { + name = grub-render-label; + mansection = 1; + + common = util/grub-render-label.c; + common = grub-core/kern/emu/argp_common.c; + common = grub-core/kern/emu/hostfs.c; + common = grub-core/disk/host.c; + + ldadd = libgrubmods.a; + ldadd = libgrubgcry.a; + ldadd = libgrubkern.a; + ldadd = grub-core/gnulib/libgnu.a; + ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; +}; diff --git a/configure.ac b/configure.ac index a39a025fe..19febfd12 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-reboot]) grub_TRANSFORM([grub-script-check]) grub_TRANSFORM([grub-set-default]) grub_TRANSFORM([grub-sparc64-setup]) +grub_TRANSFORM([grub-render-label]) # Optimization flag. Allow user to override. if test "x$TARGET_CFLAGS" = x; then diff --git a/docs/man/grub-render-label.h2m b/docs/man/grub-render-label.h2m new file mode 100644 index 000000000..50ae5247c --- /dev/null +++ b/docs/man/grub-render-label.h2m @@ -0,0 +1,3 @@ +[NAME] +grub-render-label \- generate a .disk_label for Apple Macs. + diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 4c8e947c9..6aead4c41 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -30,6 +30,12 @@ script = { common = gdb_grub.in; }; +script = { + installdir = platform; + name = grub.chrp; + common = boot/powerpc/grub.chrp.in; +}; + kernel = { name = kernel; diff --git a/grub-core/boot/powerpc/grub.chrp.in b/grub-core/boot/powerpc/grub.chrp.in new file mode 100644 index 000000000..9b2218352 --- /dev/null +++ b/grub-core/boot/powerpc/grub.chrp.in @@ -0,0 +1,172 @@ + + +MacRISC MacRISC3 MacRISC4 + + +@PACKAGE@ @VERSION@ + + +3434 +00000000000000F781FB8181818181FBFAF500000000000000000000000000000000000000F6FAFAFAFA81F9F600000000000000 +0000000000F8FBF9F500F95656FCFB5656FBF800000000000000000000000000000000F5FAF9F5F7F600F6F6F9FAF70000000000 +000000F5FBFA0056FDFEFEFDFDFAAC81FB56568181560000000000000000000000F9F9F9F7FCFDFEFEFEFFFC81F656FA00000000 +0000F5AC2BF7FBFEFEFD2BF6568181F9F7F6F6F8FBF50000000000000000000000FAF700F600F5F7F7F6F7FEFFACF82BFB000000 +0000FC2BF5FEFFFFF5F7FC81F70000F7F9FAFAF8000000000000000000000000000056F9F9FAF9F7F7FA812BF7FFFF56F7FA0000 +005656F5FEFFAC2BF9FA000000000000000000000000000000000000000000000000000000000000000000FA56FAFEFEF8F9F700 +00FB00F7FFFF56F9F800000000000000000000F656FAFA56F50000000000F5F8F9F8F5000000000000000000F9F7FCFFFB00FB00 +F8F800ACFFACF6FA000000000000000000F6FA562BF5F5F781FA000000F9FA2B00F556F9F5000000000000000081F8FFFEF6562B +810000FFFFF9FAF500000000000000002B8100F5F9FCACFBF82BFBF6FCFAF6FAFC81F600FA2B000000000000002BF8FEFFF8F5FA +FA00F5FEFFFA8100000000000000002B8100F9FEFFFFFFFFFFFBF6FDFEACFDFEFFFFFFFBF581F600000000000000F9FEFFF700FA +FA00FBFFFEF6F900000000000000F6FB00FCFFFFFFFFFFFFFFFFFCF600FCF7ACFEFFFFFFFDF6810000000000000056F9FFAC00FA +FA00F6FFFFF856000000000000F5FBF5ACFFFFFFFFFFFFFFFFFFFF2B002BF8F5ACFFFFFFFFFDF6FA000000000000F9FCFF560081 +FA0081FFFFF8F9000000000000FBF6FBFFFFFFFFFFFFFFFFFFFFFFF800F55600FCFFFFFFFFFF81F8F80000000000F981FFAC0081 +FA0000FEFEF8FB0000000000812BFAFFFFFFFFFFFFFEFFFFFDF92BFA0000F6F981ACFEFFFFFFFF56F9F600000000F9FDFF2B0081 +FA00FAFFFF81812B000000FAF8F9FFFFFEACFBF80000F500000000F9F900562B0000FCF7F9ACFFFF2BF9F50000F9F6FEFFFB0081 +810000FCFFFBF6FB56F7FBF8F9FFFE5600000000F5FAAC000000F82BF6FAFBF800F556F80000F9FFFE2BFAFAFAF8FAFFFEF60081 +FAF6F5ACFFFFAC00F856F7ACFFFCF500000000FAFCFFFC00000056AC00F581F92BFEF9FAF6000081FFFFFBF6F62BFFFFACF6F6FA +F6FA00FAFFFFFFACFA56FFFFAC0000000000F6FD2BFEF6F5565600F5F800F60081FEF7F656000000FDFFFFFDFDFFFFFFAC0081F5 +0081F52BFDFFFFFFFFFFFFFFF60000000000FBF6F6F5F656F52BF900FA000000FCFAF5F656000000F7FFFFFFFFFFFFFDF7F68100 +00F6FB00F8FDFFFFFFFFFF810000000000F6F5000000F52B56F9FC00F7F70000FCF881FCF500000000FEFFFFFFFFAC5600FBF500 +000056F900F8ACFDFFFFFFF5000000000000002B0000FDFEFFFE560000F60000F9ACFFFE810000000081FFFEFDFAF800FAF70000 +000000FAF9002B56FAFDFC0000000000000000F80000FBF5FEFEF5000000000000ACFFFA2B0000000000FEFB2BF5008156000000 +00000000F9FBF600F6FBF800000000000000F7F8000000F9F9F9F82B0000000000F6ACACF70000000000F7FD2BFA812B00000000 +0000000000F681FCFBFD0000000000000000FBF6000000000000F52B000000000000F92B810000000000008181F6000000000000 +0000000000000000F6FC00000000000000F6FF0000000000000000000000000000000081FBFB2B00000000F7F900000000000000 +000000000000000000FC00000000000000FCFAF600000000000000000000000000000056ACF581FBF700000081FB000000000000 +0000000000000000FAF90000000000008156F5F8000000000000002BFBFCFBF800000000FD2B000056FB8181FBF8000000000000 +0000000000000000AC0000000000F5FBF90000F6000000000000F5AC56F6005681F50000F6ACFCFBF70000000000000000000000 +00000000000000F881000000F5FAFDFD00000000000000000000F7FEFA2B0000F581F70000000000810000000000000000000000 +000000000000F9FCF500FAFDACFAF5FD00000000000000000000F5ACF5FDFEFA0000F82B00000000810000000000000000000000 +000000000000FCF8F9AC81FD000000FD000000000000FAF7000000F50081F9FAF800000000000000FB0000000000000000000000 +000000000000FC81F956F5FD000000FD0000000000000000F800F5000000000056000000000000F7FB0000000000000000000000 +00000000000000000000F5AC000000ACF800000000000000F5FAF80000000000F50000000000F8ACF50000000000000000000000 +00000000000000000000F5AC000000F5AC000000000000000056F9000000000000000000F7ACFCF5000000000000000000000000 +00000000000000000000F5FD00000000AC000000000000000000FB0000000000000000F5F6F5FCF6000000000000000000000000 +0000000000000000000000FD00000000FBFDF600000000000000F8F900000000000000000000F5FB000000000000000000000000 +0000000000000000000000FDF500000000F9ACF800000000000000815600000000F656818181AC56000000000000000000000000 +000000000000000000000081F80000000000F9FC0000000000000000F9ACACACFCFBFAFA81FD2B00000000000000000000000000 +0000000000000000000000F7FB0000000000FBF70000000000000000000000000000000000FB0000000000000000000000000000 +000000000000000000000000ACF500000000F9FD56F5000000000000000000000000000000FB0000000000000000000000000000 +000000000000000000000000F8FA0000000000F6FEFEF5000000000000F55681FCACFDACFC560000000000000000000000000000 +00000000000000000000000000FBF600000000002BFCFA00F700000000F9FDFDFAFEF90000000000000000000000000000000000 +00000000000000000000000000F5FB0000000000F5FEF7ACAC0000000000000000FCF50000000000000000000000000000000000 +0000000000000000000000000000F6FA000000002BFF2BFFFFAC00000000000000F7FA0000000000000000000000000000000000 +000000000000000000000000000000F65600000000FAFEFFFFAC0000000000F800F6810000000000000000000000000000000000 +00000000000000000000000000000000F52B00000000F8FEFBFF5600000000FCFAACF60000000000000000000000000000000000 +0000000000000000000000000000000000000000000000F9FCFCFFFB00F8FEFFFDF5000000000000000000000000000000000000 +00000000000000000000000000000000000000000000F9FDF7F5FFFD56FFFFFFFD00000000000000000000000000000000000000 +00000000000000000000000000000000000000000000810000FBFFFFFBFFFFFFFFACF9F5F5000000000000000000000000000000 +0000000000000000000000000000000000000000000000F600FC81FFFEFFFFFFFFFFFE8100000000000000000000000000000000 +00000000000000000000000000000000000000000000000000F7F6FDFFFFFFFEFFFFACF500000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000F5FC81FC81FAFBF9F500000000000000000000000000000000 + +00000000000000F781FB8181818181FBFAF500000000000000000000000000000000000000F6FAFAFAFA81F9F600000000000000 +0000000000F8FBF9F500F95656FCFB5656FBF800000000000000000000000000000000F5FAF9F5F7F600F6F6F9FAF70000000000 +000000F5FBFA0056FDFEFEFDFDFAAC81FB56568181560000000000000000000000F9F9F9F7FCFDFEFEFEFFFC81F656FA00000000 +0000F5AC2BF7FBFEFEFD2BF6568181F9F7F6F6F8FBF50000000000000000000000FAF700F600F5F7F7F6F7FEFFACF82BFB000000 +0000FC2BF5FEFFFFF5F7FC81F70000F7F9FAFAF8000000000000000000000000000056F9F9FAF9F7F7FA812BF7FFFF56F7FA0000 +005656F5FEFFAC2BF9FA000000000000000000000000000000000000000000000000000000000000000000FA56FAFEFEF8F9F700 +00FB00F7FFFF56F9F800000000000000000000F656FAFA56F50000000000F5F8F9F8F5000000000000000000F9F7FCFFFB00FB00 +F8F800ACFFACF6FA000000000000000000F6FA562BF5F5F781FA000000F9FA2B00F556F9F5000000000000000081F8FFFEF6562B +810000FFFFF9FAF500000000000000002B8100F5F9FCACFBF82BFBF6FCFAF6FAFC81F600FA2B000000000000002BF8FEFFF8F5FA +FA00F5FEFFFA8100000000000000002B8100F9FEFFFFFFFFFFFBF6FDFEACFDFEFFFFFFFBF581F600000000000000F9FEFFF700FA +FA00FBFFFEF6F900000000000000F6FB00FCFFFFFFFFFFFFFFFFFCF600FCF7ACFEFFFFFFFDF6810000000000000056F9FFAC00FA +FA00F6FFFFF856000000000000F5FBF5ACFFFFFFFFFFFFFFFFFFFF2B002BF8F5ACFFFFFFFFFDF6FA000000000000F9FCFF560081 +FA0081FFFFF8F9000000000000FBF6FBFFFFFFFFFFFFFFFFFFFFFFF800F55600FCFFFFFFFFFF81F8F80000000000F981FFAC0081 +FA0000FEFEF8FB0000000000812BFAFFFFFFFFFFFFFEFFFFFDF92BFA0000F6F981ACFEFFFFFFFF56F9F600000000F9FDFF2B0081 +FA00FAFFFF81812B000000FAF8F9FFFFFEACFBF80000F500000000F9F900562B0000FCF7F9ACFFFF2BF9F50000F9F6FEFFFB0081 +810000FCFFFBF6FB56F7FBF8F9FFFE5600000000F5FAAC000000F82BF6FAFBF800F556F80000F9FFFE2BFAFAFAF8FAFFFEF60081 +FAF6F5ACFFFFAC00F856F7ACFFFCF500000000FAFCFFFC00000056AC00F581F92BFEF9FAF6000081FFFFFBF6F62BFFFFACF6F6FA +F6FA00FAFFFFFFACFA56FFFFAC0000000000F6FD2BFEF6F5565600F5F800F60081FEF7F656000000FDFFFFFDFDFFFFFFAC0081F5 +0081F52BFDFFFFFFFFFFFFFFF60000000000FBF6F6F5F656F52BF900FA000000FCFAF5F656000000F7FFFFFFFFFFFFFDF7F68100 +00F6FB00F8FDFFFFFFFFFF810000000000F6F5000000F52B56F9FC00F7F70000FCF881FCF500000000FEFFFFFFFFAC5600FBF500 +000056F900F8ACFDFFFFFFF5000000000000002B0000FDFEFFFE560000F60000F9ACFFFE810000000081FFFEFDFAF800FAF70000 +000000FAF9002B56FAFDFC0000000000000000F80000FBF5FEFEF5000000000000ACFFFA2B0000000000FEFB2BF5008156000000 +00000000F9FBF600F6FBF800000000000000F7F8000000F9F9F9F82B0000000000F6ACACF70000000000F7FD2BFA812B00000000 +0000000000F681FCFBFD0000000000000000FBF6000000000000F52B000000000000F92B810000000000008181F6000000000000 +0000000000000000F6FC00000000000000F6FF0000000000000000000000000000000081FBFB2B00000000F7F900000000000000 +000000000000000000FC00000000000000FCFAF600000000000000000000000000000056ACF581FBF700000081FB000000000000 +0000000000000000FAF90000000000008156F5F8000000000000002BFBFCFBF800000000FD2B000056FB8181FBF8000000000000 +0000000000000000AC0000000000F5FBF90000F6000000000000F5AC56F6005681F50000F6ACFCFBF70000000000000000000000 +00000000000000F881000000F5FAFDFD00000000000000000000F7FEFA2B0000F581F70000000000810000000000000000000000 +000000000000F9FCF500FAFDACFAF5FD00000000000000000000F5ACF5FDFEFA0000F82B00000000810000000000000000000000 +000000000000FCF8F9AC81FD000000FD000000000000FAF7000000F50081F9FAF800000000000000FB0000000000000000000000 +000000000000FC81F956F5FD000000FD0000000000000000F800F5000000000056000000000000F7FB0000000000000000000000 +00000000000000000000F5AC000000ACF800000000000000F5FAF80000000000F50000000000F8ACF50000000000000000000000 +00000000000000000000F5AC000000F5AC000000000000000056F9000000000000000000F7ACFCF5000000000000000000000000 +00000000000000000000F5FD00000000AC000000000000000000FB0000000000000000F5F6F5FCF6000000000000000000000000 +0000000000000000000000FD00000000FBFDF600000000000000F8F900000000000000000000F5FB000000000000000000000000 +0000000000000000000000FDF500000000F9ACF800000000000000815600000000F656818181AC56000000000000000000000000 +000000000000000000000081F80000000000F9FC0000000000000000F9ACACACFCFBFAFA81FD2B00000000000000000000000000 +0000000000000000000000F7FB0000000000FBF70000000000000000000000000000000000FB0000000000000000000000000000 +000000000000000000000000ACF500000000F9FD56F5000000000000000000000000000000FB0000000000000000000000000000 +000000000000000000000000F8FA0000000000F6FEFEF5000000000000F55681FCACFDACFC560000000000000000000000000000 +00000000000000000000000000FBF600000000002BFCFA00F700000000F9FDFDFAFEF90000000000000000000000000000000000 +00000000000000000000000000F5FB0000000000F5FEF7ACAC0000000000000000FCF50000000000000000000000000000000000 +0000000000000000000000000000F6FA000000002BFF2BFFFFAC00000000000000F7FA0000000000000000000000000000000000 +000000000000000000000000000000F65600000000FAFEFFFFAC0000000000F800F6810000000000000000000000000000000000 +00000000000000000000000000000000F52B00000000F8FEFBFF5600000000FCFAACF60000000000000000000000000000000000 +0000000000000000000000000000000000000000000000F9FCFCFFFB00F8FEFFFDF5000000000000000000000000000000000000 +00000000000000000000000000000000000000000000F9FDF7F5FFFD56FFFFFFFD00000000000000000000000000000000000000 +00000000000000000000000000000000000000000000810000FBFFFFFBFFFFFFFFACF9F5F5000000000000000000000000000000 +0000000000000000000000000000000000000000000000F600FC81FFFEFFFFFFFFFFFE8100000000000000000000000000000000 +00000000000000000000000000000000000000000000000000F7F6FDFFFFFFFEFFFFACF500000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000F5FC81FC81FAFBF9F500000000000000000000000000000000 + +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + + +boot &device;:&partition;,\System\Library\CoreServices\grub.elf + + diff --git a/grub-core/font/font.c b/grub-core/font/font.c index 6b54a84c8..fbbb988a5 100644 --- a/grub-core/font/font.c +++ b/grub-core/font/font.c @@ -422,7 +422,7 @@ read_section_as_short (struct font_file_section *section, /* Load a font and add it to the beginning of the global font list. Returns 0 upon success, nonzero upon failure. */ -int +grub_font_t grub_font_load (const char *filename) { grub_file_t file = 0; @@ -657,7 +657,7 @@ grub_font_load (const char *filename) if (register_font (font) != 0) goto fail; - return 0; + return font; fail: if (file) @@ -666,7 +666,7 @@ fail: font->file = 0; free_font (font); - return 1; + return 0; } /* Read a 16-bit big-endian integer from FILE, convert it to native byte diff --git a/grub-core/font/font_cmd.c b/grub-core/font/font_cmd.c index 90f605d2f..1d9ddea54 100644 --- a/grub-core/font/font_cmd.c +++ b/grub-core/font/font_cmd.c @@ -32,7 +32,7 @@ loadfont_command (grub_command_t cmd __attribute__ ((unused)), return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); while (argc--) - if (grub_font_load (*args++) != 0) + if (grub_font_load (*args++) == 0) { if (!grub_errno) return grub_error (GRUB_ERR_BAD_FONT, "invalid font"); diff --git a/grub-core/video/video.c b/grub-core/video/video.c index c36994f55..aab9b181a 100644 --- a/grub-core/video/video.c +++ b/grub-core/video/video.c @@ -711,3 +711,11 @@ grub_video_set_mode (const char *modestring, return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no suitable video mode found")); } + +#ifdef GRUB_UTIL +void +grub_video_set_adapter (grub_video_adapter_t adapter) +{ + grub_video_adapter_active = adapter; +} +#endif diff --git a/include/grub/font.h b/include/grub/font.h index 690363faf..975432ef7 100644 --- a/include/grub/font.h +++ b/include/grub/font.h @@ -81,7 +81,7 @@ void grub_font_loader_init (void); /* Load a font and add it to the beginning of the global font list. Returns: 0 upon success; nonzero upon failure. */ -int grub_font_load (const char *filename); +grub_font_t grub_font_load (const char *filename); /* Get the font that has the specified name. Font names are in the form "Family Name Bold Italic 14", where Bold and Italic are optional. diff --git a/include/grub/video.h b/include/grub/video.h index 9fe478316..40a77111d 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -542,4 +542,9 @@ extern void grub_video_sis315pro_fini (void); extern void grub_video_radeon_fuloong2e_fini (void); #endif +#ifdef GRUB_UTIL +void +grub_video_set_adapter (grub_video_adapter_t adapter); +#endif + #endif /* ! GRUB_VIDEO_HEADER */ diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index c57a0d95a..a6e4de676 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -43,9 +43,16 @@ pc_dir="${libdir}/@PACKAGE@/i386-pc" efi32_dir="${libdir}/@PACKAGE@/i386-efi" efi64_dir="${libdir}/@PACKAGE@/x86_64-efi" ia64_dir="${libdir}/@PACKAGE@/ia64-efi" +ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" rom_directory= override_dir= grub_mkimage="${bindir}/@grub_mkimage@" +grub_render_label="${bindir}/@grub_render_label@" +label_font="${pkgdatadir}/unicode.pf2" +label_color="black" +label_bgcolor="white" +product_name="${PACKAGE_NAME}" +product_version="${PACKAGE_VERSION}" xorriso=xorriso @@ -74,6 +81,12 @@ usage () { # TRANSLATORS: xorriso is a program for creating ISOs and burning CDs print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")" print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")" + print_option_help "--grub-render-label=$filetrans" "$(gettext "use FILE as grub-render-label")" + print_option_help "--label-font=$filetrans" "$(gettext "use FILE as font for label")" + print_option_help "--label-color=$(gettext "COLOR")" "$(gettext "use COLOR for label")" + print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")" + print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")" + print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")" echo gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt echo @@ -131,11 +144,41 @@ do export PATH ;; + --product-name) + product_name=`argument $option "$@"`; shift ;; + --product-name=*) + product_name=`echo "$option" | sed 's/--product-name=//'` ;; + + --product-version) + product_version=`argument $option "$@"`; shift ;; + --product-version=*) + product_version=`echo "$option" | sed 's/--product-version=//'` ;; + --grub-mkimage) grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + --grub-render-label) + grub_render_label=`argument $option "$@"`; shift ;; + --grub-render-label=*) + grub_render_label=`echo "$option" | sed 's/--grub-render-label=//'` ;; + + --label-font) + label_font=`argument $option "$@"`; shift ;; + --label-font=*) + label_font=`echo "$option" | sed 's/--label-font=//'` ;; + + --label-color) + label_color=`argument $option "$@"`; shift ;; + --label-color=*) + label_color=`echo "$option" | sed 's/--label-color=//'` ;; + + --label-bgcolor) + label_bgcolor=`argument $option "$@"`; shift ;; + --label-bgcolor=*) + label_bgcolor=`echo "$option" | sed 's/--label-bgcolor=//'` ;; + --xorriso) xorriso=`argument $option "$@"`; shift ;; --xorriso=*) @@ -231,6 +274,9 @@ if [ "${override_dir}" = "" ] ; then if test -e "${loongson_dir}" ; then process_input_dir "${loongson_dir}" mipsel-loongson fi + if test -e "${ppc_dir}" ; then + process_input_dir "${ppc_dir}" mipsel-loongson + fi else . "${override_dir}"/modinfo.sh process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform} @@ -244,6 +290,7 @@ else mipsel_qemu_dir= mips_qemu_dir= loongson_dir= + ppc_dir= case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-multiboot) multiboot_dir="${override_dir}" ;; i386-coreboot) coreboot_dir="${override_dir}" ;; @@ -255,6 +302,7 @@ else mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;; mipsel-loongson) loongson_dir="${override_dir}" ;; mips-qemu_mips) mips_qemu_dir="${override_dir}" ;; + powerpc-ieee1275) ppc_dir="${override_dir}" ;; esac fi @@ -309,6 +357,38 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; th grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img" fi +make_image "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" "" +if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/powerpc.elf" ]; then + mkdir -p "${iso9660_dir}"/System/Library/CoreServices + touch "${iso9660_dir}/mach_kernel" + cat > "${iso9660_dir}/System/Library/CoreServices/SystemVersion.plist" < + + ProductBuildVersion + + ProductName + ${product_name} + ProductVersion + ${product_version} + + +EOF + "$grub_render_label" -f "$label_font" -b "$label_bgcolor" -c "$label_color" -t "${product_name} ${product_version}" -o "${iso9660_dir}/System/Library/CoreServices/.disk_label" + echo "${product_name} ${product_version}" > "${iso9660_dir}/System/Library/CoreServices/.disk_label.contentDetails" + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label" +fi + +if [ -e "${iso9660_dir}/boot/powerpc.elf" ] ; then + cp "${ppc_dir}/grub.chrp" "${iso9660_dir}"/System/Library/CoreServices/BootX + cp "${iso9660_dir}/boot/powerpc.elf" "${iso9660_dir}"/System/Library/CoreServices/grub.elf + # FIXME: add PreP + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices -sysid PPC" +fi + +if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ]; then + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfs-bless-by i /System/Library/CoreServices/boot.efi" +fi + make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "pata" if [ -e "${iso9660_dir}/boot/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then cp "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf" diff --git a/util/grub-render-label.c b/util/grub-render-label.c new file mode 100644 index 000000000..723775967 --- /dev/null +++ b/util/grub-render-label.c @@ -0,0 +1,393 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2010,2012 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + + +#define grub_video_render_target grub_video_fbrender_target + +#include + +#include +#include +#include +#include +#include + +#define _GNU_SOURCE 1 + +#include +#include +#include +#include +#include +#include + +#include "progname.h" + +struct arguments +{ + char *input; + char *text; + char *output; + char *font; + grub_video_rgba_color_t fgcolor; + grub_video_rgba_color_t bgcolor; + int verbosity; +}; + +static struct argp_option options[] = { + {"input", 'i', N_("FILE"), 0, + N_("read text from FILE."), 0}, + {"color", 'c', N_("COLOR"), 0, + N_("use COLOR for text"), 0}, + {"bgcolor", 'b', N_("COLOR"), 0, + N_("use COLOR for background"), 0}, + {"text", 't', N_("STR"), 0, + N_("supply the string."), 0}, + {"output", 'o', N_("FILE"), 0, + N_("set output filename. Default is STDOUT"), 0}, + {"font", 'f', N_("FILE"), 0, + N_("use FILE as font (PF2)."), 0}, + {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, + { 0, 0, 0, 0, 0, 0 } +}; + +#include +#include +#include +#include +#include +#include +#include + +static struct +{ + struct grub_video_mode_info mode_info; + struct grub_video_render_target *render_target; + grub_uint8_t *ptr; +} framebuffer; + +static grub_err_t +grub_video_text_render_swap_buffers (void) +{ + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_video_text_render_set_active_render_target (struct grub_video_render_target *target) +{ + if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY) + target = framebuffer.render_target; + + return grub_video_fb_set_active_render_target (target); +} + +static struct grub_video_adapter grub_video_text_render_adapter = + { + .name = "Text rendering", + + .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE, + + .fini = grub_video_fb_fini, + .get_info = grub_video_fb_get_info, + .get_info_and_fini = 0, + .set_palette = grub_video_fb_set_palette, + .get_palette = grub_video_fb_get_palette, + .set_viewport = grub_video_fb_set_viewport, + .get_viewport = grub_video_fb_get_viewport, + .map_color = grub_video_fb_map_color, + .map_rgb = grub_video_fb_map_rgb, + .map_rgba = grub_video_fb_map_rgba, + .unmap_color = grub_video_fb_unmap_color, + .fill_rect = grub_video_fb_fill_rect, + .blit_bitmap = grub_video_fb_blit_bitmap, + .blit_render_target = grub_video_fb_blit_render_target, + .scroll = grub_video_fb_scroll, + .swap_buffers = grub_video_text_render_swap_buffers, + .create_render_target = grub_video_fb_create_render_target, + .delete_render_target = grub_video_fb_delete_render_target, + .set_active_render_target = grub_video_text_render_set_active_render_target, + .get_active_render_target = grub_video_fb_get_active_render_target, + + .next = 0 + }; + +static error_t +argp_parser (int key, char *arg, struct argp_state *state) +{ + /* Get the input argument from argp_parse, which we + know is a pointer to our arguments structure. */ + struct arguments *arguments = state->input; + grub_err_t err; + + switch (key) + { + case 'i': + arguments->input = xstrdup (arg); + break; + + case 'b': + err = grub_video_parse_color (arg, &arguments->bgcolor); + if (err) + grub_util_error (_("Invalud color `%s'"), arg); + break; + + case 'c': + err = grub_video_parse_color (arg, &arguments->fgcolor); + if (err) + grub_util_error (_("Invalud color `%s'"), arg); + break; + + case 'f': + arguments->font = xstrdup (arg); + break; + + case 't': + arguments->text = xstrdup (arg); + break; + + case 'o': + arguments->output = xstrdup (arg); + break; + + case 'v': + arguments->verbosity++; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + + return 0; +} + +void grub_hostfs_init (void); +void grub_host_init (void); + +struct header +{ + grub_uint8_t magic; + grub_uint16_t width; + grub_uint16_t height; +} __attribute__ ((packed)); + +static struct argp argp = { + options, argp_parser, N_("[OPTIONS]"), + N_("Render Apple .disk_label."), + NULL, NULL, NULL +}; + +static struct grub_video_palette_data ieee1275_palette[256]; + +int +main (int argc, char *argv[]) +{ + FILE *out; + char *text; + char *fontfull; + struct arguments arguments; + grub_font_t font; + int width, height; + struct header head; + const grub_uint8_t vals[] = { 0xff, 0xda, 0xb3, 0x87, 0x54, 0x00 }; + const grub_uint8_t vals2[] = { 0xf3, 0xe7, 0xcd, 0xc0, 0xa5, 0x96, + 0x77, 0x66, 0x3f, 0x27 }; + int i, j, k, cptr = 0; + grub_uint8_t bg, fg; + + for (i = 0; i < 256; i++) + ieee1275_palette[i].a = 0xff; + + for (i = 0; i < 6; i++) + for (j = 0; j < 6; j++) + for (k = 0; k < 6; k++) + { + ieee1275_palette[cptr].r = vals[i]; + ieee1275_palette[cptr].g = vals[j]; + ieee1275_palette[cptr].b = vals[k]; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + cptr--; + for (i = 0; i < 10; i++) + { + ieee1275_palette[cptr].r = vals2[i]; + ieee1275_palette[cptr].g = 0; + ieee1275_palette[cptr].b = 0; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + for (i = 0; i < 10; i++) + { + ieee1275_palette[cptr].r = 0; + ieee1275_palette[cptr].g = vals2[i]; + ieee1275_palette[cptr].b = 0; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + for (i = 0; i < 10; i++) + { + ieee1275_palette[cptr].r = 0; + ieee1275_palette[cptr].g = 0; + ieee1275_palette[cptr].b = vals2[i]; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + for (i = 0; i < 10; i++) + { + ieee1275_palette[cptr].r = vals2[i]; + ieee1275_palette[cptr].g = vals2[i]; + ieee1275_palette[cptr].b = vals2[i]; + ieee1275_palette[cptr].a = 0xff; + cptr++; + } + ieee1275_palette[cptr].r = 0; + ieee1275_palette[cptr].g = 0; + ieee1275_palette[cptr].b = 0; + ieee1275_palette[cptr].a = 0xff; + + set_program_name (argv[0]); + + grub_util_init_nls (); + + /* Check for options. */ + memset (&arguments, 0, sizeof (struct arguments)); + arguments.bgcolor.red = 0xff; + arguments.bgcolor.green = 0xff; + arguments.bgcolor.blue = 0xff; + arguments.bgcolor.alpha = 0xff; + arguments.fgcolor.red = 0x00; + arguments.fgcolor.green = 0x00; + arguments.fgcolor.blue = 0x00; + arguments.fgcolor.alpha = 0xff; + if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0) + { + fprintf (stderr, "%s", _("Error in parsing command line arguments\n")); + exit(1); + } + + if ((!arguments.input && !arguments.text) || !arguments.font) + { + fprintf (stderr, "%s", _("Missing arguments\n")); + exit(1); + } + + if (arguments.text) + text = arguments.text; + else + { + FILE *in = fopen (arguments.input, "r"); + size_t s; + if (!in) + grub_util_error (_("cannot open `%s': %s"), arguments.input, + strerror (errno)); + fseek (in, 0, SEEK_END); + s = ftell (in); + fseek (in, 0, SEEK_SET); + text = xmalloc (s + 1); + if (fread (text, 1, s, in) != s) + grub_util_error (_("cannot read `%s': %s"), arguments.input, + strerror (errno)); + text[s] = 0; + fclose (in); + } + + if (arguments.output) + out = fopen (arguments.output, "wb"); + else + out = stdout; + if (!out) + { + grub_util_error (_("cannot open `%s': %s"), arguments.output ? : "stdout", + strerror (errno)); + } + + fontfull = canonicalize_file_name (arguments.font); + if (!fontfull) + { + grub_util_error (_("cannot open `%s': %s"), arguments.font, + strerror (errno)); + } + + fontfull = xasprintf ("(host)/%s", fontfull); + + grub_init_all (); + grub_hostfs_init (); + grub_host_init (); + + grub_font_loader_init (); + font = grub_font_load (fontfull); + if (!font) + { + grub_util_error (_("cannot open `%s': %s"), arguments.font, + grub_errmsg); + } + + width = grub_font_get_string_width (font, text) + 10; + height = grub_font_get_height (font); + + grub_memset (&framebuffer, 0, sizeof (framebuffer)); + + grub_video_fb_init (); + + framebuffer.mode_info.width = width; + framebuffer.mode_info.height = height; + framebuffer.mode_info.pitch = width; + + framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; + framebuffer.mode_info.bpp = 8; + framebuffer.mode_info.bytes_per_pixel = 1; + framebuffer.mode_info.number_of_colors = 256; + + framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info); + + /* For some reason sparc64 uses 32-bit pointer too. */ + framebuffer.ptr = xmalloc (height * width); + + grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, + &framebuffer.mode_info, + framebuffer.ptr); + grub_video_fb_set_active_render_target (framebuffer.render_target); + grub_video_fb_set_palette (0, ARRAY_SIZE (ieee1275_palette), + ieee1275_palette); + + grub_video_set_adapter (&grub_video_text_render_adapter); + + fg = grub_video_map_rgb (arguments.fgcolor.red, + arguments.fgcolor.green, + arguments.fgcolor.blue); + bg = grub_video_map_rgb (arguments.bgcolor.red, + arguments.bgcolor.green, + arguments.bgcolor.blue); + + grub_memset (framebuffer.ptr, bg, height * width); + grub_font_draw_string (text, font, fg, + 5, grub_font_get_ascent (font)); + + grub_video_set_adapter (0); + + head.magic = 1; + head.width = grub_cpu_to_be16 (width); + head.height = grub_cpu_to_be16 (height); + fwrite (&head, 1, sizeof (head), out); + fwrite (framebuffer.ptr, 1, width * height, out); + + if (out != stdout) + fclose (out); + + return 0; +} diff --git a/util/powerpc/ieee1275/grub-mkrescue.in b/util/powerpc/ieee1275/grub-mkrescue.in deleted file mode 100644 index 2615cab76..000000000 --- a/util/powerpc/ieee1275/grub-mkrescue.in +++ /dev/null @@ -1,146 +0,0 @@ -#! /bin/sh -set -e - -# Make GRUB rescue image -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. -# -# GRUB is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# GRUB is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GRUB. If not, see . - -# Initialize some variables. -prefix="@prefix@" -exec_prefix="@exec_prefix@" -bindir="@bindir@" -libdir="@libdir@" -PACKAGE_NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ -PACKAGE_VERSION=@PACKAGE_VERSION@ -input_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" -datarootdir="@datarootdir@" -datadir="@datadir@" -if [ "x$pkgdatadir" = x ]; then - pkgdatadir="${datadir}/@PACKAGE@" -fi - -self=`basename $0` - -grub_mkimage="${bindir}/@grub_mkimage@" - -export TEXTDOMAIN=@PACKAGE@ -export TEXTDOMAINDIR="@localedir@" - -. "${pkgdatadir}/grub-mkconfig_lib" - -# Usage: usage -# Print the usage. -usage () { - gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self" - gettext "Make GRUB CD-ROM, disk, pendrive and floppy bootable image."; echo - echo - print_option_help "-h, --help" "$(gettext "print this message and exit")" - print_option_help "-v, --version" "$(gettext "print the version information and exit")" - print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" - print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" - echo - gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "genisoimage -help" "$self" | grub_fmt - echo - gettext "Report bugs to ."; echo -} - -argument () { - opt=$1 - shift - - if test $# -eq 0; then - gettext_printf "%s: option requires an argument -- \`%s'\n" "$0" "$opt" 1>&2 - exit 1 - fi - echo $1 -} - -source= -output_image= - -# Check the arguments. -while test $# -gt 0 -do - option=$1 - shift - - case "$option" in - -h | --help) - usage - exit 0 ;; - -v | --version) - echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" - exit 0 ;; - - --modules) - modules=`argument $option "$@"`; shift ;; - --modules=*) - modules=`echo "$option" | sed 's/--modules=//'` ;; - - --override-directory) - input_dir=`argument $option "$@"`; shift ;; - --override-directory=*) - input_dir=`echo "$option" | sed 's/--override-directory=//'` ;; - - --grub-mkimage) - grub_mkimage=`argument $option "$@"`; shift ;; - --grub-mkimage=*) - grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; - - -o | --output) - output_image=`argument $option "$@"`; shift ;; - --output=*) - output_image=`echo "$option" | sed 's/--output=//'` ;; - - --rom-directory=*) - ;; - --rom-directory) - shift ;; - - *) - source="${source} ${option} $@"; break ;; - esac -done - -if test "x$output_image" = x; then - usage - exit 1 -fi - -if [ "x${modules}" = "x" ] ; then - modules=`cd ${input_dir}/ && ls *.mod` -fi - -map_file=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 -cat >${map_file} < Date: Fri, 12 Apr 2013 01:29:45 +0200 Subject: [PATCH 013/187] Support i386-ieee1275 grub-mkrescue and make check on it. --- ChangeLog | 4 ++++ Makefile.util.def | 1 + grub-core/tests/boot/qemu-shutdown-x86.S | 9 +++++++++ tests/grub_script_expansion.in | 2 +- tests/partmap_test.in | 8 +++++++- tests/util/grub-shell.in | 7 ++++--- util/grub-mkrescue.in | 8 ++++++++ 7 files changed, 34 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d62509d1..c137b5f06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-11 Vladimir Serbinenko + + Support i386-ieee1275 grub-mkrescue and make check on it. + 2013-04-11 Vladimir Serbinenko Merge powerpc grub-mkrescue flavour with common. Use xorriso HFS+ diff --git a/Makefile.util.def b/Makefile.util.def index bd286fc55..373c25b8b 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -470,6 +470,7 @@ script = { enable = i386_qemu; enable = i386_multiboot; enable = i386_coreboot; + enable = i386_ieee1275; enable = mips_qemu_mips; enable = mips_loongson; enable = ia64_efi; diff --git a/grub-core/tests/boot/qemu-shutdown-x86.S b/grub-core/tests/boot/qemu-shutdown-x86.S index 8f794fc4b..9f8bc4051 100644 --- a/grub-core/tests/boot/qemu-shutdown-x86.S +++ b/grub-core/tests/boot/qemu-shutdown-x86.S @@ -1,3 +1,12 @@ + movl $0x80000b80, %eax + movw $0xcf8, %dx + outl %eax, %dx + movl $0x1001, %eax + movw $0xcfc, %dx + inb %al, %dx + orb $1, %al + outb %al, %dx + movl $0x80000b40, %eax movw $0xcf8, %dx outl %eax, %dx diff --git a/tests/grub_script_expansion.in b/tests/grub_script_expansion.in index c4763907c..03dc510a2 100644 --- a/tests/grub_script_expansion.in +++ b/tests/grub_script_expansion.in @@ -35,7 +35,7 @@ done other=`echo insmod regexp\; echo '(*)' | @builddir@/grub-shell` for d in $disks; do - if ! echo "$other" | grep "$d" >/dev/null; then + if ! echo "$other" | grep -F "$d" >/dev/null; then echo "$d missing from (*) expansion" >&2 exit 1 fi diff --git a/tests/partmap_test.in b/tests/partmap_test.in index 150722026..a0beb2a4c 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -49,7 +49,7 @@ list_parts () { outfile="$1" shift - echo ls | "${grubshell}" --qemu-opts="-hda ${imgfile}" \ + echo ls | "${grubshell}" --qemu-opts="-$qemudisk ${imgfile}" \ --modules=$mod | tr -d "\n\r" > "${outfile}" cat "${outfile}" echo @@ -58,12 +58,18 @@ list_parts () { case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot | mipsel-loongson) disk=ata0 + qemudisk=hda ;; powerpc-ieee1275) disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0 + qemudisk=hda # QEMU firmware has bugs which prevent it from accessing hard disk. exit 0 ;; + i386-ieee1275) + disk=ieee1275/d + qemudisk=hdb + ;; *) disk=hd0 ;; diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 04e64daa0..c6d1cd783 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -100,10 +100,11 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in console=vga_text;; i386-ieee1275) - boot=cd + boot=hd qemu=qemu-system-i386 - console=console;; - + console=console + trim=1 + ;; i386-qemu) boot=qemu qemu=qemu-system-i386 diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index a6e4de676..510d95fb7 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -40,6 +40,7 @@ mipsel_qemu_dir="${libdir}/@PACKAGE@/mipsel-qemu_mips" loongson_dir="${libdir}/@PACKAGE@/mipsel-loongson" mips_qemu_dir="${libdir}/@PACKAGE@/mips-qemu_mips" pc_dir="${libdir}/@PACKAGE@/i386-pc" +i386_ieee1275_dir="${libdir}/@PACKAGE@/i386-ieee1275" efi32_dir="${libdir}/@PACKAGE@/i386-efi" efi64_dir="${libdir}/@PACKAGE@/x86_64-efi" ia64_dir="${libdir}/@PACKAGE@/ia64-efi" @@ -256,6 +257,9 @@ if [ "${override_dir}" = "" ] ; then if test -e "${pc_dir}" ; then process_input_dir "${pc_dir}" i386-pc fi + if test -e "${i386_ieee1275_dir}" ; then + process_input_dir "${i386_ieee1275_dir}" i386-ieee1275 + fi if test -e "${efi32_dir}" ; then process_input_dir "${efi32_dir}" i386-efi fi @@ -291,6 +295,7 @@ else mips_qemu_dir= loongson_dir= ppc_dir= + i386_ieee1275_dir= case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-multiboot) multiboot_dir="${override_dir}" ;; i386-coreboot) coreboot_dir="${override_dir}" ;; @@ -303,6 +308,7 @@ else mipsel-loongson) loongson_dir="${override_dir}" ;; mips-qemu_mips) mips_qemu_dir="${override_dir}" ;; powerpc-ieee1275) ppc_dir="${override_dir}" ;; + i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;; esac fi @@ -336,6 +342,8 @@ fi # build multiboot core.img make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "pata ahci at_keyboard" +make_image "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/ofwx86.elf" "" + if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; then efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 mkdir -p "${efi_dir}/efi/boot" From f9d4005539b7662404e53eb05f2e400bbba0ad6b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 01:44:14 +0200 Subject: [PATCH 014/187] * tests/partmap_test.in: Fix missing qemudisk setting. --- ChangeLog | 4 ++++ tests/partmap_test.in | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index c137b5f06..0668a0f13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * tests/partmap_test.in: Fix missing qemudisk setting. + 2013-04-11 Vladimir Serbinenko Support i386-ieee1275 grub-mkrescue and make check on it. diff --git a/tests/partmap_test.in b/tests/partmap_test.in index a0beb2a4c..8d68a28d7 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -72,6 +72,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in ;; *) disk=hd0 + qemudisk=hda ;; esac imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 From e3734b84cf57d60196cdf126738c98dfaca1f92d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 01:47:38 +0200 Subject: [PATCH 015/187] * tests/grub_cmd_date.in: New test for datetime. --- ChangeLog | 4 ++++ Makefile.util.def | 6 ++++++ tests/grub_cmd_date.in | 12 ++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/grub_cmd_date.in diff --git a/ChangeLog b/ChangeLog index 0668a0f13..a2f1d5af7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * tests/grub_cmd_date.in: New test for datetime. + 2013-04-12 Vladimir Serbinenko * tests/partmap_test.in: Fix missing qemudisk setting. diff --git a/Makefile.util.def b/Makefile.util.def index 373c25b8b..a231b401e 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -674,6 +674,12 @@ script = { common = tests/grub_cmd_regexp.in; }; +script = { + testcase; + name = grub_cmd_date; + common = tests/grub_cmd_date.in; +}; + script = { testcase; name = grub_script_expansion; diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in new file mode 100644 index 000000000..1c8e7e667 --- /dev/null +++ b/tests/grub_cmd_date.in @@ -0,0 +1,12 @@ +#! /bin/bash +set -e + +pdt="$(date -u +%s)" +dt=`echo date | @builddir@/grub-shell` +dtg="$(date -u -d "$dt" +%s)" +ndt="$(date -u +%s)" + +if [ $pdt -le $dtg ] && [ $dtg -le $ndt ]; then + exit 0; +fi +echo "Date not in range: $pdt <= $dtg <= $ndt" From a21eec9ec536a15a720f01f5caf4363bc0e75979 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 14:03:52 +0200 Subject: [PATCH 016/187] * docs/grub.texi: Update coreboot status info. --- ChangeLog | 4 ++++ docs/grub.texi | 40 ++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2f1d5af7..521295599 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * docs/grub.texi: Update coreboot status info. + 2013-04-12 Vladimir Serbinenko * tests/grub_cmd_date.in: New test for datetime. diff --git a/docs/grub.texi b/docs/grub.texi index f6f95068a..87d19ea74 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -4860,6 +4860,7 @@ Information retrieval: @item mips-arc: lsdev @item efi: lsefisystab, lssal, lsefimmap @item i386-pc: lsapm +@item i386-coreboot: lscoreboot, coreboot_boottime @item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi): lsacpi @end itemize @@ -4895,10 +4896,10 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel @item Plan9 @tab yes @tab no (1) @item Freedos @tab yes @tab no (1) @item FreeBSD bootloader @tab yes @tab crashes (1) -@item 32-bit kFreeBSD @tab yes @tab crashes (2,6) -@item 64-bit kFreeBSD @tab yes @tab crashes (2,6) +@item 32-bit kFreeBSD @tab yes @tab crashes (5) +@item 64-bit kFreeBSD @tab yes @tab crashes (5) @item 32-bit kNetBSD @tab yes @tab crashes (1) -@item 64-bit kNetBSD @tab yes @tab crashes (2) +@item 64-bit kNetBSD @tab yes @tab crashes @item 32-bit kOpenBSD @tab yes @tab yes @item 64-bit kOpenBSD @tab yes @tab yes @item Multiboot @tab yes @tab yes @@ -4909,9 +4910,9 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel @item 64-bit Linux (modern protocol) @tab yes @tab yes @item 32-bit XNU @tab yes @tab ? @item 64-bit XNU @tab yes @tab ? -@item 32-bit EFI chainloader @tab no (3) @tab no (3) -@item 64-bit EFI chainloader @tab no (3) @tab no (3) -@item Appleloader @tab no (3) @tab no (3) +@item 32-bit EFI chainloader @tab no (2) @tab no (2) +@item 64-bit EFI chainloader @tab no (2) @tab no (2) +@item Appleloader @tab no (2) @tab no (2) @end multitable @multitable @columnfractions .50 .22 .22 @@ -4921,8 +4922,8 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel @item Plan9 @tab no (1) @tab no (1) @item FreeDOS @tab no (1) @tab no (1) @item FreeBSD bootloader @tab crashes (1) @tab crashes (1) -@item 32-bit kFreeBSD @tab crashes (6) @tab crashes (6) -@item 64-bit kFreeBSD @tab crashes (6) @tab crashes (6) +@item 32-bit kFreeBSD @tab crashes (5) @tab crashes (5) +@item 64-bit kFreeBSD @tab crashes (5) @tab crashes (5) @item 32-bit kNetBSD @tab crashes (1) @tab crashes (1) @item 64-bit kNetBSD @tab yes @tab yes @item 32-bit kOpenBSD @tab yes @tab yes @@ -4935,9 +4936,9 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel @item 64-bit Linux (modern protocol) @tab yes @tab yes @item 32-bit XNU @tab ? @tab ? @item 64-bit XNU @tab ? @tab ? -@item 32-bit EFI chainloader @tab no (3) @tab no (3) -@item 64-bit EFI chainloader @tab no (3) @tab no (3) -@item Appleloader @tab no (3) @tab no (3) +@item 32-bit EFI chainloader @tab no (2) @tab no (2) +@item 64-bit EFI chainloader @tab no (2) @tab no (2) +@item Appleloader @tab no (2) @tab no (2) @end multitable @multitable @columnfractions .50 .22 .22 @@ -4960,9 +4961,9 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel @item 32-bit Linux (modern protocol) @tab yes @tab yes @item 64-bit Linux (modern protocol) @tab yes @tab yes @item 32-bit XNU @tab yes @tab yes -@item 64-bit XNU @tab yes (5) @tab yes -@item 32-bit EFI chainloader @tab yes @tab no (4) -@item 64-bit EFI chainloader @tab no (4) @tab yes +@item 64-bit XNU @tab yes (4) @tab yes +@item 32-bit EFI chainloader @tab yes @tab no (3) +@item 64-bit EFI chainloader @tab no (3) @tab yes @item Appleloader @tab yes @tab yes @end multitable @@ -4973,8 +4974,8 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel @item Plan9 @tab no (1) @item FreeDOS @tab no (1) @item FreeBSD bootloader @tab crashes (1) -@item 32-bit kFreeBSD @tab crashes (6) -@item 64-bit kFreeBSD @tab crashes (6) +@item 32-bit kFreeBSD @tab crashes (5) +@item 64-bit kFreeBSD @tab crashes (5) @item 32-bit kNetBSD @tab crashes (1) @item 64-bit kNetBSD @tab ? @item 32-bit kOpenBSD @tab ? @@ -4987,14 +4988,13 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel @item 64-bit Linux (modern protocol) @tab ? @item 32-bit XNU @tab ? @item 64-bit XNU @tab ? -@item 32-bit EFI chainloader @tab no (3) -@item 64-bit EFI chainloader @tab no (3) -@item Appleloader @tab no (3) +@item 32-bit EFI chainloader @tab no (2) +@item 64-bit EFI chainloader @tab no (2) +@item Appleloader @tab no (2) @end multitable @enumerate @item Requires BIOS -@item Crashes because the memory at 0x0-0x1000 isn't available @item EFI only @item 32-bit and 64-bit EFI have different structures and work in different CPU modes so it's not possible to chainload 32-bit bootloader on 64-bit platform and vice-versa @item Some modules may need to be disabled From 512122346557f5eb77375aa77ff51a3df6e81399 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 14:49:33 +0200 Subject: [PATCH 017/187] Turn off QEMU ACPI-way since new releases don't have shutdown port anymore. --- ChangeLog | 5 +++ Makefile.am | 35 ++++++++++----------- grub-core/lib/i386/halt.c | 23 +++++++++++++- grub-core/tests/boot/kfreebsd.init-i386.S | 6 ++-- grub-core/tests/boot/kfreebsd.init-x86_64.S | 2 +- grub-core/tests/boot/qemu-shutdown-x86.S | 7 ++--- 6 files changed, 51 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 521295599..1c77abf0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-12 Vladimir Serbinenko + + Turn off QEMU ACPI-way since new releases don't have shutdown port + anymore. + 2013-04-12 Vladimir Serbinenko * docs/grub.texi: Update coreboot status info. diff --git a/Makefile.am b/Makefile.am index 30aa5a770..9d38405af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -153,10 +153,10 @@ if COND_x86_64_efi QEMU32=qemu-system-x86_64 endif -linux.init.x86_64: $(srcdir)/grub-core/tests/boot/linux.init-x86_64.S +linux.init.x86_64: $(srcdir)/grub-core/tests/boot/linux.init-x86_64.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -m64 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -linux.init.i386: $(srcdir)/grub-core/tests/boot/linux.init-i386.S +linux.init.i386: $(srcdir)/grub-core/tests/boot/linux.init-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" linux.init.mips: $(srcdir)/grub-core/tests/boot/linux.init-mips.S @@ -171,46 +171,46 @@ linux.init.mipsel: $(srcdir)/grub-core/tests/boot/linux.init-mips.S linux.init.loongson: $(srcdir)/grub-core/tests/boot/linux.init-mips.S $(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -DREBOOT=1 -multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S +multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -DTARGET_MULTIBOOT=1 -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include -kfreebsd.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S +kfreebsd.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include kfreebsd.aout: kfreebsd.elf $(OBJCOPY) -O a.out-i386-linux $< $@ -R .note.gnu.build-id -R .note.gnu.gold-version -pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S +pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -DTARGET_CHAINLOADER=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x7c00 -m32 pc-chainloader.bin: pc-chainloader.elf $(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; -ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S +ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0 -m32 ntldr.bin: ntldr.elf $(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; -multiboot2.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S +multiboot2.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include -DTARGET_MULTIBOOT2=1 -kfreebsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kfreebsd.init-x86_64.S +kfreebsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kfreebsd.init-x86_64.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -m64 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@ -kfreebsd.init.i386: $(srcdir)/grub-core/tests/boot/kfreebsd.init-i386.S +kfreebsd.init.i386: $(srcdir)/grub-core/tests/boot/kfreebsd.init-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@ -knetbsd.init.i386: $(srcdir)/grub-core/tests/boot/kbsd.init-i386.S +knetbsd.init.i386: $(srcdir)/grub-core/tests/boot/kbsd.init-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DTARGET_NETBSD=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -kopenbsd.init.i386: $(srcdir)/grub-core/tests/boot/kbsd.init-i386.S +kopenbsd.init.i386: $(srcdir)/grub-core/tests/boot/kbsd.init-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DTARGET_OPENBSD=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -knetbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S +knetbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -m64 -DTARGET_NETBSD=1 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -kopenbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S +kopenbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S $(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" linux-initramfs.mips: linux.init.mips Makefile @@ -335,18 +335,17 @@ BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd- endif if COND_i386_multiboot -# Freebsd crashes because memory at 0-0x1000 is occupied and requires ACPI +# FreeBSD requires ACPI BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 endif if COND_i386_coreboot -# 64-bit NetBSD crashes because memory at 0-0x1000 is occupied -# Freebsd crashes because memory at 0-0x1000 is occupied and requires ACPI -BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 +# Freebsd requires ACPI +BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 endif if COND_i386_qemu -# Freebsd crashes because memory at 0-0x1000 is occupied and requires ACPI +# FreeBSD requires ACPI BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 endif diff --git a/grub-core/lib/i386/halt.c b/grub-core/lib/i386/halt.c index bd878c9bf..9f8405494 100644 --- a/grub-core/lib/i386/halt.c +++ b/grub-core/lib/i386/halt.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include const char bochs_shutdown[] = "Shutdown"; @@ -37,6 +39,23 @@ stop (void) } } +static int +grub_shutdown_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, + void *data __attribute__ ((unused))) +{ + /* QEMU. */ + if (pciid == 0x71138086) + { + grub_pci_address_t addr; + addr = grub_pci_make_address (dev, 0x40); + grub_pci_write (addr, 0x7001); + addr = grub_pci_make_address (dev, 0x80); + grub_pci_write (addr, grub_pci_read (addr) | 1); + grub_outw (0x2000, 0x7004); + } + return 0; +} + void grub_halt (void) { @@ -49,10 +68,12 @@ grub_halt (void) /* Disable interrupts. */ __asm__ __volatile__ ("cli"); - /* Bochs, QEMU, etc. */ + /* Bochs, QEMU, etc. Removed in newer QEMU releases. */ for (i = 0; i < sizeof (bochs_shutdown) - 1; i++) grub_outb (bochs_shutdown[i], 0x8900); + grub_pci_iterate (grub_shutdown_pci_iter, NULL); + grub_puts_ (N_("GRUB doesn't know how to halt this machine yet!")); /* In order to return we'd have to check what the previous status of IF diff --git a/grub-core/tests/boot/kfreebsd.init-i386.S b/grub-core/tests/boot/kfreebsd.init-i386.S index a4481520a..7a4babaf9 100644 --- a/grub-core/tests/boot/kfreebsd.init-i386.S +++ b/grub-core/tests/boot/kfreebsd.init-i386.S @@ -65,7 +65,7 @@ _start: /* IOPERM. */ movl $SYSCALL_ARCH, %eax - pushl $iopl_arg1 + pushl $ioperm_arg1 pushl $SYSCALL_ARCH_IOPERM pushl $0 int $SYSCALL_INT @@ -73,7 +73,7 @@ _start: /* IOPERM. */ movl $SYSCALL_ARCH, %eax - pushl $iopl_arg2 + pushl $ioperm_arg2 pushl $SYSCALL_ARCH_IOPERM pushl $0 int $SYSCALL_INT @@ -104,6 +104,6 @@ ioperm_arg1: .long 8 .long 1 ioperm_arg2: - .long 0x1000 + .long 0x7000 .long 8 .long 1 diff --git a/grub-core/tests/boot/kfreebsd.init-x86_64.S b/grub-core/tests/boot/kfreebsd.init-x86_64.S index de7bab6ce..05e5760e0 100644 --- a/grub-core/tests/boot/kfreebsd.init-x86_64.S +++ b/grub-core/tests/boot/kfreebsd.init-x86_64.S @@ -85,6 +85,6 @@ ioperm_arg1: .long 8 .long 1 ioperm_arg2: - .long 0x1000 + .long 0x7000 .long 8 .long 1 diff --git a/grub-core/tests/boot/qemu-shutdown-x86.S b/grub-core/tests/boot/qemu-shutdown-x86.S index 9f8bc4051..e37f5df79 100644 --- a/grub-core/tests/boot/qemu-shutdown-x86.S +++ b/grub-core/tests/boot/qemu-shutdown-x86.S @@ -1,18 +1,17 @@ movl $0x80000b80, %eax movw $0xcf8, %dx outl %eax, %dx - movl $0x1001, %eax movw $0xcfc, %dx - inb %al, %dx + inb %dx, %al orb $1, %al outb %al, %dx movl $0x80000b40, %eax movw $0xcf8, %dx outl %eax, %dx - movl $0x1001, %eax + movl $0x7001, %eax movw $0xcfc, %dx outl %eax, %dx movw $0x2000, %ax - movw $0x1004, %dx + movw $0x7004, %dx outw %ax, %dx From a936af564cccf2d388ac38ff186ed9a3241dfd6a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 14:52:05 +0200 Subject: [PATCH 018/187] * tests/util/grub-shell.in: Fix it on powerpc. --- ChangeLog | 4 ++++ tests/util/grub-shell.in | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c77abf0e..109bb4c14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * tests/util/grub-shell.in: Fix it on powerpc. + 2013-04-12 Vladimir Serbinenko Turn off QEMU ACPI-way since new releases don't have shutdown port diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index c6d1cd783..e467b4a77 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -198,8 +198,13 @@ cfgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 cat <${cfgfile} grubshell=yes insmod serial +EOF +if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = powerpc-ieee1275 ]; then + echo insmod escc >>${cfgfile} +fi +cat <>${cfgfile} serial ${serial_port} -terminfo serial_${serial_port} dumb +terminfo -g 255x255 serial_${serial_port} dumb terminal_input serial_${serial_port} terminal_output serial_${serial_port} EOF @@ -228,7 +233,7 @@ echo "${halt_cmd}" >>${cfgfile} isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 if [ x$boot != xnet ]; then - pkgdatadir="@builddir@" sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \ + pkgdatadir="@builddir@" sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--grub-render-label=${builddir}/grub-render-label" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \ --rom-directory="${rom_directory}" \ "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \ ${files} >/dev/null 2>&1 From a3d566d442676fc4732c9043ec914662a97d9789 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 17:51:43 +0200 Subject: [PATCH 019/187] Disable partmap check on i386-ieee1275 due to openfirmware issues. --- ChangeLog | 4 ++++ tests/partmap_test.in | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 109bb4c14..1f6ad7c0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + Disable partmap check on i386-ieee1275 due to openfirmware issues. + 2013-04-12 Vladimir Serbinenko * tests/util/grub-shell.in: Fix it on powerpc. diff --git a/tests/partmap_test.in b/tests/partmap_test.in index 8d68a28d7..f667f86e1 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -69,6 +69,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-ieee1275) disk=ieee1275/d qemudisk=hdb + # QEMU firmware has bugs which prevent it from accessing hard disk. + exit 0 ;; *) disk=hd0 From b7d17a492f93c10fe285708274837d9a7e10e3a6 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 19:25:16 +0200 Subject: [PATCH 020/187] * grub-core/net/drivers/ieee1275/ofnet.c: Don't attempt to send more than buffer size. --- ChangeLog | 5 +++++ grub-core/net/drivers/ieee1275/ofnet.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1f6ad7c0e..ced68cc38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-12 Vladimir Serbinenko + + * grub-core/net/drivers/ieee1275/ofnet.c: Don't attempt to send more + than buffer size. + 2013-04-12 Vladimir Serbinenko Disable partmap check on i386-ieee1275 due to openfirmware issues. diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c index 1acfb73fb..cd9b159c7 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -79,7 +79,7 @@ send_card_buffer (struct grub_net_card *dev, struct grub_net_buff *pack) grub_memcpy (dev->txbuf, pack->data, len); status = grub_ieee1275_write (data->handle, dev->txbuf, - pack->tail - pack->data, &actual); + len, &actual); if (status) return grub_error (GRUB_ERR_IO, N_("couldn't send network packet")); From 92c8f58d973a621890e302cba3d80fe0bbc208d7 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 20:17:53 +0200 Subject: [PATCH 021/187] * grub-core/net/http.c: Fix bad free. --- ChangeLog | 4 ++++ grub-core/net/http.c | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ced68cc38..79563b811 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * grub-core/net/http.c: Fix bad free. + 2013-04-12 Vladimir Serbinenko * grub-core/net/drivers/ieee1275/ofnet.c: Don't attempt to send more diff --git a/grub-core/net/http.c b/grub-core/net/http.c index a7542d1ae..4684f8b33 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c @@ -157,9 +157,10 @@ http_err (grub_net_tcp_socket_t sock __attribute__ ((unused)), if (data->sock) grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT); + data->sock = 0; if (data->current_line) grub_free (data->current_line); - grub_free (data); + data->current_line = 0; file->device->net->eof = 1; file->device->net->stall = 1; if (file->size == GRUB_FILE_SIZE_UNKNOWN) @@ -175,6 +176,12 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)), http_data_t data = file->data; grub_err_t err; + if (!data->sock) + { + grub_netbuff_free (nb); + return GRUB_ERR_NONE; + } + while (1) { char *ptr = (char *) nb->data; @@ -432,7 +439,8 @@ http_seek (struct grub_file *file, grub_off_t off) grub_err_t err; old_data = file->data; /* FIXME: Reuse socket? */ - grub_net_tcp_close (old_data->sock, GRUB_NET_TCP_ABORT); + if (old_data->sock) + grub_net_tcp_close (old_data->sock, GRUB_NET_TCP_ABORT); old_data->sock = 0; while (file->device->net->packs.first) @@ -529,7 +537,8 @@ http_packets_pulled (struct grub_file *file) if (!file->device->net->eof) file->device->net->stall = 0; - grub_net_tcp_unstall (data->sock); + if (data && data->sock) + grub_net_tcp_unstall (data->sock); return 0; } From 51a4c3e3b0fd7ef7ee0becbb8c42853d23e252ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Nesrsta?= Date: Fri, 12 Apr 2013 20:42:46 +0200 Subject: [PATCH 022/187] Fix handling of split transfers. --- ChangeLog | 4 +++ grub-core/bus/usb/ehci.c | 25 ++++++++----------- grub-core/bus/usb/usbhub.c | 50 ++++++++++++++++++++++++++++++++------ include/grub/usb.h | 4 +-- 4 files changed, 59 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79563b811..e8e456950 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Aleš Nesrsta + + Fix handling of split transfers. + 2013-04-12 Vladimir Serbinenko * grub-core/net/http.c: Fix bad free. diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c index e902fcd7e..18b12b226 100644 --- a/grub-core/bus/usb/ehci.c +++ b/grub-core/bus/usb/ehci.c @@ -798,7 +798,7 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid, /* Set ownership of root hub ports to EHCI */ grub_ehci_oper_write32 (e, GRUB_EHCI_CONFIG_FLAG, GRUB_EHCI_CF_EHCI_OWNER); - /* Enable asynchronous list */ + /* Enable both lists */ grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND, GRUB_EHCI_CMD_AS_ENABL | GRUB_EHCI_CMD_PS_ENABL @@ -942,9 +942,9 @@ grub_ehci_setup_qh (grub_ehci_qh_t qh, grub_usb_transfer_t transfer) * SplitCompletionMask - AFAIK it is ignored in asynchronous list, * InterruptScheduleMask - AFAIK it should be zero in async. list */ ep_cap |= GRUB_EHCI_MULT_THREE; - ep_cap |= (transfer->dev->port << GRUB_EHCI_DEVPORT_OFF) + ep_cap |= (transfer->dev->split_hubport << GRUB_EHCI_DEVPORT_OFF) & GRUB_EHCI_DEVPORT_MASK; - ep_cap |= (transfer->dev->hubaddr << GRUB_EHCI_HUBADDR_OFF) + ep_cap |= (transfer->dev->split_hubaddr << GRUB_EHCI_HUBADDR_OFF) & GRUB_EHCI_HUBADDR_MASK; if (transfer->dev->speed == GRUB_USB_SPEED_LOW && transfer->type != GRUB_USB_TRANSACTION_TYPE_CONTROL) @@ -1261,16 +1261,6 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev, /* XXX: Fix it: Currently we don't do anything to restart EHCI */ return GRUB_USB_ERR_INTERNAL; - /* Check if transfer is not high speed and connected to root hub. - * It should not happened but... */ - if ((transfer->dev->speed != GRUB_USB_SPEED_HIGH) - && !transfer->dev->hubaddr) - { - grub_error (GRUB_USB_ERR_BADDEVICE, - "FULL/LOW speed device on EHCI port!?!"); - return GRUB_USB_ERR_BADDEVICE; - } - /* Allocate memory for controller transfer data. */ cdata = grub_malloc (sizeof (*cdata)); if (!cdata) @@ -1887,13 +1877,18 @@ grub_ehci_fini_hw (int noreturn __attribute__ ((unused))) /* We should disable all EHCI HW to prevent any DMA access etc. */ for (e = ehci; e; e = e->next) { + /* Disable both lists */ + grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND, + ~(GRUB_EHCI_CMD_AS_ENABL | GRUB_EHCI_CMD_PS_ENABL) + & grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); + /* Check if EHCI is halted and halt it if not */ if (grub_ehci_halt (e) != GRUB_USB_ERR_NONE) - grub_error (GRUB_ERR_TIMEOUT, "restore_hw: EHCI halt timeout"); + grub_error (GRUB_ERR_TIMEOUT, "fini_hw: EHCI halt timeout"); /* Reset EHCI */ if (grub_ehci_reset (e) != GRUB_USB_ERR_NONE) - grub_error (GRUB_ERR_TIMEOUT, "restore_hw: EHCI reset timeout"); + grub_error (GRUB_ERR_TIMEOUT, "fini_hw: EHCI reset timeout"); } return GRUB_USB_ERR_NONE; diff --git a/grub-core/bus/usb/usbhub.c b/grub-core/bus/usb/usbhub.c index 6fc9d021c..e3b7d4032 100644 --- a/grub-core/bus/usb/usbhub.c +++ b/grub-core/bus/usb/usbhub.c @@ -49,7 +49,7 @@ static grub_usb_controller_dev_t grub_usb_list; static grub_usb_device_t grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed, - int port, int hubaddr) + int split_hubport, int split_hubaddr) { grub_usb_device_t dev; int i; @@ -63,8 +63,8 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, dev->controller = *controller; dev->speed = speed; - dev->port = port; - dev->hubaddr = hubaddr; + dev->split_hubport = split_hubport; + dev->split_hubaddr = split_hubaddr; err = grub_usb_device_initialize (dev); if (err) @@ -108,8 +108,8 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_dprintf ("usb", "Added new usb device: %p, addr=%d\n", dev, i); - grub_dprintf ("usb", "speed=%d, port=%d, hubaddr=%d\n", - speed, port, hubaddr); + grub_dprintf ("usb", "speed=%d, split_hubport=%d, split_hubaddr=%d\n", + speed, split_hubport, split_hubaddr); /* Wait "recovery interval", spec. says 2ms */ grub_millisleep (2); @@ -219,7 +219,12 @@ attach_root_port (struct grub_usb_hub *hub, int portno, grub_boot_time ("Port enabled"); /* Enable the port and create a device. */ - dev = grub_usb_hub_add_dev (hub->controller, speed, portno, 0); + /* High speed device needs not transaction translation + and full/low speed device cannot be connected to EHCI root hub + and full/low speed device connected to OHCI/UHCI needs not + transaction translation - e.g. hubport and hubaddr should be + always none (zero) for any device connected to any root hub. */ + dev = grub_usb_hub_add_dev (hub->controller, speed, 0, 0); hub->controller->dev->pending_reset = 0; npending--; if (! dev) @@ -593,6 +598,8 @@ poll_nonroot_hub (grub_usb_device_t dev) { grub_usb_speed_t speed; grub_usb_device_t next_dev; + int split_hubport = 0; + int split_hubaddr = 0; /* Determine the device speed. */ if (status & GRUB_USB_HUB_STATUS_PORT_LOWSPEED) @@ -608,8 +615,37 @@ poll_nonroot_hub (grub_usb_device_t dev) /* Wait a recovery time after reset, spec. says 10ms */ grub_millisleep (10); + /* Find correct values for SPLIT hubport and hubaddr */ + if (speed == GRUB_USB_SPEED_HIGH) + { + /* HIGH speed device needs not transaction translation */ + split_hubport = 0; + split_hubaddr = 0; + } + else + /* FULL/LOW device needs hub port and hub address + for transaction translation (if connected to EHCI) */ + if (dev->speed == GRUB_USB_SPEED_HIGH) + { + /* This port is the first FULL/LOW speed port + in the chain from root hub. Attached device + should use its port number and hub address */ + split_hubport = i; + split_hubaddr = dev->addr; + } + else + { + /* This port is NOT the first FULL/LOW speed port + in the chain from root hub. Attached device + should use values inherited from some parent + HIGH speed hub - if any. */ + split_hubport = dev->split_hubport; + split_hubaddr = dev->split_hubaddr; + } + /* Add the device and assign a device address to it. */ - next_dev = grub_usb_hub_add_dev (&dev->controller, speed, i, dev->addr); + next_dev = grub_usb_hub_add_dev (&dev->controller, speed, + split_hubport, split_hubaddr); if (dev->controller.dev->pending_reset) { dev->controller.dev->pending_reset = 0; diff --git a/include/grub/usb.h b/include/grub/usb.h index 9e2c22165..1cc99426c 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -225,9 +225,9 @@ struct grub_usb_device struct grub_usb_desc_endp *hub_endpoint; /* EHCI Split Transfer information */ - int port; + int split_hubport; - int hubaddr; + int split_hubaddr; }; From d70dbab77a4239cc3d1c00230d1e1b311dc23d24 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 20:51:11 +0200 Subject: [PATCH 023/187] * grub-core/bus/usb/ehci.c (grub_ehci_fini_hw): Ignore errors, not much we can do about it anyway. --- ChangeLog | 5 +++++ grub-core/bus/usb/ehci.c | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e8e456950..0d5c8369f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-12 Vladimir Serbinenko + + * grub-core/bus/usb/ehci.c (grub_ehci_fini_hw): Ignore errors, not + much we can do about it anyway. + 2013-04-12 Aleš Nesrsta Fix handling of split transfers. diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c index 18b12b226..d18a87f8e 100644 --- a/grub-core/bus/usb/ehci.c +++ b/grub-core/bus/usb/ehci.c @@ -1883,12 +1883,10 @@ grub_ehci_fini_hw (int noreturn __attribute__ ((unused))) & grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND)); /* Check if EHCI is halted and halt it if not */ - if (grub_ehci_halt (e) != GRUB_USB_ERR_NONE) - grub_error (GRUB_ERR_TIMEOUT, "fini_hw: EHCI halt timeout"); + grub_ehci_halt (e); /* Reset EHCI */ - if (grub_ehci_reset (e) != GRUB_USB_ERR_NONE) - grub_error (GRUB_ERR_TIMEOUT, "fini_hw: EHCI reset timeout"); + grub_ehci_reset (e); } return GRUB_USB_ERR_NONE; From 8573d302fc6abe26c298296a5308c50bfafe2835 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 21:08:53 +0200 Subject: [PATCH 024/187] * util/grub-mkimage.c: Document memdisk implying --prefix. --- ChangeLog | 4 ++++ util/grub-mkimage.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0d5c8369f..92cb29d57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * util/grub-mkimage.c: Document memdisk implying --prefix. + 2013-04-12 Vladimir Serbinenko * grub-core/bus/usb/ehci.c (grub_ehci_fini_hw): Ignore errors, not diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index dce2c295d..80e7d8113 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -1710,7 +1710,9 @@ static struct argp_option options[] = { {"memdisk", 'm', N_("FILE"), 0, /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated. "embed" is a verb (command description). "*/ - N_("embed FILE as a memdisk image"), 0}, + N_("embed FILE as a memdisk image\n" + "Implies `-p (memdisk)/boot/grub' but prefix can be overridden by " + "later options"), 0}, /* TRANSLATORS: "embed" is a verb (command description). "*/ {"config", 'c', N_("FILE"), 0, N_("embed FILE as an early config"), 0}, /* TRANSLATORS: "embed" is a verb (command description). "*/ From bbdd6305db2a02561823457545e08b62d743952b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 22:26:38 +0200 Subject: [PATCH 025/187] Handle Japanese special keys. Reported by: Hiroyuki YAMAMORI. Codes supplied by: Hiroyuki YAMAMORI. --- ChangeLog | 6 ++++++ grub-core/commands/keylayouts.c | 5 ++++- grub-core/term/at_keyboard.c | 16 +++++++++++++--- include/grub/keyboard_layouts.h | 6 ++++-- util/grub-mklayout.c | 11 +++++++++-- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92cb29d57..70544411f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-12 Vladimir Serbinenko + + Handle Japanese special keys. + Reported by: Hiroyuki YAMAMORI. + Codes supplied by: Hiroyuki YAMAMORI. + 2013-04-12 Vladimir Serbinenko * util/grub-mkimage.c: Document memdisk implying --prefix. diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c index 6b5141c29..b93ddf164 100644 --- a/grub-core/commands/keylayouts.c +++ b/grub-core/commands/keylayouts.c @@ -132,6 +132,9 @@ map_key_core (int code, int status, int *alt_gr_consumed) { *alt_gr_consumed = 0; + if (code >= GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE) + return 0; + if (status & GRUB_TERM_STATUS_RALT) { if (status & (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT)) @@ -242,7 +245,7 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)), goto fail; } - if (grub_le_to_cpu32 (version) != GRUB_KEYBOARD_LAYOUTS_VERSION) + if (version != grub_cpu_to_le32_compile_time (GRUB_KEYBOARD_LAYOUTS_VERSION)) { grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid version"); goto fail; diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c index b2f328f9f..e255d4060 100644 --- a/grub-core/term/at_keyboard.c +++ b/grub-core/term/at_keyboard.c @@ -97,7 +97,17 @@ static const grub_uint8_t set1_mapping[128] = /* OLPC keys. Just mapped to normal keys. */ /* 0x64 */ 0, GRUB_KEYBOARD_KEY_UP, /* 0x66 */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_LEFT, - /* 0x68 */ GRUB_KEYBOARD_KEY_RIGHT + /* 0x68 */ GRUB_KEYBOARD_KEY_RIGHT, 0, + /* 0x6a */ 0, 0, + /* 0x6c */ 0, 0, + /* 0x6e */ 0, 0, + /* 0x70 */ 0, 0, + /* 0x72 */ 0, GRUB_KEYBOARD_KEY_JP_RO, + /* 0x74 */ 0, 0, + /* 0x76 */ 0, 0, + /* 0x78 */ 0, 0, + /* 0x7a */ 0, 0, + /* 0x7c */ 0, GRUB_KEYBOARD_KEY_JP_YEN, }; static const struct @@ -163,7 +173,7 @@ static const grub_uint8_t set2_mapping[256] = /* 0x4a */ GRUB_KEYBOARD_KEY_SLASH, GRUB_KEYBOARD_KEY_L, /* 0x4c */ GRUB_KEYBOARD_KEY_SEMICOLON, GRUB_KEYBOARD_KEY_P, /* 0x4e */ GRUB_KEYBOARD_KEY_DASH, 0, - /* 0x50 */ 0, 0, + /* 0x50 */ 0, GRUB_KEYBOARD_KEY_JP_RO, /* 0x52 */ GRUB_KEYBOARD_KEY_DQUOTE, 0, /* 0x54 */ GRUB_KEYBOARD_KEY_LBRACKET, GRUB_KEYBOARD_KEY_EQUAL, /* 0x56 */ 0, 0, @@ -176,7 +186,7 @@ static const grub_uint8_t set2_mapping[256] = /* 0x64 */ 0, 0, /* 0x66 */ GRUB_KEYBOARD_KEY_BACKSPACE, 0, /* 0x68 */ 0, GRUB_KEYBOARD_KEY_NUM1, - /* 0x6a */ 0, GRUB_KEYBOARD_KEY_NUM4, + /* 0x6a */ GRUB_KEYBOARD_KEY_JP_YEN, GRUB_KEYBOARD_KEY_NUM4, /* 0x6c */ GRUB_KEYBOARD_KEY_NUM7, 0, /* 0x6e */ 0, 0, /* 0x70 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUM0, diff --git a/include/grub/keyboard_layouts.h b/include/grub/keyboard_layouts.h index 1f7213c4a..8d94490c8 100644 --- a/include/grub/keyboard_layouts.h +++ b/include/grub/keyboard_layouts.h @@ -21,9 +21,9 @@ #define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC "GRUBLAYO" #define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE (sizeof(GRUB_KEYBOARD_LAYOUTS_FILEMAGIC) - 1) -#define GRUB_KEYBOARD_LAYOUTS_VERSION 8 +#define GRUB_KEYBOARD_LAYOUTS_VERSION 10 -#define GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE 128 +#define GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE 160 struct grub_keyboard_layout { @@ -129,6 +129,8 @@ typedef enum grub_keyboard_key GRUB_KEYBOARD_KEY_NUM0 = 0x62, GRUB_KEYBOARD_KEY_NUMDOT = 0x63, GRUB_KEYBOARD_KEY_102ND = 0x64, + GRUB_KEYBOARD_KEY_JP_RO = 0x87, + GRUB_KEYBOARD_KEY_JP_YEN = 0x89, GRUB_KEYBOARD_KEY_LEFT_CTRL = 0xe0, GRUB_KEYBOARD_KEY_LEFT_SHIFT = 0xe1, GRUB_KEYBOARD_KEY_LEFT_ALT = 0xe2, diff --git a/util/grub-mklayout.c b/util/grub-mklayout.c index bff4dd61c..e53d7109a 100644 --- a/util/grub-mklayout.c +++ b/util/grub-mklayout.c @@ -250,7 +250,7 @@ static grub_uint8_t linux_to_usb_map[128] = { /* 0x52 */ GRUB_KEYBOARD_KEY_NUMDOT, GRUB_KEYBOARD_KEY_NUMDOT, /* 0x54 */ 0, 0, /* 0x56 */ GRUB_KEYBOARD_KEY_102ND, GRUB_KEYBOARD_KEY_F11, - /* 0x58 */ GRUB_KEYBOARD_KEY_F12, 0, + /* 0x58 */ GRUB_KEYBOARD_KEY_F12, GRUB_KEYBOARD_KEY_JP_RO, /* 0x5a */ 0, 0, /* 0x5c */ 0, 0, /* 0x5e */ 0, 0, @@ -261,7 +261,14 @@ static grub_uint8_t linux_to_usb_map[128] = { /* 0x68 */ GRUB_KEYBOARD_KEY_PPAGE, GRUB_KEYBOARD_KEY_LEFT, /* 0x6a */ GRUB_KEYBOARD_KEY_RIGHT, GRUB_KEYBOARD_KEY_END, /* 0x6c */ GRUB_KEYBOARD_KEY_DOWN, GRUB_KEYBOARD_KEY_NPAGE, - /* 0x6e */ GRUB_KEYBOARD_KEY_INSERT, GRUB_KEYBOARD_KEY_DELETE + /* 0x6e */ GRUB_KEYBOARD_KEY_INSERT, GRUB_KEYBOARD_KEY_DELETE, + /* 0x70 */ 0, 0, + /* 0x72 */ 0, GRUB_KEYBOARD_KEY_JP_RO, + /* 0x74 */ 0, 0, + /* 0x76 */ 0, 0, + /* 0x78 */ 0, 0, + /* 0x7a */ 0, 0, + /* 0x7c */ GRUB_KEYBOARD_KEY_JP_YEN, }; static void From ba44ca6d1a62f558a5a814fa56b023840f214b3d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 12 Apr 2013 22:37:59 +0200 Subject: [PATCH 026/187] Replace stpcpy with grub_stpcpy in tools. --- ChangeLog | 4 ++++ util/getroot.c | 4 ++-- util/grub-fstest.c | 4 ++-- util/grub-probe.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 70544411f..f9d5dca98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + Replace stpcpy with grub_stpcpy in tools. + 2013-04-12 Vladimir Serbinenko Handle Japanese special keys. diff --git a/util/getroot.c b/util/getroot.c index f65fd1ec5..4ea8e65c9 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -667,14 +667,14 @@ grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) char *ptr; *relroot = xmalloc (strlen (entries[i].enc_root) + 2 + strlen (dir)); - ptr = stpcpy (*relroot, entries[i].enc_root); + ptr = grub_stpcpy (*relroot, entries[i].enc_root); if (strlen (dir) > strlen (entries[i].enc_path)) { while (ptr > *relroot && *(ptr - 1) == '/') ptr--; if (dir[strlen (entries[i].enc_path)] != '/') *ptr++ = '/'; - ptr = stpcpy (ptr, dir + strlen (entries[i].enc_path)); + ptr = grub_stpcpy (ptr, dir + strlen (entries[i].enc_path)); } *ptr = 0; } diff --git a/util/grub-fstest.c b/util/grub-fstest.c index 253dee830..aa2ef7a13 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -289,10 +289,10 @@ cmd_cmp (char *src, char *dest) + strlen (entry->d_name)); destnew = xmalloc (strlen (dest) + sizeof ("/") + strlen (entry->d_name)); - ptr = stpcpy (srcnew, src); + ptr = grub_stpcpy (srcnew, src); *ptr++ = '/'; strcpy (ptr, entry->d_name); - ptr = stpcpy (destnew, dest); + ptr = grub_stpcpy (destnew, dest); *ptr++ = '/'; strcpy (ptr, entry->d_name); diff --git a/util/grub-probe.c b/util/grub-probe.c index b66cbeaa8..a46f0b18c 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -499,7 +499,7 @@ probe (const char *path, char **device_names, char delim) { char *tmp = xmalloc (strlen (ofpath) + sizeof ("ieee1275/")); char *p; - p = stpcpy (tmp, "ieee1275/"); + p = grub_stpcpy (tmp, "ieee1275/"); strcpy (p, ofpath); printf ("--hint-ieee1275='"); print_full_name (tmp, dev); @@ -616,7 +616,7 @@ probe (const char *path, char **device_names, char delim) { char *tmp = xmalloc (strlen (ofpath) + sizeof ("ieee1275/")); char *p; - p = stpcpy (tmp, "ieee1275/"); + p = grub_stpcpy (tmp, "ieee1275/"); strcpy (p, ofpath); print_full_name (tmp, dev); free (tmp); From 67ab83538fb755a1fa1b87fbd6bd30620fa4db7a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 13 Apr 2013 00:38:04 +0200 Subject: [PATCH 027/187] Better support Apple Intel Macs on CD. --- ChangeLog | 4 + Makefile.util.def | 14 +++ configure.ac | 1 + include/grub/i386/macho.h | 8 +- include/grub/macho.h | 7 ++ util/grub-glue-efi.c | 219 ++++++++++++++++++++++++++++++++++++++ util/grub-mkrescue.in | 19 ++++ 7 files changed, 268 insertions(+), 4 deletions(-) create mode 100644 util/grub-glue-efi.c diff --git a/ChangeLog b/ChangeLog index f9d5dca98..80067dfd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + Better support Apple Intel Macs on CD. + 2013-04-12 Vladimir Serbinenko Replace stpcpy with grub_stpcpy in tools. diff --git a/Makefile.util.def b/Makefile.util.def index a231b401e..ef3c4eab0 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -775,6 +775,20 @@ program = { ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; +program = { + name = grub-glue-efi; + mansection = 1; + + common = util/grub-glue-efi.c; + common = grub-core/kern/emu/argp_common.c; + + ldadd = libgrubmods.a; + ldadd = libgrubgcry.a; + ldadd = libgrubkern.a; + ldadd = grub-core/gnulib/libgnu.a; + ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; +}; + program = { name = grub-render-label; mansection = 1; diff --git a/configure.ac b/configure.ac index 19febfd12..ca180c6bd 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,7 @@ grub_TRANSFORM([grub-install]) grub_TRANSFORM([grub-mkconfig]) grub_TRANSFORM([grub-mkfont]) grub_TRANSFORM([grub-mkimage]) +grub_TRANSFORM([grub-glue-efi]) grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mkpasswd-pbkdf2]) grub_TRANSFORM([grub-mkrelpath]) diff --git a/include/grub/i386/macho.h b/include/grub/i386/macho.h index 5ee9f9e70..437fa038f 100644 --- a/include/grub/i386/macho.h +++ b/include/grub/i386/macho.h @@ -21,12 +21,12 @@ #include -#define GRUB_MACHO_CPUTYPE_IS_HOST32(x) ((x)==0x00000007) -#define GRUB_MACHO_CPUTYPE_IS_HOST64(x) ((x)==0x01000007) +#define GRUB_MACHO_CPUTYPE_IS_HOST32(x) ((x) == GRUB_MACHO_CPUTYPE_IA32) +#define GRUB_MACHO_CPUTYPE_IS_HOST64(x) ((x) == GRUB_MACHO_CPUTYPE_AMD64) #ifdef __x86_64__ -#define GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT(x) ((x)==0x01000007) +#define GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT(x) ((x) == GRUB_MACHO_CPUTYPE_AMD64) #else -#define GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT(x) ((x)==0x00000007) +#define GRUB_MACHO_CPUTYPE_IS_HOST_CURRENT(x) ((x) == GRUB_MACHO_CPUTYPE_IA32) #endif struct grub_macho_thread32 diff --git a/include/grub/macho.h b/include/grub/macho.h index 21f0714e0..18434ff8e 100644 --- a/include/grub/macho.h +++ b/include/grub/macho.h @@ -26,6 +26,13 @@ struct grub_macho_fat_header grub_uint32_t magic; grub_uint32_t nfat_arch; } __attribute__ ((packed)); + +enum + { + GRUB_MACHO_CPUTYPE_IA32 = 0x00000007, + GRUB_MACHO_CPUTYPE_AMD64 = 0x01000007 + }; + #define GRUB_MACHO_FAT_MAGIC 0xcafebabe #define GRUB_MACHO_FAT_EFI_MAGIC 0x0ef1fab9 diff --git a/util/grub-glue-efi.c b/util/grub-glue-efi.c new file mode 100644 index 000000000..47e393a1f --- /dev/null +++ b/util/grub-glue-efi.c @@ -0,0 +1,219 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2010,2012,2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include + +#include +#include +#include +#include + +#define _GNU_SOURCE 1 + +#include +#include +#include +#include +#include +#include + +#include "progname.h" + +struct arguments +{ + char *input32; + char *input64; + char *output; + int verbosity; +}; + +static struct argp_option options[] = { + {"input32", '3', N_("FILE"), 0, + N_("set input filename for 32-bit part."), 0}, + {"input64", '6', N_("FILE"), 0, + N_("set input filename for 64-bit part."), 0}, + {"output", 'o', N_("FILE"), 0, + N_("set output filename. Default is STDOUT"), 0}, + {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, + { 0, 0, 0, 0, 0, 0 } +}; + +static error_t +argp_parser (int key, char *arg, struct argp_state *state) +{ + /* Get the input argument from argp_parse, which we + know is a pointer to our arguments structure. */ + struct arguments *arguments = state->input; + + switch (key) + { + case '6': + arguments->input64 = xstrdup (arg); + break; + case '3': + arguments->input32 = xstrdup (arg); + break; + + case 'o': + arguments->output = xstrdup (arg); + break; + + case 'v': + arguments->verbosity++; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + + return 0; +} + +static struct argp argp = { + options, argp_parser, N_("[OPTIONS]"), + N_("Glue 32-bit and 64-binary into Apple fat one."), + NULL, NULL, NULL +}; + +static void +write_fat (FILE *in32, FILE *in64, FILE *out, const char *out_filename, + const char *name32, const char *name64) +{ + struct grub_macho_fat_header head; + struct grub_macho_fat_arch arch32, arch64; + grub_uint32_t size32, size64; + char *buf; + + fseek (in32, 0, SEEK_END); + size32 = ftell (in32); + fseek (in32, 0, SEEK_SET); + fseek (in64, 0, SEEK_END); + size64 = ftell (in64); + fseek (in64, 0, SEEK_SET); + + head.magic = grub_cpu_to_le32_compile_time (GRUB_MACHO_FAT_EFI_MAGIC); + head.nfat_arch = grub_cpu_to_le32_compile_time (2); + arch32.cputype = grub_cpu_to_le32_compile_time (GRUB_MACHO_CPUTYPE_IA32); + arch32.cpusubtype = grub_cpu_to_le32_compile_time (3); + arch32.offset = grub_cpu_to_le32_compile_time (sizeof (head) + + sizeof (arch32) + + sizeof (arch64)); + arch32.size = grub_cpu_to_le32 (size32); + arch32.align = 0; + + arch64.cputype = grub_cpu_to_le32_compile_time (GRUB_MACHO_CPUTYPE_AMD64); + arch64.cpusubtype = grub_cpu_to_le32_compile_time (3); + arch64.offset = grub_cpu_to_le32 (sizeof (head) + sizeof (arch32) + + sizeof (arch64) + size32); + arch64.size = grub_cpu_to_le32 (size64); + arch64.align = 0; + if (fwrite (&head, 1, sizeof (head), out) != sizeof (head) + || fwrite (&arch32, 1, sizeof (arch32), out) != sizeof (arch32) + || fwrite (&arch64, 1, sizeof (arch64), out) != sizeof (arch64)) + { + if (out_filename) + grub_util_error ("cannot write to `%s': %s", + out_filename, strerror (errno)); + else + grub_util_error ("cannot write to the stdout: %s", strerror (errno)); + } + + buf = xmalloc (size32); + if (fread (buf, 1, size32, in32) != size32) + grub_util_error (_("cannot read `%s': %s"), name32, + strerror (errno)); + if (fwrite (buf, 1, size32, out) != size32) + { + if (out_filename) + grub_util_error ("cannot write to `%s': %s", + out_filename, strerror (errno)); + else + grub_util_error ("cannot write to the stdout: %s", strerror (errno)); + } + free (buf); + + buf = xmalloc (size64); + if (fread (buf, 1, size64, in64) != size64) + grub_util_error (_("cannot read `%s': %s"), name64, + strerror (errno)); + if (fwrite (buf, 1, size64, out) != size64) + { + if (out_filename) + grub_util_error ("cannot write to `%s': %s", + out_filename, strerror (errno)); + else + grub_util_error ("cannot write to the stdout: %s", strerror (errno)); + } + free (buf); +} + +int +main (int argc, char *argv[]) +{ + FILE *in32, *in64, *out; + struct arguments arguments; + + set_program_name (argv[0]); + + /* Check for options. */ + memset (&arguments, 0, sizeof (struct arguments)); + if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0) + { + fprintf (stderr, "%s", _("Error in parsing command line arguments\n")); + exit(1); + } + + if (!arguments.input32 || !arguments.input64) + { + fprintf (stderr, "%s", _("Missing input file\n")); + exit(1); + } + + in32 = fopen (arguments.input32, "r"); + + if (!in32) + grub_util_error (_("cannot open `%s': %s"), arguments.input32, + strerror (errno)); + + in64 = fopen (arguments.input64, "r"); + if (!in64) + grub_util_error (_("cannot open `%s': %s"), arguments.input64, + strerror (errno)); + + if (arguments.output) + out = fopen (arguments.output, "wb"); + else + out = stdout; + + if (!out) + { + grub_util_error (_("cannot open `%s': %s"), arguments.output ? : "stdout", + strerror (errno)); + } + + write_fat (in32, in64, out, arguments.output, + arguments.input32, arguments.input64); + + fclose (in32); + fclose (in64); + + if (out != stdout) + fclose (out); + + return 0; +} diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 510d95fb7..6a38f84d1 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -49,6 +49,7 @@ rom_directory= override_dir= grub_mkimage="${bindir}/@grub_mkimage@" grub_render_label="${bindir}/@grub_render_label@" +grub_glue_efi="${bindir}/@grub_glue_efi@" label_font="${pkgdatadir}/unicode.pf2" label_color="black" label_bgcolor="white" @@ -82,6 +83,7 @@ usage () { # TRANSLATORS: xorriso is a program for creating ISOs and burning CDs print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")" print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")" + print_option_help "--grub-glue-efi=$filetrans" "$(gettext "use FILE as grub-glue-efi")" print_option_help "--grub-render-label=$filetrans" "$(gettext "use FILE as grub-render-label")" print_option_help "--label-font=$filetrans" "$(gettext "use FILE as font for label")" print_option_help "--label-color=$(gettext "COLOR")" "$(gettext "use COLOR for label")" @@ -160,6 +162,11 @@ do --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + --grub-glue-efi) + grub_glue_efi=`argument $option "$@"`; shift ;; + --grub-glue-efi=*) + grub_glue_efi=`echo "$option" | sed 's/--grub-glue-efi=//'` ;; + --grub-render-label) grub_render_label=`argument $option "$@"`; shift ;; --grub-render-label=*) @@ -359,6 +366,18 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; th cp "${efi_dir}"/efi/boot/bootia32.efi "${efi_dir}"/efi/boot/boot.efi fi + if [ -e "${efi_dir}"/efi/boot/bootx64.efi ] || [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then + mkdir -p "${iso9660_dir}"/System/Library/CoreServices + fi + + if [ -e "${efi_dir}"/efi/boot/bootx64.efi ] && [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then + "$grub_glue_efi" -6 "${efi_dir}"/efi/boot/bootx64.efi -3 "${efi_dir}"/efi/boot/bootia32.efi -o "${iso9660_dir}"/System/Library/CoreServices/boot.efi + elif [ -e "${efi_dir}"/efi/boot/bootx64.efi ]; then + cp "${efi_dir}"/efi/boot/bootx64.efi "${iso9660_dir}"/System/Library/CoreServices/boot.efi + elif [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then + cp "${efi_dir}"/efi/boot/bootia32.efi "${iso9660_dir}"/System/Library/CoreServices/boot.efi + fi + mformat -C -f 2880 -L 16 -i "${iso9660_dir}"/efi.img :: mcopy -s -i "${iso9660_dir}"/efi.img ${efi_dir}/efi ::/ rm -rf ${efi_dir} From 07aec23c00d22381a1aa986a4868cf9bcc1f973a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 13 Apr 2013 02:02:19 +0200 Subject: [PATCH 028/187] * util/grub-mkrescue.in: Fix wrong architecture for ppc dir. --- ChangeLog | 4 ++++ util/grub-mkrescue.in | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 80067dfd0..980dbbfab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * util/grub-mkrescue.in: Fix wrong architecture for ppc dir. + 2013-04-12 Vladimir Serbinenko Better support Apple Intel Macs on CD. diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 6a38f84d1..a244b2a87 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -286,7 +286,7 @@ if [ "${override_dir}" = "" ] ; then process_input_dir "${loongson_dir}" mipsel-loongson fi if test -e "${ppc_dir}" ; then - process_input_dir "${ppc_dir}" mipsel-loongson + process_input_dir "${ppc_dir}" powerpc-ieee1275 fi else . "${override_dir}"/modinfo.sh From 9d21381bac2b83aa3a0a627e9be07ce51ec72612 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 13 Apr 2013 02:26:34 +0200 Subject: [PATCH 029/187] * docs/man/grub-glue-efi.h2m: Add missing file. --- ChangeLog | 4 ++++ docs/man/grub-glue-efi.h2m | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 docs/man/grub-glue-efi.h2m diff --git a/ChangeLog b/ChangeLog index 980dbbfab..a96511762 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * docs/man/grub-glue-efi.h2m: Add missing file. + 2013-04-12 Vladimir Serbinenko * util/grub-mkrescue.in: Fix wrong architecture for ppc dir. diff --git a/docs/man/grub-glue-efi.h2m b/docs/man/grub-glue-efi.h2m new file mode 100644 index 000000000..c1c6ded49 --- /dev/null +++ b/docs/man/grub-glue-efi.h2m @@ -0,0 +1,4 @@ +[NAME] +grub-glue-efi \- generate a fat binary for EFI +[DESCRIPTION] +grub-glue-efi processes ia32 and amd64 EFI images and glues them according to Apple format. From fe22b071dc8e7b0964980a2b44ff523fd05b5c4b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 13 Apr 2013 20:12:11 +0200 Subject: [PATCH 030/187] Fix memory leaks in ofnet. Reported by: Francesco Lavra. --- ChangeLog | 5 +++++ grub-core/net/drivers/ieee1275/ofnet.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a96511762..0514e735c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-13 Vladimir Serbinenko + + Fix memory leaks in ofnet. + Reported by: Francesco Lavra. + 2013-04-12 Vladimir Serbinenko * docs/man/grub-glue-efi.h2m: Add missing file. diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c index cd9b159c7..21b62141a 100644 --- a/grub-core/net/drivers/ieee1275/ofnet.c +++ b/grub-core/net/drivers/ieee1275/ofnet.c @@ -97,10 +97,7 @@ get_card_packet (struct grub_net_card *dev) nb = grub_netbuff_alloc (dev->mtu + 64 + 2); if (!nb) - { - grub_netbuff_free (nb); - return NULL; - } + return NULL; /* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible by 4. So that IP header is aligned on 4 bytes. */ grub_netbuff_reserve (nb, 2); @@ -281,6 +278,9 @@ search_net_devices (struct grub_ieee1275_devalias *alias) card->txbuf = grub_zalloc (card->txbufsize); if (!card->txbuf) { + grub_free (ofdata->path); + grub_free (ofdata); + grub_free (card); grub_print_error (); return 0; } From 87206f2cf1fe15ce833bf0d740b61199c40c92d1 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 16:52:49 +0200 Subject: [PATCH 031/187] * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Inline name defines used only once. --- ChangeLog | 5 +++++ grub-core/kern/ieee1275/cmain.c | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0514e735c..9df4d1ecd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-13 Vladimir Serbinenko + + * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): + Inline name defines used only once. + 2013-04-13 Vladimir Serbinenko Fix memory leaks in ofnet. diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c index 789669a36..5f6a6da3a 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c @@ -43,9 +43,6 @@ grub_ieee1275_set_flag (enum grub_ieee1275_flag flag) grub_ieee1275_flags |= (1 << flag); } -#define SF "SmartFirmware(tm)" -#define OHW "PPC Open Hack'Ware" - static void grub_ieee1275_find_options (void) { @@ -76,7 +73,8 @@ grub_ieee1275_find_options (void) rc = grub_ieee1275_get_property (openprom, "CodeGen-copyright", tmp, sizeof (tmp), 0); - if (rc >= 0 && !grub_strncmp (tmp, SF, sizeof (SF) - 1)) + if (rc >= 0 && !grub_strncmp (tmp, "SmartFirmware(tm)", + sizeof ("SmartFirmware(tm)") - 1)) is_smartfirmware = 1; rc = grub_ieee1275_get_property (root, "architecture", @@ -191,7 +189,8 @@ grub_ieee1275_find_options (void) if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom)) { rc = grub_ieee1275_get_property (bootrom, "model", tmp, sizeof (tmp), 0); - if (rc >= 0 && !grub_strncmp (tmp, OHW, sizeof (OHW) - 1)) + if (rc >= 0 && !grub_strncmp (tmp, "PPC Open Hack'Ware", + sizeof ("PPC Open Hack'Ware") - 1)) { grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT); grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS); @@ -202,9 +201,6 @@ grub_ieee1275_find_options (void) } } -#undef SF -#undef OHW - void grub_ieee1275_init (void) { From ac4fea7998cc596c8f47aecbe71440b243166333 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 16:55:20 +0200 Subject: [PATCH 032/187] * grub-core/disk/ieee1275/ofdisk.c: Iterate over bootpath even if it would be otherwise excluded. --- ChangeLog | 7 ++++- grub-core/disk/ieee1275/ofdisk.c | 49 ++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9df4d1ecd..10880614d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2013-04-13 Vladimir Serbinenko +2013-04-14 Vladimir Serbinenko + + * grub-core/disk/ieee1275/ofdisk.c: Iterate over bootpath even if it + would be otherwise excluded. + +2013-04-14 Vladimir Serbinenko * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Inline name defines used only once. diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c index 1d4de90f7..bebf777ac 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -31,6 +31,7 @@ static grub_ieee1275_ihandle_t last_ihandle; struct ofdisk_hash_ent { char *devpath; + int is_boot; /* Pointer to shortest available name on nodes representing canonical names, otherwise NULL. */ const char *shortest; @@ -69,13 +70,12 @@ ofdisk_hash_add_real (char *devpath) struct ofdisk_hash_ent *p; struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)]; - p = grub_malloc(sizeof (*p)); + p = grub_zalloc (sizeof (*p)); if (!p) return NULL; p->devpath = devpath; p->next = *head; - p->shortest = 0; *head = p; return p; } @@ -267,7 +267,8 @@ grub_ofdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, } } - if (grub_strncmp (ent->shortest, "cdrom", 5) == 0) + if (grub_strncmp (ent->shortest, "cdrom", 5) == 0 + || ent->is_boot) continue; { @@ -491,9 +492,51 @@ static struct grub_disk_dev grub_ofdisk_dev = .next = 0 }; +static void +insert_bootpath (void) +{ + char *bootpath; + grub_ssize_t bootpath_size; + char *type; + + if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath", + &bootpath_size) + || bootpath_size <= 0) + { + /* Should never happen. */ + grub_printf ("/chosen/bootpath property missing!\n"); + return; + } + + bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64); + if (! bootpath) + { + grub_print_error (); + return; + } + grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath, + (grub_size_t) bootpath_size + 1, 0); + bootpath[bootpath_size] = '\0'; + + /* Transform an OF device path to a GRUB path. */ + + type = grub_ieee1275_get_device_type (bootpath); + if (!(type && grub_strcmp (type, "network") == 0)) + { + struct ofdisk_hash_ent *op; + char *device = grub_ieee1275_get_devname (bootpath); + op = ofdisk_hash_add (device, NULL); + op->is_boot = 1; + } + grub_free (type); + grub_free (bootpath); +} + void grub_ofdisk_init (void) { + insert_bootpath (); + grub_disk_dev_register (&grub_ofdisk_dev); } From aa1af9bbdaa8bf32ddcefda79ce9e2476c96108b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 17:01:31 +0200 Subject: [PATCH 033/187] Allow IEEE1275 ports on path even if it wasn't detected automatically. Needed on OpenBIOS due to incomplete device tree. --- ChangeLog | 5 ++ grub-core/term/ieee1275/serial.c | 78 +++++++++++++++++++++----------- grub-core/term/serial.c | 16 +++++++ include/grub/ieee1275/console.h | 3 ++ 4 files changed, 76 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10880614d..df9e30003 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-14 Vladimir Serbinenko + + Allow IEEE1275 ports on path even if it wasn't detected automatically. + Needed on OpenBIOS due to incomplete device tree. + 2013-04-14 Vladimir Serbinenko * grub-core/disk/ieee1275/ofdisk.c: Iterate over bootpath even if it diff --git a/grub-core/term/ieee1275/serial.c b/grub-core/term/ieee1275/serial.c index cda97d0d5..9e71ca4b8 100644 --- a/grub-core/term/ieee1275/serial.c +++ b/grub-core/term/ieee1275/serial.c @@ -23,6 +23,7 @@ #include #include #include +#include #define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_cell_t) 0) @@ -216,11 +217,59 @@ dev_iterate (struct grub_ieee1275_devalias *alias) return 0; } +static const char * +add_port (struct ofserial_hash_ent *ent) +{ + struct grub_serial_port *port; + char *ptr; + grub_err_t err; + + if (!ent->shortest) + return NULL; + + port = grub_zalloc (sizeof (*port)); + if (!port) + return NULL; + port->name = grub_malloc (sizeof ("ieee1275/") + + grub_strlen (ent->shortest)); + port->elem = ent; + if (!port->name) + return NULL; + ptr = grub_stpcpy (port->name, "ieee1275/"); + grub_strcpy (ptr, ent->shortest); + + port->driver = &grub_ofserial_driver; + err = grub_serial_config_defaults (port); + if (err) + grub_print_error (); + + grub_serial_register (port); + + return port->name; +} + +const char * +grub_ofserial_add_port (const char *path) +{ + struct ofserial_hash_ent *ent; + char *name = grub_strdup (path); + char *can = grub_strdup (path); + + if (!name || ! can) + { + grub_free (name); + grub_free (can); + return NULL; + } + + ent = ofserial_hash_add (name, can); + return add_port (ent); +} + void grub_ofserial_init (void) { unsigned i; - grub_err_t err; struct grub_ieee1275_devalias alias; FOR_IEEE1275_DEVALIASES(alias) @@ -230,32 +279,9 @@ grub_ofserial_init (void) for (i = 0; i < ARRAY_SIZE (ofserial_hash); i++) { - static struct ofserial_hash_ent *ent; + struct ofserial_hash_ent *ent; for (ent = ofserial_hash[i]; ent; ent = ent->next) - { - struct grub_serial_port *port; - char *ptr; - if (!ent->shortest) - continue; - - port = grub_zalloc (sizeof (*port)); - if (!port) - return; - port->name = grub_malloc (sizeof ("ieee1275/") - + grub_strlen (ent->shortest)); - port->elem = ent; - if (!port->name) - return; - ptr = grub_stpcpy (port->name, "ieee1275/"); - grub_strcpy (ptr, ent->shortest); - - port->driver = &grub_ofserial_driver; - err = grub_serial_config_defaults (port); - if (err) - grub_print_error (); - - grub_serial_register (port); - } + add_port (ent); } } diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c index cfcfe8484..96f9d7f29 100644 --- a/grub-core/term/serial.c +++ b/grub-core/term/serial.c @@ -31,6 +31,9 @@ #ifdef GRUB_MACHINE_MIPS_LOONGSON #include #endif +#ifdef GRUB_MACHINE_IEEE1275 +#include +#endif GRUB_MOD_LICENSE ("GPLv3+"); @@ -149,6 +152,19 @@ grub_serial_find (const char *name) } #endif +#ifdef GRUB_MACHINE_IEEE1275 + if (!port && grub_memcmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) == 0) + { + name = grub_ofserial_add_port (&name[sizeof ("ieee1275/") - 1]); + if (!name) + return NULL; + + FOR_SERIAL_PORTS (port) + if (grub_strcmp (port->name, name) == 0) + break; + } +#endif + return port; } diff --git a/include/grub/ieee1275/console.h b/include/grub/ieee1275/console.h index e054f54f5..bdd98fe06 100644 --- a/include/grub/ieee1275/console.h +++ b/include/grub/ieee1275/console.h @@ -28,4 +28,7 @@ void grub_console_init_lately (void); /* Finish the console system. */ void grub_console_fini (void); +const char * +grub_ofserial_add_port (const char *name); + #endif /* ! GRUB_CONSOLE_MACHINE_HEADER */ From 8ca86b3a03bab8ca3e9a99f00c9df33465e796a8 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 17:10:55 +0200 Subject: [PATCH 034/187] Support mkrescue on sparc64. --- ChangeLog | 4 ++ INSTALL | 2 +- Makefile.util.def | 1 + grub-core/Makefile.core.def | 9 +++ grub-core/boot/sparc64/ieee1275/boot.S | 24 ++++++- util/grub-mkimage.c | 21 ++++++- util/grub-mkrescue.in | 87 +++++++++++++++++++------- 7 files changed, 122 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index df9e30003..4c1e28db5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-14 Vladimir Serbinenko + + Support mkrescue on sparc64. + 2013-04-14 Vladimir Serbinenko Allow IEEE1275 ports on path even if it wasn't detected automatically. diff --git a/INSTALL b/INSTALL index 128bf4758..333368696 100644 --- a/INSTALL +++ b/INSTALL @@ -45,7 +45,7 @@ need the following. Prerequisites for make-check: * qemu, specifically the binary 'qemu-system-i386' -* xorriso, for grub-mkrescue and grub-shell +* xorriso 1.2.9 or later, for grub-mkrescue and grub-shell Configuring the GRUB ==================== diff --git a/Makefile.util.def b/Makefile.util.def index ef3c4eab0..ed7b4128a 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -475,6 +475,7 @@ script = { enable = mips_loongson; enable = ia64_efi; enable = powerpc_ieee1275; + enable = sparc64_ieee1275; }; script = { diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 6aead4c41..f1f10125a 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -283,10 +283,19 @@ image = { image = { name = cdboot; + i386_pc = boot/i386/pc/cdboot.S; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + + sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S; + sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big'; + sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000'; + sparc64_ieee1275_cppflags = '-DCDBOOT=1'; + objcopyflags = '-O binary'; + + enable = sparc64_ieee1275; enable = i386_pc; }; diff --git a/grub-core/boot/sparc64/ieee1275/boot.S b/grub-core/boot/sparc64/ieee1275/boot.S index f79699502..0ab9a4af3 100644 --- a/grub-core/boot/sparc64/ieee1275/boot.S +++ b/grub-core/boot/sparc64/ieee1275/boot.S @@ -28,6 +28,7 @@ pic_base: call boot_continue mov %o4, CIF_REG +#ifndef CDBOOT /* The offsets to these locations are defined by the * GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h, * and grub-setup uses this to patch these next three values as needed. @@ -43,9 +44,19 @@ pic_base: . = _start + GRUB_BOOT_MACHINE_BOOT_DEVPATH boot_path: . = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE -boot_path_end: kernel_byte: .xword (2 << 9) +boot_path_end: kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR +#else +#define boot_path (_start + 512) +#define boot_path_end (_start + 1024) +#include + + . = _start + 8 +kernel_byte: .xword (2 << 9) +kernel_size: .word 512 +kernel_address: .word GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS +#endif prom_finddev_name: .asciz "finddevice" prom_chosen_path: .asciz "/chosen" @@ -158,8 +169,10 @@ boot_continue: mov GRUB_NAME_LEN, %o3 GET_ABS(boot_path, %o3) +#ifndef CDBOOT ldub [%o3], %o1 brnz,pn %o1, bootpath_known +#endif /* getprop(chosen_node, "bootpath", &buffer, buffer_size) */ GET_ABS(prom_bootpath_name, %o2) @@ -194,12 +207,19 @@ bootpath_known: GET_ABS(prom_read_name, %o0) LDUW_ABS(kernel_address, 0x00, %o2) call prom_call_3_1_o1 +#ifdef CDBOOT + LDUW_ABS(kernel_size, 0x00, %o3) +#else mov 512, %o3 +#endif LDUW_ABS(kernel_address, 0x00, %o2) jmpl %o2, %o7 +#ifdef CDBOOT + mov CIF_REG, %o4 +#else nop - +#endif . = _start + GRUB_BOOT_MACHINE_CODE_END /* the last 4 bytes in the sector 0 contain the signature */ diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index 80e7d8113..96279a435 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -67,7 +67,8 @@ struct image_target_desc int bigendian; enum { IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT, - IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275, + IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_SPARC64_CDCORE, + IMAGE_I386_IEEE1275, IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH, IMAGE_FULOONG2F_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC, IMAGE_QEMU_MIPS_FLASH @@ -334,6 +335,21 @@ struct image_target_desc image_targets[] = .vaddr_offset = 0, .link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR }, + { + .dirname = "sparc64-ieee1275", + .names = { "sparc64-ieee1275-cdcore", NULL }, + .voidp_sizeof = 8, + .bigendian = 1, + .id = IMAGE_SPARC64_CDCORE, + .flags = PLATFORM_FLAGS_NONE, + .total_module_size = GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE, + .decompressor_compressed_size = TARGET_NO_FIELD, + .decompressor_uncompressed_size = TARGET_NO_FIELD, + .decompressor_uncompressed_addr = TARGET_NO_FIELD, + .section_align = 1, + .vaddr_offset = 0, + .link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR + }, { .dirname = "sparc64-ieee1275", .names = { "sparc64-ieee1275-aout", NULL }, @@ -1021,6 +1037,7 @@ generate_image (const char *dir, const char *prefix, break; case IMAGE_SPARC64_AOUT: case IMAGE_SPARC64_RAW: + case IMAGE_SPARC64_CDCORE: case IMAGE_I386_IEEE1275: case IMAGE_PPC: break; @@ -1360,6 +1377,8 @@ generate_image (const char *dir, const char *prefix, free (boot_path); } break; + case IMAGE_SPARC64_CDCORE: + break; case IMAGE_YEELOONG_FLASH: case IMAGE_FULOONG2F_FLASH: { diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index a244b2a87..c74c8ca66 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -44,6 +44,7 @@ i386_ieee1275_dir="${libdir}/@PACKAGE@/i386-ieee1275" efi32_dir="${libdir}/@PACKAGE@/i386-efi" efi64_dir="${libdir}/@PACKAGE@/x86_64-efi" ia64_dir="${libdir}/@PACKAGE@/ia64-efi" +sparc64_dir="${libdir}/@PACKAGE@/sparc64-ieee1275" ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" rom_directory= override_dir= @@ -90,6 +91,7 @@ usage () { print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")" print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")" print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")" + print_option_help "--sparc-boot" "$(gettext "enable sparc boot. Disables HFS+, APM and boot as disk image for i386-pc")" echo gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt echo @@ -99,6 +101,8 @@ usage () { gettext "Mail xorriso support requests to ."; echo } +system_area=auto + # Check the arguments. while test $# -gt 0 do @@ -147,6 +151,9 @@ do export PATH ;; + --sparc-boot) + system_area=sparc64 ;; + --product-name) product_name=`argument $option "$@"`; shift ;; --product-name=*) @@ -230,9 +237,7 @@ make_image () gettext_printf "Enabling %s support ...\n" "$2" - memdisk_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 - memdisk_dir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 - mkdir -p "${memdisk_dir}/boot/grub" + load_cfg="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" (cat << EOF search --fs-uuid --set=root ${iso_uuid} @@ -240,18 +245,36 @@ set prefix=(\${root})/boot/grub EOF for i in $(cat "${source_directory}/partmap.lst") ${modules} ; do echo "insmod $i" - done ; \ - echo "source \$prefix/grub.cfg") \ - > "${memdisk_dir}/boot/grub/grub.cfg" + done ; ) > "${load_cfg}" - (cd "${memdisk_dir}"; tar -cf - boot) > "${memdisk_img}" - rm -rf "${memdisk_dir}" - "$grub_mkimage" -O ${platform} -d "${source_directory}" -m "${memdisk_img}" -o "$3" --prefix='(memdisk)/boot/grub' \ - search iso9660 configfile normal memdisk tar $4 - rm -rf "${memdisk_img}" + "$grub_mkimage" -O ${platform} -d "${source_directory}" -c "${load_cfg}" -o "$3" \ + search iso9660 $4 + rm -rf "${load_cfg}" +} + +make_image_fwdisk () +{ + source_directory="$1" + platform=$2 + if ! test -e "${source_directory}"; then + return; + fi + + gettext_printf "Enabling %s support ...\n" "$2" + + "$grub_mkimage" -O ${platform} -d "${source_directory}" -p '()/boot/grub' -o "$3" \ + iso9660 $4 } if [ "${override_dir}" = "" ] ; then + if [ "$system_area" = auto ]; then + if test -e "${pc_dir}" || test -e "${ppc_dir}" \ + || test -e "${efi32_dir}" || test -e "${efi64_dir}"; then + system_area=common; + elif test -e "${sparc64_dir}" ; then + system_area=sparc64; + fi + fi if test -e "${multiboot_dir}" ; then process_input_dir "${multiboot_dir}" i386-multiboot fi @@ -288,6 +311,9 @@ if [ "${override_dir}" = "" ] ; then if test -e "${ppc_dir}" ; then process_input_dir "${ppc_dir}" powerpc-ieee1275 fi + if test -e "${sparc64_dir}" ; then + process_input_dir "${sparc64_dir}" sparc64-ieee1275 + fi else . "${override_dir}"/modinfo.sh process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform} @@ -303,18 +329,20 @@ else loongson_dir= ppc_dir= i386_ieee1275_dir= + sparc64_dir= case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-multiboot) multiboot_dir="${override_dir}" ;; i386-coreboot) coreboot_dir="${override_dir}" ;; i386-qemu) qemu_dir="${override_dir}" ;; - i386-pc) pc_dir="${override_dir}" ;; - i386-efi) efi32_dir="${override_dir}" ;; - x86_64-efi) efi64_dir="${override_dir}" ;; + i386-pc) pc_dir="${override_dir}"; system_area=common;; + i386-efi) efi32_dir="${override_dir}"; system_area=common ;; + x86_64-efi) efi64_dir="${override_dir}"; system_area=common ;; ia64-efi) ia64_dir="${override_dir}" ;; mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;; mipsel-loongson) loongson_dir="${override_dir}" ;; mips-qemu_mips) mips_qemu_dir="${override_dir}" ;; - powerpc-ieee1275) ppc_dir="${override_dir}" ;; + powerpc-ieee1275) ppc_dir="${override_dir}"; system_area=common ;; + sparc64-ieee1275) sparc64_dir="${override_dir}"; system_area=sparc64 ;; i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;; esac fi @@ -342,14 +370,16 @@ if test -e "${pc_dir}" ; then rm -f "${core_img}" - grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-info-table \ - --embedded-boot ${embed_img}" + grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table" + if [ "$system_area" = common ]; then + grub_mkisofs_arguments="--embedded-boot ${embed_img}" + fi fi # build multiboot core.img make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "pata ahci at_keyboard" -make_image "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/ofwx86.elf" "" +make_image_fwdisk "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/ofwx86.elf" "" if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; then efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 @@ -384,7 +414,7 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; th grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img" fi -make_image "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" "" +make_image_fwdisk "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" "" if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/powerpc.elf" ]; then mkdir -p "${iso9660_dir}"/System/Library/CoreServices touch "${iso9660_dir}/mach_kernel" @@ -402,20 +432,32 @@ if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso96 EOF "$grub_render_label" -f "$label_font" -b "$label_bgcolor" -c "$label_color" -t "${product_name} ${product_version}" -o "${iso9660_dir}/System/Library/CoreServices/.disk_label" echo "${product_name} ${product_version}" > "${iso9660_dir}/System/Library/CoreServices/.disk_label.contentDetails" - grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label" + if [ "$system_area" = common ]; then + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label" + fi fi if [ -e "${iso9660_dir}/boot/powerpc.elf" ] ; then cp "${ppc_dir}/grub.chrp" "${iso9660_dir}"/System/Library/CoreServices/BootX cp "${iso9660_dir}/boot/powerpc.elf" "${iso9660_dir}"/System/Library/CoreServices/grub.elf # FIXME: add PreP - grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices -sysid PPC" + if [ "$system_area" = common ]; then + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices" + fi + grub_mkisofs_arguments="${grub_mkisofs_arguments} -sysid PPC" fi -if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ]; then +if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] && [ "$system_area" = common ]; then grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfs-bless-by i /System/Library/CoreServices/boot.efi" fi +make_image_fwdisk "${sparc64_dir}" sparc64-ieee1275-cdcore "${iso9660_dir}/boot/grub/sparc64-ieee1275/core.img" "" +if [ -e "${iso9660_dir}"/boot/grub/sparc64-ieee1275/core.img ] && [ "$system_area" = sparc64 ]; then + sysarea_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 + dd if=/dev/zero count=1 bs=512 | cat - "${sparc64_dir}"/cdboot.img > "$sysarea_img" + grub_mkisofs_arguments="${grub_mkisofs_arguments} -G $sysarea_img -B , --grub2-sparc-core /boot/grub/sparc64-ieee1275/core.img" +fi + make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "pata" if [ -e "${iso9660_dir}/boot/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then cp "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf" @@ -452,6 +494,7 @@ fi "${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o "${output_image}" -r "${iso9660_dir}" --sort-weight 0 / --sort-weight 1 /boot ${source} rm -rf "${iso9660_dir}" +rm -f "${sysarea_img}" rm -f "${embed_img}" exit 0 From 3f7297414177e5d419f25fa86f25ce6062b675e5 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 17:13:58 +0200 Subject: [PATCH 035/187] Support grub-shell on sparc64. --- ChangeLog | 4 ++++ tests/util/grub-shell.in | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4c1e28db5..867cc5dbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-14 Vladimir Serbinenko + + Support grub-shell on sparc64. + 2013-04-14 Vladimir Serbinenko Support mkrescue on sparc64. diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index e467b4a77..739c300b3 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -69,6 +69,16 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in serial_null="-serial null" ;; + sparc64-ieee1275) + boot=cd + qemu=qemu-system-sparc64 + console= + serial_port=ieee1275/ttya + trim=1 + qemuopts="$qemuopts -no-reboot" + halt_cmd=reboot + ;; + mips-qemu_mips) boot=mips_qemu qemu=qemu-system-mips From c9d586ea1794753f69774824538ab3d9d3d0d9a9 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 17:16:32 +0200 Subject: [PATCH 036/187] * tests/partmap_test.in: Skip on sparc64. --- ChangeLog | 4 ++++ tests/partmap_test.in | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 867cc5dbc..402c79fbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-14 Vladimir Serbinenko + + * tests/partmap_test.in: Skip on sparc64. + 2013-04-14 Vladimir Serbinenko Support grub-shell on sparc64. diff --git a/tests/partmap_test.in b/tests/partmap_test.in index f667f86e1..bc503f50d 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -66,6 +66,12 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in # QEMU firmware has bugs which prevent it from accessing hard disk. exit 0 ;; + sparc64-ieee1275) + disk=ieee1275//pci@1fe\,0/pci-ata@5/ide0@500/disk@0 + qemudisk=hda + # QEMU firmware has bugs which prevent it from accessing hard disk. + exit 0 + ;; i386-ieee1275) disk=ieee1275/d qemudisk=hdb From 5351da81e0f33b2239e2529b7b4170d1c528bc1f Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 17:19:04 +0200 Subject: [PATCH 037/187] * tests/grub_cmd_date.in: Add missing exit 1. --- ChangeLog | 4 ++++ tests/grub_cmd_date.in | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 402c79fbe..60effd3d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-14 Vladimir Serbinenko + + * tests/grub_cmd_date.in: Add missing exit 1. + 2013-04-14 Vladimir Serbinenko * tests/partmap_test.in: Skip on sparc64. diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in index 1c8e7e667..254fb91ea 100644 --- a/tests/grub_cmd_date.in +++ b/tests/grub_cmd_date.in @@ -10,3 +10,4 @@ if [ $pdt -le $dtg ] && [ $dtg -le $ndt ]; then exit 0; fi echo "Date not in range: $pdt <= $dtg <= $ndt" +exit 1 From b49fe8792a2acdb98ba1d2d0eb5c0f528098fadc Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 18:53:14 +0200 Subject: [PATCH 038/187] Move GRUB out of system area when using xorriso 1.2.9 or later. --- ChangeLog | 4 + grub-core/Makefile.core.def | 13 +++ grub-core/boot/i386/pc/boot.S | 194 ++++++++++++++++++++------------ grub-core/boot/i386/pc/cdboot.S | 5 +- util/grub-mkrescue.in | 23 ++-- 5 files changed, 159 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60effd3d1..fc3dd5172 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-14 Vladimir Serbinenko + + Move GRUB out of system area when using xorriso 1.2.9 or later. + 2013-04-14 Vladimir Serbinenko * tests/grub_cmd_date.in: Add missing exit 1. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index f1f10125a..459e56645 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -281,6 +281,19 @@ image = { enable = sparc64_ieee1275; }; +image = { + name = boot_hybrid; + i386_pc = boot/i386/pc/boot.S; + + cppflags = '-DHYBRID_BOOT=1'; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + + objcopyflags = '-O binary'; + enable = i386_pc; +}; + image = { name = cdboot; diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S index 314f14016..c0880c6b8 100644 --- a/grub-core/boot/i386/pc/boot.S +++ b/grub-core/boot/i386/pc/boot.S @@ -28,6 +28,81 @@ #define MSG(x) movw $x, %si; call LOCAL(message) #define ERR(x) movw $x, %si; jmp LOCAL(error_message) + .macro floppy +part_start: + +probe_values: + .byte 36, 18, 15, 9, 0 + +LOCAL(floppy_probe): +/* + * Perform floppy probe. + */ + + movw $probe_values - 1, %si + +LOCAL(probe_loop): + /* reset floppy controller INT 13h AH=0 */ + xorw %ax, %ax + int $0x13 + + incw %si + movb (%si), %cl + + /* if number of sectors is 0, display error and die */ + cmpb $0, %cl + jne 1f + +/* + * Floppy disk probe failure. + */ + MSG(fd_probe_error_string) + jmp LOCAL(general_error) + +/* "Floppy" */ +fd_probe_error_string: .asciz "Floppy" + +1: + /* perform read */ + movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx + movw %bx, %es + xorw %bx, %bx + movw $0x201, %ax + movb $0, %ch + movb $0, %dh + int $0x13 + + /* if error, jump to "LOCAL(probe_loop)" */ + jc LOCAL(probe_loop) + + /* %cl is already the correct value! */ + movb $1, %dh + movb $79, %ch + + jmp LOCAL(final_init) + .endm + + .macro scratch + + /* scratch space */ +mode: + .byte 0 +disk_address_packet: +sectors: + .long 0 +heads: + .long 0 +cylinders: + .word 0 +sector_start: + .byte 0 +head_start: + .byte 0 +cylinder_start: + .word 0 + /* more space... */ + .endm + .file "boot.S" .text @@ -51,6 +126,34 @@ start: jmp LOCAL(after_BPB) nop /* do I care about this ??? */ +#ifdef HYBRID_BOOT + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + + nop + nop + nop + nop + nop + nop + nop + nop + + nop + nop + jmp LOCAL(after_BPB) +#else /* * This space is for the BIOS parameter block!!!! Don't change * the first jump, nor start the code anywhere but right after @@ -59,27 +162,14 @@ start: . = _start + GRUB_BOOT_MACHINE_BPB_START . = _start + 4 - - /* scratch space */ -mode: - .byte 0 -disk_address_packet: -sectors: - .long 0 -heads: - .long 0 -cylinders: - .word 0 -sector_start: - .byte 0 -head_start: - .byte 0 -cylinder_start: - .word 0 - /* more space... */ +#endif +#ifdef HYBRID_BOOT + floppy +#else + scratch +#endif . = _start + GRUB_BOOT_MACHINE_BPB_END - /* * End of BIOS parameter block. */ @@ -87,9 +177,11 @@ cylinder_start: kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR +#ifndef HYBRID_BOOT . = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR kernel_sector: .long 1, 0 +#endif . = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE boot_drive: @@ -410,6 +502,11 @@ LOCAL(message): * number here. */ +#ifdef HYBRID_BOOT + . = _start + 0x1b0 +kernel_sector: + .long 1, 0 +#endif . = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC nt_magic: .long 0 @@ -419,62 +516,17 @@ nt_magic: * This is where an MBR would go if on a hard disk. The code * here isn't even referenced unless we're on a floppy. Kinda * sneaky, huh? - */ + */ . = _start + GRUB_BOOT_MACHINE_PART_START -part_start: -probe_values: - .byte 36, 18, 15, 9, 0 - -LOCAL(floppy_probe): -/* - * Perform floppy probe. - */ - - movw $probe_values - 1, %si - -LOCAL(probe_loop): - /* reset floppy controller INT 13h AH=0 */ - xorw %ax, %ax - int $0x13 - - incw %si - movb (%si), %cl - - /* if number of sectors is 0, display error and die */ - cmpb $0, %cl - jne 1f - -/* - * Floppy disk probe failure. - */ - MSG(fd_probe_error_string) - jmp LOCAL(general_error) - -/* "Floppy" */ -fd_probe_error_string: .asciz "Floppy" - -1: - /* perform read */ - movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx - movw %bx, %es - xorw %bx, %bx - movw $0x201, %ax - movb $0, %ch - movb $0, %dh - int $0x13 - - /* if error, jump to "LOCAL(probe_loop)" */ - jc LOCAL(probe_loop) - - /* %cl is already the correct value! */ - movb $1, %dh - movb $79, %ch - - jmp LOCAL(final_init) +#ifndef HYBRID_BOOT + floppy +#else + scratch +#endif . = _start + GRUB_BOOT_MACHINE_PART_END - + /* the last 2 bytes in the sector 0 contain the signature */ .word GRUB_BOOT_MACHINE_SIGNATURE diff --git a/grub-core/boot/i386/pc/cdboot.S b/grub-core/boot/i386/pc/cdboot.S index d939835a9..92df7c76f 100644 --- a/grub-core/boot/i386/pc/cdboot.S +++ b/grub-core/boot/i386/pc/cdboot.S @@ -93,11 +93,12 @@ LOCAL(read_cdrom): pushw $CDBLK_LENG /* Block number. */ + incl %esi pushl %eax pushl %esi /* Buffer address. */ - pushw $((DATA_ADDR - 0x400)>> 4) + pushw $((DATA_ADDR - 0x200)>> 4) pushl %eax pushw $0x10 @@ -167,6 +168,6 @@ err_noboot_msg: err_cdfail_msg: .ascii "cdrom read fails\0" - . = start + 0x1FF + . = start + 0x7FF .byte 0 diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index c74c8ca66..b97d674b6 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -365,15 +365,25 @@ if test -e "${pc_dir}" ; then iso9660 biosdisk cat "${pc_dir}/cdboot.img" "${core_img}" > "${iso9660_dir}/boot/grub/i386-pc/eltorito.img" - embed_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 - cat "${pc_dir}/boot.img" "${core_img}" > "${embed_img}" - - rm -f "${core_img}" - grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table" if [ "$system_area" = common ]; then - grub_mkisofs_arguments="--embedded-boot ${embed_img}" + if "${xorriso}" -as mkisofs -help 2>&1 | fgrep "grub2-boot-info" >/dev/null; then + grub_mkisofs_arguments="${grub_mkisofs_arguments} --grub2-boot-info --grub2-mbr ${pc_dir}/boot_hybrid.img" + else + gettext "Your xorriso doesn't support \`--grub2-boot-info'. Some features are disabled. Please use xorriso 1.2.9 or later." + echo + sysarea_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 + cat "${pc_dir}/boot.img" "${core_img}" > "${sysarea_img}" + if [ "$(wc -c "${sysarea_img}" | awk '{ print $1; }')" -gt 32768 ]; then + gettext "Your xorriso doesn't support \`--grub2-boot-info'. Your core image is too big. Boot as disk is disabled. Please use xorriso 1.2.9 or later." + echo + else + grub_mkisofs_arguments="${grub_mkisofs_arguments} -G ${sysarea_img}" + fi + fi fi + + rm -f "${core_img}" fi # build multiboot core.img @@ -495,6 +505,5 @@ fi rm -rf "${iso9660_dir}" rm -f "${sysarea_img}" -rm -f "${embed_img}" exit 0 From cc2fa5ec1ea5319c959450d93b192881f85ee8fd Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 19:01:23 +0200 Subject: [PATCH 039/187] * grub-core/loader/i386/linux.c: Remove useless leftover pointer. --- ChangeLog | 4 +++ grub-core/loader/i386/linux.c | 64 +++++++++++++++++------------------ 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc3dd5172..1372be865 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-14 Vladimir Serbinenko + + * grub-core/loader/i386/linux.c: Remove useless leftover pointer. + 2013-04-14 Vladimir Serbinenko Move GRUB out of system area when using xorriso 1.2.9 or later. diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index bdfe19acd..5cd074b26 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -688,7 +688,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), { grub_file_t file = 0; struct linux_kernel_header lh; - struct linux_kernel_params *params; grub_uint8_t setup_sects; grub_size_t real_size, prot_size, prot_file_size; grub_ssize_t len; @@ -808,16 +807,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), preferred_address)) goto fail; - params = (struct linux_kernel_params *) &linux_params; - grub_memset (params, 0, sizeof (*params)); - grub_memcpy (¶ms->setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1); + grub_memset (&linux_params, 0, sizeof (linux_params)); + grub_memcpy (&linux_params.setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1); - params->code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR; - params->kernel_alignment = (1 << align); - params->ps_mouse = params->padding10 = 0; + linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR; + linux_params.kernel_alignment = (1 << align); + linux_params.ps_mouse = linux_params.padding10 = 0; - len = sizeof (*params) - sizeof (lh); - if (grub_file_read (file, (char *) params + sizeof (lh), len) != len) + len = sizeof (linux_params) - sizeof (lh); + if (grub_file_read (file, (char *) &linux_params + sizeof (lh), len) != len) { if (!grub_errno) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), @@ -825,58 +823,58 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } - params->type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; + linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; /* These two are used (instead of cmd_line_ptr) by older versions of Linux, and otherwise ignored. */ - params->cl_magic = GRUB_LINUX_CL_MAGIC; - params->cl_offset = 0x1000; + linux_params.cl_magic = GRUB_LINUX_CL_MAGIC; + linux_params.cl_offset = 0x1000; - params->ramdisk_image = 0; - params->ramdisk_size = 0; + linux_params.ramdisk_image = 0; + linux_params.ramdisk_size = 0; - params->heap_end_ptr = GRUB_LINUX_HEAP_END_OFFSET; - params->loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP; + linux_params.heap_end_ptr = GRUB_LINUX_HEAP_END_OFFSET; + linux_params.loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP; /* These are not needed to be precise, because Linux uses these values only to raise an error when the decompression code cannot find good space. */ - params->ext_mem = ((32 * 0x100000) >> 10); - params->alt_mem = ((32 * 0x100000) >> 10); + linux_params.ext_mem = ((32 * 0x100000) >> 10); + linux_params.alt_mem = ((32 * 0x100000) >> 10); /* Ignored by Linux. */ - params->video_page = 0; + linux_params.video_page = 0; /* Only used when `video_mode == 0x7', otherwise ignored. */ - params->video_ega_bx = 0; + linux_params.video_ega_bx = 0; - params->font_size = 16; /* XXX */ + linux_params.font_size = 16; /* XXX */ #ifdef GRUB_MACHINE_EFI #ifdef __x86_64__ - if (grub_le_to_cpu16 (params->version) < 0x0208 && + if (grub_le_to_cpu16 (linux_params.version) < 0x0208 && ((grub_addr_t) grub_efi_system_table >> 32) != 0) return grub_error(GRUB_ERR_BAD_OS, "kernel does not support 64-bit addressing"); #endif - if (grub_le_to_cpu16 (params->version) >= 0x0208) + if (grub_le_to_cpu16 (linux_params.version) >= 0x0208) { - params->v0208.efi_signature = GRUB_LINUX_EFI_SIGNATURE; - params->v0208.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; + linux_params.v0208.efi_signature = GRUB_LINUX_EFI_SIGNATURE; + linux_params.v0208.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; #ifdef __x86_64__ - params->v0208.efi_system_table_hi = (grub_uint32_t) ((grub_uint64_t) grub_efi_system_table >> 32); + linux_params.v0208.efi_system_table_hi = (grub_uint32_t) ((grub_uint64_t) grub_efi_system_table >> 32); #endif } - else if (grub_le_to_cpu16 (params->version) >= 0x0206) + else if (grub_le_to_cpu16 (linux_params.version) >= 0x0206) { - params->v0206.efi_signature = GRUB_LINUX_EFI_SIGNATURE; - params->v0206.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; + linux_params.v0206.efi_signature = GRUB_LINUX_EFI_SIGNATURE; + linux_params.v0206.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; } - else if (grub_le_to_cpu16 (params->version) >= 0x0204) + else if (grub_le_to_cpu16 (linux_params.version) >= 0x0204) { - params->v0204.efi_signature = GRUB_LINUX_EFI_SIGNATURE_0204; - params->v0204.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; + linux_params.v0204.efi_signature = GRUB_LINUX_EFI_SIGNATURE_0204; + linux_params.v0204.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; } #endif @@ -1012,7 +1010,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } else if (grub_memcmp (argv[i], "quiet", sizeof ("quiet") - 1) == 0) { - params->loadflags |= GRUB_LINUX_FLAG_QUIET; + linux_params.loadflags |= GRUB_LINUX_FLAG_QUIET; } /* Create kernel command line. */ From 78b7d77bcd484fa19f9a27cd814b01c31eeab5d2 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 19:07:55 +0200 Subject: [PATCH 040/187] * docs/grub-dev.texi: Rearrange menu to match the section order. Reported by: Bryan Hundven. --- ChangeLog | 5 +++++ docs/grub-dev.texi | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1372be865..c01ae94af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-14 Vladimir Serbinenko + + * docs/grub-dev.texi: Rearrange menu to match the section order. + Reported by: Bryan Hundven. + 2013-04-14 Vladimir Serbinenko * grub-core/loader/i386/linux.c: Remove useless leftover pointer. diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi index f74c96602..53f70108b 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -74,8 +74,8 @@ This edition documents version @value{VERSION}. @menu * Getting the source code:: -* Finding your way around:: * Coding style:: +* Finding your way around:: * Contributing Changes:: * Porting:: * Error Handling:: @@ -948,8 +948,8 @@ driver manager works are not included here. @menu * Video API:: -* Bitmap API:: * Example usage of Video API:: +* Bitmap API:: @end menu @node Video API From 794515225f64179398f5a6e8eb992da9349d80a8 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 19:24:05 +0200 Subject: [PATCH 041/187] Add option to compress files on install/image creation. --- ChangeLog | 4 +++ util/grub-install.in | 8 ++--- util/grub-install_header | 61 +++++++++++++++++++++++++++++++++------ util/grub-mkimage.c | 2 +- util/grub-mknetdir.in | 2 +- util/grub-mkrescue.in | 6 ++-- util/grub-mkstandalone.in | 4 +-- 7 files changed, 67 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index c01ae94af..8cbf241b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-14 Szymon Janc + + Add option to compress files on install/image creation. + 2013-04-14 Vladimir Serbinenko * docs/grub-dev.texi: Rearrange menu to match the section order. diff --git a/util/grub-install.in b/util/grub-install.in index 016b16147..32a3be361 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -684,9 +684,9 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in esac if [ x"$config_opt_file" = x ]; then - "$grub_mkimage" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $modules || exit 1 + "$grub_mkimage" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1 else - "$grub_mkimage" -c "${config_opt_file}" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $modules || exit 1 + "$grub_mkimage" -c "${config_opt_file}" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1 fi # Backward-compatibility kludges @@ -697,9 +697,9 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ] elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-efi" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "x86_64-efi" ]; then if [ x"$config_opt_file" = x ]; then - "$grub_mkimage" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $modules || exit 1 + "$grub_mkimage" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1 else - "$grub_mkimage" -c "${config_opt_file}" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $modules || exit 1 + "$grub_mkimage" -c "${config_opt_file}" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1 fi fi diff --git a/util/grub-install_header b/util/grub-install_header index 69aac467c..805fc4fd1 100644 --- a/util/grub-install_header +++ b/util/grub-install_header @@ -19,6 +19,14 @@ set -e pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst \ handler.lst video.lst crypto.lst terminal.lst" +grub_compress_file () { + if [ "$compressor" != "" ] ; then + "$compressor" $compressor_opts "$1" > "$2" + else + cp -f "$1" "$2" + fi +} + grub_install_files () { grub_install_files_source_directory="$1" grub_install_files_target_directory="$2" @@ -42,7 +50,7 @@ grub_install_files () { if [ x"$install_modules" = xall ]; then for file in "${grub_install_files_source_directory}/"*.mod; do - cp -f "$file" "${grub_install_files_target_directory}"/"${grub_install_files_platform}" + grub_compress_file "$file" "${grub_install_files_target_directory}"/"${grub_install_files_platform}/$(basename "$file")" done else modules1= @@ -56,13 +64,13 @@ grub_install_files () { modules2="$modules3" done for file in $(echo "$modules1" | sed 's, ,\n,g' |sort -u); do - cp -f "${grub_install_files_source_directory}/$file.mod" "${grub_install_files_target_directory}"/"${grub_install_files_platform}" + grub_compress_file "${grub_install_files_source_directory}/$file.mod" "${grub_install_files_target_directory}"/"${grub_install_files_platform}/$file.mod" done fi for file in ${pkglib_DATA} efiemu32.o efiemu64.o; do if test -f "${grub_install_files_source_directory}/${file}"; then - cp -f "${grub_install_files_source_directory}/${file}" "${grub_install_files_target_directory}"/"${grub_install_files_platform}" + grub_compress_file "${grub_install_files_source_directory}/${file}" "${grub_install_files_target_directory}"/"${grub_install_files_platform}/${file}" fi done @@ -78,34 +86,36 @@ grub_install_files () { if [ x"$install_locales" = xall ]; then for file in "${grub_install_files_source_directory}"/po/*.mo; do if test -f "$file"; then - cp -f "$file" "${grub_install_files_target_directory}"/locale/ + grub_compress_file "$file" "${grub_install_files_target_directory}"/locale/"$(basename "$file")" fi done for dir in "${localedir}"/*; do if test -f "$dir/LC_MESSAGES/@PACKAGE@.mo" && ! test -f "${grub_install_files_target_directory}"/locale/"${dir##*/}.mo"; then - cp -f "$dir/LC_MESSAGES/@PACKAGE@.mo" "${grub_install_files_target_directory}"/locale/"${dir##*/}.mo" + grub_compress_file "$dir/LC_MESSAGES/@PACKAGE@.mo" "${grub_install_files_target_directory}"/locale/"${dir##*/}.mo" fi done else for locale in $install_locales; do if test -f "${grub_install_files_source_directory}"/po/$locale.mo; then - cp -f " "${grub_install_files_source_directory}"/po/$locale.mo" "${grub_install_files_target_directory}"/locale/$locale.mo + grub_compress_file "${grub_install_files_source_directory}"/po/locale.mo "${grub_install_files_target_directory}"/locale/$locale.mo elif test -f "${localedir}/$locale/LC_MESSAGES/@PACKAGE@.mo"; then - cp -f "${localedir}/$locale/LC_MESSAGES/@PACKAGE@.mo" "${grub_install_files_target_directory}"/locale/$locale.mo + grub_compress_file "${localedir}/$locale/LC_MESSAGES/@PACKAGE@.mo" "${grub_install_files_target_directory}"/locale/$locale.mo fi done fi for theme in ${install_themes} ; do if test -f "${pkgdatadir}"/themes/"${theme}"/theme.txt; then mkdir -p "${grub_install_files_target_directory}"/themes/"${theme}" - cp "${pkgdatadir}"/themes/"${theme}"/* "${grub_install_files_target_directory}"/themes/"${theme}" + for file in "${pkgdatadir}"/themes/"${theme}"/*; do + grub_compress_file "$file" "${grub_install_files_target_directory}"/themes/"${theme}"/"$(basename "$file")" + done fi done for font in ${install_fonts} ; do if test -f "${pkgdatadir}"/"$font".pf2; then mkdir -p "${grub_install_files_target_directory}"/fonts - cp "${pkgdatadir}"/"$font".pf2 "${grub_install_files_target_directory}"/fonts + grub_compress_file "${pkgdatadir}"/"$font".pf2 "${grub_install_files_target_directory}"/fonts/"$font".pf2 fi done } @@ -115,12 +125,17 @@ grub_print_install_files_help () { print_option_help "--themes=THEMES" "$(gettext_printf "install THEMES [default=%s]" "starfield")" print_option_help "--fonts=FONTS" "$(gettext_printf "install FONTS [default=%s]" "unicode")" print_option_help "--locales=LOCALES" "$(gettext_printf "install only LOCALES [default=all]")" + print_option_help "--compress[=no,xz,gz,lzo]" "$(gettext "compress GRUB files [optional]")" } install_modules=all install_themes=starfield install_fonts=unicode install_locales=all +compress=no +grub_decompression_module="" +compressor="" +compressor_opts="" argument () { opt=$1 @@ -133,6 +148,29 @@ argument () { echo $1 } +grub_parse_compress () { + compress="$1" + case x"$compress" in + xno) ;; + xgz) + compressor=`which gzip || true` + grub_decompression_module="gzio" + compressor_opts="--best --stdout";; + xxz) + compressor=`which xz || true` + grub_decompression_module="xzio gcry_crc" + compressor_opts="--lzma2=dict=128KiB --check=none --stdout";; + xlzo) + compressor=`which lzop || true` + grub_decompression_module="lzopio adler32 gcry_crc" + compressor_opts="-9 -c";; + *) + gettext_printf "Unrecognized compression \`%s'\n" "$compress" 1>&2 + usage + exit 1 + esac +} + grub_process_install_options () { option=$1 shift @@ -156,6 +194,11 @@ grub_process_install_options () { install_locales=`argument $option "$@"`; grub_process_install_options_consumed=2; return ;; --locales=*) install_locales=`echo "$option" | sed 's/--locales=//'`; grub_process_install_options_consumed=1; return ;; + --compress) + grub_parse_compress `argument $option "$@"`; grub_process_install_options_consumed=2; return ;; + --compress=*) + grub_parse_compress `echo "${option}" | sed 's/--compress=//'`; grub_process_install_options_consumed=1; return ;; esac } +export grub_decompression_module diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index 96279a435..0acc61ee4 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -1740,7 +1740,7 @@ static struct argp_option options[] = { {"note", 'n', 0, 0, N_("add NOTE segment for CHRP IEEE1275"), 0}, {"output", 'o', N_("FILE"), 0, N_("output a generated image to FILE [default=stdout]"), 0}, {"format", 'O', N_("FORMAT"), 0, 0, 0}, - {"compression", 'C', "(xz|none|auto)", 0, N_("choose the compression to use"), 0}, + {"compression", 'C', "(xz|none|auto)", 0, N_("choose the compression to use for core image"), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, { 0, 0, 0, 0, 0, 0 } }; diff --git a/util/grub-mknetdir.in b/util/grub-mknetdir.in index 6df761a38..d32de462e 100644 --- a/util/grub-mknetdir.in +++ b/util/grub-mknetdir.in @@ -191,7 +191,7 @@ process_input_dir () source ${subdir}/grub.cfg EOF - "$grub_mkimage" ${config_opt} -d "${input_dir}" -O ${mkimage_target} "--output=${grubdir}/core.$ext" "--prefix=$prefix" $modules $netmodules tftp || exit 1 + "$grub_mkimage" ${config_opt} -d "${input_dir}" -O ${mkimage_target} "--output=${grubdir}/core.$ext" "--prefix=$prefix" $modules $grub_decompression_module $netmodules tftp || exit 1 # TRANSLATORS: First %s is replaced by platform name. Second one by filename. gettext_printf "Netboot directory for %s created. Configure your DHCP server to point to %s\n" "${platform}" "${subdir}/${platform}/core.$ext" } diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index b97d674b6..7270d7f60 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -248,7 +248,7 @@ EOF done ; ) > "${load_cfg}" "$grub_mkimage" -O ${platform} -d "${source_directory}" -c "${load_cfg}" -o "$3" \ - search iso9660 $4 + $grub_decompression_module search iso9660 $4 rm -rf "${load_cfg}" } @@ -263,7 +263,7 @@ make_image_fwdisk () gettext_printf "Enabling %s support ...\n" "$2" "$grub_mkimage" -O ${platform} -d "${source_directory}" -p '()/boot/grub' -o "$3" \ - iso9660 $4 + $grub_decompression_module iso9660 $4 } if [ "${override_dir}" = "" ] ; then @@ -362,7 +362,7 @@ if test -e "${pc_dir}" ; then done ;) > "${load_cfg}" "$grub_mkimage" -O i386-pc -d "${pc_dir}/" -o "${core_img}" -c "$load_cfg" --prefix=/boot/grub \ - iso9660 biosdisk + $grub_decompression_module iso9660 biosdisk cat "${pc_dir}/cdboot.img" "${core_img}" > "${iso9660_dir}/boot/grub/i386-pc/eltorito.img" grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table" diff --git a/util/grub-mkstandalone.in b/util/grub-mkstandalone.in index a5434c4ac..927075be6 100644 --- a/util/grub-mkstandalone.in +++ b/util/grub-mkstandalone.in @@ -60,7 +60,7 @@ usage () { print_option_help "-O, --format=$(gettext "FORMAT")" "$(gettext "generate an image in FORMAT")"; echo print_option_help "" "$(gettext "available formats:") $formats" echo - print_option_help "-C, --compression=(xz|none|auto)" "$(gettext "choose the compression to use")" + print_option_help "-C, --compression=(xz|none|auto)" "$(gettext "choose the compression to use for core image")" print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" grub_print_install_files_help print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" @@ -170,7 +170,7 @@ memdisk_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 (cd "${memdisk_dir}"; tar -cf - * $source) > "${memdisk_img}" rm -rf "${memdisk_dir}" -"$grub_mkimage" -O "${format}" -C "$compression" -d "${source_directory}" -m "${memdisk_img}" -o "$output_image" --prefix='(memdisk)/boot/grub' memdisk tar $modules +"$grub_mkimage" -O "${format}" -C "$compression" -d "${source_directory}" -m "${memdisk_img}" -o "$output_image" --prefix='(memdisk)/boot/grub' memdisk tar $grub_decompression_module $modules rm -rf "${memdisk_img}" exit 0 From 25092d29224f8e21ad57512f2787b63ef04bf7b4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 14 Apr 2013 19:57:15 +0200 Subject: [PATCH 042/187] * grub-core/lib/posix_wrap/sys/types.h: Make WORDS_BIGENDIAN definition match config-util.h to avoid warnings and increase compatibility. --- ChangeLog | 6 ++++++ grub-core/lib/posix_wrap/sys/types.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8cbf241b9..a4d955592 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ +2013-04-14 Vladimir Serbinenko + + * grub-core/lib/posix_wrap/sys/types.h: Make WORDS_BIGENDIAN definition + match config-util.h to avoid warnings and increase compatibility. + 2013-04-14 Szymon Janc +2013-04-14 Vladimir Serbinenko Add option to compress files on install/image creation. diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h index c88a96ee5..6485a9a35 100644 --- a/grub-core/lib/posix_wrap/sys/types.h +++ b/grub-core/lib/posix_wrap/sys/types.h @@ -60,7 +60,7 @@ typedef grub_addr_t uintptr_t; #define SIZEOF_UINT64_T 8 #ifdef GRUB_CPU_WORDS_BIGENDIAN -#define WORDS_BIGENDIAN +#define WORDS_BIGENDIAN 1 #else #undef WORDS_BIGENDIAN #endif From 21aecce0f98ae1d27d569c2f8c643e471c0375a1 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 15 Apr 2013 00:38:39 +0200 Subject: [PATCH 043/187] * grub-core/disk/ieee1275/ofdisk.c: Fix CD-ROM and boot device detection. --- ChangeLog | 5 +++++ grub-core/disk/ieee1275/ofdisk.c | 21 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4d955592..b37266844 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-15 Vladimir Serbinenko + + * grub-core/disk/ieee1275/ofdisk.c: Fix CD-ROM and boot device + detection. + 2013-04-14 Vladimir Serbinenko * grub-core/lib/posix_wrap/sys/types.h: Make WORDS_BIGENDIAN definition diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c index bebf777ac..ec92c4d10 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -32,6 +32,7 @@ struct ofdisk_hash_ent { char *devpath; int is_boot; + int is_cdrom; /* Pointer to shortest available name on nodes representing canonical names, otherwise NULL. */ const char *shortest; @@ -80,6 +81,18 @@ ofdisk_hash_add_real (char *devpath) return p; } +static int +check_string_cdrom (const char *str) +{ + const char *ptr = grub_strrchr (str, '/'); + + if (ptr) + ptr++; + else + ptr = str; + return (grub_strncmp (ptr, "cdrom", 5) == 0); +} + static struct ofdisk_hash_ent * ofdisk_hash_add (char *devpath, char *curcan) { @@ -92,6 +105,8 @@ ofdisk_hash_add (char *devpath, char *curcan) if (!curcan) { p->shortest = devpath; + if (check_string_cdrom (devpath)) + p->is_cdrom = 1; return p; } @@ -101,6 +116,9 @@ ofdisk_hash_add (char *devpath, char *curcan) else grub_free (curcan); + if (check_string_cdrom (devpath) || check_string_cdrom (curcan)) + pcan->is_cdrom = 1; + if (!pcan) grub_errno = GRUB_ERR_NONE; else @@ -267,8 +285,7 @@ grub_ofdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, } } - if (grub_strncmp (ent->shortest, "cdrom", 5) == 0 - || ent->is_boot) + if (!ent->is_boot && ent->is_cdrom) continue; { From cbe57a487bad858471a2f6ed43b2186bd8b0a77a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 15 Apr 2013 00:40:19 +0200 Subject: [PATCH 044/187] * grub-core/kern/ieee1275/openfw.c (grub_ieee1275_devalias_next): Make source and destination differ. --- ChangeLog | 5 +++++ grub-core/kern/ieee1275/openfw.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b37266844..74690301f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-15 Vladimir Serbinenko + + * grub-core/kern/ieee1275/openfw.c (grub_ieee1275_devalias_next): Make + source and destination differ. + 2013-04-15 Vladimir Serbinenko * grub-core/disk/ieee1275/ofdisk.c: Fix CD-ROM and boot device diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c index 90c092c72..07c90f7cb 100644 --- a/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c @@ -193,18 +193,22 @@ grub_ieee1275_devalias_next (struct grub_ieee1275_devalias *alias) { grub_ssize_t pathlen; grub_ssize_t actual; + char *tmp; if (alias->path) { grub_free (alias->path); alias->path = 0; } - if (grub_ieee1275_next_property (alias->parent_dev, alias->name, + tmp = grub_strdup (alias->name); + if (grub_ieee1275_next_property (alias->parent_dev, tmp, alias->name) <= 0) { + grub_free (tmp); grub_ieee1275_devalias_free (alias); return 0; } + grub_free (tmp); grub_dprintf ("devalias", "devalias name = %s\n", alias->name); From fa7d914e6cebc52d702a84fd4896954d401ad6f6 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 15 Apr 2013 01:53:33 +0200 Subject: [PATCH 045/187] * tests/grub_script_expansion.in: Use fixed-string grep to skip over firmware error messages. --- ChangeLog | 5 +++++ tests/grub_script_expansion.in | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74690301f..139120288 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-15 Vladimir Serbinenko + + * tests/grub_script_expansion.in: Use fixed-string grep to skip over + firmware error messages. + 2013-04-15 Vladimir Serbinenko * grub-core/kern/ieee1275/openfw.c (grub_ieee1275_devalias_next): Make diff --git a/tests/grub_script_expansion.in b/tests/grub_script_expansion.in index 03dc510a2..e46401c4c 100644 --- a/tests/grub_script_expansion.in +++ b/tests/grub_script_expansion.in @@ -21,12 +21,12 @@ disks=`echo ls | @builddir@/grub-shell| grep -av '^Network protocols:$'| grep -a other=`echo insmod regexp\; echo \* | @builddir@/grub-shell` for d in $disks; do if echo "$d" |grep ',' >/dev/null; then - if echo "$other" | grep "$d" >/dev/null; then + if echo "$other" | grep -F -- "$d" >/dev/null; then echo "$d should not occur in * expansion" >&2 exit 1 fi else - if ! echo "$other" | grep "$d" >/dev/null; then + if ! echo "$other" | grep -F -- "$d" >/dev/null; then echo "$d missing from * expansion" >&2 exit 1 fi @@ -35,7 +35,7 @@ done other=`echo insmod regexp\; echo '(*)' | @builddir@/grub-shell` for d in $disks; do - if ! echo "$other" | grep -F "$d" >/dev/null; then + if ! echo "$other" | grep -F -- "$d" >/dev/null; then echo "$d missing from (*) expansion" >&2 exit 1 fi From 88017d47a9741b9e9ce50b1c222ad2ee5ecd016f Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 15 Apr 2013 01:54:23 +0200 Subject: [PATCH 046/187] * tests/grub_cmd_date.in: Skip on sparc64. --- ChangeLog | 4 ++++ tests/grub_cmd_date.in | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 139120288..db6076cfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-15 Vladimir Serbinenko + + * tests/grub_cmd_date.in: Skip on sparc64. + 2013-04-15 Vladimir Serbinenko * tests/grub_script_expansion.in: Use fixed-string grep to skip over diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in index 254fb91ea..76436a016 100644 --- a/tests/grub_cmd_date.in +++ b/tests/grub_cmd_date.in @@ -1,6 +1,13 @@ #! /bin/bash set -e +. "@builddir@/grub-core/modinfo.sh" + +# OpenBIOS on sparc64 doesn't implement RTC +if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then + exit 0 +fi + pdt="$(date -u +%s)" dt=`echo date | @builddir@/grub-shell` dtg="$(date -u -d "$dt" +%s)" From 25fc51a87929262c1cc132bc29cc083ce98f0e0e Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 15 Apr 2013 08:37:13 +0200 Subject: [PATCH 047/187] Fix DMRAID partition handling. --- ChangeLog | 4 ++++ util/getroot.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index db6076cfd..2dcf1f514 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-15 Vladimir Serbinenko + + Fix DMRAID partition handling. + 2013-04-15 Vladimir Serbinenko * tests/grub_cmd_date.in: Skip on sparc64. diff --git a/util/getroot.c b/util/getroot.c index 4ea8e65c9..ecf7ce199 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -1956,6 +1956,7 @@ convert_system_partition_to_system_disk (const char *os_dev, struct stat *st, grub_util_info ("dm_tree_find_node failed"); goto devmapper_out; } + reiterate: node_uuid = dm_tree_node_get_uuid (node); if (! node_uuid) { @@ -2030,6 +2031,9 @@ convert_system_partition_to_system_disk (const char *os_dev, struct stat *st, goto devmapper_out; } mapper_name = child_name; + *is_part = 1; + node = child; + goto reiterate; devmapper_out: if (! mapper_name && node) From a7e03923fa66e46cadf612aa71fe0b01a4346bb9 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 15 Apr 2013 09:12:14 +0200 Subject: [PATCH 048/187] * grub-core/disk/efi/efidisk.c: Limit disk read or write chunk to 0x500 sectors. Based on patch by Peter Jones. --- ChangeLog | 7 +++++ grub-core/disk/efi/efidisk.c | 50 ++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2dcf1f514..6f33ff12a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-04-15 Vladimir Serbinenko +2013-04-15 Peter Jones + + * grub-core/disk/efi/efidisk.c: Limit disk read or write chunk to 0x500 + sectors. + Based on patch by Peter Jones. + 2013-04-15 Vladimir Serbinenko Fix DMRAID partition handling. diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 28b9fa1df..5a6fc630a 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -528,9 +528,9 @@ grub_efidisk_close (struct grub_disk *disk __attribute__ ((unused))) grub_dprintf ("efidisk", "closing %s\n", disk->name); } -static grub_err_t -grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector, - grub_size_t size, char *buf) +static grub_efi_status_t +grub_efidisk_readwrite (struct grub_disk *disk, grub_disk_addr_t sector, + grub_size_t size, char *buf, int wr) { /* For now, use the disk io interface rather than the block io's. */ struct grub_efidisk_data *d; @@ -540,14 +540,38 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector, d = disk->data; bio = d->block_io; + while (size > 0) + { + grub_size_t len; + len = 0x500; + if (len > size) + len = size; + status = efi_call_5 ((wr ? bio->write_blocks : bio->read_blocks), bio, + bio->media->media_id, + (grub_efi_uint64_t) sector, + (grub_efi_uintn_t) size << disk->log_sector_size, + buf); + size -= len; + buf += len << disk->log_sector_size; + sector += len; + if (status != GRUB_EFI_SUCCESS) + return status; + } + return GRUB_EFI_SUCCESS; +} + +static grub_err_t +grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector, + grub_size_t size, char *buf) +{ + grub_efi_status_t status; + grub_dprintf ("efidisk", "reading 0x%lx sectors at the sector 0x%llx from %s\n", (unsigned long) size, (unsigned long long) sector, disk->name); - status = efi_call_5 (bio->read_blocks, bio, bio->media->media_id, - (grub_efi_uint64_t) sector, - (grub_efi_uintn_t) size << disk->log_sector_size, - buf); + status = grub_efidisk_readwrite (disk, sector, size, buf, 0); + if (status != GRUB_EFI_SUCCESS) return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector 0x%llx from `%s'"), @@ -561,22 +585,14 @@ static grub_err_t grub_efidisk_write (struct grub_disk *disk, grub_disk_addr_t sector, grub_size_t size, const char *buf) { - /* For now, use the disk io interface rather than the block io's. */ - struct grub_efidisk_data *d; - grub_efi_block_io_t *bio; grub_efi_status_t status; - d = disk->data; - bio = d->block_io; - grub_dprintf ("efidisk", "writing 0x%lx sectors at the sector 0x%llx to %s\n", (unsigned long) size, (unsigned long long) sector, disk->name); - status = efi_call_5 (bio->write_blocks, bio, bio->media->media_id, - (grub_efi_uint64_t) sector, - (grub_efi_uintn_t) size << disk->log_sector_size, - (void *) buf); + status = grub_efidisk_readwrite (disk, sector, size, (char *) buf, 1); + if (status != GRUB_EFI_SUCCESS) return grub_error (GRUB_ERR_WRITE_ERROR, N_("failure writing sector 0x%llx to `%s'"), From 740201f3ab787114ac5a49f36f5deabdc8677d51 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Tue, 16 Apr 2013 16:18:12 +0200 Subject: [PATCH 049/187] * autogen.sh: Use "-f" in addition for "-h" when checking file presence. --- ChangeLog | 4 ++++ autogen.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6f33ff12a..10db262af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-16 Andrey Borzenkov + + * autogen.sh: Use "-f" in addition for "-h" when checking file presence. + 2013-04-15 Vladimir Serbinenko 2013-04-15 Peter Jones diff --git a/autogen.sh b/autogen.sh index d47650b9b..48d7a6e82 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,7 +24,7 @@ ln -s ../../../grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10 cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul3.c mpih-lshift.c mpih-rshift.c; do - if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then + if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then rm grub-core/lib/libgcrypt-grub/mpi/"$x" fi ln -s generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x" From 284df0e263d35c58e90dc067f809af94a75643d3 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Tue, 16 Apr 2013 22:10:59 +0200 Subject: [PATCH 050/187] * grub-core/disk/efi/efidisk.c: Really limit transfer chunk size. --- ChangeLog | 4 ++++ grub-core/disk/efi/efidisk.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 10db262af..b60a71d83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-16 Andrey Borzenkov + + * grub-core/disk/efi/efidisk.c: Really limit transfer chunk size. + 2013-04-16 Andrey Borzenkov * autogen.sh: Use "-f" in addition for "-h" when checking file presence. diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 5a6fc630a..0e08d3bec 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -549,7 +549,7 @@ grub_efidisk_readwrite (struct grub_disk *disk, grub_disk_addr_t sector, status = efi_call_5 ((wr ? bio->write_blocks : bio->read_blocks), bio, bio->media->media_id, (grub_efi_uint64_t) sector, - (grub_efi_uintn_t) size << disk->log_sector_size, + (grub_efi_uintn_t) len << disk->log_sector_size, buf); size -= len; buf += len << disk->log_sector_size; From a0f8f3acf1d1150b9e97e02465487fe75c79f5cd Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 17 Apr 2013 07:00:37 +0200 Subject: [PATCH 051/187] * build-aux/snippet: Add missing gnulib files. --- ChangeLog | 4 + build-aux/snippet/_Noreturn.h | 10 ++ build-aux/snippet/arg-nonnull.h | 26 +++ build-aux/snippet/c++defs.h | 271 ++++++++++++++++++++++++++++++++ build-aux/snippet/warn-on-use.h | 109 +++++++++++++ 5 files changed, 420 insertions(+) create mode 100644 build-aux/snippet/_Noreturn.h create mode 100644 build-aux/snippet/arg-nonnull.h create mode 100644 build-aux/snippet/c++defs.h create mode 100644 build-aux/snippet/warn-on-use.h diff --git a/ChangeLog b/ChangeLog index b60a71d83..073207a26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-17 Vladimir Serbinenko + + * build-aux/snippet: Add missing gnulib files. + 2013-04-16 Andrey Borzenkov * grub-core/disk/efi/efidisk.c: Really limit transfer chunk size. diff --git a/build-aux/snippet/_Noreturn.h b/build-aux/snippet/_Noreturn.h new file mode 100644 index 000000000..c44ad89b7 --- /dev/null +++ b/build-aux/snippet/_Noreturn.h @@ -0,0 +1,10 @@ +#if !defined _Noreturn && __STDC_VERSION__ < 201112 +# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif diff --git a/build-aux/snippet/arg-nonnull.h b/build-aux/snippet/arg-nonnull.h new file mode 100644 index 000000000..8ea2a4747 --- /dev/null +++ b/build-aux/snippet/arg-nonnull.h @@ -0,0 +1,26 @@ +/* A C macro for declaring that specific arguments must not be NULL. + Copyright (C) 2009-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools + that the values passed as arguments n, ..., m must be non-NULL pointers. + n = 1 stands for the first argument, n = 2 for the second argument etc. */ +#ifndef _GL_ARG_NONNULL +# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 +# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) +# else +# define _GL_ARG_NONNULL(params) +# endif +#endif diff --git a/build-aux/snippet/c++defs.h b/build-aux/snippet/c++defs.h new file mode 100644 index 000000000..b35b933cd --- /dev/null +++ b/build-aux/snippet/c++defs.h @@ -0,0 +1,271 @@ +/* C++ compatible function declaration macros. + Copyright (C) 2010-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _GL_CXXDEFS_H +#define _GL_CXXDEFS_H + +/* The three most frequent use cases of these macros are: + + * For providing a substitute for a function that is missing on some + platforms, but is declared and works fine on the platforms on which + it exists: + + #if @GNULIB_FOO@ + # if !@HAVE_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on all platforms, + but is broken/insufficient and needs to be replaced on some platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on some platforms + but is broken/insufficient and needs to be replaced on some of them and + is additionally either missing or undeclared on some other platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif +*/ + +/* _GL_EXTERN_C declaration; + performs the declaration with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C extern "C" +#else +# define _GL_EXTERN_C extern +#endif + +/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); + declares a replacement function, named rpl_func, with the given prototype, + consisting of return type, parameters, and attributes. + Example: + _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); + */ +#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ + _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) +#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C rettype rpl_func parameters_and_attributes + +/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); + declares the system function, named func, with the given prototype, + consisting of return type, parameters, and attributes. + Example: + _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); + */ +#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C rettype func parameters_and_attributes + +/* _GL_CXXALIAS_RPL (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to rpl_func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); + */ +#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + rettype (*const func) parameters = ::rpl_func; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the "invalid conversion" error + that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + rettype (*const func) parameters = \ + reinterpret_cast(::rpl_func); \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to the system provided function func, if GNULIB_NAMESPACE + is defined. + Example: + _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); + */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* If we were to write + rettype (*const func) parameters = ::func; + like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls + better (remove an indirection through a 'static' pointer variable), + but then the _GL_CXXALIASWARN macro below would cause a warning not only + for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static rettype (*func) parameters = ::func; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static rettype (*func) parameters = \ + reinterpret_cast(::func); \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function is picked among a set of overloaded functions, + namely the one with rettype2 and parameters2. Two consecutive casts + are used to silence the "cannot find a match" and "invalid conversion" + errors that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* The outer cast must be a reinterpret_cast. + The inner cast: When the function is defined as a set of overloaded + functions, it works as a static_cast<>, choosing the designated variant. + When the function is defined as a single variant, it works as a + reinterpret_cast<>. The parenthesized cast syntax works both ways. */ +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + namespace GNULIB_NAMESPACE \ + { \ + static rettype (*func) parameters = \ + reinterpret_cast( \ + (rettype2(*)parameters2)(::func)); \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN (func); + causes a warning to be emitted when ::func is used but not when + GNULIB_NAMESPACE::func is used. func must be defined without overloaded + variants. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN(func) \ + _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN_1(func,namespace) \ + _GL_CXXALIASWARN_2 (func, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !__OPTIMIZE__ +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_WARN_ON_USE (func, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN_2(func,namespace) \ + extern __typeof__ (func) func +# else +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN(func) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); + causes a warning to be emitted when the given overloaded variant of ::func + is used but not when GNULIB_NAMESPACE::func is used. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ + GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ + _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !__OPTIMIZE__ +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + extern __typeof__ (func) func +# else +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +#endif /* _GL_CXXDEFS_H */ diff --git a/build-aux/snippet/warn-on-use.h b/build-aux/snippet/warn-on-use.h new file mode 100644 index 000000000..1736a1bd7 --- /dev/null +++ b/build-aux/snippet/warn-on-use.h @@ -0,0 +1,109 @@ +/* A C macro for emitting warnings if a function is used. + Copyright (C) 2010-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* _GL_WARN_ON_USE (function, "literal string") issues a declaration + for FUNCTION which will then trigger a compiler warning containing + the text of "literal string" anywhere that function is called, if + supported by the compiler. If the compiler does not support this + feature, the macro expands to an unused extern declaration. + + This macro is useful for marking a function as a potential + portability trap, with the intent that "literal string" include + instructions on the replacement function that should be used + instead. However, one of the reasons that a function is a + portability trap is if it has the wrong signature. Declaring + FUNCTION with a different signature in C is a compilation error, so + this macro must use the same type as any existing declaration so + that programs that avoid the problematic FUNCTION do not fail to + compile merely because they included a header that poisoned the + function. But this implies that _GL_WARN_ON_USE is only safe to + use if FUNCTION is known to already have a declaration. Use of + this macro implies that there must not be any other macro hiding + the declaration of FUNCTION; but undefining FUNCTION first is part + of the poisoning process anyway (although for symbols that are + provided only via a macro, the result is a compilation error rather + than a warning containing "literal string"). Also note that in + C++, it is only safe to use if FUNCTION has no overloads. + + For an example, it is possible to poison 'getline' by: + - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], + [getline]) in configure.ac, which potentially defines + HAVE_RAW_DECL_GETLINE + - adding this code to a header that wraps the system : + #undef getline + #if HAVE_RAW_DECL_GETLINE + _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" + "not universally present; use the gnulib module getline"); + #endif + + It is not possible to directly poison global variables. But it is + possible to write a wrapper accessor function, and poison that + (less common usage, like &environ, will cause a compilation error + rather than issue the nice warning, but the end result of informing + the developer about their portability problem is still achieved): + #if HAVE_RAW_DECL_ENVIRON + static char ***rpl_environ (void) { return &environ; } + _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); + # undef environ + # define environ (*rpl_environ ()) + #endif + */ +#ifndef _GL_WARN_ON_USE + +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function __attribute__ ((__warning__ (message))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function +# else /* Unsupported. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +#endif + +/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") + is like _GL_WARN_ON_USE (function, "string"), except that the function is + declared with the given prototype, consisting of return type, parameters, + and attributes. + This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does + not work in this case. */ +#ifndef _GL_WARN_ON_USE_CXX +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes \ + __attribute__ ((__warning__ (msg))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes +# else /* Unsupported. */ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +#endif + +/* _GL_WARN_EXTERN_C declaration; + performs the declaration with C linkage. */ +#ifndef _GL_WARN_EXTERN_C +# if defined __cplusplus +# define _GL_WARN_EXTERN_C extern "C" +# else +# define _GL_WARN_EXTERN_C extern +# endif +#endif From b193e10034a9aa0f108db092c997cbfde8e49cc8 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 17 Apr 2013 19:05:57 +0200 Subject: [PATCH 052/187] * grub-core/disk/efi/efidisk.c: Detect floppies by ACPI ID. It improves performance in qemu. --- ChangeLog | 5 +++++ grub-core/disk/efi/efidisk.c | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 073207a26..9d77a7fa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-17 Vladimir Serbinenko + + * grub-core/disk/efi/efidisk.c: Detect floppies by ACPI ID. + It improves performance in qemu. + 2013-04-17 Vladimir Serbinenko * build-aux/snippet: Add missing gnulib files. diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 0e08d3bec..e168d07fa 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -329,18 +329,28 @@ name_devices (struct grub_efidisk_data *devices) { grub_efi_device_path_t *dp; grub_efi_block_io_media_t *m; + int is_floppy = 0; dp = d->last_device_path; if (! dp) continue; m = d->block_io->media; - if (m->logical_partition) + if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_ACPI_DEVICE_PATH_TYPE + && GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) + == GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE) + { + grub_efi_acpi_device_path_t *acpi + = (grub_efi_acpi_device_path_t *) dp; + /* Floppy EISA ID. */ + if (acpi->hid == 0x60441d0 || acpi->hid == 0x70041d0 + || acpi->hid == 0x70141d1) + is_floppy = 1; + } + if (is_floppy) { - /* Only one partition in a non-media device. Assume that this - is a floppy drive. */ #ifdef DEBUG_NAMES - grub_printf ("adding a floppy by guessing: "); + grub_printf ("adding a floppy: "); grub_efi_print_device_path (d->device_path); #endif add_device (&fd_devices, d); From d0d2daa66153c35315c3a9f4c9084a6fc5a1de2b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 17 Apr 2013 19:08:31 +0200 Subject: [PATCH 053/187] * util/grub-mkrescue.in: Add GPT for EFI boot. --- ChangeLog | 4 ++++ util/grub-mkrescue.in | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d77a7fa8..eb92ae4a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-17 Vladimir Serbinenko + + * util/grub-mkrescue.in: Add GPT for EFI boot. + 2013-04-17 Vladimir Serbinenko * grub-core/disk/efi/efidisk.c: Detect floppies by ACPI ID. diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 7270d7f60..c3ed39be9 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -421,7 +421,7 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; th mformat -C -f 2880 -L 16 -i "${iso9660_dir}"/efi.img :: mcopy -s -i "${iso9660_dir}"/efi.img ${efi_dir}/efi ::/ rm -rf ${efi_dir} - grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img" + grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img -efi-boot-part --efi-boot-image" fi make_image_fwdisk "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" "" @@ -443,7 +443,7 @@ EOF "$grub_render_label" -f "$label_font" -b "$label_bgcolor" -c "$label_color" -t "${product_name} ${product_version}" -o "${iso9660_dir}/System/Library/CoreServices/.disk_label" echo "${product_name} ${product_version}" > "${iso9660_dir}/System/Library/CoreServices/.disk_label.contentDetails" if [ "$system_area" = common ]; then - grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label" + grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -apm-block-size 2048 -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label" fi fi From daaa64bd9026d024934a9d62497423f69a70ad09 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 19 Apr 2013 00:36:23 +0200 Subject: [PATCH 054/187] Add support for pseries and other bootinfo machines to grub-mkrescue. Tested by: Paulo Flabiano Smorigo. --- ChangeLog | 6 +++ grub-core/Makefile.core.def | 8 +++ grub-core/boot/powerpc/bootinfo.txt.in | 73 ++++++++++++++++++++++++++ util/grub-mkrescue.in | 2 + 4 files changed, 89 insertions(+) create mode 100644 grub-core/boot/powerpc/bootinfo.txt.in diff --git a/ChangeLog b/ChangeLog index eb92ae4a3..f1750b029 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-19 Vladimir Serbinenko + + Add support for pseries and other bootinfo machines to grub-mkrescue. + + Tested by: Paulo Flabiano Smorigo. + 2013-04-17 Vladimir Serbinenko * util/grub-mkrescue.in: Add GPT for EFI boot. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 459e56645..43c4cb6d5 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -34,6 +34,14 @@ script = { installdir = platform; name = grub.chrp; common = boot/powerpc/grub.chrp.in; + enable = powerpc_ieee1275; +}; + +script = { + installdir = platform; + name = bootinfo.txt; + common = boot/powerpc/bootinfo.txt.in; + enable = powerpc_ieee1275; }; kernel = { diff --git a/grub-core/boot/powerpc/bootinfo.txt.in b/grub-core/boot/powerpc/bootinfo.txt.in new file mode 100644 index 000000000..8d6b3b006 --- /dev/null +++ b/grub-core/boot/powerpc/bootinfo.txt.in @@ -0,0 +1,73 @@ + +@PACKAGE@ @VERSION@ +@PACKAGE@ @VERSION@ +boot &device;:\boot\powerpc.elf + + +FF FF FF FF FF FF FF FF FF FF 92 6D 6D 6D 6D 6D 6D 6D 6D 6D DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6 92 6D 92 92 92 DB FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF DB 6D 92 DB FF FF FF FF FF DB B6 FF FF 92 6D FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 92 DB FF FF FF FF FF B6 6D 92 DB FF FF FF FF FF FF FF +FF FF FF FF FF FF 49 92 FF FF B6 B6 24 00 24 00 00 00 00 49 6D DB 6D 92 DB B6 DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6 6D DB 92 6D 24 49 92 6D 6D FF FF FF 92 6D FF FF FF FF FF FF +FF FF FF FF B6 49 DB FF FF 24 00 00 00 92 92 B6 FF DB DB FF DB B6 FF DB 92 49 DB FF FF FF FF FF FF FF FF FF FF FF FF FF DB 49 6D B6 FF 6D B6 6D 6D 92 24 24 00 00 24 6D FF FF 49 DB FF FF FF FF +FF FF FF B6 49 FF DB 49 24 00 49 6D B6 FF B6 92 6D 6D 6D 92 DB DB DB B6 6D 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 6D DB FF FF FF FF DB B6 B6 B6 FF DB 24 00 00 92 B6 FF 49 FF FF FF FF +FF FF DB 49 FF FF 49 00 00 24 FF FF 6D 49 92 DB FF FF FF DB 92 92 92 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 92 92 6D 6D B6 DB DB B6 6D 6D FF FF 24 00 00 DB FF 49 FF FF FF +FF FF 49 FF FF 49 00 00 6D DB DB 49 DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 B6 B6 24 00 24 DB DB 6D FF FF +FF B6 92 FF B6 00 00 24 FF DB 6D FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 B6 FF 00 00 49 FF 92 B6 FF +FF 6D FF FF 92 00 00 49 FF 6D FF FF FF FF FF FF FF FF FF FF FF FF FF B6 92 92 6D 6D 6D 6D DB FF FF FF FF FF FF B6 92 92 92 92 92 FF FF FF FF FF FF FF FF FF FF FF FF 6D FF 24 00 24 FF FF 6D FF +DB 92 FF DB 00 00 49 FF 92 DB FF FF FF FF FF FF FF FF FF FF FF DB 6D B6 FF FF FF FF FF FF 92 6D FF FF FF FF 6D B6 FF FF FF FF FF B6 B6 FF FF FF FF FF FF FF FF FF FF FF 92 DB 00 00 92 FF 92 DB +92 FF FF B6 00 00 6D FF 6D FF FF FF FF FF FF FF FF FF FF FF DB 6D FF FF FF 92 49 49 49 92 FF FF 49 DB DB 24 DB FF B6 49 49 92 FF FF DB 92 FF FF FF FF FF FF FF FF FF FF 92 FF 00 00 6D FF DB 92 +6D FF FF FF 00 00 49 92 DB FF FF FF FF FF FF FF FF FF FF DB 6D FF FF 6D 00 00 00 00 00 00 00 B6 FF 49 00 24 24 49 24 00 00 00 00 6D FF DB 92 FF FF FF FF FF FF FF FF FF DB B6 00 00 92 FF FF 6D +6D FF FF 24 00 00 DB 6D FF FF FF FF FF FF FF FF FF FF DB 6D FF DB 00 00 00 00 00 00 00 00 00 00 B6 FF DB B6 49 92 24 24 00 00 00 00 24 FF DB 92 FF FF FF FF FF FF FF FF FF 92 6D 00 00 DB FF 6D +6D FF FF 24 00 00 FF 6D FF FF FF FF FF FF FF FF FF FF 49 FF B6 00 00 00 00 00 00 00 00 00 00 00 00 92 FF FF 92 DB DB 24 24 00 00 00 00 24 FF 92 DB FF FF FF FF FF FF FF FF 92 92 00 00 FF FF 6D +6D FF FF B6 00 00 92 6D FF FF FF FF FF FF FF FF FF 49 FF DB 00 00 00 00 00 00 00 00 00 00 00 00 00 92 FF FF B6 B6 FF 92 24 00 00 00 00 00 49 FF 6D FF FF FF FF FF FF FF FF 92 24 00 49 FF FF 6D +6D FF FF 00 00 00 DB 6D FF FF FF FF FF FF FF FF 6D DB DB 00 00 00 00 00 00 00 00 00 00 00 00 00 00 92 FF FF DB B6 FF B6 49 00 00 00 00 00 00 6D FF 6D FF FF FF FF FF FF FF 92 92 00 00 DB FF 6D +6D FF FF DB 00 00 B6 6D FF FF FF FF FF FF FF 6D B6 FF 24 00 00 00 00 00 00 00 00 00 00 00 24 B6 DB 6D FF FF FF FF FF 6D 49 24 00 00 00 00 00 00 B6 DB B6 FF FF FF FF FF B6 DB 24 00 92 FF FF 6D +6D FF FF 6D 00 00 24 DB 92 FF FF FF FF FF 92 92 FF 49 00 00 00 00 00 49 B6 FF FF DB B6 DB FF FF FF B6 92 FF FF DB 92 FF FF FF 49 6D 92 24 00 00 00 DB B6 DB FF FF FF FF 6D FF 00 00 00 DB FF 6D +6D FF FF 92 24 00 49 FF 6D B6 FF FF FF 6D 92 FF 49 00 00 49 DB FF FF FF FF FF FF B6 FF FF FF FF FF FF B6 6D 92 92 FF FF FF FF 6D FF FF FF DB 24 00 24 FF 92 B6 FF FF 92 B6 FF 00 00 B6 FF FF 6D +92 FF FF FF 00 00 24 92 FF 92 6D 92 49 B6 DB 24 00 24 DB FF FF FF FF FF DB 92 24 00 FF FF FF FF 6D 6D FF FF FF 6D 6D FF FF B6 DB 6D FF FF FF FF 00 00 24 DB B6 6D 6D B6 DB 00 00 00 6D FF FF 6D +DB 92 FF DB 49 00 00 00 B6 FF FF DB FF 6D 00 00 6D FF FF FF FF FF FF FF 24 92 00 49 FF FF FF FF FF 6D B6 FF FF 6D 6D FF 6D 00 DB DB 92 FF FF FF DB 00 00 00 6D FF FF DB 6D 00 00 24 FF FF 92 DB +FF 49 FF FF 6D 00 00 00 24 49 B6 FF 24 00 00 6D FF FF FF FF FF FF FF 49 92 B6 00 DB FF FF DB DB FF FF B6 FF FF FF FF FF 00 49 DB FF 92 FF FF FF FF 92 00 00 00 24 6D 00 00 00 00 24 DB FF 49 FF +FF 92 B6 FF 92 49 00 00 00 00 00 24 00 00 00 FF FF FF FF FF FF FF 92 6D FF B6 DB FF DB B6 DB B6 B6 FF FF B6 FF FF FF DB 00 B6 DB FF 92 FF FF FF FF FF 24 00 00 00 00 00 00 00 00 B6 FF 92 B6 FF +FF FF 49 FF FF 49 24 00 00 00 00 00 00 00 B6 FF FF FF FF FF FF FF B6 FF FF FF FF FF FF FF FF FF 6D FF FF 6D FF FF FF DB 24 FF FF FF 92 FF FF FF FF FF 6D 00 00 00 00 00 00 00 DB FF FF 6D FF FF +FF FF DB 6D FF FF 6D 49 00 00 00 00 00 24 FF FF FF FF FF FF FF FF FF FF FF FF FF DB 6D 49 24 24 24 FF FF DB FF FF FF FF 24 24 00 00 92 FF FF FF FF FF DB 00 00 00 00 00 00 FF DB FF 6D FF FF FF +FF FF FF 92 B6 FF FF DB 49 24 00 00 00 92 FF FF FF FF FF FF FF FF FF DB FF FF FF 49 49 24 00 24 FF FF FF FF FF FF FF FF 49 6D 00 24 49 FF FF FF FF FF FF 49 00 24 6D 6D B6 FF FF 6D B6 FF FF FF +FF FF FF FF 6D B6 FF FF DB 92 B6 49 00 FF FF FF FF FF FF FF FF FF FF B6 FF FF FF 92 DB 92 00 24 FF FF FF FF FF FF FF FF FF 00 00 6D FF FF FF FF FF FF FF DB 00 6D DB FF FF FF 6D B6 FF FF FF FF +FF FF FF FF FF 92 6D FF FF FF FF B6 49 FF FF FF FF FF FF FF FF FF FF 6D FF FF FF FF B6 92 92 B6 B6 DB FF FF FF FF FF FF FF B6 6D 49 6D FF FF FF FF FF FF FF 92 24 FF FF B6 6D DB FF FF FF FF FF +FF FF FF FF FF FF DB 49 6D B6 FF 6D 92 FF FF FF FF FF FF FF FF FF DB 6D FF FF FF FF FF FF FF FF FF 92 FF FF FF FF FF FF FF FF 6D DB 92 FF FF FF FF FF FF FF FF 6D 49 6D DB FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF DB 92 49 00 FF FF FF FF FF FF FF FF FF FF 6D 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 92 6D FF FF FF FF FF FF FF DB 92 FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF 49 FF FF FF FF FF FF FF FF FF DB 00 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 B6 92 6D B6 FF FF FF FF FF FF 49 DB FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF 24 FF FF FF FF FF FF FF FF FF 49 DB 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 6D 6D FF 92 49 92 FF FF FF FF DB 49 DB FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF B6 49 FF FF FF FF FF FF FF FF 6D 92 FF 92 FF FF FF FF FF FF FF FF FF FF B6 6D 49 6D DB FF FF FF FF FF 6D 49 FF FF FF DB 6D 6D 92 92 6D 49 FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF 24 FF FF FF FF FF FF FF FF 6D 92 FF FF FF DB FF FF FF FF FF FF FF FF 6D 6D FF FF FF 92 6D FF FF FF FF FF 49 92 B6 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF DB 6D FF FF FF FF FF FF DB 24 92 FF FF FF FF FF FF FF FF FF FF FF FF FF 49 49 6D DB FF FF DB 6D B6 FF FF FF FF B6 B6 DB 49 FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF 24 B6 FF FF FF FF B6 49 49 24 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF 00 49 FF DB DB FF FF FF B6 92 FF FF FF FF FF FF 92 DB FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF 24 B6 FF FF B6 24 00 6D DB FF 6D 92 FF FF FF FF FF FF FF FF FF FF FF FF FF 6D DB DB 00 00 24 FF FF FF FF B6 FF FF FF FF FF B6 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF B6 B6 DB B6 6D 49 49 92 FF FF FF B6 6D FF FF FF FF FF FF FF 92 92 FF FF FF FF FF FF FF 49 92 DB 49 FF FF FF FF FF FF FF FF FF 92 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF 92 24 49 49 6D FF 6D 92 FF FF FF B6 6D FF FF FF FF FF FF FF FF FF FF DB FF FF FF FF FF FF FF FF B6 FF FF FF FF FF FF FF FF FF 49 FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF 6D 92 FF FF FF B6 6D FF FF FF FF FF FF FF FF FF FF B6 DB DB FF FF FF FF FF FF FF DB FF FF FF FF FF FF FF 6D 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF 6D 92 FF FF FF FF 24 92 FF FF FF FF FF FF FF FF FF FF 6D B6 FF FF FF FF FF FF FF FF FF FF FF FF FF DB 49 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF 6D B6 FF FF FF FF B6 6D FF FF FF FF FF FF FF FF FF FF B6 92 FF FF FF FF FF FF FF FF FF FF FF DB 6D 00 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF 6D 92 FF FF FF FF DB 49 FF FF FF FF FF FF FF FF FF FF FF 49 FF FF FF FF FF FF FF FF FF FF FF FF FF DB 49 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF 92 6D FF FF FF FF FF 00 24 DB FF FF FF FF FF FF FF FF FF DB 6D FF FF FF FF FF FF FF FF FF FF FF FF FF FF 49 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF B6 49 FF FF FF FF FF FF 92 6D FF FF FF FF FF FF FF FF FF FF 6D B6 FF FF FF FF FF FF FF FF FF FF FF FF B6 49 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 FF FF FF FF FF FF FF 49 00 DB FF FF FF FF FF FF FF FF FF 6D 6D B6 DB DB DB 92 49 00 00 00 00 00 49 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF 49 DB FF FF FF FF FF FF FF 24 FF FF FF FF FF FF FF FF FF FF FF DB 6D 49 49 6D B6 DB FF FF FF B6 6D FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 92 FF FF FF FF FF FF B6 6D FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 6D FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 24 FF FF FF FF FF FF DB 00 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF DB 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 B6 FF FF FF FF FF FF DB 6D 00 49 FF FF FF FF FF FF FF FF FF FF FF FF DB B6 92 6D 6D 6D 49 DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 49 FF FF FF FF FF FF FF FF 49 00 92 FF FF FF FF FF FF FF FF 49 00 00 00 00 00 49 B6 DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF DB 6D FF FF FF FF FF FF FF FF 6D 6D FF B6 B6 FF FF FF FF FF FF 92 92 FF FF 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 B6 FF FF FF FF FF FF DB 00 DB 6D 00 B6 FF FF FF FF FF FF FF FF FF FF 24 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 DB FF FF FF FF FF 92 00 FF 24 00 00 49 FF FF FF FF FF FF FF FF FF B6 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 FF FF FF FF FF FF 49 24 24 00 00 6D FF FF FF FF FF FF FF DB FF DB 6D FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6 FF FF FF FF FF FF 6D 00 24 24 24 FF FF FF FF FF FF DB B6 DB 49 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6 00 B6 00 49 DB FF FF FF DB 24 6D 24 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 B6 6D 00 00 DB FF 6D 00 00 00 DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF DB 00 6D FF FF 00 00 DB 49 00 00 00 00 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 DB FF FF 6D 00 00 92 24 00 00 00 00 00 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6 FF FF 00 6D 00 00 24 00 00 00 00 00 00 24 92 DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 6D DB 00 00 00 00 00 00 00 00 00 00 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF DB 00 24 00 00 6D 00 00 00 B6 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF +FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF DB 49 92 6D 6D DB B6 92 92 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + + + diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index c3ed39be9..5a5d4e3c6 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -449,6 +449,8 @@ fi if [ -e "${iso9660_dir}/boot/powerpc.elf" ] ; then cp "${ppc_dir}/grub.chrp" "${iso9660_dir}"/System/Library/CoreServices/BootX + mkdir -p "${iso9660_dir}"/ppc/chrp + cp "${ppc_dir}/bootinfo.txt" "${iso9660_dir}"/ppc/bootinfo.txt cp "${iso9660_dir}/boot/powerpc.elf" "${iso9660_dir}"/System/Library/CoreServices/grub.elf # FIXME: add PreP if [ "$system_area" = common ]; then From 4eafa1756577529c19d8b8a32b78181c20555246 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Fri, 19 Apr 2013 12:08:46 +0400 Subject: [PATCH 055/187] * util/grub.d/30_os-prober.in: Add onstr to linux entries in one more place. --- ChangeLog | 5 +++++ util/grub.d/30_os-prober.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f1750b029..745003645 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-19 Andrey Borzenkov + + * util/grub.d/30_os-prober.in: Add onstr to linux entries in one + more place. + 2013-04-19 Vladimir Serbinenko Add support for pseries and other bootinfo machines to grub-mkrescue. diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 5500a3c42..04f32a146 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -231,7 +231,7 @@ EOF } EOF if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then - replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" + replacement_title="$(echo "Advanced options for ${OS} $onstr" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" From aeace7f71c855c1e23395cb7ff69b685729923b0 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 19 Apr 2013 15:05:11 +0200 Subject: [PATCH 056/187] * grub-core/kern/elfXX.c (grub_elfXX_load): Handle GRUB_ELF_LOAD_FLAGS_30BITS and GRUB_ELF_LOAD_FLAGS_62BITS. * grub-core/loader/powerpc/ieee1275/linux.c (grub_linux_load32), (grub_linux_load64): Mask out 2 high bits. --- ChangeLog | 7 +++++++ grub-core/kern/elfXX.c | 16 ++++++++++++++-- grub-core/loader/powerpc/ieee1275/linux.c | 4 ++-- include/grub/elfload.h | 4 ++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 745003645..3799129d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-04-19 Vladimir Serbinenko + + * grub-core/kern/elfXX.c (grub_elfXX_load): Handle + GRUB_ELF_LOAD_FLAGS_30BITS and GRUB_ELF_LOAD_FLAGS_62BITS. + * grub-core/loader/powerpc/ieee1275/linux.c (grub_linux_load32), + (grub_linux_load64): Mask out 2 high bits. + 2013-04-19 Andrey Borzenkov * util/grub.d/30_os-prober.in: Add onstr to linux entries in one diff --git a/grub-core/kern/elfXX.c b/grub-core/kern/elfXX.c index b35e235df..2e4544919 100644 --- a/grub-core/kern/elfXX.c +++ b/grub-core/kern/elfXX.c @@ -101,8 +101,20 @@ grub_elfXX_load (grub_elf_t elf, const char *filename, continue; load_addr = (grub_addr_t) phdr->p_paddr; - if (load_flags & GRUB_ELF_LOAD_FLAGS_28BITS) - load_addr &= 0xFFFFFFF; + switch (load_flags & GRUB_ELF_LOAD_FLAGS_BITS) + { + case GRUB_ELF_LOAD_FLAGS_ALL_BITS: + break; + case GRUB_ELF_LOAD_FLAGS_28BITS: + load_addr &= 0xFFFFFFF; + break; + case GRUB_ELF_LOAD_FLAGS_30BITS: + load_addr &= 0x3FFFFFFF; + break; + case GRUB_ELF_LOAD_FLAGS_62BITS: + load_addr &= 0x3FFFFFFFFFFFFFFFULL; + break; + } load_addr += (grub_addr_t) load_offset; if (load_addr < load_base) diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c index cff4fd184..3356d51ac 100644 --- a/grub-core/loader/powerpc/ieee1275/linux.c +++ b/grub-core/loader/powerpc/ieee1275/linux.c @@ -204,7 +204,7 @@ grub_linux_load32 (grub_elf_t elf, const char *filename) linux_addr = seg_addr; /* Now load the segments into the area we claimed. */ - return grub_elf32_load (elf, filename, (void *) (seg_addr - base_addr), GRUB_ELF_LOAD_FLAGS_NONE, 0, 0); + return grub_elf32_load (elf, filename, (void *) (seg_addr - base_addr), GRUB_ELF_LOAD_FLAGS_30BITS, 0, 0); } static grub_err_t @@ -238,7 +238,7 @@ grub_linux_load64 (grub_elf_t elf, const char *filename) linux_addr = seg_addr; /* Now load the segments into the area we claimed. */ - return grub_elf64_load (elf, filename, (void *) (grub_addr_t) (seg_addr - base_addr), GRUB_ELF_LOAD_FLAGS_NONE, 0, 0); + return grub_elf64_load (elf, filename, (void *) (grub_addr_t) (seg_addr - base_addr), GRUB_ELF_LOAD_FLAGS_62BITS, 0, 0); } static grub_err_t diff --git a/include/grub/elfload.h b/include/grub/elfload.h index f854d0ba7..9a7ae4ebb 100644 --- a/include/grub/elfload.h +++ b/include/grub/elfload.h @@ -53,7 +53,11 @@ enum grub_elf_load_flags { GRUB_ELF_LOAD_FLAGS_NONE = 0, GRUB_ELF_LOAD_FLAGS_LOAD_PT_DYNAMIC = 1, + GRUB_ELF_LOAD_FLAGS_BITS = 6, + GRUB_ELF_LOAD_FLAGS_ALL_BITS = 0, GRUB_ELF_LOAD_FLAGS_28BITS = 2, + GRUB_ELF_LOAD_FLAGS_30BITS = 4, + GRUB_ELF_LOAD_FLAGS_62BITS = 6, }; grub_err_t grub_elf32_load (grub_elf_t, const char *filename, void *load_offset, enum grub_elf_load_flags flags, grub_addr_t *, From 386497990a04117ae2c5cb501fc66d16cec64c98 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 19 Apr 2013 15:09:15 +0200 Subject: [PATCH 057/187] * grub-core/commands/videotest.c (grub_cmd_videotest): Fix error handling when creating text_layer failed. * grub-core/video/video.c (grub_video_create_render_target): Set result to 0 on error. (grub_video_delete_render_target): Do not dereference NULL. --- ChangeLog | 8 ++++++++ grub-core/commands/videotest.c | 8 ++++---- grub-core/video/video.c | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3799129d0..3d4b23d92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2013-04-19 Vladimir Serbinenko + + * grub-core/commands/videotest.c (grub_cmd_videotest): Fix error + handling when creating text_layer failed. + * grub-core/video/video.c (grub_video_create_render_target): + Set result to 0 on error. + (grub_video_delete_render_target): Do not dereference NULL. + 2013-04-19 Vladimir Serbinenko * grub-core/kern/elfXX.c (grub_elfXX_load): Handle diff --git a/grub-core/commands/videotest.c b/grub-core/commands/videotest.c index 2e4b3a23c..2256237f9 100644 --- a/grub-core/commands/videotest.c +++ b/grub-core/commands/videotest.c @@ -71,10 +71,10 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)), grub_font_t fixed; struct grub_font_glyph *glyph; - grub_video_create_render_target (&text_layer, width, height, - GRUB_VIDEO_MODE_TYPE_RGB - | GRUB_VIDEO_MODE_TYPE_ALPHA); - if (!text_layer) + if (grub_video_create_render_target (&text_layer, width, height, + GRUB_VIDEO_MODE_TYPE_RGB + | GRUB_VIDEO_MODE_TYPE_ALPHA) + || !text_layer) goto fail; grub_video_set_active_render_target (text_layer); diff --git a/grub-core/video/video.c b/grub-core/video/video.c index aab9b181a..844f36c08 100644 --- a/grub-core/video/video.c +++ b/grub-core/video/video.c @@ -339,6 +339,7 @@ grub_video_create_render_target (struct grub_video_render_target **result, unsigned int width, unsigned int height, unsigned int mode_type) { + *result = 0; if (! grub_video_adapter_active) return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated"); @@ -351,6 +352,8 @@ grub_video_create_render_target (struct grub_video_render_target **result, grub_err_t grub_video_delete_render_target (struct grub_video_render_target *target) { + if (!target) + return GRUB_ERR_NONE; if (! grub_video_adapter_active) return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated"); From f32555dd93ebd109764114cea76003eb83337c1d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 19 Apr 2013 15:14:28 +0200 Subject: [PATCH 058/187] * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Look for /boot-rom as well as /rom/boot-rom. --- ChangeLog | 5 +++++ grub-core/kern/ieee1275/cmain.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3d4b23d92..488be607b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-19 Vladimir Serbinenko + + * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): + Look for /boot-rom as well as /rom/boot-rom. + 2013-04-19 Vladimir Serbinenko * grub-core/commands/videotest.c (grub_cmd_videotest): Fix error diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c index 5f6a6da3a..abd1ca96c 100644 --- a/grub-core/kern/ieee1275/cmain.c +++ b/grub-core/kern/ieee1275/cmain.c @@ -186,7 +186,8 @@ grub_ieee1275_find_options (void) grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_HAS_CURSORONOFF); } - if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom)) + if (! grub_ieee1275_finddevice ("/rom/boot-rom", &bootrom) + || ! grub_ieee1275_finddevice ("/boot-rom", &bootrom)) { rc = grub_ieee1275_get_property (bootrom, "model", tmp, sizeof (tmp), 0); if (rc >= 0 && !grub_strncmp (tmp, "PPC Open Hack'Ware", From 90ec4b7f6c9f2ea3ce9e102c706794dae323d102 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 19 Apr 2013 15:27:09 +0200 Subject: [PATCH 059/187] * grub-core/kern/ieee1275/init.c (grub_claim_heap): Improve handling of GRUB_IEEE1275_FLAG_FORCE_CLAIM. * grub-core/loader/powerpc/ieee1275/linux.c (grub_linux_claimmap_iterate): Handle GRUB_IEEE1275_FLAG_FORCE_CLAIM. --- ChangeLog | 7 +++++++ grub-core/kern/ieee1275/init.c | 5 +++-- grub-core/lib/ieee1275/relocator.c | 4 ++-- grub-core/loader/powerpc/ieee1275/linux.c | 14 ++++++++++++++ include/grub/ieee1275/ieee1275.h | 8 ++++++++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 488be607b..3e606cba9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-04-19 Vladimir Serbinenko + + * grub-core/kern/ieee1275/init.c (grub_claim_heap): Improve handling + of GRUB_IEEE1275_FLAG_FORCE_CLAIM. + * grub-core/loader/powerpc/ieee1275/linux.c + (grub_linux_claimmap_iterate): Handle GRUB_IEEE1275_FLAG_FORCE_CLAIM. + 2013-04-19 Vladimir Serbinenko * grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c index 391a734d4..ce8eadbd3 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c @@ -225,8 +225,9 @@ grub_claim_heap (void) { unsigned long total = 0; - if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET)) - heap_init (HEAP_MAX_ADDR - HEAP_MIN_SIZE, HEAP_MIN_SIZE, 1, &total); + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) + heap_init (GRUB_IEEE1275_STATIC_HEAP_START, GRUB_IEEE1275_STATIC_HEAP_LEN, + 1, &total); else grub_machine_mmap_iterate (heap_init, &total); } diff --git a/grub-core/lib/ieee1275/relocator.c b/grub-core/lib/ieee1275/relocator.c index f6ecaddc7..c6dd8facb 100644 --- a/grub-core/lib/ieee1275/relocator.c +++ b/grub-core/lib/ieee1275/relocator.c @@ -38,7 +38,7 @@ grub_relocator_firmware_get_max_events (void) { int counter = 0; - if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET)) + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) return 0; grub_machine_mmap_iterate (count, &counter); return 2 * counter; @@ -92,7 +92,7 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events) .counter = 0 }; - if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET)) + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) return 0; grub_machine_mmap_iterate (grub_relocator_firmware_fill_events_iter, &ctx); return ctx.counter; diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c index 3356d51ac..4a14f66de 100644 --- a/grub-core/loader/powerpc/ieee1275/linux.c +++ b/grub-core/loader/powerpc/ieee1275/linux.c @@ -111,6 +111,20 @@ grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size, .found_addr = (grub_addr_t) -1 }; + if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM)) + { + grub_uint64_t addr = target; + if (addr < GRUB_IEEE1275_STATIC_HEAP_START + + GRUB_IEEE1275_STATIC_HEAP_LEN) + addr = GRUB_IEEE1275_STATIC_HEAP_START + + GRUB_IEEE1275_STATIC_HEAP_LEN; + addr = ALIGN_UP (addr, align); + if (grub_claimmap (addr, size) == GRUB_ERR_NONE) + return addr; + return (grub_addr_t) -1; + } + + grub_machine_mmap_iterate (alloc_mem, &ctx); return ctx.found_addr; diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h index 1e8ba6f84..1b240d3df 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -78,6 +78,14 @@ extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen); extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu); extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *); +/* Static heap, used only if FORCE_CLAIM is set, + happens on Open Hack'Ware. Should be in platform-specific + header but is used only on PPC anyway. +*/ +#define GRUB_IEEE1275_STATIC_HEAP_START 0x1000000 +#define GRUB_IEEE1275_STATIC_HEAP_LEN 0x1000000 + + enum grub_ieee1275_flag { /* Old World Macintosh firmware fails seek when "dev:0" is opened. */ From 872dac835c372493cb5bfc49459589a3b430a680 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 20 Apr 2013 13:39:04 +0200 Subject: [PATCH 060/187] * grub-core/lib/efi/relocator.c (grub_relocator_firmware_alloc_region): Remove dprintf. * grub-core/lib/relocator.c (malloc_in_range): Likewise. --- ChangeLog | 6 ++++++ grub-core/lib/efi/relocator.c | 4 ++-- grub-core/lib/relocator.c | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e606cba9..6ca70a636 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-20 Vladimir Serbinenko + + * grub-core/lib/efi/relocator.c (grub_relocator_firmware_alloc_region): + Remove dprintf. + * grub-core/lib/relocator.c (malloc_in_range): Likewise. + 2013-04-19 Vladimir Serbinenko * grub-core/kern/ieee1275/init.c (grub_claim_heap): Improve handling diff --git a/grub-core/lib/efi/relocator.c b/grub-core/lib/efi/relocator.c index 0d346bea3..319b69eeb 100644 --- a/grub-core/lib/efi/relocator.c +++ b/grub-core/lib/efi/relocator.c @@ -96,10 +96,10 @@ grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size) if (grub_efi_is_finished) return 1; - +#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF grub_dprintf ("relocator", "EFI alloc: %llx, %llx\n", (unsigned long long) start, (unsigned long long) size); - +#endif b = grub_efi_system_table->boot_services; status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS, GRUB_EFI_LOADER_DATA, size >> 12, &address); diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c index 350066dc2..e08551403 100644 --- a/grub-core/lib/relocator.c +++ b/grub-core/lib/relocator.c @@ -984,9 +984,11 @@ malloc_in_range (struct grub_relocator *rel, alloc_end = min (events[j].pos, target + size); if (alloc_end > alloc_start) { +#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF grub_dprintf ("relocator", "subchunk 0x%lx-0x%lx, %d\n", (unsigned long) alloc_start, (unsigned long) alloc_end, typepre); +#endif curschu->type = typepre; curschu->start = alloc_start; curschu->size = alloc_end - alloc_start; From ec2dd17919b9cd4926e7ca576d03b47e38150fef Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 20 Apr 2013 13:46:58 +0200 Subject: [PATCH 061/187] * grub-core/Makefile.core.def (legacycfg): Enable on EFI. --- ChangeLog | 4 ++++ grub-core/Makefile.core.def | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6ca70a636..b2e3cccac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-20 Vladimir Serbinenko + + * grub-core/Makefile.core.def (legacycfg): Enable on EFI. + 2013-04-20 Vladimir Serbinenko * grub-core/lib/efi/relocator.c (grub_relocator_firmware_alloc_region): diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 43c4cb6d5..1f04afba6 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1856,7 +1856,12 @@ module = { common = commands/legacycfg.c; common = lib/legacy_parse.c; emu = lib/i386/pc/vesa_modes_table.c; + i386_efi = lib/i386/pc/vesa_modes_table.c; + x86_64_efi = lib/i386/pc/vesa_modes_table.c; + enable = i386_pc; + enable = i386_efi; + enable = x86_64_efi; enable = emu; }; From fe4c3e7e670d45d2b5e1624e256f9cd09bbecf34 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 20 Apr 2013 17:39:49 +0200 Subject: [PATCH 062/187] * grub-core/kern/mm.c (grub_mm_init_region): Fix condition for detecting too small regions. --- ChangeLog | 5 +++++ grub-core/kern/mm.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2e3cccac..2a4264cf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-20 Vladimir Serbinenko + + * grub-core/kern/mm.c (grub_mm_init_region): Fix condition for + detecting too small regions. + 2013-04-20 Vladimir Serbinenko * grub-core/Makefile.core.def (legacycfg): Enable on EFI. diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index d8690916c..959c3bab1 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c @@ -140,12 +140,13 @@ grub_mm_init_region (void *addr, grub_size_t size) /* Allocate a region from the head. */ r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN); - size -= (char *) r - (char *) addr + sizeof (*r); /* If this region is too small, ignore it. */ - if (size < GRUB_MM_ALIGN) + if (size < GRUB_MM_ALIGN + (char *) r - (char *) addr + sizeof (*r)) return; + size -= (char *) r - (char *) addr + sizeof (*r); + h = (grub_mm_header_t) (r + 1); h->next = h; h->magic = GRUB_MM_FREE_MAGIC; From d178788e71b5d1c8df8040fa5d9716b301194bdb Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 21 Apr 2013 13:02:10 +0200 Subject: [PATCH 063/187] Support coreboot framebuffer. * grub-core/video/i386/coreboot/cbfb.c: New file. --- ChangeLog | 6 + grub-core/Makefile.core.def | 6 + grub-core/commands/i386/coreboot/cbls.c | 16 ++- grub-core/video/i386/coreboot/cbfb.c | 180 ++++++++++++++++++++++++ include/grub/i386/coreboot/lbio.h | 36 ++++- 5 files changed, 236 insertions(+), 8 deletions(-) create mode 100644 grub-core/video/i386/coreboot/cbfb.c diff --git a/ChangeLog b/ChangeLog index 2a4264cf0..6be583e58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-21 Vladimir Serbinenko + + Support coreboot framebuffer. + + * grub-core/video/i386/coreboot/cbfb.c: New file. + 2013-04-20 Vladimir Serbinenko * grub-core/kern/mm.c (grub_mm_init_region): Fix condition for diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 1f04afba6..7269609f9 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1796,6 +1796,12 @@ module = { enable = powerpc_ieee1275; }; +module = { + name = coreboot_fb; + common = video/i386/coreboot/cbfb.c; + enable = i386_coreboot; +}; + module = { name = sdl; emu = video/emu/sdl.c; diff --git a/grub-core/commands/i386/coreboot/cbls.c b/grub-core/commands/i386/coreboot/cbls.c index 151f9e84a..a3542f372 100644 --- a/grub-core/commands/i386/coreboot/cbls.c +++ b/grub-core/commands/i386/coreboot/cbls.c @@ -50,7 +50,7 @@ static const char *descs[] = { [0xd] = "assembler", [0xf] = "serial", [GRUB_LINUXBIOS_MEMBER_CONSOLE] = "console", - [0x12] = "framebuffer", + [GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER] = "framebuffer", [0x13] = "GPIO", [0x15] = "VDAT", [GRUB_LINUXBIOS_MEMBER_TIMESTAMPS] = "timestamps (`coreboot_boottime' to list)", @@ -77,6 +77,20 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, switch (table_item->tag) { + case GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER: + { + struct grub_linuxbios_table_framebuffer *fb; + fb = (struct grub_linuxbios_table_framebuffer *) (table_item + 1); + + grub_printf (": %dx%dx%d pitch=%d lfb=0x%llx %d/%d/%d/%d %d/%d/%d/%d", + fb->width, fb->height, + fb->bpp, fb->pitch, fb->lfb, + fb->red_mask_size, fb->green_mask_size, + fb->blue_mask_size, fb->reserved_mask_size, + fb->red_field_pos, fb->green_field_pos, + fb->blue_field_pos, fb->reserved_field_pos); + break; + } case GRUB_LINUXBIOS_MEMBER_MAINBOARD: { struct grub_linuxbios_mainboard *mb; diff --git a/grub-core/video/i386/coreboot/cbfb.c b/grub-core/video/i386/coreboot/cbfb.c new file mode 100644 index 000000000..000efdb85 --- /dev/null +++ b/grub-core/video/i386/coreboot/cbfb.c @@ -0,0 +1,180 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#define grub_video_render_target grub_video_fbrender_target + +#include +#include +#include +#include +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +static struct grub_linuxbios_table_framebuffer *cbfb; + +static struct +{ + struct grub_video_mode_info mode_info; + grub_uint8_t *ptr; +} framebuffer; + +static grub_err_t +grub_video_cbfb_init (void) +{ + grub_memset (&framebuffer, 0, sizeof(framebuffer)); + + return grub_video_fb_init (); +} + +static grub_err_t +grub_video_cbfb_fill_mode_info (struct grub_video_mode_info *out) +{ + grub_memset (out, 0, sizeof (*out)); + + out->width = cbfb->width; + out->height = cbfb->height; + out->pitch = cbfb->pitch; + + out->red_field_pos = cbfb->red_field_pos; + out->red_mask_size = cbfb->red_mask_size; + out->green_field_pos = cbfb->green_field_pos; + out->green_mask_size = cbfb->green_mask_size; + out->blue_field_pos = cbfb->blue_field_pos; + out->blue_mask_size = cbfb->blue_mask_size; + out->reserved_field_pos = cbfb->reserved_field_pos; + out->reserved_mask_size = cbfb->reserved_mask_size; + + out->mode_type = GRUB_VIDEO_MODE_TYPE_RGB; + out->bpp = cbfb->bpp; + out->bytes_per_pixel = (cbfb->bpp + 7) / 8; + out->number_of_colors = 256; + + out->blit_format = grub_video_get_blit_format (out); + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_video_cbfb_setup (unsigned int width, unsigned int height, + unsigned int mode_type __attribute__ ((unused)), + unsigned int mode_mask __attribute__ ((unused))) +{ + grub_err_t err; + + if (!cbfb) + return grub_error (GRUB_ERR_IO, "Couldn't find display device."); + + if (!((width == cbfb->width && height == cbfb->height) + || (width == 0 && height == 0))) + return grub_error (GRUB_ERR_IO, "can't set mode %dx%d", width, height); + + err = grub_video_cbfb_fill_mode_info (&framebuffer.mode_info); + if (err) + { + grub_dprintf ("video", "CBFB: couldn't fill mode info\n"); + return err; + } + + framebuffer.ptr = (void *) (grub_addr_t) cbfb->lfb; + + grub_dprintf ("video", "CBFB: initialising FB @ %p %dx%dx%d\n", + framebuffer.ptr, framebuffer.mode_info.width, + framebuffer.mode_info.height, framebuffer.mode_info.bpp); + + err = grub_video_fb_setup (mode_type, mode_mask, + &framebuffer.mode_info, + framebuffer.ptr, NULL, NULL); + if (err) + return err; + + grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS, + grub_video_fbstd_colors); + + return err; +} + +static grub_err_t +grub_video_cbfb_get_info_and_fini (struct grub_video_mode_info *mode_info, + void **framebuf) +{ + grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info)); + *framebuf = (char *) framebuffer.ptr; + + grub_video_fb_fini (); + + return GRUB_ERR_NONE; +} + +static struct grub_video_adapter grub_video_cbfb_adapter = + { + .name = "Coreboot video driver", + + .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE_DIRTY, + + .init = grub_video_cbfb_init, + .fini = grub_video_fb_fini, + .setup = grub_video_cbfb_setup, + .get_info = grub_video_fb_get_info, + .get_info_and_fini = grub_video_cbfb_get_info_and_fini, + .set_palette = grub_video_fb_set_palette, + .get_palette = grub_video_fb_get_palette, + .set_viewport = grub_video_fb_set_viewport, + .get_viewport = grub_video_fb_get_viewport, + .map_color = grub_video_fb_map_color, + .map_rgb = grub_video_fb_map_rgb, + .map_rgba = grub_video_fb_map_rgba, + .unmap_color = grub_video_fb_unmap_color, + .fill_rect = grub_video_fb_fill_rect, + .blit_bitmap = grub_video_fb_blit_bitmap, + .blit_render_target = grub_video_fb_blit_render_target, + .scroll = grub_video_fb_scroll, + .swap_buffers = grub_video_fb_swap_buffers, + .create_render_target = grub_video_fb_create_render_target, + .delete_render_target = grub_video_fb_delete_render_target, + .set_active_render_target = grub_video_fb_set_active_render_target, + .get_active_render_target = grub_video_fb_get_active_render_target, + + .next = 0 + }; + +static int +iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, + void *data __attribute__ ((unused))) +{ + if (table_item->tag != GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER) + return 0; + cbfb = (struct grub_linuxbios_table_framebuffer *) (table_item + 1); + return 1; +} + +GRUB_MOD_INIT(coreboot_fb) +{ + grub_linuxbios_table_iterate (iterate_linuxbios_table, 0); + + if (cbfb) + grub_video_register (&grub_video_cbfb_adapter); +} + +GRUB_MOD_FINI(coreboot_fb) +{ + if (cbfb) + grub_video_unregister (&grub_video_cbfb_adapter); +} diff --git a/include/grub/i386/coreboot/lbio.h b/include/grub/i386/coreboot/lbio.h index b4150f461..9a9304625 100644 --- a/include/grub/i386/coreboot/lbio.h +++ b/include/grub/i386/coreboot/lbio.h @@ -54,18 +54,40 @@ struct grub_linuxbios_mainboard struct grub_linuxbios_table_item { -#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00 -#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01 -#define GRUB_LINUXBIOS_MEMBER_MAINBOARD 0x03 -#define GRUB_LINUXBIOS_MEMBER_CONSOLE 0x10 -#define GRUB_LINUXBIOS_MEMBER_LINK 0x11 -#define GRUB_LINUXBIOS_MEMBER_TIMESTAMPS 0x16 -#define GRUB_LINUXBIOS_MEMBER_CBMEMC 0x17 grub_uint32_t tag; grub_uint32_t size; }; typedef struct grub_linuxbios_table_item *grub_linuxbios_table_item_t; +enum + { + GRUB_LINUXBIOS_MEMBER_UNUSED = 0x00, + GRUB_LINUXBIOS_MEMBER_MEMORY = 0x01, + GRUB_LINUXBIOS_MEMBER_MAINBOARD = 0x03, + GRUB_LINUXBIOS_MEMBER_CONSOLE = 0x10, + GRUB_LINUXBIOS_MEMBER_LINK = 0x11, + GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER = 0x12, + GRUB_LINUXBIOS_MEMBER_TIMESTAMPS = 0x16, + GRUB_LINUXBIOS_MEMBER_CBMEMC = 0x17 + }; + +struct grub_linuxbios_table_framebuffer { + grub_uint64_t lfb; + grub_uint32_t width; + grub_uint32_t height; + grub_uint32_t pitch; + grub_uint8_t bpp; + + grub_uint8_t red_field_pos; + grub_uint8_t red_mask_size; + grub_uint8_t green_field_pos; + grub_uint8_t green_mask_size; + grub_uint8_t blue_field_pos; + grub_uint8_t blue_mask_size; + grub_uint8_t reserved_field_pos; + grub_uint8_t reserved_mask_size; +}; + struct grub_linuxbios_mem_region { grub_uint64_t addr; From 17fca5734b4b22053941a758c4d857cc2331bcb2 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 21 Apr 2013 13:06:22 +0200 Subject: [PATCH 064/187] * grub-core/disk/arc/arcdisk.c (grub_arcdisk_iterate_iter): Fix a type which prevented CD-ROM and floppy boot. --- ChangeLog | 5 +++++ grub-core/disk/arc/arcdisk.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6be583e58..2150d3da5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-21 Vladimir Serbinenko + + * grub-core/disk/arc/arcdisk.c (grub_arcdisk_iterate_iter): + Fix a type which prevented CD-ROM and floppy boot. + 2013-04-21 Vladimir Serbinenko Support coreboot framebuffer. diff --git a/grub-core/disk/arc/arcdisk.c b/grub-core/disk/arc/arcdisk.c index 5d1212843..780728f68 100644 --- a/grub-core/disk/arc/arcdisk.c +++ b/grub-core/disk/arc/arcdisk.c @@ -95,7 +95,7 @@ grub_arcdisk_iterate_iter (const char *name, struct grub_arcdisk_iterate_ctx *ctx = data; if (!(comp->type == GRUB_ARC_COMPONENT_TYPE_DISK - || comp->type == GRUB_ARC_COMPONENT_TYPE_DISK + || comp->type == GRUB_ARC_COMPONENT_TYPE_FLOPPY || comp->type == GRUB_ARC_COMPONENT_TYPE_TAPE)) return 0; return ctx->hook (name, ctx->hook_data); From 8528c879e31f1f364d4608a8aeeee7f7565104ba Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 13:54:17 +0200 Subject: [PATCH 065/187] Move mips-arc link address. Previous link address was chosen in belief that RAM on SGI platforms grows down while in fact it grows up from an unusual base. --- ChangeLog | 6 ++++++ grub-core/Makefile.core.def | 6 +++--- grub-core/kern/mips/arc/init.c | 14 +++++++++----- grub-core/kern/mips/startup.S | 2 -- include/grub/mips/arc/memory.h | 2 +- include/grub/offsets.h | 2 +- util/grub-mkimage.c | 11 ++++------- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2150d3da5..39bb8279b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-24 Vladimir Serbinenko + + Move mips-arc link address. Previous link address was chosen + in belief that RAM on SGI platforms grows down while in fact it + grows up from an unusual base. + 2013-04-21 Vladimir Serbinenko * grub-core/disk/arc/arcdisk.c (grub_arcdisk_iterate_iter): diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 7269609f9..8f36ea0f2 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -73,7 +73,7 @@ kernel = { mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000'; sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400'; - mips_arc_ldflags = '-Wl,-Ttext,0x8bd00000'; + mips_arc_ldflags = '-Wl,-Ttext,0x88200000'; mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000'; mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK'; @@ -372,7 +372,7 @@ image = { objcopyflags = '-O binary'; mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; - mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000'; + mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000'; ldadd = '-lgcc'; cflags = '-Wno-unreachable-code -static-libgcc'; enable = mips; @@ -388,7 +388,7 @@ image = { objcopyflags = '-O binary'; mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; - mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000'; + mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000'; ldadd = '-lgcc'; cflags = '-static-libgcc'; enable = mips; diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c index f63ac6d47..011c63fe0 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -128,12 +128,16 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data) extern grub_uint32_t grub_total_modules_size __attribute__ ((section(".text"))); grub_addr_t grub_modbase; +extern char _end[]; + void grub_machine_init (void) { struct grub_arc_memory_descriptor *cur = NULL; + grub_addr_t modend; - grub_modbase = GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size; + grub_modbase = ALIGN_UP ((grub_addr_t) _end, GRUB_KERNEL_MACHINE_MOD_ALIGN); + modend = grub_modbase + grub_total_modules_size; grub_console_init_early (); /* FIXME: measure this. */ @@ -153,10 +157,10 @@ grub_machine_init (void) start = ((grub_uint64_t) cur->start_page) << 12; end = ((grub_uint64_t) cur->num_pages) << 12; end += start; - if ((grub_uint64_t) end > ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR - - grub_total_modules_size) & 0x1fffffff)) - end = ((GRUB_KERNEL_MIPS_ARC_LINK_ADDR - grub_total_modules_size) - & 0x1fffffff); + if ((grub_uint64_t) start < (modend & 0x1fffffff)) + start = (modend & 0x1fffffff); + if ((grub_uint64_t) end > 0x20000000) + end = 0x20000000; if (end > start) grub_mm_init_region ((void *) (grub_addr_t) (start | 0x80000000), end - start); diff --git a/grub-core/kern/mips/startup.S b/grub-core/kern/mips/startup.S index 2476038bc..35a11bcf8 100644 --- a/grub-core/kern/mips/startup.S +++ b/grub-core/kern/mips/startup.S @@ -73,7 +73,6 @@ cont: #endif /* Move the modules out of BSS. */ -#ifndef GRUB_MACHINE_ARC lui $t2, %hi(__bss_start) addiu $t2, %lo(__bss_start) @@ -103,7 +102,6 @@ modulesmovcont: b modulesmovcont addiu $t3, $t3, -1 modulesmovdone: -#endif /* Clean BSS. */ diff --git a/include/grub/mips/arc/memory.h b/include/grub/mips/arc/memory.h index b960d2a37..68b425f75 100644 --- a/include/grub/mips/arc/memory.h +++ b/include/grub/mips/arc/memory.h @@ -19,7 +19,7 @@ #ifndef GRUB_MEMORY_MACHINE_HEADER #define GRUB_MEMORY_MACHINE_HEADER 1 -#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x8bfffff0 +#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x881ffff0 #ifndef ASM_FILE diff --git a/include/grub/offsets.h b/include/grub/offsets.h index bce755d98..1e673d522 100644 --- a/include/grub/offsets.h +++ b/include/grub/offsets.h @@ -80,7 +80,7 @@ #define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10 #define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08 -#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8bd00000 +#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x88200000 #define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32 diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index 0acc61ee4..41f795aab 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -387,8 +387,7 @@ struct image_target_desc image_targets[] = .voidp_sizeof = 4, .bigendian = 1, .id = IMAGE_MIPS_ARC, - .flags = (PLATFORM_FLAGS_DECOMPRESSORS - | PLATFORM_FLAGS_MODULES_BEFORE_KERNEL), + .flags = PLATFORM_FLAGS_DECOMPRESSORS, .total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE, .decompressor_compressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE, .decompressor_uncompressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE, @@ -1522,12 +1521,10 @@ generate_image (const char *dir, const char *prefix, program_size = ALIGN_ADDR (core_size); if (comp == COMPRESSION_NONE) - target_addr = (image_target->link_addr - - total_module_size - decompress_size); + target_addr = (image_target->link_addr - decompress_size); else - target_addr = (image_target->link_addr - - ALIGN_UP(total_module_size + core_size, 1048576) - - (1 << 20)); + target_addr = ALIGN_UP (image_target->link_addr + + kernel_size + total_module_size, 32); ecoff_img = xmalloc (program_size + sizeof (*head) + sizeof (*section)); grub_memset (ecoff_img, 0, program_size + sizeof (*head) + sizeof (*section)); From cdeb832472af0523b4708cb02897ed05c4e00da4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 13:58:31 +0200 Subject: [PATCH 066/187] * grub-core/kern/dl.c (grub_dl_resolve_symbols): Handle malloc failure. --- ChangeLog | 4 ++++ grub-core/kern/dl.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 39bb8279b..598d16cc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-24 Vladimir Serbinenko + + * grub-core/kern/dl.c (grub_dl_resolve_symbols): Handle malloc failure. + 2013-04-24 Vladimir Serbinenko Move mips-arc link address. Previous link address was chosen diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c index d06b6aef2..c6d9ec982 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -359,6 +359,8 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) #ifdef GRUB_MODULES_MACHINE_READONLY mod->symtab = grub_malloc (s->sh_size); + if (!mod->symtab) + return grub_errno; memcpy (mod->symtab, (char *) e + s->sh_offset, s->sh_size); #else mod->symtab = (Elf_Sym *) ((char *) e + s->sh_offset); From ab1440bd4e55b02efebaca7249040b56df4f8795 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 14:02:58 +0200 Subject: [PATCH 067/187] * util/grub-mkrescue.in: Add mips-arc support. --- ChangeLog | 4 ++++ Makefile.util.def | 13 +------------ util/grub-mkrescue.in | 22 +++++++++++++++++++++- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 598d16cc4..c2d56f10b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-24 Vladimir Serbinenko + + * util/grub-mkrescue.in: Add mips-arc support. + 2013-04-24 Vladimir Serbinenko * grub-core/kern/dl.c (grub_dl_resolve_symbols): Handle malloc failure. diff --git a/Makefile.util.def b/Makefile.util.def index ed7b4128a..4fa37bcb6 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -464,18 +464,7 @@ script = { name = grub-mkrescue; common = util/grub-install_header; common = util/grub-mkrescue.in; - enable = i386_pc; - enable = i386_efi; - enable = x86_64_efi; - enable = i386_qemu; - enable = i386_multiboot; - enable = i386_coreboot; - enable = i386_ieee1275; - enable = mips_qemu_mips; - enable = mips_loongson; - enable = ia64_efi; - enable = powerpc_ieee1275; - enable = sparc64_ieee1275; + enable = noemu; }; script = { diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 5a5d4e3c6..634318b68 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -45,6 +45,7 @@ efi32_dir="${libdir}/@PACKAGE@/i386-efi" efi64_dir="${libdir}/@PACKAGE@/x86_64-efi" ia64_dir="${libdir}/@PACKAGE@/ia64-efi" sparc64_dir="${libdir}/@PACKAGE@/sparc64-ieee1275" +arcs_dir="${libdir}/@PACKAGE@/mips-arc" ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" rom_directory= override_dir= @@ -91,7 +92,8 @@ usage () { print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")" print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")" print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")" - print_option_help "--sparc-boot" "$(gettext "enable sparc boot. Disables HFS+, APM and boot as disk image for i386-pc")" + print_option_help "--sparc-boot" "$(gettext "enable sparc boot. Disables HFS+, APM, ARCS and boot as disk image for i386-pc")" + print_option_help "--arcs-boot" "$(gettext "enable ARCS (big-endian mips machines, mostly SGI) boot. Disables HFS+, APM, sparc64 and boot as disk image for i386-pc")" echo gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt echo @@ -154,6 +156,9 @@ do --sparc-boot) system_area=sparc64 ;; + --arcs-boot) + system_area=arcs ;; + --product-name) product_name=`argument $option "$@"`; shift ;; --product-name=*) @@ -273,6 +278,8 @@ if [ "${override_dir}" = "" ] ; then system_area=common; elif test -e "${sparc64_dir}" ; then system_area=sparc64; + elif test -e "${arcs_dir}" ; then + system_area=arcs; fi fi if test -e "${multiboot_dir}" ; then @@ -314,6 +321,9 @@ if [ "${override_dir}" = "" ] ; then if test -e "${sparc64_dir}" ; then process_input_dir "${sparc64_dir}" sparc64-ieee1275 fi + if test -e "${arcs_dir}" ; then + process_input_dir "${arcs_dir}" mips-arc + fi else . "${override_dir}"/modinfo.sh process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform} @@ -330,6 +340,7 @@ else ppc_dir= i386_ieee1275_dir= sparc64_dir= + arcs_dir= case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-multiboot) multiboot_dir="${override_dir}" ;; i386-coreboot) coreboot_dir="${override_dir}" ;; @@ -343,6 +354,7 @@ else mips-qemu_mips) mips_qemu_dir="${override_dir}" ;; powerpc-ieee1275) ppc_dir="${override_dir}"; system_area=common ;; sparc64-ieee1275) sparc64_dir="${override_dir}"; system_area=sparc64 ;; + mips-arc) arcs_dir="${override_dir}"; system_area=arcs ;; i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;; esac fi @@ -470,6 +482,14 @@ if [ -e "${iso9660_dir}"/boot/grub/sparc64-ieee1275/core.img ] && [ "$system_are grub_mkisofs_arguments="${grub_mkisofs_arguments} -G $sysarea_img -B , --grub2-sparc-core /boot/grub/sparc64-ieee1275/core.img" fi +make_image "${arcs_dir}" mips-arc "${iso9660_dir}/boot/grub/mips-arc/core.img" "" +if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ]; then + grub_mkisofs_arguments="${grub_mkisofs_arguments} /boot/grub/mips-arc/grub=${iso9660_dir}/boot/grub/mips-arc/core.img /boot/grub/mips-arc/sashARCS=${iso9660_dir}/boot/grub/mips-arc/core.img" +fi +if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ] && [ "$system_area" = arcs ]; then + grub_mkisofs_arguments="${grub_mkisofs_arguments} -mips-boot /boot/grub/mips-arc/sashARCS -mips-boot /boot/grub/mips-arc/grub" +fi + make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "pata" if [ -e "${iso9660_dir}/boot/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then cp "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf" From 45fbd9a23fd2e436efcb9e19a384c845dd349af9 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 14:44:15 +0200 Subject: [PATCH 068/187] Add missing video ids to coreboot and ieee1275 video. --- ChangeLog | 4 ++++ grub-core/loader/i386/linux.c | 2 ++ grub-core/video/i386/coreboot/cbfb.c | 1 + grub-core/video/ieee1275.c | 1 + include/grub/video.h | 2 ++ 5 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index c2d56f10b..d863bb32a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-24 Vladimir Serbinenko + + Add missing video ids to coreboot and ieee1275 video. + 2013-04-24 Vladimir Serbinenko * util/grub-mkrescue.in: Add mips-arc support. diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 5cd074b26..db81ca1cc 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -338,6 +338,8 @@ grub_linux_setup_video (struct linux_kernel_params *params) case GRUB_VIDEO_DRIVER_CIRRUS: case GRUB_VIDEO_DRIVER_BOCHS: case GRUB_VIDEO_DRIVER_RADEON_FULOONG2E: + case GRUB_VIDEO_DRIVER_IEEE1275: + case GRUB_VIDEO_DRIVER_COREBOOT: /* Make gcc happy. */ case GRUB_VIDEO_DRIVER_SDL: case GRUB_VIDEO_DRIVER_NONE: diff --git a/grub-core/video/i386/coreboot/cbfb.c b/grub-core/video/i386/coreboot/cbfb.c index 000efdb85..984b5943e 100644 --- a/grub-core/video/i386/coreboot/cbfb.c +++ b/grub-core/video/i386/coreboot/cbfb.c @@ -128,6 +128,7 @@ static struct grub_video_adapter grub_video_cbfb_adapter = .name = "Coreboot video driver", .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE_DIRTY, + .id = GRUB_VIDEO_DRIVER_COREBOOT, .init = grub_video_cbfb_init, .fini = grub_video_fb_fini, diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c index 93feeb52a..5830b68f8 100644 --- a/grub-core/video/ieee1275.c +++ b/grub-core/video/ieee1275.c @@ -241,6 +241,7 @@ static struct grub_video_adapter grub_video_ieee1275_adapter = .name = "IEEE1275 video driver", .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE, + .id = GRUB_VIDEO_DRIVER_IEEE1275, .init = grub_video_ieee1275_init, .fini = grub_video_ieee1275_fini, diff --git a/include/grub/video.h b/include/grub/video.h index 40a77111d..bd5852e4f 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -283,6 +283,8 @@ typedef enum grub_video_driver_id GRUB_VIDEO_DRIVER_SDL, GRUB_VIDEO_DRIVER_SIS315PRO, GRUB_VIDEO_DRIVER_RADEON_FULOONG2E, + GRUB_VIDEO_DRIVER_COREBOOT, + GRUB_VIDEO_DRIVER_IEEE1275 } grub_video_driver_id_t; typedef enum grub_video_adapter_prio From e343549ca976d95d713fa957b1e986eda8363d8f Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 14:47:14 +0200 Subject: [PATCH 069/187] * grub-core/disk/ata.c (grub_ata_real_open): Use grub_error properly. --- ChangeLog | 4 ++++ grub-core/disk/ata.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index d863bb32a..6d9ffdcc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-24 Vladimir Serbinenko + + * grub-core/disk/ata.c (grub_ata_real_open): Use grub_error properly. + 2013-04-24 Vladimir Serbinenko Add missing video ids to coreboot and ieee1275 video. diff --git a/grub-core/disk/ata.c b/grub-core/disk/ata.c index c84d316e1..dada56d00 100644 --- a/grub-core/disk/ata.c +++ b/grub-core/disk/ata.c @@ -382,6 +382,8 @@ grub_ata_real_open (int id, int bus) err = grub_ata_identify (ata); if (err) { + if (!grub_errno) + grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such ATA device"); grub_free (ata); return NULL; } From 1a40f80c98da574dab206aefd3fffb4dbbcfbf44 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 14:53:00 +0200 Subject: [PATCH 070/187] * grub-core/loader/i386/linux.c (grub_linux_boot): Default to gfxpayload=keep if cbfb is active. --- ChangeLog | 5 +++++ grub-core/loader/i386/linux.c | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d9ffdcc1..58543267b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-24 Vladimir Serbinenko + + * grub-core/loader/i386/linux.c (grub_linux_boot): Default to + gfxpayload=keep if cbfb is active. + 2013-04-24 Vladimir Serbinenko * grub-core/disk/ata.c (grub_ata_real_open): Use grub_error properly. diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index db81ca1cc..106496b86 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -503,15 +503,20 @@ grub_linux_boot (void) #endif grub_free (tmp); } - else - { + else /* We can't go back to text mode from coreboot fb. */ +#ifdef GRUB_MACHINE_COREBOOT + if (grub_video_get_driver_id () == GRUB_VIDEO_DRIVER_COREBOOT) + err = GRUB_ERR_NONE; + else +#endif + { #if ACCEPTS_PURE_TEXT - err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0); + err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0); #else - err = grub_video_set_mode (DEFAULT_VIDEO_MODE, + err = grub_video_set_mode (DEFAULT_VIDEO_MODE, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0); #endif - } + } if (err) { From a59a9826fd56efe350933ef73cba3a42b97a52b9 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 15:07:24 +0200 Subject: [PATCH 071/187] * grub-core/normal/menu_text.c (print_entry): Put an asterisk in front of chosen entry to mark it even if highlighting is lost. --- ChangeLog | 5 +++++ grub-core/normal/menu_text.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 58543267b..7e297888e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-24 Vladimir Serbinenko + + * grub-core/normal/menu_text.c (print_entry): Put an asterisk + in front of chosen entry to mark it even if highlighting is lost. + 2013-04-24 Vladimir Serbinenko * grub-core/loader/i386/linux.c (grub_linux_boot): Default to diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c index 0031b0c1d..e1d3c8fcb 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, || unicode_title[i] == '\r' || unicode_title[i] == '\e') unicode_title[i] = ' '; - for (x = GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1, i = 0; + for (x = GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 2, i = 0; x < (int) (GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (term) - GRUB_TERM_MARGIN);) { @@ -269,6 +269,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, break; } + grub_putcode (highlight ? '*' : ' ', term); + grub_print_ucs4 (unicode_title, unicode_title + last_printed, 0, 0, term); From 1a25e72cf60fc2beb8a7bf12b09f70b150977706 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 15:10:29 +0200 Subject: [PATCH 072/187] * util/grub-install.in: Fix target fo qemu_mips. Fix extension on EFI. --- ChangeLog | 5 +++++ util/grub-install.in | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e297888e..2f55104e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-24 Vladimir Serbinenko + + * util/grub-install.in: Fix target fo qemu_mips. + Fix extension on EFI. + 2013-04-24 Vladimir Serbinenko * grub-core/normal/menu_text.c (print_entry): Put an asterisk diff --git a/util/grub-install.in b/util/grub-install.in index 32a3be361..271e447ef 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -673,13 +673,14 @@ fi case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in sparc64-ieee1275) mkimage_target=sparc64-ieee1275-raw ;; mipsel-loongson) mkimage_target=mipsel-loongson-elf ;; + mips-qemu_mips | mipsel-qemu_mips) mkimage_target="${grub_modinfo_target_cpu}-${grub_modinfo_platform}"-elf ;; *) mkimage_target="${grub_modinfo_target_cpu}-${grub_modinfo_platform}" ;; esac case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in - i386-efi | x86_64-efi) imgext=efi ;; + i386-efi | x86_64-efi | ia64-efi) imgext=efi ;; mipsel-loongson | i386-coreboot | i386-multiboot | i386-ieee1275 \ - | powerpc-ieee1275) imgext=elf ;; + | powerpc-ieee1275 | mips-qemu_mips | mipsel-qemu_mips) imgext=elf ;; *) imgext=img ;; esac From d1989e2e1d3f57048211c5d9def2d31467bb223b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 18:39:00 +0200 Subject: [PATCH 073/187] * grub-core/term/arc/console.c: Assume that console is 80x24 vt100 if it's serial. --- ChangeLog | 5 +++ grub-core/term/arc/console.c | 77 ++++++++++++++++++++++++++++++++++-- include/grub/arc/arc.h | 2 +- 3 files changed, 80 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f55104e8..6c27f76da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-24 Vladimir Serbinenko + + * grub-core/term/arc/console.c: Assume that console is 80x24 vt100 if + it's serial. + 2013-04-24 Vladimir Serbinenko * util/grub-install.in: Fix target fo qemu_mips. diff --git a/grub-core/term/arc/console.c b/grub-core/term/arc/console.c index 0ccaebe0a..13478ea36 100644 --- a/grub-core/term/arc/console.c +++ b/grub-core/term/arc/console.c @@ -50,10 +50,72 @@ put (struct grub_term_output *term __attribute__ ((unused)), const int c) static struct grub_terminfo_output_state grub_console_terminfo_output; -static grub_err_t -grub_console_init_output (struct grub_term_output *term) +static int +check_is_serial (void) +{ + static int is_serial = -1; + + if (is_serial != -1) + return is_serial; + + const char *consout = 0; + + /* Check for serial. It works unless user manually overrides ConsoleOut + variable. If he does there is nothing we can do. Fortunately failure + isn't critical. + */ + if (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmware_vector_length + >= ((char *) (&GRUB_ARC_FIRMWARE_VECTOR->getenvironmentvariable + 1) + - (char *) GRUB_ARC_FIRMWARE_VECTOR) + && GRUB_ARC_FIRMWARE_VECTOR->getenvironmentvariable) + consout = GRUB_ARC_FIRMWARE_VECTOR->getenvironmentvariable ("ConsoleOut"); + if (!consout) + return is_serial = 0; + if (consout[0] == '\0') + return is_serial = 0; + + const char *ptr = consout + grub_strlen (consout) - 1; + int i; + /* + Recognize: + serial(N) + serial(N)other(M) + */ + for (i = 0; i < 2; i++) + { + if (*ptr != ')') + return is_serial = 0; + ptr--; + for (; ptr >= consout && grub_isdigit (*ptr); ptr--); + if (ptr < consout) + return is_serial = 0; + if (*ptr != '(') + return is_serial = 0; + if (ptr >= consout + sizeof ("serial") - 1 + && grub_memcmp (ptr - (sizeof ("serial") - 1), + "serial", sizeof ("serial") - 1) == 0) + return is_serial = 1; + if (!(ptr >= consout + sizeof ("other") - 1 + && grub_memcmp (ptr - (sizeof ("other") - 1), + "other", sizeof ("other") - 1) == 0)) + return is_serial = 0; + ptr -= sizeof ("other"); + } + return 0; +} + +static void +set_console_dimensions (void) { struct grub_arc_display_status *info = NULL; + + if (check_is_serial ()) + { + grub_console_terminfo_output.width = 80; + grub_console_terminfo_output.height = 24; + return; + } + if (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmware_vector_length >= ((char *) (&GRUB_ARC_FIRMWARE_VECTOR->getdisplaystatus + 1) - (char *) GRUB_ARC_FIRMWARE_VECTOR) @@ -64,6 +126,12 @@ grub_console_init_output (struct grub_term_output *term) grub_console_terminfo_output.width = info->w + 1; grub_console_terminfo_output.height = info->h + 1; } +} + +static grub_err_t +grub_console_init_output (struct grub_term_output *term) +{ + set_console_dimensions (); grub_terminfo_output_init (term); return 0; @@ -115,5 +183,8 @@ void grub_console_init_lately (void) { grub_terminfo_init (); - grub_terminfo_output_register (&grub_console_term_output, "arc"); + if (check_is_serial ()) + grub_terminfo_output_register (&grub_console_term_output, "vt100"); + else + grub_terminfo_output_register (&grub_console_term_output, "arc"); } diff --git a/include/grub/arc/arc.h b/include/grub/arc/arc.h index 739926f43..8f865001e 100644 --- a/include/grub/arc/arc.h +++ b/include/grub/arc/arc.h @@ -210,7 +210,7 @@ struct grub_arc_firmware_vector grub_arc_err_t (*seek) (grub_arc_fileno_t fileno, grub_arc_ularge_t *pos, grub_arc_enum_t mode); void *mount; - void *getenvironmentvariable; + const char * (*getenvironmentvariable) (const char *name); void *setenvironmentvariable; /* 0x80. */ From 5e013e56f097d5699a8d18bca189edcd8f3d04c1 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 18:56:47 +0200 Subject: [PATCH 074/187] * util/grub-mkrescue.in: Alias sashARCS as sash. --- ChangeLog | 4 ++++ util/grub-mkrescue.in | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c27f76da..bdaba2bcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-24 Vladimir Serbinenko + + * util/grub-mkrescue.in: Alias sashARCS as sash. + 2013-04-24 Vladimir Serbinenko * grub-core/term/arc/console.c: Assume that console is 80x24 vt100 if diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 634318b68..22b9cf0ab 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -484,10 +484,10 @@ fi make_image "${arcs_dir}" mips-arc "${iso9660_dir}/boot/grub/mips-arc/core.img" "" if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ]; then - grub_mkisofs_arguments="${grub_mkisofs_arguments} /boot/grub/mips-arc/grub=${iso9660_dir}/boot/grub/mips-arc/core.img /boot/grub/mips-arc/sashARCS=${iso9660_dir}/boot/grub/mips-arc/core.img" + grub_mkisofs_arguments="${grub_mkisofs_arguments} /boot/grub/mips-arc/grub=${iso9660_dir}/boot/grub/mips-arc/core.img /boot/grub/mips-arc/sashARCS=${iso9660_dir}/boot/grub/mips-arc/core.img /boot/grub/mips-arc/sash=${iso9660_dir}/boot/grub/mips-arc/core.img" fi if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ] && [ "$system_area" = arcs ]; then - grub_mkisofs_arguments="${grub_mkisofs_arguments} -mips-boot /boot/grub/mips-arc/sashARCS -mips-boot /boot/grub/mips-arc/grub" + grub_mkisofs_arguments="${grub_mkisofs_arguments} -mips-boot /boot/grub/mips-arc/sashARCS -mips-boot /boot/grub/mips-arc/sash -mips-boot /boot/grub/mips-arc/grub" fi make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "pata" From 6aff01075d347d90131ecdc2dbac0e7a518ef6df Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 24 Apr 2013 22:24:28 +0200 Subject: [PATCH 075/187] Make check work on mips-arc. --- ChangeLog | 4 ++++ tests/partmap_test.in | 10 +++++++--- tests/util/grub-shell.in | 7 +++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bdaba2bcf..9f2eccc0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-24 Vladimir Serbinenko + + Make check work on mips-arc. + 2013-04-24 Vladimir Serbinenko * util/grub-mkrescue.in: Alias sashARCS as sash. diff --git a/tests/partmap_test.in b/tests/partmap_test.in index bc503f50d..e8aca2e1d 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -63,21 +63,25 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in powerpc-ieee1275) disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0 qemudisk=hda - # QEMU firmware has bugs which prevent it from accessing hard disk. + # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; sparc64-ieee1275) disk=ieee1275//pci@1fe\,0/pci-ata@5/ide0@500/disk@0 qemudisk=hda - # QEMU firmware has bugs which prevent it from accessing hard disk. + # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; i386-ieee1275) disk=ieee1275/d qemudisk=hdb - # QEMU firmware has bugs which prevent it from accessing hard disk. + # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; + mips-arc) + # ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel. + exit 0 + *) disk=hd0 qemudisk=hda diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 739c300b3..b051669d6 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -85,6 +85,13 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in qemuopts="$qemuopts -M mips" console=vga_text ;; + mips-arc) + boot=cd + qemu=qemu-system-mips64 + qemuopts="$qemuopts -M indy" + console=console + trim=1 + ;; mipsel-qemu_mips) boot=mipsel_qemu qemu=qemu-system-mipsel From 65a6b30b474f7b8704d47157e2aa5e1615cced97 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 25 Apr 2013 00:45:29 +0200 Subject: [PATCH 076/187] * grub-core/term/ieee1275/console.c (grub_console_dimensions): Ignore bogus SLOF values. --- ChangeLog | 5 +++++ grub-core/term/ieee1275/console.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9f2eccc0f..2670946df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-24 Vladimir Serbinenko + + * grub-core/term/ieee1275/console.c (grub_console_dimensions): Ignore + bogus SLOF values. + 2013-04-24 Vladimir Serbinenko Make check work on mips-arc. diff --git a/grub-core/term/ieee1275/console.c b/grub-core/term/ieee1275/console.c index 3a808640e..6bcee5863 100644 --- a/grub-core/term/ieee1275/console.c +++ b/grub-core/term/ieee1275/console.c @@ -123,6 +123,14 @@ grub_console_dimensions (void) } } + /* Bogus default value on SLOF in QEMU. */ + if (grub_console_terminfo_output.width == 200 + && grub_console_terminfo_output.height == 200) + { + grub_console_terminfo_output.width = 80; + grub_console_terminfo_output.height = 24; + } + /* Use a small console by default. */ if (! grub_console_terminfo_output.width) grub_console_terminfo_output.width = 80; From e0810df35e1c37bbc4ec4caf6452d36a3f70971c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 25 Apr 2013 01:36:20 +0200 Subject: [PATCH 077/187] * util/grub-mkrescue.in: Move all files that don't have a location set in stone under /boot/grub. Use ISO hard links rather than copies to save some space. --- ChangeLog | 6 +++++ util/grub-mkrescue.in | 55 ++++++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2670946df..f77a87a7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-25 Vladimir Serbinenko + + * util/grub-mkrescue.in: Move all files that don't have a location + set in stone under /boot/grub. Use ISO hard links rather than copies + to save some space. + 2013-04-24 Vladimir Serbinenko * grub-core/term/ieee1275/console.c (grub_console_dimensions): Ignore diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 22b9cf0ab..e944b899d 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -226,6 +226,7 @@ fi iso9660_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 mkdir -p ${iso9660_dir}/boot/grub +mkdir -p ${iso9660_dir}/boot/grub/roms process_input_dir () { @@ -399,9 +400,9 @@ if test -e "${pc_dir}" ; then fi # build multiboot core.img -make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "pata ahci at_keyboard" +make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/grub/i386-multiboot/core.elf" "pata ahci at_keyboard" -make_image_fwdisk "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/ofwx86.elf" "" +make_image_fwdisk "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/grub/i386-ieee1275/core.elf" "" if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; then efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 @@ -436,8 +437,8 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; th grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img -efi-boot-part --efi-boot-image" fi -make_image_fwdisk "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" "" -if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/powerpc.elf" ]; then +make_image_fwdisk "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/grub/powerpc-ieee1275/core.elf" "" +if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/grub/powerpc-ieee1275/core.elf" ]; then mkdir -p "${iso9660_dir}"/System/Library/CoreServices touch "${iso9660_dir}/mach_kernel" cat > "${iso9660_dir}/System/Library/CoreServices/SystemVersion.plist" < Date: Thu, 25 Apr 2013 02:14:46 +0200 Subject: [PATCH 078/187] * util/grub-mkrescue.in: Fix loongson filename. --- ChangeLog | 4 ++++ util/grub-mkrescue.in | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f77a87a7e..c0eb5efe5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-25 Vladimir Serbinenko + + * util/grub-mkrescue.in: Fix loongson filename. + 2013-04-25 Vladimir Serbinenko * util/grub-mkrescue.in: Move all files that don't have a location diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index e944b899d..78d4bec79 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -496,9 +496,9 @@ if [ -e "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" ] && [ -d "${rom_di cp "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf" fi -make_image "${loongson_dir}" mipsel-loongson-elf "${iso9660_dir}/boot/mipsel-loongson/core.elf" "pata -C xz" -if [ -e "${iso9660_dir}/boot/mipsel-loongson/core.elf" ] && [ -d "${rom_directory}" ]; then - cp "${iso9660_dir}/boot/mipsel-loongson/core.elf" "${rom_directory}/mipsel-loongson.elf" +make_image "${loongson_dir}" mipsel-loongson-elf "${iso9660_dir}/boot/grub/loongson.elf" "pata -C xz" +if [ -e "${iso9660_dir}/boot/grub/loongson.elf" ] && [ -d "${rom_directory}" ]; then + cp "${iso9660_dir}/boot/grub/loongson.elf" "${rom_directory}/mipsel-loongson.elf" fi make_image "${loongson_dir}" mipsel-yeeloong-flash "${iso9660_dir}/boot/grub/roms/mipsel-yeeloong.bin" "pata -C xz" if [ -e "${iso9660_dir}/boot/grub/roms/mipsel-yeeloong.bin" ] && [ -d "${rom_directory}" ]; then From 86eb23bc8f81e4d2093a6595f5084e95b2e1178c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 25 Apr 2013 02:22:20 +0200 Subject: [PATCH 079/187] * tests/partmap_test.in: Add missing double semicolon. --- ChangeLog | 4 ++++ tests/partmap_test.in | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0eb5efe5..e944801c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-25 Vladimir Serbinenko + + * tests/partmap_test.in: Add missing double semicolon. + 2013-04-25 Vladimir Serbinenko * util/grub-mkrescue.in: Fix loongson filename. diff --git a/tests/partmap_test.in b/tests/partmap_test.in index e8aca2e1d..0dea98a37 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -80,8 +80,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in ;; mips-arc) # ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel. - exit 0 - + exit 0 ;; *) disk=hd0 qemudisk=hda From 88d2f3022ef437cdf9e5feefe6ed73bc24b15318 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 25 Apr 2013 03:26:41 +0200 Subject: [PATCH 080/187] * grub-core/boot/powerpc/bootinfo.txt.in: Missing update from previous commit. --- ChangeLog | 5 +++++ grub-core/boot/powerpc/bootinfo.txt.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e944801c6..94dd291cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-25 Vladimir Serbinenko + + * grub-core/boot/powerpc/bootinfo.txt.in: Missing update from previous + commit. + 2013-04-25 Vladimir Serbinenko * tests/partmap_test.in: Add missing double semicolon. diff --git a/grub-core/boot/powerpc/bootinfo.txt.in b/grub-core/boot/powerpc/bootinfo.txt.in index 8d6b3b006..bc831daa9 100644 --- a/grub-core/boot/powerpc/bootinfo.txt.in +++ b/grub-core/boot/powerpc/bootinfo.txt.in @@ -1,7 +1,7 @@ @PACKAGE@ @VERSION@ @PACKAGE@ @VERSION@ -boot &device;:\boot\powerpc.elf +boot &device;:\boot\grub\powerpc.elf FF FF FF FF FF FF FF FF FF FF 92 6D 6D 6D 6D 6D 6D 6D 6D 6D DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6 92 6D 92 92 92 DB FF FF FF FF FF FF FF FF FF FF From b04b5990df15235bd8f0ac1812416c42371998ad Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 25 Apr 2013 22:40:03 +0200 Subject: [PATCH 081/187] Add serial on ARC platform. --- ChangeLog | 4 + docs/grub.texi | 6 +- grub-core/Makefile.am | 1 + grub-core/Makefile.core.def | 2 + grub-core/disk/arc/arcdisk.c | 34 +------- grub-core/kern/mips/arc/init.c | 39 +++++++++ grub-core/term/arc/console.c | 81 +++++++++++------- grub-core/term/arc/serial.c | 147 +++++++++++++++++++++++++++++++++ grub-core/term/serial.c | 9 +- include/grub/arc/arc.h | 11 +++ include/grub/serial.h | 16 ++++ 11 files changed, 279 insertions(+), 71 deletions(-) create mode 100644 grub-core/term/arc/serial.c diff --git a/ChangeLog b/ChangeLog index 94dd291cc..7f2c4dd75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-25 Vladimir Serbinenko + + Add serial on ARC platform. + 2013-04-25 Vladimir Serbinenko * grub-core/boot/powerpc/bootinfo.txt.in: Missing update from previous diff --git a/docs/grub.texi b/docs/grub.texi index 87d19ea74..920a55850 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -4729,8 +4729,7 @@ ARC platform is unable to change datetime (firmware doesn't seem to provide a function for it). EMU has similar limitation. -ARC platform no serial port is available. -EMU has similar limitation. +On EMU platform no serial port is available. Console charset refers only to firmware-assisted console. gfxterm is always Unicode (see Internationalisation section for its limitations). Serial is @@ -4747,9 +4746,6 @@ the actual console may be much more limited depending on firmware On BIOS network is supported only if the image is loaded through network. On sparc64 GRUB is unable to determine which server it was booted from. -On platforms not having direct serial support (as indicated in the line serial) -you can still redirect firmware console to serial if it allows so. - Direct ATA/AHCI support allows to circumvent various firmware limitations but isn't needed for normal operation except on baremetal ports. diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 6f156e75d..07aad5086 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -151,6 +151,7 @@ endif if COND_mips_arc KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h endif if COND_mips_qemu_mips diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 8f36ea0f2..cdef5b40f 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1661,10 +1661,12 @@ module = { common = term/serial.c; x86 = term/ns8250.c; ieee1275 = term/ieee1275/serial.c; + mips_arc = term/arc/serial.c; efi = term/efi/serial.c; enable = terminfomodule; enable = ieee1275; + enable = mips_arc; }; module = { diff --git a/grub-core/disk/arc/arcdisk.c b/grub-core/disk/arc/arcdisk.c index 780728f68..9aefb7c3f 100644 --- a/grub-core/disk/arc/arcdisk.c +++ b/grub-core/disk/arc/arcdisk.c @@ -153,9 +153,7 @@ reopen (const char *name, int writable) static grub_err_t grub_arcdisk_open (const char *name, grub_disk_t disk) { - char *fullname, *optr; - const char *iptr; - int state = 0; + char *fullname; grub_err_t err; grub_arc_err_t r; struct grub_arc_fileinfo info; @@ -163,35 +161,7 @@ grub_arcdisk_open (const char *name, grub_disk_t disk) if (grub_memcmp (name, "arc/", 4) != 0) return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not arc device"); - fullname = grub_malloc (2 * grub_strlen (name) + sizeof (RAW_SUFFIX)); - if (!fullname) - return grub_errno; - optr = fullname; - for (iptr = name + 4; *iptr; iptr++) - if (state == 0) - { - if (!grub_isdigit (*iptr)) - *optr++ = *iptr; - else - { - *optr++ = '('; - *optr++ = *iptr; - state = 1; - } - } - else - { - if (grub_isdigit (*iptr)) - *optr++ = *iptr; - else - { - *optr++ = ')'; - state = 0; - } - } - if (state) - *optr++ = ')'; - grub_memcpy (optr, RAW_SUFFIX, sizeof (RAW_SUFFIX)); + fullname = grub_arc_alt_name_to_norm (name, RAW_SUFFIX); disk->data = fullname; grub_dprintf ("arcdisk", "opening %s\n", fullname); diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c index 011c63fe0..92a287754 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -125,6 +125,45 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data) } } +char * +grub_arc_alt_name_to_norm (const char *name, const char *suffix) +{ + char *optr; + const char *iptr; + char * ret = grub_malloc (2 * grub_strlen (name) + grub_strlen (suffix)); + int state = 0; + + if (!ret) + return NULL; + optr = ret; + for (iptr = name + 4; *iptr; iptr++) + if (state == 0) + { + if (!grub_isdigit (*iptr)) + *optr++ = *iptr; + else + { + *optr++ = '('; + *optr++ = *iptr; + state = 1; + } + } + else + { + if (grub_isdigit (*iptr)) + *optr++ = *iptr; + else + { + *optr++ = ')'; + state = 0; + } + } + if (state) + *optr++ = ')'; + grub_strcpy (optr, suffix); + return ret; +} + extern grub_uint32_t grub_total_modules_size __attribute__ ((section(".text"))); grub_addr_t grub_modbase; diff --git a/grub-core/term/arc/console.c b/grub-core/term/arc/console.c index 13478ea36..ea4737cb4 100644 --- a/grub-core/term/arc/console.c +++ b/grub-core/term/arc/console.c @@ -50,6 +50,55 @@ put (struct grub_term_output *term __attribute__ ((unused)), const int c) static struct grub_terminfo_output_state grub_console_terminfo_output; +int +grub_arc_is_device_serial (const char *name, int alt_names) +{ + if (name[0] == '\0') + return 0; + + const char *ptr = name + grub_strlen (name) - 1; + int i; + /* + Recognize: + serial(N) + serial(N)other(M) + */ + for (i = 0; i < 2; i++) + { + if (!alt_names) + { + if (*ptr != ')') + return 0; + ptr--; + } + for (; ptr >= name && grub_isdigit (*ptr); ptr--); + if (ptr < name) + return 0; + if (!alt_names) + { + if (*ptr != '(') + return 0; + ptr--; + } + if (ptr + 1 >= name + sizeof ("serial") - 1 + && grub_memcmp (ptr + 1 - (sizeof ("serial") - 1), + "serial", sizeof ("serial") - 1) == 0) + return 1; + if (!(ptr + 1 >= name + sizeof ("other") - 1 + && grub_memcmp (ptr + 1 - (sizeof ("other") - 1), + "other", sizeof ("other") - 1) == 0)) + return 0; + ptr -= sizeof ("other") - 1; + if (alt_names) + { + if (*ptr != '/') + return 0; + ptr--; + } + } + return 0; +} + static int check_is_serial (void) { @@ -71,37 +120,7 @@ check_is_serial (void) consout = GRUB_ARC_FIRMWARE_VECTOR->getenvironmentvariable ("ConsoleOut"); if (!consout) return is_serial = 0; - if (consout[0] == '\0') - return is_serial = 0; - - const char *ptr = consout + grub_strlen (consout) - 1; - int i; - /* - Recognize: - serial(N) - serial(N)other(M) - */ - for (i = 0; i < 2; i++) - { - if (*ptr != ')') - return is_serial = 0; - ptr--; - for (; ptr >= consout && grub_isdigit (*ptr); ptr--); - if (ptr < consout) - return is_serial = 0; - if (*ptr != '(') - return is_serial = 0; - if (ptr >= consout + sizeof ("serial") - 1 - && grub_memcmp (ptr - (sizeof ("serial") - 1), - "serial", sizeof ("serial") - 1) == 0) - return is_serial = 1; - if (!(ptr >= consout + sizeof ("other") - 1 - && grub_memcmp (ptr - (sizeof ("other") - 1), - "other", sizeof ("other") - 1) == 0)) - return is_serial = 0; - ptr -= sizeof ("other"); - } - return 0; + return is_serial = grub_arc_is_device_serial (consout, 0); } static void diff --git a/grub-core/term/arc/serial.c b/grub-core/term/arc/serial.c new file mode 100644 index 000000000..87d1ce821 --- /dev/null +++ b/grub-core/term/arc/serial.c @@ -0,0 +1,147 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +static void +do_real_config (struct grub_serial_port *port) +{ + char *name; + if (port->configured) + return; + + name = grub_arc_alt_name_to_norm (port->name, ""); + + if (GRUB_ARC_FIRMWARE_VECTOR->open (name,GRUB_ARC_FILE_ACCESS_OPEN_RW, + &port->handle)) + port->handle_valid = 0; + else + port->handle_valid = 1; + + port->configured = 1; +} + +/* Fetch a key. */ +static int +serial_hw_fetch (struct grub_serial_port *port) +{ + unsigned long actual; + char c; + + do_real_config (port); + + if (!port->handle_valid) + return -1; + if (GRUB_ARC_FIRMWARE_VECTOR->read (port->handle, &c, + 1, &actual) || actual <= 0) + return -1; + return c; +} + +/* Put a character. */ +static void +serial_hw_put (struct grub_serial_port *port, const int c) +{ + unsigned long actual; + char c0 = c; + + do_real_config (port); + + if (!port->handle_valid) + return; + + GRUB_ARC_FIRMWARE_VECTOR->write (port->handle, &c0, + 1, &actual); +} + +/* Initialize a serial device. PORT is the port number for a serial device. + SPEED is a DTE-DTE speed which must be one of these: 2400, 4800, 9600, + 19200, 38400, 57600 and 115200. WORD_LEN is the word length to be used + for the device. Likewise, PARITY is the type of the parity and + STOP_BIT_LEN is the length of the stop bit. The possible values for + WORD_LEN, PARITY and STOP_BIT_LEN are defined in the header file as + macros. */ +static grub_err_t +serial_hw_configure (struct grub_serial_port *port __attribute__ ((unused)), + struct grub_serial_config *config __attribute__ ((unused))) +{ + /* FIXME: no ARC serial config available. */ + + return GRUB_ERR_NONE; +} + +struct grub_serial_driver grub_arcserial_driver = + { + .configure = serial_hw_configure, + .fetch = serial_hw_fetch, + .put = serial_hw_put + }; + +const char * +grub_arcserial_add_port (const char *path) +{ + struct grub_serial_port *port; + grub_err_t err; + + port = grub_zalloc (sizeof (*port)); + if (!port) + return NULL; + port->name = grub_strdup (path); + if (!port->name) + return NULL; + + port->driver = &grub_arcserial_driver; + err = grub_serial_config_defaults (port); + if (err) + grub_print_error (); + + grub_serial_register (port); + + return port->name; +} + +static int +dev_iterate (const char *name, + const struct grub_arc_component *comp __attribute__ ((unused)), + void *data __attribute__ ((unused))) +{ + /* We should check consolein/consoleout flags as + well but some implementations are buggy. */ + if ((comp->flags & (GRUB_ARC_COMPONENT_FLAG_IN | GRUB_ARC_COMPONENT_FLAG_OUT)) + != (GRUB_ARC_COMPONENT_FLAG_IN | GRUB_ARC_COMPONENT_FLAG_OUT)) + return 0; + if (!grub_arc_is_device_serial (name, 1)) + return 0; + grub_arcserial_add_port (name); + return 0; +} + +void +grub_arcserial_init (void) +{ + grub_arc_iterate_devs (dev_iterate, 0, 1); +} + diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c index 96f9d7f29..61cd80a9c 100644 --- a/grub-core/term/serial.c +++ b/grub-core/term/serial.c @@ -137,7 +137,7 @@ grub_serial_find (const char *name) if (grub_strcmp (port->name, name) == 0) break; -#if (defined(__mips__) || defined (__i386__) || defined (__x86_64__)) && !defined(GRUB_MACHINE_EMU) +#if (defined(__mips__) || defined (__i386__) || defined (__x86_64__)) && !defined(GRUB_MACHINE_EMU) && !defined(GRUB_MACHINE_ARC) if (!port && grub_memcmp (name, "port", sizeof ("port") - 1) == 0 && grub_isxdigit (name [sizeof ("port") - 1])) { @@ -242,7 +242,7 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) err = port->driver->configure (port, &config); if (err) return err; -#if !defined (GRUB_MACHINE_EMU) && (defined(__mips__) || defined (__i386__) || defined (__x86_64__)) +#if !defined (GRUB_MACHINE_EMU) && !defined(GRUB_MACHINE_ARC) && (defined(__mips__) || defined (__i386__) || defined (__x86_64__)) /* Compatibility kludge. */ if (port->driver == &grub_ns8250_driver) @@ -396,7 +396,7 @@ GRUB_MOD_INIT(serial) &grub_serial_terminfo_input_template, sizeof (grub_serial_terminfo_input)); -#if !defined (GRUB_MACHINE_EMU) && (defined(__mips__) || defined (__i386__) || defined (__x86_64__)) +#if !defined (GRUB_MACHINE_EMU) && !defined(GRUB_MACHINE_ARC) && (defined(__mips__) || defined (__i386__) || defined (__x86_64__)) grub_ns8250_init (); #endif #ifdef GRUB_MACHINE_IEEE1275 @@ -405,6 +405,9 @@ GRUB_MOD_INIT(serial) #ifdef GRUB_MACHINE_EFI grub_efiserial_init (); #endif +#ifdef GRUB_MACHINE_ARC + grub_arcserial_init (); +#endif } #if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) diff --git a/include/grub/arc/arc.h b/include/grub/arc/arc.h index 8f865001e..c2578f415 100644 --- a/include/grub/arc/arc.h +++ b/include/grub/arc/arc.h @@ -79,6 +79,12 @@ struct grub_arc_display_status grub_arc_uchar_t reverse_video; }; +enum + { + GRUB_ARC_COMPONENT_FLAG_OUT = 0x40, + GRUB_ARC_COMPONENT_FLAG_IN = 0x20, + }; + struct grub_arc_component { grub_arc_enum_t class; @@ -262,6 +268,11 @@ int EXPORT_FUNC (grub_arc_iterate_devs) (grub_arc_iterate_devs_hook_t hook, void *hook_data, int alt_names); +char *EXPORT_FUNC (grub_arc_alt_name_to_norm) (const char *name, const char *suffix); + +int EXPORT_FUNC (grub_arc_is_device_serial) (const char *name, int alt_names); + + #define FOR_ARC_CHILDREN(comp, parent) for (comp = GRUB_ARC_FIRMWARE_VECTOR->getchild (parent); comp; comp = GRUB_ARC_FIRMWARE_VECTOR->getpeer (comp)) extern void grub_arcdisk_init (void); diff --git a/include/grub/serial.h b/include/grub/serial.h index 32f507c6e..20840d04b 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -30,6 +30,9 @@ #ifdef GRUB_MACHINE_IEEE1275 #include #endif +#ifdef GRUB_MACHINE_ARC +#include +#endif struct grub_serial_port; struct grub_serial_config; @@ -104,6 +107,13 @@ struct grub_serial_port #endif #ifdef GRUB_MACHINE_EFI struct grub_efi_serial_io_interface *interface; +#endif +#ifdef GRUB_MACHINE_ARC + struct + { + grub_arc_fileno_t handle; + int handle_valid; + }; #endif }; grub_term_output_t term_out; @@ -170,6 +180,12 @@ void grub_ofserial_init (void); void grub_efiserial_init (void); #endif +#ifdef GRUB_MACHINE_ARC +void +grub_arcserial_init (void); +const char * +grub_arcserial_add_port (const char *path); +#endif struct grub_serial_port *grub_serial_find (const char *name); extern struct grub_serial_driver grub_ns8250_driver; From 7f63a64fa03ae04c5c7e435079aa11a7e9554049 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 25 Apr 2013 22:42:35 +0200 Subject: [PATCH 082/187] Enable mipsel-arc. --- ChangeLog | 4 ++++ configure.ac | 20 +++++++++++++++++++- grub-core/Makefile.core.def | 10 +++------- grub-core/disk/arc/arcdisk.c | 4 ++++ include/grub/mips/arc/memory.h | 4 ++++ include/grub/offsets.h | 6 +++++- tests/grub_cmd_date.in | 3 ++- tests/partmap_test.in | 4 ++++ tests/util/grub-shell.in | 9 +++++++++ util/grub-mkimage.c | 30 ++++++++++++++++++++++++++++-- util/grub-mkrescue.in | 8 ++++++++ 11 files changed, 90 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f2c4dd75..0bc5cc4d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-25 Vladimir Serbinenko + + Enable mipsel-arc. + 2013-04-25 Vladimir Serbinenko Add serial on ARC platform. diff --git a/configure.ac b/configure.ac index ca180c6bd..4af1a0376 100644 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,7 @@ case "$target_cpu"-"$platform" in mips-qemu_mips) ;; mips-qemu-mips) platform=qemu_mips;; mips-arc) ;; + mipsel-arc) ;; mipsel-qemu_mips) ;; mipsel-qemu-mips) platform=qemu_mips;; mipsel-yeeloong) platform=loongson ;; @@ -198,6 +199,23 @@ else machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1" fi +case "${target_cpu}-$platform" in + mips-arc) + TARGET_LINK_ADDR=0x88200000 + TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000 + ;; + mipsel-arc) + TARGET_LINK_ADDR=0x80700000 + TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000 + ;; + mips*-qemu_mips | mips-loongson) + TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000 + ;; +esac + +AC_SUBST(TARGET_LINK_ADDR) +AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR) + TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS" AC_SUBST(host_cpu) @@ -1146,7 +1164,7 @@ AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson]) AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips]) -AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc]) +AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc]) AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel]) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index cdef5b40f..ad912a648 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -73,7 +73,7 @@ kernel = { mips_loongson_ldflags = '-Wl,-Ttext,0x80200000'; powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000'; sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400'; - mips_arc_ldflags = '-Wl,-Ttext,0x88200000'; + mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)'; mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000'; mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK'; @@ -370,9 +370,7 @@ image = { cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1'; objcopyflags = '-O binary'; - mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; - mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; - mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000'; + mips_ldflags = '-static-libgcc -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; ldadd = '-lgcc'; cflags = '-Wno-unreachable-code -static-libgcc'; enable = mips; @@ -386,9 +384,7 @@ image = { cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1'; objcopyflags = '-O binary'; - mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; - mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000'; - mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000'; + mips_ldflags = '-static-libgcc -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; ldadd = '-lgcc'; cflags = '-static-libgcc'; enable = mips; diff --git a/grub-core/disk/arc/arcdisk.c b/grub-core/disk/arc/arcdisk.c index 9aefb7c3f..0cc1993e5 100644 --- a/grub-core/disk/arc/arcdisk.c +++ b/grub-core/disk/arc/arcdisk.c @@ -113,7 +113,11 @@ grub_arcdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, return grub_arc_iterate_devs (grub_arcdisk_iterate_iter, &ctx, 1); } +#ifdef GRUB_CPU_MIPSEL +#define RAW_SUFFIX "partition(0)" +#else #define RAW_SUFFIX "partition(10)" +#endif static grub_err_t reopen (const char *name, int writable) diff --git a/include/grub/mips/arc/memory.h b/include/grub/mips/arc/memory.h index 68b425f75..77bb03d3e 100644 --- a/include/grub/mips/arc/memory.h +++ b/include/grub/mips/arc/memory.h @@ -19,7 +19,11 @@ #ifndef GRUB_MEMORY_MACHINE_HEADER #define GRUB_MEMORY_MACHINE_HEADER 1 +#ifdef GRUB_CPU_MIPSEL +#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x806ffff0 +#else #define GRUB_MACHINE_MEMORY_STACK_HIGH 0x881ffff0 +#endif #ifndef ASM_FILE diff --git a/include/grub/offsets.h b/include/grub/offsets.h index 1e673d522..c5ef79f7a 100644 --- a/include/grub/offsets.h +++ b/include/grub/offsets.h @@ -81,7 +81,7 @@ #define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08 #define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x88200000 - +#define GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR 0x80700000 #define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32 #define GRUB_DECOMPRESSOR_MIPS_ARC_COMPRESSED_SIZE 0x8 @@ -125,7 +125,11 @@ #define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG) #define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER) +#if defined (GRUB_MACHINE_ARC) && defined (GRUB_CPU_MIPSEL) +#define GRUB_MACHINE_LINK_ADDR GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR +#else #define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR) +#endif #define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE) #define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_SIZE) diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in index 76436a016..effc82a21 100644 --- a/tests/grub_cmd_date.in +++ b/tests/grub_cmd_date.in @@ -4,7 +4,8 @@ set -e . "@builddir@/grub-core/modinfo.sh" # OpenBIOS on sparc64 doesn't implement RTC -if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then +# mipsel-arc QEMU emulated RTC doesn't play well with firmware +if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mipsel-arc ]; then exit 0 fi diff --git a/tests/partmap_test.in b/tests/partmap_test.in index 0dea98a37..ee23f7f45 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -81,6 +81,10 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in mips-arc) # ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel. exit 0 ;; + mipsel-arc) + disk=arc/scsi0/disk0/rdisk0 + qemudisk=hda + ;; *) disk=hd0 qemudisk=hda diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index b051669d6..ccea33266 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -92,6 +92,15 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in console=console trim=1 ;; + mipsel-arc) + boot=cd + qemu=qemu-system-mips64el + qemuopts="$qemuopts -M magnum -no-reboot" + serial_port=arc/multi0/serial0 + console=console + halt_cmd=reboot + trim=1 + ;; mipsel-qemu_mips) boot=mipsel_qemu qemu=qemu-system-mipsel diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index 41f795aab..7edf77a3f 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -399,6 +399,24 @@ struct image_target_desc image_targets[] = .link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN, .default_compression = COMPRESSION_NONE }, + { + .dirname = "mipsel-arc", + .names = {"mipsel-arc", NULL}, + .voidp_sizeof = 4, + .bigendian = 0, + .id = IMAGE_MIPS_ARC, + .flags = PLATFORM_FLAGS_DECOMPRESSORS, + .total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE, + .decompressor_compressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE, + .decompressor_uncompressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE, + .decompressor_uncompressed_addr = GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_ADDR, + .section_align = 1, + .vaddr_offset = 0, + .link_addr = GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR, + .elf_target = EM_MIPS, + .link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN, + .default_compression = COMPRESSION_NONE + }, { .dirname = "mipsel-qemu_mips", .names = { "mipsel-qemu_mips-elf", NULL }, @@ -1530,11 +1548,14 @@ generate_image (const char *dir, const char *prefix, grub_memset (ecoff_img, 0, program_size + sizeof (*head) + sizeof (*section)); head = (void *) ecoff_img; section = (void *) (head + 1); - head->magic = grub_host_to_target16 (0x160); + head->magic = image_target->bigendian ? grub_host_to_target16 (0x160) + : grub_host_to_target16 (0x166); head->nsec = grub_host_to_target16 (1); head->time = grub_host_to_target32 (0); head->opt = grub_host_to_target16 (0x38); - head->flags = grub_host_to_target16 (0x207); + head->flags = image_target->bigendian + ? grub_host_to_target16 (0x207) + : grub_host_to_target16 (0x103); head->magic2 = grub_host_to_target16 (0x107); head->textsize = grub_host_to_target32 (program_size); head->entry = grub_host_to_target32 (target_addr); @@ -1544,6 +1565,11 @@ generate_image (const char *dir, const char *prefix, section->vaddr = grub_host_to_target32 (target_addr); section->size = grub_host_to_target32 (program_size); section->file_offset = grub_host_to_target32 (sizeof (*head) + sizeof (*section)); + if (!image_target->bigendian) + { + section->paddr = grub_host_to_target32 (0xaa60); + section->flags = grub_host_to_target32 (0x20); + } memcpy (section + 1, core_img, core_size); free (core_img); core_img = ecoff_img; diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 78d4bec79..51e75e8a7 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -46,6 +46,7 @@ efi64_dir="${libdir}/@PACKAGE@/x86_64-efi" ia64_dir="${libdir}/@PACKAGE@/ia64-efi" sparc64_dir="${libdir}/@PACKAGE@/sparc64-ieee1275" arcs_dir="${libdir}/@PACKAGE@/mips-arc" +arc_dir="${libdir}/@PACKAGE@/mipsel-arc" ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" rom_directory= override_dir= @@ -325,6 +326,9 @@ if [ "${override_dir}" = "" ] ; then if test -e "${arcs_dir}" ; then process_input_dir "${arcs_dir}" mips-arc fi + if test -e "${arc_dir}" ; then + process_input_dir "${arc_dir}" mipsel-arc + fi else . "${override_dir}"/modinfo.sh process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform} @@ -342,6 +346,7 @@ else i386_ieee1275_dir= sparc64_dir= arcs_dir= + arc_dir= case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-multiboot) multiboot_dir="${override_dir}" ;; i386-coreboot) coreboot_dir="${override_dir}" ;; @@ -356,6 +361,7 @@ else powerpc-ieee1275) ppc_dir="${override_dir}"; system_area=common ;; sparc64-ieee1275) sparc64_dir="${override_dir}"; system_area=sparc64 ;; mips-arc) arcs_dir="${override_dir}"; system_area=arcs ;; + mipsel-arc) arc_dir="${override_dir}" ;; i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;; esac fi @@ -491,6 +497,8 @@ if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ] && [ "$system_area" = arc grub_mkisofs_arguments="${grub_mkisofs_arguments} -mips-boot /boot/grub/mips-arc/sashARCS -mips-boot /boot/grub/mips-arc/sash -mips-boot /boot/grub/mips-arc/grub" fi +make_image "${arc_dir}" mipsel-arc "${iso9660_dir}/boot/grub/arc.exe" "" + make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" "pata" if [ -e "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then cp "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf" From 5fe67f3911d5110217954a5554c51f84d0b39161 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 26 Apr 2013 11:26:08 +0200 Subject: [PATCH 083/187] * configure.ac: Fix loongson conditional. --- ChangeLog | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0bc5cc4d6..f3d135238 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-26 Vladimir Serbinenko + + * configure.ac: Fix loongson conditional. + 2013-04-25 Vladimir Serbinenko Enable mipsel-arc. diff --git a/configure.ac b/configure.ac index 4af1a0376..7d3aeac9c 100644 --- a/configure.ac +++ b/configure.ac @@ -208,7 +208,7 @@ case "${target_cpu}-$platform" in TARGET_LINK_ADDR=0x80700000 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000 ;; - mips*-qemu_mips | mips-loongson) + mips*-qemu_mips | mips*-loongson) TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000 ;; esac From c4b456d34755dcedbe0ecd4047ca05d02acb2cb4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 26 Apr 2013 11:27:24 +0200 Subject: [PATCH 084/187] * util/grub-mkrescue.in: Rename i386-ieee1275 core image due to ofw limited ISO support. --- ChangeLog | 5 +++++ util/grub-mkrescue.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f3d135238..6e007d58a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-26 Vladimir Serbinenko + + * util/grub-mkrescue.in: Rename i386-ieee1275 core image due to + ofw limited ISO support. + 2013-04-26 Vladimir Serbinenko * configure.ac: Fix loongson conditional. diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 51e75e8a7..cc072c2ae 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -408,7 +408,7 @@ fi # build multiboot core.img make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/grub/i386-multiboot/core.elf" "pata ahci at_keyboard" -make_image_fwdisk "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/grub/i386-ieee1275/core.elf" "" +make_image_fwdisk "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/grub/ofwx86.elf" "" if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; then efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 From f93e89ef90d954bc7abf155fa23805fc3218f948 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 26 Apr 2013 14:33:31 +0200 Subject: [PATCH 085/187] Add test to check that different boot mediums work. --- ChangeLog | 4 ++++ Makefile.am | 38 +++++++++++++++---------------- Makefile.util.def | 48 +++++++++++++++++++++++++++++++++++++++ tests/cdboot_test.in | 36 +++++++++++++++++++++++++++++ tests/fddboot_test.in | 48 +++++++++++++++++++++++++++++++++++++++ tests/grub_cmd_date.in | 5 ++-- tests/gzcompress_test.in | 24 ++++++++++++++++++++ tests/hddboot_test.in | 37 ++++++++++++++++++++++++++++++ tests/lzocompress_test.in | 24 ++++++++++++++++++++ tests/netboot_test.in | 42 ++++++++++++++++++++++++++++++++++ tests/partmap_test.in | 8 +++---- tests/util/grub-shell.in | 48 +++++++++++++++++++++++++++++++++------ tests/xzcompress_test.in | 24 ++++++++++++++++++++ 13 files changed, 353 insertions(+), 33 deletions(-) create mode 100644 tests/cdboot_test.in create mode 100644 tests/fddboot_test.in create mode 100644 tests/gzcompress_test.in create mode 100644 tests/hddboot_test.in create mode 100644 tests/lzocompress_test.in create mode 100644 tests/netboot_test.in create mode 100644 tests/xzcompress_test.in diff --git a/ChangeLog b/ChangeLog index 6e007d58a..19a1cf6cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-26 Vladimir Serbinenko + + Add test to check that different boot mediums work. + 2013-04-26 Vladimir Serbinenko * util/grub-mkrescue.in: Rename i386-ieee1275 core image due to diff --git a/Makefile.am b/Makefile.am index 9d38405af..9889023e1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -261,70 +261,70 @@ kfreebsd-mfsroot.i386.gz: kfreebsd-mfsroot.i386.img gzip < $< > $@ bootcheck-kfreebsd-i386: kfreebsd-mfsroot.i386.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.i386 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null kfreebsd-mfsroot.x86_64.gz: kfreebsd-mfsroot.x86_64.img gzip < $< > $@ bootcheck-kfreebsd-x86_64: kfreebsd-mfsroot.x86_64.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null knetbsd.miniroot-image.i386.gz: knetbsd.miniroot-image.i386.img gzip < $< > $@ bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-kopenbsd-i386: kopenbsd.image.i386 $(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-kopenbsd-x86_64: kopenbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null knetbsd.miniroot-image.x86_64.gz: knetbsd.miniroot-image.x86_64.img gzip < $< > $@ bootcheck-knetbsd-x86_64: knetbsd.miniroot-image.x86_64.gz $(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-mips: linux-initramfs.mips $(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-ppc: linux-initramfs.ppc $(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-mipsel: linux-initramfs.mipsel $(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-loongson: linux-initramfs.loongson $(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.loongson --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.loongson --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux16-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux16-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-multiboot: multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-multiboot2: multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-kfreebsd-aout: kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-pc-chainloader: pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-ntldr: ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + ./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null if COND_i386_efi BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386 diff --git a/Makefile.util.def b/Makefile.util.def index 4fa37bcb6..1b71fd07f 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -688,6 +688,54 @@ script = { common = tests/partmap_test.in; }; +script = { + testcase; + name = hddboot_test; + common = tests/hddboot_test.in; +}; + +script = { + testcase; + name = fddboot_test; + common = tests/fddboot_test.in; +}; + +script = { + testcase; + name = cdboot_test; + common = tests/cdboot_test.in; +}; + +script = { + testcase; + name = netboot_test; + common = tests/netboot_test.in; +}; + +script = { + testcase; + name = pseries_test; + common = tests/pseries_test.in; +}; + +script = { + testcase; + name = xzcompress_test; + common = tests/xzcompress_test.in; +}; + +script = { + testcase; + name = gzcompress_test; + common = tests/gzcompress_test.in; +}; + +script = { + testcase; + name = lzocompress_test; + common = tests/lzocompress_test.in; +}; + script = { testcase; name = grub_cmd_echo; diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in new file mode 100644 index 000000000..d9a5fb80e --- /dev/null +++ b/tests/cdboot_test.in @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # Flash targets + i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) + exit 0;; + # FIXME: currently grub-shell uses only -kernel for loongson + mipsel-loongson) + exit 0;; + # FIXME: OFW fails to open CD-ROM + i386-ieee1275) + exit 0;; +esac + +if [ "$(echo hello | "${grubshell}" --boot=cd)" != "Hello World" ]; then + exit 1 +fi diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in new file mode 100644 index 000000000..77340251a --- /dev/null +++ b/tests/fddboot_test.in @@ -0,0 +1,48 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # Flash targets + i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) + exit 0;; + # FIXME: currently grub-shell uses only -kernel for loongson + mipsel-loongson) + exit 0;; + # FIXME: We don't support EFI floppy boot in grub-mkrescue + *-efi) + exit 0;; + # FIXME: no floppy support + i386-multiboot) + exit 0;; + # FIXME: QEMU firmware crashes when trying to boot from floppy + sparc64-ieee1275) + exit 0;; + # FIXME: QEMU doesn't emulate SCSI floppies + mipsel-arc | mips-arc) + exit 0;; + # powerpc doesn't boot from floppy except OldWorld Macs which we don't support anyway + powerpc-ieee1275) + exit 0;; +esac + +if [ "$(echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes=")" != "Hello World" ]; then + exit 1 +fi diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in index effc82a21..0417c67ef 100644 --- a/tests/grub_cmd_date.in +++ b/tests/grub_cmd_date.in @@ -3,9 +3,8 @@ set -e . "@builddir@/grub-core/modinfo.sh" -# OpenBIOS on sparc64 doesn't implement RTC -# mipsel-arc QEMU emulated RTC doesn't play well with firmware -if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mipsel-arc ]; then +# FIXME: OpenBIOS on sparc64 doesn't implement RTC +if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then exit 0 fi diff --git a/tests/gzcompress_test.in b/tests/gzcompress_test.in new file mode 100644 index 000000000..5cc352eef --- /dev/null +++ b/tests/gzcompress_test.in @@ -0,0 +1,24 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=gz)" != "Hello World" ]; then + exit 1 +fi diff --git a/tests/hddboot_test.in b/tests/hddboot_test.in new file mode 100644 index 000000000..e76f99671 --- /dev/null +++ b/tests/hddboot_test.in @@ -0,0 +1,37 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # Flash targets + i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) + exit 0;; + # FIXME: currently grub-shell uses only -kernel for loongson + mipsel-loongson) + exit 0;; + # FIXME: OVMF skips HDDs for automatic boot and has no USB support + *-efi) + exit 0;; +esac + +if [ "$(echo hello | "${grubshell}" --boot=hd)" != "Hello World" ]; then + exit 1 +fi + diff --git a/tests/lzocompress_test.in b/tests/lzocompress_test.in new file mode 100644 index 000000000..54428c33b --- /dev/null +++ b/tests/lzocompress_test.in @@ -0,0 +1,24 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo)" != "Hello World" ]; then + exit 1 +fi diff --git a/tests/netboot_test.in b/tests/netboot_test.in new file mode 100644 index 000000000..8e3f8c9b2 --- /dev/null +++ b/tests/netboot_test.in @@ -0,0 +1,42 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # Flash targets + i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) + exit 0;; + # FIXME: currently grub-shell uses only -kernel for loongson + mipsel-loongson) + exit 0;; + # FIXME: no rtl8139 support + i386-multiboot) + exit 0;; + # FIXME: We don't fully support netboot on ARC + *-arc) + exit 0;; + # FIXME: Many QEMU firmware have no netboot capability + *-efi | i386-ieee1275 | powerpc-ieee1275 | sparc64-ieee1275) + exit 0;; +esac + +if [ "$(echo hello | "${grubshell}" --boot=net)" != "Hello World" ]; then + exit 1 +fi diff --git a/tests/partmap_test.in b/tests/partmap_test.in index ee23f7f45..b222fa139 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -63,23 +63,23 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in powerpc-ieee1275) disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0 qemudisk=hda - # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. + # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; sparc64-ieee1275) disk=ieee1275//pci@1fe\,0/pci-ata@5/ide0@500/disk@0 qemudisk=hda - # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. + # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; i386-ieee1275) disk=ieee1275/d qemudisk=hdb - # QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. + # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; mips-arc) - # ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel. + # FIXME: ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel. exit 0 ;; mipsel-arc) disk=arc/scsi0/disk0/rdisk0 diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index ccea33266..fc52e7b80 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -41,11 +41,13 @@ Run GRUB script in a Qemu instance. -h, --help print this message and exit -v, --version print the version information and exit - --boot=[fd|hd|cd|net] boot method for Qemu instance + --boot=[fd|hd|cd|net] boot method for Qemu instance --modules=MODULES pre-load specified modules MODULES --qemu=FILE Name of qemu binary --qemu-opts=OPTIONS extra options to pass to Qemu instance --files=FILES add files to the image + --mkrescue-arg=ARGS additional arguments to grub-mkrescue + --timeout=SECONDS set timeout --trim trim firmware output $0 runs input GRUB script or SOURCE file in a Qemu instance and prints @@ -60,6 +62,7 @@ qemuopts="${GRUB_QEMU_OPTS}" serial_port=com0 serial_null= halt_cmd=halt +pseries=n case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in powerpc-ieee1275) boot=cd @@ -67,6 +70,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in console=console serial_port=escc-ch-a serial_null="-serial null" + netbootext=elf ;; sparc64-ieee1275) @@ -139,7 +143,9 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in i386-pc) boot=cd qemu=qemu-system-i386 - console=console;; + console=console + netbootext=0 + ;; i386-efi) qemu=qemu-system-i386 @@ -159,6 +165,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in console=console;; esac +timeout=60 + # Check the arguments. for option in "$@"; do case "$option" in @@ -177,11 +185,24 @@ for option in "$@"; do --files=*) fls=`echo "$option" | sed -e 's/--files=//' -e 's/,/ /g'` files="$files $fls" ;; + --mkrescue-arg=*) + mkr=`echo "$option" | sed -e 's/--mkrescue-arg=//' -e 's/,/ /g'` + mkrescue_args="$mkrescue_args $mkr" ;; --qemu=*) qemu=`echo "$option" | sed -e 's/--qemu=//' -e 's/,/ /g'`;; + --pseries) + qemu=qemu-system-ppc64 + serial_port=ieee1275/hvterm + serial_null= + qemuopts="$qemuopts -no-reboot" + trim=1 + ;; --qemu-opts=*) qs=`echo "$option" | sed -e 's/--qemu-opts=//'` qemuopts="$qemuopts $qs" ;; + --timeout=*) + timeout=`echo "$option" | sed -e 's/--timeout=//'` + ;; --boot=*) dev=`echo "$option" | sed -e 's/--boot=//'` if [ "$dev" = "fd" ] ; then boot=fd; @@ -260,12 +281,16 @@ echo "${halt_cmd}" >>${cfgfile} isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 if [ x$boot != xnet ]; then pkgdatadir="@builddir@" sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--grub-render-label=${builddir}/grub-render-label" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \ - --rom-directory="${rom_directory}" \ + --rom-directory="${rom_directory}" ${mkrescue_args} \ "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \ ${files} >/dev/null 2>&1 fi if [ x$boot = xhd ]; then - device=hda + if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mips-arc ]; then + device=hdb + else + device=hda + fi bootdev="-boot c" fi if [ x$boot = xcd ]; then @@ -305,6 +330,15 @@ if [ x$boot = xcoreboot ]; then device=cdrom fi +if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mipsel-arc ]; then + case "$boot" in + hd) + bootdev="-global ds1225y.filename=$GRUB_QEMU_MAGNUM_NVRAM_DIR/disk" ;; + *) + bootdev="-global ds1225y.filename=$GRUB_QEMU_MAGNUM_NVRAM_DIR/cdrom";; + esac +fi + do_trim () { if [ $trim = 1 ]; then @@ -316,12 +350,12 @@ do_trim () if [ x$boot = xnet ]; then netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 - pkgdatadir="@builddir@" sh "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" + pkgdatadir="@builddir@" sh "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" ${mkrescue_args} > /dev/null cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" cp "${source}" "$netdir/boot/grub/testcase.cfg" - "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.0" -net nic | cat | tr -d "\r" | do_trim + timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | do_trim else - "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r" | do_trim + timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r" | do_trim fi rm -f "${isofile}" "${imgfile}" rm -rf "${rom_directory}" diff --git a/tests/xzcompress_test.in b/tests/xzcompress_test.in new file mode 100644 index 000000000..63f5fd190 --- /dev/null +++ b/tests/xzcompress_test.in @@ -0,0 +1,24 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=xz)" != "Hello World" ]; then + exit 1 +fi From c1b00fffdfc391545c367908587d359f296286b4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 26 Apr 2013 19:09:55 +0200 Subject: [PATCH 086/187] * tests/pseries_test.in: New test. --- ChangeLog | 4 ++++ tests/pseries_test.in | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/pseries_test.in diff --git a/ChangeLog b/ChangeLog index 19a1cf6cd..5ddb7a854 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-26 Vladimir Serbinenko + + * tests/pseries_test.in: New test. + 2013-04-26 Vladimir Serbinenko Add test to check that different boot mediums work. diff --git a/tests/pseries_test.in b/tests/pseries_test.in new file mode 100644 index 000000000..86a396a85 --- /dev/null +++ b/tests/pseries_test.in @@ -0,0 +1,37 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" != powerpc-ieee1275 ]; then + exit 0 +fi + +if [ "$(echo hello | "${grubshell}" --pseries --timeout 180 --boot=cd)" != "Hello World" ]; then + exit 1 +fi + +if [ "$(echo hello | "${grubshell}" --pseries --timeout 180 --boot=hd)" != "Hello World" ]; then + exit 1 +fi + +# FIXME: workaround SLOF bugs +#if [ "$(echo hello | "${grubshell}" --pseries --timeout 180 --boot=net)" != "Hello World" ]; then +# exit 1 +#fi From 63314aa43c47559192c10e6c89a0ce15bf834f6d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 26 Apr 2013 23:41:13 +0200 Subject: [PATCH 087/187] * util/getroot.c (exec_pipe): Put proper #if's so that its users don't compile when not needed. --- ChangeLog | 5 +++++ util/getroot.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ddb7a854..4975a2cca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-26 Vladimir Serbinenko + + * util/getroot.c (exec_pipe): Put proper #if's so that its users don't + compile when not needed. + 2013-04-26 Vladimir Serbinenko * tests/pseries_test.in: New test. diff --git a/util/getroot.c b/util/getroot.c index ecf7ce199..2ad8a55ce 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -220,9 +220,6 @@ xgetcwd (void) #if !defined (__MINGW32__) && !defined (__CYGWIN__) && !defined (__GNU__) -#if (defined (__linux__) || \ - !defined (HAVE_LIBZFS) || !defined (HAVE_LIBNVPAIR)) - static pid_t exec_pipe (char **argv, int *fd) { @@ -268,8 +265,6 @@ exec_pipe (char **argv, int *fd) } } -#endif - static char ** find_root_devices_from_poolname (char *poolname) { @@ -1322,6 +1317,8 @@ grub_util_get_dev_abstraction (const char *os_dev) return GRUB_DEV_ABSTRACTION_NONE; } +#if !defined (__MINGW32__) && !defined (__CYGWIN__) && !defined (__GNU__) + static void pull_lvm_by_command (const char *os_dev) { @@ -1392,6 +1389,8 @@ out: free (buf); } +#endif + #ifdef __linux__ static char * get_mdadm_uuid (const char *os_dev) @@ -1615,7 +1614,9 @@ grub_util_pull_device (const char *os_dev) break; case GRUB_DEV_ABSTRACTION_LVM: +#if !defined (__MINGW32__) && !defined (__CYGWIN__) && !defined (__GNU__) pull_lvm_by_command (os_dev); +#endif /* Fallthrough in case that lvm-tools are unavailable. */ case GRUB_DEV_ABSTRACTION_LUKS: #ifdef HAVE_DEVICE_MAPPER From b24ca7cd8915bcb29d05352350b06d17dd350093 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 26 Apr 2013 23:47:46 +0200 Subject: [PATCH 088/187] * grub-core/Makefile.core.def: Fix grub-emu and grub-emu-lite sources. --- ChangeLog | 4 ++++ grub-core/Makefile.core.def | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4975a2cca..f554ba858 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-26 Vladimir Serbinenko + + * grub-core/Makefile.core.def: Fix grub-emu and grub-emu-lite sources. + 2013-04-26 Vladimir Serbinenko * util/getroot.c (exec_pipe): Put proper #if's so that its users don't diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index ad912a648..e2ecff10f 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -248,9 +248,9 @@ program = { emu = kern/emu/full.c; emu_nodist = grub_emu_init.c; - ldadd = 'kernel.img$(EXEEXT)'; + ldadd = 'kernel.exec$(EXEEXT)'; ldadd = '$(MODULE_FILES)'; - ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + ldadd = 'gnulib/libgnu.a $(LIBCURSES) $(LIBINTL) $(LIBUTIL) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; enable = emu; }; @@ -261,8 +261,8 @@ program = { emu = kern/emu/lite.c; emu_nodist = symlist.c; - ldadd = 'kernel.img$(EXEEXT)'; - ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + ldadd = 'kernel.exec$(EXEEXT)'; + ldadd = 'gnulib/libgnu.a $(LIBCURSES) $(LIBINTL) $(LIBUTIL) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; enable = emu; }; From db99fbe83fc0207f2fbf7b5b5874768d423b6db7 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 00:02:23 +0200 Subject: [PATCH 089/187] Replace libcurses with our own vt100 handling for the ease of testing and decreasing prerequisites. --- ChangeLog | 5 + INSTALL | 6 +- configure.ac | 16 -- docs/grub.texi | 45 +++-- gentpl.py | 2 +- grub-core/Makefile.am | 1 + grub-core/Makefile.core.def | 4 +- grub-core/term/emu/console.c | 341 ++++++++++++----------------------- include/grub/terminfo.h | 2 - 9 files changed, 152 insertions(+), 270 deletions(-) diff --git a/ChangeLog b/ChangeLog index f554ba858..237ca05b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-26 Vladimir Serbinenko + + Replace libcurses with our own vt100 handling for the ease of testing + and decreasing prerequisites. + 2013-04-26 Vladimir Serbinenko * grub-core/Makefile.core.def: Fix grub-emu and grub-emu-lite sources. diff --git a/INSTALL b/INSTALL index 333368696..a626395b6 100644 --- a/INSTALL +++ b/INSTALL @@ -23,11 +23,11 @@ On GNU/Linux, you also need: * libdevmapper 1.02.34 or later (recommended) -To build grub-emu, you need: +For optional grub-emu features, you need: -* ncurses -* libusb (recommended) * SDL (recommended) +* libpciaccess (optional) +* libusb (optional) To build GRUB's graphical terminal (gfxterm), you need: diff --git a/configure.ac b/configure.ac index 7d3aeac9c..5ff7f25ac 100644 --- a/configure.ac +++ b/configure.ac @@ -842,22 +842,6 @@ AC_ARG_ENABLE([grub-emu-pci], [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])]) if test "$platform" = emu; then - missing_ncurses= -[# Check for curses libraries.] - AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], - [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], - [missing_ncurses=[true]])]) - AC_SUBST([LIBCURSES]) -[if [ x"$missing_ncurses" = x ]; then ] - [# Check for headers.] - AC_CHECK_HEADERS([ncurses/curses.h], [], - [AC_CHECK_HEADERS([ncurses.h], [], - [AC_CHECK_HEADERS([curses.h], [], - [missing_ncurses=[true]])])]) -[fi] -if test x"$missing_ncurses" = xtrue ; then - AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) -fi if test x"$enable_grub_emu_usb" != xyes ; then grub_emu_usb_excuse="not enabled" diff --git a/docs/grub.texi b/docs/grub.texi index 920a55850..754e1912b 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -4586,26 +4586,35 @@ On normalized ZFS subvolumes filenames out of normalisation are inaccessible. @chapter Output terminal Firmware output console ``console'' on ARC and IEEE1275 are limited to ASCII. + BIOS firmware console and VGA text are limited to ASCII and some pseudographics. + None of above mentioned is appropriate for displaying international and any unsupported character is replaced with question mark except pseudographics -which we attempt to approximate with ASCII. EFI console on the other hand -nominally supports UTF-16 but actual language coverage depends on firmware and -may be very limited. The encoding used on serial can be chosen with -@command{terminfo} as either ASCII, UTF-8 or ``visual UTF-8''. Last one is -against the specification but results in correct rendering of right-to-left -on some readers which don't have own bidi implementation. When using gfxterm -or gfxmenu GRUB itself is responsible for rendering the text. In this case -GRUB is limited by loaded fonts. If fonts contain all required characters -then bidirectional text, cursive variants and combining marks other than -enclosing, half (e.g. left half tilde or combining overline) and double ones. -Ligatures aren't supported though. This should cover European, Middle Eastern -(if you don't mind lack of lam-alif ligature in Arabic) and East Asian scripts. -Notable unsupported scripts are Brahmic family and derived as well as -Mongolian, Tifinagh, Korean Jamo (precomposed characters have no problem) -and tonal writing (2e5-2e9). GRUB also ignores deprecated (as specified -in Unicode) characters (e.g. tags). GRUB also doesn't handle so called -``annotation characters'' If you can complete either of +which we attempt to approximate with ASCII. + +EFI console on the other hand nominally supports UTF-16 but actual language +coverage depends on firmware and may be very limited. + +The encoding used on serial can be chosen with @command{terminfo} as +either ASCII, UTF-8 or ``visual UTF-8''. Last one is against the specification +but results in correct rendering of right-to-left on some readers which don't +have own bidi implementation. + +On emu GRUB checks if charset is UTF-8 and uses it if so and uses ASCII +otherwise. + +When using gfxterm or gfxmenu GRUB itself is responsible for rendering the +text. In this case GRUB is limited by loaded fonts. If fonts contain all +required characters then bidirectional text, cursive variants and combining +marks other than enclosing, half (e.g. left half tilde or combining overline) +and double ones. Ligatures aren't supported though. This should cover European, +Middle Eastern (if you don't mind lack of lam-alif ligature in Arabic) and +East Asian scripts. Notable unsupported scripts are Brahmic family and +derived as well as Mongolian, Tifinagh, Korean Jamo (precomposed characters +have no problem) and tonal writing (2e5-2e9). GRUB also ignores deprecated +(as specified in Unicode) characters (e.g. tags). GRUB also doesn't handle so +called ``annotation characters'' If you can complete either of two lists or, better, propose a patch to improve rendering, please contact developer team. @@ -4826,7 +4835,7 @@ and mips-qemu_mips can use only memory up to first hole. @multitable @columnfractions .20 .20 .20 .20 .20 @item @tab MIPS qemu @tab emu @item video @tab no @tab yes -@item console charset @tab CP437 @tab ASCII +@item console charset @tab CP437 @tab Unicode (*) @item network @tab no @tab yes @item ATA/AHCI @tab yes @tab no @item AT keyboard @tab yes @tab no diff --git a/gentpl.py b/gentpl.py index b159795a1..8674622f1 100644 --- a/gentpl.py +++ b/gentpl.py @@ -57,7 +57,7 @@ GROUPS["videomodules"] = GRUB_PLATFORMS[:]; for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i) # Similar for terminfo -GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"]; +GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"]; GROUPS["terminfomodule"] = GRUB_PLATFORMS[:]; for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i) diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 07aad5086..fa6afcfad 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -216,6 +216,7 @@ if COND_emu KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/export.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h if COND_GRUB_EMU_SDL KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h endif diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index e2ecff10f..2a8ac6f5b 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -250,7 +250,7 @@ program = { ldadd = 'kernel.exec$(EXEEXT)'; ldadd = '$(MODULE_FILES)'; - ldadd = 'gnulib/libgnu.a $(LIBCURSES) $(LIBINTL) $(LIBUTIL) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + ldadd = 'gnulib/libgnu.a $(LIBINTL) $(LIBUTIL) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; enable = emu; }; @@ -262,7 +262,7 @@ program = { emu_nodist = symlist.c; ldadd = 'kernel.exec$(EXEEXT)'; - ldadd = 'gnulib/libgnu.a $(LIBCURSES) $(LIBINTL) $(LIBUTIL) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + ldadd = 'gnulib/libgnu.a $(LIBINTL) $(LIBUTIL) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; enable = emu; }; diff --git a/grub-core/term/emu/console.c b/grub-core/term/emu/console.c index 5bd5db1d8..d61ade167 100644 --- a/grub-core/term/emu/console.c +++ b/grub-core/term/emu/console.c @@ -1,7 +1,7 @@ -/* console.c -- Ncurses console for GRUB. */ +/* console.c -- console for GRUB. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2013 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,274 +20,159 @@ #include #include -/* For compatibility. */ -#ifndef A_NORMAL -# define A_NORMAL 0 -#endif /* ! A_NORMAL */ -#ifndef A_STANDOUT -# define A_STANDOUT 0 -#endif /* ! A_STANDOUT */ - -#include #include #include +#include +#include +#include +#include +#include -#if defined(HAVE_NCURSES_CURSES_H) -# include -#elif defined(HAVE_NCURSES_H) -# include -#elif defined(HAVE_CURSES_H) -# include -#else -#error What the hell? -#endif +#include +#include +#include +#include +#include +#include +#include +#include -static int grub_console_attr = A_NORMAL; +#include -grub_uint8_t grub_console_cur_color = 7; - -static const grub_uint8_t grub_console_standard_color = 0x7; - -#define NUM_COLORS 8 - -static grub_uint8_t color_map[NUM_COLORS] = -{ - COLOR_BLACK, - COLOR_BLUE, - COLOR_GREEN, - COLOR_CYAN, - COLOR_RED, - COLOR_MAGENTA, - COLOR_YELLOW, - COLOR_WHITE -}; - -static int use_color; +extern struct grub_terminfo_output_state grub_console_terminfo_output; +static int original_fl; +static int saved_orig; +static struct termios orig_tty; +static struct termios new_tty; static void -grub_ncurses_putchar (struct grub_term_output *term __attribute__ ((unused)), - const struct grub_unicode_glyph *c) +put (struct grub_term_output *term __attribute__ ((unused)), const int c) { - addch (c->base | grub_console_attr); -} + char chr = c; -static void -grub_ncurses_setcolorstate (struct grub_term_output *term, - grub_term_color_state state) -{ - switch (state) - { - case GRUB_TERM_COLOR_STANDARD: - grub_console_cur_color = grub_console_standard_color; - grub_console_attr = A_NORMAL; - break; - case GRUB_TERM_COLOR_NORMAL: - grub_console_cur_color = grub_term_normal_color; - grub_console_attr = A_NORMAL; - break; - case GRUB_TERM_COLOR_HIGHLIGHT: - grub_console_cur_color = grub_term_highlight_color; - grub_console_attr = A_STANDOUT; - break; - default: - break; - } - - if (use_color) - { - grub_uint8_t fg, bg; - - fg = (grub_console_cur_color & 7); - bg = (grub_console_cur_color >> 4) & 7; - - grub_console_attr = (grub_console_cur_color & 8) ? A_BOLD : A_NORMAL; - color_set ((bg << 3) + fg, 0); - } + write (STDOUT_FILENO, &chr, 1); } static int -grub_ncurses_getkey (struct grub_term_input *term __attribute__ ((unused))) +readkey (struct grub_term_input *term __attribute__ ((unused))) { - int c; + grub_uint8_t c; + ssize_t actual; - wtimeout (stdscr, 100); - c = getch (); - - switch (c) - { - case ERR: - return GRUB_TERM_NO_KEY; - case KEY_LEFT: - c = GRUB_TERM_KEY_LEFT; - break; - - case KEY_RIGHT: - c = GRUB_TERM_KEY_RIGHT; - break; - - case KEY_UP: - c = GRUB_TERM_KEY_UP; - break; - - case KEY_DOWN: - c = GRUB_TERM_KEY_DOWN; - break; - - case KEY_IC: - c = 24; - break; - - case KEY_DC: - c = GRUB_TERM_KEY_DC; - break; - - case KEY_BACKSPACE: - /* XXX: For some reason ncurses on xterm does not return - KEY_BACKSPACE. */ - case 127: - c = '\b'; - break; - - case KEY_HOME: - c = GRUB_TERM_KEY_HOME; - break; - - case KEY_END: - c = GRUB_TERM_KEY_END; - break; - - case KEY_NPAGE: - c = GRUB_TERM_KEY_NPAGE; - break; - - case KEY_PPAGE: - c = GRUB_TERM_KEY_PPAGE; - break; - } - - return c; -} - -static grub_uint16_t -grub_ncurses_getxy (struct grub_term_output *term __attribute__ ((unused))) -{ - int x; - int y; - - getyx (stdscr, y, x); - - return (x << 8) | y; -} - -static grub_uint16_t -grub_ncurses_getwh (struct grub_term_output *term __attribute__ ((unused))) -{ - int x; - int y; - - getmaxyx (stdscr, y, x); - - return (x << 8) | y; -} - -static void -grub_ncurses_gotoxy (struct grub_term_output *term __attribute__ ((unused)), - grub_uint8_t x, grub_uint8_t y) -{ - move (y, x); -} - -static void -grub_ncurses_cls (struct grub_term_output *term __attribute__ ((unused))) -{ - clear (); - refresh (); -} - -static void -grub_ncurses_setcursor (struct grub_term_output *term __attribute__ ((unused)), - int on) -{ - curs_set (on ? 1 : 0); -} - -static void -grub_ncurses_refresh (struct grub_term_output *term __attribute__ ((unused))) -{ - refresh (); + actual = read (STDIN_FILENO, &c, 1); + if (actual > 0) + return c; + return -1; } static grub_err_t -grub_ncurses_init (struct grub_term_output *term __attribute__ ((unused))) +grub_console_init_input (struct grub_term_input *term) { - initscr (); - raw (); - noecho (); - scrollok (stdscr, TRUE); - - nonl (); - intrflush (stdscr, FALSE); - keypad (stdscr, TRUE); - - if (has_colors ()) + if (!saved_orig) { - start_color (); - - if ((COLORS >= NUM_COLORS) && (COLOR_PAIRS >= NUM_COLORS * NUM_COLORS)) - { - int i, j, n; - - n = 0; - for (i = 0; i < NUM_COLORS; i++) - for (j = 0; j < NUM_COLORS; j++) - init_pair(n++, color_map[j], color_map[i]); - - use_color = 1; - } + original_fl = fcntl (STDIN_FILENO, F_GETFL); + fcntl (STDIN_FILENO, F_SETFL, original_fl | O_NONBLOCK); } - return 0; + saved_orig = 1; + + tcgetattr(STDIN_FILENO, &orig_tty); + new_tty = orig_tty; + new_tty.c_lflag &= ~(ICANON | ECHO); + new_tty.c_cc[VMIN] = 1; + tcsetattr(STDIN_FILENO, TCSANOW, &new_tty); + + return grub_terminfo_input_init (term); } static grub_err_t -grub_ncurses_fini (struct grub_term_output *term __attribute__ ((unused))) +grub_console_fini_input (struct grub_term_input *term + __attribute__ ((unused))) { - endwin (); + fcntl (STDIN_FILENO, F_SETFL, original_fl); + tcsetattr(STDIN_FILENO, TCSANOW, &orig_tty); + saved_orig = 0; + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_console_init_output (struct grub_term_output *term) +{ + struct winsize size; + if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &size) >= 0) + { + grub_console_terminfo_output.width = size.ws_col; + grub_console_terminfo_output.height = size.ws_row; + } + else + { + grub_console_terminfo_output.width = 80; + grub_console_terminfo_output.height = 24; + } + + grub_terminfo_output_init (term); + return 0; } -static struct grub_term_input grub_ncurses_term_input = + +struct grub_terminfo_input_state grub_console_terminfo_input = { - .name = "console", - .getkey = grub_ncurses_getkey, + .readkey = readkey }; -static struct grub_term_output grub_ncurses_term_output = +struct grub_terminfo_output_state grub_console_terminfo_output = + { + .put = put, + .width = 80, + .height = 24 + }; + +static struct grub_term_input grub_console_term_input = { .name = "console", - .init = grub_ncurses_init, - .fini = grub_ncurses_fini, - .putchar = grub_ncurses_putchar, - .getxy = grub_ncurses_getxy, - .getwh = grub_ncurses_getwh, - .gotoxy = grub_ncurses_gotoxy, - .cls = grub_ncurses_cls, - .setcolorstate = grub_ncurses_setcolorstate, - .setcursor = grub_ncurses_setcursor, - .refresh = grub_ncurses_refresh, - .flags = GRUB_TERM_CODE_TYPE_ASCII + .init = grub_console_init_input, + .fini = grub_console_fini_input, + .getkey = grub_terminfo_getkey, + .data = &grub_console_terminfo_input + }; + +static struct grub_term_output grub_console_term_output = + { + .name = "console", + .init = grub_console_init_output, + .putchar = grub_terminfo_putchar, + .getxy = grub_terminfo_getxy, + .getwh = grub_terminfo_getwh, + .gotoxy = grub_terminfo_gotoxy, + .cls = grub_terminfo_cls, + .setcolorstate = grub_terminfo_setcolorstate, + .setcursor = grub_terminfo_setcursor, + .data = &grub_console_terminfo_output, }; void grub_console_init (void) { - grub_term_register_output ("console", &grub_ncurses_term_output); - grub_term_register_input ("console", &grub_ncurses_term_input); + const char *cs = nl_langinfo (CODESET); + if (cs && grub_strcasecmp (cs, "UTF-8")) + grub_console_term_output.flags = GRUB_TERM_CODE_TYPE_UTF8_LOGICAL; + else + grub_console_term_output.flags = GRUB_TERM_CODE_TYPE_ASCII; + grub_term_register_input ("console", &grub_console_term_input); + grub_term_register_output ("console", &grub_console_term_output); + grub_terminfo_init (); + grub_terminfo_output_register (&grub_console_term_output, "vt100-color"); } void grub_console_fini (void) { - grub_ncurses_fini (&grub_ncurses_term_output); + if (saved_orig) + { + fcntl (STDIN_FILENO, F_SETFL, original_fl); + tcsetattr(STDIN_FILENO, TCSANOW, &orig_tty); + } + saved_orig = 0; } diff --git a/include/grub/terminfo.h b/include/grub/terminfo.h index 20541a949..2bbae1fa3 100644 --- a/include/grub/terminfo.h +++ b/include/grub/terminfo.h @@ -82,9 +82,7 @@ grub_err_t EXPORT_FUNC (grub_terminfo_output_register) (struct grub_term_output const char *type); grub_err_t EXPORT_FUNC (grub_terminfo_output_unregister) (struct grub_term_output *term); -#ifndef GRUB_MACHINE_EMU void grub_terminfo_init (void); void grub_terminfo_fini (void); -#endif #endif /* ! GRUB_TERMINFO_HEADER */ From a6393224c4a681eb2c5543fc16e9750ea1ba4c78 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 02:00:16 +0200 Subject: [PATCH 090/187] Make 'make check' work on emu. --- ChangeLog | 4 +++ grub-core/commands/parttool.c | 2 +- grub-core/gensymlist.sh | 2 +- grub-core/kern/dl.c | 3 ++ grub-core/kern/emu/full.c | 12 ++----- grub-core/kern/emu/lite.c | 13 ++------ grub-core/kern/emu/main.c | 6 ---- grub-core/normal/main.c | 2 +- include/grub/emu/misc.h | 2 -- include/grub/misc.h | 6 ++-- tests/cdboot_test.in | 2 ++ tests/fddboot_test.in | 2 ++ tests/hddboot_test.in | 2 ++ tests/netboot_test.in | 2 ++ tests/partmap_test.in | 8 +---- tests/util/grub-shell.in | 63 +++++++++++++++++++++++++++++++---- 16 files changed, 82 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 237ca05b9..f4306c4b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-26 Vladimir Serbinenko + + Make 'make check' work on emu. + 2013-04-26 Vladimir Serbinenko Replace libcurses with our own vt100 handling for the ease of testing diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c index 0f9b65110..f144c511b 100644 --- a/grub-core/commands/parttool.c +++ b/grub-core/commands/parttool.c @@ -179,7 +179,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), } /* Load modules. */ - if (! grub_no_autoload) + if (! grub_no_modules) { const char *prefix; prefix = grub_env_get ("prefix"); diff --git a/grub-core/gensymlist.sh b/grub-core/gensymlist.sh index a13d7cc38..5beaabdd6 100644 --- a/grub-core/gensymlist.sh +++ b/grub-core/gensymlist.sh @@ -59,7 +59,7 @@ EOF | grep -v '^#' \ | sed -n \ -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/ {"\1", \1, 1},/;p;}' \ - -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/ {"\1", \&\1, 0},/;p;}' \ + -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/ {"\1", (void *) \&\1, 0},/;p;}' \ | sort -u cat < #include +const int grub_no_modules = 1; + void grub_register_exported_symbols (void) { @@ -44,12 +46,6 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) return GRUB_ERR_BAD_MODULE; } -void -grub_emu_init (void) -{ - grub_no_autoload = 1; -} - #if defined (__ia64__) || defined (__powerpc__) void grub_arch_dl_get_tramp_got_size (const void *ehdr __attribute__ ((unused)), grub_size_t *tramp, grub_size_t *got) @@ -66,7 +62,3 @@ grub_arch_dl_init_linker (void) } #endif -void -grub_emu_post_init (void) -{ -} diff --git a/grub-core/kern/emu/lite.c b/grub-core/kern/emu/lite.c index 947c669aa..00b811bf5 100644 --- a/grub-core/kern/emu/lite.c +++ b/grub-core/kern/emu/lite.c @@ -21,6 +21,8 @@ #error "No target cpu type is defined" #endif +const int grub_no_modules = 0; + /* grub-emu-lite supports dynamic module loading, so it won't have any embedded modules. */ void @@ -34,14 +36,3 @@ grub_fini_all (void) { return; } - -void -grub_emu_init (void) -{ - return; -} - -void -grub_emu_post_init (void) -{ -} diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c index 4a8890516..99ef90ce1 100644 --- a/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c @@ -55,8 +55,6 @@ static jmp_buf main_env; /* Store the prefix specified by an argument. */ static char *root_dev = NULL, *dir = NULL; -int grub_no_autoload; - grub_addr_t grub_modbase = 0; void @@ -171,7 +169,6 @@ void grub_hostfs_init (void); void grub_hostfs_fini (void); void grub_host_init (void); void grub_host_fini (void); -void grub_emu_init (void); int main (int argc, char *argv[]) @@ -208,7 +205,6 @@ main (int argc, char *argv[]) } signal (SIGINT, SIG_IGN); - grub_emu_init (); grub_console_init (); grub_host_init (); @@ -219,8 +215,6 @@ main (int argc, char *argv[]) grub_hostfs_init (); - grub_emu_post_init (); - /* Make sure that there is a root device. */ if (! root_dev) root_dev = grub_strdup ("host"); diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c index 9aaa3b29f..2f203ddf9 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -263,7 +263,7 @@ grub_normal_init_page (struct grub_term_output *term) static void read_lists (const char *val) { - if (! grub_no_autoload) + if (! grub_no_modules) { read_command_list (val); read_fs_list (val); diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 6423eb963..3c9f07ed3 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -44,10 +44,8 @@ extern int verbosity; extern const char *program_name; -void grub_emu_init (void); void grub_init_all (void); void grub_fini_all (void); -void grub_emu_post_init (void); void grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs); diff --git a/include/grub/misc.h b/include/grub/misc.h index c953a003e..c191c1f51 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -437,10 +437,10 @@ void grub_halt (void) __attribute__ ((noreturn)); #endif #ifdef GRUB_MACHINE_EMU -/* Flag to control module autoloading in normal mode. */ -extern int EXPORT_VAR(grub_no_autoload); +/* Flag to check if module loading is available. */ +extern const int EXPORT_VAR(grub_no_modules); #else -#define grub_no_autoload 0 +#define grub_no_modules 0 #endif static inline void diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in index d9a5fb80e..097964f95 100644 --- a/tests/cdboot_test.in +++ b/tests/cdboot_test.in @@ -20,6 +20,8 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; # Flash targets i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) exit 0;; diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in index 77340251a..0866fdc8e 100644 --- a/tests/fddboot_test.in +++ b/tests/fddboot_test.in @@ -20,6 +20,8 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; # Flash targets i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) exit 0;; diff --git a/tests/hddboot_test.in b/tests/hddboot_test.in index e76f99671..34257a360 100644 --- a/tests/hddboot_test.in +++ b/tests/hddboot_test.in @@ -20,6 +20,8 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; # Flash targets i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) exit 0;; diff --git a/tests/netboot_test.in b/tests/netboot_test.in index 8e3f8c9b2..aeb1db037 100644 --- a/tests/netboot_test.in +++ b/tests/netboot_test.in @@ -20,6 +20,8 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; # Flash targets i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) exit 0;; diff --git a/tests/partmap_test.in b/tests/partmap_test.in index b222fa139..2d4b54ed0 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -49,7 +49,7 @@ list_parts () { outfile="$1" shift - echo ls | "${grubshell}" --qemu-opts="-$qemudisk ${imgfile}" \ + echo ls | "${grubshell}" --disk="${imgfile}" \ --modules=$mod | tr -d "\n\r" > "${outfile}" cat "${outfile}" echo @@ -58,23 +58,19 @@ list_parts () { case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot | mipsel-loongson) disk=ata0 - qemudisk=hda ;; powerpc-ieee1275) disk=ieee1275//pci@80000000/mac-io@4/ata-3@20000/disk@0 - qemudisk=hda # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; sparc64-ieee1275) disk=ieee1275//pci@1fe\,0/pci-ata@5/ide0@500/disk@0 - qemudisk=hda # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; i386-ieee1275) disk=ieee1275/d - qemudisk=hdb # FIXME: QEMU firmware has bugs which prevent it from accessing hard disk w/o recognised label. exit 0 ;; @@ -83,11 +79,9 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in exit 0 ;; mipsel-arc) disk=arc/scsi0/disk0/rdisk0 - qemudisk=hda ;; *) disk=hd0 - qemudisk=hda ;; esac imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index fc52e7b80..7c8801835 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -44,6 +44,7 @@ Run GRUB script in a Qemu instance. --boot=[fd|hd|cd|net] boot method for Qemu instance --modules=MODULES pre-load specified modules MODULES --qemu=FILE Name of qemu binary + --disk=FILE Attach FILE as a disk --qemu-opts=OPTIONS extra options to pass to Qemu instance --files=FILES add files to the image --mkrescue-arg=ARGS additional arguments to grub-mkrescue @@ -63,7 +64,16 @@ serial_port=com0 serial_null= halt_cmd=halt pseries=n +disk=hda case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + device_map=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 + boot=emu + console=console + disk=0 + # To skip "Welcome to GRUB" and color setttings + trim=1 + ;; powerpc-ieee1275) boot=cd qemu=qemu-system-ppc @@ -134,6 +144,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in qemu=qemu-system-i386 console=console trim=1 + disk=hdb ;; i386-qemu) boot=qemu @@ -200,6 +211,28 @@ for option in "$@"; do --qemu-opts=*) qs=`echo "$option" | sed -e 's/--qemu-opts=//'` qemuopts="$qemuopts $qs" ;; + --disk=*) + dsk=`echo "$option" | sed -e 's/--disk=//'` + if [ ${grub_modinfo_platform} = emu ]; then + echo "(hd$disk) $dsk" >> "$device_map" + disk="$((disk+1))" + else + if [ $disk = error ]; then + echo "Too many disks" 1>&2 + exit 1; + fi + qemuopts="$qemuopts -$disk $dsk" + if [ "$disk" = hda ]; then + disk=hdb; + elif [ "$disk" = hdb ]; then + # CDROM is hdc + disk=hdd + elif [ "$disk" = hdd ]; then + # CDROM is hdc + disk=error + fi + fi + ;; --timeout=*) timeout=`echo "$option" | sed -e 's/--timeout=//'` ;; @@ -244,16 +277,27 @@ fi cfgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 cat <${cfgfile} grubshell=yes -insmod serial EOF + + +if [ "${grub_modinfo_platform}" != emu ]; then + echo insmod serial >>${cfgfile} +fi + if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = powerpc-ieee1275 ]; then echo insmod escc >>${cfgfile} fi +if [ "${grub_modinfo_platform}" != emu ]; then + echo "serial ${serial_port}" >>${cfgfile} + term="serial_${serial_port}" +else + term=console +fi + cat <>${cfgfile} -serial ${serial_port} -terminfo -g 255x255 serial_${serial_port} dumb -terminal_input serial_${serial_port} -terminal_output serial_${serial_port} +terminfo -g 255x255 ${term} dumb +terminal_input ${term} +terminal_output ${term} EOF trim_head=664cbea8-132f-4770-8aa4-1696d59ac35c @@ -270,7 +314,7 @@ do done cat <>${cfgfile} -source /boot/grub/testcase.cfg +source \$prefix/testcase.cfg # Stop serial output to suppress "ACPI shutdown failed" error. EOF if [ x$console != x ]; then @@ -279,7 +323,7 @@ fi echo "${halt_cmd}" >>${cfgfile} isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 -if [ x$boot != xnet ]; then +if [ x$boot != xnet ] && [ x$boot != xemu ]; then pkgdatadir="@builddir@" sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--grub-render-label=${builddir}/grub-render-label" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \ --rom-directory="${rom_directory}" ${mkrescue_args} \ "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \ @@ -354,6 +398,11 @@ if [ x$boot = xnet ]; then cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" cp "${source}" "$netdir/boot/grub/testcase.cfg" timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | do_trim +elif [ x$boot = xemu ]; then + grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" + cp "${cfgfile}" "$grubdir/grub.cfg" + cp "${source}" "$grubdir/testcase.cfg" + @builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim else timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r" | do_trim fi From f25a2ba6b849521e078f049bf33a26af8a231720 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 14:11:12 +0200 Subject: [PATCH 091/187] Fix pseries test. --- ChangeLog | 4 ++++ grub-core/lib/ieee1275/halt.c | 2 +- tests/pseries_test.in | 6 +++--- tests/util/grub-shell.in | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4306c4b9..8c34cc0ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-26 Vladimir Serbinenko + + Fix pseries test. + 2013-04-26 Vladimir Serbinenko Make 'make check' work on emu. diff --git a/grub-core/lib/ieee1275/halt.c b/grub-core/lib/ieee1275/halt.c index 7ede29de9..8fc16d243 100644 --- a/grub-core/lib/ieee1275/halt.c +++ b/grub-core/lib/ieee1275/halt.c @@ -25,8 +25,8 @@ grub_halt (void) { /* Not standardized. We try three known commands. */ - grub_ieee1275_interpret ("shut-down", 0); grub_ieee1275_interpret ("power-off", 0); + grub_ieee1275_interpret ("shut-down", 0); grub_ieee1275_interpret ("poweroff", 0); while (1); diff --git a/tests/pseries_test.in b/tests/pseries_test.in index 86a396a85..226494593 100644 --- a/tests/pseries_test.in +++ b/tests/pseries_test.in @@ -23,15 +23,15 @@ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" != powerpc-ieee1275 ] exit 0 fi -if [ "$(echo hello | "${grubshell}" --pseries --timeout 180 --boot=cd)" != "Hello World" ]; then +if [ "$(echo hello | "${grubshell}" --pseries --timeout=180 --boot=cd)" != "Hello World" ]; then exit 1 fi -if [ "$(echo hello | "${grubshell}" --pseries --timeout 180 --boot=hd)" != "Hello World" ]; then +if [ "$(echo hello | "${grubshell}" --pseries --timeout=180 --boot=hd)" != "Hello World" ]; then exit 1 fi # FIXME: workaround SLOF bugs -#if [ "$(echo hello | "${grubshell}" --pseries --timeout 180 --boot=net)" != "Hello World" ]; then +#if [ "$(echo hello | "${grubshell}" --pseries --timeout=180 --boot=net)" != "Hello World" ]; then # exit 1 #fi diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 7c8801835..e00998a8e 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -205,7 +205,7 @@ for option in "$@"; do qemu=qemu-system-ppc64 serial_port=ieee1275/hvterm serial_null= - qemuopts="$qemuopts -no-reboot" + qemuopts="$qemuopts -M pseries -no-reboot" trim=1 ;; --qemu-opts=*) From dc2a6c8b0e3dfe3bce78dbe0febcd9d4d9038411 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 17:18:02 +0200 Subject: [PATCH 092/187] Improve AHCI detection and command issuing. --- ChangeLog | 4 + grub-core/disk/ahci.c | 815 +++++++++++++++++++++++++++++++----------- 2 files changed, 606 insertions(+), 213 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c34cc0ad..0d4329c9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-27 Vladimir Serbinenko + + Improve AHCI detection and command issuing. + 2013-04-26 Vladimir Serbinenko Fix pseries test. diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c index 143ab97b3..29fe2460f 100644 --- a/grub-core/disk/ahci.c +++ b/grub-core/disk/ahci.c @@ -75,6 +75,8 @@ struct grub_ahci_hba_port enum grub_ahci_hba_port_command { GRUB_AHCI_HBA_PORT_CMD_ST = 0x01, + GRUB_AHCI_HBA_PORT_CMD_SPIN_UP = 0x02, + GRUB_AHCI_HBA_PORT_CMD_POWER_ON = 0x04, GRUB_AHCI_HBA_PORT_CMD_FRE = 0x10, GRUB_AHCI_HBA_PORT_CMD_CR = 0x8000, GRUB_AHCI_HBA_PORT_CMD_FR = 0x4000, @@ -136,7 +138,7 @@ struct grub_ahci_device static grub_err_t grub_ahci_readwrite_real (struct grub_ahci_device *dev, struct grub_disk_ata_pass_through_parms *parms, - int spinup); + int spinup, int reset); enum @@ -162,8 +164,521 @@ enum static struct grub_ahci_device *grub_ahci_devices; static int numdevs; +static int +grub_ahci_pciinit (grub_pci_device_t dev, + grub_pci_id_t pciid __attribute__ ((unused)), + void *data __attribute__ ((unused))) +{ + grub_pci_address_t addr; + grub_uint32_t class; + grub_uint32_t bar; + unsigned i, nports; + volatile struct grub_ahci_hba *hba; + + /* Read class. */ + addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); + class = grub_pci_read (addr); + + /* Check if this class ID matches that of a PCI IDE Controller. */ + if (class >> 8 != 0x010601) + return 0; + +#ifdef GRUB_MACHINE_QEMU + addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); + grub_pci_write_word (addr, 0x107); +#endif + + addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG5); + +#ifdef GRUB_MACHINE_QEMU + grub_pci_write (addr, 0xf4000000); +#endif + bar = grub_pci_read (addr); + + if ((bar & (GRUB_PCI_ADDR_SPACE_MASK | GRUB_PCI_ADDR_MEM_TYPE_MASK + | GRUB_PCI_ADDR_MEM_PREFETCH)) + != (GRUB_PCI_ADDR_SPACE_MEMORY | GRUB_PCI_ADDR_MEM_TYPE_32)) + return 0; + + addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); + grub_pci_write_word (addr, grub_pci_read_word (addr) | + GRUB_PCI_COMMAND_IO_ENABLED + | GRUB_PCI_COMMAND_MEM_ENABLED + | GRUB_PCI_COMMAND_BUS_MASTER); + + hba = grub_pci_device_map_range (dev, bar & GRUB_PCI_ADDR_MEM_MASK, + sizeof (hba)); + grub_dprintf ("ahci", "dev: %x:%x.%x\n", dev.bus, dev.device, dev.function); + + grub_dprintf ("ahci", "tfd[0]: %x\n", + hba->ports[0].task_file_data); + grub_dprintf ("ahci", "cmd[0]: %x\n", + hba->ports[0].command); + grub_dprintf ("ahci", "st[0]: %x\n", + hba->ports[0].status); + grub_dprintf ("ahci", "err[0]: %x\n", + hba->ports[0].sata_error); + + grub_dprintf ("ahci", "tfd[1]: %x\n", + hba->ports[1].task_file_data); + grub_dprintf ("ahci", "cmd[1]: %x\n", + hba->ports[1].command); + grub_dprintf ("ahci", "st[1]: %x\n", + hba->ports[1].status); + grub_dprintf ("ahci", "err[1]: %x\n", + hba->ports[1].sata_error); + + hba->ports[1].sata_error = hba->ports[1].sata_error; + + grub_dprintf ("ahci", "err[1]: %x\n", + hba->ports[1].sata_error); + + grub_dprintf ("ahci", "BH:%x\n", hba->bios_handoff); + + if (! (hba->bios_handoff & GRUB_AHCI_BIOS_HANDOFF_OS_OWNED)) + { + grub_uint64_t endtime; + + grub_dprintf ("ahci", "Requesting AHCI ownership\n"); + hba->bios_handoff = (hba->bios_handoff & ~GRUB_AHCI_BIOS_HANDOFF_RWC) + | GRUB_AHCI_BIOS_HANDOFF_OS_OWNED; + grub_dprintf ("ahci", "Waiting for BIOS to give up ownership\n"); + endtime = grub_get_time_ms () + 1000; + while ((hba->bios_handoff & GRUB_AHCI_BIOS_HANDOFF_BIOS_OWNED) + && grub_get_time_ms () < endtime); + if (hba->bios_handoff & GRUB_AHCI_BIOS_HANDOFF_BIOS_OWNED) + { + grub_dprintf ("ahci", "Forcibly taking ownership\n"); + hba->bios_handoff = GRUB_AHCI_BIOS_HANDOFF_OS_OWNED; + hba->bios_handoff |= GRUB_AHCI_BIOS_HANDOFF_OS_OWNERSHIP_CHANGED; + } + else + grub_dprintf ("ahci", "AHCI ownership obtained\n"); + } + else + grub_dprintf ("ahci", "AHCI is already in OS mode\n"); + + grub_dprintf ("ahci", "GLC:%x\n", hba->global_control); + + grub_dprintf ("ahci", "err[1]: %x\n", + hba->ports[1].sata_error); + + if (!(hba->global_control & GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN)) + grub_dprintf ("ahci", "AHCI is in compat mode. Switching\n"); + else + grub_dprintf ("ahci", "AHCI is in AHCI mode.\n"); + + grub_dprintf ("ahci", "err[1]: %x\n", + hba->ports[1].sata_error); + + grub_dprintf ("ahci", "GLC:%x\n", hba->global_control); + + /* { + grub_uint64_t endtime; + hba->global_control |= 1; + endtime = grub_get_time_ms () + 1000; + while (hba->global_control & 1) + if (grub_get_time_ms () > endtime) + { + grub_dprintf ("ahci", "couldn't reset AHCI\n"); + return 0; + } + }*/ + + grub_dprintf ("ahci", "GLC:%x\n", hba->global_control); + + grub_dprintf ("ahci", "err[1]: %x\n", + hba->ports[1].sata_error); + + for (i = 0; i < 5; i++) + { + hba->global_control |= GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN; + grub_millisleep (1); + if (hba->global_control & GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN) + break; + } + if (i == 5) + { + grub_dprintf ("ahci", "Couldn't put AHCI in AHCI mode\n"); + return 0; + } + + grub_dprintf ("ahci", "GLC:%x\n", hba->global_control); + + grub_dprintf ("ahci", "err[1]: %x\n", + hba->ports[1].sata_error); + + grub_dprintf ("ahci", "err[1]: %x\n", + hba->ports[1].sata_error); + + grub_dprintf ("ahci", "GLC:%x\n", hba->global_control); + + for (i = 0; i < 5; i++) + { + hba->global_control |= GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN; + grub_millisleep (1); + if (hba->global_control & GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN) + break; + } + if (i == 5) + { + grub_dprintf ("ahci", "Couldn't put AHCI in AHCI mode\n"); + return 0; + } + + grub_dprintf ("ahci", "err[1]: %x\n", + hba->ports[1].sata_error); + + grub_dprintf ("ahci", "GLC:%x\n", hba->global_control); + + nports = (hba->cap & GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1; + + grub_dprintf ("ahci", "%d AHCI ports, PI = 0x%x\n", nports, + hba->ports_implemented); + + struct grub_ahci_device *adevs[GRUB_AHCI_HBA_CAP_NPORTS_MASK + 1]; + struct grub_ahci_device *failed_adevs[GRUB_AHCI_HBA_CAP_NPORTS_MASK + 1]; + grub_uint32_t fr_running = 0; + + for (i = 0; i < nports; i++) + failed_adevs[i] = 0; + for (i = 0; i < nports; i++) + { + if (!(hba->ports_implemented & (1 << i))) + { + adevs[i] = 0; + continue; + } + + adevs[i] = grub_malloc (sizeof (*adevs[i])); + if (!adevs[i]) + return 1; + + adevs[i]->hba = hba; + adevs[i]->port = i; + adevs[i]->present = 1; + adevs[i]->num = numdevs++; + } + + for (i = 0; i < nports; i++) + if (adevs[i]) + { + adevs[i]->hba->ports[adevs[i]->port].sata_error = adevs[i]->hba->ports[adevs[i]->port].sata_error; + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head)); + if (!adevs[i]->command_list_chunk) + { + adevs[i] = 0; + continue; + } + + adevs[i]->command_table_chunk = grub_memalign_dma32 (1024, + sizeof (struct grub_ahci_cmd_table)); + if (!adevs[i]->command_table_chunk) + { + grub_dma_free (adevs[i]->command_list_chunk); + adevs[i] = 0; + continue; + } + + adevs[i]->command_list = grub_dma_get_virt (adevs[i]->command_list_chunk); + adevs[i]->command_table = grub_dma_get_virt (adevs[i]->command_table_chunk); + adevs[i]->command_list->command_table_base + = grub_dma_get_phys (adevs[i]->command_table_chunk); + + grub_dprintf ("ahci", "found device ahci%d (port %d), command_table = %p, command_list = %p\n", + adevs[i]->num, adevs[i]->port, grub_dma_get_virt (adevs[i]->command_table_chunk), + grub_dma_get_virt (adevs[i]->command_list_chunk)); + + adevs[i]->hba->ports[adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE; + } + + grub_uint64_t endtime; + endtime = grub_get_time_ms () + 1000; + + while (grub_get_time_ms () < endtime) + { + for (i = 0; i < nports; i++) + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_FR)) + break; + if (i == nports) + break; + } + + for (i = 0; i < nports; i++) + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_FR)) + { + grub_dprintf ("ahci", "couldn't stop FR on port %d\n", i); + failed_adevs[i] = adevs[i]; + adevs[i] = 0; + } + + for (i = 0; i < nports; i++) + if (adevs[i]) + adevs[i]->hba->ports[adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST; + endtime = grub_get_time_ms () + 1000; + + while (grub_get_time_ms () < endtime) + { + for (i = 0; i < nports; i++) + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) + break; + if (i == nports) + break; + } + + for (i = 0; i < nports; i++) + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) + { + grub_dprintf ("ahci", "couldn't stop CR on port %d\n", i); + failed_adevs[i] = adevs[i]; + adevs[i] = 0; + } + for (i = 0; i < nports; i++) + if (adevs[i]) + { + adevs[i]->hba->ports[adevs[i]->port].inten = 0; + adevs[i]->hba->ports[adevs[i]->port].intstatus = ~0; + // adevs[i]->hba->ports[adevs[i]->port].fbs = 0; + + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->rfis = grub_memalign_dma32 (4096, + sizeof (struct grub_ahci_received_fis)); + grub_memset ((char *) grub_dma_get_virt (adevs[i]->rfis), 0, + sizeof (struct grub_ahci_received_fis)); + grub_memset ((char *) grub_dma_get_virt (adevs[i]->command_list_chunk), 0, + sizeof (struct grub_ahci_cmd_head)); + grub_memset ((char *) grub_dma_get_virt (adevs[i]->command_table_chunk), 0, + sizeof (struct grub_ahci_cmd_table)); + adevs[i]->hba->ports[adevs[i]->port].fis_base = grub_dma_get_phys (adevs[i]->rfis); + adevs[i]->hba->ports[adevs[i]->port].command_list_base + = grub_dma_get_phys (adevs[i]->command_list_chunk); + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_FRE; + } + + endtime = grub_get_time_ms () + 1000; + + while (grub_get_time_ms () < endtime) + { + for (i = 0; i < nports; i++) + if (adevs[i] && !(adevs[i]->hba->ports[adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_FR)) + break; + if (i == nports) + break; + } + + for (i = 0; i < nports; i++) + if (adevs[i] && !(adevs[i]->hba->ports[adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_FR)) + { + grub_dprintf ("ahci", "couldn't start FR on port %d\n", i); + failed_adevs[i] = adevs[i]; + adevs[i] = 0; + } + + for (i = 0; i < nports; i++) + if (adevs[i]) + { + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + fr_running |= (1 << i); + + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_SPIN_UP; + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_POWER_ON; + adevs[i]->hba->ports[adevs[i]->port].command |= 1 << 28; + + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + } + + /* 10ms should actually be enough. */ + endtime = grub_get_time_ms () + 100; + + while (grub_get_time_ms () < endtime) + { + for (i = 0; i < nports; i++) + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].status & 7) != 3) + break; + if (i == nports) + break; + } + + for (i = 0; i < nports; i++) + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].status & 7) != 3) + { + grub_dprintf ("ahci", "couldn't detect device on port %d\n", i); + failed_adevs[i] = adevs[i]; + adevs[i] = 0; + } + + for (i = 0; i < nports; i++) + if (adevs[i]) + { + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_POWER_ON; + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_SPIN_UP; + + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->hba->ports[adevs[i]->port].sata_error = ~0; + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n", + (char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - + (char *) adevs[i]->hba, + adevs[i]->hba->ports[adevs[i]->port].task_file_data, + adevs[i]->hba->ports[adevs[i]->port].command); + + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + } + + + for (i = 0; i < nports; i++) + if (adevs[i]) + { + grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n", + (char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - + (char *) adevs[i]->hba, + adevs[i]->hba->ports[adevs[i]->port].task_file_data, + adevs[i]->hba->ports[adevs[i]->port].command); + + grub_dprintf ("ahci", "err: %x\n", + adevs[i]->hba->ports[adevs[i]->port].sata_error); + + adevs[i]->hba->ports[adevs[i]->port].command + = (adevs[i]->hba->ports[adevs[i]->port].command & 0x0fffffff) | (1 << 28) | 2 | 4; + + /* struct grub_disk_ata_pass_through_parms parms2; + grub_memset (&parms2, 0, sizeof (parms2)); + parms2.taskfile.cmd = 8; + grub_ahci_readwrite_real (dev, &parms2, 1, 1);*/ + } + + endtime = grub_get_time_ms () + 10000; + + while (grub_get_time_ms () < endtime) + { + for (i = 0; i < nports; i++) + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & 0x88)) + break; + if (i == nports) + break; + } + + for (i = 0; i < nports; i++) + if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & 0x88)) + { + grub_dprintf ("ahci", "port %d is busy\n", i); + failed_adevs[i] = adevs[i]; + adevs[i] = 0; + } + + for (i = 0; i < nports; i++) + if (adevs[i]) + adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_ST; + + endtime = grub_get_time_ms () + 1000; + + while (grub_get_time_ms () < endtime) + { + for (i = 0; i < nports; i++) + if (adevs[i] && !(adevs[i]->hba->ports[adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) + break; + if (i == nports) + break; + } + + for (i = 0; i < nports; i++) + if (adevs[i] && !(adevs[i]->hba->ports[adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) + { + grub_dprintf ("ahci", "couldn't start CR on port %d\n", i); + failed_adevs[i] = adevs[i]; + adevs[i] = 0; + } + for (i = 0; i < nports; i++) + if (failed_adevs[i] && (fr_running & (1 << i))) + failed_adevs[i]->hba->ports[failed_adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE; + + endtime = grub_get_time_ms () + 1000; + while (grub_get_time_ms () < endtime) + { + for (i = 0; i < nports; i++) + if (failed_adevs[i] && (fr_running & (1 << i)) && (failed_adevs[i]->hba->ports[failed_adevs[i]->port].command & GRUB_AHCI_HBA_PORT_CMD_FR)) + break; + if (i == nports) + break; + } + for (i = 0; i < nports; i++) + if (failed_adevs[i]) + { + grub_dma_free (adevs[i]->command_list_chunk); + grub_dma_free (adevs[i]->command_table_chunk); + grub_dma_free (adevs[i]->rfis); + } + + for (i = 0; i < nports; i++) + if (adevs[i]) + { + grub_list_push (GRUB_AS_LIST_P (&grub_ahci_devices), + GRUB_AS_LIST (adevs[i])); + } + + return 0; +} + +static grub_err_t +grub_ahci_initialize (void) +{ + grub_pci_iterate (grub_ahci_pciinit, NULL); + return grub_errno; +} + +static grub_err_t +grub_ahci_fini_hw (int noreturn __attribute__ ((unused))) +{ + struct grub_ahci_device *dev; + + for (dev = grub_ahci_devices; dev; dev = dev->next) + { + grub_uint64_t endtime; + + dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE; + endtime = grub_get_time_ms () + 1000; + while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_FR)) + if (grub_get_time_ms () > endtime) + { + grub_dprintf ("ahci", "couldn't stop FR\n"); + break; + } + + dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST; + endtime = grub_get_time_ms () + 1000; + while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) + if (grub_get_time_ms () > endtime) + { + grub_dprintf ("ahci", "couldn't stop CR\n"); + break; + } + grub_dma_free (dev->command_list_chunk); + grub_dma_free (dev->command_table_chunk); + grub_dma_free (dev->rfis); + dev->command_list_chunk = NULL; + dev->command_table_chunk = NULL; + dev->rfis = NULL; + } + return GRUB_ERR_NONE; +} + static int -init_port (struct grub_ahci_device *dev) +reinit_port (struct grub_ahci_device *dev) { struct grub_pci_dma_chunk *command_list; struct grub_pci_dma_chunk *command_table; @@ -254,194 +769,13 @@ init_port (struct grub_ahci_device *dev) return 1; } -static int -grub_ahci_pciinit (grub_pci_device_t dev, - grub_pci_id_t pciid __attribute__ ((unused)), - void *data __attribute__ ((unused))) -{ - grub_pci_address_t addr; - grub_uint32_t class; - grub_uint32_t bar; - unsigned i, nports; - volatile struct grub_ahci_hba *hba; - - /* Read class. */ - addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); - class = grub_pci_read (addr); - - /* Check if this class ID matches that of a PCI IDE Controller. */ - if (class >> 8 != 0x010601) - return 0; - - addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG5); - bar = grub_pci_read (addr); - - if ((bar & (GRUB_PCI_ADDR_SPACE_MASK | GRUB_PCI_ADDR_MEM_TYPE_MASK - | GRUB_PCI_ADDR_MEM_PREFETCH)) - != (GRUB_PCI_ADDR_SPACE_MEMORY | GRUB_PCI_ADDR_MEM_TYPE_32)) - return 0; - - hba = grub_pci_device_map_range (dev, bar & GRUB_PCI_ADDR_MEM_MASK, - sizeof (hba)); - - if (! (hba->bios_handoff & GRUB_AHCI_BIOS_HANDOFF_OS_OWNED)) - { - grub_uint64_t endtime; - - grub_dprintf ("ahci", "Requesting AHCI ownership\n"); - hba->bios_handoff = (hba->bios_handoff & ~GRUB_AHCI_BIOS_HANDOFF_RWC) - | GRUB_AHCI_BIOS_HANDOFF_OS_OWNED; - grub_dprintf ("ahci", "Waiting for BIOS to give up ownership\n"); - endtime = grub_get_time_ms () + 1000; - while ((hba->bios_handoff & GRUB_AHCI_BIOS_HANDOFF_BIOS_OWNED) - && grub_get_time_ms () < endtime); - if (hba->bios_handoff & GRUB_AHCI_BIOS_HANDOFF_BIOS_OWNED) - { - grub_dprintf ("ahci", "Forcibly taking ownership\n"); - hba->bios_handoff = GRUB_AHCI_BIOS_HANDOFF_OS_OWNED; - hba->bios_handoff |= GRUB_AHCI_BIOS_HANDOFF_OS_OWNERSHIP_CHANGED; - } - else - grub_dprintf ("ahci", "AHCI ownership obtained\n"); - } - else - grub_dprintf ("ahci", "AHCI is already in OS mode\n"); - - if (!(hba->global_control & GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN)) - grub_dprintf ("ahci", "AHCI is in compat mode. Switching\n"); - else - grub_dprintf ("ahci", "AHCI is in AHCI mode.\n"); - - for (i = 0; i < 5; i++) - { - hba->global_control |= GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN; - grub_millisleep (1); - if (hba->global_control & GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN) - break; - } - if (i == 5) - { - grub_dprintf ("ahci", "Couldn't put AHCI in AHCI mode\n"); - return 0; - } - - /* - { - grub_uint64_t endtime; - hba->global_control |= 1; - endtime = grub_get_time_ms () + 1000; - while (hba->global_control & 1) - if (grub_get_time_ms () > endtime) - { - grub_dprintf ("ahci", "couldn't reset AHCI\n"); - return 0; - } - } - - for (i = 0; i < 5; i++) - { - hba->global_control |= GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN; - grub_millisleep (1); - if (hba->global_control & GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN) - break; - } - if (i == 5) - { - grub_dprintf ("ahci", "Couldn't put AHCI in AHCI mode\n"); - return 0; - } - */ - - nports = (hba->cap & GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1; - - grub_dprintf ("ahci", "%d AHCI ports\n", nports); - - for (i = 0; i < nports; i++) - { - struct grub_ahci_device *adev; - grub_uint32_t st; - - if (!(hba->ports_implemented & (1 << i))) - continue; - - grub_dprintf ("ahci", "status %d:%x\n", i, hba->ports[i].status); - /* FIXME: support hotplugging. */ - st = hba->ports[i].status; - if ((st & 0xf) != 0x3 && (st & 0xf) != 0x1) - continue; - - adev = grub_malloc (sizeof (*adev)); - if (!adev) - return 1; - - adev->hba = hba; - adev->port = i; - adev->present = 1; - adev->num = numdevs++; - - if (init_port (adev)) - { - grub_free (adev); - return 1; - } - - grub_list_push (GRUB_AS_LIST_P (&grub_ahci_devices), - GRUB_AS_LIST (adev)); - } - - return 0; -} - -static grub_err_t -grub_ahci_initialize (void) -{ - grub_pci_iterate (grub_ahci_pciinit, NULL); - return grub_errno; -} - -static grub_err_t -grub_ahci_fini_hw (int noreturn __attribute__ ((unused))) -{ - struct grub_ahci_device *dev; - - for (dev = grub_ahci_devices; dev; dev = dev->next) - { - grub_uint64_t endtime; - - dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE; - endtime = grub_get_time_ms () + 1000; - while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_FR)) - if (grub_get_time_ms () > endtime) - { - grub_dprintf ("ahci", "couldn't stop FR\n"); - break; - } - - dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST; - endtime = grub_get_time_ms () + 1000; - while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) - if (grub_get_time_ms () > endtime) - { - grub_dprintf ("ahci", "couldn't stop CR\n"); - break; - } - grub_dma_free (dev->command_list_chunk); - grub_dma_free (dev->command_table_chunk); - grub_dma_free (dev->rfis); - dev->command_list_chunk = NULL; - dev->command_table_chunk = NULL; - dev->rfis = NULL; - } - return GRUB_ERR_NONE; -} - static grub_err_t grub_ahci_restore_hw (void) { struct grub_ahci_device **pdev; for (pdev = &grub_ahci_devices; *pdev; pdev = &((*pdev)->next)) - if (init_port (*pdev)) + if (reinit_port (*pdev)) { struct grub_ahci_device *odev; odev = *pdev; @@ -504,10 +838,54 @@ static const int register_map[11] = { 3 /* Features */, 9 /* LBA48 mid */, 10 /* LBA48 high */ }; +static grub_err_t +grub_ahci_reset_port (struct grub_ahci_device *dev, int force) +{ + grub_uint64_t endtime; + + dev->hba->ports[dev->port].sata_error = dev->hba->ports[dev->port].sata_error; + + if (force || (dev->hba->ports[dev->port].command_issue & 1) + || (dev->hba->ports[dev->port].task_file_data & 0x80)) + { + struct grub_disk_ata_pass_through_parms parms2; + dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST; + endtime = grub_get_time_ms () + 1000; + while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) + if (grub_get_time_ms () > endtime) + { + grub_dprintf ("ahci", "couldn't stop CR"); + return grub_error (GRUB_ERR_IO, "couldn't stop CR"); + } + dev->hba->ports[dev->port].command |= 8; + while (dev->hba->ports[dev->port].command & 8) + if (grub_get_time_ms () > endtime) + { + grub_dprintf ("ahci", "couldn't set CLO\n"); + dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE; + return grub_error (GRUB_ERR_IO, "couldn't set CLO"); + } + + dev->hba->ports[dev->port].command |= GRUB_AHCI_HBA_PORT_CMD_ST; + while (!(dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) + if (grub_get_time_ms () > endtime) + { + grub_dprintf ("ahci", "couldn't stop CR"); + dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST; + return grub_error (GRUB_ERR_IO, "couldn't stop CR"); + } + dev->hba->ports[dev->port].sata_error = dev->hba->ports[dev->port].sata_error; + grub_memset (&parms2, 0, sizeof (parms2)); + parms2.taskfile.cmd = 8; + return grub_ahci_readwrite_real (dev, &parms2, 1, 1); + } + return GRUB_ERR_NONE; +} + static grub_err_t grub_ahci_readwrite_real (struct grub_ahci_device *dev, struct grub_disk_ata_pass_through_parms *parms, - int spinup) + int spinup, int reset) { struct grub_pci_dma_chunk *bufc; grub_uint64_t endtime; @@ -517,25 +895,15 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, grub_dprintf ("ahci", "AHCI tfd = %x\n", dev->hba->ports[dev->port].task_file_data); - if ((dev->hba->ports[dev->port].task_file_data & 0x80)) - { - dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST; - endtime = grub_get_time_ms () + 1000; - while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) - if (grub_get_time_ms () > endtime) - { - grub_dprintf ("ahci", "couldn't stop CR\n"); - break; - } - dev->hba->ports[dev->port].command |= GRUB_AHCI_HBA_PORT_CMD_ST; - endtime = grub_get_time_ms () + (spinup ? 10000 : 1000); - while (!(dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR)) - if (grub_get_time_ms () > endtime) - { - grub_dprintf ("ahci", "couldn't start CR\n"); - break; - } - } + if (!reset) + grub_ahci_reset_port (dev, 0); + + grub_dprintf ("ahci", "AHCI tfd = %x\n", + dev->hba->ports[dev->port].task_file_data); + dev->hba->ports[dev->port].task_file_data = 0; + dev->hba->ports[dev->port].command_issue = 0; + grub_dprintf ("ahci", "AHCI tfd = %x\n", + dev->hba->ports[dev->port].task_file_data); dev->hba->ports[dev->port].sata_error = dev->hba->ports[dev->port].sata_error; @@ -551,10 +919,9 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1)); - dev->hba->ports[dev->port].command |= 8; - - grub_dprintf ("ahci", "AHCI tfd = %x\n", - dev->hba->ports[dev->port].task_file_data); + grub_dprintf ("ahci", "AHCI tfd = %x, CL=%p\n", + dev->hba->ports[dev->port].task_file_data, + dev->command_list); /* FIXME: support port multipliers. */ dev->command_list[0].config = (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT) @@ -564,17 +931,28 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, | (parms->cmdsize ? GRUB_AHCI_CONFIG_ATAPI : 0) | (parms->write ? GRUB_AHCI_CONFIG_WRITE : GRUB_AHCI_CONFIG_READ) | (parms->taskfile.cmd == 8 ? (1 << 8) : 0); + grub_dprintf ("ahci", "AHCI tfd = %x\n", + dev->hba->ports[dev->port].task_file_data); + dev->command_list[0].transfered = 0; dev->command_list[0].command_table_base = grub_dma_get_phys (dev->command_table_chunk); + grub_memset ((char *) dev->command_list[0].unused, 0, sizeof (dev->command_list[0].unused)); + grub_memset ((char *) &dev->command_table[0], 0, sizeof (dev->command_table[0])); + grub_dprintf ("ahci", "AHCI tfd = %x\n", + dev->hba->ports[dev->port].task_file_data); + if (parms->cmdsize) grub_memcpy ((char *) dev->command_table[0].command, parms->cmd, parms->cmdsize); + grub_dprintf ("ahci", "AHCI tfd = %x\n", + dev->hba->ports[dev->port].task_file_data); + dev->command_table[0].cfis[0] = GRUB_AHCI_FIS_REG_H2D; dev->command_table[0].cfis[1] = 0x80; for (i = 0; i < sizeof (parms->taskfile.raw); i++) @@ -593,8 +971,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, dev->command_table[0].prdt[0].data_base = grub_dma_get_phys (bufc); dev->command_table[0].prdt[0].unused = 0; - dev->command_table[0].prdt[0].size = (parms->size + (parms->size & 1) - 1) - | GRUB_AHCI_INTERRUPT_ON_COMPLETE; + dev->command_table[0].prdt[0].size = (parms->size - 1); grub_dprintf ("ahci", "PRDT = %" PRIxGRUB_UINT64_T ", %x, %x (%" PRIuGRUB_SIZE ")\n", @@ -610,11 +987,19 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, grub_dprintf ("ahci", "AHCI command schedulded\n"); grub_dprintf ("ahci", "AHCI tfd = %x\n", dev->hba->ports[dev->port].task_file_data); + grub_dprintf ("ahci", "AHCI inten = %x\n", + dev->hba->ports[dev->port].inten); + grub_dprintf ("ahci", "AHCI intstatus = %x\n", + dev->hba->ports[dev->port].intstatus); + dev->hba->ports[dev->port].inten = 0xffffffff;//(1 << 2) | (1 << 5); dev->hba->ports[dev->port].intstatus = 0xffffffff;//(1 << 2) | (1 << 5); + grub_dprintf ("ahci", "AHCI inten = %x\n", + dev->hba->ports[dev->port].inten); grub_dprintf ("ahci", "AHCI tfd = %x\n", dev->hba->ports[dev->port].task_file_data); - dev->hba->ports[dev->port].command_issue |= 1; + dev->hba->ports[dev->port].sata_active = 1; + dev->hba->ports[dev->port].command_issue = 1; grub_dprintf ("ahci", "AHCI sig = %x\n", dev->hba->ports[dev->port].sig); grub_dprintf ("ahci", "AHCI tfd = %x\n", dev->hba->ports[dev->port].task_file_data); @@ -623,11 +1008,15 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev, while ((dev->hba->ports[dev->port].command_issue & 1)) if (grub_get_time_ms () > endtime) { - grub_dprintf ("ahci", "AHCI status <%x %x %x>\n", + grub_dprintf ("ahci", "AHCI status <%x %x %x %x>\n", dev->hba->ports[dev->port].command_issue, + dev->hba->ports[dev->port].sata_active, dev->hba->ports[dev->port].intstatus, dev->hba->ports[dev->port].task_file_data); + dev->hba->ports[dev->port].command_issue = 0; err = grub_error (GRUB_ERR_IO, "AHCI transfer timed out"); + if (!reset) + grub_ahci_reset_port (dev, 1); break; } @@ -672,7 +1061,7 @@ grub_ahci_readwrite (grub_ata_t disk, struct grub_disk_ata_pass_through_parms *parms, int spinup) { - return grub_ahci_readwrite_real (disk->data, parms, spinup); + return grub_ahci_readwrite_real (disk->data, parms, spinup, 0); } static grub_err_t From 17f9fd29d3c52961a0b30a9ac554fefad6b406a2 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 19:12:11 +0200 Subject: [PATCH 093/187] Implement grub_machine_get_bootlocation for ARC. --- ChangeLog | 4 + grub-core/Makefile.core.def | 1 + grub-core/boot/mips/startup_raw.S | 22 +++- grub-core/kern/mips/arc/init.c | 167 +++++++++++++++++++++++++++ grub-core/kern/mips/init.c | 6 - grub-core/kern/mips/loongson/init.c | 6 + grub-core/kern/mips/qemu_mips/init.c | 6 + util/grub-mkrescue.in | 4 +- 8 files changed, 207 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d4329c9e..09a6c70af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-27 Vladimir Serbinenko + + Implement grub_machine_get_bootlocation for ARC. + 2013-04-27 Vladimir Serbinenko Improve AHCI detection and command issuing. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 2a8ac6f5b..7f9372320 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -76,6 +76,7 @@ kernel = { mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)'; mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000'; + mips_arc_cppflags = '-DGRUB_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)'; mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK'; i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; emu_cflags = '$(CFLAGS_GNULIB)'; diff --git a/grub-core/boot/mips/startup_raw.S b/grub-core/boot/mips/startup_raw.S index bbbc1dbec..606197624 100644 --- a/grub-core/boot/mips/startup_raw.S +++ b/grub-core/boot/mips/startup_raw.S @@ -196,6 +196,21 @@ do_check: argfw: not $s7, $a2 cmdlinedone: +#endif +#ifdef GRUB_MACHINE_ARC + lui $t0, %hi(_start - 256) + addiu $t0, $t0, %lo(_start - 256) + addiu $t3, $t0, 255 + lw $t1, 0($a1) +1: + bne $t0, $t3, 2f + lb $t2, 0($t1) + move $t2, $zero +2: + sb $t2, 0($t0) + addiu $t0, $t0, 1 + bnez $t2, 1b + addiu $t1, $t1, 1 #endif /* Copy the decompressor. */ lui $t1, %hi(base) @@ -253,10 +268,15 @@ cmdlinedone: lui $t0, %hi(EXT_C(grub_decompress_core)) addiu $t0, $t0, %lo(EXT_C(grub_decompress_core)) +#ifdef GRUB_MACHINE_ARC + lui $sp, %hi(_start - 512) + jalr $t0 + addiu $sp, $sp, %lo(_start - 512) +#else lui $sp, %hi(_start - 256) jalr $t0 addiu $sp, $sp, %lo(_start - 256) - +#endif move $a0, $s1 move $a1, $s6 diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c index 92a287754..d279ada7c 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -34,6 +34,8 @@ #include #include #include +#include +#include const char *type_names[] = { #ifdef GRUB_CPU_WORDS_BIGENDIAN @@ -164,10 +166,42 @@ grub_arc_alt_name_to_norm (const char *name, const char *suffix) return ret; } +static char * +norm_name_to_alt (const char *name) +{ + char *optr; + const char *iptr; + int state = 0; + char * ret = grub_malloc (grub_strlen (name) + sizeof ("arc/")); + + if (!ret) + return NULL; + optr = grub_stpcpy (ret, "arc/"); + for (iptr = name; *iptr; iptr++) + { + if (state == 1) + { + *optr++ = '/'; + state = 0; + } + if (*iptr == '(') + continue; + if (*iptr == ')') + { + state = 1; + continue; + } + *optr++ = *iptr; + } + *optr = '\0'; + return ret; +} + extern grub_uint32_t grub_total_modules_size __attribute__ ((section(".text"))); grub_addr_t grub_modbase; extern char _end[]; +static char boot_location[256]; void grub_machine_init (void) @@ -175,6 +209,9 @@ grub_machine_init (void) struct grub_arc_memory_descriptor *cur = NULL; grub_addr_t modend; + grub_memcpy (boot_location, + (char *) (GRUB_DECOMPRESSOR_LINK_ADDR - 256), 256); + grub_modbase = ALIGN_UP ((grub_addr_t) _end, GRUB_KERNEL_MACHINE_MOD_ALIGN); modend = grub_modbase + grub_total_modules_size; grub_console_init_early (); @@ -239,3 +276,133 @@ grub_exit (void) while (1); } +static char * +get_part (char *dev) +{ + char *ptr; + if (!*dev) + return 0; + ptr = dev + grub_strlen (dev) - 1; + if (ptr == dev || *ptr != ')') + return 0; + ptr--; + while (grub_isdigit (*ptr) && ptr > dev) + ptr--; + if (*ptr != '(' || ptr == dev) + return 0; + ptr--; + if (ptr - dev < (int) sizeof ("partition") - 2) + return 0; + ptr -= sizeof ("partition") - 2; + if (grub_memcmp (ptr, "partition", sizeof ("partition") - 1) != 0) + return 0; + return ptr; +} + +static grub_disk_addr_t +get_partition_offset (char *part, grub_disk_addr_t *en) +{ + grub_arc_fileno_t handle; + grub_disk_addr_t ret = -1; + struct grub_arc_fileinfo info; + grub_arc_err_t r; + + if (GRUB_ARC_FIRMWARE_VECTOR->open (part, GRUB_ARC_FILE_ACCESS_OPEN_RO, + &handle)) + return -1; + + r = GRUB_ARC_FIRMWARE_VECTOR->getfileinformation (handle, &info); + if (!r) + { + ret = (info.start >> 9); + *en = (info.end >> 9); + } + GRUB_ARC_FIRMWARE_VECTOR->close (handle); + return ret; +} + +struct get_device_name_ctx +{ + char *partition_name; + grub_disk_addr_t poff, pend; +}; + +static int +get_device_name_iter (grub_disk_t disk __attribute__ ((unused)), + const grub_partition_t part, void *data) +{ + struct get_device_name_ctx *ctx = data; + + if (grub_partition_get_start (part) == ctx->poff + && grub_partition_get_len (part) == ctx->pend) + { + ctx->partition_name = grub_partition_get_name (part); + return 1; + } + + return 0; +} + +void +grub_machine_get_bootlocation (char **device __attribute__ ((unused)), + char **path __attribute__ ((unused))) +{ + char *loaddev = boot_location; + char *pptr, *partptr; + char *dname; + grub_disk_addr_t poff = -1, pend; + struct get_device_name_ctx ctx; + grub_disk_t parent = 0; + + pptr = grub_strchr (loaddev, '/'); + if (pptr) + { + *path = grub_strdup (pptr); + *pptr = '\0'; + } + partptr = get_part (loaddev); + if (partptr) + { + poff = get_partition_offset (loaddev, &pend); + *partptr = '\0'; + } + dname = norm_name_to_alt (loaddev); + if (poff == (grub_addr_t) -1) + { + *device = dname; + return; + } + + parent = grub_disk_open (dname); + if (!parent) + { + *device = dname; + return; + } + + if (poff == 0 + && pend == grub_disk_get_size (parent)) + { + grub_disk_close (parent); + *device = dname; + return; + } + + ctx.partition_name = NULL; + ctx.poff = poff; + ctx.pend = pend; + + grub_partition_iterate (parent, get_device_name_iter, &ctx); + grub_disk_close (parent); + + if (! ctx.partition_name) + { + *device = dname; + return; + } + + *device = grub_xasprintf ("%s,%s", dname, + ctx.partition_name); + grub_free (ctx.partition_name); + grub_free (dname); +} diff --git a/grub-core/kern/mips/init.c b/grub-core/kern/mips/init.c index 353f679e6..14b8752ec 100644 --- a/grub-core/kern/mips/init.c +++ b/grub-core/kern/mips/init.c @@ -36,9 +36,3 @@ grub_get_rtc (void) return (((grub_uint64_t) high) << 32) | low; } - -void -grub_machine_get_bootlocation (char **device __attribute__ ((unused)), - char **path __attribute__ ((unused))) -{ -} diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c index 756439b13..1abcf1ab4 100644 --- a/grub-core/kern/mips/loongson/init.c +++ b/grub-core/kern/mips/loongson/init.c @@ -259,6 +259,12 @@ grub_exit (void) grub_halt (); } +void +grub_machine_get_bootlocation (char **device __attribute__ ((unused)), + char **path __attribute__ ((unused))) +{ +} + extern char _end[]; grub_addr_t grub_modbase = (grub_addr_t) _end; diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c index aa414ebc7..050f19f6a 100644 --- a/grub-core/kern/mips/qemu_mips/init.c +++ b/grub-core/kern/mips/qemu_mips/init.c @@ -98,6 +98,12 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data) return GRUB_ERR_NONE; } +void +grub_machine_get_bootlocation (char **device __attribute__ ((unused)), + char **path __attribute__ ((unused))) +{ +} + extern char _end[]; grub_addr_t grub_modbase = (grub_addr_t) _end; diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index cc072c2ae..f2b24b4d5 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -489,7 +489,7 @@ if [ -e "${iso9660_dir}"/boot/grub/sparc64-ieee1275/core.img ] && [ "$system_are grub_mkisofs_arguments="${grub_mkisofs_arguments} -G $sysarea_img -B , --grub2-sparc-core /boot/grub/sparc64-ieee1275/core.img" fi -make_image "${arcs_dir}" mips-arc "${iso9660_dir}/boot/grub/mips-arc/core.img" "" +make_image_fwdisk "${arcs_dir}" mips-arc "${iso9660_dir}/boot/grub/mips-arc/core.img" "" if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ]; then grub_mkisofs_arguments="${grub_mkisofs_arguments} /boot/grub/mips-arc/grub=${iso9660_dir}/boot/grub/mips-arc/core.img /boot/grub/mips-arc/sashARCS=${iso9660_dir}/boot/grub/mips-arc/core.img /boot/grub/mips-arc/sash=${iso9660_dir}/boot/grub/mips-arc/core.img" fi @@ -497,7 +497,7 @@ if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ] && [ "$system_area" = arc grub_mkisofs_arguments="${grub_mkisofs_arguments} -mips-boot /boot/grub/mips-arc/sashARCS -mips-boot /boot/grub/mips-arc/sash -mips-boot /boot/grub/mips-arc/grub" fi -make_image "${arc_dir}" mipsel-arc "${iso9660_dir}/boot/grub/arc.exe" "" +make_image_fwdisk "${arc_dir}" mipsel-arc "${iso9660_dir}/boot/grub/arc.exe" "" make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" "pata" if [ -e "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then From e7b8fd08c50cfa04f622dd63de6fd48bd675b42a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 19:44:00 +0200 Subject: [PATCH 094/187] Core compression test. --- ChangeLog | 4 ++++ Makefile.util.def | 6 ++++++ tests/util/grub-shell.in | 10 +++++++++- util/grub-mkrescue.in | 7 +++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 09a6c70af..67099391e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-27 Vladimir Serbinenko + + Core compression test. + 2013-04-27 Vladimir Serbinenko Implement grub_machine_get_bootlocation for ARC. diff --git a/Makefile.util.def b/Makefile.util.def index 1b71fd07f..caa6c059c 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -718,6 +718,12 @@ script = { common = tests/pseries_test.in; }; +script = { + testcase; + name = core_compress_test; + common = tests/core_compress_test.in; +}; + script = { testcase; name = xzcompress_test; diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index e00998a8e..b034e96a3 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -177,6 +177,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in esac timeout=60 +mkimage_extra_arg= # Check the arguments. for option in "$@"; do @@ -236,6 +237,13 @@ for option in "$@"; do --timeout=*) timeout=`echo "$option" | sed -e 's/--timeout=//'` ;; + + # Intentionally undocumented + --grub-mkimage-extra) + mkimage_extra_arg="$mkimage_extra_arg `argument $option "$@"`"; shift ;; + --grub-mkimage-extra=*) + mkimage_extra_arg="$mkimage_extra_arg `echo "$option" | sed 's/--grub-mkimage-extra=//'`" ;; + --boot=*) dev=`echo "$option" | sed -e 's/--boot=//'` if [ "$dev" = "fd" ] ; then boot=fd; @@ -325,7 +333,7 @@ echo "${halt_cmd}" >>${cfgfile} isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 if [ x$boot != xnet ] && [ x$boot != xemu ]; then pkgdatadir="@builddir@" sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--grub-render-label=${builddir}/grub-render-label" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \ - --rom-directory="${rom_directory}" ${mkrescue_args} \ + --rom-directory="${rom_directory}" "--grub-mkimage-extra=$mkimage_extra_arg" ${mkrescue_args} \ "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \ ${files} >/dev/null 2>&1 fi diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index f2b24b4d5..eab621e29 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -105,6 +105,7 @@ usage () { } system_area=auto +mkimage_extra_arg= # Check the arguments. while test $# -gt 0 @@ -154,6 +155,12 @@ do export PATH ;; + # Intentionally undocumented + --grub-mkimage-extra) + mkimage_extra_arg="$mkimage_extra_arg `argument $option "$@"`"; shift ;; + --grub-mkimage-extra=*) + mkimage_extra_arg="$mkimage_extra_arg `echo "$option" | sed 's/--grub-mkimage-extra=//'`" ;; + --sparc-boot) system_area=sparc64 ;; From 43168646d81f2b5d5d5ef2502db98a4f14318d38 Mon Sep 17 00:00:00 2001 From: Leon Drugi Date: Sat, 27 Apr 2013 21:16:55 +0200 Subject: [PATCH 095/187] * grub-core/loader/multiboot_mbi2.c (grub_multiboot_load): Fix cast in BSS clearing. --- ChangeLog | 5 +++++ grub-core/loader/multiboot_mbi2.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 67099391e..0f3eaf682 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-27 Leon Drugi + + * grub-core/loader/multiboot_mbi2.c (grub_multiboot_load): Fix cast in + BSS clearing. + 2013-04-27 Vladimir Serbinenko Core compression test. diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c index 900793a9b..ccd32a746 100644 --- a/grub-core/loader/multiboot_mbi2.c +++ b/grub-core/loader/multiboot_mbi2.c @@ -251,7 +251,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) } if (addr_tag->bss_end_addr) - grub_memset ((grub_uint32_t *) source + load_size, 0, + grub_memset ((grub_uint8_t *) source + load_size, 0, addr_tag->bss_end_addr - addr_tag->load_addr - load_size); } else From c796a107b6bafa37716556984f987ce19638a0e9 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 21:49:14 +0200 Subject: [PATCH 096/187] * grub-core/disk/ahci.c (grub_ahci_pciinit): Fix handling of empty ports. --- ChangeLog | 5 +++++ grub-core/disk/ahci.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f3eaf682..317a367cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-27 Vladimir Serbinenko + + * grub-core/disk/ahci.c (grub_ahci_pciinit): Fix handling of empty + ports. + 2013-04-27 Leon Drugi * grub-core/loader/multiboot_mbi2.c (grub_multiboot_load): Fix cast in diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c index 29fe2460f..47fd423e4 100644 --- a/grub-core/disk/ahci.c +++ b/grub-core/disk/ahci.c @@ -350,7 +350,7 @@ grub_ahci_pciinit (grub_pci_device_t dev, continue; } - adevs[i] = grub_malloc (sizeof (*adevs[i])); + adevs[i] = grub_zalloc (sizeof (*adevs[i])); if (!adevs[i]) return 1; @@ -619,9 +619,9 @@ grub_ahci_pciinit (grub_pci_device_t dev, for (i = 0; i < nports; i++) if (failed_adevs[i]) { - grub_dma_free (adevs[i]->command_list_chunk); - grub_dma_free (adevs[i]->command_table_chunk); - grub_dma_free (adevs[i]->rfis); + grub_dma_free (failed_adevs[i]->command_list_chunk); + grub_dma_free (failed_adevs[i]->command_table_chunk); + grub_dma_free (failed_adevs[i]->rfis); } for (i = 0; i < nports; i++) From 1dd70ebd5878a690ab531ec3feaccaf3ad5c154a Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Sat, 27 Apr 2013 22:03:13 +0200 Subject: [PATCH 097/187] * util/ieee1275/ofpath.c (of_path_of_scsi): Fix path output for sas disks. (check_sas): Get sas_adress info. --- ChangeLog | 6 ++++ util/ieee1275/ofpath.c | 76 +++++++++++++++++++++++++++++++++--------- 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 317a367cf..83cdafce0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-27 Paulo Flabiano Smorigo + + * util/ieee1275/ofpath.c (of_path_of_scsi): Fix path output for sas + disks. + (check_sas): Get sas_adress info. + 2013-04-27 Vladimir Serbinenko * grub-core/disk/ahci.c (grub_ahci_pciinit): Fix handling of empty diff --git a/util/ieee1275/ofpath.c b/util/ieee1275/ofpath.c index f0a34b587..5fde97996 100644 --- a/util/ieee1275/ofpath.c +++ b/util/ieee1275/ofpath.c @@ -324,11 +324,11 @@ vendor_is_ATA(const char *path) } static void -check_sas (char *sysfs_path, int *tgt) +check_sas (char *sysfs_path, int *tgt, unsigned long int *sas_address) { char *ed = strstr (sysfs_path, "end_device"); char *p, *q, *path; - char phy[16]; + char phy[21]; int fd; size_t path_size; @@ -348,16 +348,25 @@ check_sas (char *sysfs_path, int *tgt) + sizeof ("%s/sas_device/%s/phy_identifier")); path = xmalloc (path_size); snprintf (path, path_size, "%s/sas_device/%s/phy_identifier", p, ed); - fd = open (path, O_RDONLY); if (fd < 0) grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); memset (phy, 0, sizeof (phy)); - read (fd, phy, sizeof (phy)); + read (fd, phy, sizeof (phy) - 1); + close (fd); sscanf (phy, "%d", tgt); + snprintf (path, path_size, "%s/sas_device/%s/sas_address", p, ed); + fd = open (path, O_RDONLY); + if (fd < 0) + grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); + + memset (phy, 0, sizeof (phy)); + read (fd, phy, sizeof (phy) - 1); + sscanf (phy, "%lx", sas_address); + free (path); free (p); close (fd); @@ -370,13 +379,14 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev { const char *p, *digit_string, *disk_name; int host, bus, tgt, lun; + unsigned long int sas_address; char *sysfs_path, disk[MAX_DISK_CAT - sizeof ("/fp@0,0")]; char *of_path; sysfs_path = block_device_get_sysfs_path_and_link(devicenode); p = get_basename (sysfs_path); sscanf(p, "%d:%d:%d:%d", &host, &bus, &tgt, &lun); - check_sas (sysfs_path, &tgt); + check_sas (sysfs_path, &tgt, &sas_address); if (vendor_is_ATA(sysfs_path)) { @@ -417,18 +427,52 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev } else { - if (*digit_string == '\0') - { - snprintf(disk, sizeof (disk), "/%s@%x,%d", disk_name, tgt, lun); - } - else - { - int part; + if (lun == 0) + { + int sas_id = 0; + sas_id = bus << 16 | tgt << 8 | lun; - sscanf(digit_string, "%d", &part); - snprintf(disk, sizeof (disk), - "/%s@%x,%d:%c", disk_name, tgt, lun, 'a' + (part - 1)); - } + if (*digit_string == '\0') + { + snprintf(disk, sizeof (disk), "/sas/%s@%x", disk_name, sas_id); + } + else + { + int part; + + sscanf(digit_string, "%d", &part); + snprintf(disk, sizeof (disk), + "/sas/%s@%x:%c", disk_name, sas_id, 'a' + (part - 1)); + } + } + else + { + char *lunstr; + int lunpart[4]; + + lunstr = xmalloc (20); + + lunpart[0] = (lun >> 8) & 0xff; + lunpart[1] = lun & 0xff; + lunpart[2] = (lun >> 24) & 0xff; + lunpart[3] = (lun >> 16) & 0xff; + + sprintf(lunstr, "%02x%02x%02x%02x00000000", lunpart[0], lunpart[1], lunpart[2], lunpart[3]); + long int longlun = atol(lunstr); + + if (*digit_string == '\0') + { + snprintf(disk, sizeof (disk), "/sas/%s@%lx,%lu", disk_name, sas_address, longlun); + } + else + { + int part; + + sscanf(digit_string, "%d", &part); + snprintf(disk, sizeof (disk), + "/sas/%s@%lx,%lu:%c", disk_name, sas_address, longlun, 'a' + (part - 1)); + } + } } strcat(of_path, disk); return of_path; From 141e2a7816486274219cc24a9c7097a88e5ae382 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 22:47:57 +0200 Subject: [PATCH 098/187] * grub-core/term/ns8250.c: Systematically probe ports by writing to SR before using them. --- ChangeLog | 5 +++++ grub-core/term/ns8250.c | 46 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83cdafce0..43b2906a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-27 Vladimir Serbinenko + + * grub-core/term/ns8250.c: Systematically probe ports by writing + to SR before using them. + 2013-04-27 Paulo Flabiano Smorigo * util/ieee1275/ofpath.c (of_path_of_scsi): Fix path output for sas diff --git a/grub-core/term/ns8250.c b/grub-core/term/ns8250.c index e6947f5e6..2064e0dc9 100644 --- a/grub-core/term/ns8250.c +++ b/grub-core/term/ns8250.c @@ -36,6 +36,8 @@ static const grub_port_t serial_hw_io_addr[] = GRUB_MACHINE_SERIAL_PORTS; #define GRUB_SERIAL_PORT_NUM (ARRAY_SIZE(serial_hw_io_addr)) #endif +static int dead_ports = 0; + /* Convert speed to divisor. */ static unsigned short serial_get_divisor (const struct grub_serial_port *port __attribute__ ((unused)), @@ -83,6 +85,8 @@ do_real_config (struct grub_serial_port *port) { int divisor; unsigned char status = 0; + grub_uint64_t endtime; + const unsigned char parities[] = { [GRUB_SERIAL_PARITY_NONE] = UART_NO_PARITY, [GRUB_SERIAL_PARITY_ODD] = UART_ODD_PARITY, @@ -132,8 +136,16 @@ do_real_config (struct grub_serial_port *port) #endif /* Drain the input buffer. */ + endtime = grub_get_time_ms () + 1000; while (grub_inb (port->port + UART_LSR) & UART_DATA_READY) - grub_inb (port->port + UART_RX); + { + grub_inb (port->port + UART_RX); + if (grub_get_time_ms () > endtime) + { + port->broken = 1; + break; + } + } port->configured = 1; } @@ -239,6 +251,20 @@ grub_ns8250_init (void) if (serial_hw_io_addr[i]) { grub_err_t err; + + grub_outb (0x5a, serial_hw_io_addr[i] + UART_SR); + if (grub_inb (serial_hw_io_addr[i] + UART_SR) != 0x5a) + { + dead_ports |= (1 << i); + continue; + } + grub_outb (0xa5, serial_hw_io_addr[i] + UART_SR); + if (grub_inb (serial_hw_io_addr[i] + UART_SR) != 0xa5) + { + dead_ports |= (1 << i); + continue; + } + grub_snprintf (com_names[i], sizeof (com_names[i]), "com%d", i); com_ports[i].name = com_names[i]; com_ports[i].driver = &grub_ns8250_driver; @@ -255,7 +281,8 @@ grub_ns8250_init (void) grub_port_t grub_ns8250_hw_get_port (const unsigned int unit) { - if (unit < GRUB_SERIAL_PORT_NUM) + if (unit < GRUB_SERIAL_PORT_NUM + && !(dead_ports & (1 << unit))) return serial_hw_io_addr[unit]; else return 0; @@ -268,7 +295,20 @@ grub_serial_ns8250_add_port (grub_port_t port) unsigned i; for (i = 0; i < GRUB_SERIAL_PORT_NUM; i++) if (com_ports[i].port == port) - return com_names[i]; + { + if (dead_ports & (1 << i)) + return NULL; + return com_names[i]; + } + + grub_outb (0x5a, port + UART_SR); + if (grub_inb (port + UART_SR) != 0x5a) + return NULL; + + grub_outb (0xa5, port + UART_SR); + if (grub_inb (port + UART_SR) != 0xa5) + return NULL; + p = grub_malloc (sizeof (*p)); if (!p) return NULL; From b75e66135f0121763ae48137d251ae8e17240a29 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 27 Apr 2013 22:55:02 +0200 Subject: [PATCH 099/187] missing file --- tests/core_compress_test.in | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/core_compress_test.in diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in new file mode 100644 index 000000000..bd57f6f56 --- /dev/null +++ b/tests/core_compress_test.in @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +# FIXME: Only mips currently supports configurable core compression +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu | i386-* | x86_64-* | sparc64-* | ia64-*) + exit 0 + ;; +esac + + +if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=-C --grub-mkimage-extra=xz)" != "Hello World" ]; then + exit 1 +fi + +if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=-C --grub-mkimage-extra=none)" != "Hello World" ]; then + exit 1 +fi From b2d7470c15444e49b5356b40f7b7ae86548ea221 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Sat, 27 Apr 2013 23:06:52 +0200 Subject: [PATCH 100/187] * include/grub/macho.h: Set GRUB_MACHO_FAT_EFI_MAGIC as unsigned. --- ChangeLog | 4 ++++ include/grub/macho.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 43b2906a8..3144dd0fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-27 Paulo Flabiano Smorigo + + * include/grub/macho.h: Set GRUB_MACHO_FAT_EFI_MAGIC as unsigned. + 2013-04-27 Vladimir Serbinenko * grub-core/term/ns8250.c: Systematically probe ports by writing diff --git a/include/grub/macho.h b/include/grub/macho.h index 18434ff8e..2bfc30f1a 100644 --- a/include/grub/macho.h +++ b/include/grub/macho.h @@ -34,7 +34,7 @@ enum }; #define GRUB_MACHO_FAT_MAGIC 0xcafebabe -#define GRUB_MACHO_FAT_EFI_MAGIC 0x0ef1fab9 +#define GRUB_MACHO_FAT_EFI_MAGIC 0x0ef1fab9U typedef grub_uint32_t grub_macho_cpu_type_t; typedef grub_uint32_t grub_macho_cpu_subtype_t; From f97ec54645756b6f9f79feefb1f01738018e7787 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 13:27:51 +0200 Subject: [PATCH 101/187] * grub-core/term/morse.c: Macroify dih and dah. --- ChangeLog | 4 +++ grub-core/term/morse.c | 75 ++++++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3144dd0fe..287770e33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + * grub-core/term/morse.c: Macroify dih and dah. + 2013-04-27 Paulo Flabiano Smorigo * include/grub/macho.h: Set GRUB_MACHO_FAT_EFI_MAGIC as unsigned. diff --git a/grub-core/term/morse.c b/grub-core/term/morse.c index 0fdc3b416..ba84dfe14 100644 --- a/grub-core/term/morse.c +++ b/grub-core/term/morse.c @@ -27,45 +27,48 @@ GRUB_MOD_LICENSE ("GPLv3+"); #define BASE_TIME 250 +#define DIH 1 +#define DAH 3 +#define END 0 static const char codes[0x80][6] = { - ['0'] = { 3, 3, 3, 3, 3, 0 }, - ['1'] = { 1, 3, 3, 3, 3, 0 }, - ['2'] = { 1, 1, 3, 3, 3, 0 }, - ['3'] = { 1, 1, 1, 3, 3, 0 }, - ['4'] = { 1, 1, 1, 1, 3, 0 }, - ['5'] = { 1, 1, 1, 1, 1, 0 }, - ['6'] = { 3, 1, 1, 1, 1, 0 }, - ['7'] = { 3, 3, 1, 1, 1, 0 }, - ['8'] = { 3, 3, 3, 1, 1, 0 }, - ['9'] = { 3, 3, 3, 3, 1, 0 }, - ['a'] = { 1, 3, 0 }, - ['b'] = { 3, 1, 1, 1, 0 }, - ['c'] = { 3, 1, 3, 1, 0 }, - ['d'] = { 3, 1, 1, 0 }, - ['e'] = { 1, 0 }, - ['f'] = { 1, 1, 3, 1, 0 }, - ['g'] = { 3, 3, 1, 0 }, - ['h'] = { 1, 1, 1, 1, 0 }, - ['i'] = { 1, 1, 0 }, - ['j'] = { 1, 3, 3, 3, 0 }, - ['k'] = { 3, 1, 3, 0 }, - ['l'] = { 1, 3, 1, 1, 0 }, - ['m'] = { 3, 3, 0 }, - ['n'] = { 3, 1, 0 }, - ['o'] = { 3, 3, 3, 0 }, - ['p'] = { 1, 3, 3, 1, 0 }, - ['q'] = { 3, 3, 1, 3, 0 }, - ['r'] = { 1, 3, 1, 0 }, - ['s'] = { 1, 1, 1, 0 }, - ['t'] = { 3, 0 }, - ['u'] = { 1, 1, 3, 0 }, - ['v'] = { 1, 1, 1, 3, 0 }, - ['w'] = { 1, 3, 3, 0 }, - ['x'] = { 3, 1, 1, 3, 0 }, - ['y'] = { 3, 1, 3, 3, 0 }, - ['z'] = { 3, 3, 1, 1, 0 } + ['0'] = { DAH, DAH, DAH, DAH, DAH, END }, + ['1'] = { DIH, DAH, DAH, DAH, DAH, END }, + ['2'] = { DIH, DIH, DAH, DAH, DAH, END }, + ['3'] = { DIH, DIH, DIH, DAH, DAH, END }, + ['4'] = { DIH, DIH, DIH, DIH, DAH, END }, + ['5'] = { DIH, DIH, DIH, DIH, DIH, END }, + ['6'] = { DAH, DIH, DIH, DIH, DIH, END }, + ['7'] = { DAH, DAH, DIH, DIH, DIH, END }, + ['8'] = { DAH, DAH, DAH, DIH, DIH, END }, + ['9'] = { DAH, DAH, DAH, DAH, DIH, END }, + ['a'] = { DIH, DAH, END }, + ['b'] = { DAH, DIH, DIH, DIH, END }, + ['c'] = { DAH, DIH, DAH, DIH, END }, + ['d'] = { DAH, DIH, DIH, END }, + ['e'] = { DIH, END }, + ['f'] = { DIH, DIH, DAH, DIH, END }, + ['g'] = { DAH, DAH, DIH, END }, + ['h'] = { DIH, DIH, DIH, DIH, END }, + ['i'] = { DIH, DIH, END }, + ['j'] = { DIH, DAH, DAH, DAH, END }, + ['k'] = { DAH, DIH, DAH, END }, + ['l'] = { DIH, DAH, DIH, DIH, END }, + ['m'] = { DAH, DAH, END }, + ['n'] = { DAH, DIH, END }, + ['o'] = { DAH, DAH, DAH, END }, + ['p'] = { DIH, DAH, DAH, DIH, END }, + ['q'] = { DAH, DAH, DIH, DAH, END }, + ['r'] = { DIH, DAH, DIH, END }, + ['s'] = { DIH, DIH, DIH, END }, + ['t'] = { DAH, END }, + ['u'] = { DIH, DIH, DAH, END }, + ['v'] = { DIH, DIH, DIH, DAH, END }, + ['w'] = { DIH, DAH, DAH, END }, + ['x'] = { DAH, DIH, DIH, DAH, END }, + ['y'] = { DAH, DIH, DAH, DAH, END }, + ['z'] = { DAH, DAH, DIH, DIH, END } }; static void From d417ddc4e43e61e6e1a316e20c0da2055a1a4d82 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 13:35:51 +0200 Subject: [PATCH 102/187] Move --directory/--override-directorry to grub-install_header and unify. --- ChangeLog | 4 +++ util/grub-install.in | 29 +++++++++------------- util/grub-install_header | 14 +++++++++++ util/grub-mknetdir.in | 8 ------ util/grub-mkrescue.in | 51 +++++++++++++++------------------------ util/grub-mkstandalone.in | 9 ------- 6 files changed, 48 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index 287770e33..f058b20fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + Move --directory/--override-directorry to grub-install_header and unify. + 2013-04-28 Vladimir Serbinenko * grub-core/term/morse.c: Macroify dih and dah. diff --git a/util/grub-install.in b/util/grub-install.in index 271e447ef..d69ef3a41 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -32,7 +32,6 @@ export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAINDIR="@localedir@" host_os=@host_os@ -source_dir= target= datadir="@datadir@" if [ "x$pkgdatadir" = x ]; then @@ -96,7 +95,6 @@ usage () { target_trans="$(gettext "TARGET")" # TRANSLATORS: "current" refers to the platform user's currently running on print_option_help "--target=$target_trans" "$(gettext "install GRUB for TARGET platform [default=current]")" - print_option_help "--directory=$(gettext "DIR")" "$(gettext "use GRUB images from DIR. Takes precedence over target")" print_option_help "--grub-setup=$(gettext "FILE")" "$(gettext "use FILE as grub-setup")" print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" print_option_help "--grub-mkrelpath=$(gettext "FILE")" "$(gettext "use FILE as grub-mkrelpath")" @@ -176,11 +174,6 @@ do --efi-directory=*) efidir="`echo "$option" | sed 's/--efi-directory=//'`" ;; - --directory | -d) - source_dir="`argument $option "$@"`"; shift;; - --directory=*) - source_dir="`echo "$option" | sed 's/--directory=//'`" ;; - --target) target="`argument $option "$@"`"; shift;; --target=*) @@ -264,7 +257,7 @@ do esac done -if [ x$source_dir = x ]; then +if [ x$source_directory = x ]; then if [ x$target = x ]; then case x"`uname -m`" in x"powerpc"* | x"ppc"*) @@ -321,15 +314,15 @@ if [ x$source_dir = x ]; then echo ;; esac fi - source_dir="${libdir}/@PACKAGE@/$target" + source_directory="${libdir}/@PACKAGE@/$target" fi -if ! [ -d "$source_dir" ]; then - gettext_printf "%s doesn't exist. Please specify --target or --directory\\n" "$source_dir" +if ! [ -d "$source_directory" ]; then + gettext_printf "%s doesn't exist. Please specify --target or --directory\\n" "$source_directory" exit 1 fi -. "${source_dir}"/modinfo.sh +. "${source_directory}"/modinfo.sh if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] ; then if [ x$disk_module = xunspecified ]; then @@ -516,10 +509,10 @@ else fi # Copy the GRUB images to the GRUB directory. -grub_install_files "${source_dir}" "${grubdir}" "${grub_modinfo_target_cpu}-$grub_modinfo_platform" all +grub_install_files "${source_directory}" "${grubdir}" "${grub_modinfo_target_cpu}-$grub_modinfo_platform" all if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ] ; then - for file in "${source_dir}"/*.img "${source_dir}"/efiemu??.o; do + for file in "${source_directory}"/*.img "${source_directory}"/efiemu??.o; do if test -f "$file"; then cp -f "$file" "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform" || exit 1 fi @@ -685,9 +678,9 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in esac if [ x"$config_opt_file" = x ]; then - "$grub_mkimage" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1 + "$grub_mkimage" -d "${source_directory}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1 else - "$grub_mkimage" -c "${config_opt_file}" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1 + "$grub_mkimage" -c "${config_opt_file}" -d "${source_directory}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $grub_decompression_module $modules || exit 1 fi # Backward-compatibility kludges @@ -698,9 +691,9 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ] elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-efi" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "x86_64-efi" ]; then if [ x"$config_opt_file" = x ]; then - "$grub_mkimage" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1 + "$grub_mkimage" -d "${source_directory}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1 else - "$grub_mkimage" -c "${config_opt_file}" -d "${source_dir}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1 + "$grub_mkimage" -c "${config_opt_file}" -d "${source_directory}" -O "${mkimage_target}" --output="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/grub.efi" --prefix="" $grub_decompression_module $modules || exit 1 fi fi diff --git a/util/grub-install_header b/util/grub-install_header index 805fc4fd1..72d91e9ed 100644 --- a/util/grub-install_header +++ b/util/grub-install_header @@ -126,6 +126,9 @@ grub_print_install_files_help () { print_option_help "--fonts=FONTS" "$(gettext_printf "install FONTS [default=%s]" "unicode")" print_option_help "--locales=LOCALES" "$(gettext_printf "install only LOCALES [default=all]")" print_option_help "--compress[=no,xz,gz,lzo]" "$(gettext "compress GRUB files [optional]")" + # TRANSLATORS: platform here isn't identifier. It can be translated. + dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/]" "${libdir}/@PACKAGE@")" + print_option_help "-d, --directory=$(gettext "DIR")" "$dir_msg" } install_modules=all @@ -136,6 +139,7 @@ compress=no grub_decompression_module="" compressor="" compressor_opts="" +source_directory="" argument () { opt=$1 @@ -198,6 +202,16 @@ grub_process_install_options () { grub_parse_compress `argument $option "$@"`; grub_process_install_options_consumed=2; return ;; --compress=*) grub_parse_compress `echo "${option}" | sed 's/--compress=//'`; grub_process_install_options_consumed=1; return ;; + --directory | -d) + source_directory=`argument $option "$@"`; grub_process_install_options_consumed=2 ;; + --directory=*) + source_directory=`echo "$option" | sed 's/--directory=//'` grub_process_install_options_consumed=1;; + + # For backwards compatibility + --override-directory) + source_directory=`argument $option "$@"`; grub_process_install_options_consumed=2 ;; + --override-directory=*) + source_directory=`echo "$option" | sed 's/--override-directory=//'` grub_process_install_options_consumed=1;; esac } diff --git a/util/grub-mknetdir.in b/util/grub-mknetdir.in index d32de462e..051b98556 100644 --- a/util/grub-mknetdir.in +++ b/util/grub-mknetdir.in @@ -66,9 +66,6 @@ usage () { print_option_help "--net-directory=$(gettext "DIR")" "$(gettext "root directory of TFTP server")" print_option_help "--subdir=$(gettext "DIR")" "$(gettext "relative subdirectory on network server")" print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" - # TRANSLATORS: platform here isn't identifier. It can be translated. - dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/]" "${libdir}/@PACKAGE@")" - print_option_help "-d, --directory=$(gettext "DIR")" "$dir_msg" echo gettext_printf "%s copies GRUB images into net_directory/subdir/target_cpu-platform\n" "$self" echo @@ -123,11 +120,6 @@ do --debug-image=*) debug_image=`echo "$option" | sed 's/--debug-image=//'` ;; - --directory | -d) - source_directory=`argument $option "$@"`; shift ;; - --directory=*) - source_directory=`echo "$option" | sed 's/--directory=//'` ;; - -*) gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2 usage diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index eab621e29..a8d492e82 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -1,3 +1,4 @@ +#!/bin/sh # Make GRUB rescue image # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. @@ -49,7 +50,6 @@ arcs_dir="${libdir}/@PACKAGE@/mips-arc" arc_dir="${libdir}/@PACKAGE@/mipsel-arc" ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" rom_directory= -override_dir= grub_mkimage="${bindir}/@grub_mkimage@" grub_render_label="${bindir}/@grub_render_label@" grub_glue_efi="${bindir}/@grub_glue_efi@" @@ -142,19 +142,6 @@ do --rom-directory=*) rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;; - # Intentionally undocumented - --override-directory) - override_dir=`argument $option "$@"` - shift - PATH=${override_dir}:$PATH - export PATH - ;; - --override-directory=*) - override_dir=`echo "${option}/" | sed 's/--override-directory=//'` - PATH=${override_dir}:$PATH - export PATH - ;; - # Intentionally undocumented --grub-mkimage-extra) mkimage_extra_arg="$mkimage_extra_arg `argument $option "$@"`"; shift ;; @@ -280,7 +267,7 @@ make_image_fwdisk () $grub_decompression_module iso9660 $4 } -if [ "${override_dir}" = "" ] ; then +if [ "${source_directory}" = "" ] ; then if [ "$system_area" = auto ]; then if test -e "${pc_dir}" || test -e "${ppc_dir}" \ || test -e "${efi32_dir}" || test -e "${efi64_dir}"; then @@ -337,8 +324,8 @@ if [ "${override_dir}" = "" ] ; then process_input_dir "${arc_dir}" mipsel-arc fi else - . "${override_dir}"/modinfo.sh - process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform} + . "${source_directory}"/modinfo.sh + process_input_dir "${source_directory}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform} multiboot_dir= pc_dir= efi32_dir= @@ -355,21 +342,21 @@ else arcs_dir= arc_dir= case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in - i386-multiboot) multiboot_dir="${override_dir}" ;; - i386-coreboot) coreboot_dir="${override_dir}" ;; - i386-qemu) qemu_dir="${override_dir}" ;; - i386-pc) pc_dir="${override_dir}"; system_area=common;; - i386-efi) efi32_dir="${override_dir}"; system_area=common ;; - x86_64-efi) efi64_dir="${override_dir}"; system_area=common ;; - ia64-efi) ia64_dir="${override_dir}" ;; - mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;; - mipsel-loongson) loongson_dir="${override_dir}" ;; - mips-qemu_mips) mips_qemu_dir="${override_dir}" ;; - powerpc-ieee1275) ppc_dir="${override_dir}"; system_area=common ;; - sparc64-ieee1275) sparc64_dir="${override_dir}"; system_area=sparc64 ;; - mips-arc) arcs_dir="${override_dir}"; system_area=arcs ;; - mipsel-arc) arc_dir="${override_dir}" ;; - i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;; + i386-multiboot) multiboot_dir="${source_directory}" ;; + i386-coreboot) coreboot_dir="${source_directory}" ;; + i386-qemu) qemu_dir="${source_directory}" ;; + i386-pc) pc_dir="${source_directory}"; system_area=common;; + i386-efi) efi32_dir="${source_directory}"; system_area=common ;; + x86_64-efi) efi64_dir="${source_directory}"; system_area=common ;; + ia64-efi) ia64_dir="${source_directory}" ;; + mipsel-qemu_mips) mipsel_qemu_dir="${source_directory}" ;; + mipsel-loongson) loongson_dir="${source_directory}" ;; + mips-qemu_mips) mips_qemu_dir="${source_directory}" ;; + powerpc-ieee1275) ppc_dir="${source_directory}"; system_area=common ;; + sparc64-ieee1275) sparc64_dir="${source_directory}"; system_area=sparc64 ;; + mips-arc) arcs_dir="${source_directory}"; system_area=arcs ;; + mipsel-arc) arc_dir="${source_directory}" ;; + i386-ieee1275) i386_ieee1275_dir="${source_directory}" ;; esac fi diff --git a/util/grub-mkstandalone.in b/util/grub-mkstandalone.in index 927075be6..30dd90fe0 100644 --- a/util/grub-mkstandalone.in +++ b/util/grub-mkstandalone.in @@ -33,7 +33,6 @@ fi self=`basename $0` -source_directory= compression=auto format= grub_mkimage="${bindir}/@grub_mkimage@" @@ -54,9 +53,6 @@ usage () { print_option_help "-h, --help" "$(gettext "print this message and exit")" print_option_help "-v, --version" "$(gettext "print the version information and exit")" print_option_help "-o, --output=$(gettext FILE)" "$(gettext "save output in FILE [required]")" - # TRANSLATORS: platform here isn't identifier. It can be translated. - dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/]" "${libdir}/@PACKAGE@")" - print_option_help "-d, --directory=$(gettext "DIR")" "$dir_msg" print_option_help "-O, --format=$(gettext "FORMAT")" "$(gettext "generate an image in FORMAT")"; echo print_option_help "" "$(gettext "available formats:") $formats" echo @@ -98,11 +94,6 @@ do --output=*) output_image=`echo "$option" | sed 's/--output=//'` ;; - --directory | -d) - source_directory=`argument $option "$@"`; shift ;; - --directory=*) - source_directory=`echo "$option" | sed 's/--directory=//'` ;; - --grub-mkimage) grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) From 965fa8294057f55c56f006d06d30f50f4c55258d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 13:49:21 +0200 Subject: [PATCH 103/187] Remove POTFILES.in and regenerate it in autogen.sh. --- .bzrignore | 1 + ChangeLog | 4 + autogen.sh | 2 + po/POTFILES.in | 1043 ------------------------------------------------ 4 files changed, 7 insertions(+), 1043 deletions(-) delete mode 100644 po/POTFILES.in diff --git a/.bzrignore b/.bzrignore index c6797ad8f..1e8924bdf 100644 --- a/.bzrignore +++ b/.bzrignore @@ -174,3 +174,4 @@ po/*.gmo po/LINGUAS include/grub/gcrypt/gcrypt.h include/grub/gcrypt/g10lib.h +po/POTFILES.in diff --git a/ChangeLog b/ChangeLog index f058b20fa..0dcf7b03c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + Remove POTFILES.in and regenerate it in autogen.sh. + 2013-04-28 Vladimir Serbinenko Move --directory/--override-directorry to grub-install_header and unify. diff --git a/autogen.sh b/autogen.sh index 48d7a6e82..00fdafca9 100755 --- a/autogen.sh +++ b/autogen.sh @@ -6,6 +6,8 @@ export LC_CTYPE=C export LC_COLLATE=C unset LC_ALL +find . -iname '*.[ch]' -not -ipath './grub-core/lib/libgcrypt-grub/*' -not -ipath './build-aux/*' |sort > po/POTFILES.in + autogen --version >/dev/null || exit 1 echo "Importing unicode..." diff --git a/po/POTFILES.in b/po/POTFILES.in deleted file mode 100644 index ac394189c..000000000 --- a/po/POTFILES.in +++ /dev/null @@ -1,1043 +0,0 @@ -./grub-core/boot/decompressor/minilib.c -./grub-core/boot/decompressor/none.c -./grub-core/boot/decompressor/xz.c -./grub-core/bus/bonito.c -./grub-core/bus/cs5536.c -./grub-core/bus/emu/pci.c -./grub-core/bus/pci.c -./grub-core/bus/usb/ehci.c -./grub-core/bus/usb/emu/usb.c -./grub-core/bus/usb/ohci.c -./grub-core/bus/usb/serial/common.c -./grub-core/bus/usb/serial/ftdi.c -./grub-core/bus/usb/serial/pl2303.c -./grub-core/bus/usb/serial/usbdebug_late.c -./grub-core/bus/usb/uhci.c -./grub-core/bus/usb/usb.c -./grub-core/bus/usb/usbhub.c -./grub-core/bus/usb/usbtrans.c -./grub-core/commands/acpi.c -./grub-core/commands/acpihalt.c -./grub-core/commands/arc/lsdev.c -./grub-core/commands/blocklist.c -./grub-core/commands/boot.c -./grub-core/commands/boottime.c -./grub-core/commands/cacheinfo.c -./grub-core/commands/cat.c -./grub-core/commands/cmp.c -./grub-core/commands/configfile.c -./grub-core/commands/date.c -./grub-core/commands/echo.c -./grub-core/commands/efi/acpi.c -./grub-core/commands/efi/efifwsetup.c -./grub-core/commands/efi/fixvideo.c -./grub-core/commands/efi/loadbios.c -./grub-core/commands/efi/lsefi.c -./grub-core/commands/efi/lsefimmap.c -./grub-core/commands/efi/lsefisystab.c -./grub-core/commands/efi/lssal.c -./grub-core/commands/extcmd.c -./grub-core/commands/gptsync.c -./grub-core/commands/halt.c -./grub-core/commands/hashsum.c -./grub-core/commands/hdparm.c -./grub-core/commands/help.c -./grub-core/commands/hexdump.c -./grub-core/commands/i386/cmosdump.c -./grub-core/commands/i386/cmostest.c -./grub-core/commands/i386/coreboot/cbls.c -./grub-core/commands/i386/coreboot/cb_timestamps.c -./grub-core/commands/i386/cpuid.c -./grub-core/commands/i386/pc/acpi.c -./grub-core/commands/i386/pc/drivemap.c -./grub-core/commands/i386/pc/halt.c -./grub-core/commands/i386/pc/lsapm.c -./grub-core/commands/i386/pc/play.c -./grub-core/commands/i386/pc/sendkey.c -./grub-core/commands/ieee1275/suspend.c -./grub-core/commands/iorw.c -./grub-core/commands/keylayouts.c -./grub-core/commands/keystatus.c -./grub-core/commands/legacycfg.c -./grub-core/commands/loadenv.c -./grub-core/commands/lsacpi.c -./grub-core/commands/ls.c -./grub-core/commands/lsmmap.c -./grub-core/commands/lspci.c -./grub-core/commands/memrw.c -./grub-core/commands/menuentry.c -./grub-core/commands/minicmd.c -./grub-core/commands/mips/loongson/lsspd.c -./grub-core/commands/parttool.c -./grub-core/commands/password.c -./grub-core/commands/password_pbkdf2.c -./grub-core/commands/pcidump.c -./grub-core/commands/probe.c -./grub-core/commands/read.c -./grub-core/commands/reboot.c -./grub-core/commands/regexp.c -./grub-core/commands/search.c -./grub-core/commands/search_file.c -./grub-core/commands/search_label.c -./grub-core/commands/search_uuid.c -./grub-core/commands/search_wrap.c -./grub-core/commands/setpci.c -./grub-core/commands/sleep.c -./grub-core/commands/terminal.c -./grub-core/commands/test.c -./grub-core/commands/testload.c -./grub-core/commands/time.c -./grub-core/commands/true.c -./grub-core/commands/usbtest.c -./grub-core/commands/verify.c -./grub-core/commands/videoinfo.c -./grub-core/commands/videotest.c -./grub-core/commands/wildcard.c -./grub-core/commands/xnu_uuid.c -./grub-core/disk/AFSplitter.c -./grub-core/disk/ahci.c -./grub-core/disk/arc/arcdisk.c -./grub-core/disk/ata.c -./grub-core/disk/cryptodisk.c -./grub-core/disk/diskfilter.c -./grub-core/disk/dmraid_nvidia.c -./grub-core/disk/efi/efidisk.c -./grub-core/disk/geli.c -./grub-core/disk/host.c -./grub-core/disk/i386/pc/biosdisk.c -./grub-core/disk/ieee1275/nand.c -./grub-core/disk/ieee1275/ofdisk.c -./grub-core/disk/ldm.c -./grub-core/disk/loopback.c -./grub-core/disk/luks.c -./grub-core/disk/lvm.c -./grub-core/disk/mdraid1x_linux.c -./grub-core/disk/mdraid_linux_be.c -./grub-core/disk/mdraid_linux.c -./grub-core/disk/memdisk.c -./grub-core/disk/pata.c -./grub-core/disk/raid5_recover.c -./grub-core/disk/raid6_recover.c -./grub-core/disk/scsi.c -./grub-core/disk/usbms.c -./grub-core/efiemu/i386/coredetect.c -./grub-core/efiemu/i386/loadcore32.c -./grub-core/efiemu/i386/loadcore64.c -./grub-core/efiemu/i386/nocfgtables.c -./grub-core/efiemu/i386/pc/cfgtables.c -./grub-core/efiemu/loadcore32.c -./grub-core/efiemu/loadcore64.c -./grub-core/efiemu/loadcore.c -./grub-core/efiemu/loadcore_common.c -./grub-core/efiemu/main.c -./grub-core/efiemu/mm.c -./grub-core/efiemu/pnvram.c -./grub-core/efiemu/prepare32.c -./grub-core/efiemu/prepare64.c -./grub-core/efiemu/prepare.c -./grub-core/efiemu/runtime/config.h -./grub-core/efiemu/runtime/efiemu.c -./grub-core/efiemu/symbols.c -./grub-core/font/font.c -./grub-core/font/font_cmd.c -./grub-core/fs/affs.c -./grub-core/fs/afs.c -./grub-core/fs/bfs.c -./grub-core/fs/btrfs.c -./grub-core/fs/cpio_be.c -./grub-core/fs/cpio.c -./grub-core/fs/exfat.c -./grub-core/fs/ext2.c -./grub-core/fs/fat.c -./grub-core/fs/fshelp.c -./grub-core/fs/hfs.c -./grub-core/fs/hfsplus.c -./grub-core/fs/iso9660.c -./grub-core/fs/jfs.c -./grub-core/fs/minix2_be.c -./grub-core/fs/minix2.c -./grub-core/fs/minix3_be.c -./grub-core/fs/minix3.c -./grub-core/fs/minix_be.c -./grub-core/fs/minix.c -./grub-core/fs/newc.c -./grub-core/fs/nilfs2.c -./grub-core/fs/ntfs.c -./grub-core/fs/ntfscomp.c -./grub-core/fs/odc.c -./grub-core/fs/proc.c -./grub-core/fs/reiserfs.c -./grub-core/fs/romfs.c -./grub-core/fs/sfs.c -./grub-core/fs/squash4.c -./grub-core/fs/tar.c -./grub-core/fs/udf.c -./grub-core/fs/ufs2.c -./grub-core/fs/ufs_be.c -./grub-core/fs/ufs.c -./grub-core/fs/xfs.c -./grub-core/fs/zfs/zfs.c -./grub-core/fs/zfs/zfscrypt.c -./grub-core/fs/zfs/zfs_fletcher.c -./grub-core/fs/zfs/zfsinfo.c -./grub-core/fs/zfs/zfs_lzjb.c -./grub-core/fs/zfs/zfs_sha256.c -./grub-core/gdb/cstub.c -./grub-core/gdb/gdb.c -./grub-core/gdb/i386/idt.c -./grub-core/gdb/i386/signal.c -./grub-core/gentrigtables.c -./grub-core/gettext/gettext.c -./grub-core/gfxmenu/font.c -./grub-core/gfxmenu/gfxmenu.c -./grub-core/gfxmenu/gui_box.c -./grub-core/gfxmenu/gui_canvas.c -./grub-core/gfxmenu/gui_circular_progress.c -./grub-core/gfxmenu/gui_image.c -./grub-core/gfxmenu/gui_label.c -./grub-core/gfxmenu/gui_list.c -./grub-core/gfxmenu/gui_progress_bar.c -./grub-core/gfxmenu/gui_string_util.c -./grub-core/gfxmenu/gui_util.c -./grub-core/gfxmenu/icon_manager.c -./grub-core/gfxmenu/model.c -./grub-core/gfxmenu/theme_loader.c -./grub-core/gfxmenu/view.c -./grub-core/gfxmenu/widget-box.c -./grub-core/gnulib/alloca.c -./grub-core/gnulib/alloca.in.h -./grub-core/gnulib/argp-ba.c -./grub-core/gnulib/argp-eexst.c -./grub-core/gnulib/argp-fmtstream.c -./grub-core/gnulib/argp-fmtstream.h -./grub-core/gnulib/argp-fs-xinl.c -./grub-core/gnulib/argp.h -./grub-core/gnulib/argp-help.c -./grub-core/gnulib/argp-namefrob.h -./grub-core/gnulib/argp-parse.c -./grub-core/gnulib/argp-pin.c -./grub-core/gnulib/argp-pv.c -./grub-core/gnulib/argp-pvh.c -./grub-core/gnulib/argp-xinl.c -./grub-core/gnulib/asnprintf.c -./grub-core/gnulib/basename-lgpl.c -./grub-core/gnulib/btowc.c -./grub-core/gnulib/dirname.h -./grub-core/gnulib/dirname-lgpl.c -./grub-core/gnulib/dosname.h -./grub-core/gnulib/errno.in.h -./grub-core/gnulib/error.c -./grub-core/gnulib/error.h -./grub-core/gnulib/float.c -./grub-core/gnulib/float+.h -./grub-core/gnulib/float.in.h -./grub-core/gnulib/fnmatch.c -./grub-core/gnulib/fnmatch.in.h -./grub-core/gnulib/fnmatch_loop.c -./grub-core/gnulib/getdelim.c -./grub-core/gnulib/getline.c -./grub-core/gnulib/getopt1.c -./grub-core/gnulib/getopt.c -./grub-core/gnulib/getopt.in.h -./grub-core/gnulib/getopt_int.h -./grub-core/gnulib/gettext.h -./grub-core/gnulib/intprops.h -./grub-core/gnulib/itold.c -./grub-core/gnulib/langinfo.in.h -./grub-core/gnulib/localcharset.c -./grub-core/gnulib/localcharset.h -./grub-core/gnulib/localeconv.c -./grub-core/gnulib/locale.in.h -./grub-core/gnulib/malloc.c -./grub-core/gnulib/mbrtowc.c -./grub-core/gnulib/mbsinit.c -./grub-core/gnulib/mbsrtowcs.c -./grub-core/gnulib/mbsrtowcs-impl.h -./grub-core/gnulib/mbsrtowcs-state.c -./grub-core/gnulib/mbswidth.c -./grub-core/gnulib/mbswidth.h -./grub-core/gnulib/mbtowc.c -./grub-core/gnulib/mbtowc-impl.h -./grub-core/gnulib/memchr.c -./grub-core/gnulib/mempcpy.c -./grub-core/gnulib/msvc-inval.c -./grub-core/gnulib/msvc-inval.h -./grub-core/gnulib/msvc-nothrow.c -./grub-core/gnulib/msvc-nothrow.h -./grub-core/gnulib/nl_langinfo.c -./grub-core/gnulib/printf-args.c -./grub-core/gnulib/printf-args.h -./grub-core/gnulib/printf-parse.c -./grub-core/gnulib/printf-parse.h -./grub-core/gnulib/progname.c -./grub-core/gnulib/progname.h -./grub-core/gnulib/rawmemchr.c -./grub-core/gnulib/realloc.c -./grub-core/gnulib/regcomp.c -./grub-core/gnulib/regex.c -./grub-core/gnulib/regexec.c -./grub-core/gnulib/regex.h -./grub-core/gnulib/regex_internal.c -./grub-core/gnulib/regex_internal.h -./grub-core/gnulib/size_max.h -./grub-core/gnulib/sleep.c -./grub-core/gnulib/stdalign.in.h -./grub-core/gnulib/stdbool.in.h -./grub-core/gnulib/stddef.in.h -./grub-core/gnulib/stdint.in.h -./grub-core/gnulib/stdio.in.h -./grub-core/gnulib/stdlib.in.h -./grub-core/gnulib/strcasecmp.c -./grub-core/gnulib/strchrnul.c -./grub-core/gnulib/streq.h -./grub-core/gnulib/strerror.c -./grub-core/gnulib/strerror-override.c -./grub-core/gnulib/strerror-override.h -./grub-core/gnulib/string.in.h -./grub-core/gnulib/strings.in.h -./grub-core/gnulib/stripslash.c -./grub-core/gnulib/strncasecmp.c -./grub-core/gnulib/strndup.c -./grub-core/gnulib/strnlen1.c -./grub-core/gnulib/strnlen1.h -./grub-core/gnulib/strnlen.c -./grub-core/gnulib/sysexits.in.h -./grub-core/gnulib/sys_types.in.h -./grub-core/gnulib/unistd.c -./grub-core/gnulib/unistd.in.h -./grub-core/gnulib/unitypes.in.h -./grub-core/gnulib/uniwidth/cjk.h -./grub-core/gnulib/uniwidth.in.h -./grub-core/gnulib/uniwidth/width.c -./grub-core/gnulib/vasnprintf.c -./grub-core/gnulib/vasnprintf.h -./grub-core/gnulib/verify.h -./grub-core/gnulib/vsnprintf.c -./grub-core/gnulib/wchar.in.h -./grub-core/gnulib/wcrtomb.c -./grub-core/gnulib/wctype-h.c -./grub-core/gnulib/wctype.in.h -./grub-core/gnulib/wcwidth.c -./grub-core/gnulib/xsize.c -./grub-core/gnulib/xsize.h -./grub-core/hello/hello.c -./grub-core/hook/datehook.c -./grub-core/io/bufio.c -./grub-core/io/gzio.c -./grub-core/io/lzopio.c -./grub-core/io/xzio.c -./grub-core/kern/command.c -./grub-core/kern/corecmd.c -./grub-core/kern/device.c -./grub-core/kern/disk.c -./grub-core/kern/dl.c -./grub-core/kern/efi/efi.c -./grub-core/kern/efi/init.c -./grub-core/kern/efi/mm.c -./grub-core/kern/elf.c -./grub-core/kern/elfXX.c -./grub-core/kern/emu/argp_common.c -./grub-core/kern/emu/cache.c -./grub-core/kern/emu/full.c -./grub-core/kern/emu/hostdisk.c -./grub-core/kern/emu/hostfs.c -./grub-core/kern/emu/lite.c -./grub-core/kern/emu/main.c -./grub-core/kern/emu/misc.c -./grub-core/kern/emu/mm.c -./grub-core/kern/emu/time.c -./grub-core/kern/env.c -./grub-core/kern/err.c -./grub-core/kern/file.c -./grub-core/kern/fs.c -./grub-core/kern/generic/millisleep.c -./grub-core/kern/generic/rtc_get_time_ms.c -./grub-core/kern/i386/coreboot/init.c -./grub-core/kern/i386/coreboot/mmap.c -./grub-core/kern/i386/dl.c -./grub-core/kern/i386/efi/init.c -./grub-core/kern/i386/multiboot_mmap.c -./grub-core/kern/i386/pc/init.c -./grub-core/kern/i386/pc/mmap.c -./grub-core/kern/i386/qemu/mmap.c -./grub-core/kern/i386/tsc.c -./grub-core/kern/ia64/dl.c -./grub-core/kern/ia64/dl_helper.c -./grub-core/kern/ia64/efi/init.c -./grub-core/kern/ieee1275/cmain.c -./grub-core/kern/ieee1275/ieee1275.c -./grub-core/kern/ieee1275/init.c -./grub-core/kern/ieee1275/mmap.c -./grub-core/kern/ieee1275/openfw.c -./grub-core/kern/list.c -./grub-core/kern/main.c -./grub-core/kern/mips/arc/init.c -./grub-core/kern/mips/dl.c -./grub-core/kern/mips/init.c -./grub-core/kern/mips/loongson/init.c -./grub-core/kern/mips/qemu_mips/init.c -./grub-core/kern/misc.c -./grub-core/kern/mm.c -./grub-core/kern/parser.c -./grub-core/kern/partition.c -./grub-core/kern/powerpc/dl.c -./grub-core/kern/rescue_parser.c -./grub-core/kern/rescue_reader.c -./grub-core/kern/sparc64/dl.c -./grub-core/kern/sparc64/ieee1275/ieee1275.c -./grub-core/kern/term.c -./grub-core/kern/time.c -./grub-core/kern/vga_init.c -./grub-core/kern/x86_64/dl.c -./grub-core/lib/adler32.c -./grub-core/lib/arc/datetime.c -./grub-core/lib/arg.c -./grub-core/lib/backtrace.c -./grub-core/lib/cmdline.c -./grub-core/lib/cmos_datetime.c -./grub-core/lib/crc64.c -./grub-core/lib/crc.c -./grub-core/lib/crypto.c -./grub-core/lib/efi/datetime.c -./grub-core/lib/efi/halt.c -./grub-core/lib/efi/reboot.c -./grub-core/lib/efi/relocator.c -./grub-core/lib/emu/halt.c -./grub-core/lib/envblk.c -./grub-core/lib/fake_module.c -./grub-core/lib/hexdump.c -./grub-core/lib/i386/backtrace.c -./grub-core/lib/i386/halt.c -./grub-core/lib/i386/pc/biosnum.c -./grub-core/lib/i386/pc/vesa_modes_table.c -./grub-core/lib/i386/reboot.c -./grub-core/lib/i386/relocator.c -./grub-core/lib/ieee1275/cmos.c -./grub-core/lib/ieee1275/datetime.c -./grub-core/lib/ieee1275/halt.c -./grub-core/lib/ieee1275/reboot.c -./grub-core/lib/ieee1275/relocator.c -./grub-core/lib/legacy_parse.c -./grub-core/lib/libgcrypt/cipher/ac.c -./grub-core/lib/libgcrypt/cipher/arcfour.c -./grub-core/lib/libgcrypt/cipher/bithelp.h -./grub-core/lib/libgcrypt/cipher/blowfish.c -./grub-core/lib/libgcrypt/cipher/camellia.c -./grub-core/lib/libgcrypt/cipher/camellia-glue.c -./grub-core/lib/libgcrypt/cipher/camellia.h -./grub-core/lib/libgcrypt/cipher/cast5.c -./grub-core/lib/libgcrypt/cipher/cipher.c -./grub-core/lib/libgcrypt/cipher/crc.c -./grub-core/lib/libgcrypt/cipher/des.c -./grub-core/lib/libgcrypt/cipher/dsa.c -./grub-core/lib/libgcrypt/cipher/ecc.c -./grub-core/lib/libgcrypt/cipher/elgamal.c -./grub-core/lib/libgcrypt/cipher/hash-common.c -./grub-core/lib/libgcrypt/cipher/hash-common.h -./grub-core/lib/libgcrypt/cipher/hmac-tests.c -./grub-core/lib/libgcrypt/cipher/md4.c -./grub-core/lib/libgcrypt/cipher/md5.c -./grub-core/lib/libgcrypt/cipher/md.c -./grub-core/lib/libgcrypt/cipher/primegen.c -./grub-core/lib/libgcrypt/cipher/pubkey.c -./grub-core/lib/libgcrypt/cipher/rfc2268.c -./grub-core/lib/libgcrypt/cipher/rijndael.c -./grub-core/lib/libgcrypt/cipher/rijndael-tables.h -./grub-core/lib/libgcrypt/cipher/rmd160.c -./grub-core/lib/libgcrypt/cipher/rmd.h -./grub-core/lib/libgcrypt/cipher/rsa.c -./grub-core/lib/libgcrypt/cipher/seed.c -./grub-core/lib/libgcrypt/cipher/serpent.c -./grub-core/lib/libgcrypt/cipher/sha1.c -./grub-core/lib/libgcrypt/cipher/sha256.c -./grub-core/lib/libgcrypt/cipher/sha512.c -./grub-core/lib/libgcrypt/cipher/test-getrusage.c -./grub-core/lib/libgcrypt/cipher/tiger.c -./grub-core/lib/libgcrypt/cipher/twofish.c -./grub-core/lib/libgcrypt/cipher/whirlpool.c -./grub-core/lib/libgcrypt/mpi/ec.c -./grub-core/lib/libgcrypt/mpi/generic/mpi-asm-defs.h -./grub-core/lib/libgcrypt/mpi/generic/mpih-add1.c -./grub-core/lib/libgcrypt/mpi/generic/mpih-lshift.c -./grub-core/lib/libgcrypt/mpi/generic/mpih-mul1.c -./grub-core/lib/libgcrypt/mpi/generic/mpih-mul2.c -./grub-core/lib/libgcrypt/mpi/generic/mpih-mul3.c -./grub-core/lib/libgcrypt/mpi/generic/mpih-rshift.c -./grub-core/lib/libgcrypt/mpi/generic/mpih-sub1.c -./grub-core/lib/libgcrypt/mpi/generic/udiv-w-sdiv.c -./grub-core/lib/libgcrypt/mpi/i386/syntax.h -./grub-core/lib/libgcrypt/mpi/longlong.h -./grub-core/lib/libgcrypt/mpi/m68k/syntax.h -./grub-core/lib/libgcrypt/mpi/mips3/mpi-asm-defs.h -./grub-core/lib/libgcrypt/mpi/mpi-add.c -./grub-core/lib/libgcrypt/mpi/mpi-bit.c -./grub-core/lib/libgcrypt/mpi/mpi-cmp.c -./grub-core/lib/libgcrypt/mpi/mpicoder.c -./grub-core/lib/libgcrypt/mpi/mpi-div.c -./grub-core/lib/libgcrypt/mpi/mpi-gcd.c -./grub-core/lib/libgcrypt/mpi/mpih-div.c -./grub-core/lib/libgcrypt/mpi/mpih-mul.c -./grub-core/lib/libgcrypt/mpi/mpi-inline.c -./grub-core/lib/libgcrypt/mpi/mpi-inline.h -./grub-core/lib/libgcrypt/mpi/mpi-internal.h -./grub-core/lib/libgcrypt/mpi/mpi-inv.c -./grub-core/lib/libgcrypt/mpi/mpi-mod.c -./grub-core/lib/libgcrypt/mpi/mpi-mpow.c -./grub-core/lib/libgcrypt/mpi/mpi-mul.c -./grub-core/lib/libgcrypt/mpi/mpi-pow.c -./grub-core/lib/libgcrypt/mpi/mpi-scan.c -./grub-core/lib/libgcrypt/mpi/mpiutil.c -./grub-core/lib/libgcrypt/mpi/powerpc32/syntax.h -./grub-core/lib/libgcrypt/src/ath.c -./grub-core/lib/libgcrypt/src/ath.h -./grub-core/lib/libgcrypt/src/cipher.h -./grub-core/lib/libgcrypt/src/cipher-proto.h -./grub-core/lib/libgcrypt/src/dumpsexp.c -./grub-core/lib/libgcrypt/src/fips.c -./grub-core/lib/libgcrypt/src/g10lib.h -./grub-core/lib/libgcrypt/src/gcrypt-module.h -./grub-core/lib/libgcrypt/src/gcryptrnd.c -./grub-core/lib/libgcrypt/src/getrandom.c -./grub-core/lib/libgcrypt/src/global.c -./grub-core/lib/libgcrypt/src/hmac256.c -./grub-core/lib/libgcrypt/src/hmac256.h -./grub-core/lib/libgcrypt/src/hwfeatures.c -./grub-core/lib/libgcrypt/src/misc.c -./grub-core/lib/libgcrypt/src/missing-string.c -./grub-core/lib/libgcrypt/src/module.c -./grub-core/lib/libgcrypt/src/mpi.h -./grub-core/lib/libgcrypt/src/secmem.c -./grub-core/lib/libgcrypt/src/secmem.h -./grub-core/lib/libgcrypt/src/sexp.c -./grub-core/lib/libgcrypt/src/stdmem.c -./grub-core/lib/libgcrypt/src/stdmem.h -./grub-core/lib/libgcrypt/src/types.h -./grub-core/lib/libgcrypt/src/visibility.c -./grub-core/lib/libgcrypt/src/visibility.h -./grub-core/lib/libgcrypt_wrap/cipher_wrap.h -./grub-core/lib/libgcrypt_wrap/mem.c -./grub-core/lib/LzFind.c -./grub-core/lib/LzmaDec.c -./grub-core/lib/LzmaEnc.c -./grub-core/lib/minilzo/lzoconf.h -./grub-core/lib/minilzo/lzodefs.h -./grub-core/lib/minilzo/minilzo.c -./grub-core/lib/minilzo/minilzo.h -./grub-core/lib/mips/arc/reboot.c -./grub-core/lib/mips/loongson/reboot.c -./grub-core/lib/mips/qemu_mips/reboot.c -./grub-core/lib/mips/relocator.c -./grub-core/lib/pbkdf2.c -./grub-core/lib/posix_wrap/assert.h -./grub-core/lib/posix_wrap/ctype.h -./grub-core/lib/posix_wrap/errno.h -./grub-core/lib/posix_wrap/inttypes.h -./grub-core/lib/posix_wrap/langinfo.h -./grub-core/lib/posix_wrap/limits.h -./grub-core/lib/posix_wrap/localcharset.h -./grub-core/lib/posix_wrap/locale.h -./grub-core/lib/posix_wrap/stdint.h -./grub-core/lib/posix_wrap/stdio.h -./grub-core/lib/posix_wrap/stdlib.h -./grub-core/lib/posix_wrap/string.h -./grub-core/lib/posix_wrap/sys/types.h -./grub-core/lib/posix_wrap/unistd.h -./grub-core/lib/posix_wrap/wchar.h -./grub-core/lib/posix_wrap/wctype.h -./grub-core/lib/powerpc/relocator.c -./grub-core/lib/priority_queue.c -./grub-core/lib/reed_solomon.c -./grub-core/lib/relocator.c -./grub-core/lib/xzembed/xz_config.h -./grub-core/lib/xzembed/xz_dec_bcj.c -./grub-core/lib/xzembed/xz_dec_lzma2.c -./grub-core/lib/xzembed/xz_dec_stream.c -./grub-core/lib/xzembed/xz.h -./grub-core/lib/xzembed/xz_lzma2.h -./grub-core/lib/xzembed/xz_private.h -./grub-core/lib/xzembed/xz_stream.h -./grub-core/loader/aout.c -./grub-core/loader/efi/appleloader.c -./grub-core/loader/efi/chainloader.c -./grub-core/loader/i386/bsd32.c -./grub-core/loader/i386/bsd64.c -./grub-core/loader/i386/bsd.c -./grub-core/loader/i386/bsd_pagetable.c -./grub-core/loader/i386/bsdXX.c -./grub-core/loader/i386/coreboot/chainloader.c -./grub-core/loader/i386/linux.c -./grub-core/loader/i386/multiboot_mbi.c -./grub-core/loader/i386/pc/chainloader.c -./grub-core/loader/i386/pc/freedos.c -./grub-core/loader/i386/pc/linux.c -./grub-core/loader/i386/pc/ntldr.c -./grub-core/loader/i386/pc/plan9.c -./grub-core/loader/i386/pc/pxechainloader.c -./grub-core/loader/i386/xnu.c -./grub-core/loader/ia64/efi/linux.c -./grub-core/loader/linux.c -./grub-core/loader/lzss.c -./grub-core/loader/macho32.c -./grub-core/loader/macho64.c -./grub-core/loader/macho.c -./grub-core/loader/machoXX.c -./grub-core/loader/mips/linux.c -./grub-core/loader/multiboot.c -./grub-core/loader/multiboot_elfxx.c -./grub-core/loader/multiboot_mbi2.c -./grub-core/loader/powerpc/ieee1275/linux.c -./grub-core/loader/sparc64/ieee1275/linux.c -./grub-core/loader/xnu.c -./grub-core/loader/xnu_resume.c -./grub-core/mmap/efi/mmap.c -./grub-core/mmap/i386/mmap.c -./grub-core/mmap/i386/pc/mmap.c -./grub-core/mmap/i386/uppermem.c -./grub-core/mmap/mips/uppermem.c -./grub-core/mmap/mmap.c -./grub-core/net/arp.c -./grub-core/net/bootp.c -./grub-core/net/dns.c -./grub-core/net/drivers/efi/efinet.c -./grub-core/net/drivers/emu/emunet.c -./grub-core/net/drivers/i386/pc/pxe.c -./grub-core/net/drivers/ieee1275/ofnet.c -./grub-core/net/ethernet.c -./grub-core/net/http.c -./grub-core/net/icmp6.c -./grub-core/net/icmp.c -./grub-core/net/ip.c -./grub-core/net/netbuff.c -./grub-core/net/net.c -./grub-core/net/tcp.c -./grub-core/net/tftp.c -./grub-core/net/udp.c -./grub-core/normal/auth.c -./grub-core/normal/autofs.c -./grub-core/normal/charset.c -./grub-core/normal/cmdline.c -./grub-core/normal/color.c -./grub-core/normal/completion.c -./grub-core/normal/context.c -./grub-core/normal/crypto.c -./grub-core/normal/datetime.c -./grub-core/normal/dyncmd.c -./grub-core/normal/main.c -./grub-core/normal/menu.c -./grub-core/normal/menu_entry.c -./grub-core/normal/menu_text.c -./grub-core/normal/misc.c -./grub-core/normal/term.c -./grub-core/partmap/acorn.c -./grub-core/partmap/amiga.c -./grub-core/partmap/apple.c -./grub-core/partmap/bsdlabel.c -./grub-core/partmap/dvh.c -./grub-core/partmap/gpt.c -./grub-core/partmap/msdos.c -./grub-core/partmap/plan.c -./grub-core/partmap/sun.c -./grub-core/partmap/sunpc.c -./grub-core/parttool/msdospart.c -./grub-core/script/argv.c -./grub-core/script/execute.c -./grub-core/script/function.c -./grub-core/script/lexer.c -./grub-core/script/main.c -./grub-core/script/script.c -./grub-core/term/arc/console.c -./grub-core/term/at_keyboard.c -./grub-core/term/efi/console.c -./grub-core/term/efi/serial.c -./grub-core/term/emu/console.c -./grub-core/term/gfxterm.c -./grub-core/term/i386/coreboot/cbmemc.c -./grub-core/term/i386/pc/console.c -./grub-core/term/i386/pc/mda_text.c -./grub-core/term/i386/pc/vga_text.c -./grub-core/term/ieee1275/console.c -./grub-core/term/ieee1275/escc.c -./grub-core/term/ieee1275/serial.c -./grub-core/term/morse.c -./grub-core/term/ns8250.c -./grub-core/term/serial.c -./grub-core/term/spkmodem.c -./grub-core/term/terminfo.c -./grub-core/term/tparm.c -./grub-core/term/usb_keyboard.c -./grub-core/tests/example_functional_test.c -./grub-core/tests/lib/functional_test.c -./grub-core/tests/lib/test.c -./grub-core/tests/test_blockarg.c -./grub-core/unidata.c -./grub-core/video/bitmap.c -./grub-core/video/bitmap_scale.c -./grub-core/video/bochs.c -./grub-core/video/cirrus.c -./grub-core/video/colors.c -./grub-core/video/efi_gop.c -./grub-core/video/efi_uga.c -./grub-core/video/emu/sdl.c -./grub-core/video/fb/fbblit.c -./grub-core/video/fb/fbfill.c -./grub-core/video/fb/fbutil.c -./grub-core/video/fb/video_fb.c -./grub-core/video/i386/pc/vbe.c -./grub-core/video/i386/pc/vga.c -./grub-core/video/ieee1275.c -./grub-core/video/radeon_fuloong2e.c -./grub-core/video/readers/jpeg.c -./grub-core/video/readers/png.c -./grub-core/video/readers/tga.c -./grub-core/video/sis315_init.c -./grub-core/video/sis315pro.c -./grub-core/video/sm712.c -./grub-core/video/sm712_init.c -./grub-core/video/video.c -./include/grub/acorn_filecore.h -./include/grub/acpi.h -./include/grub/aout.h -./include/grub/arc/arc.h -./include/grub/arc/console.h -./include/grub/ata.h -./include/grub/at_keyboard.h -./include/grub/auth.h -./include/grub/autoefi.h -./include/grub/backtrace.h -./include/grub/bitmap.h -./include/grub/bitmap_scale.h -./include/grub/boottime.h -./include/grub/bsdlabel.h -./include/grub/bufio.h -./include/grub/cache.h -./include/grub/charset.h -./include/grub/cmos.h -./include/grub/command.h -./include/grub/cryptodisk.h -./include/grub/crypto.h -./include/grub/cs5536.h -./include/grub/datetime.h -./include/grub/decompressor.h -./include/grub/deflate.h -./include/grub/device.h -./include/grub/diskfilter.h -./include/grub/disk.h -./include/grub/dl.h -./include/grub/efi/api.h -./include/grub/efi/console_control.h -./include/grub/efi/console.h -./include/grub/efi/disk.h -./include/grub/efi/edid.h -./include/grub/efi/efi.h -./include/grub/efiemu/efiemu.h -./include/grub/efiemu/runtime.h -./include/grub/efi/graphics_output.h -./include/grub/efi/memory.h -./include/grub/efi/pci.h -./include/grub/efi/pe32.h -./include/grub/efi/uga_draw.h -./include/grub/elf.h -./include/grub/elfload.h -./include/grub/emu/console.h -./include/grub/emu/export.h -./include/grub/emu/getroot.h -./include/grub/emu/hostdisk.h -./include/grub/emu/misc.h -./include/grub/env.h -./include/grub/env_private.h -./include/grub/err.h -./include/grub/extcmd.h -./include/grub/fat.h -./include/grub/fbblit.h -./include/grub/fbfill.h -./include/grub/fbutil.h -./include/grub/file.h -./include/grub/fontformat.h -./include/grub/font.h -./include/grub/fs.h -./include/grub/fshelp.h -./include/grub/gcrypt/g10lib.h -./include/grub/gcrypt/gcrypt.h -./include/grub/gcrypt/gpg-error.h -./include/grub/gcry/types.h -./include/grub/gdb.h -./include/grub/gfxmenu_model.h -./include/grub/gfxmenu_view.h -./include/grub/gfxterm.h -./include/grub/gfxwidgets.h -./include/grub/gpt_partition.h -./include/grub/gui.h -./include/grub/gui_string_util.h -./include/grub/hfs.h -./include/grub/i18n.h -./include/grub/i386/at_keyboard.h -./include/grub/i386/bsd.h -./include/grub/i386/cmos.h -./include/grub/i386/coreboot/boot.h -./include/grub/i386/coreboot/console.h -./include/grub/i386/coreboot/lbio.h -./include/grub/i386/coreboot/memory.h -./include/grub/i386/coreboot/serial.h -./include/grub/i386/coreboot/time.h -./include/grub/i386/cpuid.h -./include/grub/i386/efiemu.h -./include/grub/i386/efi/memory.h -./include/grub/i386/efi/serial.h -./include/grub/i386/floppy.h -./include/grub/i386/freebsd_linker.h -./include/grub/i386/freebsd_reboot.h -./include/grub/i386/gdb.h -./include/grub/i386/ieee1275/ieee1275.h -./include/grub/i386/ieee1275/memory.h -./include/grub/i386/ieee1275/serial.h -./include/grub/i386/io.h -./include/grub/i386/linux.h -./include/grub/i386/macho.h -./include/grub/i386/memory.h -./include/grub/i386/multiboot/boot.h -./include/grub/i386/multiboot/console.h -./include/grub/i386/multiboot.h -./include/grub/i386/multiboot/kernel.h -./include/grub/i386/multiboot/memory.h -./include/grub/i386/multiboot/serial.h -./include/grub/i386/multiboot/time.h -./include/grub/i386/netbsd_bootinfo.h -./include/grub/i386/netbsd_reboot.h -./include/grub/i386/openbsd_bootarg.h -./include/grub/i386/openbsd_reboot.h -./include/grub/i386/pc/apm.h -./include/grub/i386/pc/biosdisk.h -./include/grub/i386/pc/biosnum.h -./include/grub/i386/pc/boot.h -./include/grub/i386/pc/chainloader.h -./include/grub/i386/pc/console.h -./include/grub/i386/pci.h -./include/grub/i386/pc/int.h -./include/grub/i386/pc/kernel.h -./include/grub/i386/pc/memory.h -./include/grub/i386/pc/pxe.h -./include/grub/i386/pc/time.h -./include/grub/i386/pc/vbe.h -./include/grub/i386/pc/vesa_modes_table.h -./include/grub/i386/pit.h -./include/grub/i386/qemu/boot.h -./include/grub/i386/qemu/console.h -./include/grub/i386/qemu/kernel.h -./include/grub/i386/qemu/memory.h -./include/grub/i386/qemu/serial.h -./include/grub/i386/qemu/time.h -./include/grub/i386/reboot.h -./include/grub/i386/relocator.h -./include/grub/i386/relocator_private.h -./include/grub/i386/setjmp.h -./include/grub/i386/time.h -./include/grub/i386/tsc.h -./include/grub/i386/types.h -./include/grub/i386/xnu.h -./include/grub/ia64/efi/memory.h -./include/grub/ia64/efi/time.h -./include/grub/ia64/kernel.h -./include/grub/ia64/reloc.h -./include/grub/ia64/setjmp.h -./include/grub/ia64/time.h -./include/grub/ia64/types.h -./include/grub/icon_manager.h -./include/grub/ieee1275/console.h -./include/grub/ieee1275/ieee1275.h -./include/grub/ieee1275/ofdisk.h -./include/grub/kernel.h -./include/grub/keyboard_layouts.h -./include/grub/legacy_parse.h -./include/grub/lib/arg.h -./include/grub/lib/cmdline.h -./include/grub/lib/crc.h -./include/grub/lib/envblk.h -./include/grub/libgcc.h -./include/grub/lib/hexdump.h -./include/grub/lib/LzFind.h -./include/grub/lib/LzHash.h -./include/grub/lib/LzmaDec.h -./include/grub/lib/LzmaEnc.h -./include/grub/lib/LzmaTypes.h -./include/grub/libpciaccess.h -./include/grub/libusb.h -./include/grub/linux.h -./include/grub/list.h -./include/grub/loader.h -./include/grub/lvm.h -./include/grub/macho.h -./include/grub/machoload.h -./include/grub/memory.h -./include/grub/menu.h -./include/grub/menu_viewer.h -./include/grub/mips/arc/kernel.h -./include/grub/mips/arc/memory.h -./include/grub/mips/arc/time.h -./include/grub/mips/at_keyboard.h -./include/grub/mips/cache.h -./include/grub/mips/cmos.h -./include/grub/mips/io.h -./include/grub/mips/kernel.h -./include/grub/mips/loongson/at_keyboard.h -./include/grub/mips/loongson/cmos.h -./include/grub/mips/loongson/ec.h -./include/grub/mips/loongson.h -./include/grub/mips/loongson/kernel.h -./include/grub/mips/loongson/memory.h -./include/grub/mips/loongson/pci.h -./include/grub/mips/loongson/serial.h -./include/grub/mips/loongson/time.h -./include/grub/mips/memory.h -./include/grub/mips/mips.h -./include/grub/mips/multiboot.h -./include/grub/mips/pci.h -./include/grub/mips/qemu_mips/at_keyboard.h -./include/grub/mips/qemu_mips/cmos.h -./include/grub/mips/qemu_mips/console.h -./include/grub/mips/qemu_mips/kernel.h -./include/grub/mips/qemu_mips/loader.h -./include/grub/mips/qemu_mips/memory.h -./include/grub/mips/qemu_mips/serial.h -./include/grub/mips/qemu_mips/time.h -./include/grub/mips/relocator.h -./include/grub/mips/setjmp.h -./include/grub/mips/time.h -./include/grub/mips/types.h -./include/grub/misc.h -./include/grub/mm.h -./include/grub/mm_private.h -./include/grub/msdos_partition.h -./include/grub/multiboot.h -./include/grub/multiboot_loader.h -./include/grub/net/arp.h -./include/grub/net/ethernet.h -./include/grub/net.h -./include/grub/net/ip.h -./include/grub/net/netbuff.h -./include/grub/net/tcp.h -./include/grub/net/udp.h -./include/grub/normal.h -./include/grub/ns8250.h -./include/grub/ntfs.h -./include/grub/offsets.h -./include/grub/parser.h -./include/grub/partition.h -./include/grub/parttool.h -./include/grub/pci.h -./include/grub/pciutils.h -./include/grub/powerpc/ieee1275/ieee1275.h -./include/grub/powerpc/kernel.h -./include/grub/powerpc/memory.h -./include/grub/powerpc/relocator.h -./include/grub/powerpc/setjmp.h -./include/grub/powerpc/time.h -./include/grub/powerpc/types.h -./include/grub/priority_queue.h -./include/grub/procfs.h -./include/grub/pubkey.h -./include/grub/reader.h -./include/grub/reed_solomon.h -./include/grub/relocator.h -./include/grub/relocator_private.h -./include/grub/script_sh.h -./include/grub/scsicmd.h -./include/grub/scsi.h -./include/grub/sdl.h -./include/grub/search.h -./include/grub/serial.h -./include/grub/setjmp.h -./include/grub/smbus.h -./include/grub/sparc64/ieee1275/boot.h -./include/grub/sparc64/ieee1275/ieee1275.h -./include/grub/sparc64/ieee1275/kernel.h -./include/grub/sparc64/setjmp.h -./include/grub/sparc64/time.h -./include/grub/sparc64/types.h -./include/grub/speaker.h -./include/grub/symbol.h -./include/grub/term.h -./include/grub/terminfo.h -./include/grub/test.h -./include/grub/time.h -./include/grub/tparm.h -./include/grub/trig.h -./include/grub/types.h -./include/grub/unicode.h -./include/grub/usbdesc.h -./include/grub/usb.h -./include/grub/usbserial.h -./include/grub/usbtrans.h -./include/grub/util/libnvpair.h -./include/grub/util/libzfs.h -./include/grub/util/lvm.h -./include/grub/util/misc.h -./include/grub/util/ofpath.h -./include/grub/util/resolve.h -./include/grub/vga.h -./include/grub/vgaregs.h -./include/grub/video_fb.h -./include/grub/video.h -./include/grub/x86_64/at_keyboard.h -./include/grub/x86_64/efi/boot.h -./include/grub/x86_64/efi/loader.h -./include/grub/x86_64/efi/memory.h -./include/grub/x86_64/efi/serial.h -./include/grub/x86_64/io.h -./include/grub/x86_64/linux.h -./include/grub/x86_64/macho.h -./include/grub/x86_64/memory.h -./include/grub/x86_64/multiboot.h -./include/grub/x86_64/pci.h -./include/grub/x86_64/relocator.h -./include/grub/x86_64/setjmp.h -./include/grub/x86_64/time.h -./include/grub/x86_64/types.h -./include/grub/x86_64/xnu.h -./include/grub/xnu.h -./include/grub/zfs/dmu.h -./include/grub/zfs/dmu_objset.h -./include/grub/zfs/dnode.h -./include/grub/zfs/dsl_dataset.h -./include/grub/zfs/dsl_dir.h -./include/grub/zfs/sa_impl.h -./include/grub/zfs/spa.h -./include/grub/zfs/uberblock_impl.h -./include/grub/zfs/vdev_impl.h -./include/grub/zfs/zap_impl.h -./include/grub/zfs/zap_leaf.h -./include/grub/zfs/zfs_acl.h -./include/grub/zfs/zfs.h -./include/grub/zfs/zfs_znode.h -./include/grub/zfs/zil.h -./include/grub/zfs/zio_checksum.h -./include/grub/zfs/zio.h -./include/multiboot2.h -./include/multiboot.h -./tests/cmp_unit_test.c -./tests/example_unit_test.c -./tests/lib/unit_test.c -./tests/printf_unit_test.c -./util/bin2h.c -./util/getroot.c -./util/grub-editenv.c -./util/grub-fstest.c -./util/grub-macho2img.c -./util/grub-menulst2cfg.c -./util/grub-mkfont.c -./util/grub-mkimage.c -./util/grub-mkimagexx.c -./util/grub-mklayout.c -./util/grub-mkpasswd-pbkdf2.c -./util/grub-mkrelpath.c -./util/grub-mount.c -./util/grub-pe2elf.c -./util/grub-probe.c -./util/grub-script-check.c -./util/grub-setup.c -./util/ieee1275/grub-ofpathname.c -./util/ieee1275/ofpath.c -./util/lvm.c -./util/misc.c -./util/raid.c -./util/resolve.c -./util/spkmodem-recv.c From 9f73ebd49be976db9cbb7d1a383066c85a7678db Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 13:50:18 +0200 Subject: [PATCH 104/187] * INSTALL: Document linguas.sh. --- ChangeLog | 4 ++++ INSTALL | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0dcf7b03c..21260c0a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + * INSTALL: Document linguas.sh. + 2013-04-28 Vladimir Serbinenko Remove POTFILES.in and regenerate it in autogen.sh. diff --git a/INSTALL b/INSTALL index a626395b6..7fe2450e7 100644 --- a/INSTALL +++ b/INSTALL @@ -76,9 +76,14 @@ Building the GRUB The simplest way to compile this package is: - 1. `cd' to the directory containing the package's source code. If - you don't use a release tarball you have to type `./autogen.sh'. - Type `./configure' to configure the package for your system. + 1. `cd' to the directory containing the package's source code. + + 2. Skip this and following step if you use release tarball and proceed to + step 4. If you want translations type `./linguas.sh'. + + 3. Type `./autogen.sh'. + + 4. Type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. @@ -86,15 +91,15 @@ The simplest way to compile this package is: Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. - 2. Type `make' to compile the package. + 6. Type `make' to compile the package. - 3. Optionally, type `make check' to run any self-tests that come with + 7. Optionally, type `make check' to run any self-tests that come with the package. - 4. Type `make install' to install the programs and any data files and + 8. Type `make install' to install the programs and any data files and documentation. - 5. You can remove the program binaries and object files from the + 9. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is From eadfad244ea69272c2418e966ae08d270afd9a7b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 13:54:32 +0200 Subject: [PATCH 105/187] * grub-core/commands/probe.c: Add missing grub_device_close. --- ChangeLog | 4 ++++ grub-core/commands/probe.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 21260c0a3..5c50b56e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + * grub-core/commands/probe.c: Add missing grub_device_close. + 2013-04-28 Vladimir Serbinenko * INSTALL: Document linguas.sh. diff --git a/grub-core/commands/probe.c b/grub-core/commands/probe.c index eeece876d..cf2793e1d 100644 --- a/grub-core/commands/probe.c +++ b/grub-core/commands/probe.c @@ -83,6 +83,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args) grub_env_set (state[0].arg, val); else grub_printf ("%s", val); + grub_device_close (dev); return GRUB_ERR_NONE; } if (state[2].set) @@ -94,6 +95,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args) grub_env_set (state[0].arg, val); else grub_printf ("%s", val); + grub_device_close (dev); return GRUB_ERR_NONE; } fs = grub_fs_probe (dev); @@ -105,6 +107,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args) grub_env_set (state[0].arg, fs->name); else grub_printf ("%s", fs->name); + grub_device_close (dev); return GRUB_ERR_NONE; } if (state[4].set) @@ -125,6 +128,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args) else grub_printf ("%s", uuid); grub_free (uuid); + grub_device_close (dev); return GRUB_ERR_NONE; } if (state[5].set) @@ -147,8 +151,10 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, char **args) else grub_printf ("%s", label); grub_free (label); + grub_device_close (dev); return GRUB_ERR_NONE; } + grub_device_close (dev); return grub_error (GRUB_ERR_BAD_ARGUMENT, "unrecognised target"); } From 178c2764199aa38c0ad689e7c19847f79b355cb2 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 14:06:57 +0200 Subject: [PATCH 106/187] * grub-core/kern/file.c: Use const char * rather than casting to non-const. --- ChangeLog | 5 +++++ grub-core/kern/file.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c50b56e7..da92415d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-28 Vladimir Serbinenko + + * grub-core/kern/file.c: Use const char * rather than casting to + non-const. + 2013-04-28 Vladimir Serbinenko * grub-core/commands/probe.c: Add missing grub_device_close. diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c index d2a631745..64266686d 100644 --- a/grub-core/kern/file.c +++ b/grub-core/kern/file.c @@ -64,7 +64,7 @@ grub_file_open (const char *name) grub_device_t device = 0; grub_file_t file = 0, last_file = 0; char *device_name; - char *file_name; + const char *file_name; grub_file_filter_id_t filter; device_name = grub_file_get_device_name (name); @@ -76,7 +76,7 @@ grub_file_open (const char *name) if (file_name) file_name++; else - file_name = (char *) name; + file_name = name; device = grub_device_open (device_name); grub_free (device_name); From bd69257a7759322d2373963b9922c38172907fd6 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 15:15:57 +0200 Subject: [PATCH 107/187] * include/grub/efi/api.h (GRUB_EFI_DEVICE_PATH_LENGTH): Use grub_get_unaligned16 rather than shifts. --- ChangeLog | 5 +++++ include/grub/efi/api.h | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index da92415d3..727a8c8e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-28 Vladimir Serbinenko + + * include/grub/efi/api.h (GRUB_EFI_DEVICE_PATH_LENGTH): Use + grub_get_unaligned16 rather than shifts. + 2013-04-28 Vladimir Serbinenko * grub-core/kern/file.c: Use const char * rather than casting to diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index 2917d1426..69bcd0ccf 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -553,8 +553,7 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t; #define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f) #define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype) -#define GRUB_EFI_DEVICE_PATH_LENGTH(dp) \ - ((dp)->length[0] | ((grub_efi_uint16_t) ((dp)->length[1]) << 8)) +#define GRUB_EFI_DEVICE_PATH_LENGTH(dp) (grub_get_unaligned16 ((dp)->length)) /* The End of Device Path nodes. */ #define GRUB_EFI_END_DEVICE_PATH_TYPE (0xff & 0x7f) From 9fb0fd4f358c267f86baebff226801a362ab2225 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 15:17:43 +0200 Subject: [PATCH 108/187] * grub-core/disk/ahci.c: Fix compilation for amd64 (format warnings). --- ChangeLog | 4 ++++ grub-core/disk/ahci.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 727a8c8e3..8b4206eaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + * grub-core/disk/ahci.c: Fix compilation for amd64 (format warnings). + 2013-04-28 Vladimir Serbinenko * include/grub/efi/api.h (GRUB_EFI_DEVICE_PATH_LENGTH): Use diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c index 47fd423e4..e6170426e 100644 --- a/grub-core/disk/ahci.c +++ b/grub-core/disk/ahci.c @@ -531,8 +531,8 @@ grub_ahci_pciinit (grub_pci_device_t dev, adevs[i]->hba->ports[adevs[i]->port].sata_error); grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n", - (char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - - (char *) adevs[i]->hba, + (int) ((char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - + (char *) adevs[i]->hba), adevs[i]->hba->ports[adevs[i]->port].task_file_data, adevs[i]->hba->ports[adevs[i]->port].command); @@ -545,8 +545,8 @@ grub_ahci_pciinit (grub_pci_device_t dev, if (adevs[i]) { grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n", - (char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - - (char *) adevs[i]->hba, + (int) ((char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data - + (char *) adevs[i]->hba), adevs[i]->hba->ports[adevs[i]->port].task_file_data, adevs[i]->hba->ports[adevs[i]->port].command); From 02adbb932d0b52a592e1b4ced42d12bedb382dc4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 15:18:50 +0200 Subject: [PATCH 109/187] * grub-core/io/lzopio.c: Use GRUB_PROPERLY_ALIGNED_ARRAY. * grub-core/loader/i386/bsd.c: Likewise. --- ChangeLog | 5 +++++ grub-core/io/lzopio.c | 4 ++-- grub-core/loader/i386/bsd.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b4206eaf..835895b66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-28 Vladimir Serbinenko + + * grub-core/io/lzopio.c: Use GRUB_PROPERLY_ALIGNED_ARRAY. + * grub-core/loader/i386/bsd.c: Likewise. + 2013-04-28 Vladimir Serbinenko * grub-core/disk/ahci.c: Fix compilation for amd64 (format warnings). diff --git a/grub-core/io/lzopio.c b/grub-core/io/lzopio.c index 63bfbadc8..451d237af 100644 --- a/grub-core/io/lzopio.c +++ b/grub-core/io/lzopio.c @@ -166,7 +166,7 @@ read_block_data (struct grub_lzopio *lzopio) if (lzopio->ccheck_fun) { - grub_uint64_t context[(lzopio->ccheck_fun->contextsize + 7) / 8]; + GRUB_PROPERLY_ALIGNED_ARRAY (context, lzopio->ccheck_fun->contextsize); lzopio->ccheck_fun->init (context); lzopio->ccheck_fun->write (context, lzopio->block.cdata, @@ -212,7 +212,7 @@ uncompress_block (struct grub_lzopio *lzopio) if (lzopio->ucheck_fun) { - grub_uint64_t context[(lzopio->ucheck_fun->contextsize + 7) / 8]; + GRUB_PROPERLY_ALIGNED_ARRAY (context, lzopio->ucheck_fun->contextsize); lzopio->ucheck_fun->init (context); lzopio->ucheck_fun->write (context, lzopio->block.udata, diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c index 5fe586fd1..014b51c85 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -1045,7 +1045,7 @@ grub_netbsd_add_boot_disk_and_wedge (void) struct grub_partition_bsd_disk_label label; } buf; grub_uint8_t *hash; - grub_uint64_t ctx[(GRUB_MD_MD5->contextsize + 7) / 8]; + GRUB_PROPERLY_ALIGNED_ARRAY (ctx, GRUB_MD_MD5->contextsize); dev = grub_device_open (0); if (! (dev && dev->disk && dev->disk->partition)) From 7cd0df84f1b96ad4f6f35a38309d932228e5bfe7 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 15:31:33 +0200 Subject: [PATCH 110/187] New command `nativedisk'. --- ChangeLog | 4 + docs/grub.texi | 8 + grub-core/Makefile.core.def | 5 + grub-core/commands/nativedisk.c | 250 ++++++++++++++++++++++++++++++++ grub-core/kern/dl.c | 46 +++--- grub-core/normal/main.c | 3 +- include/grub/dl.h | 29 +++- 7 files changed, 316 insertions(+), 29 deletions(-) create mode 100644 grub-core/commands/nativedisk.c diff --git a/ChangeLog b/ChangeLog index 835895b66..69c783977 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + New command `nativedisk'. + 2013-04-28 Vladimir Serbinenko * grub-core/io/lzopio.c: Use GRUB_PROPERLY_ALIGNED_ARRAY. diff --git a/docs/grub.texi b/docs/grub.texi index 754e1912b..587c64e0f 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -3411,6 +3411,7 @@ you forget a command, you can run the command @command{help} * lsfonts:: List loaded fonts * lsmod:: Show loaded modules * md5sum:: Compute or check MD5 hash +* nativedisk:: Switch to native disk drivers * normal:: Enter normal mode * normal_exit:: Exit from normal mode * parttool:: Modify partition table entries @@ -4035,6 +4036,13 @@ Alias for @code{hashsum --hash md5 arg @dots{}}. See command @command{hashsum} @end deffn +@node nativedisk +@subsection nativedisk + +@deffn Command nativedisk +Switch from firmware disk drivers to native ones. +@end deffn + @node normal @subsection normal diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 7f9372320..2e73d89b8 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -507,6 +507,11 @@ module = { enable = i386_multiboot; }; +module = { + name = nativedisk; + common = commands/nativedisk.c; +}; + module = { name = emupci; common = bus/emu/pci.c; diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c new file mode 100644 index 000000000..adb404335 --- /dev/null +++ b/grub-core/commands/nativedisk.c @@ -0,0 +1,250 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +static const char *modnames_def[] = { "pata", "ahci", "usbms", "ohci", "uhci", "ehci" }; + +static grub_err_t +get_uuid (const char *name, char **uuid) +{ + grub_device_t dev; + grub_fs_t fs = 0; + + dev = grub_device_open (name); + if (!dev) + return grub_errno; + if (dev) + fs = grub_fs_probe (dev); + if (!fs) + { + grub_device_close (dev); + return grub_errno; + } + if (!fs->uuid || fs->uuid (dev, uuid)) + { + grub_device_close (dev); + + if (!grub_errno) + grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + N_("%s does not support UUIDs"), fs->name); + + return grub_errno; + } + grub_device_close (dev); + return GRUB_ERR_NONE; +} + +struct search_ctx +{ + char *root_uuid; + char *prefix_uuid; + const char *prefix_path; + int prefix_found, root_found; +}; + +static int +iterate_device (const char *name, void *data) +{ + struct search_ctx *ctx = data; + char *cur_uuid; + + if (get_uuid (name, &cur_uuid)) + { + grub_print_error (); + return 0; + } + if (grub_strcasecmp (cur_uuid, ctx->prefix_uuid) == 0) + { + char *prefix; + prefix = grub_xasprintf ("(%s)/%s", name, ctx->prefix_path); + grub_env_set ("prefix", prefix); + grub_free (prefix); + ctx->prefix_found = 1; + } + if (grub_strcasecmp (cur_uuid, ctx->root_uuid) == 0) + { + grub_env_set ("root", name); + ctx->root_found = 1; + } + return ctx->prefix_found && ctx->root_found; +} + +static grub_err_t +grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)), + int argc, char **args_in) +{ + char *uuid_root = 0, *uuid_prefix, *prefdev = 0; + const char *prefix = 0; + const char *path_prefix = 0; + int mods_loaded = 0; + grub_dl_t *mods; + struct search_ctx ctx; + const char **args; + grub_fs_autoload_hook_t saved_autoload; + int i; + + if (argc == 0) + { + argc = ARRAY_SIZE (modnames_def); + args = modnames_def; + } + else + args = (const char **) args_in; + + prefix = grub_env_get ("prefix"); + + if (! prefix) + return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix"); + + if (prefix) + path_prefix = (prefix[0] == '(') ? grub_strchr (prefix, ')') : NULL; + if (path_prefix) + path_prefix++; + else + path_prefix = prefix; + + mods = grub_malloc (argc * sizeof (mods[0])); + if (!mods) + return grub_errno; + + if (get_uuid (NULL, &uuid_root)) + return grub_errno; + + prefdev = grub_file_get_device_name (prefix); + if (grub_errno) + { + grub_print_error (); + prefdev = 0; + } + + if (get_uuid (prefdev, &uuid_prefix)) + { + grub_free (uuid_root); + return grub_errno; + } + + for (mods_loaded = 0; mods_loaded < argc; mods_loaded++) + { + char *filename; + grub_dl_t mod; + grub_file_t file = NULL; + grub_ssize_t size; + void *core = 0; + + mod = grub_dl_get (args[mods_loaded]); + if (mod) + { + mods[mods_loaded] = 0; + continue; + } + + filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM "/%s.mod", + prefix, args[mods_loaded]); + if (! filename) + goto fail; + + file = grub_file_open (filename); + grub_free (filename); + if (! file) + goto fail; + + size = grub_file_size (file); + core = grub_malloc (size); + if (! core) + { + grub_file_close (file); + goto fail; + } + + if (grub_file_read (file, core, size) != (grub_ssize_t) size) + { + grub_file_close (file); + grub_free (core); + goto fail; + } + + grub_file_close (file); + + mods[mods_loaded] = grub_dl_load_core_noinit (core, size); + if (! mods[mods_loaded]) + goto fail; + } + + for (i = 0; i < argc; i++) + if (mods[i]) + grub_dl_init (mods[i]); + + /* No need to autoload FS since obviously we already have the necessary fs modules. */ + saved_autoload = grub_fs_autoload_hook; + grub_fs_autoload_hook = 0; + + ctx.root_uuid = uuid_root; + ctx.prefix_uuid = uuid_prefix; + ctx.prefix_path = path_prefix; + ctx.prefix_found = 0; + ctx.root_found = 0; + + /* FIXME: try to guess the correct values. */ + grub_device_iterate (iterate_device, &ctx); + + grub_fs_autoload_hook = saved_autoload; + + grub_free (uuid_root); + grub_free (uuid_prefix); + + return GRUB_ERR_NONE; + + fail: + grub_free (uuid_root); + grub_free (uuid_prefix); + + for (i = 0; i < mods_loaded; i++) + if (mods[i]) + { + mods[i]->fini = 0; + grub_dl_unload (mods[i]); + } + return grub_errno; +} + +static grub_command_t cmd; + +GRUB_MOD_INIT(nativedisk) +{ + cmd = grub_register_command ("nativedisk", grub_cmd_nativedisk, "[MODULE1 MODULE2 ...]", + N_("Switch to native disk drivers. If no modules are specified default set (pata,ahci,usbms,ohci,uhci,ehci) is used")); +} + +GRUB_MOD_FINI(nativedisk) +{ + grub_unregister_command (cmd); +} diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c index 641146d34..6c086adda 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -51,6 +51,7 @@ grub_dl_t grub_dl_head = 0; grub_err_t grub_dl_add (grub_dl_t mod); +/* Keep global so that GDB scripts work. */ grub_err_t grub_dl_add (grub_dl_t mod) { @@ -58,9 +59,6 @@ grub_dl_add (grub_dl_t mod) return grub_error (GRUB_ERR_BAD_MODULE, "`%s' is already loaded", mod->name); - mod->next = grub_dl_head; - grub_dl_head = mod; - return GRUB_ERR_NONE; } @@ -77,18 +75,6 @@ grub_dl_remove (grub_dl_t mod) } } -grub_dl_t -grub_dl_get (const char *name) -{ - grub_dl_t l; - - for (l = grub_dl_head; l; l = l->next) - if (grub_strcmp (name, l->name) == 0) - return l; - - return 0; -} - struct grub_symbol @@ -447,13 +433,6 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) return GRUB_ERR_NONE; } -static void -grub_dl_call_init (grub_dl_t mod) -{ - if (mod->init) - (mod->init) (mod); -} - /* Me, Vladimir Serbinenko, hereby I add this module check as per new GNU module policy. Note that this license check is informative only. Modules have to be licensed under GPLv3 or GPLv3+ (optionally @@ -595,7 +574,7 @@ grub_dl_flush_cache (grub_dl_t mod) /* Load a module from core memory. */ grub_dl_t -grub_dl_load_core (void *addr, grub_size_t size) +grub_dl_load_core_noinit (void *addr, grub_size_t size) { Elf_Ehdr *e; grub_dl_t mod; @@ -651,10 +630,6 @@ grub_dl_load_core (void *addr, grub_size_t size) grub_dprintf ("modules", "module name: %s\n", mod->name); grub_dprintf ("modules", "init function: %p\n", mod->init); - grub_boot_time ("Initing module %s", mod->name); - grub_dl_call_init (mod); - grub_boot_time ("Module %s inited", mod->name); - if (grub_dl_add (mod)) { grub_dl_unload (mod); @@ -664,6 +639,23 @@ grub_dl_load_core (void *addr, grub_size_t size) return mod; } +grub_dl_t +grub_dl_load_core (void *addr, grub_size_t size) +{ + grub_dl_t mod; + + mod = grub_dl_load_core_noinit (addr, size); + + if (!mod) + return NULL; + + grub_boot_time ("Initing module %s", mod->name); + grub_dl_init (mod); + grub_boot_time ("Module %s inited", mod->name); + + return mod; +} + /* Load a module from the file FILENAME. */ grub_dl_t grub_dl_load_file (const char *filename) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c index 2f203ddf9..759e0a4c4 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -506,7 +506,8 @@ static void (*grub_xputs_saved) (const char *str); static const char *features[] = { "feature_chainloader_bpb", "feature_ntldr", "feature_platform_search_hint", "feature_default_font_path", "feature_all_video_module", - "feature_menuentry_id", "feature_menuentry_options", "feature_200_final" + "feature_menuentry_id", "feature_menuentry_options", "feature_200_final", + "feature_nativedisk_cmd" }; GRUB_MOD_INIT(normal) diff --git a/include/grub/dl.h b/include/grub/dl.h index 3119978f1..f34b5a1ac 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -25,6 +25,7 @@ #include #include #include +#include #endif /* @@ -181,15 +182,41 @@ typedef struct grub_dl *grub_dl_t; grub_dl_t grub_dl_load_file (const char *filename); grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name); grub_dl_t grub_dl_load_core (void *addr, grub_size_t size); +grub_dl_t EXPORT_FUNC(grub_dl_load_core_noinit) (void *addr, grub_size_t size); int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod); void grub_dl_unload_unneeded (void); int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); extern grub_dl_t EXPORT_VAR(grub_dl_head); +#ifndef GRUB_UTIL + #define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head)) -grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name); +static inline void +grub_dl_init (grub_dl_t mod) +{ + if (mod->init) + (mod->init) (mod); + + mod->next = grub_dl_head; + grub_dl_head = mod; +} + +static inline grub_dl_t +grub_dl_get (const char *name) +{ + grub_dl_t l; + + FOR_DL_MODULES(l) + if (grub_strcmp (name, l->name) == 0) + return l; + + return 0; +} + +#endif + grub_err_t grub_dl_register_symbol (const char *name, void *addr, int isfunc, grub_dl_t mod); From adb7d667fc4947d424667ca466bfe33f2ac56a11 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 18:52:53 +0200 Subject: [PATCH 111/187] * grub-core/commands/nativedisk.c: Ignore unknown filesystem error. --- ChangeLog | 4 ++++ grub-core/commands/nativedisk.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 69c783977..4833670bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + * grub-core/commands/nativedisk.c: Ignore unknown filesystem error. + 2013-04-28 Vladimir Serbinenko New command `nativedisk'. diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c index adb404335..333fc8299 100644 --- a/grub-core/commands/nativedisk.c +++ b/grub-core/commands/nativedisk.c @@ -79,6 +79,8 @@ iterate_device (const char *name, void *data) if (get_uuid (name, &cur_uuid)) { + if (grub_errno == GRUB_ERR_UNKNOWN_FS) + grub_errno = 0; grub_print_error (); return 0; } From 3c0003c3c329bceff449890c81f4c279d80d73fb Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 28 Apr 2013 18:53:59 +0200 Subject: [PATCH 112/187] * docs/grub.texi: Add a comment about usefullness of nativedisk. --- ChangeLog | 4 ++++ docs/grub.texi | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4833670bc..32a2a8e2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-28 Vladimir Serbinenko + + * docs/grub.texi: Add a comment about usefullness of nativedisk. + 2013-04-28 Vladimir Serbinenko * grub-core/commands/nativedisk.c: Ignore unknown filesystem error. diff --git a/docs/grub.texi b/docs/grub.texi index 587c64e0f..bfd42ee51 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -4041,6 +4041,10 @@ Alias for @code{hashsum --hash md5 arg @dots{}}. See command @command{hashsum} @deffn Command nativedisk Switch from firmware disk drivers to native ones. +Really useful only on platforms where both +firmware and native disk drives are available. +Currently i386-pc, i386-efi, i386-ieee1275 and +x86_64-efi. @end deffn @node normal From e0aacf24337baefa9c3638764709686833f80873 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 11:57:51 +0200 Subject: [PATCH 113/187] * grub-core/lib/arg.c (grub_arg_show_help): Fix a NULL pointer dereference. Reported by: qwertial. --- ChangeLog | 6 ++++++ grub-core/lib/arg.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 32a2a8e2a..41a941cb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-29 Vladimir Serbinenko + + * grub-core/lib/arg.c (grub_arg_show_help): Fix a NULL pointer + dereference. + Reported by: qwertial. + 2013-04-28 Vladimir Serbinenko * docs/grub.texi: Add a comment about usefullness of nativedisk. diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c index 7492ac6a8..9cc18dc2e 100644 --- a/grub-core/lib/arg.c +++ b/grub-core/lib/arg.c @@ -158,7 +158,7 @@ grub_arg_show_help (grub_extcmd_t cmd) show_usage (cmd); grub_printf ("%s\n\n", _(cmd->cmd->description)); - for (opt = cmd->options; opt->doc; opt++) + for (opt = cmd->options; opt && opt->doc; opt++) switch (opt->shortarg) { case 'h': From 0e90dee8e83b2cc08bf251df72ea98255549cb46 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 11:59:18 +0200 Subject: [PATCH 114/187] * grub-core/kern/mips/arc/init.c: Fix prefix detection. --- ChangeLog | 4 +++ grub-core/kern/mips/arc/init.c | 62 +++++++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41a941cb7..f444ea922 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-29 Vladimir Serbinenko + + * grub-core/kern/mips/arc/init.c: Fix prefix detection. + 2013-04-29 Vladimir Serbinenko * grub-core/lib/arg.c (grub_arg_show_help): Fix a NULL pointer diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c index d279ada7c..fdcc2bd22 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -179,19 +179,26 @@ norm_name_to_alt (const char *name) optr = grub_stpcpy (ret, "arc/"); for (iptr = name; *iptr; iptr++) { - if (state == 1) + if (state == 3) { *optr++ = '/'; state = 0; } if (*iptr == '(') - continue; - if (*iptr == ')') { state = 1; continue; } + if (*iptr == ')') + { + if (state == 1) + *optr++ = '0'; + state = 3; + continue; + } *optr++ = *iptr; + if (state == 1) + state = 2; } *optr = '\0'; return ret; @@ -353,13 +360,48 @@ grub_machine_get_bootlocation (char **device __attribute__ ((unused)), grub_disk_addr_t poff = -1, pend; struct get_device_name_ctx ctx; grub_disk_t parent = 0; + unsigned i; - pptr = grub_strchr (loaddev, '/'); - if (pptr) + for (i = 0; i < ARRAY_SIZE (type_names); i++) + if (type_names[i] + && grub_memcmp (loaddev, type_names[i], grub_strlen (type_names[i])) == 0 + && loaddev[grub_strlen (type_names[i])] == '(') + break; + if (i == ARRAY_SIZE (type_names)) + pptr = loaddev; + else + for (pptr = loaddev; *pptr && *pptr != '/' && *pptr != '\\'; pptr++); + if (*pptr) { + char *iptr, *optr; + char sep = *pptr; + *path = grub_malloc (grub_strlen (pptr) + 1); + if (!*path) + return; + for (iptr = pptr, optr = *path; *iptr; iptr++, optr++) + if (*iptr == sep) + *optr = '/'; + else + *optr = *iptr; + *optr = '\0'; *path = grub_strdup (pptr); *pptr = '\0'; } + + if (*loaddev == '\0') + { + const char *syspart = 0; + + if (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmware_vector_length + >= ((char *) (&GRUB_ARC_FIRMWARE_VECTOR->getenvironmentvariable + 1) + - (char *) GRUB_ARC_FIRMWARE_VECTOR) + && GRUB_ARC_FIRMWARE_VECTOR->getenvironmentvariable) + syspart = GRUB_ARC_FIRMWARE_VECTOR->getenvironmentvariable ("SystemPartition"); + if (!syspart) + return; + loaddev = grub_strdup (syspart); + } + partptr = get_part (loaddev); if (partptr) { @@ -370,6 +412,8 @@ grub_machine_get_bootlocation (char **device __attribute__ ((unused)), if (poff == (grub_addr_t) -1) { *device = dname; + if (loaddev != boot_location) + grub_free (loaddev); return; } @@ -377,6 +421,8 @@ grub_machine_get_bootlocation (char **device __attribute__ ((unused)), if (!parent) { *device = dname; + if (loaddev != boot_location) + grub_free (loaddev); return; } @@ -385,6 +431,8 @@ grub_machine_get_bootlocation (char **device __attribute__ ((unused)), { grub_disk_close (parent); *device = dname; + if (loaddev != boot_location) + grub_free (loaddev); return; } @@ -398,6 +446,8 @@ grub_machine_get_bootlocation (char **device __attribute__ ((unused)), if (! ctx.partition_name) { *device = dname; + if (loaddev != boot_location) + grub_free (loaddev); return; } @@ -405,4 +455,6 @@ grub_machine_get_bootlocation (char **device __attribute__ ((unused)), ctx.partition_name); grub_free (ctx.partition_name); grub_free (dname); + if (loaddev != boot_location) + grub_free (loaddev); } From e9e46c9a0c2b67a3e9abb555f5f0e0c552892e20 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 12:00:31 +0200 Subject: [PATCH 115/187] * include/grub/list.h (FOR_LIST_ELEMENTS_SAFE):Fix a NULL pointer dereference. Reported by: qwertial. --- ChangeLog | 6 ++++++ include/grub/list.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f444ea922..bf413de63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-29 Vladimir Serbinenko + + * include/grub/list.h (FOR_LIST_ELEMENTS_SAFE):Fix a NULL pointer + dereference. + Reported by: qwertial. + 2013-04-29 Vladimir Serbinenko * grub-core/kern/mips/arc/init.c: Fix prefix detection. diff --git a/include/grub/list.h b/include/grub/list.h index 6f6dec044..edd20adfd 100644 --- a/include/grub/list.h +++ b/include/grub/list.h @@ -35,7 +35,7 @@ void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item); void EXPORT_FUNC(grub_list_remove) (grub_list_t item); #define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next) -#define FOR_LIST_ELEMENTS_SAFE(var, nxt, list) for ((var) = (list), (nxt) = ((var) ? (var)->next : 0); (var); (var) = (nxt), (nxt) = (var)->next) +#define FOR_LIST_ELEMENTS_SAFE(var, nxt, list) for ((var) = (list), (nxt) = ((var) ? (var)->next : 0); (var); (var) = (nxt), ((nxt) = (var) ? (var)->next : 0)) static inline void * grub_bad_type_cast_real (int line, const char *file) From bdc4add8ca278ed8c5348fd7e7028ae6092089ef Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 12:02:26 +0200 Subject: [PATCH 116/187] * grub-core/script/execute.c (grub_script_arglist_to_argv): Fix handling of variables containing backslash. --- ChangeLog | 5 +++++ grub-core/script/execute.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf413de63..9dacb19b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-29 Vladimir Serbinenko + + * grub-core/script/execute.c (grub_script_arglist_to_argv): Fix + handling of variables containing backslash. + 2013-04-29 Vladimir Serbinenko * include/grub/list.h (FOR_LIST_ELEMENTS_SAFE):Fix a NULL pointer diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c index a1dcc342d..9babbeee2 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -643,9 +643,38 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist, if (arg->type == GRUB_SCRIPT_ARG_TYPE_VAR) { - if (grub_script_argv_append (&result, values[i], - grub_strlen (values[i]))) + int len; + char ch; + char *p; + char *op; + const char *s = values[i]; + + len = grub_strlen (values[i]); + /* \? -> \\\? */ + /* \* -> \\\* */ + /* \ -> \\ */ + p = grub_malloc (len * 2 + 1); + if (! p) goto fail; + + op = p; + while ((ch = *s++)) + { + if (ch == '\\') + { + *op++ = '\\'; + if (*s == '?' || *s == '*') + *op++ = '\\'; + } + *op++ = ch; + } + *op = '\0'; + + if (grub_script_argv_append (&result, p, op - p)) + { + grub_free (p); + goto fail; + } } else { From f7bf6c31f36c1644e9b48daf0bfb8c90912a415a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 12:05:19 +0200 Subject: [PATCH 117/187] * grub-core/bus/usb/uhci.c: Fix DMA handling and enable on all PCI platforms. --- ChangeLog | 5 +++ grub-core/Makefile.core.def | 2 +- grub-core/bus/usb/uhci.c | 70 ++++++++++++++++++++++++++++--------- 3 files changed, 59 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9dacb19b8..99a049a15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-29 Vladimir Serbinenko + + * grub-core/bus/usb/uhci.c: Fix DMA handling and enable on all PCI + platforms. + 2013-04-29 Vladimir Serbinenko * grub-core/script/execute.c (grub_script_arglist_to_argv): Fix diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 2e73d89b8..dcb92ef65 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -482,7 +482,7 @@ module = { module = { name = uhci; common = bus/usb/uhci.c; - enable = x86; + enable = pci; }; module = { diff --git a/grub-core/bus/usb/uhci.c b/grub-core/bus/usb/uhci.c index 3639c4258..a31463735 100644 --- a/grub-core/bus/usb/uhci.c +++ b/grub-core/bus/usb/uhci.c @@ -26,6 +26,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -44,12 +45,22 @@ typedef enum GRUB_UHCI_REG_USBLEGSUP = 0xc0 } grub_uhci_reg_t; +enum + { + GRUB_UHCI_DETECT_CHANGED = (1 << 1), + GRUB_UHCI_DETECT_HAVE_DEVICE = 1, + GRUB_UHCI_DETECT_LOW_SPEED = (1 << 8) + }; + /* R/WC legacy support bits */ -#define GRUB_UHCI_LEGSUP_END_A20GATE (1 << 15) -#define GRUB_UHCI_TRAP_BY_64H_WSTAT (1 << 11) -#define GRUB_UHCI_TRAP_BY_64H_RSTAT (1 << 10) -#define GRUB_UHCI_TRAP_BY_60H_WSTAT (1 << 9) -#define GRUB_UHCI_TRAP_BY_60H_RSTAT (1 << 8) +enum + { + GRUB_UHCI_LEGSUP_END_A20GATE = (1 << 15), + GRUB_UHCI_TRAP_BY_64H_WSTAT = (1 << 11), + GRUB_UHCI_TRAP_BY_64H_RSTAT = (1 << 10), + GRUB_UHCI_TRAP_BY_60H_WSTAT = (1 << 9), + GRUB_UHCI_TRAP_BY_60H_RSTAT = (1 << 8) + }; /* Reset all legacy support - clear all R/WC bits and all R/W bits */ #define GRUB_UHCI_RESET_LEGSUP_SMI ( GRUB_UHCI_LEGSUP_END_A20GATE \ @@ -125,7 +136,7 @@ typedef volatile struct grub_uhci_qh *grub_uhci_qh_t; struct grub_uhci { - int iobase; + grub_port_t iobase; volatile grub_uint32_t *framelist_virt; grub_uint32_t framelist_phys; struct grub_pci_dma_chunk *framelist_chunk; @@ -213,22 +224,36 @@ grub_uhci_pci_iter (grub_pci_device_t dev, /* Set bus master - needed for coreboot or broken BIOSes */ addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); - grub_pci_write_word(addr, - GRUB_PCI_COMMAND_BUS_MASTER | grub_pci_read_word(addr)); + grub_pci_write_word(addr, GRUB_PCI_COMMAND_IO_ENABLED + | GRUB_PCI_COMMAND_BUS_MASTER + | grub_pci_read_word (addr)); /* Determine IO base address. */ addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4); base = grub_pci_read (addr); /* Stop if there is no IO space base address defined. */ - if (! (base & 1)) + if ((base & GRUB_PCI_ADDR_SPACE_MASK) != GRUB_PCI_ADDR_SPACE_IO) return 0; + if ((base & GRUB_UHCI_IOMASK) == 0) + { +#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_QEMU) + static int ndevs = 0; + base = 0x1800 + ndevs++ * 0x100; + grub_pci_write (addr, base | GRUB_PCI_ADDR_SPACE_IO); +#else + return 0; +#endif + } + + grub_dprintf ("uhci", "base = %x\n", base); + /* Allocate memory for the controller and register it. */ u = grub_zalloc (sizeof (*u)); if (! u) return 1; - u->iobase = base & GRUB_UHCI_IOMASK; + u->iobase = (base & GRUB_UHCI_IOMASK) + GRUB_MACHINE_PCI_IO_BASE; /* Reset PIRQ and SMI */ addr = grub_pci_make_address (dev, GRUB_UHCI_REG_USBLEGSUP); @@ -392,6 +417,7 @@ grub_free_queue (struct grub_uhci *u, grub_uhci_qh_t qh, grub_uhci_td_t td, { grub_uhci_td_t tdprev; + grub_dprintf ("uhci", "Freeing %p\n", td); /* Check state of TD and possibly set last_trans */ if (transfer && (td->linkptr & 1)) transfer->last_trans = i; @@ -400,7 +426,10 @@ grub_free_queue (struct grub_uhci *u, grub_uhci_qh_t qh, grub_uhci_td_t td, /* Unlink the queue. */ tdprev = td; - td = grub_dma_phys2virt (td->linkptr2, u->td_chunk); + if (!td->linkptr2) + td = 0; + else + td = grub_dma_phys2virt (td->linkptr2, u->td_chunk); /* Free the TD. */ grub_free_td (u, tdprev); @@ -583,10 +612,17 @@ grub_uhci_check_transfer (grub_usb_controller_t dev, *actual = 0; - errtd = grub_dma_phys2virt (cdata->qh->elinkptr & ~0x0f, u->qh_chunk); + if (cdata->qh->elinkptr & ~0x0f) + errtd = grub_dma_phys2virt (cdata->qh->elinkptr & ~0x0f, u->qh_chunk); + else + errtd = 0; - grub_dprintf ("uhci", ">t status=0x%02x data=0x%02x td=%p\n", - errtd->ctrl_status, errtd->buffer & (~15), errtd); + if (errtd) + { + grub_dprintf ("uhci", ">t status=0x%02x data=0x%02x td=%p, %x\n", + errtd->ctrl_status, errtd->buffer & (~15), errtd, + cdata->qh->elinkptr); + } /* Check if the transaction completed. */ if (cdata->qh->elinkptr & 1) @@ -788,7 +824,7 @@ grub_uhci_detect_dev (grub_usb_controller_t dev, int port, int *changed) grub_dprintf ("uhci", "detect=0x%02x port=%d\n", status, port); /* Connect Status Change bit - it detects change of connection */ - if (status & (1 << 1)) + if (status & GRUB_UHCI_DETECT_CHANGED) { *changed = 1; /* Reset bit Connect Status Change */ @@ -798,9 +834,9 @@ grub_uhci_detect_dev (grub_usb_controller_t dev, int port, int *changed) else *changed = 0; - if (! (status & 1)) + if (! (status & GRUB_UHCI_DETECT_HAVE_DEVICE)) return GRUB_USB_SPEED_NONE; - else if (status & (1 << 8)) + else if (status & GRUB_UHCI_DETECT_LOW_SPEED) return GRUB_USB_SPEED_LOW; else return GRUB_USB_SPEED_FULL; From ef9d8cd510902e8a961b6566059819acd5156c1a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 12:14:57 +0200 Subject: [PATCH 118/187] * grub-core/commands/nativedisk.c: Customize the list of modules on platform. Don't try to search for disks already using native drivers. --- ChangeLog | 5 ++ grub-core/Makefile.core.def | 4 ++ grub-core/commands/nativedisk.c | 101 +++++++++++++++++++++++++------- 3 files changed, 89 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99a049a15..1ba588d32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-29 Vladimir Serbinenko + + * grub-core/commands/nativedisk.c: Customize the list of modules on + platform. Don't try to search for disks already using native drivers. + 2013-04-29 Vladimir Serbinenko * grub-core/bus/usb/uhci.c: Fix DMA handling and enable on all PCI diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index dcb92ef65..ebcd01deb 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -510,6 +510,10 @@ module = { module = { name = nativedisk; common = commands/nativedisk.c; + + enable = x86; + enable = mips_loongson; + enable = mips_qemu_mips; }; module = { diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c index 333fc8299..453faadea 100644 --- a/grub-core/commands/nativedisk.c +++ b/grub-core/commands/nativedisk.c @@ -31,17 +31,67 @@ GRUB_MOD_LICENSE ("GPLv3+"); -static const char *modnames_def[] = { "pata", "ahci", "usbms", "ohci", "uhci", "ehci" }; +static const char *modnames_def[] = { + /* FIXME: autogenerate this. */ +#if defined (__i386__) || defined (__x86_64__) || defined (GRUB_MACHINE_MIPS_LOONGSON) + "pata", "ahci", "usbms", "ohci", "uhci", "ehci" +#elif defined (GRUB_MACHINE_MIPS_QEMU_MIPS) + "pata" +#else +#error "Fill this" +#endif + }; static grub_err_t -get_uuid (const char *name, char **uuid) +get_uuid (const char *name, char **uuid, int getnative) { grub_device_t dev; grub_fs_t fs = 0; + *uuid = 0; + dev = grub_device_open (name); if (!dev) return grub_errno; + + if (!dev->disk) + { + grub_dprintf ("nativedisk", "Skipping non-disk\n"); + return 0; + } + + switch (dev->disk->dev->id) + { + /* Firmware disks. */ + case GRUB_DISK_DEVICE_BIOSDISK_ID: + case GRUB_DISK_DEVICE_OFDISK_ID: + case GRUB_DISK_DEVICE_EFIDISK_ID: + case GRUB_DISK_DEVICE_NAND_ID: + case GRUB_DISK_DEVICE_ARCDISK_ID: + case GRUB_DISK_DEVICE_HOSTDISK_ID: + break; + + /* Native disks. */ + case GRUB_DISK_DEVICE_ATA_ID: + case GRUB_DISK_DEVICE_SCSI_ID: + if (getnative) + break; + + /* Virtual disks. */ + case GRUB_DISK_DEVICE_PROCFS_ID: + case GRUB_DISK_DEVICE_HOST_ID: + /* GRUB-only memdisk. Can't match any of firmware devices. */ + case GRUB_DISK_DEVICE_MEMDISK_ID: + grub_dprintf ("nativedisk", "Skipping native disk %s\n", + dev->disk->name); + return 0; + + /* FIXME: those probably need special handling. */ + case GRUB_DISK_DEVICE_LOOPBACK_ID: + case GRUB_DISK_DEVICE_DISKFILTER_ID: + case GRUB_DISK_DEVICE_CRYPTODISK_ID: + break; + } if (dev) fs = grub_fs_probe (dev); if (!fs) @@ -49,7 +99,7 @@ get_uuid (const char *name, char **uuid) grub_device_close (dev); return grub_errno; } - if (!fs->uuid || fs->uuid (dev, uuid)) + if (!fs->uuid || fs->uuid (dev, uuid) || !*uuid) { grub_device_close (dev); @@ -77,14 +127,17 @@ iterate_device (const char *name, void *data) struct search_ctx *ctx = data; char *cur_uuid; - if (get_uuid (name, &cur_uuid)) + if (get_uuid (name, &cur_uuid, 1)) { if (grub_errno == GRUB_ERR_UNKNOWN_FS) grub_errno = 0; grub_print_error (); return 0; } - if (grub_strcasecmp (cur_uuid, ctx->prefix_uuid) == 0) + + grub_dprintf ("nativedisk", "checking %s: %s\n", name, + cur_uuid); + if (ctx->prefix_uuid && grub_strcasecmp (cur_uuid, ctx->prefix_uuid) == 0) { char *prefix; prefix = grub_xasprintf ("(%s)/%s", name, ctx->prefix_path); @@ -92,7 +145,7 @@ iterate_device (const char *name, void *data) grub_free (prefix); ctx->prefix_found = 1; } - if (grub_strcasecmp (cur_uuid, ctx->root_uuid) == 0) + if (ctx->root_uuid && grub_strcasecmp (cur_uuid, ctx->root_uuid) == 0) { grub_env_set ("root", name); ctx->root_found = 1; @@ -109,9 +162,7 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)), const char *path_prefix = 0; int mods_loaded = 0; grub_dl_t *mods; - struct search_ctx ctx; const char **args; - grub_fs_autoload_hook_t saved_autoload; int i; if (argc == 0) @@ -138,7 +189,7 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)), if (!mods) return grub_errno; - if (get_uuid (NULL, &uuid_root)) + if (get_uuid (NULL, &uuid_root, 0)) return grub_errno; prefdev = grub_file_get_device_name (prefix); @@ -148,12 +199,15 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)), prefdev = 0; } - if (get_uuid (prefdev, &uuid_prefix)) + if (get_uuid (prefdev, &uuid_prefix, 0)) { grub_free (uuid_root); return grub_errno; } + grub_dprintf ("nativedisk", "uuid_prefix = %s, uuid_root = %s\n", + uuid_prefix, uuid_root); + for (mods_loaded = 0; mods_loaded < argc; mods_loaded++) { char *filename; @@ -205,21 +259,26 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)), if (mods[i]) grub_dl_init (mods[i]); - /* No need to autoload FS since obviously we already have the necessary fs modules. */ - saved_autoload = grub_fs_autoload_hook; - grub_fs_autoload_hook = 0; + if (uuid_prefix || uuid_root) + { + struct search_ctx ctx; + grub_fs_autoload_hook_t saved_autoload; - ctx.root_uuid = uuid_root; - ctx.prefix_uuid = uuid_prefix; - ctx.prefix_path = path_prefix; - ctx.prefix_found = 0; - ctx.root_found = 0; + /* No need to autoload FS since obviously we already have the necessary fs modules. */ + saved_autoload = grub_fs_autoload_hook; + grub_fs_autoload_hook = 0; - /* FIXME: try to guess the correct values. */ - grub_device_iterate (iterate_device, &ctx); + ctx.root_uuid = uuid_root; + ctx.prefix_uuid = uuid_prefix; + ctx.prefix_path = path_prefix; + ctx.prefix_found = !uuid_prefix; + ctx.root_found = !uuid_root; - grub_fs_autoload_hook = saved_autoload; + /* FIXME: try to guess the correct values. */ + grub_device_iterate (iterate_device, &ctx); + grub_fs_autoload_hook = saved_autoload; + } grub_free (uuid_root); grub_free (uuid_prefix); From e2f27a8c5363f7be96db1abcf261c7d0265f5308 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 12:16:46 +0200 Subject: [PATCH 119/187] Enforce disabling of firmware disk drivers when native drivers kick in. --- ChangeLog | 4 ++++ grub-core/bus/usb/ehci.c | 4 ++++ grub-core/bus/usb/ohci.c | 4 ++++ grub-core/bus/usb/uhci.c | 2 ++ grub-core/disk/ahci.c | 13 +------------ grub-core/disk/efi/efidisk.c | 19 ++++++++++++------- grub-core/disk/ieee1275/ofdisk.c | 18 ++++++++++-------- grub-core/disk/pata.c | 8 +------- include/grub/disk.h | 14 ++++++++++++++ 9 files changed, 52 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ba588d32..1dea1aa8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-29 Vladimir Serbinenko + + Enforce disabling of firmware disk drivers when native drivers kick in. + 2013-04-29 Vladimir Serbinenko * grub-core/commands/nativedisk.c: Customize the list of modules on diff --git a/grub-core/bus/usb/ehci.c b/grub-core/bus/usb/ehci.c index d18a87f8e..9294445d3 100644 --- a/grub-core/bus/usb/ehci.c +++ b/grub-core/bus/usb/ehci.c @@ -28,6 +28,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -1909,6 +1910,9 @@ GRUB_MOD_INIT (ehci) { COMPILE_TIME_ASSERT (sizeof (struct grub_ehci_td) == 64); COMPILE_TIME_ASSERT (sizeof (struct grub_ehci_qh) == 96); + + grub_stop_disk_firmware (); + grub_boot_time ("Initing EHCI hardware"); grub_ehci_inithw (); grub_boot_time ("Registering EHCI driver"); diff --git a/grub-core/bus/usb/ohci.c b/grub-core/bus/usb/ohci.c index 2f3fd91fb..3be5c8d73 100644 --- a/grub-core/bus/usb/ohci.c +++ b/grub-core/bus/usb/ohci.c @@ -28,6 +28,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -1442,6 +1443,9 @@ GRUB_MOD_INIT(ohci) { COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_td) == 32); COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_ed) == 16); + + grub_stop_disk_firmware (); + grub_ohci_inithw (); grub_usb_controller_dev_register (&usb_controller); fini_hnd = grub_loader_register_preboot_hook (grub_ohci_fini_hw, diff --git a/grub-core/bus/usb/uhci.c b/grub-core/bus/usb/uhci.c index a31463735..c2e2e7efe 100644 --- a/grub-core/bus/usb/uhci.c +++ b/grub-core/bus/usb/uhci.c @@ -866,6 +866,8 @@ static struct grub_usb_controller_dev usb_controller = GRUB_MOD_INIT(uhci) { + grub_stop_disk_firmware (); + grub_uhci_inithw (); grub_usb_controller_dev_register (&usb_controller); grub_dprintf ("uhci", "registered\n"); diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c index e6170426e..554fcc55f 100644 --- a/grub-core/disk/ahci.c +++ b/grub-core/disk/ahci.c @@ -183,11 +183,6 @@ grub_ahci_pciinit (grub_pci_device_t dev, if (class >> 8 != 0x010601) return 0; -#ifdef GRUB_MACHINE_QEMU - addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); - grub_pci_write_word (addr, 0x107); -#endif - addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG5); #ifdef GRUB_MACHINE_QEMU @@ -1102,13 +1097,7 @@ static struct grub_preboot *fini_hnd; GRUB_MOD_INIT(ahci) { - /* To prevent two drivers operating on the same disks. */ - grub_disk_firmware_is_tainted = 1; - if (grub_disk_firmware_fini) - { - grub_disk_firmware_fini (); - grub_disk_firmware_fini = NULL; - } + grub_stop_disk_firmware (); /* AHCI initialization. */ grub_ahci_initialize (); diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index e168d07fa..ebd906e7c 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -623,22 +623,27 @@ static struct grub_disk_dev grub_efidisk_dev = .next = 0 }; -void -grub_efidisk_init (void) -{ - enumerate_disks (); - grub_disk_dev_register (&grub_efidisk_dev); -} - void grub_efidisk_fini (void) { free_devices (fd_devices); free_devices (hd_devices); free_devices (cd_devices); + fd_devices = 0; + hd_devices = 0; + cd_devices = 0; grub_disk_dev_unregister (&grub_efidisk_dev); } +void +grub_efidisk_init (void) +{ + grub_disk_firmware_fini = grub_efidisk_fini; + + enumerate_disks (); + grub_disk_dev_register (&grub_efidisk_dev); +} + /* Some utility functions to map GRUB devices with EFI devices. */ grub_efi_handle_t grub_efidisk_get_device_handle (grub_disk_t disk) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c index ec92c4d10..2a31ecdb1 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -549,14 +549,6 @@ insert_bootpath (void) grub_free (bootpath); } -void -grub_ofdisk_init (void) -{ - insert_bootpath (); - - grub_disk_dev_register (&grub_ofdisk_dev); -} - void grub_ofdisk_fini (void) { @@ -568,6 +560,16 @@ grub_ofdisk_fini (void) grub_disk_dev_unregister (&grub_ofdisk_dev); } +void +grub_ofdisk_init (void) +{ + grub_disk_firmware_fini = grub_ofdisk_fini; + + insert_bootpath (); + + grub_disk_dev_register (&grub_ofdisk_dev); +} + grub_err_t grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size) { diff --git a/grub-core/disk/pata.c b/grub-core/disk/pata.c index 75e5deb61..8c4b27b7e 100644 --- a/grub-core/disk/pata.c +++ b/grub-core/disk/pata.c @@ -530,13 +530,7 @@ static struct grub_ata_dev grub_pata_dev = GRUB_MOD_INIT(ata_pthru) { - /* To prevent two drivers operating on the same disks. */ - grub_disk_firmware_is_tainted = 1; - if (grub_disk_firmware_fini) - { - grub_disk_firmware_fini (); - grub_disk_firmware_fini = NULL; - } + grub_stop_disk_firmware (); /* ATA initialization. */ grub_pata_initialize (); diff --git a/include/grub/disk.h b/include/grub/disk.h index d19b1ac96..8fa09a6df 100644 --- a/include/grub/disk.h +++ b/include/grub/disk.h @@ -25,6 +25,8 @@ #include #include #include +/* For NULL. */ +#include /* These are used to set a device id. When you add a new disk device, you must define a new id for it here. */ @@ -205,6 +207,18 @@ EXPORT_FUNC(grub_disk_cache_get_performance) (unsigned long *hits, unsigned long extern void (* EXPORT_VAR(grub_disk_firmware_fini)) (void); extern int EXPORT_VAR(grub_disk_firmware_is_tainted); +static inline void +grub_stop_disk_firmware (void) +{ + /* To prevent two drivers operating on the same disks. */ + grub_disk_firmware_is_tainted = 1; + if (grub_disk_firmware_fini) + { + grub_disk_firmware_fini (); + grub_disk_firmware_fini = NULL; + } +} + #if defined (GRUB_UTIL) void grub_lvm_init (void); void grub_ldm_init (void); From f7457fb231b562e09b62eb8b9bcd103e9a490e79 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 12:25:57 +0200 Subject: [PATCH 120/187] Add few new tests. --- ChangeLog | 4 +++ Makefile.util.def | 42 ++++++++++++++++++++++++ tests/ahci_test.in | 52 +++++++++++++++++++++++++++++ tests/ehci_test.in | 50 ++++++++++++++++++++++++++++ tests/grub_script_escape_comma.in | 18 +++++++++++ tests/help_test.in | 16 +++++++++ tests/ohci_test.in | 50 ++++++++++++++++++++++++++++ tests/pata_test.in | 54 +++++++++++++++++++++++++++++++ tests/uhci_test.in | 50 ++++++++++++++++++++++++++++ tests/util/grub-shell.in | 2 +- 10 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 tests/ahci_test.in create mode 100644 tests/ehci_test.in create mode 100644 tests/grub_script_escape_comma.in create mode 100644 tests/help_test.in create mode 100644 tests/ohci_test.in create mode 100644 tests/pata_test.in create mode 100644 tests/uhci_test.in diff --git a/ChangeLog b/ChangeLog index 1dea1aa8d..e4a730786 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-29 Vladimir Serbinenko + + Add few new tests. + 2013-04-29 Vladimir Serbinenko Enforce disabling of firmware disk drivers when native drivers kick in. diff --git a/Makefile.util.def b/Makefile.util.def index caa6c059c..3cfc592dc 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -544,6 +544,36 @@ script = { common = tests/example_scripted_test.in; }; +script = { + testcase; + name = pata_test; + common = tests/pata_test.in; +}; + +script = { + testcase; + name = ahci_test; + common = tests/ahci_test.in; +}; + +script = { + testcase; + name = uhci_test; + common = tests/uhci_test.in; +}; + +script = { + testcase; + name = ohci_test; + common = tests/ohci_test.in; +}; + +script = { + testcase; + name = ehci_test; + common = tests/ehci_test.in; +}; + script = { testcase; name = example_grub_script_test; @@ -748,12 +778,24 @@ script = { common = tests/grub_cmd_echo.in; }; +script = { + testcase; + name = help_test; + common = tests/help_test.in; +}; + script = { testcase; name = grub_script_gettext; common = tests/grub_script_gettext.in; }; +script = { + testcase; + name = grub_script_escape_comma; + common = tests/grub_script_escape_comma.in; +}; + script = { testcase; name = grub_script_strcmp; diff --git a/tests/ahci_test.in b/tests/ahci_test.in new file mode 100644 index 000000000..fa5314c97 --- /dev/null +++ b/tests/ahci_test.in @@ -0,0 +1,52 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; + # FIXME: qemu gets bonito DMA wrong + mipsel-loongson) + exit 0;; + # no AHCI on ARC and qemu-mips platforms + mips*-arc | mips*-qemu_mips) + exit 0;; + # FIXME: No native drivers are available for those + powerpc-ieee1275 | sparc64-ieee1275) + exit 0;; +esac + +imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 +outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 + +echo "hello" > "$outfile" + +tar cf "$imgfile" "$outfile" + +if [ "$(echo "nativedisk; source '(ahci0)/$outfile';" | "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 " | tail -n 1)" != "Hello World" ]; then + rm "$imgfile" + rm "$outfile" + exit 1 +fi + +rm "$imgfile" +rm "$outfile" + + diff --git a/tests/ehci_test.in b/tests/ehci_test.in new file mode 100644 index 000000000..d9999f8e6 --- /dev/null +++ b/tests/ehci_test.in @@ -0,0 +1,50 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; + # FIXME: qemu gets bonito DMA wrong + mipsel-loongson) + exit 0;; + # no USB on ARC and qemu-mips platforms + mips*-arc | mips*-qemu_mips) + exit 0;; + # FIXME: No native drivers are available for those + powerpc-ieee1275 | sparc64-ieee1275) + exit 0;; +esac + +imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 +outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 + +echo "hello" > "$outfile" + +tar cf "$imgfile" "$outfile" + +if [ "$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-device ich9-usb-ehci1 -drive id=my_usb_disk,file=$imgfile,if=none -device usb-storage,drive=my_usb_disk" | tail -n 1)" != "Hello World" ]; then + rm "$imgfile" + rm "$outfile" + exit 1 +fi + +rm "$imgfile" +rm "$outfile" diff --git a/tests/grub_script_escape_comma.in b/tests/grub_script_escape_comma.in new file mode 100644 index 000000000..eff317920 --- /dev/null +++ b/tests/grub_script_escape_comma.in @@ -0,0 +1,18 @@ +#! @builddir@/grub-shell-tester + +x=1\\,1 +echo $x +y='$' +echo $y +z='\' +echo $z +t='\*' +echo $t +u='$' +echo $u +v='\?' +echo $v + + +echo \\ + diff --git a/tests/help_test.in b/tests/help_test.in new file mode 100644 index 000000000..e780924ef --- /dev/null +++ b/tests/help_test.in @@ -0,0 +1,16 @@ +#! /bin/bash +set -e + +. "@builddir@/grub-core/modinfo.sh" + +template="Usage: help [PATTERN ...] +Show a help message. + +-h, --help Display this help and exit. +-u, --usage Display the usage of this command and exit. +Hello World" +outpu="$(echo 'help help; hello' | @builddir@/grub-shell)" + +if [ "$template" != "$outpu" ]; then + exit 1 +fi diff --git a/tests/ohci_test.in b/tests/ohci_test.in new file mode 100644 index 000000000..d6c1e0c93 --- /dev/null +++ b/tests/ohci_test.in @@ -0,0 +1,50 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; + # FIXME: qemu gets bonito DMA wrong + mipsel-loongson) + exit 0;; + # no USB on ARC and qemu-mips platforms + mips*-arc | mips*-qemu_mips) + exit 0;; + # FIXME: No native drivers are available for those + powerpc-ieee1275 | sparc64-ieee1275) + exit 0;; +esac + +imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 +outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 + +echo "hello" > "$outfile" + +tar cf "$imgfile" "$outfile" + +if [ "$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-device pci-ohci -drive id=my_usb_disk,file=$imgfile,if=none -device usb-storage,drive=my_usb_disk" | tail -n 1)" != "Hello World" ]; then + rm "$imgfile" + rm "$outfile" + exit 1 +fi + +rm "$imgfile" +rm "$outfile" diff --git a/tests/pata_test.in b/tests/pata_test.in new file mode 100644 index 000000000..3671300d8 --- /dev/null +++ b/tests/pata_test.in @@ -0,0 +1,54 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +disk=hda +indisk=ata0 + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; + # no ATA on ARC platforms (they use SCSI) + *-arc) + exit 0;; + # FIXME: No native drivers are available for those + powerpc-ieee1275 | sparc64-ieee1275) + exit 0;; + i386-ieee1275) + disk=hdb + indisk=ata1 + ;; +esac + +imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 +outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 + +echo "hello" > "$outfile" + +tar cf "$imgfile" "$outfile" + +if [ "$(echo "nativedisk; source '($indisk)/$outfile';" | "${grubshell}" --qemu-opts="-$disk $imgfile")" != "Hello World" ]; then + rm "$imgfile" + rm "$outfile" + exit 1 +fi + +rm "$imgfile" +rm "$outfile" diff --git a/tests/uhci_test.in b/tests/uhci_test.in new file mode 100644 index 000000000..ec6731c85 --- /dev/null +++ b/tests/uhci_test.in @@ -0,0 +1,50 @@ +#! /bin/sh +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +set -e +grubshell=@builddir@/grub-shell + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + *-emu) + exit 0;; + # FIXME: qemu gets bonito DMA wrong + mipsel-loongson) + exit 0;; + # no USB on ARC and qemu-mips platforms + mips*-arc | mips*-qemu_mips) + exit 0;; + # FIXME: No native drivers are available for those + powerpc-ieee1275 | sparc64-ieee1275) + exit 0;; +esac + +imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 +outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 + +echo "hello" > "$outfile" + +tar cf "$imgfile" "$outfile" + +if [ "$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-usb -usbdevice disk:$imgfile" | tail -n 1)" != "Hello World" ]; then + rm "$imgfile" + rm "$outfile" + exit 1 +fi + +rm "$imgfile" +rm "$outfile" diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index b034e96a3..5b20ca3fb 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -322,7 +322,7 @@ do done cat <>${cfgfile} -source \$prefix/testcase.cfg +source "\$prefix/testcase.cfg" # Stop serial output to suppress "ACPI shutdown failed" error. EOF if [ x$console != x ]; then From c53b4e67e4a9e5943238bc7d33b32b7831c0d692 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 12:26:43 +0200 Subject: [PATCH 121/187] Unify more code in grub-install_header. --- ChangeLog | 4 ++++ util/grub-install.in | 37 ------------------------------------ util/grub-install_header | 40 +++++++++++++++++++++++++++++++++++++++ util/grub-mknetdir.in | 36 ----------------------------------- util/grub-mkrescue.in | 39 -------------------------------------- util/grub-mkstandalone.in | 37 ------------------------------------ 6 files changed, 44 insertions(+), 149 deletions(-) diff --git a/ChangeLog b/ChangeLog index e4a730786..eff0b6b0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-29 Vladimir Serbinenko + + Unify more code in grub-install_header. + 2013-04-29 Vladimir Serbinenko Add few new tests. diff --git a/util/grub-install.in b/util/grub-install.in index d69ef3a41..3dbd5da73 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -17,38 +17,19 @@ # along with GRUB. If not, see . # Initialize some variables. -prefix="@prefix@" -exec_prefix="@exec_prefix@" -datarootdir="@datarootdir@" sbindir="@sbindir@" -bindir="@bindir@" -libdir="@libdir@" sysconfdir="@sysconfdir@" -PACKAGE_NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ -PACKAGE_VERSION=@PACKAGE_VERSION@ - -export TEXTDOMAIN=@PACKAGE@ -export TEXTDOMAINDIR="@localedir@" host_os=@host_os@ target= -datadir="@datadir@" -if [ "x$pkgdatadir" = x ]; then - pkgdatadir="${datadir}/@PACKAGE@" -fi localedir="@datadir@/locale" -self="`basename $0`" - -grub_mkimage="${bindir}/@grub_mkimage@" grub_probe="${sbindir}/@grub_probe@" grub_editenv="${bindir}/@grub_editenv@" grub_mkrelpath="${bindir}/@grub_mkrelpath@" rootdir= bootdir= grubdir="`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`" -modules= install_device= force_lba= @@ -73,8 +54,6 @@ fi disk_module=unspecified -. "${pkgdatadir}/grub-mkconfig_lib" - # Usage: usage # Print the usage. usage () { @@ -85,8 +64,6 @@ usage () { gettext "Install GRUB on your drive." ; echo echo print_option_help "-h, --help" "$(gettext "print this message and exit")" - print_option_help "-v, --version" "$(gettext "print the version information and exit")" - print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" grub_print_install_files_help dirmsg="$(gettext_printf "install GRUB images under the directory DIR/%s instead of the %s directory" "@grubdirname@" "$grubdir")" @@ -96,7 +73,6 @@ usage () { # TRANSLATORS: "current" refers to the platform user's currently running on print_option_help "--target=$target_trans" "$(gettext "install GRUB for TARGET platform [default=current]")" print_option_help "--grub-setup=$(gettext "FILE")" "$(gettext "use FILE as grub-setup")" - print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" print_option_help "--grub-mkrelpath=$(gettext "FILE")" "$(gettext "use FILE as grub-mkrelpath")" print_option_help "--grub-probe=$(gettext "FILE")" "$(gettext "use FILE as grub-probe")" # TRANSLATORS: "may break" doesn't just mean that option wouldn't have any @@ -140,14 +116,6 @@ do -h | --help) usage exit 0 ;; - -v | --version) - echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" - exit 0 ;; - - --modules) - modules=`argument $option "$@"`; shift;; - --modules=*) - modules=`echo "$option" | sed 's/--modules=//'` ;; --force-file-id) force_file_id=y ;; @@ -189,11 +157,6 @@ do --bootloader-id=*) bootloader_id="`echo "$option" | sed 's/--bootloader-id=//'`" ;; - --grub-mkimage) - grub_mkimage="`argument $option "$@"`"; shift;; - --grub-mkimage=*) - grub_mkimage="`echo "$option" | sed 's/--grub-mkimage=//'`" ;; - --grub-mkrelpath) grub_mkrelpath="`argument "$option" "$@"`"; shift;; --grub-mkrelpath=*) diff --git a/util/grub-install_header b/util/grub-install_header index 72d91e9ed..cf7fa9d0e 100644 --- a/util/grub-install_header +++ b/util/grub-install_header @@ -16,9 +16,34 @@ set -e # You should have received a copy of the GNU General Public License # along with GRUB. If not, see . +prefix="@prefix@" +exec_prefix="@exec_prefix@" +datarootdir="@datarootdir@" +bindir="@bindir@" + +libdir="@libdir@" +PACKAGE_NAME=@PACKAGE_NAME@ +PACKAGE_TARNAME=@PACKAGE_TARNAME@ +PACKAGE_VERSION=@PACKAGE_VERSION@ +datadir="@datadir@" +if [ "x$pkgdatadir" = x ]; then + pkgdatadir="${datadir}/@PACKAGE@" +fi + +self=`basename $0` + +export TEXTDOMAIN=@PACKAGE@ +export TEXTDOMAINDIR="@localedir@" + +. "${pkgdatadir}/grub-mkconfig_lib" + +modules= + pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst \ handler.lst video.lst crypto.lst terminal.lst" +grub_mkimage="${bindir}/@grub_mkimage@" + grub_compress_file () { if [ "$compressor" != "" ] ; then "$compressor" $compressor_opts "$1" > "$2" @@ -121,6 +146,7 @@ grub_install_files () { } grub_print_install_files_help () { + print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" print_option_help "--install-modules=$(gettext "MODULES")" "$(gettext "install only MODULES and their dependencies [default=all]")" print_option_help "--themes=THEMES" "$(gettext_printf "install THEMES [default=%s]" "starfield")" print_option_help "--fonts=FONTS" "$(gettext_printf "install FONTS [default=%s]" "unicode")" @@ -129,6 +155,8 @@ grub_print_install_files_help () { # TRANSLATORS: platform here isn't identifier. It can be translated. dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/]" "${libdir}/@PACKAGE@")" print_option_help "-d, --directory=$(gettext "DIR")" "$dir_msg" + print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" + print_option_help "-v, --version" "$(gettext "print the version information and exit")" } install_modules=all @@ -212,6 +240,18 @@ grub_process_install_options () { source_directory=`argument $option "$@"`; grub_process_install_options_consumed=2 ;; --override-directory=*) source_directory=`echo "$option" | sed 's/--override-directory=//'` grub_process_install_options_consumed=1;; + + --grub-mkimage) + grub_mkimage=`argument $option "$@"`; grub_process_install_options_consumed=2 ;; + --grub-mkimage=*) + grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'`;grub_process_install_options_consumed=1 ;; + --modules) + modules=`argument $option "$@"`; grub_process_install_options_consumed=2;; + --modules=*) + modules=`echo "$option" | sed 's/--modules=//'` grub_process_install_options_consumed=1;; + -v | --version) + echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" + exit 0 ;; esac } diff --git a/util/grub-mknetdir.in b/util/grub-mknetdir.in index 051b98556..97d4155e3 100644 --- a/util/grub-mknetdir.in +++ b/util/grub-mknetdir.in @@ -15,23 +15,8 @@ # along with GRUB. If not, see . # Initialize some variables. -prefix="@prefix@" -exec_prefix="@exec_prefix@" -datarootdir="@datarootdir@" -bindir="@bindir@" -libdir="@libdir@" -PACKAGE_NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ -PACKAGE_VERSION=@PACKAGE_VERSION@ host_os=@host_os@ -datadir="@datadir@" -if [ "x$pkgdatadir" = x ]; then - pkgdatadir="${datadir}/@PACKAGE@" -fi -self=`basename $0` - -grub_mkimage="${bindir}/@grub_mkimage@" rootdir=/srv/tftp modules= @@ -48,11 +33,6 @@ efi32_dir="${libdir}/@PACKAGE@/i386-efi" efi64_dir="${libdir}/@PACKAGE@/x86_64-efi" itanium_dir="${libdir}/@PACKAGE@/ia64-efi" -export TEXTDOMAIN=@PACKAGE@ -export TEXTDOMAINDIR="@localedir@" - -. "${pkgdatadir}/grub-mkconfig_lib" - # Usage: usage # Print the usage. usage () { @@ -60,12 +40,9 @@ usage () { gettext; echo "Install GRUB on your drive."; echo echo print_option_help "-h, --help" "$(gettext "print this message and exit")" - print_option_help "-v, --version" "$(gettext "print the version information and exit")" - print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" grub_print_install_files_help print_option_help "--net-directory=$(gettext "DIR")" "$(gettext "root directory of TFTP server")" print_option_help "--subdir=$(gettext "DIR")" "$(gettext "relative subdirectory on network server")" - print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" echo gettext_printf "%s copies GRUB images into net_directory/subdir/target_cpu-platform\n" "$self" echo @@ -88,14 +65,6 @@ do -h | --help) usage exit 0 ;; - -v | --version) - echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" - exit 0 ;; - - --modules) - modules=`argument $option "$@"`; shift;; - --modules=*) - modules=`echo "$option" | sed 's/--modules=//'` ;; --net-directory) rootdir=`argument $option "$@"`; shift;; @@ -107,11 +76,6 @@ do --subdir=*) subdir=`echo "$option" | sed 's/--subdir=//'` ;; - --grub-mkimage) - grub_mkimage=`argument $option "$@"`; shift;; - --grub-mkimage=*) - grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; - # This is an undocumented feature... --debug) debug=yes ;; diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index a8d492e82..b942c8f7d 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -18,22 +18,6 @@ # Initialize some variables. -prefix="@prefix@" -exec_prefix="@exec_prefix@" -datarootdir="@datarootdir@" -bindir="@bindir@" -libdir="@libdir@" -PACKAGE_NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ -PACKAGE_VERSION=@PACKAGE_VERSION@ -datadir="@datadir@" -if [ "x$pkgdatadir" = x ]; then - pkgdatadir="${datadir}/@PACKAGE@" -fi -pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst" - -self=`basename $0` - multiboot_dir="${libdir}/@PACKAGE@/i386-multiboot" coreboot_dir="${libdir}/@PACKAGE@/i386-coreboot" qemu_dir="${libdir}/@PACKAGE@/i386-qemu" @@ -50,7 +34,6 @@ arcs_dir="${libdir}/@PACKAGE@/mips-arc" arc_dir="${libdir}/@PACKAGE@/mipsel-arc" ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" rom_directory= -grub_mkimage="${bindir}/@grub_mkimage@" grub_render_label="${bindir}/@grub_render_label@" grub_glue_efi="${bindir}/@grub_glue_efi@" label_font="${pkgdatadir}/unicode.pf2" @@ -61,13 +44,8 @@ product_version="${PACKAGE_VERSION}" xorriso=xorriso -export TEXTDOMAIN=@PACKAGE@ -export TEXTDOMAINDIR="@localedir@" - localedir="@datadir@/locale" -. "${pkgdatadir}/grub-mkconfig_lib" - # Usage: usage # Print the usage. usage () { @@ -77,15 +55,11 @@ usage () { echo filetrans="$(gettext FILE)" print_option_help "-h, --help" "$(gettext "print this message and exit")" - print_option_help "-v, --version" "$(gettext "print the version information and exit")" print_option_help "-o, --output=$filetrans" "$(gettext "save output in FILE [required]")" - print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" grub_print_install_files_help - print_option_help "--install-modules=$(gettext "MODULES")" "$(gettext "install only MODULES and their dependencies on bootable media")" print_option_help "--rom-directory=$(gettext "DIR")" "$(gettext "save ROM images in DIR [optional]")" # TRANSLATORS: xorriso is a program for creating ISOs and burning CDs print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")" - print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")" print_option_help "--grub-glue-efi=$filetrans" "$(gettext "use FILE as grub-glue-efi")" print_option_help "--grub-render-label=$filetrans" "$(gettext "use FILE as grub-render-label")" print_option_help "--label-font=$filetrans" "$(gettext "use FILE as font for label")" @@ -123,14 +97,6 @@ do -h | --help) usage exit 0 ;; - -v | --version) - echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" - exit 0 ;; - - --modules) - modules=`argument $option "$@"`; shift ;; - --modules=*) - modules=`echo "$option" | sed 's/--modules=//'` ;; -o | --output) output_image=`argument $option "$@"`; shift ;; @@ -164,11 +130,6 @@ do --product-version=*) product_version=`echo "$option" | sed 's/--product-version=//'` ;; - --grub-mkimage) - grub_mkimage=`argument $option "$@"`; shift ;; - --grub-mkimage=*) - grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; - --grub-glue-efi) grub_glue_efi=`argument $option "$@"`; shift ;; --grub-glue-efi=*) diff --git a/util/grub-mkstandalone.in b/util/grub-mkstandalone.in index 30dd90fe0..b692c481c 100644 --- a/util/grub-mkstandalone.in +++ b/util/grub-mkstandalone.in @@ -18,31 +18,10 @@ # Initialize some variables. -prefix="@prefix@" -exec_prefix="@exec_prefix@" -datarootdir="@datarootdir@" -bindir="@bindir@" -libdir="@libdir@" -PACKAGE_NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ -PACKAGE_VERSION=@PACKAGE_VERSION@ -datadir="@datadir@" -if [ "x$pkgdatadir" = x ]; then - pkgdatadir="${datadir}/@PACKAGE@" -fi - -self=`basename $0` - compression=auto format= -grub_mkimage="${bindir}/@grub_mkimage@" source= -export TEXTDOMAIN=@PACKAGE@ -export TEXTDOMAINDIR="@localedir@" - -. "${pkgdatadir}/grub-mkconfig_lib" - # Usage: usage # Print the usage. usage () { @@ -51,15 +30,12 @@ usage () { gettext "Generate a standalone image (containing all modules) in the selected format" echo print_option_help "-h, --help" "$(gettext "print this message and exit")" - print_option_help "-v, --version" "$(gettext "print the version information and exit")" print_option_help "-o, --output=$(gettext FILE)" "$(gettext "save output in FILE [required]")" print_option_help "-O, --format=$(gettext "FORMAT")" "$(gettext "generate an image in FORMAT")"; echo print_option_help "" "$(gettext "available formats:") $formats" echo print_option_help "-C, --compression=(xz|none|auto)" "$(gettext "choose the compression to use for core image")" - print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" grub_print_install_files_help - print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" echo gettext "Report bugs to ."; echo } @@ -80,25 +56,12 @@ do -h | --help) usage exit 0 ;; - -v | --version) - echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" - exit 0 ;; - - --modules) - modules=`argument $option "$@"`; shift ;; - --modules=*) - modules=`echo "$option" | sed 's/--modules=//'` ;; -o | --output) output_image=`argument $option "$@"`; shift ;; --output=*) output_image=`echo "$option" | sed 's/--output=//'` ;; - --grub-mkimage) - grub_mkimage=`argument $option "$@"`; shift ;; - --grub-mkimage=*) - grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; - --compression | -C) compression=`argument $option "$@"`; shift ;; --compression=*) From dc5a311a1edc6ab3771a507a5825e0a71683b050 Mon Sep 17 00:00:00 2001 From: Vladimir Testov Date: Mon, 29 Apr 2013 13:40:11 +0200 Subject: [PATCH 122/187] * grub-core/gfxmenu/gui_list.c: Refresh first_shown_entry value when cached view is reused. * grub-core/gfxmenu/view.c: Call the refresh procedure for all open boot menus. --- ChangeLog | 7 +++++++ grub-core/gfxmenu/gui_list.c | 13 ++++++++++++- grub-core/gfxmenu/view.c | 22 ++++++++++++++++++++++ include/grub/gui.h | 2 ++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eff0b6b0f..86effa0fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-04-29 Vladimir Testov + + * grub-core/gfxmenu/gui_list.c: Refresh first_shown_entry value when + cached view is reused. + * grub-core/gfxmenu/view.c: Call the refresh procedure for all + open boot menus. + 2013-04-29 Vladimir Serbinenko Unify more code in grub-install_header. diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c index 1982d9a40..a06603b0b 100644 --- a/grub-core/gfxmenu/gui_list.c +++ b/grub-core/gfxmenu/gui_list.c @@ -541,6 +541,16 @@ list_set_view_info (void *vself, self->view = view; } +/* Refresh list variables */ +static void +list_refresh_info (void *vself, + grub_gfxmenu_view_t view) +{ + list_impl_t self = vself; + if (view->nested) + self->first_shown_index = 0; +} + static struct grub_gui_component_ops list_comp_ops = { .destroy = list_destroy, @@ -557,7 +567,8 @@ static struct grub_gui_component_ops list_comp_ops = static struct grub_gui_list_ops list_ops = { - .set_view_info = list_set_view_info + .set_view_info = list_set_view_info, + .refresh_list = list_refresh_info }; grub_gui_component_t diff --git a/grub-core/gfxmenu/view.c b/grub-core/gfxmenu/view.c index 6de96ca00..475fc76c5 100644 --- a/grub-core/gfxmenu/view.c +++ b/grub-core/gfxmenu/view.c @@ -236,6 +236,27 @@ update_menu_components (grub_gfxmenu_view_t view) update_menu_visit, view); } +static void +refresh_menu_visit (grub_gui_component_t component, + void *userdata) +{ + grub_gfxmenu_view_t view; + view = userdata; + if (component->ops->is_instance (component, "list")) + { + grub_gui_list_t list = (grub_gui_list_t) component; + list->ops->refresh_list (list, view); + } +} + +/* Refresh list information (useful for submenus) */ +static void +refresh_menu_components (grub_gfxmenu_view_t view) +{ + grub_gui_iterate_recursively ((grub_gui_component_t) view->canvas, + refresh_menu_visit, view); +} + static void draw_message (grub_gfxmenu_view_t view) { @@ -294,6 +315,7 @@ grub_gfxmenu_view_draw (grub_gfxmenu_view_t view) view->screen.x, view->screen.y, view->screen.width, view->screen.height); + refresh_menu_components (view); update_menu_components (view); grub_gfxmenu_view_redraw (view, &view->screen); diff --git a/include/grub/gui.h b/include/grub/gui.h index ef0795cf7..4b8ec8965 100644 --- a/include/grub/gui.h +++ b/include/grub/gui.h @@ -67,6 +67,8 @@ struct grub_gui_list_ops { void (*set_view_info) (void *self, grub_gfxmenu_view_t view); + void (*refresh_list) (void *self, + grub_gfxmenu_view_t view); }; struct grub_gui_progress_ops From 96f33fed86799d6d6315d10e32f32904dae986fc Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 15:09:39 +0200 Subject: [PATCH 123/187] Make PCI init in i386-qemu port more robust. --- ChangeLog | 6 +- grub-core/Makefile.core.def | 4 +- grub-core/bus/usb/uhci.c | 10 +- grub-core/disk/ahci.c | 3 - grub-core/kern/i386/coreboot/init.c | 22 +-- grub-core/kern/i386/qemu/init.c | 284 ++++++++++++++++++++++++++++ grub-core/kern/mips/loongson/init.c | 3 +- grub-core/kern/vga_init.c | 35 ---- include/grub/pci.h | 1 + 9 files changed, 299 insertions(+), 69 deletions(-) create mode 100644 grub-core/kern/i386/qemu/init.c diff --git a/ChangeLog b/ChangeLog index 86effa0fb..ece85869b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2013-04-29 Vladimir Testov +2013-04-29 Vladimir Serbinenko + + Make PCI init in i386-qemu port more robust. + +2013-04-29 Vladimir Testov * grub-core/gfxmenu/gui_list.c: Refresh first_shown_entry value when cached view is reused. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index ebcd01deb..7e19acb66 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -134,7 +134,9 @@ kernel = { i386 = kern/i386/dl.c; - i386_coreboot_multiboot_qemu = kern/i386/coreboot/init.c; + i386_coreboot = kern/i386/coreboot/init.c; + i386_multiboot = kern/i386/coreboot/init.c; + i386_qemu = kern/i386/qemu/init.c; i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c; efi = disk/efi/efidisk.c; diff --git a/grub-core/bus/usb/uhci.c b/grub-core/bus/usb/uhci.c index c2e2e7efe..0fca1a154 100644 --- a/grub-core/bus/usb/uhci.c +++ b/grub-core/bus/usb/uhci.c @@ -236,15 +236,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev, return 0; if ((base & GRUB_UHCI_IOMASK) == 0) - { -#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_QEMU) - static int ndevs = 0; - base = 0x1800 + ndevs++ * 0x100; - grub_pci_write (addr, base | GRUB_PCI_ADDR_SPACE_IO); -#else - return 0; -#endif - } + return 0; grub_dprintf ("uhci", "base = %x\n", base); diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c index 554fcc55f..58bc190f2 100644 --- a/grub-core/disk/ahci.c +++ b/grub-core/disk/ahci.c @@ -185,9 +185,6 @@ grub_ahci_pciinit (grub_pci_device_t dev, addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG5); -#ifdef GRUB_MACHINE_QEMU - grub_pci_write (addr, 0xf4000000); -#endif bar = grub_pci_read (addr); if ((bar & (GRUB_PCI_ADDR_SPACE_MASK | GRUB_PCI_ADDR_MEM_TYPE_MASK diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c index bfc8f3f12..7cd530db8 100644 --- a/grub-core/kern/i386/coreboot/init.c +++ b/grub-core/kern/i386/coreboot/init.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2013 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,9 +34,6 @@ #include #include #include -#ifdef GRUB_MACHINE_QEMU -#include -#endif extern grub_uint8_t _start[]; extern grub_uint8_t _end[]; @@ -51,12 +48,8 @@ grub_exit (void) grub_cpu_idle (); } -#ifdef GRUB_MACHINE_QEMU -grub_addr_t grub_modbase; -#else grub_addr_t grub_modbase = GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR; static grub_uint64_t modend; -#endif /* Helper for grub_machine_init. */ static int @@ -80,10 +73,8 @@ heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, if (begin < GRUB_MEMORY_MACHINE_LOWER_SIZE) begin = GRUB_MEMORY_MACHINE_LOWER_SIZE; -#ifndef GRUB_MACHINE_QEMU if (modend && begin < modend) begin = modend; -#endif if (end <= begin) return 0; @@ -96,18 +87,11 @@ heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, void grub_machine_init (void) { -#ifdef GRUB_MACHINE_QEMU - grub_modbase = grub_core_entry_addr + (_edata - _start); - - grub_qemu_init_cirrus (); -#endif -#ifndef GRUB_MACHINE_QEMU modend = grub_modules_get_end (); -#endif - /* Initialize the console as early as possible. */ + grub_vga_text_init (); -#if defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU) +#ifdef GRUB_MACHINE_MULTIBOOT grub_machine_mmap_init (); #endif grub_machine_mmap_iterate (heap_init, NULL); diff --git a/grub-core/kern/i386/qemu/init.c b/grub-core/kern/i386/qemu/init.c new file mode 100644 index 000000000..cad6c40a2 --- /dev/null +++ b/grub-core/kern/i386/qemu/init.c @@ -0,0 +1,284 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern grub_uint8_t _start[]; +extern grub_uint8_t _end[]; +extern grub_uint8_t _edata[]; + +void __attribute__ ((noreturn)) +grub_exit (void) +{ + /* We can't use grub_fatal() in this function. This would create an infinite + loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ + while (1) + grub_cpu_idle (); +} + +grub_addr_t grub_modbase; + +/* Helper for grub_machine_init. */ +static int +heap_init (grub_uint64_t addr, grub_uint64_t size, grub_memory_type_t type, + void *data __attribute__ ((unused))) +{ + grub_uint64_t begin = addr, end = addr + size; + +#if GRUB_CPU_SIZEOF_VOID_P == 4 + /* Restrict ourselves to 32-bit memory space. */ + if (begin > GRUB_ULONG_MAX) + return 0; + if (end > GRUB_ULONG_MAX) + end = GRUB_ULONG_MAX; +#endif + + if (type != GRUB_MEMORY_AVAILABLE) + return 0; + + /* Avoid the lower memory. */ + if (begin < GRUB_MEMORY_MACHINE_LOWER_SIZE) + begin = GRUB_MEMORY_MACHINE_LOWER_SIZE; + + if (end <= begin) + return 0; + + grub_mm_init_region ((void *) (grub_addr_t) begin, (grub_size_t) (end - begin)); + + return 0; +} + +struct resource +{ + grub_pci_device_t dev; + int type; + grub_size_t size; + int bar; +}; + +struct iterator_ctx +{ + struct resource *resources; + grub_size_t nresources; +}; + +static int +count_cards (grub_pci_device_t dev __attribute__ ((unused)), + grub_pci_id_t pciid __attribute__ ((unused)), + void *data) +{ + int *cnt = data; + + (*cnt)++; + + return 0; +} + +static int +find_resources (grub_pci_device_t dev, + grub_pci_id_t pciid __attribute__ ((unused)), + void *data) +{ + struct iterator_ctx *ctx = data; + int bar; + + for (bar = 0; bar < 6; bar++) + { + grub_pci_address_t addr; + grub_uint32_t ones, zeros, mask; + struct resource *res; + addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0 + + 4 * bar); + grub_pci_write (addr, 0xffffffff); + grub_pci_read (addr); + ones = grub_pci_read (addr); + grub_pci_write (addr, 0); + grub_pci_read (addr); + zeros = grub_pci_read (addr); + if (ones == zeros) + continue; + res = &ctx->resources[ctx->nresources++]; + if ((zeros & GRUB_PCI_ADDR_SPACE_MASK) == GRUB_PCI_ADDR_SPACE_IO) + mask = GRUB_PCI_ADDR_SPACE_MASK; + else + mask = (GRUB_PCI_ADDR_MEM_TYPE_MASK | GRUB_PCI_ADDR_SPACE_MASK | GRUB_PCI_ADDR_MEM_PREFETCH); + + res->type = ones & mask; + res->dev = dev; + res->bar = bar; + res->size = (~((zeros ^ ones)) | mask) + 1; + if ((zeros & (GRUB_PCI_ADDR_MEM_TYPE_MASK | GRUB_PCI_ADDR_SPACE_MASK)) + == (GRUB_PCI_ADDR_SPACE_MEMORY | GRUB_PCI_ADDR_MEM_TYPE_64)) + bar++; + } + return 0; +} + +static int +enable_cards (grub_pci_device_t dev, + grub_pci_id_t pciid __attribute__ ((unused)), + void *data __attribute__ ((unused))) +{ + grub_uint16_t cmd = 0; + grub_pci_address_t addr; + grub_uint32_t class; + int bar; + + for (bar = 0; bar < 6; bar++) + { + grub_uint32_t val; + addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0 + + 4 * bar); + val = grub_pci_read (addr); + if (!val) + continue; + if ((val & GRUB_PCI_ADDR_SPACE_MASK) == GRUB_PCI_ADDR_SPACE_IO) + cmd |= GRUB_PCI_COMMAND_IO_ENABLED; + else + cmd |= GRUB_PCI_COMMAND_MEM_ENABLED; + } + + class = (grub_pci_read (addr) >> 16) & 0xffff; + + if (class == GRUB_PCI_CLASS_SUBCLASS_VGA) + cmd |= GRUB_PCI_COMMAND_IO_ENABLED + | GRUB_PCI_COMMAND_MEM_ENABLED; + + if (class == GRUB_PCI_CLASS_SUBCLASS_USB) + return 0; + + addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); + grub_pci_write (addr, cmd); + + return 0; +} + +static void +grub_pci_assign_addresses (void) +{ + int ncards = 0; + struct iterator_ctx ctx; + + grub_pci_iterate (count_cards, &ncards); + + { + struct resource resources[ncards * 6]; + int done; + unsigned i; + ctx.nresources = 0; + ctx.resources = resources; + grub_uint32_t memptr = 0xf0000000; + grub_uint16_t ioptr = 0x1000; + + grub_pci_iterate (find_resources, &ctx); + /* FIXME: do we need a better sort here? */ + do + { + done = 0; + for (i = 0; i + 1 < ctx.nresources; i++) + if (resources[i].size < resources[i+1].size) + { + struct resource t; + t = resources[i]; + resources[i] = resources[i+1]; + resources[i+1] = t; + done = 1; + } + } + while (done); + + for (i = 0; i < ctx.nresources; i++) + { + grub_pci_address_t addr; + addr = grub_pci_make_address (resources[i].dev, + GRUB_PCI_REG_ADDRESS_REG0 + + 4 * resources[i].bar); + if ((resources[i].type & GRUB_PCI_ADDR_SPACE_MASK) + == GRUB_PCI_ADDR_SPACE_IO) + { + grub_pci_write (addr, ioptr | resources[i].type); + ioptr += resources[i].size; + } + else + { + grub_pci_write (addr, memptr | resources[i].type); + memptr += resources[i].size; + if ((resources[i].type & (GRUB_PCI_ADDR_MEM_TYPE_MASK + | GRUB_PCI_ADDR_SPACE_MASK)) + == (GRUB_PCI_ADDR_SPACE_MEMORY | GRUB_PCI_ADDR_MEM_TYPE_64)) + { + addr = grub_pci_make_address (resources[i].dev, + GRUB_PCI_REG_ADDRESS_REG0 + + 4 * resources[i].bar + 4); + grub_pci_write (addr, 0); + } + } + } + grub_pci_iterate (enable_cards, NULL); + } +} + +void +grub_machine_init (void) +{ + grub_modbase = grub_core_entry_addr + (_edata - _start); + + grub_pci_assign_addresses (); + + grub_qemu_init_cirrus (); + + grub_vga_text_init (); + + grub_machine_mmap_init (); + grub_machine_mmap_iterate (heap_init, NULL); + + + grub_tsc_init (); +} + +void +grub_machine_get_bootlocation (char **device __attribute__ ((unused)), + char **path __attribute__ ((unused))) +{ +} + +void +grub_machine_fini (void) +{ + grub_vga_text_fini (); + grub_stop_floppy (); +} diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c index 1abcf1ab4..52cbfd407 100644 --- a/grub-core/kern/mips/loongson/init.c +++ b/grub-core/kern/mips/loongson/init.c @@ -55,7 +55,8 @@ set_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data __attribute__ ((unused))) { grub_pci_address_t addr; - /* FIXME: autoscan for BARs and devices. */ + /* We could use grub_pci_assign_addresses for this but we prefer to + have exactly same memory map as on pmon. */ switch (pciid) { case GRUB_LOONGSON_OHCI_PCIID: diff --git a/grub-core/kern/vga_init.c b/grub-core/kern/vga_init.c index 1119bb33d..301721d37 100644 --- a/grub-core/kern/vga_init.c +++ b/grub-core/kern/vga_init.c @@ -88,44 +88,9 @@ load_palette (void) grub_vga_palette_write (i, colors[i].r, colors[i].g, colors[i].b); } -#ifndef __mips__ -/* Helper for grub_qemu_init_cirrus. */ -static int -find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)), - void *data __attribute__ ((unused))) -{ - grub_pci_address_t addr; - grub_uint32_t class; - - addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); - class = grub_pci_read (addr); - - if (((class >> 16) & 0xffff) != GRUB_PCI_CLASS_SUBCLASS_VGA) - return 0; - - /* FIXME: chooose addresses dynamically. */ - addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0); - grub_pci_write (addr, 0xf0000000 | GRUB_PCI_ADDR_MEM_PREFETCH - | GRUB_PCI_ADDR_SPACE_MEMORY | GRUB_PCI_ADDR_MEM_TYPE_32); - addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG1); - grub_pci_write (addr, 0xf2000000 - | GRUB_PCI_ADDR_SPACE_MEMORY | GRUB_PCI_ADDR_MEM_TYPE_32); - - addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); - grub_pci_write (addr, GRUB_PCI_COMMAND_MEM_ENABLED - | GRUB_PCI_COMMAND_IO_ENABLED); - - return 1; -} -#endif - void grub_qemu_init_cirrus (void) { -#ifndef __mips__ - grub_pci_iterate (find_card, NULL); -#endif - grub_outb (GRUB_VGA_IO_MISC_COLOR, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_MISC_WRITE); diff --git a/include/grub/pci.h b/include/grub/pci.h index e163d47cb..70d9a0513 100644 --- a/include/grub/pci.h +++ b/include/grub/pci.h @@ -81,6 +81,7 @@ #define GRUB_PCI_STATUS_DEVSEL_TIMING_SHIFT 9 #define GRUB_PCI_STATUS_DEVSEL_TIMING_MASK 0x0600 #define GRUB_PCI_CLASS_SUBCLASS_VGA 0x0300 +#define GRUB_PCI_CLASS_SUBCLASS_USB 0x0c03 #ifndef ASM_FILE From 3476e0ef42848e728dfe688b48d488cc7c690a6f Mon Sep 17 00:00:00 2001 From: Vladimir Testov Date: Mon, 29 Apr 2013 15:32:56 +0200 Subject: [PATCH 124/187] =?UTF-8?q?=09*=20grub-core/gfxmenu/circular=5Fpro?= =?UTF-8?q?gress.c:=20Set=20start=5Fangle=20in=20degrees=20=09with=20synta?= =?UTF-8?q?x=20"XXX=20deg"/"XXX=20=C2=B0".?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 5 +++++ grub-core/gfxmenu/gui_circular_progress.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ece85869b..0e6d38a68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-29 Vladimir Testov + + * grub-core/gfxmenu/circular_progress.c: Set start_angle in degrees + with syntax "XXX deg"/"XXX °". + 2013-04-29 Vladimir Serbinenko Make PCI init in i386-qemu port more robust. diff --git a/grub-core/gfxmenu/gui_circular_progress.c b/grub-core/gfxmenu/gui_circular_progress.c index e06d40cdb..284a75a5e 100644 --- a/grub-core/gfxmenu/gui_circular_progress.c +++ b/grub-core/gfxmenu/gui_circular_progress.c @@ -223,6 +223,25 @@ circprog_set_state (void *vself, int visible, int start, self->end = end; } +static int +parse_angle (const char *value) +{ + char *ptr; + int angle; + + angle = grub_strtol (value, &ptr, 10); + if (grub_errno) + return 0; + while (grub_isspace (*ptr)) + ptr++; + if (grub_strcmp (ptr, "deg") == 0 + /* Unicode symbol of degrees (a circle, U+b0). Put here in UTF-8 to + avoid potential problem with text file reesncoding */ + || grub_strcmp (ptr, "\xc2\xb0") == 0) + angle = (angle * 64 + 45) / 90; + return angle; +} + static grub_err_t circprog_set_property (void *vself, const char *name, const char *value) { @@ -233,7 +252,7 @@ circprog_set_property (void *vself, const char *name, const char *value) } else if (grub_strcmp (name, "start_angle") == 0) { - self->start_angle = grub_strtol (value, 0, 10); + self->start_angle = parse_angle (value); } else if (grub_strcmp (name, "ticks_disappear") == 0) { From 46546fc577e4074e70229030cb7f394b9047b41a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 29 Apr 2013 19:14:46 +0200 Subject: [PATCH 125/187] * configure.ac: Use -mcmodel=large on x86_64-emu as well. Reported by: qwertial. --- ChangeLog | 5 +++++ configure.ac | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0e6d38a68..0485a01f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-29 Vladimir Serbinenko + + * configure.ac: Use -mcmodel=large on x86_64-emu as well. + Reported by: qwertial. + 2013-04-29 Vladimir Testov * grub-core/gfxmenu/circular_progress.c: Set start_angle in degrees diff --git a/configure.ac b/configure.ac index 5ff7f25ac..00540e6be 100644 --- a/configure.ac +++ b/configure.ac @@ -605,7 +605,7 @@ if test "x$target_m64" = x1; then TARGET_MODULE_FORMAT="elf64" fi -if test "$target_cpu"-"$platform" = x86_64-efi; then +if test "$target_cpu" = x86_64; then # Use large model to support 4G memory AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ SAVED_CFLAGS=$CFLAGS @@ -619,7 +619,9 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then else TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" fi +fi +if test "$target_cpu"-"$platform" = x86_64-efi; then # EFI writes to stack below %rsp, we must not use the red zone AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ CFLAGS="$CFLAGS -m64 -mno-red-zone" From 95ef1a54cf42458bbf51b65aac40c5253167fe74 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 30 Apr 2013 17:34:29 +0200 Subject: [PATCH 126/187] * grub-core/partmap/amiga.c: Fix size of checksummed block. --- ChangeLog | 4 ++++ grub-core/partmap/amiga.c | 25 +++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0485a01f1..b0ae4eebf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-30 Vladimir Serbinenko + + * grub-core/partmap/amiga.c: Fix size of checksummed block. + 2013-04-29 Vladimir Serbinenko * configure.ac: Use -mcmodel=large on x86_64-emu as well. diff --git a/grub-core/partmap/amiga.c b/grub-core/partmap/amiga.c index 213d7074e..97f71600f 100644 --- a/grub-core/partmap/amiga.c +++ b/grub-core/partmap/amiga.c @@ -25,6 +25,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); +#define AMIGA_CHECKSUM_WORDS 128 + struct grub_amiga_rdsk { /* "RDSK". */ @@ -39,7 +41,7 @@ struct grub_amiga_rdsk grub_uint32_t partitionlst; grub_uint32_t fslst; - grub_uint32_t unused[128 - 9]; + grub_uint32_t unused[AMIGA_CHECKSUM_WORDS - 9]; } __attribute__ ((packed)); struct grub_amiga_partition @@ -47,7 +49,7 @@ struct grub_amiga_partition /* "PART". */ grub_uint8_t magic[4]; #define GRUB_AMIGA_PART_MAGIC "PART" - grub_int32_t size; + grub_uint32_t size; grub_int32_t checksum; grub_uint32_t scsihost; grub_uint32_t next; @@ -67,7 +69,7 @@ struct grub_amiga_partition grub_uint32_t highcyl; grub_uint32_t firstcyl; - grub_uint32_t unused[128 - 44]; + grub_uint32_t unused[AMIGA_CHECKSUM_WORDS - 44]; } __attribute__ ((packed)); static struct grub_partition_map grub_amiga_partition_map; @@ -75,13 +77,20 @@ static struct grub_partition_map grub_amiga_partition_map; static grub_uint32_t -amiga_partition_map_checksum (void *buf, grub_size_t sz) +amiga_partition_map_checksum (void *buf) { grub_uint32_t *ptr = buf; grub_uint32_t r = 0; - sz /= sizeof (grub_uint32_t); + grub_size_t sz; + /* Fancy and quick way of checking sz >= 512 / 4 = 128. */ + if (ptr[1] & ~grub_cpu_to_be32_compile_time (AMIGA_CHECKSUM_WORDS - 1)) + sz = AMIGA_CHECKSUM_WORDS; + else + sz = grub_be_to_cpu32 (ptr[1]); + for (; sz; sz--, ptr++) r += grub_be_to_cpu32 (*ptr); + return r; } @@ -105,7 +114,7 @@ amiga_partition_map_iterate (grub_disk_t disk, if (grub_memcmp (rdsk.magic, GRUB_AMIGA_RDSK_MAGIC, sizeof (rdsk.magic)) == 0 - && amiga_partition_map_checksum (&rdsk, sizeof (rdsk)) == 0) + && amiga_partition_map_checksum (&rdsk) == 0) { /* Found the first PART block. */ next = grub_be_to_cpu32 (rdsk.partitionlst); @@ -128,7 +137,7 @@ amiga_partition_map_iterate (grub_disk_t disk, if (grub_memcmp (apart.magic, GRUB_AMIGA_PART_MAGIC, sizeof (apart.magic)) != 0 - || amiga_partition_map_checksum (&apart, sizeof (apart)) != 0) + || amiga_partition_map_checksum (&apart) != 0) return grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid Amiga partition map"); /* Calculate the first block and the size of the partition. */ @@ -140,7 +149,7 @@ amiga_partition_map_iterate (grub_disk_t disk, * grub_be_to_cpu32 (apart.heads) * grub_be_to_cpu32 (apart.block_per_track)); - part.offset = (grub_off_t) next * 512; + part.offset = next; part.number = partno; part.index = 0; part.partmap = &grub_amiga_partition_map; From aa7bcb99dfff87f606da2454308d4f3eda28fc85 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 30 Apr 2013 17:37:37 +0200 Subject: [PATCH 127/187] * grub-core/kern/mips/loongson/init.c: Support halt for loongson 2E. --- ChangeLog | 4 ++++ grub-core/kern/mips/loongson/init.c | 33 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/ChangeLog b/ChangeLog index b0ae4eebf..6b5feff55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-30 Vladimir Serbinenko + + * grub-core/kern/mips/loongson/init.c: Support halt for loongson 2E. + 2013-04-30 Vladimir Serbinenko * grub-core/partmap/amiga.c: Fix size of checksummed block. diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c index 52cbfd407..3ed1ded61 100644 --- a/grub-core/kern/mips/loongson/init.c +++ b/grub-core/kern/mips/loongson/init.c @@ -221,12 +221,45 @@ grub_machine_fini (void) { } +static int +halt_via (grub_pci_device_t dev, grub_pci_id_t pciid, + void *data __attribute__ ((unused))) +{ + grub_uint16_t pm; + grub_pci_address_t addr; + + if (pciid != 0x30571106) + return 0; + + addr = grub_pci_make_address (dev, 0x40); + pm = grub_pci_read (addr) & ~1; + + if (pm == 0) + { + grub_pci_write (addr, 0x1801); + pm = 0x1800; + } + + addr = grub_pci_make_address (dev, 0x80); + grub_pci_write_byte (addr, 0xff); + + addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); + grub_pci_write_word (addr, grub_pci_read_word (addr) | GRUB_PCI_COMMAND_IO_ENABLED); + + /* FIXME: This one is derived from qemu. Check on real hardware. */ + grub_outw (0x2000, pm + 4 + GRUB_MACHINE_PCI_IO_BASE); + grub_millisleep (5000); + + return 0; +} + void grub_halt (void) { switch (grub_arch_machine) { case GRUB_ARCH_MACHINE_FULOONG2E: + grub_pci_iterate (halt_via, NULL); break; case GRUB_ARCH_MACHINE_FULOONG2F: { From 583e5b645c87129bcb05997eae09b3287913f329 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 30 Apr 2013 17:40:31 +0200 Subject: [PATCH 128/187] * include/grub/arc/arc.h: Account for missing "other" peripheral on ARCS. All users updated. --- ChangeLog | 5 +++++ grub-core/kern/mips/arc/init.c | 6 +++++- grub-core/term/arc/console.c | 10 +++++----- include/grub/arc/arc.h | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b5feff55..b92445792 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-30 Vladimir Serbinenko + + * include/grub/arc/arc.h: Account for missing "other" peripheral on + ARCS. All users updated. + 2013-04-30 Vladimir Serbinenko * grub-core/kern/mips/loongson/init.c: Support halt for loongson 2E. diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c index fdcc2bd22..ddee814c5 100644 --- a/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c @@ -45,7 +45,11 @@ const char *type_names[] = { "eisa", "tc", "scsi", "dti", "multi", "disk", "tape", "cdrom", "worm", "serial", "net", "video", "par", "point", "key", "audio", "other", "rdisk", "fdisk", "tape", "modem", "monitor", "print", "pointer", - "keyboard", "term", "other", "line", "network", NULL + "keyboard", "term", +#ifndef GRUB_CPU_WORDS_BIGENDIAN + "other", +#endif + "line", "network", NULL }; static int diff --git a/grub-core/term/arc/console.c b/grub-core/term/arc/console.c index ea4737cb4..df099f05a 100644 --- a/grub-core/term/arc/console.c +++ b/grub-core/term/arc/console.c @@ -61,7 +61,7 @@ grub_arc_is_device_serial (const char *name, int alt_names) /* Recognize: serial(N) - serial(N)other(M) + serial(N)line(M) */ for (i = 0; i < 2; i++) { @@ -84,11 +84,11 @@ grub_arc_is_device_serial (const char *name, int alt_names) && grub_memcmp (ptr + 1 - (sizeof ("serial") - 1), "serial", sizeof ("serial") - 1) == 0) return 1; - if (!(ptr + 1 >= name + sizeof ("other") - 1 - && grub_memcmp (ptr + 1 - (sizeof ("other") - 1), - "other", sizeof ("other") - 1) == 0)) + if (!(ptr + 1 >= name + sizeof ("line") - 1 + && grub_memcmp (ptr + 1 - (sizeof ("line") - 1), + "line", sizeof ("line") - 1) == 0)) return 0; - ptr -= sizeof ("other") - 1; + ptr -= sizeof ("line") - 1; if (alt_names) { if (*ptr != '/') diff --git a/include/grub/arc/arc.h b/include/grub/arc/arc.h index c2578f415..7615a49a9 100644 --- a/include/grub/arc/arc.h +++ b/include/grub/arc/arc.h @@ -139,7 +139,9 @@ enum GRUB_ARC_COMPONENT_TYPE_POINTER, GRUB_ARC_COMPONENT_TYPE_KBD, GRUB_ARC_COMPONENT_TYPE_TERMINAL, +#ifndef GRUB_CPU_WORDS_BIGENDIAN GRUB_ARC_COMPONENT_TYPE_OTHER_PERIPHERAL, +#endif GRUB_ARC_COMPONENT_TYPE_LINE, GRUB_ARC_COMPONENT_TYPE_NET, GRUB_ARC_COMPONENT_TYPE_MEMORY_UNIT, From 3f9634e550265cddfcc27d979f9db3d4c24d01d7 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 30 Apr 2013 17:41:32 +0200 Subject: [PATCH 129/187] Add few more tests. --- ChangeLog | 4 + Makefile.util.def | 12 +++ tests/ahci_test.in | 3 +- tests/cdboot_test.in | 3 +- tests/core_compress_test.in | 2 +- tests/ehci_test.in | 3 +- tests/fddboot_test.in | 5 +- tests/grub_cmd_date.in | 17 +++- tests/grub_cmd_set_date.in | 35 ++++++++ tests/grub_cmd_sleep.in | 20 +++++ tests/hddboot_test.in | 3 +- tests/netboot_test.in | 3 +- tests/ohci_test.in | 3 +- tests/partmap_test.in | 160 +++++++++++++++++++++++++++++++++++- tests/pata_test.in | 3 +- tests/uhci_test.in | 3 +- tests/util/grub-shell.in | 6 +- 17 files changed, 265 insertions(+), 20 deletions(-) create mode 100644 tests/grub_cmd_set_date.in create mode 100644 tests/grub_cmd_sleep.in diff --git a/ChangeLog b/ChangeLog index b92445792..642858ce3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-30 Vladimir Serbinenko + + Add few more tests. + 2013-04-30 Vladimir Serbinenko * include/grub/arc/arc.h: Account for missing "other" peripheral on diff --git a/Makefile.util.def b/Makefile.util.def index 3cfc592dc..fbd37ebb6 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -700,6 +700,18 @@ script = { common = tests/grub_cmd_date.in; }; +script = { + testcase; + name = grub_cmd_set_date; + common = tests/grub_cmd_set_date.in; +}; + +script = { + testcase; + name = grub_cmd_sleep; + common = tests/grub_cmd_sleep.in; +}; + script = { testcase; name = grub_script_expansion; diff --git a/tests/ahci_test.in b/tests/ahci_test.in index fa5314c97..e7d26ac07 100644 --- a/tests/ahci_test.in +++ b/tests/ahci_test.in @@ -20,12 +20,13 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: Don't mess with real devices when OS is active *-emu) exit 0;; # FIXME: qemu gets bonito DMA wrong mipsel-loongson) exit 0;; - # no AHCI on ARC and qemu-mips platforms + # PLATFORM: no AHCI on ARC and qemu-mips platforms mips*-arc | mips*-qemu_mips) exit 0;; # FIXME: No native drivers are available for those diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in index 097964f95..1cc901977 100644 --- a/tests/cdboot_test.in +++ b/tests/cdboot_test.in @@ -20,9 +20,10 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: emu is different *-emu) exit 0;; - # Flash targets + # PLATFORM: Flash targets i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) exit 0;; # FIXME: currently grub-shell uses only -kernel for loongson diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in index bd57f6f56..f97c0240b 100644 --- a/tests/core_compress_test.in +++ b/tests/core_compress_test.in @@ -19,8 +19,8 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" -# FIXME: Only mips currently supports configurable core compression case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # FIXME: Only mips currently supports configurable core compression *-emu | i386-* | x86_64-* | sparc64-* | ia64-*) exit 0 ;; diff --git a/tests/ehci_test.in b/tests/ehci_test.in index d9999f8e6..5cfe726df 100644 --- a/tests/ehci_test.in +++ b/tests/ehci_test.in @@ -20,12 +20,13 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: Don't mess with real devices when OS is active *-emu) exit 0;; # FIXME: qemu gets bonito DMA wrong mipsel-loongson) exit 0;; - # no USB on ARC and qemu-mips platforms + # PLATFORM: no USB on ARC and qemu-mips platforms mips*-arc | mips*-qemu_mips) exit 0;; # FIXME: No native drivers are available for those diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in index 0866fdc8e..a05eb3e75 100644 --- a/tests/fddboot_test.in +++ b/tests/fddboot_test.in @@ -20,9 +20,10 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: emu is different *-emu) exit 0;; - # Flash targets + # PLATFORM: Flash targets i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) exit 0;; # FIXME: currently grub-shell uses only -kernel for loongson @@ -40,7 +41,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in # FIXME: QEMU doesn't emulate SCSI floppies mipsel-arc | mips-arc) exit 0;; - # powerpc doesn't boot from floppy except OldWorld Macs which we don't support anyway + # PLATFORM: powerpc doesn't boot from floppy except OldWorld Macs which we don't support anyway powerpc-ieee1275) exit 0;; esac diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in index 0417c67ef..a459353e8 100644 --- a/tests/grub_cmd_date.in +++ b/tests/grub_cmd_date.in @@ -13,8 +13,17 @@ dt=`echo date | @builddir@/grub-shell` dtg="$(date -u -d "$dt" +%s)" ndt="$(date -u +%s)" -if [ $pdt -le $dtg ] && [ $dtg -le $ndt ]; then - exit 0; +if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then + echo "Date not in range: $pdt <= $dtg <= $ndt" + exit 1 +fi + +pdt="$(date -u +%s)" +dt=`echo 'insmod datehook; echo $YEAR-$MONTH-$DAY $HOUR:$MINUTE:$SECOND' | @builddir@/grub-shell` +dtg="$(date -u -d "$dt" +%s)" +ndt="$(date -u +%s)" + +if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then + echo "Date not in range: $pdt <= $dtg <= $ndt" + exit 1 fi -echo "Date not in range: $pdt <= $dtg <= $ndt" -exit 1 diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in new file mode 100644 index 000000000..c594ae3fc --- /dev/null +++ b/tests/grub_cmd_set_date.in @@ -0,0 +1,35 @@ +#! /bin/bash +set -e + +. "@builddir@/grub-core/modinfo.sh" + +case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # FIXME: OpenBIOS on sparc64 doesn't implement RTC + sparc64-ieee1275) + exit 0;; + # PLATFORM: ARC doesn't provide any way to set time + *-arc) + exit 0;; + # PLATFORM: EMU doesn't provide any way to set time + # Even if it did we'd need some kind of sandbox to avoid + # modifying real system time. + *-emu) + exit 0;; +esac + +out=$(cat < Date: Thu, 2 May 2013 14:34:13 +0200 Subject: [PATCH 130/187] * grub-core/commands/videotest.c: Reduce flickering and draw 6 squares instead of 2 to have full RGB/CMY test pattern. --- ChangeLog | 5 ++++ grub-core/commands/videotest.c | 49 +++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 642858ce3..b202abec7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-02 Vladimir Serbinenko + + * grub-core/commands/videotest.c: Reduce flickering and draw 6 squares + instead of 2 to have full RGB/CMY test pattern. + 2013-04-30 Vladimir Serbinenko Add few more tests. diff --git a/grub-core/commands/videotest.c b/grub-core/commands/videotest.c index 2256237f9..b6c181b52 100644 --- a/grub-core/commands/videotest.c +++ b/grub-core/commands/videotest.c @@ -49,7 +49,6 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)), if (grub_strcmp (cmd->name, "vbetest") == 0) grub_dl_load ("vbe"); #endif - mode = grub_env_get ("gfxmode"); if (argc) mode = args[0]; @@ -155,26 +154,38 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)), grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY); - for (i = 0; i < 2; i++) - { - color = grub_video_map_rgb (0, 0, 0); - grub_video_fill_rect (color, 0, 0, width, height); - - color = grub_video_map_rgb (255, 0, 0); - grub_video_fill_rect (color, 0, 0, 100, 100); - - color = grub_video_map_rgb (0, 255, 255); - grub_video_fill_rect (color, 100, 100, 100, 100); - - grub_video_set_viewport (x + 150, y + 150, - width - 150 * 2, height - 150 * 2); - color = grub_video_map_rgb (77, 33, 77); - grub_video_fill_rect (color, 0, 0, width, height); - grub_video_swap_buffers (); - } - for (i = 0; i < 5; i++) { + + if (i == 0 || i == 1) + { + color = grub_video_map_rgb (0, 0, 0); + grub_video_fill_rect (color, 0, 0, width, height); + + color = grub_video_map_rgb (255, 0, 0); + grub_video_fill_rect (color, 0, 0, 100, 100); + + color = grub_video_map_rgb (0, 255, 0); + grub_video_fill_rect (color, 100, 0, 100, 100); + + color = grub_video_map_rgb (0, 0, 255); + grub_video_fill_rect (color, 200, 0, 100, 100); + + color = grub_video_map_rgb (0, 255, 255); + grub_video_fill_rect (color, 0, 100, 100, 100); + + color = grub_video_map_rgb (255, 0, 255); + grub_video_fill_rect (color, 100, 100, 100, 100); + + color = grub_video_map_rgb (255, 255, 0); + grub_video_fill_rect (color, 200, 100, 100, 100); + + grub_video_set_viewport (x + 150, y + 150, + width - 150 * 2, height - 150 * 2); + color = grub_video_map_rgb (77, 33, 77); + grub_video_fill_rect (color, 0, 0, width, height); + } + color = grub_video_map_rgb (i, 33, 77); grub_video_fill_rect (color, 0, 0, width, height); grub_video_blit_render_target (text_layer, GRUB_VIDEO_BLIT_BLEND, 0, 0, From 503616602234105253bfe51055c3e7c252cf87ea Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 2 May 2013 14:39:03 +0200 Subject: [PATCH 131/187] First automated video test (running videotest and comparing results) --- ChangeLog | 4 + Makefile.util.def | 7 + grub-core/Makefile.core.def | 8 + grub-core/tests/checksums.c | 27 ++ grub-core/tests/fake_input.c | 67 ++++ grub-core/tests/lib/functional_test.c | 29 +- grub-core/tests/video_checksum.c | 435 ++++++++++++++++++++++++++ grub-core/tests/videotest_checksum.c | 286 +++++++++++++++++ grub-core/video/capture.c | 128 ++++++++ grub-core/video/video.c | 13 +- include/grub/emu/export.h | 3 +- include/grub/test.h | 9 + include/grub/video.h | 120 ++++++- tests/grub_func_test.in | 12 + tests/util/grub-shell.in | 2 + util/grub-render-label.c | 97 +----- 16 files changed, 1150 insertions(+), 97 deletions(-) create mode 100644 grub-core/tests/checksums.c create mode 100644 grub-core/tests/fake_input.c create mode 100644 grub-core/tests/video_checksum.c create mode 100644 grub-core/tests/videotest_checksum.c create mode 100644 grub-core/video/capture.c create mode 100644 tests/grub_func_test.in diff --git a/ChangeLog b/ChangeLog index b202abec7..37595a910 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-02 Vladimir Serbinenko + + First automated video test (running videotest and comparing results) + 2013-05-02 Vladimir Serbinenko * grub-core/commands/videotest.c: Reduce flickering and draw 6 squares diff --git a/Makefile.util.def b/Makefile.util.def index fbd37ebb6..a357341eb 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -67,6 +67,7 @@ library = { common = grub-core/video/fb/fbfill.c; common = grub-core/video/fb/video_fb.c; common = grub-core/video/video.c; + common = grub-core/video/capture.c; common = grub-core/video/colors.c; common = grub-core/unidata.c; common = grub-core/io/bufio.c; @@ -814,6 +815,12 @@ script = { common = tests/grub_script_strcmp.in; }; +script = { + testcase; + name = grub_func_test; + common = tests/grub_func_test.in; +}; + program = { testcase; name = example_unit_test; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 7e19acb66..2fa0ea7be 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1731,6 +1731,9 @@ module = { name = functional_test; common = tests/lib/functional_test.c; common = tests/lib/test.c; + common = tests/video_checksum.c; + common = tests/fake_input.c; + common = video/capture.c; }; module = { @@ -1738,6 +1741,11 @@ module = { common = tests/example_functional_test.c; }; +module = { + name = videotest_checksum; + common = tests/videotest_checksum.c; +}; + module = { name = bitmap; common = video/bitmap.c; diff --git a/grub-core/tests/checksums.c b/grub-core/tests/checksums.c new file mode 100644 index 000000000..93d100fee --- /dev/null +++ b/grub-core/tests/checksums.c @@ -0,0 +1,27 @@ + { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, }, 5 }, + { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, }, 5 }, + { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgb555 */, (grub_uint32_t []) { 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgb555 */, (grub_uint32_t []) { 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgb555 */, (grub_uint32_t []) { 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgb565 */, (grub_uint32_t []) { 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgb565 */, (grub_uint32_t []) { 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgb565 */, (grub_uint32_t []) { 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgb888 */, (grub_uint32_t []) { 0x61db45b7, 0x1d867efe, 0x99613325, 0xe53c086c, 0x9543de62, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgb888 */, (grub_uint32_t []) { 0xa46eb37f, 0xd2a59656, 0x49f8f92d, 0x3f33dc04, 0x7aae512a, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgb888 */, (grub_uint32_t []) { 0xb864a496, 0x6c22313b, 0x1505f93d, 0xc1436c90, 0xe74a6931, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgb888 */, (grub_uint32_t []) { 0x2b154617, 0x692e98df, 0xaf62fb87, 0xed59254f, 0x26164bc6, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgb888 */, (grub_uint32_t []) { 0x3b0fbc56, 0xd9d57c0e, 0xfb564a17, 0x198c8a4f, 0xbe502625, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgb888 */, (grub_uint32_t []) { 0x6e6c9b36, 0x4ae9f137, 0x27664f34, 0x3e32535, 0xfc793332, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgr555 */, (grub_uint32_t []) { 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgr555 */, (grub_uint32_t []) { 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgr555 */, (grub_uint32_t []) { 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgr565 */, (grub_uint32_t []) { 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgr565 */, (grub_uint32_t []) { 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgr565 */, (grub_uint32_t []) { 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgr888 */, (grub_uint32_t []) { 0x4af6b480, 0x923db79c, 0xfe8cc449, 0x2647c755, 0x27ee23e3, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgr888 */, (grub_uint32_t []) { 0x121d5e29, 0xf66c0aed, 0xdf138150, 0x3b62d594, 0x8dec962a, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgr888 */, (grub_uint32_t []) { 0xae86a12c, 0x4dabbe89, 0x6d30e897, 0x8e1df732, 0x2c0644ab, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgr888 */, (grub_uint32_t []) { 0x2605d280, 0xc06e3172, 0xef3e6395, 0x9558067, 0xb19ec65b, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgr888 */, (grub_uint32_t []) { 0x9404ef3b, 0xa4fdf18, 0xad7ef98c, 0x3335c9af, 0xe6f0c255, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgr888 */, (grub_uint32_t []) { 0xa008b770, 0xb98eb0d8, 0x9304b820, 0x8a82bf88, 0xc610a9d0, }, 5 }, diff --git a/grub-core/tests/fake_input.c b/grub-core/tests/fake_input.c new file mode 100644 index 000000000..b514c2acc --- /dev/null +++ b/grub-core/tests/fake_input.c @@ -0,0 +1,67 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +static int *seq; +static int seqptr, nseq; +static struct grub_term_input *saved; + +static int +fake_getkey (struct grub_term_input *term __attribute__ ((unused))) +{ + if (seq && seqptr < nseq) + return seq[seqptr++]; + return -1; +} + +static struct grub_term_input fake_input_term = + { + .name = "fake", + .getkey = fake_getkey + }; + +void +grub_terminal_input_fake_sequence (int *seq_in, int nseq_in) +{ + if (!saved) + saved = grub_term_inputs; + if (seq) + grub_free (seq); + seq = grub_malloc (nseq_in * sizeof (seq[0])); + if (seq) + { + grub_term_inputs = &fake_input_term; + grub_memcpy (seq, seq_in, nseq_in * sizeof (seq[0])); + } + nseq = nseq_in; +} + +void +grub_terminal_input_fake_sequence_end (void) +{ + grub_term_inputs = saved; + grub_free (seq); + seq = 0; + nseq = 0; +} diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c index fd199bd63..da4d5f809 100644 --- a/grub-core/tests/lib/functional_test.c +++ b/grub-core/tests/lib/functional_test.c @@ -30,9 +30,34 @@ grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)), char **args __attribute__ ((unused))) { grub_test_t test; + int ok = 1; FOR_LIST_ELEMENTS (test, grub_test_list) - grub_test_run (test); + ok = ok && !grub_test_run (test); + if (ok) + grub_printf ("ALL TESTS PASSED\n"); + else + grub_printf ("TEST FAILURE\n"); + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char **args __attribute__ ((unused))) +{ + grub_test_t test; + int ok = 1; + + grub_dl_load ("exfctest"); + grub_dl_load ("videotest_checksum"); + + FOR_LIST_ELEMENTS (test, grub_test_list) + ok = ok && !grub_test_run (test); + if (ok) + grub_printf ("ALL TESTS PASSED\n"); + else + grub_printf ("TEST FAILURE\n"); return GRUB_ERR_NONE; } @@ -41,6 +66,8 @@ static grub_extcmd_t cmd; GRUB_MOD_INIT (functional_test) { cmd = grub_register_extcmd ("functional_test", grub_functional_test, 0, 0, + "Run all loaded functional tests.", 0); + cmd = grub_register_extcmd ("all_functional_test", grub_functional_all_tests, 0, 0, "Run all functional tests.", 0); } diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c new file mode 100644 index 000000000..b2aab7929 --- /dev/null +++ b/grub-core/tests/video_checksum.c @@ -0,0 +1,435 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +/* All tests need to include test.h for GRUB testing framework. */ +#include +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +static int ctr; +static int nchk; +static char *basename; +static const grub_uint32_t *checksums; +static struct grub_video_mode_info capt_mode_info; + +#ifdef GRUB_MACHINE_EMU +#include +#include +#include +#include +#include +#include +#include +#include + +struct bmp_header +{ + grub_uint8_t magic[2]; + grub_uint32_t filesize; + grub_uint32_t reserved; + grub_uint32_t bmp_off; + grub_uint32_t head_size; + grub_uint16_t width; + grub_uint16_t height; + grub_uint16_t planes; + grub_uint16_t bpp; +} __attribute__ ((packed)); + +static void +grub_video_capture_write_bmp (const char *fname, + void *ptr, + const struct grub_video_mode_info *mode_info) +{ + int fd = open (fname, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + struct bmp_header head; + + if (fd < 0) + { + grub_printf (_("cannot open `%s': %s"), + fname, strerror (errno)); + } + + grub_memset (&head, 0, sizeof (head)); + + head.magic[0] = 'B'; + head.magic[1] = 'M'; + + if (mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB) + { + head.filesize = grub_cpu_to_le32 (sizeof (head) + mode_info->width * mode_info->height * 3); + head.bmp_off = grub_cpu_to_le32 (sizeof (head)); + head.bpp = grub_cpu_to_le16_compile_time (24); + } + else + { + head.filesize = grub_cpu_to_le32 (sizeof (head) + 3 * 256 + mode_info->width * mode_info->height); + head.bmp_off = grub_cpu_to_le32 (sizeof (head) + 3 * 256); + head.bpp = grub_cpu_to_le16_compile_time (8); + } + head.head_size = grub_cpu_to_le32 (sizeof (head) - 14); + head.width = grub_cpu_to_le16 (mode_info->width); + head.height = grub_cpu_to_le16 (mode_info->height); + head.planes = grub_cpu_to_le16_compile_time (1); + + head.width = grub_cpu_to_le16 (mode_info->width); + head.height = grub_cpu_to_le16 (mode_info->height); + + write (fd, &head, sizeof (head)); + + if (!(mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_RGB)) + { + struct grub_video_palette_data palette_data[256]; + int i; + int palette_len = mode_info->number_of_colors; + grub_memset (palette_data, 0, sizeof (palette_data)); + if (palette_len > 256) + palette_len = 256; + grub_video_get_palette (0, palette_len, palette_data); + for (i = 0; i < 256; i++) + { + grub_uint8_t r, g, b; + r = palette_data[i].r; + g = palette_data[i].g; + b = palette_data[i].b; + + write (fd, &b, 1); + write (fd, &g, 1); + write (fd, &r, 1); + } + } + + /* This does essentialy the same as some fbblit functions yet using + them would mean testing them against themselves so keep this + implemetation separate. */ + switch (mode_info->bytes_per_pixel) + { + case 4: + { + grub_uint8_t *buffer = xmalloc (mode_info->width * 3); + grub_uint32_t rmask = ((1 << mode_info->red_mask_size) - 1); + grub_uint32_t gmask = ((1 << mode_info->green_mask_size) - 1); + grub_uint32_t bmask = ((1 << mode_info->blue_mask_size) - 1); + int rshift = mode_info->red_field_pos; + int gshift = mode_info->green_field_pos; + int bshift = mode_info->blue_field_pos; + int mulrshift = (8 - mode_info->red_mask_size); + int mulgshift = (8 - mode_info->green_mask_size); + int mulbshift = (8 - mode_info->blue_mask_size); + int y; + + for (y = mode_info->height - 1; y >= 0; y--) + { + grub_uint32_t *iptr = (grub_uint32_t *) ((grub_uint8_t *) ptr + mode_info->pitch * y); + int x; + grub_uint8_t *optr = buffer; + for (x = 0; x < (int) mode_info->width; x++) + { + grub_uint32_t val = *iptr++; + *optr++ = ((val >> bshift) & bmask) << mulbshift; + *optr++ = ((val >> gshift) & gmask) << mulgshift; + *optr++ = ((val >> rshift) & rmask) << mulrshift; + } + write (fd, buffer, mode_info->width * 3); + } + grub_free (buffer); + break; + } + case 3: + { + grub_uint8_t *buffer = xmalloc (mode_info->width * 3); + grub_uint32_t rmask = ((1 << mode_info->red_mask_size) - 1); + grub_uint32_t gmask = ((1 << mode_info->green_mask_size) - 1); + grub_uint32_t bmask = ((1 << mode_info->blue_mask_size) - 1); + int rshift = mode_info->red_field_pos; + int gshift = mode_info->green_field_pos; + int bshift = mode_info->blue_field_pos; + int mulrshift = (8 - mode_info->red_mask_size); + int mulgshift = (8 - mode_info->green_mask_size); + int mulbshift = (8 - mode_info->blue_mask_size); + int y; + + for (y = mode_info->height - 1; y >= 0; y--) + { + grub_uint8_t *iptr = ((grub_uint8_t *) ptr + mode_info->pitch * y); + int x; + grub_uint8_t *optr = buffer; + for (x = 0; x < (int) mode_info->width; x++) + { + grub_uint32_t val = 0; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + val |= *iptr++ << 16; + val |= *iptr++ << 8; + val |= *iptr++; +#else + val |= *iptr++; + val |= *iptr++ << 8; + val |= *iptr++ << 16; +#endif + *optr++ = ((val >> bshift) & bmask) << mulbshift; + *optr++ = ((val >> gshift) & gmask) << mulgshift; + *optr++ = ((val >> rshift) & rmask) << mulrshift; + } + write (fd, buffer, mode_info->width * 3); + } + grub_free (buffer); + break; + } + case 2: + { + grub_uint8_t *buffer = xmalloc (mode_info->width * 3); + grub_uint16_t rmask = ((1 << mode_info->red_mask_size) - 1); + grub_uint16_t gmask = ((1 << mode_info->green_mask_size) - 1); + grub_uint16_t bmask = ((1 << mode_info->blue_mask_size) - 1); + int rshift = mode_info->red_field_pos; + int gshift = mode_info->green_field_pos; + int bshift = mode_info->blue_field_pos; + int mulrshift = (8 - mode_info->red_mask_size); + int mulgshift = (8 - mode_info->green_mask_size); + int mulbshift = (8 - mode_info->blue_mask_size); + int y; + + for (y = mode_info->height - 1; y >= 0; y--) + { + grub_uint16_t *iptr = (grub_uint16_t *) ((grub_uint8_t *) ptr + mode_info->pitch * y); + int x; + grub_uint8_t *optr = buffer; + for (x = 0; x < (int) mode_info->width; x++) + { + grub_uint16_t val = *iptr++; + *optr++ = ((val >> bshift) & bmask) << mulbshift; + *optr++ = ((val >> gshift) & gmask) << mulgshift; + *optr++ = ((val >> rshift) & rmask) << mulrshift; + } + write (fd, buffer, mode_info->width * 3); + } + grub_free (buffer); + break; + } + case 1: + { + int y; + + for (y = mode_info->height - 1; y >= 0; y--) + write (fd, ((grub_uint8_t *) ptr + mode_info->pitch * y), mode_info->width); + break; + } + } + close (fd); +} + +#endif + +static const char * +get_modename (void) +{ + static char buf[40]; + if (capt_mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) + { + grub_snprintf (buf, sizeof (buf), "i%d", capt_mode_info.number_of_colors); + return buf; + } + if (capt_mode_info.red_field_pos == 0) + { + grub_snprintf (buf, sizeof (buf), "bgr%d%d%d", capt_mode_info.blue_mask_size, + capt_mode_info.green_mask_size, + capt_mode_info.red_mask_size); + return buf; + } + grub_snprintf (buf, sizeof (buf), "rgb%d%d%d", capt_mode_info.red_mask_size, + capt_mode_info.green_mask_size, + capt_mode_info.blue_mask_size); + return buf; +} + +//#define GENERATE_MODE 1 + +#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) +int genfd = -1; +#endif + +static void +checksum (void) +{ + void *ptr; + grub_uint32_t crc; + + ptr = grub_video_capture_get_framebuffer (); + + crc = grub_getcrc32c (0, ptr, capt_mode_info.pitch * capt_mode_info.height); + if (!checksums || ctr >= nchk) + { + grub_test_assert (0, "Unexpected checksum %s_%dx%dx%s:%d: 0x%x", + basename, + capt_mode_info.width, + capt_mode_info.height, get_modename (), ctr, crc); + } + else if (crc != checksums[ctr]) + { + grub_test_assert (0, "Checksum %s_%dx%dx%s:%d failed: 0x%x vs 0x%x", + basename, + capt_mode_info.width, + capt_mode_info.height, get_modename (), + ctr, crc, checksums[ctr]); + } + else + { +#if !(defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU)) + ctr++; + return; +#endif + } +#ifdef GRUB_MACHINE_EMU + char *name = grub_xasprintf ("%s_%dx%dx%s_%d.bmp", basename, + capt_mode_info.width, + capt_mode_info.height, get_modename (), + ctr); + grub_video_capture_write_bmp (name, ptr, &capt_mode_info); +#endif + +#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) + if (genfd >= 0) + { + char buf[20]; + grub_snprintf (buf, sizeof (buf), "0x%x, ", crc); + write (genfd, buf, grub_strlen (buf)); + } +#endif + + ctr++; +} + +struct checksum_desc +{ + const char *name; + unsigned width; + unsigned height; + unsigned mode_type; + unsigned number_of_colors; + unsigned bpp; + unsigned bytes_per_pixel; + unsigned red_field_pos; + unsigned red_mask_size; + unsigned green_field_pos; + unsigned green_mask_size; + unsigned blue_field_pos; + unsigned blue_mask_size; + unsigned reserved_field_pos; + unsigned reserved_mask_size; + const grub_uint32_t *checksums; + int nchk; +}; + +const struct checksum_desc checksum_table[] = { +#include "checksums.c" +}; + +void +grub_video_checksum (const char *basename_in) +{ + unsigned i; + + grub_video_get_info (&capt_mode_info); + +#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) + if (genfd < 0) + genfd = open ("checksums.c", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + if (genfd >= 0) + { + char buf[400]; + + grub_snprintf (buf, sizeof (buf), "\", %d, %d, 0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d /* %dx%dx%s */, (grub_uint32_t []) { ", + capt_mode_info.width, + capt_mode_info.height, + capt_mode_info.mode_type, + capt_mode_info.number_of_colors, + capt_mode_info.bpp, + capt_mode_info.bytes_per_pixel, + capt_mode_info.red_field_pos, + capt_mode_info.red_mask_size, + capt_mode_info.green_field_pos, + capt_mode_info.green_mask_size, + capt_mode_info.blue_field_pos, + capt_mode_info.blue_mask_size, + capt_mode_info.reserved_field_pos, + capt_mode_info.reserved_mask_size, + capt_mode_info.width, + capt_mode_info.height, get_modename ()); + + write (genfd, " { \"", 5); + write (genfd, basename_in, grub_strlen (basename_in)); + write (genfd, buf, grub_strlen (buf)); + } +#endif + + basename = grub_strdup (basename_in); + nchk = 0; + checksums = 0; + /* FIXME: optimize this. */ + for (i = 0; i < ARRAY_SIZE (checksum_table); i++) + if (grub_strcmp (checksum_table[i].name, basename_in) == 0 + && capt_mode_info.width == checksum_table[i].width + && capt_mode_info.height == checksum_table[i].height + && capt_mode_info.mode_type == checksum_table[i].mode_type + && capt_mode_info.number_of_colors == checksum_table[i].number_of_colors + && capt_mode_info.bpp == checksum_table[i].bpp + && capt_mode_info.bytes_per_pixel == checksum_table[i].bytes_per_pixel + && capt_mode_info.red_field_pos == checksum_table[i].red_field_pos + && capt_mode_info.red_mask_size == checksum_table[i].red_mask_size + && capt_mode_info.green_field_pos == checksum_table[i].green_field_pos + && capt_mode_info.green_mask_size == checksum_table[i].green_mask_size + && capt_mode_info.blue_field_pos == checksum_table[i].blue_field_pos + && capt_mode_info.blue_mask_size == checksum_table[i].blue_mask_size + && capt_mode_info.reserved_field_pos == checksum_table[i].reserved_field_pos + && capt_mode_info.reserved_mask_size == checksum_table[i].reserved_mask_size) + { + nchk = checksum_table[i].nchk; + checksums = checksum_table[i].checksums; + break; + } + + ctr = 0; + grub_video_capture_refresh_cb = checksum; +} + +void +grub_video_checksum_end (void) +{ +#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) + if (genfd >= 0) + { + char buf[40]; + grub_snprintf (buf, sizeof (buf), "}, %x },\n", ctr); + write (genfd, buf, grub_strlen (buf)); + } +#endif + grub_test_assert (ctr == nchk, "Not enough checksums %s_%dx%dx%s: %d vs %d", + basename, + capt_mode_info.width, + capt_mode_info.height, get_modename (), + ctr, nchk); + grub_free (basename); + basename = 0; + nchk = 0; + checksums = 0; + ctr = 0; + grub_video_capture_refresh_cb = 0; +} diff --git a/grub-core/tests/videotest_checksum.c b/grub-core/tests/videotest_checksum.c new file mode 100644 index 000000000..e57dae73c --- /dev/null +++ b/grub-core/tests/videotest_checksum.c @@ -0,0 +1,286 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +/* All tests need to include test.h for GRUB testing framework. */ +#include +#include +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +struct +{ + struct grub_video_mode_info mode_info; +} tests[] = { + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 640, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 800, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 1024, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS + }, + }, + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 1280, + GRUB_VIDEO_MI_RGB555 () + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 1600, + GRUB_VIDEO_MI_RGB555 () + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 2048, + GRUB_VIDEO_MI_RGB555 () + }, + }, + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 1280, + GRUB_VIDEO_MI_RGB565 () + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 1600, + GRUB_VIDEO_MI_RGB565 () + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 2048, + GRUB_VIDEO_MI_RGB565 () + }, + }, + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 640 * 3, + GRUB_VIDEO_MI_RGB888 () + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 800 * 3, + GRUB_VIDEO_MI_RGB888 () + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 1024 * 3, + GRUB_VIDEO_MI_RGB888 () + }, + }, + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 640 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 800 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 1024 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + }, + + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 1280, + GRUB_VIDEO_MI_BGR555 () + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 1600, + GRUB_VIDEO_MI_BGR555 () + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 2048, + GRUB_VIDEO_MI_BGR555 () + }, + }, + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 1280, + GRUB_VIDEO_MI_BGR565 () + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 1600, + GRUB_VIDEO_MI_BGR565 () + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 2048, + GRUB_VIDEO_MI_BGR565 () + }, + }, + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 640 * 3, + GRUB_VIDEO_MI_BGR888 () + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 800 * 3, + GRUB_VIDEO_MI_BGR888 () + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 1024 * 3, + GRUB_VIDEO_MI_BGR888 () + }, + }, + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 640 * 4, + GRUB_VIDEO_MI_BGRA8888() + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 800 * 4, + GRUB_VIDEO_MI_BGRA8888() + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 1024 * 4, + GRUB_VIDEO_MI_BGRA8888() + }, + }, + + }; + + +/* Functional test main method. */ +static void +videotest_checksum (void) +{ + unsigned i; + grub_font_load ("unicode"); + for (i = 0; i < ARRAY_SIZE (tests); i++) + { + grub_video_capture_start (&tests[i].mode_info, + grub_video_fbstd_colors, + GRUB_VIDEO_FBSTD_NUMCOLORS); + grub_terminal_input_fake_sequence ((int []) { '\n' }, 1); + + grub_video_checksum ("videotest"); + + char *args[] = { 0 }; + grub_command_execute ("videotest", 0, args); + grub_video_checksum_end (); + grub_video_capture_end (); + } +} + +/* Register example_test method as a functional test. */ +GRUB_FUNCTIONAL_TEST (videotest_checksum, videotest_checksum); diff --git a/grub-core/video/capture.c b/grub-core/video/capture.c new file mode 100644 index 000000000..be7fb61af --- /dev/null +++ b/grub-core/video/capture.c @@ -0,0 +1,128 @@ + +#define grub_video_render_target grub_video_fbrender_target + +#include +#include +#include + +static struct +{ + struct grub_video_mode_info mode_info; + struct grub_video_render_target *render_target; + grub_uint8_t *ptr; +} framebuffer; + +void (*grub_video_capture_refresh_cb) (void); + +static grub_err_t +grub_video_capture_swap_buffers (void) +{ + if (grub_video_capture_refresh_cb) + grub_video_capture_refresh_cb (); + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_video_capture_set_active_render_target (struct grub_video_render_target *target) +{ + if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY) + target = framebuffer.render_target; + + return grub_video_fb_set_active_render_target (target); +} + +static struct grub_video_adapter grub_video_capture_adapter = + { + .name = "Render capture", + + .prio = 0, + .id = GRUB_VIDEO_ADAPTER_CAPTURE, + + .fini = grub_video_fb_fini, + .get_info = grub_video_fb_get_info, + .get_info_and_fini = 0, + .set_palette = grub_video_fb_set_palette, + .get_palette = grub_video_fb_get_palette, + .set_viewport = grub_video_fb_set_viewport, + .get_viewport = grub_video_fb_get_viewport, + .map_color = grub_video_fb_map_color, + .map_rgb = grub_video_fb_map_rgb, + .map_rgba = grub_video_fb_map_rgba, + .unmap_color = grub_video_fb_unmap_color, + .fill_rect = grub_video_fb_fill_rect, + .blit_bitmap = grub_video_fb_blit_bitmap, + .blit_render_target = grub_video_fb_blit_render_target, + .scroll = grub_video_fb_scroll, + .swap_buffers = grub_video_capture_swap_buffers, + .create_render_target = grub_video_fb_create_render_target, + .delete_render_target = grub_video_fb_delete_render_target, + .set_active_render_target = grub_video_capture_set_active_render_target, + .get_active_render_target = grub_video_fb_get_active_render_target, + + .next = 0 + }; + +static struct grub_video_adapter *saved; +static struct grub_video_mode_info saved_mode_info; + +grub_err_t +grub_video_capture_start (const struct grub_video_mode_info *mode_info, + struct grub_video_palette_data *palette, + unsigned int palette_size) +{ + grub_err_t err; + grub_memset (&framebuffer, 0, sizeof (framebuffer)); + + grub_video_fb_init (); + + framebuffer.mode_info = *mode_info; + framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info); + + framebuffer.ptr = grub_malloc (framebuffer.mode_info.height * framebuffer.mode_info.pitch); + if (!framebuffer.ptr) + return grub_errno; + + err = grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, + &framebuffer.mode_info, + framebuffer.ptr); + if (err) + return err; + err = grub_video_fb_set_active_render_target (framebuffer.render_target); + if (err) + return err; + err = grub_video_fb_set_palette (0, palette_size, palette); + if (err) + return err; + + saved = grub_video_adapter_active; + if (saved) + { + grub_video_get_info (&saved_mode_info); + if (saved->fini) + saved->fini (); + } + grub_video_adapter_active = &grub_video_capture_adapter; + + return GRUB_ERR_NONE; +} + +void * +grub_video_capture_get_framebuffer (void) +{ + return framebuffer.ptr; +} + +void +grub_video_capture_end (void) +{ + grub_free (framebuffer.ptr); + grub_video_fb_fini (); + grub_video_adapter_active = saved; + if (saved) + { + if (saved->init) + saved->init (); + if (saved->setup) + saved->setup (saved_mode_info.width, saved_mode_info.height, 0, 0); + } +} diff --git a/grub-core/video/video.c b/grub-core/video/video.c index 844f36c08..90b525325 100644 --- a/grub-core/video/video.c +++ b/grub-core/video/video.c @@ -29,7 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); grub_video_adapter_t grub_video_adapter_list = NULL; /* Active video adapter. */ -static grub_video_adapter_t grub_video_adapter_active; +grub_video_adapter_t grub_video_adapter_active; /* Restore back to initial mode (where applicable). */ grub_err_t @@ -510,6 +510,9 @@ grub_video_set_mode (const char *modestring, if (! modevar) return grub_errno; + if (grub_video_adapter_active && grub_video_adapter_active->id == GRUB_VIDEO_ADAPTER_CAPTURE) + return GRUB_ERR_NONE; + if (grub_memcmp (next_mode, "keep", sizeof ("keep")) == 0 || grub_memcmp (next_mode, "keep,", sizeof ("keep,") - 1) == 0 || grub_memcmp (next_mode, "keep;", sizeof ("keep;") - 1) == 0) @@ -714,11 +717,3 @@ grub_video_set_mode (const char *modestring, return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no suitable video mode found")); } - -#ifdef GRUB_UTIL -void -grub_video_set_adapter (grub_video_adapter_t adapter) -{ - grub_video_adapter_active = adapter; -} -#endif diff --git a/include/grub/emu/export.h b/include/grub/emu/export.h index 1e2f0432b..7f9e4e158 100644 --- a/include/grub/emu/export.h +++ b/include/grub/emu/export.h @@ -3,4 +3,5 @@ void EXPORT_FUNC (close) (void); void EXPORT_FUNC (read) (void); void EXPORT_FUNC (write) (void); void EXPORT_FUNC (ioctl) (void); - +void EXPORT_FUNC (__errno_location) (void); +void EXPORT_FUNC (strerror) (void); diff --git a/include/grub/test.h b/include/grub/test.h index d876f5704..6aa406979 100644 --- a/include/grub/test.h +++ b/include/grub/test.h @@ -90,4 +90,13 @@ void grub_unit_test_fini (void); grub_test_unregister (#name); \ } +void +grub_video_checksum (const char *basename_in); +void +grub_video_checksum_end (void); +void +grub_terminal_input_fake_sequence (int *seq_in, int nseq_in); +void +grub_terminal_input_fake_sequence_end (void); + #endif /* ! GRUB_TEST_HEADER */ diff --git a/include/grub/video.h b/include/grub/video.h index bd5852e4f..630817797 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -284,7 +284,8 @@ typedef enum grub_video_driver_id GRUB_VIDEO_DRIVER_SIS315PRO, GRUB_VIDEO_DRIVER_RADEON_FULOONG2E, GRUB_VIDEO_DRIVER_COREBOOT, - GRUB_VIDEO_DRIVER_IEEE1275 + GRUB_VIDEO_DRIVER_IEEE1275, + GRUB_VIDEO_ADAPTER_CAPTURE } grub_video_driver_id_t; typedef enum grub_video_adapter_prio @@ -544,9 +545,122 @@ extern void grub_video_sis315pro_fini (void); extern void grub_video_radeon_fuloong2e_fini (void); #endif -#ifdef GRUB_UTIL void grub_video_set_adapter (grub_video_adapter_t adapter); -#endif +grub_video_adapter_t +grub_video_get_adapter (void); +grub_err_t +grub_video_capture_start (const struct grub_video_mode_info *mode_info, + struct grub_video_palette_data *palette, + unsigned int palette_size); +void +grub_video_capture_end (void); + +void * +grub_video_capture_get_framebuffer (void); + +extern grub_video_adapter_t EXPORT_VAR (grub_video_adapter_active); +extern void (*grub_video_capture_refresh_cb) (void); + +#define GRUB_VIDEO_MI_RGB555(x) \ + x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \ + x.bpp = 15, \ + x.bytes_per_pixel = 2, \ + x.number_of_colors = 256, \ + x.red_mask_size = 5, \ + x.red_field_pos = 10, \ + x.green_mask_size = 5, \ + x.green_field_pos = 5, \ + x.blue_mask_size = 5, \ + x.blue_field_pos = 0 + +#define GRUB_VIDEO_MI_RGB565(x) \ + x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \ + x.bpp = 16, \ + x.bytes_per_pixel = 2, \ + x.number_of_colors = 256, \ + x.red_mask_size = 5, \ + x.red_field_pos = 11, \ + x.green_mask_size = 6, \ + x.green_field_pos = 5, \ + x.blue_mask_size = 5, \ + x.blue_field_pos = 0 + +#define GRUB_VIDEO_MI_RGB888(x) \ + x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \ + x.bpp = 24, \ + x.bytes_per_pixel = 3, \ + x.number_of_colors = 256, \ + x.red_mask_size = 8, \ + x.red_field_pos = 16, \ + x.green_mask_size = 8, \ + x.green_field_pos = 8, \ + x.blue_mask_size = 8, \ + x.blue_field_pos = 0 + +#define GRUB_VIDEO_MI_RGBA8888(x) \ + x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \ + x.bpp = 32, \ + x.bytes_per_pixel = 4, \ + x.number_of_colors = 256, \ + x.reserved_mask_size = 8, \ + x.reserved_field_pos = 24, \ + x.red_mask_size = 8, \ + x.red_field_pos = 16, \ + x.green_mask_size = 8, \ + x.green_field_pos = 8, \ + x.blue_mask_size = 8, \ + x.blue_field_pos = 0 + + +#define GRUB_VIDEO_MI_BGR555(x) \ + x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \ + x.bpp = 15, \ + x.bytes_per_pixel = 2, \ + x.number_of_colors = 256, \ + x.red_mask_size = 5, \ + x.red_field_pos = 0, \ + x.green_mask_size = 5, \ + x.green_field_pos = 5, \ + x.blue_mask_size = 5, \ + x.blue_field_pos = 10 + +#define GRUB_VIDEO_MI_BGR565(x) \ + x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \ + x.bpp = 16, \ + x.bytes_per_pixel = 2, \ + x.number_of_colors = 256, \ + x.red_mask_size = 5, \ + x.red_field_pos = 0, \ + x.green_mask_size = 6, \ + x.green_field_pos = 5, \ + x.blue_mask_size = 5, \ + x.blue_field_pos = 11 + +#define GRUB_VIDEO_MI_BGR888(x) \ + x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \ + x.bpp = 24, \ + x.bytes_per_pixel = 3, \ + x.number_of_colors = 256, \ + x.red_mask_size = 8, \ + x.red_field_pos = 0, \ + x.green_mask_size = 8, \ + x.green_field_pos = 8, \ + x.blue_mask_size = 8, \ + x.blue_field_pos = 16 + +#define GRUB_VIDEO_MI_BGRA8888(x) \ + x.mode_type = GRUB_VIDEO_MODE_TYPE_RGB, \ + x.bpp = 32, \ + x.bytes_per_pixel = 4, \ + x.number_of_colors = 256, \ + x.reserved_mask_size = 8, \ + x.reserved_field_pos = 24, \ + x.red_mask_size = 8, \ + x.red_field_pos = 0, \ + x.green_mask_size = 8, \ + x.green_field_pos = 8, \ + x.blue_mask_size = 8, \ + x.blue_field_pos = 16 #endif /* ! GRUB_VIDEO_HEADER */ diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in new file mode 100644 index 000000000..a149cf96d --- /dev/null +++ b/tests/grub_func_test.in @@ -0,0 +1,12 @@ +#! /bin/bash +set -e + +. "@builddir@/grub-core/modinfo.sh" + +out=`echo all_functional_test | @builddir@/grub-shell` + +if [ "$(echo "$out" | tail -n 1)" != "ALL TESTS PASSED" ]; then + echo "Functional test failure: $out" + exit 1 +fi + diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 1d7dfb868..dfde836d5 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -408,6 +408,8 @@ if [ x$boot = xnet ]; then timeout -s KILL $timeout "${qemu}" ${qemuopts} -nographic ${serial_null} -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | do_trim elif [ x$boot = xemu ]; then grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" + mkdir -p "$grubdir/fonts" + cp "@builddir@/"unicode.pf2 "$grubdir/fonts/unicode.pf2" cp "${cfgfile}" "$grubdir/grub.cfg" cp "${source}" "$grubdir/testcase.cfg" @builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim diff --git a/util/grub-render-label.c b/util/grub-render-label.c index 723775967..32d37746d 100644 --- a/util/grub-render-label.c +++ b/util/grub-render-label.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2010,2012 Free Software Foundation, Inc. + * Copyright (C) 2010,2012,2013 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,8 +17,6 @@ */ -#define grub_video_render_target grub_video_fbrender_target - #include #include @@ -74,58 +72,6 @@ static struct argp_option options[] = { #include #include -static struct -{ - struct grub_video_mode_info mode_info; - struct grub_video_render_target *render_target; - grub_uint8_t *ptr; -} framebuffer; - -static grub_err_t -grub_video_text_render_swap_buffers (void) -{ - return GRUB_ERR_NONE; -} - -static grub_err_t -grub_video_text_render_set_active_render_target (struct grub_video_render_target *target) -{ - if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY) - target = framebuffer.render_target; - - return grub_video_fb_set_active_render_target (target); -} - -static struct grub_video_adapter grub_video_text_render_adapter = - { - .name = "Text rendering", - - .prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE, - - .fini = grub_video_fb_fini, - .get_info = grub_video_fb_get_info, - .get_info_and_fini = 0, - .set_palette = grub_video_fb_set_palette, - .get_palette = grub_video_fb_get_palette, - .set_viewport = grub_video_fb_set_viewport, - .get_viewport = grub_video_fb_get_viewport, - .map_color = grub_video_fb_map_color, - .map_rgb = grub_video_fb_map_rgb, - .map_rgba = grub_video_fb_map_rgba, - .unmap_color = grub_video_fb_unmap_color, - .fill_rect = grub_video_fb_fill_rect, - .blit_bitmap = grub_video_fb_blit_bitmap, - .blit_render_target = grub_video_fb_blit_render_target, - .scroll = grub_video_fb_scroll, - .swap_buffers = grub_video_text_render_swap_buffers, - .create_render_target = grub_video_fb_create_render_target, - .delete_render_target = grub_video_fb_delete_render_target, - .set_active_render_target = grub_video_text_render_set_active_render_target, - .get_active_render_target = grub_video_fb_get_active_render_target, - - .next = 0 - }; - static error_t argp_parser (int key, char *arg, struct argp_state *state) { @@ -208,6 +154,7 @@ main (int argc, char *argv[]) 0x77, 0x66, 0x3f, 0x27 }; int i, j, k, cptr = 0; grub_uint8_t bg, fg; + struct grub_video_mode_info mode_info; for (i = 0; i < 256; i++) ieee1275_palette[i].a = 0xff; @@ -340,32 +287,17 @@ main (int argc, char *argv[]) width = grub_font_get_string_width (font, text) + 10; height = grub_font_get_height (font); - grub_memset (&framebuffer, 0, sizeof (framebuffer)); + mode_info.width = width; + mode_info.height = height; + mode_info.pitch = width; - grub_video_fb_init (); + mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; + mode_info.bpp = 8; + mode_info.bytes_per_pixel = 1; + mode_info.number_of_colors = 256; - framebuffer.mode_info.width = width; - framebuffer.mode_info.height = height; - framebuffer.mode_info.pitch = width; - - framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; - framebuffer.mode_info.bpp = 8; - framebuffer.mode_info.bytes_per_pixel = 1; - framebuffer.mode_info.number_of_colors = 256; - - framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info); - - /* For some reason sparc64 uses 32-bit pointer too. */ - framebuffer.ptr = xmalloc (height * width); - - grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, - &framebuffer.mode_info, - framebuffer.ptr); - grub_video_fb_set_active_render_target (framebuffer.render_target); - grub_video_fb_set_palette (0, ARRAY_SIZE (ieee1275_palette), - ieee1275_palette); - - grub_video_set_adapter (&grub_video_text_render_adapter); + grub_video_capture_start (&mode_info, ieee1275_palette, + ARRAY_SIZE (ieee1275_palette)); fg = grub_video_map_rgb (arguments.fgcolor.red, arguments.fgcolor.green, @@ -374,18 +306,17 @@ main (int argc, char *argv[]) arguments.bgcolor.green, arguments.bgcolor.blue); - grub_memset (framebuffer.ptr, bg, height * width); + grub_memset (grub_video_capture_get_framebuffer (), bg, height * width); grub_font_draw_string (text, font, fg, 5, grub_font_get_ascent (font)); - grub_video_set_adapter (0); - head.magic = 1; head.width = grub_cpu_to_be16 (width); head.height = grub_cpu_to_be16 (height); fwrite (&head, 1, sizeof (head), out); - fwrite (framebuffer.ptr, 1, width * height, out); + fwrite (grub_video_capture_get_framebuffer (), 1, width * height, out); + grub_video_capture_end (); if (out != stdout) fclose (out); From 095accd14b5b591ebaef3e07072a525231054b5f Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 2 May 2013 18:06:39 +0200 Subject: [PATCH 132/187] * grub-core/loader/i386/linux.c (grub_linux_setup_video): Add GRUB_VIDEO_ADAPTER_CAPTURE: to handled drived ids. --- ChangeLog | 5 +++++ grub-core/loader/i386/linux.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 37595a910..de8acba51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-02 Vladimir Serbinenko + + * grub-core/loader/i386/linux.c (grub_linux_setup_video): Add + GRUB_VIDEO_ADAPTER_CAPTURE: to handled drived ids. + 2013-05-02 Vladimir Serbinenko First automated video test (running videotest and comparing results) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 106496b86..4ff610609 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -343,6 +343,7 @@ grub_linux_setup_video (struct linux_kernel_params *params) /* Make gcc happy. */ case GRUB_VIDEO_DRIVER_SDL: case GRUB_VIDEO_DRIVER_NONE: + case GRUB_VIDEO_ADAPTER_CAPTURE: params->have_vga = GRUB_VIDEO_LINUX_TYPE_SIMPLE; break; } From 3f3e7326b7ea300d1137363265121bd30468ff2d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 2 May 2013 18:08:42 +0200 Subject: [PATCH 133/187] * grub-core/tests/videotest_checksum.c (videotest_checksum): Error out if no unifont is found. Restore original keyboard. --- ChangeLog | 6 ++++++ grub-core/tests/videotest_checksum.c | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index de8acba51..ef402f8fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-05-02 Vladimir Serbinenko + + * grub-core/tests/videotest_checksum.c (videotest_checksum): Error out + if no unifont is found. + Restore original keyboard. + 2013-05-02 Vladimir Serbinenko * grub-core/loader/i386/linux.c (grub_linux_setup_video): Add diff --git a/grub-core/tests/videotest_checksum.c b/grub-core/tests/videotest_checksum.c index e57dae73c..3c70f8c47 100644 --- a/grub-core/tests/videotest_checksum.c +++ b/grub-core/tests/videotest_checksum.c @@ -265,7 +265,12 @@ static void videotest_checksum (void) { unsigned i; - grub_font_load ("unicode"); + if (grub_font_load ("unicode") == 0) + { + grub_test_assert (0, "unicode font not found: %s", grub_errmsg); + return; + } + for (i = 0; i < ARRAY_SIZE (tests); i++) { grub_video_capture_start (&tests[i].mode_info, @@ -277,6 +282,8 @@ videotest_checksum (void) char *args[] = { 0 }; grub_command_execute ("videotest", 0, args); + + grub_terminal_input_fake_sequence_end (); grub_video_checksum_end (); grub_video_capture_end (); } From 813c16222ffb6924320f5eb23c20bc4b18cf1cc0 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 2 May 2013 18:10:11 +0200 Subject: [PATCH 134/187] Add missing exports on mips. --- ChangeLog | 4 +++ grub-core/Makefile.am | 2 ++ include/grub/font.h | 2 +- include/grub/video.h | 2 +- include/grub/video_fb.h | 61 +++++++++++++++++++++-------------------- 5 files changed, 39 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef402f8fc..8525dd9be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-02 Vladimir Serbinenko + + Add missing exports on mips. + 2013-05-02 Vladimir Serbinenko * grub-core/tests/videotest_checksum.c (videotest_checksum): Error out diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index fa6afcfad..c350b5ab1 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -160,6 +160,7 @@ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h @@ -178,6 +179,7 @@ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h diff --git a/include/grub/font.h b/include/grub/font.h index 975432ef7..aed7e1c2b 100644 --- a/include/grub/font.h +++ b/include/grub/font.h @@ -81,7 +81,7 @@ void grub_font_loader_init (void); /* Load a font and add it to the beginning of the global font list. Returns: 0 upon success; nonzero upon failure. */ -grub_font_t grub_font_load (const char *filename); +grub_font_t EXPORT_FUNC(grub_font_load) (const char *filename); /* Get the font that has the specified name. Font names are in the form "Family Name Bold Italic 14", where Bold and Italic are optional. diff --git a/include/grub/video.h b/include/grub/video.h index 630817797..36e863be3 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -419,7 +419,7 @@ grub_err_t EXPORT_FUNC (grub_video_get_info) (struct grub_video_mode_info *mode_ grub_err_t EXPORT_FUNC (grub_video_get_info_and_fini) (struct grub_video_mode_info *mode_info, void **framebuffer); -enum grub_video_blit_format grub_video_get_blit_format (struct grub_video_mode_info *mode_info); +enum grub_video_blit_format EXPORT_FUNC(grub_video_get_blit_format) (struct grub_video_mode_info *mode_info); grub_err_t grub_video_set_palette (unsigned int start, unsigned int count, struct grub_video_palette_data *palette_data); diff --git a/include/grub/video_fb.h b/include/grub/video_fb.h index d696398fe..0628467e7 100644 --- a/include/grub/video_fb.h +++ b/include/grub/video_fb.h @@ -31,45 +31,46 @@ struct grub_video_fbblit_info; struct grub_video_fbrender_target; #define GRUB_VIDEO_FBSTD_NUMCOLORS 16 -extern struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLORS]; +extern struct grub_video_palette_data EXPORT_VAR(grub_video_fbstd_colors)[GRUB_VIDEO_FBSTD_NUMCOLORS]; grub_err_t -grub_video_fb_init (void); +EXPORT_FUNC(grub_video_fb_init) (void); grub_err_t -grub_video_fb_fini (void); +EXPORT_FUNC(grub_video_fb_fini) (void); grub_err_t -grub_video_fb_get_info (struct grub_video_mode_info *mode_info); +EXPORT_FUNC(grub_video_fb_get_info) (struct grub_video_mode_info *mode_info); grub_err_t -grub_video_fb_get_palette (unsigned int start, unsigned int count, - struct grub_video_palette_data *palette_data); +EXPORT_FUNC(grub_video_fb_get_palette) (unsigned int start, unsigned int count, + struct grub_video_palette_data *palette_data); grub_err_t -grub_video_fb_set_palette (unsigned int start, unsigned int count, - struct grub_video_palette_data *palette_data); +EXPORT_FUNC(grub_video_fb_set_palette) (unsigned int start, unsigned int count, + struct grub_video_palette_data *palette_data); grub_err_t -grub_video_fb_set_viewport (unsigned int x, unsigned int y, - unsigned int width, unsigned int height); +EXPORT_FUNC(grub_video_fb_set_viewport) (unsigned int x, unsigned int y, + unsigned int width, unsigned int height); grub_err_t -grub_video_fb_get_viewport (unsigned int *x, unsigned int *y, - unsigned int *width, unsigned int *height); +EXPORT_FUNC(grub_video_fb_get_viewport) (unsigned int *x, unsigned int *y, + unsigned int *width, + unsigned int *height); grub_video_color_t -grub_video_fb_map_color (grub_uint32_t color_name); +EXPORT_FUNC(grub_video_fb_map_color) (grub_uint32_t color_name); grub_video_color_t -grub_video_fb_map_rgb (grub_uint8_t red, grub_uint8_t green, - grub_uint8_t blue); +EXPORT_FUNC(grub_video_fb_map_rgb) (grub_uint8_t red, grub_uint8_t green, + grub_uint8_t blue); grub_video_color_t -grub_video_fb_map_rgba (grub_uint8_t red, grub_uint8_t green, - grub_uint8_t blue, grub_uint8_t alpha); +EXPORT_FUNC(grub_video_fb_map_rgba) (grub_uint8_t red, grub_uint8_t green, + grub_uint8_t blue, grub_uint8_t alpha); grub_err_t -grub_video_fb_unmap_color (grub_video_color_t color, - grub_uint8_t *red, grub_uint8_t *green, - grub_uint8_t *blue, grub_uint8_t *alpha); +EXPORT_FUNC(grub_video_fb_unmap_color) (grub_video_color_t color, + grub_uint8_t *red, grub_uint8_t *green, + grub_uint8_t *blue, grub_uint8_t *alpha); void grub_video_fb_unmap_color_int (struct grub_video_fbblit_info * source, @@ -78,42 +79,42 @@ grub_video_fb_unmap_color_int (struct grub_video_fbblit_info * source, grub_uint8_t *blue, grub_uint8_t *alpha); grub_err_t -grub_video_fb_fill_rect (grub_video_color_t color, int x, int y, - unsigned int width, unsigned int height); +EXPORT_FUNC(grub_video_fb_fill_rect) (grub_video_color_t color, int x, int y, + unsigned int width, unsigned int height); grub_err_t -grub_video_fb_blit_bitmap (struct grub_video_bitmap *bitmap, +EXPORT_FUNC(grub_video_fb_blit_bitmap) (struct grub_video_bitmap *bitmap, enum grub_video_blit_operators oper, int x, int y, int offset_x, int offset_y, unsigned int width, unsigned int height); grub_err_t -grub_video_fb_blit_render_target (struct grub_video_fbrender_target *source, +EXPORT_FUNC(grub_video_fb_blit_render_target) (struct grub_video_fbrender_target *source, enum grub_video_blit_operators oper, int x, int y, int offset_x, int offset_y, unsigned int width, unsigned int height); grub_err_t -grub_video_fb_scroll (grub_video_color_t color, int dx, int dy); +EXPORT_FUNC(grub_video_fb_scroll) (grub_video_color_t color, int dx, int dy); grub_err_t -grub_video_fb_create_render_target (struct grub_video_fbrender_target **result, +EXPORT_FUNC(grub_video_fb_create_render_target) (struct grub_video_fbrender_target **result, unsigned int width, unsigned int height, unsigned int mode_type __attribute__ ((unused))); grub_err_t -grub_video_fb_create_render_target_from_pointer (struct grub_video_fbrender_target **result, +EXPORT_FUNC(grub_video_fb_create_render_target_from_pointer) (struct grub_video_fbrender_target **result, const struct grub_video_mode_info *mode_info, void *ptr); grub_err_t -grub_video_fb_delete_render_target (struct grub_video_fbrender_target *target); +EXPORT_FUNC(grub_video_fb_delete_render_target) (struct grub_video_fbrender_target *target); grub_err_t -grub_video_fb_get_active_render_target (struct grub_video_fbrender_target **target); +EXPORT_FUNC(grub_video_fb_get_active_render_target) (struct grub_video_fbrender_target **target); grub_err_t -grub_video_fb_set_active_render_target (struct grub_video_fbrender_target *target); +EXPORT_FUNC(grub_video_fb_set_active_render_target) (struct grub_video_fbrender_target *target); typedef grub_err_t (*grub_video_fb_set_page_t) (int page); From a8905e8ae83edc438214af553671efec7b787191 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 2 May 2013 22:30:20 +0200 Subject: [PATCH 135/187] Several fixes to ieee1275 and big-endian video. --- ChangeLog | 4 + grub-core/tests/checksums.c | 3 + grub-core/tests/video_checksum.c | 82 +++++++- grub-core/tests/videotest_checksum.c | 38 +++- grub-core/video/bochs.c | 1 + grub-core/video/cirrus.c | 6 +- grub-core/video/efi_uga.c | 2 +- grub-core/video/emu/sdl.c | 12 +- grub-core/video/fb/fbblit.c | 78 +++++++- grub-core/video/fb/fbfill.c | 20 +- grub-core/video/fb/fbutil.c | 8 + grub-core/video/fb/video_fb.c | 280 ++++++++++++++++++++++++--- grub-core/video/i386/pc/vbe.c | 5 +- grub-core/video/ieee1275.c | 106 ++++++++-- grub-core/video/readers/jpeg.c | 13 ++ grub-core/video/readers/png.c | 61 +++++- grub-core/video/sis315pro.c | 4 +- include/grub/video_fb.h | 4 +- 18 files changed, 655 insertions(+), 72 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8525dd9be..3ff4a050a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-02 Vladimir Serbinenko + + Several fixes to ieee1275 and big-endian video. + 2013-05-02 Vladimir Serbinenko Add missing exports on mips. diff --git a/grub-core/tests/checksums.c b/grub-core/tests/checksums.c index 93d100fee..583c696d6 100644 --- a/grub-core/tests/checksums.c +++ b/grub-core/tests/checksums.c @@ -1,6 +1,9 @@ { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, }, 5 }, { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, }, 5 }, { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, }, 5 }, + { "videotest", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, }, 5 }, + { "videotest", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0x327d1082, 0x327d1082, 0x327d1082, 0x327d1082, 0x327d1082, }, 5 }, + { "videotest", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xadd0f186, 0xadd0f186, 0xadd0f186, 0xadd0f186, 0xadd0f186, }, 5 }, { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgb555 */, (grub_uint32_t []) { 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, }, 5 }, { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgb555 */, (grub_uint32_t []) { 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, }, 5 }, { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgb555 */, (grub_uint32_t []) { 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, }, 5 }, diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c index b2aab7929..cf47fa245 100644 --- a/grub-core/tests/video_checksum.c +++ b/grub-core/tests/video_checksum.c @@ -249,14 +249,16 @@ get_modename (void) } if (capt_mode_info.red_field_pos == 0) { - grub_snprintf (buf, sizeof (buf), "bgr%d%d%d", capt_mode_info.blue_mask_size, + grub_snprintf (buf, sizeof (buf), "bgra%d%d%d%d", capt_mode_info.blue_mask_size, capt_mode_info.green_mask_size, - capt_mode_info.red_mask_size); + capt_mode_info.red_mask_size, + capt_mode_info.reserved_mask_size); return buf; } - grub_snprintf (buf, sizeof (buf), "rgb%d%d%d", capt_mode_info.red_mask_size, + grub_snprintf (buf, sizeof (buf), "rgba%d%d%d%d", capt_mode_info.red_mask_size, capt_mode_info.green_mask_size, - capt_mode_info.blue_mask_size); + capt_mode_info.blue_mask_size, + capt_mode_info.reserved_mask_size); return buf; } @@ -270,11 +272,81 @@ static void checksum (void) { void *ptr; - grub_uint32_t crc; + grub_uint32_t crc = 0; ptr = grub_video_capture_get_framebuffer (); +#ifdef GRUB_CPU_WORDS_BIGENDIAN + switch (capt_mode_info.bytes_per_pixel) + { + case 1: + crc = grub_getcrc32c (0, ptr, capt_mode_info.pitch + * capt_mode_info.height); + break; + case 2: + { + unsigned x, y, rowskip; + grub_uint8_t *iptr = ptr; + crc = 0; + rowskip = capt_mode_info.pitch - capt_mode_info.width * 2; + for (y = 0; y < capt_mode_info.height; y++) + { + for (x = 0; x < capt_mode_info.width; x++) + { + crc = grub_getcrc32c (crc, iptr + 1, 1); + crc = grub_getcrc32c (crc, iptr, 1); + iptr += 2; + } + crc = grub_getcrc32c (crc, iptr, rowskip); + iptr += rowskip; + } + break; + } + case 3: + { + unsigned x, y, rowskip; + grub_uint8_t *iptr = ptr; + crc = 0; + rowskip = capt_mode_info.pitch - capt_mode_info.width * 3; + for (y = 0; y < capt_mode_info.height; y++) + { + for (x = 0; x < capt_mode_info.width; x++) + { + crc = grub_getcrc32c (crc, iptr + 2, 1); + crc = grub_getcrc32c (crc, iptr + 1, 1); + crc = grub_getcrc32c (crc, iptr, 1); + iptr += 3; + } + crc = grub_getcrc32c (crc, iptr, rowskip); + iptr += rowskip; + } + break; + } + case 4: + { + unsigned x, y, rowskip; + grub_uint8_t *iptr = ptr; + crc = 0; + rowskip = capt_mode_info.pitch - capt_mode_info.width * 4; + for (y = 0; y < capt_mode_info.height; y++) + { + for (x = 0; x < capt_mode_info.width; x++) + { + crc = grub_getcrc32c (crc, iptr + 3, 1); + crc = grub_getcrc32c (crc, iptr + 2, 1); + crc = grub_getcrc32c (crc, iptr + 1, 1); + crc = grub_getcrc32c (crc, iptr, 1); + iptr += 4; + } + crc = grub_getcrc32c (crc, iptr, rowskip); + iptr += rowskip; + } + break; + } + } +#else crc = grub_getcrc32c (0, ptr, capt_mode_info.pitch * capt_mode_info.height); +#endif if (!checksums || ctr >= nchk) { grub_test_assert (0, "Unexpected checksum %s_%dx%dx%s:%d: 0x%x", diff --git a/grub-core/tests/videotest_checksum.c b/grub-core/tests/videotest_checksum.c index 3c70f8c47..7833d04f4 100644 --- a/grub-core/tests/videotest_checksum.c +++ b/grub-core/tests/videotest_checksum.c @@ -63,6 +63,42 @@ struct .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS }, }, + + + { + .mode_info = { + .width = 640, + .height = 480, + .pitch = 640, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS + }, + }, + { + .mode_info = { + .width = 800, + .height = 600, + .pitch = 800, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS + }, + }, + { + .mode_info = { + .width = 1024, + .height = 768, + .pitch = 1024, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS + }, + }, + { .mode_info = { .width = 640, @@ -275,7 +311,7 @@ videotest_checksum (void) { grub_video_capture_start (&tests[i].mode_info, grub_video_fbstd_colors, - GRUB_VIDEO_FBSTD_NUMCOLORS); + tests[i].mode_info.number_of_colors); grub_terminal_input_fake_sequence ((int []) { '\n' }, 1); grub_video_checksum ("videotest"); diff --git a/grub-core/video/bochs.c b/grub-core/video/bochs.c index aea486c22..287ae0ff3 100644 --- a/grub-core/video/bochs.c +++ b/grub-core/video/bochs.c @@ -331,6 +331,7 @@ grub_video_bochs_setup (unsigned int width, unsigned int height, case 4: case 8: framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; + framebuffer.mode_info.number_of_colors = 16; break; case 16: framebuffer.mode_info.red_mask_size = 5; diff --git a/grub-core/video/cirrus.c b/grub-core/video/cirrus.c index 073c54e41..00e6516ac 100644 --- a/grub-core/video/cirrus.c +++ b/grub-core/video/cirrus.c @@ -295,15 +295,14 @@ grub_video_cirrus_setup (unsigned int width, unsigned int height, && !grub_video_check_mode_flag (mode_type, mode_mask, GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, 0)) depth = 24; - - if (depth == 0) + else if (depth == 0) depth = 8; if (depth != 32 && depth != 24 && depth != 16 && depth != 15 && depth != 8) return grub_error (GRUB_ERR_IO, "only 32, 24, 16, 15 and 8-bit bpp are" " supported by cirrus video"); - bytes_per_pixel = (depth + 7) / 8; + bytes_per_pixel = (depth + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT; pitch = width * bytes_per_pixel; if (pitch > CIRRUS_MAX_PITCH) @@ -411,6 +410,7 @@ grub_video_cirrus_setup (unsigned int width, unsigned int height, { case 8: framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; + framebuffer.mode_info.number_of_colors = 16; break; case 16: framebuffer.mode_info.red_mask_size = 5; diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c index 695f01578..159df8e61 100644 --- a/grub-core/video/efi_uga.c +++ b/grub-core/video/efi_uga.c @@ -247,7 +247,7 @@ grub_video_uga_setup (unsigned int width, unsigned int height, framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_RGB; framebuffer.mode_info.bpp = 32; framebuffer.mode_info.bytes_per_pixel = 4; - framebuffer.mode_info.number_of_colors = 256; /* TODO: fix me. */ + framebuffer.mode_info.number_of_colors = 256; framebuffer.mode_info.red_mask_size = 8; framebuffer.mode_info.red_field_pos = 16; framebuffer.mode_info.green_mask_size = 8; diff --git a/grub-core/video/emu/sdl.c b/grub-core/video/emu/sdl.c index f4c1a6ab6..6fd01be39 100644 --- a/grub-core/video/emu/sdl.c +++ b/grub-core/video/emu/sdl.c @@ -151,8 +151,7 @@ grub_video_sdl_setup (unsigned int width, unsigned int height, return err; /* Copy default palette to initialize emulated palette. */ - grub_video_sdl_set_palette (0, (sizeof (grub_video_fbstd_colors) - / sizeof (grub_video_fbstd_colors[0])), + grub_video_sdl_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS, grub_video_fbstd_colors); /* Reset render target to SDL one. */ @@ -166,7 +165,14 @@ grub_video_sdl_set_palette (unsigned int start, unsigned int count, unsigned i; if (window->format->palette) { - SDL_Color *tmp = grub_malloc (count * sizeof (tmp[0])); + SDL_Color *tmp; + if (start >= mode_info.number_of_colors) + return GRUB_ERR_NONE; + + if (start + count > mode_info.number_of_colors) + count = mode_info.number_of_colors - start; + + tmp = grub_malloc (count * sizeof (tmp[0])); for (i = 0; i < count; i++) { tmp[i].r = palette_data[i].r; diff --git a/grub-core/video/fb/fbblit.c b/grub-core/video/fb/fbblit.c index 4d262d710..13e2926bf 100644 --- a/grub-core/video/fb/fbblit.c +++ b/grub-core/video/fb/fbblit.c @@ -416,15 +416,25 @@ grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst, { for (i = 0; i < width; i++) { +#ifdef GRUB_CPU_WORDS_BIGENDIAN + grub_uint8_t a = *srcptr++; +#endif grub_uint8_t r = *srcptr++; grub_uint8_t g = *srcptr++; grub_uint8_t b = *srcptr++; +#ifndef GRUB_CPU_WORDS_BIGENDIAN grub_uint8_t a = *srcptr++; +#endif +#ifdef GRUB_CPU_WORDS_BIGENDIAN + *dstptr++ = a; +#endif *dstptr++ = b; *dstptr++ = g; *dstptr++ = r; +#ifndef GRUB_CPU_WORDS_BIGENDIAN *dstptr++ = a; +#endif } srcptr += srcrowskip; @@ -463,12 +473,19 @@ grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst, grub_uint8_t g = *srcptr++; grub_uint8_t b = *srcptr++; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + /* Set alpha component as opaque. */ + *dstptr++ = 255; +#endif + *dstptr++ = b; *dstptr++ = g; *dstptr++ = r; +#ifndef GRUB_CPU_WORDS_BIGENDIAN /* Set alpha component as opaque. */ *dstptr++ = 255; +#endif } srcptr += srcrowskip; @@ -514,9 +531,15 @@ grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst, sg = (color >> 8) & 0xFF; sb = (color >> 16) & 0xFF; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + *dstptr++ = sr; + *dstptr++ = sg; + *dstptr++ = sb; +#else *dstptr++ = sb; *dstptr++ = sg; *dstptr++ = sr; +#endif } GRUB_VIDEO_FB_ADVANCE_POINTER (srcptr, srcrowskip); @@ -593,10 +616,15 @@ grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst, { for (i = 0; i < width; i++) { +#ifdef GRUB_CPU_WORDS_BIGENDIAN + sb = *srcptr++; + sg = *srcptr++; + sr = *srcptr++; +#else sr = *srcptr++; sg = *srcptr++; sb = *srcptr++; - +#endif /* Set alpha as opaque. */ color = 0xFF000000 | (sb << 16) | (sg << 8) | sr; @@ -641,9 +669,15 @@ grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst, sg = (color >> 8) & 0xFF; sb = (color >> 16) & 0xFF; +#ifndef GRUB_CPU_WORDS_BIGENDIAN *dstptr++ = sr; *dstptr++ = sg; *dstptr++ = sb; +#else + *dstptr++ = sb; + *dstptr++ = sg; + *dstptr++ = sr; +#endif } GRUB_VIDEO_FB_ADVANCE_POINTER (srcptr, srcrowskip); GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip); @@ -681,9 +715,15 @@ grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst, { color = *srcptr++; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + sb = (color >> 0) & 0xFF; + sg = (color >> 8) & 0xFF; + sr = (color >> 16) & 0xFF; +#else sr = (color >> 0) & 0xFF; sg = (color >> 8) & 0xFF; sb = (color >> 16) & 0xFF; +#endif color = grub_video_fb_map_rgb(sr, sg, sb); *dstptr++ = color & 0xFF; @@ -722,9 +762,15 @@ grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst, { for (i = 0; i < width; i++) { +#ifndef GRUB_CPU_WORDS_BIGENDIAN sr = *srcptr++; sg = *srcptr++; sb = *srcptr++; +#else + sb = *srcptr++; + sg = *srcptr++; + sr = *srcptr++; +#endif color = grub_video_fb_map_rgb(sr, sg, sb); @@ -948,9 +994,15 @@ grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst, dr = (dr * (255 - a) + sr * a) / 255; } +#ifndef GRUB_CPU_WORDS_BIGENDIAN *dstptr++ = db; *dstptr++ = dg; *dstptr++ = dr; +#else + *dstptr++ = dr; + *dstptr++ = dg; + *dstptr++ = db; +#endif } GRUB_VIDEO_FB_ADVANCE_POINTER (srcptr, srcrowskip); @@ -1079,24 +1131,42 @@ grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst, if (a == 255) { +#ifndef GRUB_CPU_WORDS_BIGENDIAN *dstptr++ = sr; *dstptr++ = sg; *dstptr++ = sb; +#else + *dstptr++ = sb; + *dstptr++ = sg; + *dstptr++ = sr; +#endif continue; } +#ifndef GRUB_CPU_WORDS_BIGENDIAN + db = dstptr[0]; + dg = dstptr[1]; + dr = dstptr[2]; +#else dr = dstptr[0]; dg = dstptr[1]; db = dstptr[2]; +#endif dr = (dr * (255 - a) + sr * a) / 255; dg = (dg * (255 - a) + sg * a) / 255; db = (db * (255 - a) + sb * a) / 255; +#ifndef GRUB_CPU_WORDS_BIGENDIAN *dstptr++ = dr; *dstptr++ = dg; *dstptr++ = db; +#else + *dstptr++ = db; + *dstptr++ = dg; + *dstptr++ = dr; +#endif } GRUB_VIDEO_FB_ADVANCE_POINTER (srcptr, srcrowskip); GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip); @@ -1330,9 +1400,15 @@ grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst, if (a == 255) { +#ifndef GRUB_CPU_WORDS_BIGENDIAN ((grub_uint8_t *) dstptr)[0] = color & 0xff; ((grub_uint8_t *) dstptr)[1] = (color & 0xff00) >> 8; ((grub_uint8_t *) dstptr)[2] = (color & 0xff0000) >> 16; +#else + ((grub_uint8_t *) dstptr)[2] = color & 0xff; + ((grub_uint8_t *) dstptr)[1] = (color & 0xff00) >> 8; + ((grub_uint8_t *) dstptr)[0] = (color & 0xff0000) >> 16; +#endif } else if (a != 0) { diff --git a/grub-core/video/fb/fbfill.c b/grub-core/video/fb/fbfill.c index 5f3e55fae..74b157bea 100644 --- a/grub-core/video/fb/fbfill.c +++ b/grub-core/video/fb/fbfill.c @@ -87,10 +87,15 @@ grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst, int j; grub_size_t rowskip; grub_uint8_t *dstptr; +#ifndef GRUB_CPU_WORDS_BIGENDIAN grub_uint8_t fill0 = (grub_uint8_t)((color >> 0) & 0xFF); grub_uint8_t fill1 = (grub_uint8_t)((color >> 8) & 0xFF); grub_uint8_t fill2 = (grub_uint8_t)((color >> 16) & 0xFF); - +#else + grub_uint8_t fill2 = (grub_uint8_t)((color >> 0) & 0xFF); + grub_uint8_t fill1 = (grub_uint8_t)((color >> 8) & 0xFF); + grub_uint8_t fill0 = (grub_uint8_t)((color >> 16) & 0xFF); +#endif /* Calculate the number of bytes to advance from the end of one line to the beginning of the next line. */ rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; @@ -122,13 +127,11 @@ grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst, int i; int j; grub_size_t rowskip; - grub_uint8_t *dstptr; - grub_uint8_t fill0 = (grub_uint8_t)((color >> 0) & 0xFF); - grub_uint8_t fill1 = (grub_uint8_t)((color >> 8) & 0xFF); + grub_uint16_t *dstptr; /* Calculate the number of bytes to advance from the end of one line to the beginning of the next line. */ - rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + rowskip = (dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width); /* Get the start address. */ dstptr = grub_video_fb_get_video_ptr (dst, x, y); @@ -136,13 +139,10 @@ grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst, for (j = 0; j < height; j++) { for (i = 0; i < width; i++) - { - *dstptr++ = fill0; - *dstptr++ = fill1; - } + *dstptr++ = color; /* Advance the dest pointer to the right location on the next line. */ - dstptr += rowskip; + GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, rowskip); } } diff --git a/grub-core/video/fb/fbutil.c b/grub-core/video/fb/fbutil.c index c7fb08702..81b3860ac 100644 --- a/grub-core/video/fb/fbutil.c +++ b/grub-core/video/fb/fbutil.c @@ -82,7 +82,11 @@ get_pixel (struct grub_video_fbblit_info *source, { grub_uint8_t *ptr; ptr = grub_video_fb_get_video_ptr (source, x, y); +#ifdef GRUB_CPU_WORDS_BIGENDIAN + color = ptr[2] | (ptr[1] << 8) | (ptr[0] << 16); +#else color = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16); +#endif } break; @@ -131,7 +135,11 @@ set_pixel (struct grub_video_fbblit_info *source, case 24: { grub_uint8_t *ptr; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + grub_uint8_t *colorptr = ((grub_uint8_t *)&color) + 1; +#else grub_uint8_t *colorptr = (grub_uint8_t *)&color; +#endif ptr = grub_video_fb_get_video_ptr (source, x, y); diff --git a/grub-core/video/fb/video_fb.c b/grub-core/video/fb/video_fb.c index cfe441f42..836842e15 100644 --- a/grub-core/video/fb/video_fb.c +++ b/grub-core/video/fb/video_fb.c @@ -59,8 +59,10 @@ static struct /* Specify "standard" VGA palette, some video cards may need this and this will also be used when using RGB modes. */ -struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLORS] = +struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_EXT_NUMCOLORS] = { + /* Standard (3-bit) colors. */ + // {R, G, B, A} {0x00, 0x00, 0x00, 0xFF}, // 0 = black {0x00, 0x00, 0xA8, 0xFF}, // 1 = blue @@ -71,6 +73,7 @@ struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLOR {0xA8, 0x54, 0x00, 0xFF}, // 6 = brown {0xA8, 0xA8, 0xA8, 0xFF}, // 7 = light gray + /* Bright (4-bit) colors. */ {0x54, 0x54, 0x54, 0xFF}, // 8 = dark gray {0x54, 0x54, 0xFE, 0xFF}, // 9 = bright blue {0x54, 0xFE, 0x54, 0xFF}, // 10 = bright green @@ -78,7 +81,249 @@ struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLOR {0xFE, 0x54, 0x54, 0xFF}, // 12 = bright red {0xFE, 0x54, 0xFE, 0xFF}, // 13 = bright magenta {0xFE, 0xFE, 0x54, 0xFF}, // 14 = yellow - {0xFE, 0xFE, 0xFE, 0xFF} // 15 = white + {0xFE, 0xFE, 0xFE, 0xFF}, // 15 = white + + /* Extended (8-bit) colors. Completes preceding colors to full RGB332. */ + {0x00, 0x00, 0x55, 0xFF}, // RGB332 = (0, 0, 1) + {0x00, 0x00, 0xFF, 0xFF}, // RGB332 = (0, 0, 3) + {0x00, 0x24, 0x00, 0xFF}, // RGB332 = (0, 1, 0) + {0x00, 0x24, 0x55, 0xFF}, // RGB332 = (0, 1, 1) + {0x00, 0x24, 0xAA, 0xFF}, // RGB332 = (0, 1, 2) + {0x00, 0x24, 0xFF, 0xFF}, // RGB332 = (0, 1, 3) + {0x00, 0x48, 0x00, 0xFF}, // RGB332 = (0, 2, 0) + {0x00, 0x48, 0x55, 0xFF}, // RGB332 = (0, 2, 1) + {0x00, 0x48, 0xAA, 0xFF}, // RGB332 = (0, 2, 2) + {0x00, 0x48, 0xFF, 0xFF}, // RGB332 = (0, 2, 3) + {0x00, 0x6C, 0x00, 0xFF}, // RGB332 = (0, 3, 0) + {0x00, 0x6C, 0x55, 0xFF}, // RGB332 = (0, 3, 1) + {0x00, 0x6C, 0xAA, 0xFF}, // RGB332 = (0, 3, 2) + {0x00, 0x6C, 0xFF, 0xFF}, // RGB332 = (0, 3, 3) + {0x00, 0x90, 0x00, 0xFF}, // RGB332 = (0, 4, 0) + {0x00, 0x90, 0x55, 0xFF}, // RGB332 = (0, 4, 1) + {0x00, 0x90, 0xAA, 0xFF}, // RGB332 = (0, 4, 2) + {0x00, 0x90, 0xFF, 0xFF}, // RGB332 = (0, 4, 3) + {0x00, 0xB4, 0x55, 0xFF}, // RGB332 = (0, 5, 1) + {0x00, 0xB4, 0xFF, 0xFF}, // RGB332 = (0, 5, 3) + {0x00, 0xD8, 0x00, 0xFF}, // RGB332 = (0, 6, 0) + {0x00, 0xD8, 0x55, 0xFF}, // RGB332 = (0, 6, 1) + {0x00, 0xD8, 0xAA, 0xFF}, // RGB332 = (0, 6, 2) + {0x00, 0xD8, 0xFF, 0xFF}, // RGB332 = (0, 6, 3) + {0x00, 0xFC, 0x00, 0xFF}, // RGB332 = (0, 7, 0) + {0x00, 0xFC, 0x55, 0xFF}, // RGB332 = (0, 7, 1) + {0x00, 0xFC, 0xAA, 0xFF}, // RGB332 = (0, 7, 2) + {0x00, 0xFC, 0xFF, 0xFF}, // RGB332 = (0, 7, 3) + {0x24, 0x00, 0x00, 0xFF}, // RGB332 = (1, 0, 0) + {0x24, 0x00, 0x55, 0xFF}, // RGB332 = (1, 0, 1) + {0x24, 0x00, 0xAA, 0xFF}, // RGB332 = (1, 0, 2) + {0x24, 0x00, 0xFF, 0xFF}, // RGB332 = (1, 0, 3) + {0x24, 0x24, 0x00, 0xFF}, // RGB332 = (1, 1, 0) + {0x24, 0x24, 0x55, 0xFF}, // RGB332 = (1, 1, 1) + {0x24, 0x24, 0xAA, 0xFF}, // RGB332 = (1, 1, 2) + {0x24, 0x24, 0xFF, 0xFF}, // RGB332 = (1, 1, 3) + {0x24, 0x48, 0x00, 0xFF}, // RGB332 = (1, 2, 0) + {0x24, 0x48, 0x55, 0xFF}, // RGB332 = (1, 2, 1) + {0x24, 0x48, 0xAA, 0xFF}, // RGB332 = (1, 2, 2) + {0x24, 0x48, 0xFF, 0xFF}, // RGB332 = (1, 2, 3) + {0x24, 0x6C, 0x00, 0xFF}, // RGB332 = (1, 3, 0) + {0x24, 0x6C, 0x55, 0xFF}, // RGB332 = (1, 3, 1) + {0x24, 0x6C, 0xAA, 0xFF}, // RGB332 = (1, 3, 2) + {0x24, 0x6C, 0xFF, 0xFF}, // RGB332 = (1, 3, 3) + {0x24, 0x90, 0x00, 0xFF}, // RGB332 = (1, 4, 0) + {0x24, 0x90, 0x55, 0xFF}, // RGB332 = (1, 4, 1) + {0x24, 0x90, 0xAA, 0xFF}, // RGB332 = (1, 4, 2) + {0x24, 0x90, 0xFF, 0xFF}, // RGB332 = (1, 4, 3) + {0x24, 0xB4, 0x00, 0xFF}, // RGB332 = (1, 5, 0) + {0x24, 0xB4, 0x55, 0xFF}, // RGB332 = (1, 5, 1) + {0x24, 0xB4, 0xAA, 0xFF}, // RGB332 = (1, 5, 2) + {0x24, 0xB4, 0xFF, 0xFF}, // RGB332 = (1, 5, 3) + {0x24, 0xD8, 0x00, 0xFF}, // RGB332 = (1, 6, 0) + {0x24, 0xD8, 0x55, 0xFF}, // RGB332 = (1, 6, 1) + {0x24, 0xD8, 0xAA, 0xFF}, // RGB332 = (1, 6, 2) + {0x24, 0xD8, 0xFF, 0xFF}, // RGB332 = (1, 6, 3) + {0x24, 0xFC, 0x00, 0xFF}, // RGB332 = (1, 7, 0) + {0x24, 0xFC, 0x55, 0xFF}, // RGB332 = (1, 7, 1) + {0x24, 0xFC, 0xAA, 0xFF}, // RGB332 = (1, 7, 2) + {0x24, 0xFC, 0xFF, 0xFF}, // RGB332 = (1, 7, 3) + {0x48, 0x00, 0x00, 0xFF}, // RGB332 = (2, 0, 0) + {0x48, 0x00, 0x55, 0xFF}, // RGB332 = (2, 0, 1) + {0x48, 0x00, 0xAA, 0xFF}, // RGB332 = (2, 0, 2) + {0x48, 0x00, 0xFF, 0xFF}, // RGB332 = (2, 0, 3) + {0x48, 0x24, 0x00, 0xFF}, // RGB332 = (2, 1, 0) + {0x48, 0x24, 0x55, 0xFF}, // RGB332 = (2, 1, 1) + {0x48, 0x24, 0xAA, 0xFF}, // RGB332 = (2, 1, 2) + {0x48, 0x24, 0xFF, 0xFF}, // RGB332 = (2, 1, 3) + {0x48, 0x48, 0x00, 0xFF}, // RGB332 = (2, 2, 0) + {0x48, 0x48, 0xAA, 0xFF}, // RGB332 = (2, 2, 2) + {0x48, 0x6C, 0x00, 0xFF}, // RGB332 = (2, 3, 0) + {0x48, 0x6C, 0x55, 0xFF}, // RGB332 = (2, 3, 1) + {0x48, 0x6C, 0xAA, 0xFF}, // RGB332 = (2, 3, 2) + {0x48, 0x6C, 0xFF, 0xFF}, // RGB332 = (2, 3, 3) + {0x48, 0x90, 0x00, 0xFF}, // RGB332 = (2, 4, 0) + {0x48, 0x90, 0x55, 0xFF}, // RGB332 = (2, 4, 1) + {0x48, 0x90, 0xAA, 0xFF}, // RGB332 = (2, 4, 2) + {0x48, 0x90, 0xFF, 0xFF}, // RGB332 = (2, 4, 3) + {0x48, 0xB4, 0x00, 0xFF}, // RGB332 = (2, 5, 0) + {0x48, 0xB4, 0x55, 0xFF}, // RGB332 = (2, 5, 1) + {0x48, 0xB4, 0xAA, 0xFF}, // RGB332 = (2, 5, 2) + {0x48, 0xB4, 0xFF, 0xFF}, // RGB332 = (2, 5, 3) + {0x48, 0xD8, 0x00, 0xFF}, // RGB332 = (2, 6, 0) + {0x48, 0xD8, 0x55, 0xFF}, // RGB332 = (2, 6, 1) + {0x48, 0xD8, 0xAA, 0xFF}, // RGB332 = (2, 6, 2) + {0x48, 0xD8, 0xFF, 0xFF}, // RGB332 = (2, 6, 3) + {0x48, 0xFC, 0x00, 0xFF}, // RGB332 = (2, 7, 0) + {0x48, 0xFC, 0xAA, 0xFF}, // RGB332 = (2, 7, 2) + {0x6C, 0x00, 0x00, 0xFF}, // RGB332 = (3, 0, 0) + {0x6C, 0x00, 0x55, 0xFF}, // RGB332 = (3, 0, 1) + {0x6C, 0x00, 0xAA, 0xFF}, // RGB332 = (3, 0, 2) + {0x6C, 0x00, 0xFF, 0xFF}, // RGB332 = (3, 0, 3) + {0x6C, 0x24, 0x00, 0xFF}, // RGB332 = (3, 1, 0) + {0x6C, 0x24, 0x55, 0xFF}, // RGB332 = (3, 1, 1) + {0x6C, 0x24, 0xAA, 0xFF}, // RGB332 = (3, 1, 2) + {0x6C, 0x24, 0xFF, 0xFF}, // RGB332 = (3, 1, 3) + {0x6C, 0x48, 0x00, 0xFF}, // RGB332 = (3, 2, 0) + {0x6C, 0x48, 0x55, 0xFF}, // RGB332 = (3, 2, 1) + {0x6C, 0x48, 0xAA, 0xFF}, // RGB332 = (3, 2, 2) + {0x6C, 0x48, 0xFF, 0xFF}, // RGB332 = (3, 2, 3) + {0x6C, 0x6C, 0x00, 0xFF}, // RGB332 = (3, 3, 0) + {0x6C, 0x6C, 0x55, 0xFF}, // RGB332 = (3, 3, 1) + {0x6C, 0x6C, 0xAA, 0xFF}, // RGB332 = (3, 3, 2) + {0x6C, 0x6C, 0xFF, 0xFF}, // RGB332 = (3, 3, 3) + {0x6C, 0x90, 0x00, 0xFF}, // RGB332 = (3, 4, 0) + {0x6C, 0x90, 0x55, 0xFF}, // RGB332 = (3, 4, 1) + {0x6C, 0x90, 0xAA, 0xFF}, // RGB332 = (3, 4, 2) + {0x6C, 0x90, 0xFF, 0xFF}, // RGB332 = (3, 4, 3) + {0x6C, 0xB4, 0x00, 0xFF}, // RGB332 = (3, 5, 0) + {0x6C, 0xB4, 0x55, 0xFF}, // RGB332 = (3, 5, 1) + {0x6C, 0xB4, 0xAA, 0xFF}, // RGB332 = (3, 5, 2) + {0x6C, 0xB4, 0xFF, 0xFF}, // RGB332 = (3, 5, 3) + {0x6C, 0xD8, 0x00, 0xFF}, // RGB332 = (3, 6, 0) + {0x6C, 0xD8, 0x55, 0xFF}, // RGB332 = (3, 6, 1) + {0x6C, 0xD8, 0xAA, 0xFF}, // RGB332 = (3, 6, 2) + {0x6C, 0xD8, 0xFF, 0xFF}, // RGB332 = (3, 6, 3) + {0x6C, 0xFC, 0x00, 0xFF}, // RGB332 = (3, 7, 0) + {0x6C, 0xFC, 0x55, 0xFF}, // RGB332 = (3, 7, 1) + {0x6C, 0xFC, 0xAA, 0xFF}, // RGB332 = (3, 7, 2) + {0x6C, 0xFC, 0xFF, 0xFF}, // RGB332 = (3, 7, 3) + {0x90, 0x00, 0x00, 0xFF}, // RGB332 = (4, 0, 0) + {0x90, 0x00, 0x55, 0xFF}, // RGB332 = (4, 0, 1) + {0x90, 0x00, 0xAA, 0xFF}, // RGB332 = (4, 0, 2) + {0x90, 0x00, 0xFF, 0xFF}, // RGB332 = (4, 0, 3) + {0x90, 0x24, 0x00, 0xFF}, // RGB332 = (4, 1, 0) + {0x90, 0x24, 0x55, 0xFF}, // RGB332 = (4, 1, 1) + {0x90, 0x24, 0xAA, 0xFF}, // RGB332 = (4, 1, 2) + {0x90, 0x24, 0xFF, 0xFF}, // RGB332 = (4, 1, 3) + {0x90, 0x48, 0x00, 0xFF}, // RGB332 = (4, 2, 0) + {0x90, 0x48, 0x55, 0xFF}, // RGB332 = (4, 2, 1) + {0x90, 0x48, 0xAA, 0xFF}, // RGB332 = (4, 2, 2) + {0x90, 0x48, 0xFF, 0xFF}, // RGB332 = (4, 2, 3) + {0x90, 0x6C, 0x00, 0xFF}, // RGB332 = (4, 3, 0) + {0x90, 0x6C, 0x55, 0xFF}, // RGB332 = (4, 3, 1) + {0x90, 0x6C, 0xAA, 0xFF}, // RGB332 = (4, 3, 2) + {0x90, 0x6C, 0xFF, 0xFF}, // RGB332 = (4, 3, 3) + {0x90, 0x90, 0x00, 0xFF}, // RGB332 = (4, 4, 0) + {0x90, 0x90, 0x55, 0xFF}, // RGB332 = (4, 4, 1) + {0x90, 0x90, 0xAA, 0xFF}, // RGB332 = (4, 4, 2) + {0x90, 0x90, 0xFF, 0xFF}, // RGB332 = (4, 4, 3) + {0x90, 0xB4, 0x00, 0xFF}, // RGB332 = (4, 5, 0) + {0x90, 0xB4, 0x55, 0xFF}, // RGB332 = (4, 5, 1) + {0x90, 0xB4, 0xAA, 0xFF}, // RGB332 = (4, 5, 2) + {0x90, 0xB4, 0xFF, 0xFF}, // RGB332 = (4, 5, 3) + {0x90, 0xD8, 0x00, 0xFF}, // RGB332 = (4, 6, 0) + {0x90, 0xD8, 0x55, 0xFF}, // RGB332 = (4, 6, 1) + {0x90, 0xD8, 0xAA, 0xFF}, // RGB332 = (4, 6, 2) + {0x90, 0xD8, 0xFF, 0xFF}, // RGB332 = (4, 6, 3) + {0x90, 0xFC, 0x00, 0xFF}, // RGB332 = (4, 7, 0) + {0x90, 0xFC, 0x55, 0xFF}, // RGB332 = (4, 7, 1) + {0x90, 0xFC, 0xAA, 0xFF}, // RGB332 = (4, 7, 2) + {0x90, 0xFC, 0xFF, 0xFF}, // RGB332 = (4, 7, 3) + {0xB4, 0x00, 0x55, 0xFF}, // RGB332 = (5, 0, 1) + {0xB4, 0x00, 0xFF, 0xFF}, // RGB332 = (5, 0, 3) + {0xB4, 0x24, 0x00, 0xFF}, // RGB332 = (5, 1, 0) + {0xB4, 0x24, 0x55, 0xFF}, // RGB332 = (5, 1, 1) + {0xB4, 0x24, 0xAA, 0xFF}, // RGB332 = (5, 1, 2) + {0xB4, 0x24, 0xFF, 0xFF}, // RGB332 = (5, 1, 3) + {0xB4, 0x48, 0x55, 0xFF}, // RGB332 = (5, 2, 1) + {0xB4, 0x48, 0xAA, 0xFF}, // RGB332 = (5, 2, 2) + {0xB4, 0x48, 0xFF, 0xFF}, // RGB332 = (5, 2, 3) + {0xB4, 0x6C, 0x00, 0xFF}, // RGB332 = (5, 3, 0) + {0xB4, 0x6C, 0x55, 0xFF}, // RGB332 = (5, 3, 1) + {0xB4, 0x6C, 0xAA, 0xFF}, // RGB332 = (5, 3, 2) + {0xB4, 0x6C, 0xFF, 0xFF}, // RGB332 = (5, 3, 3) + {0xB4, 0x90, 0x00, 0xFF}, // RGB332 = (5, 4, 0) + {0xB4, 0x90, 0x55, 0xFF}, // RGB332 = (5, 4, 1) + {0xB4, 0x90, 0xAA, 0xFF}, // RGB332 = (5, 4, 2) + {0xB4, 0x90, 0xFF, 0xFF}, // RGB332 = (5, 4, 3) + {0xB4, 0xB4, 0x00, 0xFF}, // RGB332 = (5, 5, 0) + {0xB4, 0xB4, 0x55, 0xFF}, // RGB332 = (5, 5, 1) + {0xB4, 0xB4, 0xFF, 0xFF}, // RGB332 = (5, 5, 3) + {0xB4, 0xD8, 0x00, 0xFF}, // RGB332 = (5, 6, 0) + {0xB4, 0xD8, 0x55, 0xFF}, // RGB332 = (5, 6, 1) + {0xB4, 0xD8, 0xAA, 0xFF}, // RGB332 = (5, 6, 2) + {0xB4, 0xD8, 0xFF, 0xFF}, // RGB332 = (5, 6, 3) + {0xB4, 0xFC, 0x00, 0xFF}, // RGB332 = (5, 7, 0) + {0xB4, 0xFC, 0x55, 0xFF}, // RGB332 = (5, 7, 1) + {0xB4, 0xFC, 0xAA, 0xFF}, // RGB332 = (5, 7, 2) + {0xB4, 0xFC, 0xFF, 0xFF}, // RGB332 = (5, 7, 3) + {0xD8, 0x00, 0x00, 0xFF}, // RGB332 = (6, 0, 0) + {0xD8, 0x00, 0x55, 0xFF}, // RGB332 = (6, 0, 1) + {0xD8, 0x00, 0xAA, 0xFF}, // RGB332 = (6, 0, 2) + {0xD8, 0x00, 0xFF, 0xFF}, // RGB332 = (6, 0, 3) + {0xD8, 0x24, 0x00, 0xFF}, // RGB332 = (6, 1, 0) + {0xD8, 0x24, 0x55, 0xFF}, // RGB332 = (6, 1, 1) + {0xD8, 0x24, 0xAA, 0xFF}, // RGB332 = (6, 1, 2) + {0xD8, 0x24, 0xFF, 0xFF}, // RGB332 = (6, 1, 3) + {0xD8, 0x48, 0x00, 0xFF}, // RGB332 = (6, 2, 0) + {0xD8, 0x48, 0x55, 0xFF}, // RGB332 = (6, 2, 1) + {0xD8, 0x48, 0xAA, 0xFF}, // RGB332 = (6, 2, 2) + {0xD8, 0x48, 0xFF, 0xFF}, // RGB332 = (6, 2, 3) + {0xD8, 0x6C, 0x00, 0xFF}, // RGB332 = (6, 3, 0) + {0xD8, 0x6C, 0x55, 0xFF}, // RGB332 = (6, 3, 1) + {0xD8, 0x6C, 0xAA, 0xFF}, // RGB332 = (6, 3, 2) + {0xD8, 0x6C, 0xFF, 0xFF}, // RGB332 = (6, 3, 3) + {0xD8, 0x90, 0x00, 0xFF}, // RGB332 = (6, 4, 0) + {0xD8, 0x90, 0x55, 0xFF}, // RGB332 = (6, 4, 1) + {0xD8, 0x90, 0xAA, 0xFF}, // RGB332 = (6, 4, 2) + {0xD8, 0x90, 0xFF, 0xFF}, // RGB332 = (6, 4, 3) + {0xD8, 0xB4, 0x00, 0xFF}, // RGB332 = (6, 5, 0) + {0xD8, 0xB4, 0x55, 0xFF}, // RGB332 = (6, 5, 1) + {0xD8, 0xB4, 0xAA, 0xFF}, // RGB332 = (6, 5, 2) + {0xD8, 0xB4, 0xFF, 0xFF}, // RGB332 = (6, 5, 3) + {0xD8, 0xD8, 0x00, 0xFF}, // RGB332 = (6, 6, 0) + {0xD8, 0xD8, 0x55, 0xFF}, // RGB332 = (6, 6, 1) + {0xD8, 0xD8, 0xAA, 0xFF}, // RGB332 = (6, 6, 2) + {0xD8, 0xD8, 0xFF, 0xFF}, // RGB332 = (6, 6, 3) + {0xD8, 0xFC, 0x00, 0xFF}, // RGB332 = (6, 7, 0) + {0xD8, 0xFC, 0x55, 0xFF}, // RGB332 = (6, 7, 1) + {0xD8, 0xFC, 0xAA, 0xFF}, // RGB332 = (6, 7, 2) + {0xD8, 0xFC, 0xFF, 0xFF}, // RGB332 = (6, 7, 3) + {0xFC, 0x00, 0x00, 0xFF}, // RGB332 = (7, 0, 0) + {0xFC, 0x00, 0x55, 0xFF}, // RGB332 = (7, 0, 1) + {0xFC, 0x00, 0xAA, 0xFF}, // RGB332 = (7, 0, 2) + {0xFC, 0x00, 0xFF, 0xFF}, // RGB332 = (7, 0, 3) + {0xFC, 0x24, 0x00, 0xFF}, // RGB332 = (7, 1, 0) + {0xFC, 0x24, 0x55, 0xFF}, // RGB332 = (7, 1, 1) + {0xFC, 0x24, 0xAA, 0xFF}, // RGB332 = (7, 1, 2) + {0xFC, 0x24, 0xFF, 0xFF}, // RGB332 = (7, 1, 3) + {0xFC, 0x48, 0x00, 0xFF}, // RGB332 = (7, 2, 0) + {0xFC, 0x48, 0xAA, 0xFF}, // RGB332 = (7, 2, 2) + {0xFC, 0x6C, 0x00, 0xFF}, // RGB332 = (7, 3, 0) + {0xFC, 0x6C, 0x55, 0xFF}, // RGB332 = (7, 3, 1) + {0xFC, 0x6C, 0xAA, 0xFF}, // RGB332 = (7, 3, 2) + {0xFC, 0x6C, 0xFF, 0xFF}, // RGB332 = (7, 3, 3) + {0xFC, 0x90, 0x00, 0xFF}, // RGB332 = (7, 4, 0) + {0xFC, 0x90, 0x55, 0xFF}, // RGB332 = (7, 4, 1) + {0xFC, 0x90, 0xAA, 0xFF}, // RGB332 = (7, 4, 2) + {0xFC, 0x90, 0xFF, 0xFF}, // RGB332 = (7, 4, 3) + {0xFC, 0xB4, 0x00, 0xFF}, // RGB332 = (7, 5, 0) + {0xFC, 0xB4, 0x55, 0xFF}, // RGB332 = (7, 5, 1) + {0xFC, 0xB4, 0xAA, 0xFF}, // RGB332 = (7, 5, 2) + {0xFC, 0xB4, 0xFF, 0xFF}, // RGB332 = (7, 5, 3) + {0xFC, 0xD8, 0x00, 0xFF}, // RGB332 = (7, 6, 0) + {0xFC, 0xD8, 0x55, 0xFF}, // RGB332 = (7, 6, 1) + {0xFC, 0xD8, 0xAA, 0xFF}, // RGB332 = (7, 6, 2) + {0xFC, 0xD8, 0xFF, 0xFF}, // RGB332 = (7, 6, 3) + {0xFC, 0xFC, 0x00, 0xFF}, // RGB332 = (7, 7, 0) + {0xFC, 0xFC, 0xAA, 0xFF}, // RGB332 = (7, 7, 2) }; grub_err_t @@ -487,38 +732,21 @@ grub_video_fb_fill_rect (grub_video_color_t color, int x, int y, /* Try to figure out more optimized version. Note that color is already mapped to target format so we can make assumptions based on that. */ - if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888) + switch (target.mode_info->bytes_per_pixel) { + case 4: grub_video_fbfill_direct32 (&target, color, x, y, - width, height); + width, height); return GRUB_ERR_NONE; - } - else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888) - { - grub_video_fbfill_direct32 (&target, color, x, y, - width, height); - return GRUB_ERR_NONE; - } - else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_888) - { + case 3: grub_video_fbfill_direct24 (&target, color, x, y, - width, height); + width, height); return GRUB_ERR_NONE; - } - else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_565) - { + case 2: grub_video_fbfill_direct16 (&target, color, x, y, width, height); return GRUB_ERR_NONE; - } - else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGR_565) - { - grub_video_fbfill_direct16 (&target, color, x, y, - width, height); - return GRUB_ERR_NONE; - } - else if (target.mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR) - { + case 1: grub_video_fbfill_direct8 (&target, color, x, y, width, height); return GRUB_ERR_NONE; diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c index f112f1567..6f7ede1fc 100644 --- a/grub-core/video/i386/pc/vbe.c +++ b/grub-core/video/i386/pc/vbe.c @@ -938,7 +938,10 @@ vbe2videoinfo (grub_uint32_t mode, else mode_info->pitch = vbeinfo->bytes_per_scan_line; - mode_info->number_of_colors = 256; /* TODO: fix me. */ + if (mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) + mode_info->number_of_colors = 16; + else + mode_info->number_of_colors = 256; mode_info->red_mask_size = vbeinfo->red_mask_size; mode_info->red_field_pos = vbeinfo->red_field_position; mode_info->green_mask_size = vbeinfo->green_mask_size; diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c index 5830b68f8..5c5870278 100644 --- a/grub-core/video/ieee1275.c +++ b/grub-core/video/ieee1275.c @@ -43,6 +43,20 @@ static struct grub_uint8_t *ptr; } framebuffer; +static struct grub_video_palette_data serial_colors[] = + { + // {R, G, B} + {0x00, 0x00, 0x00, 0xFF}, // 0 = black + {0xA8, 0x00, 0x00, 0xFF}, // 1 = red + {0x00, 0xA8, 0x00, 0xFF}, // 2 = green + {0xFE, 0xFE, 0x54, 0xFF}, // 3 = yellow + {0x00, 0x00, 0xA8, 0xFF}, // 4 = blue + {0xA8, 0x00, 0xA8, 0xFF}, // 5 = magenta + {0x00, 0xA8, 0xA8, 0xFF}, // 6 = cyan + {0xFE, 0xFE, 0xFE, 0xFF} // 7 = white + }; + + static grub_err_t grub_video_ieee1275_set_palette (unsigned int start, unsigned int count, struct grub_video_palette_data *palette_data); @@ -123,11 +137,63 @@ grub_video_ieee1275_fill_mode_info (grub_ieee1275_phandle_t dev, return grub_error (GRUB_ERR_IO, "Couldn't retrieve display pitch."); out->pitch = tmp; - out->mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; - out->bpp = 8; - out->bytes_per_pixel = 1; + if (grub_ieee1275_get_integer_property (dev, "depth", &tmp, + sizeof (tmp), 0)) + tmp = 4; + + out->mode_type = GRUB_VIDEO_MODE_TYPE_RGB; + out->bpp = tmp; + out->bytes_per_pixel = (out->bpp + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT; out->number_of_colors = 256; + switch (tmp) + { + case 4: + case 8: + out->mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR; + out->bpp = 8; + if (have_setcolors) + out->number_of_colors = 1 << tmp; + else + out->number_of_colors = 8; + break; + + /* FIXME: we may need byteswapping for the following. Currently it + was seen only on qemu and no byteswap was needed. */ + case 15: + out->red_mask_size = 5; + out->red_field_pos = 10; + out->green_mask_size = 5; + out->green_field_pos = 5; + out->blue_mask_size = 5; + out->blue_field_pos = 0; + break; + + case 16: + out->red_mask_size = 5; + out->red_field_pos = 11; + out->green_mask_size = 6; + out->green_field_pos = 5; + out->blue_mask_size = 5; + out->blue_field_pos = 0; + break; + + case 32: + out->reserved_mask_size = 8; + out->reserved_field_pos = 24; + + case 24: + out->red_mask_size = 8; + out->red_field_pos = 16; + out->green_mask_size = 8; + out->green_field_pos = 8; + out->blue_mask_size = 8; + out->blue_field_pos = 0; + break; + default: + return grub_error (GRUB_ERR_IO, "unsupported video depth %d", tmp); + } + out->blit_format = grub_video_get_blit_format (out); return GRUB_ERR_NONE; } @@ -192,7 +258,7 @@ grub_video_ieee1275_setup (unsigned int width, unsigned int height, if (err) return err; - grub_video_ieee1275_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS, + grub_video_ieee1275_set_palette (0, framebuffer.mode_info.number_of_colors, grub_video_fbstd_colors); return err; @@ -214,25 +280,35 @@ static grub_err_t grub_video_ieee1275_set_palette (unsigned int start, unsigned int count, struct grub_video_palette_data *palette_data) { - grub_err_t err; + unsigned col; struct grub_video_palette_data fb_palette_data[256]; + grub_err_t err; + + if (!(framebuffer.mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR)) + return grub_video_fb_set_palette (start, count, palette_data); + + if (!have_setcolors) + return grub_video_fb_set_palette (0, ARRAY_SIZE (serial_colors), + serial_colors); + + if (start >= framebuffer.mode_info.number_of_colors) + return GRUB_ERR_NONE; + + if (start + count > framebuffer.mode_info.number_of_colors) + count = framebuffer.mode_info.number_of_colors - start; err = grub_video_fb_set_palette (start, count, palette_data); if (err) return err; - grub_video_fb_get_palette (0, ARRAY_SIZE (fb_palette_data), fb_palette_data); - /* Set colors. */ - if (have_setcolors) - { - unsigned col; - for (col = 0; col < ARRAY_SIZE (fb_palette_data); col++) - grub_ieee1275_set_color (stdout_ihandle, col, fb_palette_data[col].r, - fb_palette_data[col].g, - fb_palette_data[col].b); - } + grub_video_fb_get_palette (0, ARRAY_SIZE (fb_palette_data), + fb_palette_data); + for (col = 0; col < ARRAY_SIZE (fb_palette_data); col++) + grub_ieee1275_set_color (stdout_ihandle, col, fb_palette_data[col].r, + fb_palette_data[col].g, + fb_palette_data[col].b); return GRUB_ERR_NONE; } diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c index f5e63aee2..33f28c32b 100644 --- a/grub-core/video/readers/jpeg.c +++ b/grub-core/video/readers/jpeg.c @@ -528,7 +528,11 @@ grub_jpeg_ycrcb_to_rgb (int yy, int cr, int cb, grub_uint8_t * rgb) dd = 0; if (dd > 255) dd = 255; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + rgb[2] = dd; +#else *(rgb++) = dd; +#endif /* Green */ dd = yy - ((cb * CONST (0.34414) + cr * CONST (0.71414)) >> SHIFT_BITS); @@ -536,7 +540,11 @@ grub_jpeg_ycrcb_to_rgb (int yy, int cr, int cb, grub_uint8_t * rgb) dd = 0; if (dd > 255) dd = 255; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + rgb[1] = dd; +#else *(rgb++) = dd; +#endif /* Blue */ dd = yy + ((cb * CONST (1.772)) >> SHIFT_BITS); @@ -544,7 +552,12 @@ grub_jpeg_ycrcb_to_rgb (int yy, int cr, int cb, grub_uint8_t * rgb) dd = 0; if (dd > 255) dd = 255; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + rgb[0] = dd; + rgb += 3; +#else *(rgb++) = dd; +#endif } static grub_err_t diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c index 7ef7e3b4c..6cae8965c 100644 --- a/grub-core/video/readers/png.c +++ b/grub-core/video/readers/png.c @@ -253,9 +253,12 @@ grub_png_decode_image_header (struct grub_png_data *data) "png: color type not supported"); if (data->is_16bit) - { data->bpp <<= 1; +#ifndef GRUB_CPU_WORDS_BIGENDIAN + if (data->is_16bit) +#endif + { data->image_data = grub_malloc (data->image_height * data->image_width * data->bpp); if (grub_errno) @@ -263,11 +266,13 @@ grub_png_decode_image_header (struct grub_png_data *data) data->cur_rgb = data->image_data; } +#ifndef GRUB_CPU_WORDS_BIGENDIAN else { data->image_data = 0; data->cur_rgb = (*data->bitmap)->data; } +#endif data->raw_bytes = data->image_height * (data->image_width + 1) * data->bpp; @@ -536,7 +541,7 @@ grub_png_output_byte (struct grub_png_data *data, grub_uint8_t n) data->cur_filter = n; } else - *(data->cur_rgb++) = n; + *data->cur_rgb++ = n; data->cur_column++; row_bytes = data->image_width * data->bpp; @@ -772,12 +777,60 @@ grub_png_convert_image (struct grub_png_data *data) grub_uint8_t *d1, *d2; d1 = (*data->bitmap)->data; - d2 = data->image_data + 1; + d2 = data->image_data + data->is_16bit; /* Only copy the upper 8 bit. */ +#ifndef GRUB_CPU_WORDS_BIGENDIAN for (i = 0; i < (data->image_width * data->image_height * data->bpp >> 1); i++, d1++, d2+=2) *d1 = *d2; +#else + switch (data->bpp) + { + /* 16-bit with alpha. */ + case 8: + for (i = 0; i < (data->image_width * data->image_height); + i++, d1 += 4, d2+=8) + { + d1[0] = d2[7]; + d1[1] = d2[5]; + d1[2] = d2[3]; + d1[3] = d2[1]; + } + break; + /* 16-bit without alpha. */ + case 6: + for (i = 0; i < (data->image_width * data->image_height); + i++, d1 += 3, d2+=6) + { + d1[0] = d2[5]; + d1[1] = d2[3]; + d1[2] = d2[1]; + } + break; + /* 8-bit with alpha. */ + case 4: + for (i = 0; i < (data->image_width * data->image_height); + i++, d1 += 4, d2 += 4) + { + d1[0] = d2[3]; + d1[1] = d2[2]; + d1[2] = d2[1]; + d1[3] = d2[0]; + } + break; + /* 8-bit without alpha. */ + case 3: + for (i = 0; i < (data->image_width * data->image_height); + i++, d1 += 3, d2 += 3) + { + d1[0] = d2[2]; + d1[1] = d2[1]; + d1[2] = d2[0]; + } + break; + } +#endif } static grub_err_t @@ -816,7 +869,9 @@ grub_png_decode_png (struct grub_png_data *data) break; case PNG_CHUNK_IEND: +#ifndef GRUB_CPU_WORDS_BIGENDIAN if (data->is_16bit) +#endif grub_png_convert_image (data); return grub_errno; diff --git a/grub-core/video/sis315pro.c b/grub-core/video/sis315pro.c index a98666944..cf45493a6 100644 --- a/grub-core/video/sis315pro.c +++ b/grub-core/video/sis315pro.c @@ -152,7 +152,7 @@ grub_video_sis315pro_setup (unsigned int width, unsigned int height, framebuffer.mode_info.bpp = 8; framebuffer.mode_info.bytes_per_pixel = 1; framebuffer.mode_info.pitch = 640 * 1; - framebuffer.mode_info.number_of_colors = 256; + framebuffer.mode_info.number_of_colors = 16; framebuffer.mode_info.red_mask_size = 0; framebuffer.mode_info.red_field_pos = 0; framebuffer.mode_info.green_mask_size = 0; @@ -372,7 +372,7 @@ grub_video_sis315pro_setup (unsigned int width, unsigned int height, return err; /* Copy default palette to initialize emulated palette. */ - err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS, + err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_EXT_NUMCOLORS, grub_video_fbstd_colors); #endif return err; diff --git a/include/grub/video_fb.h b/include/grub/video_fb.h index 0628467e7..ffe16c3ac 100644 --- a/include/grub/video_fb.h +++ b/include/grub/video_fb.h @@ -31,7 +31,9 @@ struct grub_video_fbblit_info; struct grub_video_fbrender_target; #define GRUB_VIDEO_FBSTD_NUMCOLORS 16 -extern struct grub_video_palette_data EXPORT_VAR(grub_video_fbstd_colors)[GRUB_VIDEO_FBSTD_NUMCOLORS]; +#define GRUB_VIDEO_FBSTD_EXT_NUMCOLORS 256 + +extern struct grub_video_palette_data EXPORT_VAR(grub_video_fbstd_colors)[GRUB_VIDEO_FBSTD_EXT_NUMCOLORS]; grub_err_t EXPORT_FUNC(grub_video_fb_init) (void); From b5a2114d765c26f35403e4a781eff4c727a00471 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 May 2013 13:56:45 +0200 Subject: [PATCH 136/187] * grub-core/normal/term.c (print_ucs4_real): Fix startwidth in dry run. --- ChangeLog | 4 ++++ grub-core/normal/term.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ff4a050a..9e99eb540 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-03 Vladimir Serbinenko + + * grub-core/normal/term.c (print_ucs4_real): Fix startwidth in dry run. + 2013-05-02 Vladimir Serbinenko Several fixes to ieee1275 and big-endian video. diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index f9620f6e5..976442382 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -920,8 +920,8 @@ print_ucs4_real (const grub_uint32_t * str, get_maxwidth (term, margin_left, margin_right), - get_startwidth (term, - margin_left), + dry_run ? 0 : get_startwidth (term, + margin_left), contchar, pos, !!contchar); if (visual_len < 0) { From a4f9a5ff9275535cccbb2c93a06a0042adebbeca Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 May 2013 14:02:49 +0200 Subject: [PATCH 137/187] * grub-core/gfxmenu/view.c (grub_gfxmenu_view_new): Clear grub_gfxmenu_timeout_notifications. (grub_gfxmenu_view_destroy): Likewise. --- ChangeLog | 6 ++++++ grub-core/gfxmenu/view.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9e99eb540..858f0b087 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-05-03 Vladimir Serbinenko + + * grub-core/gfxmenu/view.c (grub_gfxmenu_view_new): Clear + grub_gfxmenu_timeout_notifications. + (grub_gfxmenu_view_destroy): Likewise. + 2013-05-03 Vladimir Serbinenko * grub-core/normal/term.c (print_ucs4_real): Fix startwidth in dry run. diff --git a/grub-core/gfxmenu/view.c b/grub-core/gfxmenu/view.c index 475fc76c5..bcf6399e2 100644 --- a/grub-core/gfxmenu/view.c +++ b/grub-core/gfxmenu/view.c @@ -58,6 +58,14 @@ grub_gfxmenu_view_new (const char *theme_path, if (! view) return 0; + while (grub_gfxmenu_timeout_notifications) + { + struct grub_gfxmenu_timeout_notify *p; + p = grub_gfxmenu_timeout_notifications; + grub_gfxmenu_timeout_notifications = grub_gfxmenu_timeout_notifications->next; + grub_free (p); + } + view->screen.x = 0; view->screen.y = 0; view->screen.width = width; @@ -105,6 +113,13 @@ grub_gfxmenu_view_destroy (grub_gfxmenu_view_t view) { if (!view) return; + while (grub_gfxmenu_timeout_notifications) + { + struct grub_gfxmenu_timeout_notify *p; + p = grub_gfxmenu_timeout_notifications; + grub_gfxmenu_timeout_notifications = grub_gfxmenu_timeout_notifications->next; + grub_free (p); + } grub_video_bitmap_destroy (view->desktop_image); if (view->terminal_box) view->terminal_box->destroy (view->terminal_box); From 7c332bdc98139d7516ca58b8a488160f43a6fa9c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 May 2013 14:05:57 +0200 Subject: [PATCH 138/187] * include/grub/gui.h (grub_gfxmenu_timeout_unregister): Free cb descriptor. --- ChangeLog | 5 +++++ include/grub/gui.h | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 858f0b087..9e8884a8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-03 Vladimir Serbinenko + + * include/grub/gui.h (grub_gfxmenu_timeout_unregister): Free cb + descriptor. + 2013-05-03 Vladimir Serbinenko * grub-core/gfxmenu/view.c (grub_gfxmenu_view_new): Clear diff --git a/include/grub/gui.h b/include/grub/gui.h index 4b8ec8965..6f818627e 100644 --- a/include/grub/gui.h +++ b/include/grub/gui.h @@ -112,6 +112,7 @@ grub_gfxmenu_timeout_unregister (grub_gui_component_t self) if (q->self == self) { *p = q->next; + grub_free (q); break; } } From cff501187cad4cc7d644d4f05f940b2fbb59ab33 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 May 2013 14:07:30 +0200 Subject: [PATCH 139/187] * grub-core/video/fb/fbblit.c (grub_video_fbblit_blend_BGR888_RGBA8888): Fix order bug. (grub_video_fbblit_blend_RGB888_RGBA8888): Likewise. --- ChangeLog | 6 ++++++ grub-core/video/fb/fbblit.c | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e8884a8e..c26b110f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-05-03 Vladimir Serbinenko + + * grub-core/video/fb/fbblit.c (grub_video_fbblit_blend_BGR888_RGBA8888): + Fix order bug. + (grub_video_fbblit_blend_RGB888_RGBA8888): Likewise. + 2013-05-03 Vladimir Serbinenko * include/grub/gui.h (grub_gfxmenu_timeout_unregister): Free cb diff --git a/grub-core/video/fb/fbblit.c b/grub-core/video/fb/fbblit.c index 13e2926bf..541a0ceaf 100644 --- a/grub-core/video/fb/fbblit.c +++ b/grub-core/video/fb/fbblit.c @@ -986,11 +986,18 @@ grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst, /* General pixel color blending. */ color = *dstptr; +#ifndef GRUB_CPU_WORDS_BIGENDIAN db = dstptr[0]; - db = (db * (255 - a) + sb * a) / 255; dg = dstptr[1]; - dg = (dg * (255 - a) + sg * a) / 255; dr = dstptr[2]; +#else + dr = dstptr[0]; + dg = dstptr[1]; + db = dstptr[2]; +#endif + + db = (db * (255 - a) + sb * a) / 255; + dg = (dg * (255 - a) + sg * a) / 255; dr = (dr * (255 - a) + sr * a) / 255; } @@ -1145,13 +1152,13 @@ grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst, } #ifndef GRUB_CPU_WORDS_BIGENDIAN - db = dstptr[0]; - dg = dstptr[1]; - dr = dstptr[2]; -#else dr = dstptr[0]; dg = dstptr[1]; db = dstptr[2]; +#else + db = dstptr[0]; + dg = dstptr[1]; + dr = dstptr[2]; #endif dr = (dr * (255 - a) + sr * a) / 255; From 7391c4d5ac9ec6629dad70a82b427af188c3bc33 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 May 2013 14:08:51 +0200 Subject: [PATCH 140/187] * grub-core/gfxmenu/gfxmenu.c (grub_gfxmenu_try): Allow specifying the theme path relative to $prefix/themes. --- ChangeLog | 5 +++++ grub-core/gfxmenu/gfxmenu.c | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c26b110f2..ed99c8043 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-03 Vladimir Serbinenko + + * grub-core/gfxmenu/gfxmenu.c (grub_gfxmenu_try): Allow specifying + the theme path relative to $prefix/themes. + 2013-05-03 Vladimir Serbinenko * grub-core/video/fb/fbblit.c (grub_video_fbblit_blend_BGR888_RGBA8888): diff --git a/grub-core/gfxmenu/gfxmenu.c b/grub-core/gfxmenu/gfxmenu.c index 09e86213f..51110a6f8 100644 --- a/grub-core/gfxmenu/gfxmenu.c +++ b/grub-core/gfxmenu/gfxmenu.c @@ -53,6 +53,7 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested) { grub_gfxmenu_view_t view = NULL; const char *theme_path; + char *full_theme_path = 0; struct grub_menu_viewer *instance; grub_err_t err; struct grub_video_mode_info mode_info; @@ -70,15 +71,27 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested) if (err) return err; - if (!cached_view || grub_strcmp (cached_view->theme_path, theme_path) != 0 + if (theme_path[0] != '/' && theme_path[0] != '(') + { + const char *prefix; + prefix = grub_env_get ("prefix"); + full_theme_path = grub_xasprintf ("%s/themes/%s", + prefix, + theme_path); + } + + if (!cached_view || grub_strcmp (cached_view->theme_path, + full_theme_path ? : theme_path) != 0 || cached_view->screen.width != mode_info.width || cached_view->screen.height != mode_info.height) { grub_free (cached_view); /* Create the view. */ - cached_view = grub_gfxmenu_view_new (theme_path, mode_info.width, + cached_view = grub_gfxmenu_view_new (full_theme_path ? : theme_path, + mode_info.width, mode_info.height); } + grub_free (full_theme_path); if (! cached_view) { From c104b6f93e2f9cc5eab952a6fdb2825b9f989c0f Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 May 2013 14:09:55 +0200 Subject: [PATCH 141/187] New series of tests for gfxterm and gfxmenu. --- ChangeLog | 4 + grub-core/Makefile.core.def | 5 + grub-core/tests/checksums.c | 108 +++++++--- grub-core/tests/fake_input.c | 2 + grub-core/tests/gfxterm_menu.c | 113 +++++++++++ grub-core/tests/lib/functional_test.c | 3 +- grub-core/tests/video_checksum.c | 204 ++++++++++++++++++- grub-core/tests/videotest_checksum.c | 279 +------------------------- include/grub/test.h | 5 + tests/util/grub-shell.in | 3 + 10 files changed, 426 insertions(+), 300 deletions(-) create mode 100644 grub-core/tests/gfxterm_menu.c diff --git a/ChangeLog b/ChangeLog index ed99c8043..5fc737247 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-03 Vladimir Serbinenko + + New series of tests for gfxterm and gfxmenu. + 2013-05-03 Vladimir Serbinenko * grub-core/gfxmenu/gfxmenu.c (grub_gfxmenu_try): Allow specifying diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 2fa0ea7be..da7637fa5 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1746,6 +1746,11 @@ module = { common = tests/videotest_checksum.c; }; +module = { + name = gfxterm_menu; + common = tests/gfxterm_menu.c; +}; + module = { name = bitmap; common = video/bitmap.c; diff --git a/grub-core/tests/checksums.c b/grub-core/tests/checksums.c index 583c696d6..c2d2f5ab6 100644 --- a/grub-core/tests/checksums.c +++ b/grub-core/tests/checksums.c @@ -1,30 +1,90 @@ + { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, }, 6 }, + { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, }, 6 }, + { "gfxterm_menu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, }, 6 }, + { "gfxterm_menu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, }, 6 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x9093f849, 0xc02929e3, 0x9093f849, 0xe2f077d4, 0x5387d57f, }, 6 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbbe054f6, 0xbef13bfe, 0xbbe054f6, 0xa23fcfe0, 0xf83ee7aa, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x8cea8db2, 0x9688dd3b, 0x8cea8db2, 0x6fe82515, 0x724366e5, }, 6 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x25e346a1, 0xbd5eb38b, 0x25e346a1, 0x9d469431, 0x5387d57f, }, 6 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x6f33e7a0, 0x5716dafe, 0x6f33e7a0, 0xbfa18d18, 0xf83ee7aa, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xffb24323, 0x6e8fa0be, 0xffb24323, 0xad5c8fa5, 0x724366e5, }, 6 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0x5a925b39, 0x36226b, 0x5a925b39, 0xafa322b7, 0x1c955882, }, 6 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfb4aecf8, 0x17b91739, 0xfb4aecf8, 0xf7e3d211, 0x4d266f7a, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x4015c90f, 0x430ae98c, 0x4015c90f, 0xeb61f90d, 0x1ed9d731, }, 6 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4df27666, 0xb8015ce1, 0x4df27666, 0x8bef2cac, 0x9813a416, }, 6 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6d1d5058, 0xb2d8ed2c, 0x6d1d5058, 0xe8936168, 0x5fcf013d, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xeec86af1, 0x13493ea, 0xeec86af1, 0xee83739a, 0xdd28f52b, }, 6 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x9093f849, 0xc02929e3, 0x9093f849, 0xe2f077d4, 0x5387d57f, }, 6 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbbe054f6, 0xbef13bfe, 0xbbe054f6, 0xa23fcfe0, 0xf83ee7aa, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x8cea8db2, 0x9688dd3b, 0x8cea8db2, 0x6fe82515, 0x724366e5, }, 6 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x25e346a1, 0xbd5eb38b, 0x25e346a1, 0x9d469431, 0x5387d57f, }, 6 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x6f33e7a0, 0x5716dafe, 0x6f33e7a0, 0xbfa18d18, 0xf83ee7aa, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xffb24323, 0x6e8fa0be, 0xffb24323, 0xad5c8fa5, 0x724366e5, }, 6 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x5a925b39, 0x36226b, 0x5a925b39, 0xafa322b7, 0x1c955882, }, 6 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfb4aecf8, 0x17b91739, 0xfb4aecf8, 0xf7e3d211, 0x4d266f7a, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x4015c90f, 0x430ae98c, 0x4015c90f, 0xeb61f90d, 0x1ed9d731, }, 6 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x4df27666, 0xb8015ce1, 0x4df27666, 0x8bef2cac, 0x9813a416, }, 6 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6d1d5058, 0xb2d8ed2c, 0x6d1d5058, 0xe8936168, 0x5fcf013d, }, 6 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xeec86af1, 0x13493ea, 0xeec86af1, 0xee83739a, 0xdd28f52b, }, 6 }, + { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7a3f695f, 0xac449d41, 0x7a3f695f, 0x28a073b1, }, 5 }, + { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2ee70aea, 0x8f5328d2, 0x2ee70aea, 0x19fb9508, }, 5 }, + { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xef842e14, 0x9b7cdc00, 0xef842e14, 0x750c3145, }, 5 }, + { "gfxmenu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xcfa0e627, 0x8b7088da, 0xcfa0e627, 0xcd807142, }, 5 }, + { "gfxmenu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x64807934, 0x85d684c9, 0x64807934, 0x61726a79, }, 5 }, + { "gfxmenu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x9792b643, 0x1d769dd8, 0x9386dd8c, 0x9792b643, 0x3d74bd2f, }, 6 }, + { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xbdb8f583, 0x1e27b76, 0xbdb8f583, 0x91be6e17, }, 5 }, + { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbe72e1cb, 0x4943add3, 0xbe72e1cb, 0xa207f983, }, 5 }, + { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0xbc064047, 0x9e12d9ac, 0xbc064047, 0xf9bdce43, }, 5 }, + { "gfxmenu", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x6181ad43, 0xe570d91, 0x6181ad43, 0x567fb1cc, }, 5 }, + { "gfxmenu", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1e5b6982, 0x789f961c, 0x1e5b6982, 0xc1ad694a, }, 5 }, + { "gfxmenu", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x73f85cef, 0x9469d68d, 0x73f85cef, 0x24779078, }, 5 }, + { "gfxmenu", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xa6ddcb95, 0xa3934314, 0xa6ddcb95, 0x16ab9b6c, }, 5 }, + { "gfxmenu", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x18e25ecc, 0xe52f7def, 0x18e25ecc, 0x5bd10081, }, 5 }, + { "gfxmenu", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xa845bba2, 0xb67fe791, 0xa845bba2, 0x80452493, }, 5 }, + { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xf162dfa3, 0xe0f86fe6, 0xf162dfa3, 0x51f56384, }, 5 }, + { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x644b801, 0x8a201b04, 0x644b801, 0xa4508ec0, }, 5 }, + { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0x1e1a41fe, 0x237e53c4, 0x1e1a41fe, 0xd5890062, }, 5 }, + { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0xa35a45c5, 0xacbc8410, 0xa35a45c5, 0xed2e11bd, }, 5 }, + { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x8a6fa170, 0x7605140e, 0x8a6fa170, 0xc030feb1, }, 5 }, + { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x49ddd3e4, 0xbfaeedf9, 0x49ddd3e4, 0xcde1d4b5, }, 5 }, + { "gfxmenu", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x98a8e7a8, 0xd9cab55f, 0x98a8e7a8, 0xf2b7dd05, }, 5 }, + { "gfxmenu", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xa000334f, 0xa1b11a86, 0xa000334f, 0x8ac1b99f, }, 5 }, + { "gfxmenu", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xc662fb1, 0x673baf90, 0xc662fb1, 0xfb88406, }, 5 }, + { "gfxmenu", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x33d4530e, 0x11ff262b, 0x33d4530e, 0xbb511beb, }, 5 }, + { "gfxmenu", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x8b2e9364, 0x1d99d298, 0x8b2e9364, 0x958d5e8d, }, 5 }, + { "gfxmenu", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x6e78baae, 0xaedcda00, 0x6e78baae, 0x9399bef9, }, 5 }, + { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x1c3742c9, 0x42860f9a, 0x57da9ef, 0x42860f9a, 0x221db42c, }, 5 }, + { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x2ade7eff, 0xc91e0e0c, 0x2ade7eff, 0x8ad4bad6, }, 5 }, + { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xef4a3312, 0x4c493c2d, 0x487c542b, 0x4c493c2d, 0xfec68cd6, }, 5 }, { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, }, 5 }, { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, }, 5 }, { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, }, 5 }, { "videotest", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, }, 5 }, { "videotest", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0x327d1082, 0x327d1082, 0x327d1082, 0x327d1082, 0x327d1082, }, 5 }, { "videotest", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xadd0f186, 0xadd0f186, 0xadd0f186, 0xadd0f186, 0xadd0f186, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgb555 */, (grub_uint32_t []) { 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgb555 */, (grub_uint32_t []) { 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgb555 */, (grub_uint32_t []) { 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgb565 */, (grub_uint32_t []) { 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgb565 */, (grub_uint32_t []) { 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgb565 */, (grub_uint32_t []) { 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgb888 */, (grub_uint32_t []) { 0x61db45b7, 0x1d867efe, 0x99613325, 0xe53c086c, 0x9543de62, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgb888 */, (grub_uint32_t []) { 0xa46eb37f, 0xd2a59656, 0x49f8f92d, 0x3f33dc04, 0x7aae512a, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgb888 */, (grub_uint32_t []) { 0xb864a496, 0x6c22313b, 0x1505f93d, 0xc1436c90, 0xe74a6931, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgb888 */, (grub_uint32_t []) { 0x2b154617, 0x692e98df, 0xaf62fb87, 0xed59254f, 0x26164bc6, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgb888 */, (grub_uint32_t []) { 0x3b0fbc56, 0xd9d57c0e, 0xfb564a17, 0x198c8a4f, 0xbe502625, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgb888 */, (grub_uint32_t []) { 0x6e6c9b36, 0x4ae9f137, 0x27664f34, 0x3e32535, 0xfc793332, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgr555 */, (grub_uint32_t []) { 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgr555 */, (grub_uint32_t []) { 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgr555 */, (grub_uint32_t []) { 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgr565 */, (grub_uint32_t []) { 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgr565 */, (grub_uint32_t []) { 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgr565 */, (grub_uint32_t []) { 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgr888 */, (grub_uint32_t []) { 0x4af6b480, 0x923db79c, 0xfe8cc449, 0x2647c755, 0x27ee23e3, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgr888 */, (grub_uint32_t []) { 0x121d5e29, 0xf66c0aed, 0xdf138150, 0x3b62d594, 0x8dec962a, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgr888 */, (grub_uint32_t []) { 0xae86a12c, 0x4dabbe89, 0x6d30e897, 0x8e1df732, 0x2c0644ab, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgr888 */, (grub_uint32_t []) { 0x2605d280, 0xc06e3172, 0xef3e6395, 0x9558067, 0xb19ec65b, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgr888 */, (grub_uint32_t []) { 0x9404ef3b, 0xa4fdf18, 0xad7ef98c, 0x3335c9af, 0xe6f0c255, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgr888 */, (grub_uint32_t []) { 0xa008b770, 0xb98eb0d8, 0x9304b820, 0x8a82bf88, 0xc610a9d0, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x61db45b7, 0x1d867efe, 0x99613325, 0xe53c086c, 0x9543de62, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0xa46eb37f, 0xd2a59656, 0x49f8f92d, 0x3f33dc04, 0x7aae512a, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0xb864a496, 0x6c22313b, 0x1505f93d, 0xc1436c90, 0xe74a6931, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x2b154617, 0x692e98df, 0xaf62fb87, 0xed59254f, 0x26164bc6, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x3b0fbc56, 0xd9d57c0e, 0xfb564a17, 0x198c8a4f, 0xbe502625, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0x6e6c9b36, 0x4ae9f137, 0x27664f34, 0x3e32535, 0xfc793332, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x4af6b480, 0x923db79c, 0xfe8cc449, 0x2647c755, 0x27ee23e3, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x121d5e29, 0xf66c0aed, 0xdf138150, 0x3b62d594, 0x8dec962a, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0xae86a12c, 0x4dabbe89, 0x6d30e897, 0x8e1df732, 0x2c0644ab, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x2605d280, 0xc06e3172, 0xef3e6395, 0x9558067, 0xb19ec65b, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x9404ef3b, 0xa4fdf18, 0xad7ef98c, 0x3335c9af, 0xe6f0c255, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xa008b770, 0xb98eb0d8, 0x9304b820, 0x8a82bf88, 0xc610a9d0, }, 5 }, diff --git a/grub-core/tests/fake_input.c b/grub-core/tests/fake_input.c index b514c2acc..3c24e0f27 100644 --- a/grub-core/tests/fake_input.c +++ b/grub-core/tests/fake_input.c @@ -55,6 +55,7 @@ grub_terminal_input_fake_sequence (int *seq_in, int nseq_in) grub_memcpy (seq, seq_in, nseq_in * sizeof (seq[0])); } nseq = nseq_in; + seqptr = 0; } void @@ -64,4 +65,5 @@ grub_terminal_input_fake_sequence_end (void) grub_free (seq); seq = 0; nseq = 0; + seqptr = 0; } diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c new file mode 100644 index 000000000..e4aae1252 --- /dev/null +++ b/grub-core/tests/gfxterm_menu.c @@ -0,0 +1,113 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +/* All tests need to include test.h for GRUB testing framework. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + + +static const char testfile[] = + "terminal_output gfxterm\n" + "menuentry \"test\" {\n" + "\ttrue\n" + "}\n" + "menuentry \"s̛ ơ t o̒ s̒ u o̕̚ 8.04 m̂ñåh̊z̆x̣ a̡ b̢g̢ u᷎ô᷎ ô᷎ O̷ a̖̣ ȃ̐\" --class ubuntu --class linux --class os {\n" + "\ttrue\n" + "}\n" + "menuentry \" הַרמלל(טוֹבָ) לֶךְ\" --class opensuse --class linux --class os {\n" + "\ttrue\n" + "}\n" + "menuentry \"الرملل جِداً لِكَ\" --class gentoo --class linux --class os {\n" + "\ttrue\n" + "}\n" + "menuentry \"ὑπόγυͅον\" --class kubuntu --class linux --class os {\n" + "\ttrue\n" + "}\n" + "menuentry \"سَّ نِّ نَّ نٌّ نّْ\" --class linuxmint --class linux --class os {\n" + "\ttrue\n" + "}\n" + /* Chinese & UTF-8 test from Carbon Jiao. */ + "menuentry \"从硬盘的第一主分区启动\" --class \"windows xp\" --class windows --class os {\n" + "\ttrue\n" + "}\n" + "timeout=3\n"; + +static char * +get_test_cfg (void) +{ + return grub_strdup (testfile); +} + +struct grub_procfs_entry test_cfg = +{ + .name = "test.cfg", + .get_contents = get_test_cfg +}; + + +/* Functional test main method. */ +static void +gfxterm_menu (void) +{ + unsigned i, j; + if (grub_font_load ("unicode") == 0) + { + grub_test_assert (0, "unicode font not found: %s", grub_errmsg); + return; + } + + grub_procfs_register ("test.cfg", &test_cfg); + + for (j = 0; j < 2; j++) + for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++) + { + grub_video_capture_start (&grub_test_video_modes[i], + grub_video_fbstd_colors, + grub_test_video_modes[i].number_of_colors); + grub_terminal_input_fake_sequence ((int []) { -1, -1, -1, GRUB_TERM_KEY_DOWN, -1, '\e' }, 6); + + grub_video_checksum (j ? "gfxmenu" : "gfxterm_menu"); + + grub_env_context_open (); + if (j) + grub_env_set ("theme", "starfield/theme.txt"); + grub_normal_execute ("(proc)/test.cfg", 1, 0); + grub_env_context_close (); + + char *args[] = { (char *) "console", 0 }; + grub_command_execute ("terminal_output", 1, args); + + grub_terminal_input_fake_sequence_end (); + grub_video_checksum_end (); + grub_video_capture_end (); + } + + grub_procfs_unregister (&test_cfg); +} + +/* Register example_test method as a functional test. */ +GRUB_FUNCTIONAL_TEST (gfxterm_menu, gfxterm_menu); diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c index da4d5f809..c70e1add1 100644 --- a/grub-core/tests/lib/functional_test.c +++ b/grub-core/tests/lib/functional_test.c @@ -51,9 +51,10 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), grub_dl_load ("exfctest"); grub_dl_load ("videotest_checksum"); + grub_dl_load ("gfxterm_menu"); FOR_LIST_ELEMENTS (test, grub_test_list) - ok = ok && !grub_test_run (test); + ok = !grub_test_run (test) && ok; if (ok) grub_printf ("ALL TESTS PASSED\n"); else diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c index cf47fa245..c6780596a 100644 --- a/grub-core/tests/video_checksum.c +++ b/grub-core/tests/video_checksum.c @@ -31,6 +31,208 @@ static char *basename; static const grub_uint32_t *checksums; static struct grub_video_mode_info capt_mode_info; +struct grub_video_mode_info grub_test_video_modes[30] = { + { + .width = 640, + .height = 480, + .pitch = 640, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS + }, + { + .width = 800, + .height = 600, + .pitch = 800, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS + }, + { + .width = 1024, + .height = 768, + .pitch = 1024, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS + }, + { + .width = 640, + .height = 480, + .pitch = 640, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS + }, + { + .width = 800, + .height = 600, + .pitch = 800, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS + }, + { + .width = 1024, + .height = 768, + .pitch = 1024, + .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, + .bpp = 8, + .bytes_per_pixel = 1, + .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS + }, + { + .width = 640, + .height = 480, + .pitch = 1280, + GRUB_VIDEO_MI_RGB555 () + }, + { + .width = 800, + .height = 600, + .pitch = 1600, + GRUB_VIDEO_MI_RGB555 () + }, + { + .width = 1024, + .height = 768, + .pitch = 2048, + GRUB_VIDEO_MI_RGB555 () + }, + { + .width = 640, + .height = 480, + .pitch = 1280, + GRUB_VIDEO_MI_RGB565 () + }, + { + .width = 800, + .height = 600, + .pitch = 1600, + GRUB_VIDEO_MI_RGB565 () + }, + { + .width = 1024, + .height = 768, + .pitch = 2048, + GRUB_VIDEO_MI_RGB565 () + }, + { + .width = 640, + .height = 480, + .pitch = 640 * 3, + GRUB_VIDEO_MI_RGB888 () + }, + { + .width = 800, + .height = 600, + .pitch = 800 * 3, + GRUB_VIDEO_MI_RGB888 () + }, + { + .width = 1024, + .height = 768, + .pitch = 1024 * 3, + GRUB_VIDEO_MI_RGB888 () + }, + { + .width = 640, + .height = 480, + .pitch = 640 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + { + .width = 800, + .height = 600, + .pitch = 800 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + { + .width = 1024, + .height = 768, + .pitch = 1024 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + + { + .width = 640, + .height = 480, + .pitch = 1280, + GRUB_VIDEO_MI_BGR555 () + }, + { + .width = 800, + .height = 600, + .pitch = 1600, + GRUB_VIDEO_MI_BGR555 () + }, + { + .width = 1024, + .height = 768, + .pitch = 2048, + GRUB_VIDEO_MI_BGR555 () + }, + { + .width = 640, + .height = 480, + .pitch = 1280, + GRUB_VIDEO_MI_BGR565 () + }, + { + .width = 800, + .height = 600, + .pitch = 1600, + GRUB_VIDEO_MI_BGR565 () + }, + { + .width = 1024, + .height = 768, + .pitch = 2048, + GRUB_VIDEO_MI_BGR565 () + }, + { + .width = 640, + .height = 480, + .pitch = 640 * 3, + GRUB_VIDEO_MI_BGR888 () + }, + { + .width = 800, + .height = 600, + .pitch = 800 * 3, + GRUB_VIDEO_MI_BGR888 () + }, + { + .width = 1024, + .height = 768, + .pitch = 1024 * 3, + GRUB_VIDEO_MI_BGR888 () + }, + { + .width = 640, + .height = 480, + .pitch = 640 * 4, + GRUB_VIDEO_MI_BGRA8888() + }, + { + .width = 800, + .height = 600, + .pitch = 800 * 4, + GRUB_VIDEO_MI_BGRA8888() + }, + { + .width = 1024, + .height = 768, + .pitch = 1024 * 4, + GRUB_VIDEO_MI_BGRA8888() + }, +}; + #ifdef GRUB_MACHINE_EMU #include #include @@ -262,7 +464,7 @@ get_modename (void) return buf; } -//#define GENERATE_MODE 1 +#define GENERATE_MODE 1 #if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) int genfd = -1; diff --git a/grub-core/tests/videotest_checksum.c b/grub-core/tests/videotest_checksum.c index 7833d04f4..ee7058f51 100644 --- a/grub-core/tests/videotest_checksum.c +++ b/grub-core/tests/videotest_checksum.c @@ -26,292 +26,23 @@ GRUB_MOD_LICENSE ("GPLv3+"); -struct -{ - struct grub_video_mode_info mode_info; -} tests[] = { - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 640, - .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, - .bpp = 8, - .bytes_per_pixel = 1, - .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 800, - .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, - .bpp = 8, - .bytes_per_pixel = 1, - .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 1024, - .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, - .bpp = 8, - .bytes_per_pixel = 1, - .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS - }, - }, - - - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 640, - .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, - .bpp = 8, - .bytes_per_pixel = 1, - .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 800, - .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, - .bpp = 8, - .bytes_per_pixel = 1, - .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 1024, - .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR, - .bpp = 8, - .bytes_per_pixel = 1, - .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS - }, - }, - - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 1280, - GRUB_VIDEO_MI_RGB555 () - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 1600, - GRUB_VIDEO_MI_RGB555 () - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 2048, - GRUB_VIDEO_MI_RGB555 () - }, - }, - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 1280, - GRUB_VIDEO_MI_RGB565 () - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 1600, - GRUB_VIDEO_MI_RGB565 () - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 2048, - GRUB_VIDEO_MI_RGB565 () - }, - }, - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 640 * 3, - GRUB_VIDEO_MI_RGB888 () - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 800 * 3, - GRUB_VIDEO_MI_RGB888 () - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 1024 * 3, - GRUB_VIDEO_MI_RGB888 () - }, - }, - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 640 * 4, - GRUB_VIDEO_MI_RGBA8888() - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 800 * 4, - GRUB_VIDEO_MI_RGBA8888() - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 1024 * 4, - GRUB_VIDEO_MI_RGBA8888() - }, - }, - - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 1280, - GRUB_VIDEO_MI_BGR555 () - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 1600, - GRUB_VIDEO_MI_BGR555 () - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 2048, - GRUB_VIDEO_MI_BGR555 () - }, - }, - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 1280, - GRUB_VIDEO_MI_BGR565 () - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 1600, - GRUB_VIDEO_MI_BGR565 () - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 2048, - GRUB_VIDEO_MI_BGR565 () - }, - }, - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 640 * 3, - GRUB_VIDEO_MI_BGR888 () - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 800 * 3, - GRUB_VIDEO_MI_BGR888 () - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 1024 * 3, - GRUB_VIDEO_MI_BGR888 () - }, - }, - { - .mode_info = { - .width = 640, - .height = 480, - .pitch = 640 * 4, - GRUB_VIDEO_MI_BGRA8888() - }, - }, - { - .mode_info = { - .width = 800, - .height = 600, - .pitch = 800 * 4, - GRUB_VIDEO_MI_BGRA8888() - }, - }, - { - .mode_info = { - .width = 1024, - .height = 768, - .pitch = 1024 * 4, - GRUB_VIDEO_MI_BGRA8888() - }, - }, - - }; - - /* Functional test main method. */ static void videotest_checksum (void) { unsigned i; + if (grub_font_load ("unicode") == 0) { grub_test_assert (0, "unicode font not found: %s", grub_errmsg); return; } - - for (i = 0; i < ARRAY_SIZE (tests); i++) + + for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++) { - grub_video_capture_start (&tests[i].mode_info, + grub_video_capture_start (&grub_test_video_modes[i], grub_video_fbstd_colors, - tests[i].mode_info.number_of_colors); + grub_test_video_modes[i].number_of_colors); grub_terminal_input_fake_sequence ((int []) { '\n' }, 1); grub_video_checksum ("videotest"); diff --git a/include/grub/test.h b/include/grub/test.h index 6aa406979..946a81b1c 100644 --- a/include/grub/test.h +++ b/include/grub/test.h @@ -25,6 +25,9 @@ #include #include +#include +#include + struct grub_test { /* The next test. */ @@ -99,4 +102,6 @@ grub_terminal_input_fake_sequence (int *seq_in, int nseq_in); void grub_terminal_input_fake_sequence_end (void); +extern struct grub_video_mode_info grub_test_video_modes[30]; + #endif /* ! GRUB_TEST_HEADER */ diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index dfde836d5..dee3962e2 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -22,6 +22,7 @@ prefix="@prefix@" exec_prefix="@exec_prefix@" datarootdir="@datarootdir@" builddir="@builddir@" +srcdir="@srcdir@" PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_TARNAME=@PACKAGE_TARNAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ @@ -409,7 +410,9 @@ if [ x$boot = xnet ]; then elif [ x$boot = xemu ]; then grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" mkdir -p "$grubdir/fonts" + mkdir -p "$grubdir/themes" cp "@builddir@/"unicode.pf2 "$grubdir/fonts/unicode.pf2" + cp -R "@srcdir@/themes/starfield" "$grubdir/themes/starfield" cp "${cfgfile}" "$grubdir/grub.cfg" cp "${source}" "$grubdir/testcase.cfg" @builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim From aa73d688e755e10e5cb422a8508eef485f7b44a5 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 May 2013 14:50:05 +0200 Subject: [PATCH 142/187] * grub-core/tests/video_checksum.c: Don't set GENERATE_MODE. --- ChangeLog | 4 ++++ grub-core/tests/video_checksum.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5fc737247..1b4c9254e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-03 Vladimir Serbinenko + + * grub-core/tests/video_checksum.c: Don't set GENERATE_MODE. + 2013-05-03 Vladimir Serbinenko New series of tests for gfxterm and gfxmenu. diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c index c6780596a..41a262a69 100644 --- a/grub-core/tests/video_checksum.c +++ b/grub-core/tests/video_checksum.c @@ -464,7 +464,7 @@ get_modename (void) return buf; } -#define GENERATE_MODE 1 +//#define GENERATE_MODE 1 #if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) int genfd = -1; From 8cec7bd40b57041e07665aa3eb3c4eed927a5bbc Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Fri, 3 May 2013 18:39:17 +0400 Subject: [PATCH 143/187] Rename grub-core/tests/checksums.c into grub-core/tests/checksums.h and add it as source to functional_test module. --- ChangeLog | 5 +++++ grub-core/Makefile.core.def | 1 + grub-core/tests/{checksums.c => checksums.h} | 0 grub-core/tests/video_checksum.c | 4 ++-- 4 files changed, 8 insertions(+), 2 deletions(-) rename grub-core/tests/{checksums.c => checksums.h} (100%) diff --git a/ChangeLog b/ChangeLog index 1b4c9254e..8113b6d5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-03 Andrey Borzenkov + + Rename grub-core/tests/checksums.c into grub-core/tests/checksums.h + and add it as source to functional_test module. + 2013-05-03 Vladimir Serbinenko * grub-core/tests/video_checksum.c: Don't set GENERATE_MODE. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index da7637fa5..469524fe0 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1731,6 +1731,7 @@ module = { name = functional_test; common = tests/lib/functional_test.c; common = tests/lib/test.c; + common = tests/checksums.h; common = tests/video_checksum.c; common = tests/fake_input.c; common = video/capture.c; diff --git a/grub-core/tests/checksums.c b/grub-core/tests/checksums.h similarity index 100% rename from grub-core/tests/checksums.c rename to grub-core/tests/checksums.h diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c index 41a262a69..f3eb9fc5f 100644 --- a/grub-core/tests/video_checksum.c +++ b/grub-core/tests/video_checksum.c @@ -613,7 +613,7 @@ struct checksum_desc }; const struct checksum_desc checksum_table[] = { -#include "checksums.c" +#include "checksums.h" }; void @@ -625,7 +625,7 @@ grub_video_checksum (const char *basename_in) #if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) if (genfd < 0) - genfd = open ("checksums.c", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + genfd = open ("checksums.h", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (genfd >= 0) { char buf[400]; From 82ae74d7bdeaad52f06fb79c52b80ecc32f556f4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:11:57 +0200 Subject: [PATCH 144/187] * grub-core/font/font.c (grub_font_construct_glyph): Fix memory leak. --- ChangeLog | 4 ++++ grub-core/font/font.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8113b6d5f..a721215c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-04 Vladimir Serbinenko + + * grub-core/font/font.c (grub_font_construct_glyph): Fix memory leak. + 2013-05-03 Andrey Borzenkov Rename grub-core/tests/checksums.c into grub-core/tests/checksums.h diff --git a/grub-core/font/font.c b/grub-core/font/font.c index fbbb988a5..4758f6c0a 100644 --- a/grub-core/font/font.c +++ b/grub-core/font/font.c @@ -1544,6 +1544,8 @@ grub_font_construct_glyph (grub_font_t hinted_font, blit_comb (glyph_id, glyph, NULL, main_glyph, combining_glyphs, NULL); + grub_free (combining_glyphs); + return glyph; } From daf01d61ffb9bc63a2d3bb250f4a01c85d242e10 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:38:59 +0200 Subject: [PATCH 145/187] Fix test -a and -o precedence. Reported by: adrian15. --- ChangeLog | 5 +++++ Makefile.util.def | 6 ++++++ grub-core/commands/test.c | 30 ++++++++++++++---------------- tests/grub_script_test.in | 15 +++++++++++++++ 4 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 tests/grub_script_test.in diff --git a/ChangeLog b/ChangeLog index a721215c6..7a7d11c30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-04 Vladimir Serbinenko + + Fix test -a and -o precedence. + Reported by: adrian15. + 2013-05-04 Vladimir Serbinenko * grub-core/font/font.c (grub_font_construct_glyph): Fix memory leak. diff --git a/Makefile.util.def b/Makefile.util.def index a357341eb..d0ae67f72 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -581,6 +581,12 @@ script = { common = tests/example_grub_script_test.in; }; +script = { + testcase; + name = grub_script_test; + common = tests/grub_script_test.in; +}; + script = { testcase; name = grub_script_echo1; diff --git a/grub-core/commands/test.c b/grub-core/commands/test.c index e3347ee56..c98c13d8c 100644 --- a/grub-core/commands/test.c +++ b/grub-core/commands/test.c @@ -41,7 +41,8 @@ grub_strtosl (char *arg, char **end, int base) /* Context for test_parse. */ struct test_parse_ctx { - int ret, discard, invert; + int invert; + int or, and; int file_exists; struct grub_dirhook_info file_info; char *filename; @@ -51,9 +52,8 @@ struct test_parse_ctx static void update_val (int val, struct test_parse_ctx *ctx) { - if (! ctx->discard) - ctx->ret = ctx->invert ? ! val : val; - ctx->invert = ctx->discard = 0; + ctx->and = ctx->and && (ctx->invert ? ! val : val); + ctx->invert = 0; } /* A hook for iterating directories. */ @@ -153,8 +153,8 @@ static int test_parse (char **args, int *argn, int argc) { struct test_parse_ctx ctx = { - .ret = 0, - .discard = 0, + .and = 1, + .or = 0, .invert = 0 }; @@ -332,7 +332,7 @@ test_parse (char **args, int *argn, int argc) get_fileinfo (args[*argn + 1], &ctx); update_val (ctx.file_exists && ctx.file_info.dir, &ctx); (*argn) += 2; - return ctx.ret; + return ctx.or || ctx.and; } if (grub_strcmp (args[*argn], "-e") == 0) @@ -340,7 +340,7 @@ test_parse (char **args, int *argn, int argc) get_fileinfo (args[*argn + 1], &ctx); update_val (ctx.file_exists, &ctx); (*argn) += 2; - return ctx.ret; + return ctx.or || ctx.and; } if (grub_strcmp (args[*argn], "-f") == 0) @@ -349,7 +349,7 @@ test_parse (char **args, int *argn, int argc) /* FIXME: check for other types. */ update_val (ctx.file_exists && ! ctx.file_info.dir, &ctx); (*argn) += 2; - return ctx.ret; + return ctx.or || ctx.and; } if (grub_strcmp (args[*argn], "-s") == 0) @@ -362,7 +362,7 @@ test_parse (char **args, int *argn, int argc) grub_file_close (file); grub_errno = GRUB_ERR_NONE; (*argn) += 2; - return ctx.ret; + return ctx.or || ctx.and; } /* String tests. */ @@ -387,7 +387,7 @@ test_parse (char **args, int *argn, int argc) if (grub_strcmp (args[*argn], ")") == 0) { (*argn)++; - return ctx.ret; + return ctx.or || ctx.and; } /* Recursively invoke if parenthesis. */ if (grub_strcmp (args[*argn], "(") == 0) @@ -405,15 +405,13 @@ test_parse (char **args, int *argn, int argc) } if (grub_strcmp (args[*argn], "-a") == 0) { - /* If current value is 0 second value is to be discarded. */ - ctx.discard = ! ctx.ret; (*argn)++; continue; } if (grub_strcmp (args[*argn], "-o") == 0) { - /* If current value is 1 second value is to be discarded. */ - ctx.discard = ctx.ret; + ctx.or = ctx.or || ctx.and; + ctx.and = 1; (*argn)++; continue; } @@ -422,7 +420,7 @@ test_parse (char **args, int *argn, int argc) update_val (args[*argn][0], &ctx); (*argn)++; } - return ctx.ret; + return ctx.or || ctx.and; } static grub_err_t diff --git a/tests/grub_script_test.in b/tests/grub_script_test.in new file mode 100644 index 000000000..34a5f141d --- /dev/null +++ b/tests/grub_script_test.in @@ -0,0 +1,15 @@ +#! @builddir@/grub-shell-tester + +for device in 'hd0' 'fd0'; do + # But search them if their search has been inforced + set fd0search="no" + if [ "$device" != "fd0" -a "$device" != "cd" \ + -o \ + "$device" = "fd0" -a "$fd0search" = "yes" ]\ + ; then + echo "Yes" + else + echo "No" + fi + +done \ No newline at end of file From 0788a69514a2f2d19c0f8b9bd1b1835b589cbb20 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:40:52 +0200 Subject: [PATCH 146/187] * grub-core/gettext/gettext.c: Try $lang.gmo as well. --- ChangeLog | 4 ++++ grub-core/gettext/gettext.c | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a7d11c30..e0576e57b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-04 Vladimir Serbinenko + + * grub-core/gettext/gettext.c: Try $lang.gmo as well. + 2013-05-04 Vladimir Serbinenko Fix test -a and -o precedence. diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c index 569f98532..259251d76 100644 --- a/grub-core/gettext/gettext.c +++ b/grub-core/gettext/gettext.c @@ -355,19 +355,30 @@ grub_mofile_open_lang (struct grub_gettext_context *ctx, return grub_errno; err = grub_mofile_open (ctx, mo_file); + grub_free (mo_file); /* Will try adding .gz as well. */ if (err) { - char *mo_file_old; grub_errno = GRUB_ERR_NONE; - mo_file_old = mo_file; - mo_file = grub_xasprintf ("%s.gz", mo_file); - grub_free (mo_file_old); + mo_file = grub_xasprintf ("%s%s/%s.mo.gz", part1, part2, locale); if (!mo_file) return grub_errno; err = grub_mofile_open (ctx, mo_file); + grub_free (mo_file); } + + /* Will try adding .gmo as well. */ + if (err) + { + grub_errno = GRUB_ERR_NONE; + mo_file = grub_xasprintf ("%s%s/%s.gmo", part1, part2, locale); + if (!mo_file) + return grub_errno; + err = grub_mofile_open (ctx, mo_file); + grub_free (mo_file); + } + return err; } From c686014c1bdb8eda308b83ee61b5f5ba747b13cf Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:43:07 +0200 Subject: [PATCH 147/187] * grub-core/normal/menu.c (run_menu): Fix timeout reference point. --- ChangeLog | 4 ++++ grub-core/normal/menu.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0576e57b..6b0576d93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-04 Vladimir Serbinenko + + * grub-core/normal/menu.c (run_menu): Fix timeout reference point. + 2013-05-04 Vladimir Serbinenko * grub-core/gettext/gettext.c: Try $lang.gmo as well. diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c index 787b28775..fba19db99 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -519,12 +519,12 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) current_entry = default_entry; - /* Initialize the time. */ - saved_time = grub_get_time_ms (); - refresh: menu_init (current_entry, menu, nested); + /* Initialize the time. */ + saved_time = grub_get_time_ms (); + timeout = grub_menu_get_timeout (); if (timeout > 0) From 03f7c8c30478160357c55a18f82fa55e1b31d31a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:47:10 +0200 Subject: [PATCH 148/187] Fix several memory leaks. --- ChangeLog | 4 +++ grub-core/gfxmenu/font.c | 2 ++ grub-core/gfxmenu/gfxmenu.c | 2 +- grub-core/gfxmenu/gui_list.c | 5 ++- grub-core/gfxmenu/gui_progress_bar.c | 1 + grub-core/normal/context.c | 2 ++ grub-core/normal/main.c | 2 ++ grub-core/normal/menu_entry.c | 10 +++++- grub-core/normal/menu_text.c | 5 ++- grub-core/normal/term.c | 2 ++ grub-core/term/gfxterm.c | 47 ++++++++++++++++++++++------ grub-core/tests/lib/test.c | 3 +- grub-core/video/capture.c | 1 + 13 files changed, 72 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b0576d93..47f06fdc0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-04 Vladimir Serbinenko + + Fix several memory leaks. + 2013-05-04 Vladimir Serbinenko * grub-core/normal/menu.c (run_menu): Fix timeout reference point. diff --git a/grub-core/gfxmenu/font.c b/grub-core/gfxmenu/font.c index 4a8e1f11e..9c6e2d491 100644 --- a/grub-core/gfxmenu/font.c +++ b/grub-core/gfxmenu/font.c @@ -70,6 +70,8 @@ grub_font_draw_string (const char *str, grub_font_t font, return err; } + for (ptr = visual; ptr < visual + visual_len; ptr++) + grub_free (ptr->combining); grub_free (visual); return GRUB_ERR_NONE; diff --git a/grub-core/gfxmenu/gfxmenu.c b/grub-core/gfxmenu/gfxmenu.c index 51110a6f8..f49fce802 100644 --- a/grub-core/gfxmenu/gfxmenu.c +++ b/grub-core/gfxmenu/gfxmenu.c @@ -85,7 +85,7 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested) || cached_view->screen.width != mode_info.width || cached_view->screen.height != mode_info.height) { - grub_free (cached_view); + grub_gfxmenu_view_destroy (cached_view); /* Create the view. */ cached_view = grub_gfxmenu_view_new (full_theme_path ? : theme_path, mode_info.width, diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c index a06603b0b..1a2a16d32 100644 --- a/grub-core/gfxmenu/gui_list.c +++ b/grub-core/gfxmenu/gui_list.c @@ -83,7 +83,10 @@ list_destroy (void *vself) self->selected_item_box->destroy (self->selected_item_box); if (self->icon_manager) grub_gfxmenu_icon_manager_destroy (self->icon_manager); - + if (self->scrollbar_thumb) + self->scrollbar_thumb->destroy (self->scrollbar_thumb); + if (self->scrollbar_frame) + self->scrollbar_frame->destroy (self->scrollbar_frame); grub_free (self); } diff --git a/grub-core/gfxmenu/gui_progress_bar.c b/grub-core/gfxmenu/gui_progress_bar.c index 965c6b386..cb709302b 100644 --- a/grub-core/gfxmenu/gui_progress_bar.c +++ b/grub-core/gfxmenu/gui_progress_bar.c @@ -185,6 +185,7 @@ draw_text (grub_gui_progress_bar_t self) int y = ((height - grub_font_get_descent (font)) / 2 + grub_font_get_ascent (font) / 2); grub_font_draw_string (text, font, text_color, x, y); + grub_free (text); } } diff --git a/grub-core/normal/context.c b/grub-core/normal/context.c index e9923ccdc..7e0a696f3 100644 --- a/grub-core/normal/context.c +++ b/grub-core/normal/context.c @@ -139,6 +139,8 @@ grub_env_context_close (void) grub_current_context = context; menu = current_menu->prev; + if (current_menu->menu) + grub_normal_free_menu (current_menu->menu); grub_free (current_menu); current_menu = menu; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c index 759e0a4c4..f7a815fa1 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -127,6 +127,7 @@ grub_normal_free_menu (grub_menu_t menu) grub_free ((void *) entry->users); grub_free ((void *) entry->title); grub_free ((void *) entry->sourcecode); + grub_free (entry); entry = next_entry; } @@ -191,6 +192,7 @@ read_config_file (const char *config) if (ptr) *ptr = 0; grub_env_set ("config_directory", config_dir); + grub_free (config_dir); grub_env_export ("config_file"); grub_env_export ("config_directory"); diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c index e0407aa88..3cc0c0113 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c @@ -517,7 +517,15 @@ destroy_screen (struct screen *screen) struct line *linep = screen->lines + i; if (linep) - grub_free (linep->buf); + { + unsigned j; + if (linep->pos) + for (j = 0; j < screen->nterms; j++) + grub_free (linep->pos[j]); + + grub_free (linep->buf); + grub_free (linep->pos); + } } grub_free (screen->killed_text); diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c index e1d3c8fcb..19a538930 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -56,8 +56,10 @@ grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position, while (str < last_position) { struct grub_unicode_glyph glyph; + glyph.combining = 0; str += grub_unicode_aglomerate_comb (str, last_position - str, &glyph); width += grub_term_getcharwidth (term, &glyph); + grub_free (glyph.combining); } return width; } @@ -396,6 +398,7 @@ menu_text_print_timeout (int timeout, void *dataptr) } grub_print_message_indented (msg_translated, 3, 0, data->term); + grub_free (msg_translated); posx = grub_term_getxy (data->term) >> 8; grub_print_spaces (data->term, grub_term_width (data->term) - posx - 1); @@ -447,7 +450,7 @@ menu_text_fini (void *dataptr) grub_term_setcursor (data->term, 1); grub_term_cls (data->term); - + grub_free (data); } static void diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index 976442382..820156f48 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -952,6 +952,8 @@ print_ucs4_real (const grub_uint32_t * str, ret++; if (visual_len_show && visual[visual_len_show - 1].base != '\n') ret++; + for (vptr = visual; vptr < visual + visual_len; vptr++) + grub_free (vptr->combining); grub_free (visual); } else diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c index a168e01cf..1e33a34b3 100644 --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -175,7 +175,11 @@ set_term_color (grub_uint8_t term_color) static void clear_char (struct grub_colored_char *c) { - grub_free (c->code); + if (c->code) + { + grub_free (c->code->combining); + grub_free (c->code); + } c->code = grub_unicode_glyph_from_code (' '); if (!c->code) grub_errno = GRUB_ERR_NONE; @@ -188,7 +192,18 @@ grub_virtual_screen_free (void) { /* If virtual screen has been allocated, free it. */ if (virtual_screen.text_buffer != 0) - grub_free (virtual_screen.text_buffer); + { + unsigned i; + for (i = 0; + i < virtual_screen.columns * virtual_screen.rows; + i++) + if (virtual_screen.text_buffer[i].code) + { + grub_free (virtual_screen.text_buffer[i].code->combining); + grub_free (virtual_screen.text_buffer[i].code); + } + grub_free (virtual_screen.text_buffer); + } /* Reset virtual screen data. */ grub_memset (&virtual_screen, 0, sizeof (virtual_screen)); @@ -403,7 +418,11 @@ grub_gfxterm_term_fini (struct grub_term_output *term __attribute__ ((unused))) for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++) { - grub_free (virtual_screen.text_buffer[i].code); + if (virtual_screen.text_buffer[i].code) + { + grub_free (virtual_screen.text_buffer[i].code->combining); + grub_free (virtual_screen.text_buffer[i].code); + } virtual_screen.text_buffer[i].code = 0; } @@ -798,7 +817,11 @@ scroll_up (void) /* Clear first line in text buffer. */ for (i = 0; i < virtual_screen.columns; i++) - grub_free (virtual_screen.text_buffer[i].code); + if (virtual_screen.text_buffer[i].code) + { + grub_free (virtual_screen.text_buffer[i].code->combining); + grub_free (virtual_screen.text_buffer[i].code); + } /* Scroll text buffer with one line to up. */ grub_memmove (virtual_screen.text_buffer, @@ -874,7 +897,11 @@ grub_gfxterm_putchar (struct grub_term_output *term, p = (virtual_screen.text_buffer + virtual_screen.cursor_x + virtual_screen.cursor_y * virtual_screen.columns); - grub_free (p->code); + if (p->code) + { + grub_free (p->code->combining); + grub_free (p->code); + } p->code = grub_unicode_glyph_dup (c); if (!p->code) grub_errno = GRUB_ERR_NONE; @@ -889,10 +916,12 @@ grub_gfxterm_putchar (struct grub_term_output *term, for (i = 1; i < char_width && p + i < virtual_screen.text_buffer + virtual_screen.columns * virtual_screen.rows; i++) - { - grub_free (p[i].code); - p[i].code = NULL; - } + if (p[i].code) + { + grub_free (p[i].code->combining); + grub_free (p[i].code); + p[i].code = NULL; + } } /* Draw glyph. */ diff --git a/grub-core/tests/lib/test.c b/grub-core/tests/lib/test.c index 1d2cb8c6e..3000fc88d 100644 --- a/grub-core/tests/lib/test.c +++ b/grub-core/tests/lib/test.c @@ -87,7 +87,8 @@ failure_append_vtext(grub_test_failure_t failure, const char *fmt, va_list args) char *oldmsg = failure->message; failure->message = grub_xasprintf("%s%s", oldmsg, msg); - grub_free(oldmsg); + grub_free (oldmsg); + grub_free (msg); } else { diff --git a/grub-core/video/capture.c b/grub-core/video/capture.c index be7fb61af..18ffa28e3 100644 --- a/grub-core/video/capture.c +++ b/grub-core/video/capture.c @@ -115,6 +115,7 @@ grub_video_capture_get_framebuffer (void) void grub_video_capture_end (void) { + grub_video_fb_delete_render_target (framebuffer.render_target); grub_free (framebuffer.ptr); grub_video_fb_fini (); grub_video_adapter_active = saved; From 14af86e41b594dbcd97557157fe5d005505b0455 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:50:16 +0200 Subject: [PATCH 149/187] * grub-core/normal/main.c: Fix freed memory dereference. --- ChangeLog | 4 ++++ grub-core/normal/main.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47f06fdc0..16456f032 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-04 Vladimir Serbinenko + + * grub-core/normal/main.c: Fix freed memory dereference. + 2013-05-04 Vladimir Serbinenko Fix several memory leaks. diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c index f7a815fa1..ffc2cd221 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -163,8 +163,9 @@ static grub_menu_t read_config_file (const char *config) { grub_file_t file; - const char *old_file, *old_dir; + char *old_file = 0, *old_dir = 0; char *config_dir, *ptr = 0; + const char *ctmp; grub_menu_t newmenu; @@ -183,8 +184,12 @@ read_config_file (const char *config) if (! file) return 0; - old_file = grub_env_get ("config_file"); - old_dir = grub_env_get ("config_directory"); + ctmp = grub_env_get ("config_file"); + if (ctmp) + old_file = grub_strdup (ctmp); + ctmp = grub_env_get ("config_directory"); + if (ctmp) + old_dir = grub_strdup (ctmp); grub_env_set ("config_file", config); config_dir = grub_strdup (config); if (config_dir) @@ -220,6 +225,8 @@ read_config_file (const char *config) grub_env_set ("config_directory", old_dir); else grub_env_unset ("config_directory"); + grub_free (old_file); + grub_free (old_dir); grub_file_close (file); From 44dea3f9a93aeaedab7412fc32c26cfc570b7295 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:52:21 +0200 Subject: [PATCH 150/187] * grub-core/normal/menu_text.c (menu_clear_timeout): Clear second line of timeout as it may contain the rest of long line. --- ChangeLog | 5 +++++ grub-core/normal/menu_text.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 16456f032..8d415176b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-04 Vladimir Serbinenko + + * grub-core/normal/menu_text.c (menu_clear_timeout): Clear second + line of timeout as it may contain the rest of long line. + 2013-05-04 Vladimir Serbinenko * grub-core/normal/main.c: Fix freed memory dereference. diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c index 19a538930..d7e564158 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -460,6 +460,8 @@ menu_text_clear_timeout (void *dataptr) grub_term_gotoxy (data->term, 0, grub_term_height (data->term) - 3); grub_print_spaces (data->term, grub_term_width (data->term) - 1); + grub_term_gotoxy (data->term, 0, grub_term_height (data->term) - 2); + grub_print_spaces (data->term, grub_term_width (data->term) - 1); grub_term_gotoxy (data->term, grub_term_cursor_x (data->term), GRUB_TERM_FIRST_ENTRY_Y + data->offset); grub_term_refresh (data->term); From 0fb356a3852b12042bde06d56e1554c1da3874bc Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:54:08 +0200 Subject: [PATCH 151/187] * grub-core/tests/lib/functional_test.c: Don't stop on first failed test. --- ChangeLog | 5 +++++ grub-core/tests/lib/functional_test.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8d415176b..d5f9bb90c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-04 Vladimir Serbinenko + + * grub-core/tests/lib/functional_test.c: Don't stop on first failed + test. + 2013-05-04 Vladimir Serbinenko * grub-core/normal/menu_text.c (menu_clear_timeout): Clear second diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c index c70e1add1..957354e05 100644 --- a/grub-core/tests/lib/functional_test.c +++ b/grub-core/tests/lib/functional_test.c @@ -33,7 +33,11 @@ grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)), int ok = 1; FOR_LIST_ELEMENTS (test, grub_test_list) - ok = ok && !grub_test_run (test); + { + grub_errno = 0; + ok = ok && !grub_test_run (test); + grub_errno = 0; + } if (ok) grub_printf ("ALL TESTS PASSED\n"); else From 92323d1fb0f9ec705f8d6229beea3533effe0f89 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 13:58:30 +0200 Subject: [PATCH 152/187] Speed-up gfxterm by saving intermediate results in index+alpha format. --- ChangeLog | 5 + grub-core/term/gfxterm.c | 2 +- grub-core/video/fb/fbblit.c | 370 ++++++++++++++++++++++++++++++++++ grub-core/video/fb/video_fb.c | 298 ++++++++++++++++----------- include/grub/video.h | 5 + include/grub/video_fb.h | 54 +++++ 6 files changed, 613 insertions(+), 121 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5f9bb90c..74cb13d25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-04 Vladimir Serbinenko + + Speed-up gfxterm by saving intermediate results in index+alpha + format. + 2013-05-04 Vladimir Serbinenko * grub-core/tests/lib/functional_test.c: Don't stop on first failed diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c index 1e33a34b3..54636d771 100644 --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -254,7 +254,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y, grub_video_create_render_target (&text_layer, virtual_screen.width, virtual_screen.height, - GRUB_VIDEO_MODE_TYPE_RGB + GRUB_VIDEO_MODE_TYPE_INDEX_COLOR | GRUB_VIDEO_MODE_TYPE_ALPHA); if (grub_errno != GRUB_ERR_NONE) return grub_errno; diff --git a/grub-core/video/fb/fbblit.c b/grub-core/video/fb/fbblit.c index 541a0ceaf..c206ac872 100644 --- a/grub-core/video/fb/fbblit.c +++ b/grub-core/video/fb/fbblit.c @@ -389,6 +389,376 @@ grub_video_fbblit_replace_8bit_1bit (struct grub_video_fbblit_info *dst, } } +void +grub_video_fbblit_replace_32bit_indexa (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y) +{ + int i; + int j; + grub_uint8_t *srcptr; + grub_uint32_t *dstptr; + unsigned int dstrowskip; + unsigned int srcrowskip; + grub_uint32_t palette[17]; + + srcptr = grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = grub_video_fb_get_video_ptr (dst, x, y); + + /* Calculate the number of bytes to advance from the end of one line + to the beginning of the next line. */ + dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + srcrowskip = src->mode_info->pitch - width; + + for (i = 0; i < 16; i++) + palette[i] = grub_video_fb_map_color (i); + palette[16] = grub_video_fb_map_rgba (0, 0, 0, 0); + + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + if (*srcptr == 0xf0) + *dstptr = palette[16]; + else + *dstptr = palette[*srcptr & 0xf]; + srcptr++; + dstptr++; + } + + srcptr += srcrowskip; + GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip); + } +} + +/* Optimized replacing blitter for 1-bit to 16bit. */ +void +grub_video_fbblit_replace_24bit_indexa (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y) +{ + int i; + int j; + grub_uint8_t *srcptr; + grub_uint8_t *dstptr; + unsigned int dstrowskip; + unsigned int srcrowskip; + grub_uint32_t palette[17]; + + srcptr = grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = grub_video_fb_get_video_ptr (dst, x, y); + + /* Calculate the number of bytes to advance from the end of one line + to the beginning of the next line. */ + dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + srcrowskip = src->mode_info->pitch - width; + + for (i = 0; i < 16; i++) + palette[i] = grub_video_fb_map_color (i); + palette[16] = grub_video_fb_map_rgba (0, 0, 0, 0); + + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + register grub_uint32_t col; + if (*srcptr == 0xf0) + col = palette[16]; + else + col = palette[*srcptr & 0xf]; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + *dstptr++ = col >> 16; + *dstptr++ = col >> 8; + *dstptr++ = col >> 0; +#else + *dstptr++ = col >> 0; + *dstptr++ = col >> 8; + *dstptr++ = col >> 16; +#endif + srcptr++; + } + + srcptr += srcrowskip; + dstptr += dstrowskip; + } +} + +/* Optimized replacing blitter for 1-bit to 16bit. */ +void +grub_video_fbblit_replace_16bit_indexa (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y) +{ + int i; + int j; + grub_uint8_t *srcptr; + grub_uint16_t *dstptr; + unsigned int dstrowskip; + unsigned int srcrowskip; + grub_uint16_t palette[17]; + + srcptr = grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = grub_video_fb_get_video_ptr (dst, x, y); + + /* Calculate the number of bytes to advance from the end of one line + to the beginning of the next line. */ + dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + srcrowskip = src->mode_info->pitch - width; + + for (i = 0; i < 16; i++) + palette[i] = grub_video_fb_map_color (i); + palette[16] = grub_video_fb_map_rgba (0, 0, 0, 0); + + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + if (*srcptr == 0xf0) + *dstptr = palette[16]; + else + *dstptr = palette[*srcptr & 0xf]; + srcptr++; + dstptr++; + } + + srcptr += srcrowskip; + GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip); + } +} + +/* Optimized replacing blitter for 1-bit to 8bit. */ +void +grub_video_fbblit_replace_8bit_indexa (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y) +{ + int i; + int j; + grub_uint8_t *srcptr; + grub_uint8_t *dstptr; + unsigned int dstrowskip; + unsigned int srcrowskip; + grub_uint8_t palette[17]; + + srcptr = grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = grub_video_fb_get_video_ptr (dst, x, y); + + /* Calculate the number of bytes to advance from the end of one line + to the beginning of the next line. */ + dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + srcrowskip = src->mode_info->pitch - width; + + for (i = 0; i < 16; i++) + palette[i] = grub_video_fb_map_color (i); + palette[16] = grub_video_fb_map_rgba (0, 0, 0, 0); + + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + if (*srcptr == 0xf0) + *dstptr = palette[16]; + else + *dstptr = palette[*srcptr & 0xf]; + srcptr++; + dstptr++; + } + + srcptr += srcrowskip; + dstptr += dstrowskip; + } +} + + +void +grub_video_fbblit_blend_32bit_indexa (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y) +{ + int i; + int j; + grub_uint8_t *srcptr; + grub_uint32_t *dstptr; + unsigned int dstrowskip; + unsigned int srcrowskip; + grub_uint32_t palette[16]; + + srcptr = grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = grub_video_fb_get_video_ptr (dst, x, y); + + /* Calculate the number of bytes to advance from the end of one line + to the beginning of the next line. */ + dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + srcrowskip = src->mode_info->pitch - width; + + for (i = 0; i < 16; i++) + palette[i] = grub_video_fb_map_color (i); + + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + if (*srcptr != 0xf0) + *dstptr = palette[*srcptr & 0xf]; + srcptr++; + dstptr++; + } + + srcptr += srcrowskip; + GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip); + } +} + +/* Optimized replacing blitter for 1-bit to 16bit. */ +void +grub_video_fbblit_blend_24bit_indexa (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y) +{ + int i; + int j; + grub_uint8_t *srcptr; + grub_uint8_t *dstptr; + unsigned int dstrowskip; + unsigned int srcrowskip; + grub_uint32_t palette[16]; + + srcptr = grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = grub_video_fb_get_video_ptr (dst, x, y); + + /* Calculate the number of bytes to advance from the end of one line + to the beginning of the next line. */ + dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + srcrowskip = src->mode_info->pitch - width; + + for (i = 0; i < 16; i++) + palette[i] = grub_video_fb_map_color (i); + + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + register grub_uint32_t col; + if (*srcptr != 0xf0) + { + col = palette[*srcptr & 0xf]; +#ifdef GRUB_CPU_WORDS_BIGENDIAN + *dstptr++ = col >> 16; + *dstptr++ = col >> 8; + *dstptr++ = col >> 0; +#else + *dstptr++ = col >> 0; + *dstptr++ = col >> 8; + *dstptr++ = col >> 16; +#endif + } + else + dstptr += 3; + srcptr++; + } + + srcptr += srcrowskip; + dstptr += dstrowskip; + } +} + +/* Optimized replacing blitter for 1-bit to 16bit. */ +void +grub_video_fbblit_blend_16bit_indexa (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y) +{ + int i; + int j; + grub_uint8_t *srcptr; + grub_uint16_t *dstptr; + unsigned int dstrowskip; + unsigned int srcrowskip; + grub_uint16_t palette[17]; + + srcptr = grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = grub_video_fb_get_video_ptr (dst, x, y); + + /* Calculate the number of bytes to advance from the end of one line + to the beginning of the next line. */ + dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + srcrowskip = src->mode_info->pitch - width; + + for (i = 0; i < 16; i++) + palette[i] = grub_video_fb_map_color (i); + + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + if (*srcptr != 0xf0) + *dstptr = palette[*srcptr & 0xf]; + srcptr++; + dstptr++; + } + + srcptr += srcrowskip; + GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip); + } +} + +/* Optimized replacing blitter for 1-bit to 8bit. */ +void +grub_video_fbblit_blend_8bit_indexa (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y) +{ + int i; + int j; + grub_uint8_t *srcptr; + grub_uint8_t *dstptr; + unsigned int dstrowskip; + unsigned int srcrowskip; + grub_uint8_t palette[16]; + + srcptr = grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = grub_video_fb_get_video_ptr (dst, x, y); + + /* Calculate the number of bytes to advance from the end of one line + to the beginning of the next line. */ + dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; + srcrowskip = src->mode_info->pitch - width; + + for (i = 0; i < 16; i++) + palette[i] = grub_video_fb_map_color (i); + + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + if (*srcptr != 0xf0) + *dstptr = palette[*srcptr & 0xf]; + srcptr++; + dstptr++; + } + + srcptr += srcrowskip; + dstptr += dstrowskip; + } +} + + /* Optimized replacing blitter for RGBX8888 to BGRX8888. */ void grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst, diff --git a/grub-core/video/fb/video_fb.c b/grub-core/video/fb/video_fb.c index 836842e15..22a0128a1 100644 --- a/grub-core/video/fb/video_fb.c +++ b/grub-core/video/fb/video_fb.c @@ -542,11 +542,18 @@ grub_video_color_t grub_video_fb_map_rgba (grub_uint8_t red, grub_uint8_t green, grub_uint8_t blue, grub_uint8_t alpha) { + if ((framebuffer.render_target->mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) != 0) - /* No alpha available in index color modes, just use - same value as in only RGB modes. */ - return grub_video_fb_map_rgb (red, green, blue); + { + if ((framebuffer.render_target->mode_info.mode_type + & GRUB_VIDEO_MODE_TYPE_ALPHA) != 0 + && alpha == 0) + return 0xf0; + /* No alpha available in index color modes, just use + same value as in only RGB modes. */ + return grub_video_fb_map_rgb (red, green, blue); + } else if ((framebuffer.render_target->mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP) != 0) { @@ -605,6 +612,17 @@ grub_video_fb_unmap_color_int (struct grub_video_fbblit_info * source, if ((mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) != 0) { + if ((framebuffer.render_target->mode_info.mode_type + & GRUB_VIDEO_MODE_TYPE_ALPHA) != 0 + && color == 0xf0) + { + *red = 0; + *green = 0; + *blue = 0; + *alpha = 0; + return; + } + /* If we have an out-of-bounds color, return transparent black. */ if (color > 255) { @@ -772,134 +790,153 @@ common_blitter (struct grub_video_fbblit_info *target, if (oper == GRUB_VIDEO_BLIT_REPLACE) { /* Try to figure out more optimized version for replace operator. */ - if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888) + switch (source->mode_info->blit_format) { - if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888) + case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888: + switch (target->mode_info->blit_format) { + case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888: grub_video_fbblit_replace_directN (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888) - { + case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888: grub_video_fbblit_replace_BGRX8888_RGBX8888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGR_888) - { + case GRUB_VIDEO_BLIT_FORMAT_BGR_888: grub_video_fbblit_replace_BGR888_RGBX8888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_888) - { + case GRUB_VIDEO_BLIT_FORMAT_RGB_888: grub_video_fbblit_replace_RGB888_RGBX8888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR) - { + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR: grub_video_fbblit_replace_index_RGBX8888 (target, source, x, y, width, height, offset_x, offset_y); return; + default: + break; } - } - else if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_888) - { - if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888) + break; + case GRUB_VIDEO_BLIT_FORMAT_RGB_888: + switch (target->mode_info->blit_format) { + case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888: grub_video_fbblit_replace_BGRX8888_RGB888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888) - { + case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888: grub_video_fbblit_replace_RGBX8888_RGB888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGR_888) - { + case GRUB_VIDEO_BLIT_FORMAT_BGR_888: grub_video_fbblit_replace_BGR888_RGB888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_888) - { + case GRUB_VIDEO_BLIT_FORMAT_RGB_888: grub_video_fbblit_replace_directN (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR) - { + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR: grub_video_fbblit_replace_index_RGB888 (target, source, x, y, width, height, offset_x, offset_y); return; + default: + break; } - } - else if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888) - { - if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888) + break; + case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888: + switch (target->mode_info->blit_format) { + case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888: grub_video_fbblit_replace_directN (target, source, x, y, width, height, offset_x, offset_y); return; + default: + break; } - } - else if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR) - { - if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR) + break; + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR: + switch (target->mode_info->blit_format) { + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR: + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA: grub_video_fbblit_replace_directN (target, source, x, y, width, height, offset_x, offset_y); return; + default: + break; } - } - else if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED) - { - if (target->mode_info->bpp == 32) + break; + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA: + switch (target->mode_info->bytes_per_pixel) { + case 4: + grub_video_fbblit_replace_32bit_indexa (target, source, + x, y, width, height, + offset_x, offset_y); + return; + case 3: + grub_video_fbblit_replace_24bit_indexa (target, source, + x, y, width, height, + offset_x, offset_y); + return; + case 2: + grub_video_fbblit_replace_16bit_indexa (target, source, + x, y, width, height, + offset_x, offset_y); + return; + case 1: + grub_video_fbblit_replace_8bit_indexa (target, source, + x, y, width, height, + offset_x, offset_y); + return; + default: + break; + } + break; + case GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED: + switch (target->mode_info->bytes_per_pixel) + { + case 4: grub_video_fbblit_replace_32bit_1bit (target, source, x, y, width, height, offset_x, offset_y); return; - } #ifdef GRUB_HAVE_UNALIGNED_ACCESS - else if (target->mode_info->bpp == 24) - { + case 3: grub_video_fbblit_replace_24bit_1bit (target, source, x, y, width, height, offset_x, offset_y); return; - } #endif - else if (target->mode_info->bpp == 16) - { + case 2: grub_video_fbblit_replace_16bit_1bit (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->bpp == 8) - { + case 1: grub_video_fbblit_replace_8bit_1bit (target, source, x, y, width, height, offset_x, offset_y); return; } + break; + default: + break; } /* No optimized replace operator found, use default (slow) blitter. */ @@ -909,123 +946,131 @@ common_blitter (struct grub_video_fbblit_info *target, else { /* Try to figure out more optimized blend operator. */ - if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888) + switch (source->mode_info->blit_format) { - if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888) + case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888: + switch (target->mode_info->blit_format) { + case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888: grub_video_fbblit_blend_BGRA8888_RGBA8888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888) - { + case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888: grub_video_fbblit_blend_RGBA8888_RGBA8888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGR_888) - { + case GRUB_VIDEO_BLIT_FORMAT_BGR_888: grub_video_fbblit_blend_BGR888_RGBA8888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_888) - { + case GRUB_VIDEO_BLIT_FORMAT_RGB_888: grub_video_fbblit_blend_RGB888_RGBA8888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR) - { + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR: grub_video_fbblit_blend_index_RGBA8888 (target, source, x, y, width, height, offset_x, offset_y); return; + default: + break; } - } - else if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_888) - { + break; + case GRUB_VIDEO_BLIT_FORMAT_RGB_888: /* Note: There is really no alpha information here, so blend is changed to replace. */ - if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888) + switch (target->mode_info->blit_format) { + case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888: grub_video_fbblit_replace_BGRX8888_RGB888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888) - { + case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888: grub_video_fbblit_replace_RGBX8888_RGB888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_BGR_888) - { + case GRUB_VIDEO_BLIT_FORMAT_BGR_888: grub_video_fbblit_replace_BGR888_RGB888 (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_RGB_888) - { + case GRUB_VIDEO_BLIT_FORMAT_RGB_888: grub_video_fbblit_replace_directN (target, source, x, y, width, height, offset_x, offset_y); return; - } - else if (target->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR) - { + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR: grub_video_fbblit_replace_index_RGB888 (target, source, x, y, width, height, offset_x, offset_y); return; + default: + break; } - } - else if (source->mode_info->blit_format == GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED) - { - if (target->mode_info->blit_format - == GRUB_VIDEO_BLIT_FORMAT_BGRA_8888 - || target->mode_info->blit_format - == GRUB_VIDEO_BLIT_FORMAT_RGBA_8888) + break; + case GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED: + switch (target->mode_info->blit_format) { + case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888: + case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888: grub_video_fbblit_blend_XXXA8888_1bit (target, source, x, y, width, height, offset_x, offset_y); return; - } #ifdef GRUB_HAVE_UNALIGNED_ACCESS - else if (target->mode_info->blit_format - == GRUB_VIDEO_BLIT_FORMAT_BGR_888 - || target->mode_info->blit_format - == GRUB_VIDEO_BLIT_FORMAT_RGB_888) - { + case GRUB_VIDEO_BLIT_FORMAT_BGR_888: + case GRUB_VIDEO_BLIT_FORMAT_RGB_888: grub_video_fbblit_blend_XXX888_1bit (target, source, x, y, width, height, offset_x, offset_y); return; - } #endif - else if (target->mode_info->blit_format - == GRUB_VIDEO_BLIT_FORMAT_BGR_565 - || target->mode_info->blit_format - == GRUB_VIDEO_BLIT_FORMAT_RGB_565) - { + case GRUB_VIDEO_BLIT_FORMAT_BGR_565: + case GRUB_VIDEO_BLIT_FORMAT_RGB_565: grub_video_fbblit_blend_XXX565_1bit (target, source, x, y, width, height, offset_x, offset_y); return; + default: + break; } - + break; + case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA: + switch (target->mode_info->bytes_per_pixel) + { + case 4: + grub_video_fbblit_blend_32bit_indexa (target, source, + x, y, width, height, + offset_x, offset_y); + return; + case 3: + grub_video_fbblit_blend_24bit_indexa (target, source, + x, y, width, height, + offset_x, offset_y); + return; + case 2: + grub_video_fbblit_blend_16bit_indexa (target, source, + x, y, width, height, + offset_x, offset_y); + return; + case 1: + grub_video_fbblit_blend_8bit_indexa (target, source, + x, y, width, height, + offset_x, offset_y); + return; + } + break; + default: + break; } - /* No optimized blend operation found, use default (slow) blitter. */ grub_video_fbblit_blend (target, source, x, y, width, height, offset_x, offset_y); @@ -1411,22 +1456,35 @@ grub_video_fb_create_render_target (struct grub_video_fbrender_target **result, /* Setup render target format. */ target->mode_info.width = width; target->mode_info.height = height; - target->mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_RGB - | GRUB_VIDEO_MODE_TYPE_ALPHA; - target->mode_info.bpp = 32; - target->mode_info.bytes_per_pixel = 4; + switch (mode_type) + { + case GRUB_VIDEO_MODE_TYPE_INDEX_COLOR + | GRUB_VIDEO_MODE_TYPE_ALPHA: + target->mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR + | GRUB_VIDEO_MODE_TYPE_ALPHA; + target->mode_info.bpp = 8; + target->mode_info.bytes_per_pixel = 1; + target->mode_info.number_of_colors = 16; + target->mode_info.blit_format = GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA; + break; + default: + target->mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_RGB + | GRUB_VIDEO_MODE_TYPE_ALPHA; + target->mode_info.bpp = 32; + target->mode_info.bytes_per_pixel = 4; + target->mode_info.red_mask_size = 8; + target->mode_info.red_field_pos = 0; + target->mode_info.green_mask_size = 8; + target->mode_info.green_field_pos = 8; + target->mode_info.blue_mask_size = 8; + target->mode_info.blue_field_pos = 16; + target->mode_info.reserved_mask_size = 8; + target->mode_info.reserved_field_pos = 24; + target->mode_info.number_of_colors = framebuffer.palette_size; /* Emulated palette. */ + target->mode_info.blit_format = GRUB_VIDEO_BLIT_FORMAT_RGBA_8888; + break; + } target->mode_info.pitch = target->mode_info.bytes_per_pixel * width; - target->mode_info.number_of_colors = framebuffer.palette_size; /* Emulated palette. */ - target->mode_info.red_mask_size = 8; - target->mode_info.red_field_pos = 0; - target->mode_info.green_mask_size = 8; - target->mode_info.green_field_pos = 8; - target->mode_info.blue_mask_size = 8; - target->mode_info.blue_field_pos = 16; - target->mode_info.reserved_mask_size = 8; - target->mode_info.reserved_field_pos = 24; - - target->mode_info.blit_format = grub_video_get_blit_format (&target->mode_info); /* Calculate size needed for the data. */ size = (width * target->mode_info.bytes_per_pixel) * height; diff --git a/include/grub/video.h b/include/grub/video.h index 36e863be3..b2d145812 100644 --- a/include/grub/video.h +++ b/include/grub/video.h @@ -101,6 +101,11 @@ enum grub_video_blit_format /* When needed, decode color or just use value as is. */ GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR, + /* Like index but only 16-colors and F0 is a special value for transparency. + Could be extended to 4 bits of alpha and 4 bits of color if necessary. + Used internally for text rendering. + */ + GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA, /* Two color bitmap; bits packed: rows are not padded to byte boundary. */ GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED diff --git a/include/grub/video_fb.h b/include/grub/video_fb.h index ffe16c3ac..88bc75d9d 100644 --- a/include/grub/video_fb.h +++ b/include/grub/video_fb.h @@ -118,6 +118,60 @@ EXPORT_FUNC(grub_video_fb_get_active_render_target) (struct grub_video_fbrender_ grub_err_t EXPORT_FUNC(grub_video_fb_set_active_render_target) (struct grub_video_fbrender_target *target); +void +EXPORT_FUNC (grub_video_fbblit_blend_32bit_indexa) (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y); + +void +EXPORT_FUNC (grub_video_fbblit_blend_24bit_indexa) (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y); +void +EXPORT_FUNC (grub_video_fbblit_blend_16bit_indexa) (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y); +void +EXPORT_FUNC (grub_video_fbblit_blend_8bit_indexa) (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y); + + +void +EXPORT_FUNC (grub_video_fbblit_replace_32bit_indexa) (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y); + +void +EXPORT_FUNC (grub_video_fbblit_replace_24bit_indexa) (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y); + +void +EXPORT_FUNC (grub_video_fbblit_replace_16bit_indexa) (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y); +void +EXPORT_FUNC (grub_video_fbblit_replace_8bit_indexa) (struct grub_video_fbblit_info *dst, + struct grub_video_fbblit_info *src, + int x, int y, + int width, int height, + int offset_x, int offset_y); + typedef grub_err_t (*grub_video_fb_set_page_t) (int page); grub_err_t From b7c036bce3d93370e6d90c312b2adb35dbfc7430 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 14:00:14 +0200 Subject: [PATCH 153/187] More video checks. --- ChangeLog | 4 + grub-core/tests/checksums.h | 396 ++++++++++++++++++++++++++----- grub-core/tests/gfxterm_menu.c | 77 +++++- grub-core/tests/video_checksum.c | 147 ++++++++---- grub-core/video/video.c | 6 +- include/grub/test.h | 4 + tests/grub_func_test.in | 2 +- tests/util/grub-shell.in | 2 + 8 files changed, 510 insertions(+), 128 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74cb13d25..a13face96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-04 Vladimir Serbinenko + + More video checks. + 2013-05-04 Vladimir Serbinenko Speed-up gfxterm by saving intermediate results in index+alpha diff --git a/grub-core/tests/checksums.h b/grub-core/tests/checksums.h index c2d2f5ab6..ac677bbec 100644 --- a/grub-core/tests/checksums.h +++ b/grub-core/tests/checksums.h @@ -1,66 +1,339 @@ - { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, }, 6 }, - { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, }, 6 }, - { "gfxterm_menu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, }, 6 }, - { "gfxterm_menu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, }, 6 }, - { "gfxterm_menu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x9093f849, 0xc02929e3, 0x9093f849, 0xe2f077d4, 0x5387d57f, }, 6 }, - { "gfxterm_menu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbbe054f6, 0xbef13bfe, 0xbbe054f6, 0xa23fcfe0, 0xf83ee7aa, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x8cea8db2, 0x9688dd3b, 0x8cea8db2, 0x6fe82515, 0x724366e5, }, 6 }, - { "gfxterm_menu", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x25e346a1, 0xbd5eb38b, 0x25e346a1, 0x9d469431, 0x5387d57f, }, 6 }, - { "gfxterm_menu", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x6f33e7a0, 0x5716dafe, 0x6f33e7a0, 0xbfa18d18, 0xf83ee7aa, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xffb24323, 0x6e8fa0be, 0xffb24323, 0xad5c8fa5, 0x724366e5, }, 6 }, - { "gfxterm_menu", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0x5a925b39, 0x36226b, 0x5a925b39, 0xafa322b7, 0x1c955882, }, 6 }, - { "gfxterm_menu", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfb4aecf8, 0x17b91739, 0xfb4aecf8, 0xf7e3d211, 0x4d266f7a, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x4015c90f, 0x430ae98c, 0x4015c90f, 0xeb61f90d, 0x1ed9d731, }, 6 }, - { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4df27666, 0xb8015ce1, 0x4df27666, 0x8bef2cac, 0x9813a416, }, 6 }, - { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6d1d5058, 0xb2d8ed2c, 0x6d1d5058, 0xe8936168, 0x5fcf013d, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xeec86af1, 0x13493ea, 0xeec86af1, 0xee83739a, 0xdd28f52b, }, 6 }, - { "gfxterm_menu", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x9093f849, 0xc02929e3, 0x9093f849, 0xe2f077d4, 0x5387d57f, }, 6 }, - { "gfxterm_menu", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbbe054f6, 0xbef13bfe, 0xbbe054f6, 0xa23fcfe0, 0xf83ee7aa, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x8cea8db2, 0x9688dd3b, 0x8cea8db2, 0x6fe82515, 0x724366e5, }, 6 }, - { "gfxterm_menu", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x25e346a1, 0xbd5eb38b, 0x25e346a1, 0x9d469431, 0x5387d57f, }, 6 }, - { "gfxterm_menu", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x6f33e7a0, 0x5716dafe, 0x6f33e7a0, 0xbfa18d18, 0xf83ee7aa, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xffb24323, 0x6e8fa0be, 0xffb24323, 0xad5c8fa5, 0x724366e5, }, 6 }, - { "gfxterm_menu", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x5a925b39, 0x36226b, 0x5a925b39, 0xafa322b7, 0x1c955882, }, 6 }, - { "gfxterm_menu", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfb4aecf8, 0x17b91739, 0xfb4aecf8, 0xf7e3d211, 0x4d266f7a, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x4015c90f, 0x430ae98c, 0x4015c90f, 0xeb61f90d, 0x1ed9d731, }, 6 }, - { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x4df27666, 0xb8015ce1, 0x4df27666, 0x8bef2cac, 0x9813a416, }, 6 }, - { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6d1d5058, 0xb2d8ed2c, 0x6d1d5058, 0xe8936168, 0x5fcf013d, }, 6 }, - { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xeec86af1, 0x13493ea, 0xeec86af1, 0xee83739a, 0xdd28f52b, }, 6 }, - { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7a3f695f, 0xac449d41, 0x7a3f695f, 0x28a073b1, }, 5 }, - { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2ee70aea, 0x8f5328d2, 0x2ee70aea, 0x19fb9508, }, 5 }, - { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xef842e14, 0x9b7cdc00, 0xef842e14, 0x750c3145, }, 5 }, - { "gfxmenu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xcfa0e627, 0x8b7088da, 0xcfa0e627, 0xcd807142, }, 5 }, - { "gfxmenu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x64807934, 0x85d684c9, 0x64807934, 0x61726a79, }, 5 }, - { "gfxmenu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x9792b643, 0x1d769dd8, 0x9386dd8c, 0x9792b643, 0x3d74bd2f, }, 6 }, - { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xbdb8f583, 0x1e27b76, 0xbdb8f583, 0x91be6e17, }, 5 }, - { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbe72e1cb, 0x4943add3, 0xbe72e1cb, 0xa207f983, }, 5 }, - { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0xbc064047, 0x9e12d9ac, 0xbc064047, 0xf9bdce43, }, 5 }, - { "gfxmenu", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x6181ad43, 0xe570d91, 0x6181ad43, 0x567fb1cc, }, 5 }, - { "gfxmenu", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1e5b6982, 0x789f961c, 0x1e5b6982, 0xc1ad694a, }, 5 }, - { "gfxmenu", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x73f85cef, 0x9469d68d, 0x73f85cef, 0x24779078, }, 5 }, - { "gfxmenu", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xa6ddcb95, 0xa3934314, 0xa6ddcb95, 0x16ab9b6c, }, 5 }, - { "gfxmenu", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x18e25ecc, 0xe52f7def, 0x18e25ecc, 0x5bd10081, }, 5 }, - { "gfxmenu", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xa845bba2, 0xb67fe791, 0xa845bba2, 0x80452493, }, 5 }, - { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xf162dfa3, 0xe0f86fe6, 0xf162dfa3, 0x51f56384, }, 5 }, - { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x644b801, 0x8a201b04, 0x644b801, 0xa4508ec0, }, 5 }, - { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0x1e1a41fe, 0x237e53c4, 0x1e1a41fe, 0xd5890062, }, 5 }, - { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0xa35a45c5, 0xacbc8410, 0xa35a45c5, 0xed2e11bd, }, 5 }, - { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x8a6fa170, 0x7605140e, 0x8a6fa170, 0xc030feb1, }, 5 }, - { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x49ddd3e4, 0xbfaeedf9, 0x49ddd3e4, 0xcde1d4b5, }, 5 }, - { "gfxmenu", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x98a8e7a8, 0xd9cab55f, 0x98a8e7a8, 0xf2b7dd05, }, 5 }, - { "gfxmenu", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xa000334f, 0xa1b11a86, 0xa000334f, 0x8ac1b99f, }, 5 }, - { "gfxmenu", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xc662fb1, 0x673baf90, 0xc662fb1, 0xfb88406, }, 5 }, - { "gfxmenu", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x33d4530e, 0x11ff262b, 0x33d4530e, 0xbb511beb, }, 5 }, - { "gfxmenu", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x8b2e9364, 0x1d99d298, 0x8b2e9364, 0x958d5e8d, }, 5 }, - { "gfxmenu", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x6e78baae, 0xaedcda00, 0x6e78baae, 0x9399bef9, }, 5 }, - { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x1c3742c9, 0x42860f9a, 0x57da9ef, 0x42860f9a, 0x221db42c, }, 5 }, - { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x2ade7eff, 0xc91e0e0c, 0x2ade7eff, 0x8ad4bad6, }, 5 }, - { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xef4a3312, 0x4c493c2d, 0x487c542b, 0x4c493c2d, 0xfec68cd6, }, 5 }, + { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, 0x59c36f00, 0xcba09304, 0xcba09304, 0xcba09304, 0x97b293e6, 0x97b293e6, 0x97b293e6, 0xd2fea778, 0xd2fea778, 0xd2fea778, 0x59c36f00, 0xe82e990f, 0xe82e990f, 0x59c36f00, }, 20 }, + { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, 0xaa4593fe, 0xfda7eac8, 0xfda7eac8, 0xfda7eac8, 0x272045f3, 0x272045f3, 0x272045f3, 0x1b2c55ba, 0x1b2c55ba, 0x1b2c55ba, 0xaa4593fe, 0xff6942c6, 0xff6942c6, 0xaa4593fe, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, 0xc9cbf769, 0x270340e6, 0x270340e6, 0x270340e6, 0x13ea67c8, 0x13ea67c8, 0x13ea67c8, 0x318e0f43, 0x318e0f43, 0x318e0f43, 0xc9cbf769, 0x2e0276, 0x2e0276, 0xc9cbf769, }, 20 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4df27666, 0xb8015ce1, 0x4df27666, 0x8bef2cac, 0x9813a416, 0x9813a416, 0x8c097a93, 0x8c097a93, 0x8c097a93, 0x87fc7e3c, 0x87fc7e3c, 0x87fc7e3c, 0x93febca5, 0x93febca5, 0x93febca5, 0x9813a416, 0x8bef2cac, 0x8bef2cac, 0x9813a416, }, 20 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6d1d5058, 0xb2d8ed2c, 0x6d1d5058, 0xe8936168, 0x5fcf013d, 0x5fcf013d, 0xcacb7f18, 0xcacb7f18, 0xcacb7f18, 0x3b887a05, 0x3b887a05, 0x3b887a05, 0x7c777982, 0x7c777982, 0x7c777982, 0x5fcf013d, 0xe8936168, 0xe8936168, 0x5fcf013d, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xeec86af1, 0x13493ea, 0xeec86af1, 0xee83739a, 0xdd28f52b, 0xdd28f52b, 0x35beeea3, 0x35beeea3, 0x35beeea3, 0x48a8a967, 0x48a8a967, 0x48a8a967, 0x2b9a774d, 0x2b9a774d, 0x2b9a774d, 0xdd28f52b, 0xee83739a, 0xee83739a, 0xdd28f52b, }, 20 }, + { "gfxterm_menu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, 0x59c36f00, 0xcba09304, 0xcba09304, 0xcba09304, 0x97b293e6, 0x97b293e6, 0x97b293e6, 0xd2fea778, 0xd2fea778, 0xd2fea778, 0x59c36f00, 0xe82e990f, 0xe82e990f, 0x59c36f00, }, 20 }, + { "gfxterm_menu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, 0xaa4593fe, 0xfda7eac8, 0xfda7eac8, 0xfda7eac8, 0x272045f3, 0x272045f3, 0x272045f3, 0x1b2c55ba, 0x1b2c55ba, 0x1b2c55ba, 0xaa4593fe, 0xff6942c6, 0xff6942c6, 0xaa4593fe, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, 0xc9cbf769, 0x270340e6, 0x270340e6, 0x270340e6, 0x13ea67c8, 0x13ea67c8, 0x13ea67c8, 0x318e0f43, 0x318e0f43, 0x318e0f43, 0xc9cbf769, 0x2e0276, 0x2e0276, 0xc9cbf769, }, 20 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x9093f849, 0xc02929e3, 0x9093f849, 0xe2f077d4, 0x5387d57f, 0x5387d57f, 0x4e647c93, 0x4e647c93, 0x4e647c93, 0x6d05ba99, 0x6d05ba99, 0x6d05ba99, 0xc55eff54, 0xc55eff54, 0xc55eff54, 0x5387d57f, 0xe2f077d4, 0xe2f077d4, 0x5387d57f, }, 20 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbbe054f6, 0xbef13bfe, 0xbbe054f6, 0xa23fcfe0, 0xf83ee7aa, 0xf83ee7aa, 0xf25c3281, 0xf25c3281, 0xf25c3281, 0x366bb960, 0x366bb960, 0x366bb960, 0xf975ea72, 0xf975ea72, 0xf975ea72, 0xf83ee7aa, 0xa23fcfe0, 0xa23fcfe0, 0xf83ee7aa, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x8cea8db2, 0x9688dd3b, 0x8cea8db2, 0x6fe82515, 0x724366e5, 0x724366e5, 0x10d1a394, 0x10d1a394, 0x10d1a394, 0xf3216bf2, 0xf3216bf2, 0xf3216bf2, 0x4d63fe8a, 0x4d63fe8a, 0x4d63fe8a, 0x724366e5, 0x6fe82515, 0x6fe82515, 0x724366e5, }, 20 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x25e346a1, 0xbd5eb38b, 0x25e346a1, 0x9d469431, 0x5387d57f, 0x5387d57f, 0x4bd38a03, 0x4bd38a03, 0x4bd38a03, 0xb506d50a, 0xb506d50a, 0xb506d50a, 0xbdfe4c39, 0xbdfe4c39, 0xbdfe4c39, 0x5387d57f, 0x9d469431, 0x9d469431, 0x5387d57f, }, 20 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x6f33e7a0, 0x5716dafe, 0x6f33e7a0, 0xbfa18d18, 0xf83ee7aa, 0xf83ee7aa, 0x63d64c93, 0x63d64c93, 0x63d64c93, 0x2d80151e, 0x2d80151e, 0x2d80151e, 0xc75c6ed7, 0xc75c6ed7, 0xc75c6ed7, 0xf83ee7aa, 0xbfa18d18, 0xbfa18d18, 0xf83ee7aa, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xffb24323, 0x6e8fa0be, 0xffb24323, 0xad5c8fa5, 0x724366e5, 0x724366e5, 0xe0762c40, 0xe0762c40, 0xe0762c40, 0x21ef3daa, 0x21ef3daa, 0x21ef3daa, 0xa5bab6e2, 0xa5bab6e2, 0xa5bab6e2, 0x724366e5, 0xad5c8fa5, 0xad5c8fa5, 0x724366e5, }, 20 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0x5a925b39, 0x36226b, 0x5a925b39, 0xafa322b7, 0x1c955882, 0x1c955882, 0x97519c3a, 0x97519c3a, 0x97519c3a, 0x1507738a, 0x1507738a, 0x1507738a, 0xdaeff6f6, 0xdaeff6f6, 0xdaeff6f6, 0x1c955882, 0xafa322b7, 0xafa322b7, 0x1c955882, }, 20 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfb4aecf8, 0x17b91739, 0xfb4aecf8, 0xf7e3d211, 0x4d266f7a, 0x4d266f7a, 0x2d145f78, 0x2d145f78, 0x2d145f78, 0x61410c3e, 0x61410c3e, 0x61410c3e, 0x43e0bec0, 0x43e0bec0, 0x43e0bec0, 0x4d266f7a, 0xf7e3d211, 0xf7e3d211, 0x4d266f7a, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x4015c90f, 0x430ae98c, 0x4015c90f, 0xeb61f90d, 0x1ed9d731, 0x1ed9d731, 0xa1c3fdf0, 0xa1c3fdf0, 0xa1c3fdf0, 0x15c2bd78, 0x15c2bd78, 0x15c2bd78, 0x18eea13b, 0x18eea13b, 0x18eea13b, 0x1ed9d731, 0xeb61f90d, 0xeb61f90d, 0x1ed9d731, }, 20 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x9093f849, 0xc02929e3, 0x9093f849, 0xe2f077d4, 0x5387d57f, 0x5387d57f, 0x4e647c93, 0x4e647c93, 0x4e647c93, 0x6d05ba99, 0x6d05ba99, 0x6d05ba99, 0xc55eff54, 0xc55eff54, 0xc55eff54, 0x5387d57f, 0xe2f077d4, 0xe2f077d4, 0x5387d57f, }, 20 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbbe054f6, 0xbef13bfe, 0xbbe054f6, 0xa23fcfe0, 0xf83ee7aa, 0xf83ee7aa, 0xf25c3281, 0xf25c3281, 0xf25c3281, 0x366bb960, 0x366bb960, 0x366bb960, 0xf975ea72, 0xf975ea72, 0xf975ea72, 0xf83ee7aa, 0xa23fcfe0, 0xa23fcfe0, 0xf83ee7aa, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x8cea8db2, 0x9688dd3b, 0x8cea8db2, 0x6fe82515, 0x724366e5, 0x724366e5, 0x10d1a394, 0x10d1a394, 0x10d1a394, 0xf3216bf2, 0xf3216bf2, 0xf3216bf2, 0x4d63fe8a, 0x4d63fe8a, 0x4d63fe8a, 0x724366e5, 0x6fe82515, 0x6fe82515, 0x724366e5, }, 20 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x25e346a1, 0xbd5eb38b, 0x25e346a1, 0x9d469431, 0x5387d57f, 0x5387d57f, 0x4bd38a03, 0x4bd38a03, 0x4bd38a03, 0xb506d50a, 0xb506d50a, 0xb506d50a, 0xbdfe4c39, 0xbdfe4c39, 0xbdfe4c39, 0x5387d57f, 0x9d469431, 0x9d469431, 0x5387d57f, }, 20 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x6f33e7a0, 0x5716dafe, 0x6f33e7a0, 0xbfa18d18, 0xf83ee7aa, 0xf83ee7aa, 0x63d64c93, 0x63d64c93, 0x63d64c93, 0x2d80151e, 0x2d80151e, 0x2d80151e, 0xc75c6ed7, 0xc75c6ed7, 0xc75c6ed7, 0xf83ee7aa, 0xbfa18d18, 0xbfa18d18, 0xf83ee7aa, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xffb24323, 0x6e8fa0be, 0xffb24323, 0xad5c8fa5, 0x724366e5, 0x724366e5, 0xe0762c40, 0xe0762c40, 0xe0762c40, 0x21ef3daa, 0x21ef3daa, 0x21ef3daa, 0xa5bab6e2, 0xa5bab6e2, 0xa5bab6e2, 0x724366e5, 0xad5c8fa5, 0xad5c8fa5, 0x724366e5, }, 20 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x5a925b39, 0x36226b, 0x5a925b39, 0xafa322b7, 0x1c955882, 0x1c955882, 0x97519c3a, 0x97519c3a, 0x97519c3a, 0x1507738a, 0x1507738a, 0x1507738a, 0xdaeff6f6, 0xdaeff6f6, 0xdaeff6f6, 0x1c955882, 0xafa322b7, 0xafa322b7, 0x1c955882, }, 20 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfb4aecf8, 0x17b91739, 0xfb4aecf8, 0xf7e3d211, 0x4d266f7a, 0x4d266f7a, 0x2d145f78, 0x2d145f78, 0x2d145f78, 0x61410c3e, 0x61410c3e, 0x61410c3e, 0x43e0bec0, 0x43e0bec0, 0x43e0bec0, 0x4d266f7a, 0xf7e3d211, 0xf7e3d211, 0x4d266f7a, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x4015c90f, 0x430ae98c, 0x4015c90f, 0xeb61f90d, 0x1ed9d731, 0x1ed9d731, 0xa1c3fdf0, 0xa1c3fdf0, 0xa1c3fdf0, 0x15c2bd78, 0x15c2bd78, 0x15c2bd78, 0x18eea13b, 0x18eea13b, 0x18eea13b, 0x1ed9d731, 0xeb61f90d, 0xeb61f90d, 0x1ed9d731, }, 20 }, + { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x4df27666, 0xb8015ce1, 0x4df27666, 0x8bef2cac, 0x9813a416, 0x9813a416, 0x8c097a93, 0x8c097a93, 0x8c097a93, 0x87fc7e3c, 0x87fc7e3c, 0x87fc7e3c, 0x93febca5, 0x93febca5, 0x93febca5, 0x9813a416, 0x8bef2cac, 0x8bef2cac, 0x9813a416, }, 20 }, + { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6d1d5058, 0xb2d8ed2c, 0x6d1d5058, 0xe8936168, 0x5fcf013d, 0x5fcf013d, 0xcacb7f18, 0xcacb7f18, 0xcacb7f18, 0x3b887a05, 0x3b887a05, 0x3b887a05, 0x7c777982, 0x7c777982, 0x7c777982, 0x5fcf013d, 0xe8936168, 0xe8936168, 0x5fcf013d, }, 20 }, + { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xeec86af1, 0x13493ea, 0xeec86af1, 0xee83739a, 0xdd28f52b, 0xdd28f52b, 0x35beeea3, 0x35beeea3, 0x35beeea3, 0x48a8a967, 0x48a8a967, 0x48a8a967, 0x2b9a774d, 0x2b9a774d, 0x2b9a774d, 0xdd28f52b, 0xee83739a, 0xee83739a, 0xdd28f52b, }, 20 }, + { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7a3f695f, 0xac449d41, 0x7a3f695f, 0x28a073b1, 0xf22da29a, 0x169cd2a2, 0x169cd2a2, 0x169cd2a2, 0xc3a67fb9, 0xc3a67fb9, 0xc3a67fb9, 0x6c67e914, 0x6c67e914, 0x6c67e914, 0x59c36f00, 0x28a073b1, 0x28a073b1, }, 18 }, + { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2ee70aea, 0x8f5328d2, 0x2ee70aea, 0x19fb9508, 0x2c3dfa69, 0x1f8453a4, 0x1f8453a4, 0x1f8453a4, 0xc9055b79, 0xc9055b79, 0xc9055b79, 0xef40ac6a, 0xef40ac6a, 0xef40ac6a, 0xaa4593fe, 0x19fb9508, 0x19fb9508, }, 18 }, + { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xef842e14, 0x9b7cdc00, 0xef842e14, 0x750c3145, 0xb069b9a2, 0x3f87d41f, 0x3f87d41f, 0x3f87d41f, 0x8a031b3a, 0x8a031b3a, 0x8a031b3a, 0x4ed887f7, 0x4ed887f7, 0x4ed887f7, 0xc9cbf769, 0x750c3145, 0x750c3145, }, 18 }, + { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xf162dfa3, 0xe0f86fe6, 0xf162dfa3, 0x51f56384, 0xa9aef7c0, 0x7e4eeeb7, 0x7e4eeeb7, 0x7e4eeeb7, 0x902dc363, 0x902dc363, 0x902dc363, 0xd478551d, 0xd478551d, 0xd478551d, 0x1c3742c9, 0x51f56384, 0x51f56384, }, 18 }, + { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x644b801, 0x8a201b04, 0x644b801, 0xa4508ec0, 0xcb189b31, 0x8279446f, 0x8279446f, 0x8279446f, 0x80b67d02, 0x80b67d02, 0x80b67d02, 0xa1cc8118, 0xa1cc8118, 0xa1cc8118, 0xcc5a7bed, 0xa4508ec0, 0xa4508ec0, }, 18 }, + { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0x1e1a41fe, 0x237e53c4, 0x1e1a41fe, 0xd5890062, 0x7180f3ea, 0x6be1ad05, 0x6be1ad05, 0x6be1ad05, 0x680e4253, 0x680e4253, 0x680e4253, 0xed2cabb8, 0xed2cabb8, 0xed2cabb8, 0xef4a3312, 0xd5890062, 0xd5890062, }, 18 }, + { "gfxmenu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xcfa0e627, 0x8b7088da, 0xcfa0e627, 0xcd807142, 0xdc37dab7, 0x3886aa8f, 0x3886aa8f, 0x3886aa8f, 0xedbc0794, 0xedbc0794, 0xedbc0794, 0x427d9139, 0x427d9139, 0x427d9139, 0x59c36f00, 0xcd807142, 0xcd807142, }, 18 }, + { "gfxmenu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x64807934, 0x85d684c9, 0x64807934, 0x61726a79, 0x71c38b, 0x33c86a46, 0x33c86a46, 0x33c86a46, 0xe549629b, 0xe549629b, 0xe549629b, 0xc30c9588, 0xc30c9588, 0xc30c9588, 0xaa4593fe, 0x61726a79, 0x61726a79, }, 18 }, + { "gfxmenu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x9792b643, 0x1d769dd8, 0x9386dd8c, 0x9792b643, 0x3d74bd2f, 0x4411e313, 0xcbff8eae, 0xcbff8eae, 0xcbff8eae, 0x7e7b418b, 0x7e7b418b, 0x7e7b418b, 0xbaa0dd46, 0xbaa0dd46, 0xbaa0dd46, 0xc9cbf769, 0x3d74bd2f, 0x3d74bd2f, }, 19 }, + { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xbdb8f583, 0x1e27b76, 0xbdb8f583, 0x91be6e17, 0xf93a81be, 0x8632932e, 0x8632932e, 0x8632932e, 0xa297894, 0xa297894, 0xa297894, 0x66f16747, 0x66f16747, 0x66f16747, 0x5387d57f, 0x91be6e17, 0x91be6e17, }, 18 }, + { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbe72e1cb, 0x4943add3, 0xbe72e1cb, 0xa207f983, 0x58397d1d, 0x809530c5, 0x809530c5, 0x809530c5, 0x8b80ad8a, 0x8b80ad8a, 0x8b80ad8a, 0x425ad0af, 0x425ad0af, 0x425ad0af, 0xf83ee7aa, 0xa207f983, 0xa207f983, }, 18 }, + { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0xbc064047, 0x9e12d9ac, 0xbc064047, 0xf9bdce43, 0x7184c3f8, 0xc8fd1102, 0xc8fd1102, 0xc8fd1102, 0x81f910a3, 0x81f910a3, 0x81f910a3, 0xdb64e608, 0xdb64e608, 0xdb64e608, 0x724366e5, 0xf9bdce43, 0xf9bdce43, }, 18 }, + { "gfxmenu", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x6181ad43, 0xe570d91, 0x6181ad43, 0x567fb1cc, 0xa8a3da, 0x5f74d9d, 0x5f74d9d, 0x5f74d9d, 0xed4861bc, 0xed4861bc, 0xed4861bc, 0xcd9c9ca8, 0xcd9c9ca8, 0xcd9c9ca8, 0x5387d57f, 0x567fb1cc, 0x567fb1cc, }, 18 }, + { "gfxmenu", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1e5b6982, 0x789f961c, 0x1e5b6982, 0xc1ad694a, 0xbc4e843c, 0x27165c47, 0x27165c47, 0x27165c47, 0x5312181a, 0x5312181a, 0x5312181a, 0x9a1929fd, 0x9a1929fd, 0x9a1929fd, 0xf83ee7aa, 0xc1ad694a, 0xc1ad694a, }, 18 }, + { "gfxmenu", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x73f85cef, 0x9469d68d, 0x73f85cef, 0x24779078, 0x6f964a90, 0x205a3335, 0x205a3335, 0x205a3335, 0x5d68cafd, 0x5d68cafd, 0x5d68cafd, 0x4129165e, 0x4129165e, 0x4129165e, 0x724366e5, 0x24779078, 0x24779078, }, 18 }, + { "gfxmenu", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xa6ddcb95, 0xa3934314, 0xa6ddcb95, 0x16ab9b6c, 0x1755c99c, 0x1432b906, 0x1432b906, 0x1432b906, 0xb2aaa903, 0xb2aaa903, 0xb2aaa903, 0x3014dff7, 0x3014dff7, 0x3014dff7, 0x1c955882, 0x16ab9b6c, 0x16ab9b6c, }, 18 }, + { "gfxmenu", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x18e25ecc, 0xe52f7def, 0x18e25ecc, 0x5bd10081, 0xf52b17e7, 0x781d42cf, 0x781d42cf, 0x781d42cf, 0x43cb6f95, 0x43cb6f95, 0x43cb6f95, 0xe7bb907d, 0xe7bb907d, 0xe7bb907d, 0x4d266f7a, 0x5bd10081, 0x5bd10081, }, 18 }, + { "gfxmenu", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xa845bba2, 0xb67fe791, 0xa845bba2, 0x80452493, 0x437302fa, 0xbd263b46, 0xbd263b46, 0xbd263b46, 0xdd07a911, 0xdd07a911, 0xdd07a911, 0x75ab7095, 0x75ab7095, 0x75ab7095, 0x1ed9d731, 0x80452493, 0x80452493, }, 18 }, + { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0xa35a45c5, 0xacbc8410, 0xa35a45c5, 0xed2e11bd, 0x79f9376f, 0x6f125ff, 0x6f125ff, 0x6f125ff, 0x8aeace45, 0x8aeace45, 0x8aeace45, 0xe632d196, 0xe632d196, 0xe632d196, 0x5387d57f, 0xed2e11bd, 0xed2e11bd, }, 18 }, + { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x8a6fa170, 0x7605140e, 0x8a6fa170, 0xc030feb1, 0xa84da503, 0x70e1e8db, 0x70e1e8db, 0x70e1e8db, 0x7bf47594, 0x7bf47594, 0x7bf47594, 0xb22e08b1, 0xb22e08b1, 0xb22e08b1, 0xf83ee7aa, 0xc030feb1, 0xc030feb1, }, 18 }, + { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x49ddd3e4, 0xbfaeedf9, 0x49ddd3e4, 0xcde1d4b5, 0xf7229851, 0x4e5b4aab, 0x4e5b4aab, 0x4e5b4aab, 0x75f4b0a, 0x75f4b0a, 0x75f4b0a, 0x5dc2bda1, 0x5dc2bda1, 0x5dc2bda1, 0x724366e5, 0xcde1d4b5, 0xcde1d4b5, }, 18 }, + { "gfxmenu", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x98a8e7a8, 0xd9cab55f, 0x98a8e7a8, 0xf2b7dd05, 0xa199f4d7, 0xa4c61a90, 0xa4c61a90, 0xa4c61a90, 0x4c7936b1, 0x4c7936b1, 0x4c7936b1, 0x6cadcba5, 0x6cadcba5, 0x6cadcba5, 0x5387d57f, 0xf2b7dd05, 0xf2b7dd05, }, 18 }, + { "gfxmenu", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xa000334f, 0xa1b11a86, 0xa000334f, 0x8ac1b99f, 0xeaf098c4, 0x71a840bf, 0x71a840bf, 0x71a840bf, 0x5ac04e2, 0x5ac04e2, 0x5ac04e2, 0xcca73505, 0xcca73505, 0xcca73505, 0xf83ee7aa, 0x8ac1b99f, 0x8ac1b99f, }, 18 }, + { "gfxmenu", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xc662fb1, 0x673baf90, 0xc662fb1, 0xfb88406, 0x8df6104e, 0xc23a69eb, 0xc23a69eb, 0xc23a69eb, 0xbf089023, 0xbf089023, 0xbf089023, 0xa3494c80, 0xa3494c80, 0xa3494c80, 0x724366e5, 0xfb88406, 0xfb88406, }, 18 }, + { "gfxmenu", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x33d4530e, 0x11ff262b, 0x33d4530e, 0xbb511beb, 0xb3f7ca7e, 0xb090bae4, 0xb090bae4, 0xb090bae4, 0x1608aae1, 0x1608aae1, 0x1608aae1, 0x94b6dc15, 0x94b6dc15, 0x94b6dc15, 0x1c955882, 0xbb511beb, 0xbb511beb, }, 18 }, + { "gfxmenu", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x8b2e9364, 0x1d99d298, 0x8b2e9364, 0x958d5e8d, 0xfdfd7cdc, 0x70cb29f4, 0x70cb29f4, 0x70cb29f4, 0x4b1d04ae, 0x4b1d04ae, 0x4b1d04ae, 0xef6dfb46, 0xef6dfb46, 0xef6dfb46, 0x4d266f7a, 0x958d5e8d, 0x958d5e8d, }, 18 }, + { "gfxmenu", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x6e78baae, 0xaedcda00, 0x6e78baae, 0x9399bef9, 0xa685f2c7, 0x58d0cb7b, 0x58d0cb7b, 0x58d0cb7b, 0x38f1592c, 0x38f1592c, 0x38f1592c, 0x905d80a8, 0x905d80a8, 0x905d80a8, 0x1ed9d731, 0x9399bef9, 0x9399bef9, }, 18 }, + { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x1c3742c9, 0x42860f9a, 0x57da9ef, 0x42860f9a, 0x221db42c, 0xdb3adfbf, 0xcdac6c8, 0xcdac6c8, 0xcdac6c8, 0xe2b9eb1c, 0xe2b9eb1c, 0xe2b9eb1c, 0xa6ec7d62, 0xa6ec7d62, 0xa6ec7d62, 0x1c3742c9, 0x221db42c, 0x221db42c, }, 18 }, + { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x2ade7eff, 0xc91e0e0c, 0x2ade7eff, 0x8ad4bad6, 0x7f2729d6, 0x3646f688, 0x3646f688, 0x3646f688, 0x3489cfe5, 0x3489cfe5, 0x3489cfe5, 0x15f333ff, 0x15f333ff, 0x15f333ff, 0xcc5a7bed, 0x8ad4bad6, 0x8ad4bad6, }, 18 }, + { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xef4a3312, 0x4c493c2d, 0x487c542b, 0x4c493c2d, 0xfec68cd6, 0x76f27cf8, 0x6c932217, 0x6c932217, 0x6c932217, 0x6f7ccd41, 0x6f7ccd41, 0x6f7ccd41, 0xea5e24aa, 0xea5e24aa, 0xea5e24aa, 0xef4a3312, 0xfec68cd6, 0xfec68cd6, }, 18 }, + { "gfxterm_ar", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xb0361371, 0x1b06d274, 0xb0361371, 0xf9525e18, 0x59c36f00, 0x59c36f00, 0xbb825618, 0xbb825618, 0xbb825618, 0xe79056fa, 0xe79056fa, 0xe79056fa, 0xa2dc6264, 0xa2dc6264, 0xa2dc6264, 0x59c36f00, 0xf9525e18, 0xf9525e18, 0x59c36f00, }, 20 }, + { "gfxterm_ar", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd5e07c64, 0xd973835d, 0xcb531eb6, 0x97c0ad39, 0xaa4593fe, 0xaa4593fe, 0x470bd063, 0x470bd063, 0x470bd063, 0x9d8c7f58, 0x9d8c7f58, 0x9d8c7f58, 0xa1806f11, 0xa1806f11, 0xa1806f11, 0xaa4593fe, 0x8973cfeb, 0x97c0ad39, 0xaa4593fe, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xf652cbe1, 0xd6584e36, 0x993a7b88, 0x4cf069f4, 0xc9cbf769, 0xc9cbf769, 0x40f84477, 0x40f84477, 0x40f84477, 0x74116359, 0x74116359, 0x74116359, 0x56750bd2, 0x56750bd2, 0x56750bd2, 0xc9cbf769, 0x2398d99d, 0x4cf069f4, 0xc9cbf769, }, 20 }, + { "gfxterm_ar", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x87ba7c21, 0x62eab185, 0x87ba7c21, 0x41a726eb, 0x9813a416, 0x9813a416, 0xcbe87745, 0xcbe87745, 0xcbe87745, 0xc01d73ea, 0xc01d73ea, 0xc01d73ea, 0xd41fb173, 0xd41fb173, 0xd41fb173, 0x9813a416, 0x41a726eb, 0x41a726eb, 0x9813a416, }, 20 }, + { "gfxterm_ar", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x7cf854b5, 0x4d5395da, 0xbe7776c4, 0x3bf947f4, 0x5fcf013d, 0x5fcf013d, 0x5c1d4263, 0x5c1d4263, 0x5c1d4263, 0xad5e477e, 0xad5e477e, 0xad5e477e, 0xeaa144f9, 0xeaa144f9, 0xeaa144f9, 0x5fcf013d, 0xf9766585, 0x3bf947f4, 0x5fcf013d, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x9ab1c3a0, 0x3c2d2348, 0x4d30c6c3, 0x4d7bdfa8, 0xdd28f52b, 0xdd28f52b, 0x57f4ff36, 0x57f4ff36, 0x57f4ff36, 0x2ae2b8f2, 0x2ae2b8f2, 0x2ae2b8f2, 0x49d066d8, 0x49d066d8, 0x49d066d8, 0xdd28f52b, 0x9afadacb, 0x4d7bdfa8, 0xdd28f52b, }, 20 }, + { "gfxterm_ar", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xb0361371, 0x1b06d274, 0xb0361371, 0xf9525e18, 0x59c36f00, 0x59c36f00, 0xbb825618, 0xbb825618, 0xbb825618, 0xe79056fa, 0xe79056fa, 0xe79056fa, 0xa2dc6264, 0xa2dc6264, 0xa2dc6264, 0x59c36f00, 0xf9525e18, 0xf9525e18, 0x59c36f00, }, 20 }, + { "gfxterm_ar", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0xd5e07c64, 0xd973835d, 0xcb531eb6, 0x97c0ad39, 0xaa4593fe, 0xaa4593fe, 0x470bd063, 0x470bd063, 0x470bd063, 0x9d8c7f58, 0x9d8c7f58, 0x9d8c7f58, 0xa1806f11, 0xa1806f11, 0xa1806f11, 0xaa4593fe, 0x8973cfeb, 0x97c0ad39, 0xaa4593fe, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xf652cbe1, 0xd6584e36, 0x993a7b88, 0x4cf069f4, 0xc9cbf769, 0xc9cbf769, 0x40f84477, 0x40f84477, 0x40f84477, 0x74116359, 0x74116359, 0x74116359, 0x56750bd2, 0x56750bd2, 0x56750bd2, 0xc9cbf769, 0x2398d99d, 0x4cf069f4, 0xc9cbf769, }, 20 }, + { "gfxterm_ar", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x7b209cbf, 0x2f8bc59a, 0x7b209cbf, 0x9431322, 0x5387d57f, 0x5387d57f, 0x68f2d5ef, 0x68f2d5ef, 0x68f2d5ef, 0x4b9313e5, 0x4b9313e5, 0x4b9313e5, 0xe3c85628, 0xe3c85628, 0xe3c85628, 0x5387d57f, 0x9431322, 0x9431322, 0x5387d57f, }, 20 }, + { "gfxterm_ar", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xe0d6abdc, 0x1fb5ebb5, 0xf2d32271, 0xeb0cb967, 0xf83ee7aa, 0xf83ee7aa, 0x5e332832, 0x5e332832, 0x5e332832, 0x9a04a3d3, 0x9a04a3d3, 0x9a04a3d3, 0x551af0c1, 0x551af0c1, 0x551af0c1, 0xf83ee7aa, 0xf90930ca, 0xeb0cb967, 0xf83ee7aa, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0xeeeb078a, 0xa8401f78, 0xc4e7df4d, 0x27e577ea, 0x724366e5, 0x724366e5, 0x3c69c88a, 0x3c69c88a, 0x3c69c88a, 0xdf9900ec, 0xdf9900ec, 0xdf9900ec, 0x61db9594, 0x61db9594, 0x61db9594, 0x724366e5, 0xde9af2d, 0x27e577ea, 0x724366e5, }, 20 }, + { "gfxterm_ar", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x68a06b59, 0x5f199a13, 0x68a06b59, 0xd005b9c9, 0x5387d57f, 0x5387d57f, 0x8910bf0d, 0x8910bf0d, 0x8910bf0d, 0x77c5e004, 0x77c5e004, 0x77c5e004, 0x7f3d7937, 0x7f3d7937, 0x7f3d7937, 0x5387d57f, 0xd005b9c9, 0xd005b9c9, 0x5387d57f, }, 20 }, + { "gfxterm_ar", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x9683ff51, 0xfcc9713a, 0x7efd6d3a, 0xae6f0782, 0xf83ee7aa, 0xf83ee7aa, 0x60155cd0, 0x60155cd0, 0x60155cd0, 0x2e43055d, 0x2e43055d, 0x2e43055d, 0xc49f7e94, 0xc49f7e94, 0xc49f7e94, 0xf83ee7aa, 0x461195e9, 0xae6f0782, 0xf83ee7aa, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x6f6a363c, 0xb0e5b5b6, 0x6e302243, 0x3cdeeec5, 0x724366e5, 0x724366e5, 0x57309c73, 0x57309c73, 0x57309c73, 0x96a98d99, 0x96a98d99, 0x96a98d99, 0x12fc06d1, 0x12fc06d1, 0x12fc06d1, 0x724366e5, 0x3d84faba, 0x3cdeeec5, 0x724366e5, }, 20 }, + { "gfxterm_ar", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0x9253d5dd, 0xdd3a228f, 0x9253d5dd, 0x6762ac53, 0x1c955882, 0x1c955882, 0x6e256146, 0x6e256146, 0x6e256146, 0xec738ef6, 0xec738ef6, 0xec738ef6, 0x239b0b8a, 0x239b0b8a, 0x239b0b8a, 0x1c955882, 0x6762ac53, 0x6762ac53, 0x1c955882, }, 20 }, + { "gfxterm_ar", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x2415bc63, 0x37b8de72, 0xee1dac36, 0xe2b492df, 0x4d266f7a, 0x4d266f7a, 0xd3a77460, 0xd3a77460, 0xd3a77460, 0x9ff22726, 0x9ff22726, 0x9ff22726, 0xbd5395d8, 0xbd5395d8, 0xbd5395d8, 0x4d266f7a, 0x28bc828a, 0xe2b492df, 0x4d266f7a, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x636f96aa, 0x39f2bbca, 0xb5259489, 0x1e51a48b, 0x1ed9d731, 0x1ed9d731, 0x9310ffef, 0x9310ffef, 0x9310ffef, 0x2711bf67, 0x2711bf67, 0x2711bf67, 0x2a3da324, 0x2a3da324, 0x2a3da324, 0x1ed9d731, 0xc81ba6a8, 0x1e51a48b, 0x1ed9d731, }, 20 }, + { "gfxterm_ar", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x7b209cbf, 0x2f8bc59a, 0x7b209cbf, 0x9431322, 0x5387d57f, 0x5387d57f, 0x68f2d5ef, 0x68f2d5ef, 0x68f2d5ef, 0x4b9313e5, 0x4b9313e5, 0x4b9313e5, 0xe3c85628, 0xe3c85628, 0xe3c85628, 0x5387d57f, 0x9431322, 0x9431322, 0x5387d57f, }, 20 }, + { "gfxterm_ar", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xe0d6abdc, 0x1fb5ebb5, 0xf2d32271, 0xeb0cb967, 0xf83ee7aa, 0xf83ee7aa, 0x5e332832, 0x5e332832, 0x5e332832, 0x9a04a3d3, 0x9a04a3d3, 0x9a04a3d3, 0x551af0c1, 0x551af0c1, 0x551af0c1, 0xf83ee7aa, 0xf90930ca, 0xeb0cb967, 0xf83ee7aa, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0xeeeb078a, 0xa8401f78, 0xc4e7df4d, 0x27e577ea, 0x724366e5, 0x724366e5, 0x3c69c88a, 0x3c69c88a, 0x3c69c88a, 0xdf9900ec, 0xdf9900ec, 0xdf9900ec, 0x61db9594, 0x61db9594, 0x61db9594, 0x724366e5, 0xde9af2d, 0x27e577ea, 0x724366e5, }, 20 }, + { "gfxterm_ar", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x68a06b59, 0x5f199a13, 0x68a06b59, 0xd005b9c9, 0x5387d57f, 0x5387d57f, 0x8910bf0d, 0x8910bf0d, 0x8910bf0d, 0x77c5e004, 0x77c5e004, 0x77c5e004, 0x7f3d7937, 0x7f3d7937, 0x7f3d7937, 0x5387d57f, 0xd005b9c9, 0xd005b9c9, 0x5387d57f, }, 20 }, + { "gfxterm_ar", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x9683ff51, 0xfcc9713a, 0x7efd6d3a, 0xae6f0782, 0xf83ee7aa, 0xf83ee7aa, 0x60155cd0, 0x60155cd0, 0x60155cd0, 0x2e43055d, 0x2e43055d, 0x2e43055d, 0xc49f7e94, 0xc49f7e94, 0xc49f7e94, 0xf83ee7aa, 0x461195e9, 0xae6f0782, 0xf83ee7aa, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0x6f6a363c, 0xb0e5b5b6, 0x6e302243, 0x3cdeeec5, 0x724366e5, 0x724366e5, 0x57309c73, 0x57309c73, 0x57309c73, 0x96a98d99, 0x96a98d99, 0x96a98d99, 0x12fc06d1, 0x12fc06d1, 0x12fc06d1, 0x724366e5, 0x3d84faba, 0x3cdeeec5, 0x724366e5, }, 20 }, + { "gfxterm_ar", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x9253d5dd, 0xdd3a228f, 0x9253d5dd, 0x6762ac53, 0x1c955882, 0x1c955882, 0x6e256146, 0x6e256146, 0x6e256146, 0xec738ef6, 0xec738ef6, 0xec738ef6, 0x239b0b8a, 0x239b0b8a, 0x239b0b8a, 0x1c955882, 0x6762ac53, 0x6762ac53, 0x1c955882, }, 20 }, + { "gfxterm_ar", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x2415bc63, 0x37b8de72, 0xee1dac36, 0xe2b492df, 0x4d266f7a, 0x4d266f7a, 0xd3a77460, 0xd3a77460, 0xd3a77460, 0x9ff22726, 0x9ff22726, 0x9ff22726, 0xbd5395d8, 0xbd5395d8, 0xbd5395d8, 0x4d266f7a, 0x28bc828a, 0xe2b492df, 0x4d266f7a, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x636f96aa, 0x39f2bbca, 0xb5259489, 0x1e51a48b, 0x1ed9d731, 0x1ed9d731, 0x9310ffef, 0x9310ffef, 0x9310ffef, 0x2711bf67, 0x2711bf67, 0x2711bf67, 0x2a3da324, 0x2a3da324, 0x2a3da324, 0x1ed9d731, 0xc81ba6a8, 0x1e51a48b, 0x1ed9d731, }, 20 }, + { "gfxterm_ar", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x87ba7c21, 0x62eab185, 0x87ba7c21, 0x41a726eb, 0x9813a416, 0x9813a416, 0xcbe87745, 0xcbe87745, 0xcbe87745, 0xc01d73ea, 0xc01d73ea, 0xc01d73ea, 0xd41fb173, 0xd41fb173, 0xd41fb173, 0x9813a416, 0x41a726eb, 0x41a726eb, 0x9813a416, }, 20 }, + { "gfxterm_ar", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x7cf854b5, 0x4d5395da, 0xbe7776c4, 0x3bf947f4, 0x5fcf013d, 0x5fcf013d, 0x5c1d4263, 0x5c1d4263, 0x5c1d4263, 0xad5e477e, 0xad5e477e, 0xad5e477e, 0xeaa144f9, 0xeaa144f9, 0xeaa144f9, 0x5fcf013d, 0xf9766585, 0x3bf947f4, 0x5fcf013d, }, 20 }, + { "gfxterm_ar", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x9ab1c3a0, 0x3c2d2348, 0x4d30c6c3, 0x4d7bdfa8, 0xdd28f52b, 0xdd28f52b, 0x57f4ff36, 0x57f4ff36, 0x57f4ff36, 0x2ae2b8f2, 0x2ae2b8f2, 0x2ae2b8f2, 0x49d066d8, 0x49d066d8, 0x49d066d8, 0xdd28f52b, 0x9afadacb, 0x4d7bdfa8, 0xdd28f52b, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7cd7d588, 0xd97ec8cc, 0x7cd7d588, 0x35b398e1, 0x59c36f00, 0x59c36f00, 0x4834c117, 0x4834c117, 0x4834c117, 0x1426c1f5, 0x1426c1f5, 0x1426c1f5, 0x516af56b, 0x516af56b, 0x516af56b, 0x59c36f00, 0x35b398e1, 0x35b398e1, 0x59c36f00, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x77d5614b, 0xee38f19f, 0x77d5614b, 0x2b46d2c4, 0xaa4593fe, 0xaa4593fe, 0x88eefe02, 0x88eefe02, 0x88eefe02, 0x52695139, 0x52695139, 0x52695139, 0x6e654170, 0x6e654170, 0x6e654170, 0xaa4593fe, 0x2b46d2c4, 0x2b46d2c4, 0xaa4593fe, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5c774be, 0xd6ea481d, 0xd5c774be, 0xd66c2, 0xc9cbf769, 0xc9cbf769, 0x8ca7204, 0x8ca7204, 0x8ca7204, 0x3c23552a, 0x3c23552a, 0x3c23552a, 0x1e473da1, 0x1e473da1, 0x1e473da1, 0xc9cbf769, 0xd66c2, 0xd66c2, 0xc9cbf769, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x6ff25334, 0x60142559, 0x6ff25334, 0xa9ef09fe, 0x9813a416, 0x9813a416, 0xe9d151d6, 0xe9d151d6, 0xe9d151d6, 0xe2245579, 0xe2245579, 0xe2245579, 0xf62697e0, 0xf62697e0, 0xf62697e0, 0x9813a416, 0xa9ef09fe, 0xa9ef09fe, 0x9813a416, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x45387400, 0x1f12042f, 0x45387400, 0xc0b64530, 0x5fcf013d, 0x5fcf013d, 0xae65b130, 0xae65b130, 0xae65b130, 0x5f26b42d, 0x5f26b42d, 0x5f26b42d, 0x18d9b7aa, 0x18d9b7aa, 0x18d9b7aa, 0x5fcf013d, 0xc0b64530, 0xc0b64530, 0x5fcf013d, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf22852b8, 0x64b58aed, 0xf22852b8, 0xf2634bd3, 0xdd28f52b, 0xdd28f52b, 0x6226cfea, 0x6226cfea, 0x6226cfea, 0x1f30882e, 0x1f30882e, 0x1f30882e, 0x7c025604, 0x7c025604, 0x7c025604, 0xdd28f52b, 0xf2634bd3, 0xf2634bd3, 0xdd28f52b, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0x7cd7d588, 0xd97ec8cc, 0x7cd7d588, 0x35b398e1, 0x59c36f00, 0x59c36f00, 0x4834c117, 0x4834c117, 0x4834c117, 0x1426c1f5, 0x1426c1f5, 0x1426c1f5, 0x516af56b, 0x516af56b, 0x516af56b, 0x59c36f00, 0x35b398e1, 0x35b398e1, 0x59c36f00, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x77d5614b, 0xee38f19f, 0x77d5614b, 0x2b46d2c4, 0xaa4593fe, 0xaa4593fe, 0x88eefe02, 0x88eefe02, 0x88eefe02, 0x52695139, 0x52695139, 0x52695139, 0x6e654170, 0x6e654170, 0x6e654170, 0xaa4593fe, 0x2b46d2c4, 0x2b46d2c4, 0xaa4593fe, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5c774be, 0xd6ea481d, 0xd5c774be, 0xd66c2, 0xc9cbf769, 0xc9cbf769, 0x8ca7204, 0x8ca7204, 0x8ca7204, 0x3c23552a, 0x3c23552a, 0x3c23552a, 0x1e473da1, 0x1e473da1, 0x1e473da1, 0xc9cbf769, 0xd66c2, 0xd66c2, 0xc9cbf769, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x44f24a9a, 0xb7ce71f6, 0x44f24a9a, 0x3691c507, 0x5387d57f, 0x5387d57f, 0x4ae6f1ac, 0x4ae6f1ac, 0x4ae6f1ac, 0x698737a6, 0x698737a6, 0x698737a6, 0xc1dc726b, 0xc1dc726b, 0xc1dc726b, 0x5387d57f, 0x3691c507, 0x3691c507, 0x5387d57f, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xf3703bd8, 0x8a9322ca, 0xf3703bd8, 0xeaafa0ce, 0xf83ee7aa, 0xf83ee7aa, 0xc41b64b6, 0xc41b64b6, 0xc41b64b6, 0x2cef57, 0x2cef57, 0x2cef57, 0xcf32bc45, 0xcf32bc45, 0xcf32bc45, 0xf83ee7aa, 0xeaafa0ce, 0xeaafa0ce, 0xf83ee7aa, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x159757b3, 0x82f3937, 0x159757b3, 0xf695ff14, 0x724366e5, 0x724366e5, 0xd936d375, 0xd936d375, 0xd936d375, 0x3ac61b13, 0x3ac61b13, 0x3ac61b13, 0x84848e6b, 0x84848e6b, 0x84848e6b, 0x724366e5, 0xf695ff14, 0xf695ff14, 0x724366e5, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x96a35d83, 0x84b40f7d, 0x96a35d83, 0x2e068f13, 0x5387d57f, 0x5387d57f, 0x2512d363, 0x2512d363, 0x2512d363, 0xdbc78c6a, 0xdbc78c6a, 0xdbc78c6a, 0xd33f1559, 0xd33f1559, 0xd33f1559, 0x5387d57f, 0x2e068f13, 0x2e068f13, 0x5387d57f, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1c900934, 0xece326ba, 0x1c900934, 0xcc02638c, 0xf83ee7aa, 0xf83ee7aa, 0x1dbd718d, 0x1dbd718d, 0x1dbd718d, 0x53eb2800, 0x53eb2800, 0x53eb2800, 0xb93753c9, 0xb93753c9, 0xb93753c9, 0xf83ee7aa, 0xcc02638c, 0xcc02638c, 0xf83ee7aa, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x32265220, 0x42236b81, 0x32265220, 0x60c89ea6, 0x724366e5, 0x724366e5, 0x63c96d38, 0x63c96d38, 0x63c96d38, 0xa2507cd2, 0xa2507cd2, 0xa2507cd2, 0x2605f79a, 0x2605f79a, 0x2605f79a, 0x724366e5, 0x60c89ea6, 0x60c89ea6, 0x724366e5, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xdfe16fc4, 0xfeb34743, 0xdfe16fc4, 0x2ad0164a, 0x1c955882, 0x1c955882, 0xdc546008, 0xdc546008, 0xdc546008, 0x5e028fb8, 0x5e028fb8, 0x5e028fb8, 0x91ea0ac4, 0x91ea0ac4, 0x91ea0ac4, 0x1c955882, 0x2ad0164a, 0x2ad0164a, 0x1c955882, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xf988b96e, 0x28c3dbd0, 0xf988b96e, 0xf5218787, 0x4d266f7a, 0x4d266f7a, 0xe63989ae, 0xe63989ae, 0xe63989ae, 0xaa6cdae8, 0xaa6cdae8, 0xaa6cdae8, 0x88cd6816, 0x88cd6816, 0x88cd6816, 0x4d266f7a, 0xf5218787, 0xf5218787, 0x4d266f7a, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xe189c1c0, 0x6e09d325, 0xe189c1c0, 0x4afdf1c2, 0x1ed9d731, 0x1ed9d731, 0xb7a388a2, 0xb7a388a2, 0xb7a388a2, 0x3a2c82a, 0x3a2c82a, 0x3a2c82a, 0xe8ed469, 0xe8ed469, 0xe8ed469, 0x1ed9d731, 0x4afdf1c2, 0x4afdf1c2, 0x1ed9d731, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x44f24a9a, 0xb7ce71f6, 0x44f24a9a, 0x3691c507, 0x5387d57f, 0x5387d57f, 0x4ae6f1ac, 0x4ae6f1ac, 0x4ae6f1ac, 0x698737a6, 0x698737a6, 0x698737a6, 0xc1dc726b, 0xc1dc726b, 0xc1dc726b, 0x5387d57f, 0x3691c507, 0x3691c507, 0x5387d57f, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xf3703bd8, 0x8a9322ca, 0xf3703bd8, 0xeaafa0ce, 0xf83ee7aa, 0xf83ee7aa, 0xc41b64b6, 0xc41b64b6, 0xc41b64b6, 0x2cef57, 0x2cef57, 0x2cef57, 0xcf32bc45, 0xcf32bc45, 0xcf32bc45, 0xf83ee7aa, 0xeaafa0ce, 0xeaafa0ce, 0xf83ee7aa, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x159757b3, 0x82f3937, 0x159757b3, 0xf695ff14, 0x724366e5, 0x724366e5, 0xd936d375, 0xd936d375, 0xd936d375, 0x3ac61b13, 0x3ac61b13, 0x3ac61b13, 0x84848e6b, 0x84848e6b, 0x84848e6b, 0x724366e5, 0xf695ff14, 0xf695ff14, 0x724366e5, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x96a35d83, 0x84b40f7d, 0x96a35d83, 0x2e068f13, 0x5387d57f, 0x5387d57f, 0x2512d363, 0x2512d363, 0x2512d363, 0xdbc78c6a, 0xdbc78c6a, 0xdbc78c6a, 0xd33f1559, 0xd33f1559, 0xd33f1559, 0x5387d57f, 0x2e068f13, 0x2e068f13, 0x5387d57f, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1c900934, 0xece326ba, 0x1c900934, 0xcc02638c, 0xf83ee7aa, 0xf83ee7aa, 0x1dbd718d, 0x1dbd718d, 0x1dbd718d, 0x53eb2800, 0x53eb2800, 0x53eb2800, 0xb93753c9, 0xb93753c9, 0xb93753c9, 0xf83ee7aa, 0xcc02638c, 0xcc02638c, 0xf83ee7aa, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0x32265220, 0x42236b81, 0x32265220, 0x60c89ea6, 0x724366e5, 0x724366e5, 0x63c96d38, 0x63c96d38, 0x63c96d38, 0xa2507cd2, 0xa2507cd2, 0xa2507cd2, 0x2605f79a, 0x2605f79a, 0x2605f79a, 0x724366e5, 0x60c89ea6, 0x60c89ea6, 0x724366e5, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0xdfe16fc4, 0xfeb34743, 0xdfe16fc4, 0x2ad0164a, 0x1c955882, 0x1c955882, 0xdc546008, 0xdc546008, 0xdc546008, 0x5e028fb8, 0x5e028fb8, 0x5e028fb8, 0x91ea0ac4, 0x91ea0ac4, 0x91ea0ac4, 0x1c955882, 0x2ad0164a, 0x2ad0164a, 0x1c955882, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xf988b96e, 0x28c3dbd0, 0xf988b96e, 0xf5218787, 0x4d266f7a, 0x4d266f7a, 0xe63989ae, 0xe63989ae, 0xe63989ae, 0xaa6cdae8, 0xaa6cdae8, 0xaa6cdae8, 0x88cd6816, 0x88cd6816, 0x88cd6816, 0x4d266f7a, 0xf5218787, 0xf5218787, 0x4d266f7a, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xe189c1c0, 0x6e09d325, 0xe189c1c0, 0x4afdf1c2, 0x1ed9d731, 0x1ed9d731, 0xb7a388a2, 0xb7a388a2, 0xb7a388a2, 0x3a2c82a, 0x3a2c82a, 0x3a2c82a, 0xe8ed469, 0xe8ed469, 0xe8ed469, 0x1ed9d731, 0x4afdf1c2, 0x4afdf1c2, 0x1ed9d731, }, 20 }, + { "gfxterm_cyr", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x6ff25334, 0x60142559, 0x6ff25334, 0xa9ef09fe, 0x9813a416, 0x9813a416, 0xe9d151d6, 0xe9d151d6, 0xe9d151d6, 0xe2245579, 0xe2245579, 0xe2245579, 0xf62697e0, 0xf62697e0, 0xf62697e0, 0x9813a416, 0xa9ef09fe, 0xa9ef09fe, 0x9813a416, }, 20 }, + { "gfxterm_cyr", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x45387400, 0x1f12042f, 0x45387400, 0xc0b64530, 0x5fcf013d, 0x5fcf013d, 0xae65b130, 0xae65b130, 0xae65b130, 0x5f26b42d, 0x5f26b42d, 0x5f26b42d, 0x18d9b7aa, 0x18d9b7aa, 0x18d9b7aa, 0x5fcf013d, 0xc0b64530, 0xc0b64530, 0x5fcf013d, }, 20 }, + { "gfxterm_cyr", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xf22852b8, 0x64b58aed, 0xf22852b8, 0xf2634bd3, 0xdd28f52b, 0xdd28f52b, 0x6226cfea, 0x6226cfea, 0x6226cfea, 0x1f30882e, 0x1f30882e, 0x1f30882e, 0x7c025604, 0x7c025604, 0x7c025604, 0xdd28f52b, 0xf2634bd3, 0xf2634bd3, 0xdd28f52b, }, 20 }, + { "gfxterm_heb", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x5564b5ac, 0x60da9eee, 0xbd1e9681, 0xf47adbe8, 0x59c36f00, 0x59c36f00, 0x21d91745, 0x21d91745, 0x21d91745, 0x7dcb17a7, 0x7dcb17a7, 0x7dcb17a7, 0x38872339, 0x38872339, 0x38872339, 0x59c36f00, 0x1c00f8c5, 0xf47adbe8, 0x59c36f00, }, 20 }, + { "gfxterm_heb", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x76e5e86, 0x7b494fdd, 0x495a38ac, 0x15c98b23, 0xaa4593fe, 0xaa4593fe, 0x3eadf2ea, 0x3eadf2ea, 0x3eadf2ea, 0xe42a5dd1, 0xe42a5dd1, 0xe42a5dd1, 0xd8264d98, 0xd8264d98, 0xd8264d98, 0xaa4593fe, 0x5bfded09, 0x15c98b23, 0xaa4593fe, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xb6cb7893, 0x3d8832b4, 0xa83e25d, 0xdf49f021, 0xc9cbf769, 0xc9cbf769, 0xee497240, 0xee497240, 0xee497240, 0xdaa0556e, 0xdaa0556e, 0xdaa0556e, 0xf8c43de5, 0xf8c43de5, 0xf8c43de5, 0xc9cbf769, 0x63016aef, 0xdf49f021, 0xc9cbf769, }, 20 }, + { "gfxterm_heb", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xaec0098e, 0x31dc5518, 0x6f2943a1, 0xa934196b, 0x9813a416, 0x9813a416, 0x27d7c19f, 0x27d7c19f, 0x27d7c19f, 0x2c22c530, 0x2c22c530, 0x2c22c530, 0x382007a9, 0x382007a9, 0x382007a9, 0x9813a416, 0x68dd5344, 0xa934196b, 0x9813a416, }, 20 }, + { "gfxterm_heb", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6840baa6, 0xe3649779, 0x3c42fbb8, 0xb9ccca88, 0x5fcf013d, 0x5fcf013d, 0x634fa67d, 0x634fa67d, 0x634fa67d, 0x920ca360, 0x920ca360, 0x920ca360, 0xd5f3a0e7, 0xd5f3a0e7, 0xd5f3a0e7, 0x5fcf013d, 0xedce8b96, 0xb9ccca88, 0x5fcf013d, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7b6f728f, 0x802df91c, 0x6fe59e4c, 0x6fae8727, 0xdd28f52b, 0xdd28f52b, 0xc591678c, 0xc591678c, 0xc591678c, 0xb8872048, 0xb8872048, 0xb8872048, 0xdbb5fe62, 0xdbb5fe62, 0xdbb5fe62, 0xdd28f52b, 0x7b246be4, 0x6fae8727, 0xdd28f52b, }, 20 }, + { "gfxterm_heb", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0x5564b5ac, 0x60da9eee, 0xbd1e9681, 0xf47adbe8, 0x59c36f00, 0x59c36f00, 0x21d91745, 0x21d91745, 0x21d91745, 0x7dcb17a7, 0x7dcb17a7, 0x7dcb17a7, 0x38872339, 0x38872339, 0x38872339, 0x59c36f00, 0x1c00f8c5, 0xf47adbe8, 0x59c36f00, }, 20 }, + { "gfxterm_heb", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x76e5e86, 0x7b494fdd, 0x495a38ac, 0x15c98b23, 0xaa4593fe, 0xaa4593fe, 0x3eadf2ea, 0x3eadf2ea, 0x3eadf2ea, 0xe42a5dd1, 0xe42a5dd1, 0xe42a5dd1, 0xd8264d98, 0xd8264d98, 0xd8264d98, 0xaa4593fe, 0x5bfded09, 0x15c98b23, 0xaa4593fe, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xb6cb7893, 0x3d8832b4, 0xa83e25d, 0xdf49f021, 0xc9cbf769, 0xc9cbf769, 0xee497240, 0xee497240, 0xee497240, 0xdaa0556e, 0xdaa0556e, 0xdaa0556e, 0xf8c43de5, 0xf8c43de5, 0xf8c43de5, 0xc9cbf769, 0x63016aef, 0xdf49f021, 0xc9cbf769, }, 20 }, + { "gfxterm_heb", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xe91b111e, 0xf17069cf, 0x6b0d417f, 0x196ecee2, 0x5387d57f, 0x5387d57f, 0x3a0bd784, 0x3a0bd784, 0x3a0bd784, 0x196a118e, 0x196a118e, 0x196a118e, 0xb1315443, 0xb1315443, 0xb1315443, 0x5387d57f, 0x9b789e83, 0x196ecee2, 0x5387d57f, }, 20 }, + { "gfxterm_heb", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x618a321d, 0x424668ca, 0xbb28dfaa, 0xa2f744bc, 0xf83ee7aa, 0xf83ee7aa, 0x3a74d341, 0x3a74d341, 0x3a74d341, 0xfe4358a0, 0xfe4358a0, 0xfe4358a0, 0x315d0bb2, 0x315d0bb2, 0x315d0bb2, 0xf83ee7aa, 0x7855a90b, 0xa2f744bc, 0xf83ee7aa, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x87840389, 0x646994d2, 0x50ce49fd, 0xb3cce15a, 0x724366e5, 0x724366e5, 0x695c97b4, 0x695c97b4, 0x695c97b4, 0x8aac5fd2, 0x8aac5fd2, 0x8aac5fd2, 0x34eecaaa, 0x34eecaaa, 0x34eecaaa, 0x724366e5, 0x6486ab2e, 0xb3cce15a, 0x724366e5, }, 20 }, + { "gfxterm_heb", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x1ef83cc4, 0x8f37421b, 0xccc91d44, 0x746ccfd4, 0x5387d57f, 0x5387d57f, 0xce1861a0, 0xce1861a0, 0xce1861a0, 0x30cd3ea9, 0x30cd3ea9, 0x30cd3ea9, 0x3835a79a, 0x3835a79a, 0x3835a79a, 0x5387d57f, 0xa65dee54, 0x746ccfd4, 0x5387d57f, }, 20 }, + { "gfxterm_heb", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xd4d7990, 0x3f81f76b, 0xab169d0e, 0x7b84f7b6, 0xf83ee7aa, 0xf83ee7aa, 0xb21afb9f, 0xb21afb9f, 0xb21afb9f, 0xfc4ca212, 0xfc4ca212, 0xfc4ca212, 0x1690d9db, 0x1690d9db, 0x1690d9db, 0xf83ee7aa, 0xdddf1328, 0x7b84f7b6, 0xf83ee7aa, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xf484a7a, 0x1d016ff1, 0xa1efb839, 0xf30174bf, 0x724366e5, 0x724366e5, 0x20dd566e, 0x20dd566e, 0x20dd566e, 0xe1444784, 0xe1444784, 0xe1444784, 0x6511cccc, 0x6511cccc, 0x6511cccc, 0x724366e5, 0x5da686fc, 0xf30174bf, 0x724366e5, }, 20 }, + { "gfxterm_heb", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xe6f2b3cc, 0xb53e897f, 0xcb165f0b, 0x3e272685, 0x1c955882, 0x1c955882, 0xcebb321, 0xcebb321, 0xcebb321, 0x8ebd5c91, 0x8ebd5c91, 0x8ebd5c91, 0x4155d9ed, 0x4155d9ed, 0x4155d9ed, 0x1c955882, 0x13c3ca42, 0x3e272685, 0x1c955882, }, 20 }, + { "gfxterm_heb", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x79d3a961, 0x2abea675, 0x6d16d7f8, 0x61bfe911, 0x4d266f7a, 0x4d266f7a, 0xc6f457fe, 0xc6f457fe, 0xc6f457fe, 0x8aa104b8, 0x8aa104b8, 0x8aa104b8, 0xa800b646, 0xa800b646, 0xa800b646, 0x4d266f7a, 0x757a9788, 0x61bfe911, 0x4d266f7a, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x95a273e0, 0xa4c29c6, 0x5d827a2a, 0xf6f64a28, 0x1ed9d731, 0x1ed9d731, 0xb750ffe0, 0xb750ffe0, 0xb750ffe0, 0x351bf68, 0x351bf68, 0x351bf68, 0xe7da32b, 0xe7da32b, 0xe7da32b, 0x1ed9d731, 0x3ed643e2, 0xf6f64a28, 0x1ed9d731, }, 20 }, + { "gfxterm_heb", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0xe91b111e, 0xf17069cf, 0x6b0d417f, 0x196ecee2, 0x5387d57f, 0x5387d57f, 0x3a0bd784, 0x3a0bd784, 0x3a0bd784, 0x196a118e, 0x196a118e, 0x196a118e, 0xb1315443, 0xb1315443, 0xb1315443, 0x5387d57f, 0x9b789e83, 0x196ecee2, 0x5387d57f, }, 20 }, + { "gfxterm_heb", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x618a321d, 0x424668ca, 0xbb28dfaa, 0xa2f744bc, 0xf83ee7aa, 0xf83ee7aa, 0x3a74d341, 0x3a74d341, 0x3a74d341, 0xfe4358a0, 0xfe4358a0, 0xfe4358a0, 0x315d0bb2, 0x315d0bb2, 0x315d0bb2, 0xf83ee7aa, 0x7855a90b, 0xa2f744bc, 0xf83ee7aa, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x87840389, 0x646994d2, 0x50ce49fd, 0xb3cce15a, 0x724366e5, 0x724366e5, 0x695c97b4, 0x695c97b4, 0x695c97b4, 0x8aac5fd2, 0x8aac5fd2, 0x8aac5fd2, 0x34eecaaa, 0x34eecaaa, 0x34eecaaa, 0x724366e5, 0x6486ab2e, 0xb3cce15a, 0x724366e5, }, 20 }, + { "gfxterm_heb", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x1ef83cc4, 0x8f37421b, 0xccc91d44, 0x746ccfd4, 0x5387d57f, 0x5387d57f, 0xce1861a0, 0xce1861a0, 0xce1861a0, 0x30cd3ea9, 0x30cd3ea9, 0x30cd3ea9, 0x3835a79a, 0x3835a79a, 0x3835a79a, 0x5387d57f, 0xa65dee54, 0x746ccfd4, 0x5387d57f, }, 20 }, + { "gfxterm_heb", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xd4d7990, 0x3f81f76b, 0xab169d0e, 0x7b84f7b6, 0xf83ee7aa, 0xf83ee7aa, 0xb21afb9f, 0xb21afb9f, 0xb21afb9f, 0xfc4ca212, 0xfc4ca212, 0xfc4ca212, 0x1690d9db, 0x1690d9db, 0x1690d9db, 0xf83ee7aa, 0xdddf1328, 0x7b84f7b6, 0xf83ee7aa, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xf484a7a, 0x1d016ff1, 0xa1efb839, 0xf30174bf, 0x724366e5, 0x724366e5, 0x20dd566e, 0x20dd566e, 0x20dd566e, 0xe1444784, 0xe1444784, 0xe1444784, 0x6511cccc, 0x6511cccc, 0x6511cccc, 0x724366e5, 0x5da686fc, 0xf30174bf, 0x724366e5, }, 20 }, + { "gfxterm_heb", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0xe6f2b3cc, 0xb53e897f, 0xcb165f0b, 0x3e272685, 0x1c955882, 0x1c955882, 0xcebb321, 0xcebb321, 0xcebb321, 0x8ebd5c91, 0x8ebd5c91, 0x8ebd5c91, 0x4155d9ed, 0x4155d9ed, 0x4155d9ed, 0x1c955882, 0x13c3ca42, 0x3e272685, 0x1c955882, }, 20 }, + { "gfxterm_heb", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x79d3a961, 0x2abea675, 0x6d16d7f8, 0x61bfe911, 0x4d266f7a, 0x4d266f7a, 0xc6f457fe, 0xc6f457fe, 0xc6f457fe, 0x8aa104b8, 0x8aa104b8, 0x8aa104b8, 0xa800b646, 0xa800b646, 0xa800b646, 0x4d266f7a, 0x757a9788, 0x61bfe911, 0x4d266f7a, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x95a273e0, 0xa4c29c6, 0x5d827a2a, 0xf6f64a28, 0x1ed9d731, 0x1ed9d731, 0xb750ffe0, 0xb750ffe0, 0xb750ffe0, 0x351bf68, 0x351bf68, 0x351bf68, 0xe7da32b, 0xe7da32b, 0xe7da32b, 0x1ed9d731, 0x3ed643e2, 0xf6f64a28, 0x1ed9d731, }, 20 }, + { "gfxterm_heb", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0xaec0098e, 0x31dc5518, 0x6f2943a1, 0xa934196b, 0x9813a416, 0x9813a416, 0x27d7c19f, 0x27d7c19f, 0x27d7c19f, 0x2c22c530, 0x2c22c530, 0x2c22c530, 0x382007a9, 0x382007a9, 0x382007a9, 0x9813a416, 0x68dd5344, 0xa934196b, 0x9813a416, }, 20 }, + { "gfxterm_heb", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6840baa6, 0xe3649779, 0x3c42fbb8, 0xb9ccca88, 0x5fcf013d, 0x5fcf013d, 0x634fa67d, 0x634fa67d, 0x634fa67d, 0x920ca360, 0x920ca360, 0x920ca360, 0xd5f3a0e7, 0xd5f3a0e7, 0xd5f3a0e7, 0x5fcf013d, 0xedce8b96, 0xb9ccca88, 0x5fcf013d, }, 20 }, + { "gfxterm_heb", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x7b6f728f, 0x802df91c, 0x6fe59e4c, 0x6fae8727, 0xdd28f52b, 0xdd28f52b, 0xc591678c, 0xc591678c, 0xc591678c, 0xb8872048, 0xb8872048, 0xb8872048, 0xdbb5fe62, 0xdbb5fe62, 0xdbb5fe62, 0xdd28f52b, 0x7b246be4, 0x6fae8727, 0xdd28f52b, }, 20 }, + { "gfxterm_gre", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x8c809d98, 0xa2deb5e8, 0x8c809d98, 0xc5e4d0f1, 0x59c36f00, 0x59c36f00, 0xcce4d070, 0xcce4d070, 0xcce4d070, 0x90f6d092, 0x90f6d092, 0x90f6d092, 0xd5bae40c, 0xd5bae40c, 0xd5bae40c, 0x59c36f00, 0xc5e4d0f1, 0xc5e4d0f1, 0x59c36f00, }, 20 }, + { "gfxterm_gre", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xd2952b24, 0xc43b8c16, 0xd2952b24, 0x8e0698ab, 0xaa4593fe, 0xaa4593fe, 0x72cbd134, 0x72cbd134, 0x72cbd134, 0xa84c7e0f, 0xa84c7e0f, 0xa84c7e0f, 0x94406e46, 0x94406e46, 0x94406e46, 0xaa4593fe, 0x8e0698ab, 0x8e0698ab, 0xaa4593fe, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x10e5e33e, 0xfaceb35c, 0x10e5e33e, 0xc52ff142, 0xc9cbf769, 0xc9cbf769, 0x4b7f7a, 0x4b7f7a, 0x4b7f7a, 0x34a25854, 0x34a25854, 0x34a25854, 0x16c630df, 0x16c630df, 0x16c630df, 0xc9cbf769, 0xc52ff142, 0xc52ff142, 0xc9cbf769, }, 20 }, + { "gfxterm_gre", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x35eaca6c, 0xf1f3421e, 0x35eaca6c, 0xf3f790a6, 0x9813a416, 0x9813a416, 0x3a84c463, 0x3a84c463, 0x3a84c463, 0x3171c0cc, 0x3171c0cc, 0x3171c0cc, 0x25730255, 0x25730255, 0x25730255, 0x9813a416, 0xf3f790a6, 0xf3f790a6, 0x9813a416, }, 20 }, + { "gfxterm_gre", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xc63e4058, 0x297346bb, 0xc63e4058, 0x43b07168, 0x5fcf013d, 0x5fcf013d, 0x814b6f45, 0x814b6f45, 0x814b6f45, 0x70086a58, 0x70086a58, 0x70086a58, 0x37f769df, 0x37f769df, 0x37f769df, 0x5fcf013d, 0x43b07168, 0x43b07168, 0x5fcf013d, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x42625965, 0xbdbab59d, 0x42625965, 0x4229400e, 0xdd28f52b, 0xdd28f52b, 0x74cb4529, 0x74cb4529, 0x74cb4529, 0x9dd02ed, 0x9dd02ed, 0x9dd02ed, 0x6aefdcc7, 0x6aefdcc7, 0x6aefdcc7, 0xdd28f52b, 0x4229400e, 0x4229400e, 0xdd28f52b, }, 20 }, + { "gfxterm_gre", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0x8c809d98, 0xa2deb5e8, 0x8c809d98, 0xc5e4d0f1, 0x59c36f00, 0x59c36f00, 0xcce4d070, 0xcce4d070, 0xcce4d070, 0x90f6d092, 0x90f6d092, 0x90f6d092, 0xd5bae40c, 0xd5bae40c, 0xd5bae40c, 0x59c36f00, 0xc5e4d0f1, 0xc5e4d0f1, 0x59c36f00, }, 20 }, + { "gfxterm_gre", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0xd2952b24, 0xc43b8c16, 0xd2952b24, 0x8e0698ab, 0xaa4593fe, 0xaa4593fe, 0x72cbd134, 0x72cbd134, 0x72cbd134, 0xa84c7e0f, 0xa84c7e0f, 0xa84c7e0f, 0x94406e46, 0x94406e46, 0x94406e46, 0xaa4593fe, 0x8e0698ab, 0x8e0698ab, 0xaa4593fe, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x10e5e33e, 0xfaceb35c, 0x10e5e33e, 0xc52ff142, 0xc9cbf769, 0xc9cbf769, 0x4b7f7a, 0x4b7f7a, 0x4b7f7a, 0x34a25854, 0x34a25854, 0x34a25854, 0x16c630df, 0x16c630df, 0x16c630df, 0xc9cbf769, 0xc52ff142, 0xc52ff142, 0xc9cbf769, }, 20 }, + { "gfxterm_gre", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xf1d34c3f, 0xcb451cf, 0xf1d34c3f, 0x83b0c3a2, 0x5387d57f, 0x5387d57f, 0xdc42e576, 0xdc42e576, 0xdc42e576, 0xff23237c, 0xff23237c, 0xff23237c, 0x577866b1, 0x577866b1, 0x577866b1, 0x5387d57f, 0x83b0c3a2, 0x83b0c3a2, 0x5387d57f, }, 20 }, + { "gfxterm_gre", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1219f891, 0x3ea9e133, 0x1219f891, 0xbc66387, 0xf83ee7aa, 0xf83ee7aa, 0x4d56ad7d, 0x4d56ad7d, 0x4d56ad7d, 0x8961269c, 0x8961269c, 0x8961269c, 0x467f758e, 0x467f758e, 0x467f758e, 0xf83ee7aa, 0xbc66387, 0xbc66387, 0xf83ee7aa, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x39dd8885, 0x9ff9b01d, 0x39dd8885, 0xdadf2022, 0x724366e5, 0x724366e5, 0x2a5a1ea5, 0x2a5a1ea5, 0x2a5a1ea5, 0xc9aad6c3, 0xc9aad6c3, 0xc9aad6c3, 0x77e843bb, 0x77e843bb, 0x77e843bb, 0x724366e5, 0xdadf2022, 0xdadf2022, 0x724366e5, }, 20 }, + { "gfxterm_gre", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x9c06870a, 0xfb391ac3, 0x9c06870a, 0x24a3559a, 0x5387d57f, 0x5387d57f, 0x67afb6e7, 0x67afb6e7, 0x67afb6e7, 0x997ae9ee, 0x997ae9ee, 0x997ae9ee, 0x918270dd, 0x918270dd, 0x918270dd, 0x5387d57f, 0x24a3559a, 0x24a3559a, 0x5387d57f, }, 20 }, + { "gfxterm_gre", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x34160e54, 0xfa0d929, 0x34160e54, 0xe48464ec, 0xf83ee7aa, 0xf83ee7aa, 0xbada5191, 0xbada5191, 0xbada5191, 0xf48c081c, 0xf48c081c, 0xf48c081c, 0x1e5073d5, 0x1e5073d5, 0x1e5073d5, 0xf83ee7aa, 0xe48464ec, 0xe48464ec, 0xf83ee7aa, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xf8b89646, 0xae36218f, 0xf8b89646, 0xaa565ac0, 0x724366e5, 0x724366e5, 0xc530c749, 0xc530c749, 0xc530c749, 0x4a9d6a3, 0x4a9d6a3, 0x4a9d6a3, 0x80fc5deb, 0x80fc5deb, 0x80fc5deb, 0x724366e5, 0xaa565ac0, 0xaa565ac0, 0x724366e5, }, 20 }, + { "gfxterm_gre", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xc814e98c, 0xc80ea558, 0xc814e98c, 0x3d259002, 0x1c955882, 0x1c955882, 0xbaf29951, 0xbaf29951, 0xbaf29951, 0x38a476e1, 0x38a476e1, 0x38a476e1, 0xf74cf39d, 0xf74cf39d, 0xf74cf39d, 0x1c955882, 0x3d259002, 0x3d259002, 0x1c955882, }, 20 }, + { "gfxterm_gre", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x4d835add, 0x8e85c29e, 0x4d835add, 0x412a6434, 0x4d266f7a, 0x4d266f7a, 0x37157ce4, 0x37157ce4, 0x37157ce4, 0x7b402fa2, 0x7b402fa2, 0x7b402fa2, 0x59e19d5c, 0x59e19d5c, 0x59e19d5c, 0x4d266f7a, 0x412a6434, 0x412a6434, 0x4d266f7a, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x65f356c1, 0x687de513, 0x65f356c1, 0xce8766c3, 0x1ed9d731, 0x1ed9d731, 0xfb07ebd0, 0xfb07ebd0, 0xfb07ebd0, 0x4f06ab58, 0x4f06ab58, 0x4f06ab58, 0x422ab71b, 0x422ab71b, 0x422ab71b, 0x1ed9d731, 0xce8766c3, 0xce8766c3, 0x1ed9d731, }, 20 }, + { "gfxterm_gre", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0xf1d34c3f, 0xcb451cf, 0xf1d34c3f, 0x83b0c3a2, 0x5387d57f, 0x5387d57f, 0xdc42e576, 0xdc42e576, 0xdc42e576, 0xff23237c, 0xff23237c, 0xff23237c, 0x577866b1, 0x577866b1, 0x577866b1, 0x5387d57f, 0x83b0c3a2, 0x83b0c3a2, 0x5387d57f, }, 20 }, + { "gfxterm_gre", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1219f891, 0x3ea9e133, 0x1219f891, 0xbc66387, 0xf83ee7aa, 0xf83ee7aa, 0x4d56ad7d, 0x4d56ad7d, 0x4d56ad7d, 0x8961269c, 0x8961269c, 0x8961269c, 0x467f758e, 0x467f758e, 0x467f758e, 0xf83ee7aa, 0xbc66387, 0xbc66387, 0xf83ee7aa, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x39dd8885, 0x9ff9b01d, 0x39dd8885, 0xdadf2022, 0x724366e5, 0x724366e5, 0x2a5a1ea5, 0x2a5a1ea5, 0x2a5a1ea5, 0xc9aad6c3, 0xc9aad6c3, 0xc9aad6c3, 0x77e843bb, 0x77e843bb, 0x77e843bb, 0x724366e5, 0xdadf2022, 0xdadf2022, 0x724366e5, }, 20 }, + { "gfxterm_gre", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x9c06870a, 0xfb391ac3, 0x9c06870a, 0x24a3559a, 0x5387d57f, 0x5387d57f, 0x67afb6e7, 0x67afb6e7, 0x67afb6e7, 0x997ae9ee, 0x997ae9ee, 0x997ae9ee, 0x918270dd, 0x918270dd, 0x918270dd, 0x5387d57f, 0x24a3559a, 0x24a3559a, 0x5387d57f, }, 20 }, + { "gfxterm_gre", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x34160e54, 0xfa0d929, 0x34160e54, 0xe48464ec, 0xf83ee7aa, 0xf83ee7aa, 0xbada5191, 0xbada5191, 0xbada5191, 0xf48c081c, 0xf48c081c, 0xf48c081c, 0x1e5073d5, 0x1e5073d5, 0x1e5073d5, 0xf83ee7aa, 0xe48464ec, 0xe48464ec, 0xf83ee7aa, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xf8b89646, 0xae36218f, 0xf8b89646, 0xaa565ac0, 0x724366e5, 0x724366e5, 0xc530c749, 0xc530c749, 0xc530c749, 0x4a9d6a3, 0x4a9d6a3, 0x4a9d6a3, 0x80fc5deb, 0x80fc5deb, 0x80fc5deb, 0x724366e5, 0xaa565ac0, 0xaa565ac0, 0x724366e5, }, 20 }, + { "gfxterm_gre", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0xc814e98c, 0xc80ea558, 0xc814e98c, 0x3d259002, 0x1c955882, 0x1c955882, 0xbaf29951, 0xbaf29951, 0xbaf29951, 0x38a476e1, 0x38a476e1, 0x38a476e1, 0xf74cf39d, 0xf74cf39d, 0xf74cf39d, 0x1c955882, 0x3d259002, 0x3d259002, 0x1c955882, }, 20 }, + { "gfxterm_gre", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x4d835add, 0x8e85c29e, 0x4d835add, 0x412a6434, 0x4d266f7a, 0x4d266f7a, 0x37157ce4, 0x37157ce4, 0x37157ce4, 0x7b402fa2, 0x7b402fa2, 0x7b402fa2, 0x59e19d5c, 0x59e19d5c, 0x59e19d5c, 0x4d266f7a, 0x412a6434, 0x412a6434, 0x4d266f7a, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x65f356c1, 0x687de513, 0x65f356c1, 0xce8766c3, 0x1ed9d731, 0x1ed9d731, 0xfb07ebd0, 0xfb07ebd0, 0xfb07ebd0, 0x4f06ab58, 0x4f06ab58, 0x4f06ab58, 0x422ab71b, 0x422ab71b, 0x422ab71b, 0x1ed9d731, 0xce8766c3, 0xce8766c3, 0x1ed9d731, }, 20 }, + { "gfxterm_gre", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x35eaca6c, 0xf1f3421e, 0x35eaca6c, 0xf3f790a6, 0x9813a416, 0x9813a416, 0x3a84c463, 0x3a84c463, 0x3a84c463, 0x3171c0cc, 0x3171c0cc, 0x3171c0cc, 0x25730255, 0x25730255, 0x25730255, 0x9813a416, 0xf3f790a6, 0xf3f790a6, 0x9813a416, }, 20 }, + { "gfxterm_gre", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xc63e4058, 0x297346bb, 0xc63e4058, 0x43b07168, 0x5fcf013d, 0x5fcf013d, 0x814b6f45, 0x814b6f45, 0x814b6f45, 0x70086a58, 0x70086a58, 0x70086a58, 0x37f769df, 0x37f769df, 0x37f769df, 0x5fcf013d, 0x43b07168, 0x43b07168, 0x5fcf013d, }, 20 }, + { "gfxterm_gre", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x42625965, 0xbdbab59d, 0x42625965, 0x4229400e, 0xdd28f52b, 0xdd28f52b, 0x74cb4529, 0x74cb4529, 0x74cb4529, 0x9dd02ed, 0x9dd02ed, 0x9dd02ed, 0x6aefdcc7, 0x6aefdcc7, 0x6aefdcc7, 0xdd28f52b, 0x4229400e, 0x4229400e, 0xdd28f52b, }, 20 }, + { "gfxterm_ru", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xdbf44912, 0xc82adc43, 0xdbf44912, 0x9290047b, 0x59c36f00, 0x59c36f00, 0xab23d594, 0xab23d594, 0xab23d594, 0xf731d576, 0xf731d576, 0xf731d576, 0xb27de1e8, 0xb27de1e8, 0xb27de1e8, 0x59c36f00, 0x9290047b, 0x9290047b, 0x59c36f00, }, 20 }, + { "gfxterm_ru", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x62fabab4, 0xdbdedb42, 0x62fabab4, 0x3e69093b, 0xaa4593fe, 0xaa4593fe, 0x8573463b, 0x8573463b, 0x8573463b, 0x5ff4e900, 0x5ff4e900, 0x5ff4e900, 0x63f8f949, 0x63f8f949, 0x63f8f949, 0xaa4593fe, 0x3e69093b, 0x3e69093b, 0xaa4593fe, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xc4a0b1c4, 0xcaf9129f, 0xc4a0b1c4, 0x116aa3b8, 0xc9cbf769, 0xc9cbf769, 0xcd389b10, 0xcd389b10, 0xcd389b10, 0xf9d1bc3e, 0xf9d1bc3e, 0xf9d1bc3e, 0xdbb5d4b5, 0xdbb5d4b5, 0xdbb5d4b5, 0xc9cbf769, 0x116aa3b8, 0x116aa3b8, 0xc9cbf769, }, 20 }, + { "gfxterm_ru", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x6efb4dad, 0x369b71a, 0x6efb4dad, 0xa8e61767, 0x9813a416, 0x9813a416, 0x3b4bf94, 0x3b4bf94, 0x3b4bf94, 0x841bb3b, 0x841bb3b, 0x841bb3b, 0x1c4379a2, 0x1c4379a2, 0x1c4379a2, 0x9813a416, 0xa8e61767, 0xa8e61767, 0x9813a416, }, 20 }, + { "gfxterm_ru", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x179dd979, 0x1de58cc1, 0x179dd979, 0x9213e849, 0x5fcf013d, 0x5fcf013d, 0x349a05dc, 0x349a05dc, 0x349a05dc, 0xc5d900c1, 0xc5d900c1, 0xc5d900c1, 0x82260346, 0x82260346, 0x82260346, 0x5fcf013d, 0x9213e849, 0x9213e849, 0x5fcf013d, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x5d07b0aa, 0x2682b6f8, 0x5d07b0aa, 0x5d4ca9c1, 0xdd28f52b, 0xdd28f52b, 0xd4dbe6e9, 0xd4dbe6e9, 0xd4dbe6e9, 0xa9cda12d, 0xa9cda12d, 0xa9cda12d, 0xcaff7f07, 0xcaff7f07, 0xcaff7f07, 0xdd28f52b, 0x5d4ca9c1, 0x5d4ca9c1, 0xdd28f52b, }, 20 }, + { "gfxterm_ru", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xdbf44912, 0xc82adc43, 0xdbf44912, 0x9290047b, 0x59c36f00, 0x59c36f00, 0xab23d594, 0xab23d594, 0xab23d594, 0xf731d576, 0xf731d576, 0xf731d576, 0xb27de1e8, 0xb27de1e8, 0xb27de1e8, 0x59c36f00, 0x9290047b, 0x9290047b, 0x59c36f00, }, 20 }, + { "gfxterm_ru", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x62fabab4, 0xdbdedb42, 0x62fabab4, 0x3e69093b, 0xaa4593fe, 0xaa4593fe, 0x8573463b, 0x8573463b, 0x8573463b, 0x5ff4e900, 0x5ff4e900, 0x5ff4e900, 0x63f8f949, 0x63f8f949, 0x63f8f949, 0xaa4593fe, 0x3e69093b, 0x3e69093b, 0xaa4593fe, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xc4a0b1c4, 0xcaf9129f, 0xc4a0b1c4, 0x116aa3b8, 0xc9cbf769, 0xc9cbf769, 0xcd389b10, 0xcd389b10, 0xcd389b10, 0xf9d1bc3e, 0xf9d1bc3e, 0xf9d1bc3e, 0xdbb5d4b5, 0xdbb5d4b5, 0xdbb5d4b5, 0xc9cbf769, 0x116aa3b8, 0x116aa3b8, 0xc9cbf769, }, 20 }, + { "gfxterm_ru", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xbc31c24b, 0x83c43023, 0xbc31c24b, 0xce524dd6, 0x5387d57f, 0x5387d57f, 0xda49acb8, 0xda49acb8, 0xda49acb8, 0xf9286ab2, 0xf9286ab2, 0xf9286ab2, 0x51732f7f, 0x51732f7f, 0x51732f7f, 0x5387d57f, 0xce524dd6, 0xce524dd6, 0x5387d57f, }, 20 }, + { "gfxterm_ru", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xef057545, 0xac031794, 0xef057545, 0xf6daee53, 0xf83ee7aa, 0xf83ee7aa, 0xd2d55043, 0xd2d55043, 0xd2d55043, 0x16e2dba2, 0x16e2dba2, 0x16e2dba2, 0xd9fc88b0, 0xd9fc88b0, 0xd9fc88b0, 0xf83ee7aa, 0xf6daee53, 0xf6daee53, 0xf83ee7aa, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0xe302caa7, 0xaa205ee5, 0xe302caa7, 0x6200, 0x724366e5, 0x724366e5, 0xc267b9a4, 0xc267b9a4, 0xc267b9a4, 0x219771c2, 0x219771c2, 0x219771c2, 0x9fd5e4ba, 0x9fd5e4ba, 0x9fd5e4ba, 0x724366e5, 0x6200, 0x6200, 0x724366e5, }, 20 }, + { "gfxterm_ru", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0xe275ba72, 0xc0fca11, 0xe275ba72, 0x5ad068e2, 0x5387d57f, 0x5387d57f, 0x915873ea, 0x915873ea, 0x915873ea, 0x6f8d2ce3, 0x6f8d2ce3, 0x6f8d2ce3, 0x6775b5d0, 0x6775b5d0, 0x6775b5d0, 0x5387d57f, 0x5ad068e2, 0x5ad068e2, 0x5387d57f, }, 20 }, + { "gfxterm_ru", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1b78c823, 0x44f4ea59, 0x1b78c823, 0xcbeaa29b, 0xf83ee7aa, 0xf83ee7aa, 0x8a66a6d, 0x8a66a6d, 0x8a66a6d, 0x46f033e0, 0x46f033e0, 0x46f033e0, 0xac2c4829, 0xac2c4829, 0xac2c4829, 0xf83ee7aa, 0xcbeaa29b, 0xcbeaa29b, 0xf83ee7aa, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xb17861b9, 0x4a460c5, 0xb17861b9, 0xe396ad3f, 0x724366e5, 0x724366e5, 0xb5604b13, 0xb5604b13, 0xb5604b13, 0x74f95af9, 0x74f95af9, 0x74f95af9, 0xf0acd1b1, 0xf0acd1b1, 0xf0acd1b1, 0x724366e5, 0xe396ad3f, 0xe396ad3f, 0x724366e5, }, 20 }, + { "gfxterm_ru", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xf4baecd1, 0x8ac6b394, 0xf4baecd1, 0x18b955f, 0x1c955882, 0x1c955882, 0x96ffb153, 0x96ffb153, 0x96ffb153, 0x14a95ee3, 0x14a95ee3, 0x14a95ee3, 0xdb41db9f, 0xdb41db9f, 0xdb41db9f, 0x1c955882, 0x18b955f, 0x18b955f, 0x1c955882, }, 20 }, + { "gfxterm_ru", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfd3793dc, 0x2db332c2, 0xfd3793dc, 0xf19ead35, 0x4d266f7a, 0x4d266f7a, 0x12ca05d7, 0x12ca05d7, 0x12ca05d7, 0x5e9f5691, 0x5e9f5691, 0x5e9f5691, 0x7c3ee46f, 0x7c3ee46f, 0x7c3ee46f, 0x4d266f7a, 0xf19ead35, 0xf19ead35, 0x4d266f7a, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xeeea770, 0x17ff444a, 0xeeea770, 0xa59a9772, 0x1ed9d731, 0x1ed9d731, 0x1d44b9f2, 0x1d44b9f2, 0x1d44b9f2, 0xa945f97a, 0xa945f97a, 0xa945f97a, 0xa469e539, 0xa469e539, 0xa469e539, 0x1ed9d731, 0xa59a9772, 0xa59a9772, 0x1ed9d731, }, 20 }, + { "gfxterm_ru", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0xbc31c24b, 0x83c43023, 0xbc31c24b, 0xce524dd6, 0x5387d57f, 0x5387d57f, 0xda49acb8, 0xda49acb8, 0xda49acb8, 0xf9286ab2, 0xf9286ab2, 0xf9286ab2, 0x51732f7f, 0x51732f7f, 0x51732f7f, 0x5387d57f, 0xce524dd6, 0xce524dd6, 0x5387d57f, }, 20 }, + { "gfxterm_ru", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xef057545, 0xac031794, 0xef057545, 0xf6daee53, 0xf83ee7aa, 0xf83ee7aa, 0xd2d55043, 0xd2d55043, 0xd2d55043, 0x16e2dba2, 0x16e2dba2, 0x16e2dba2, 0xd9fc88b0, 0xd9fc88b0, 0xd9fc88b0, 0xf83ee7aa, 0xf6daee53, 0xf6daee53, 0xf83ee7aa, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0xe302caa7, 0xaa205ee5, 0xe302caa7, 0x6200, 0x724366e5, 0x724366e5, 0xc267b9a4, 0xc267b9a4, 0xc267b9a4, 0x219771c2, 0x219771c2, 0x219771c2, 0x9fd5e4ba, 0x9fd5e4ba, 0x9fd5e4ba, 0x724366e5, 0x6200, 0x6200, 0x724366e5, }, 20 }, + { "gfxterm_ru", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0xe275ba72, 0xc0fca11, 0xe275ba72, 0x5ad068e2, 0x5387d57f, 0x5387d57f, 0x915873ea, 0x915873ea, 0x915873ea, 0x6f8d2ce3, 0x6f8d2ce3, 0x6f8d2ce3, 0x6775b5d0, 0x6775b5d0, 0x6775b5d0, 0x5387d57f, 0x5ad068e2, 0x5ad068e2, 0x5387d57f, }, 20 }, + { "gfxterm_ru", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1b78c823, 0x44f4ea59, 0x1b78c823, 0xcbeaa29b, 0xf83ee7aa, 0xf83ee7aa, 0x8a66a6d, 0x8a66a6d, 0x8a66a6d, 0x46f033e0, 0x46f033e0, 0x46f033e0, 0xac2c4829, 0xac2c4829, 0xac2c4829, 0xf83ee7aa, 0xcbeaa29b, 0xcbeaa29b, 0xf83ee7aa, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xb17861b9, 0x4a460c5, 0xb17861b9, 0xe396ad3f, 0x724366e5, 0x724366e5, 0xb5604b13, 0xb5604b13, 0xb5604b13, 0x74f95af9, 0x74f95af9, 0x74f95af9, 0xf0acd1b1, 0xf0acd1b1, 0xf0acd1b1, 0x724366e5, 0xe396ad3f, 0xe396ad3f, 0x724366e5, }, 20 }, + { "gfxterm_ru", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0xf4baecd1, 0x8ac6b394, 0xf4baecd1, 0x18b955f, 0x1c955882, 0x1c955882, 0x96ffb153, 0x96ffb153, 0x96ffb153, 0x14a95ee3, 0x14a95ee3, 0x14a95ee3, 0xdb41db9f, 0xdb41db9f, 0xdb41db9f, 0x1c955882, 0x18b955f, 0x18b955f, 0x1c955882, }, 20 }, + { "gfxterm_ru", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfd3793dc, 0x2db332c2, 0xfd3793dc, 0xf19ead35, 0x4d266f7a, 0x4d266f7a, 0x12ca05d7, 0x12ca05d7, 0x12ca05d7, 0x5e9f5691, 0x5e9f5691, 0x5e9f5691, 0x7c3ee46f, 0x7c3ee46f, 0x7c3ee46f, 0x4d266f7a, 0xf19ead35, 0xf19ead35, 0x4d266f7a, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xeeea770, 0x17ff444a, 0xeeea770, 0xa59a9772, 0x1ed9d731, 0x1ed9d731, 0x1d44b9f2, 0x1d44b9f2, 0x1d44b9f2, 0xa945f97a, 0xa945f97a, 0xa945f97a, 0xa469e539, 0xa469e539, 0xa469e539, 0x1ed9d731, 0xa59a9772, 0xa59a9772, 0x1ed9d731, }, 20 }, + { "gfxterm_ru", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x6efb4dad, 0x369b71a, 0x6efb4dad, 0xa8e61767, 0x9813a416, 0x9813a416, 0x3b4bf94, 0x3b4bf94, 0x3b4bf94, 0x841bb3b, 0x841bb3b, 0x841bb3b, 0x1c4379a2, 0x1c4379a2, 0x1c4379a2, 0x9813a416, 0xa8e61767, 0xa8e61767, 0x9813a416, }, 20 }, + { "gfxterm_ru", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x179dd979, 0x1de58cc1, 0x179dd979, 0x9213e849, 0x5fcf013d, 0x5fcf013d, 0x349a05dc, 0x349a05dc, 0x349a05dc, 0xc5d900c1, 0xc5d900c1, 0xc5d900c1, 0x82260346, 0x82260346, 0x82260346, 0x5fcf013d, 0x9213e849, 0x9213e849, 0x5fcf013d, }, 20 }, + { "gfxterm_ru", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x5d07b0aa, 0x2682b6f8, 0x5d07b0aa, 0x5d4ca9c1, 0xdd28f52b, 0xdd28f52b, 0xd4dbe6e9, 0xd4dbe6e9, 0xd4dbe6e9, 0xa9cda12d, 0xa9cda12d, 0xa9cda12d, 0xcaff7f07, 0xcaff7f07, 0xcaff7f07, 0xdd28f52b, 0x5d4ca9c1, 0x5d4ca9c1, 0xdd28f52b, }, 20 }, + { "gfxterm_fr", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x78b258dc, 0x5543ab2b, 0x78b258dc, 0x31d615b5, 0x59c36f00, 0x59c36f00, 0xc73a1033, 0xc73a1033, 0xc73a1033, 0x9b2810d1, 0x9b2810d1, 0x9b2810d1, 0xde64244f, 0xde64244f, 0xde64244f, 0x59c36f00, 0x31d615b5, 0x31d615b5, 0x59c36f00, }, 20 }, + { "gfxterm_fr", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x8cfc9a2, 0xe48bee7d, 0x8cfc9a2, 0x545c7a2d, 0xaa4593fe, 0xaa4593fe, 0xb30e5e1c, 0xb30e5e1c, 0xb30e5e1c, 0x6989f127, 0x6989f127, 0x6989f127, 0x5585e16e, 0x5585e16e, 0x5585e16e, 0xaa4593fe, 0x545c7a2d, 0x545c7a2d, 0xaa4593fe, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x82e0293c, 0xef26570d, 0x82e0293c, 0x572a3b40, 0xc9cbf769, 0xc9cbf769, 0x9056af5f, 0x9056af5f, 0x9056af5f, 0xa4bf8871, 0xa4bf8871, 0xa4bf8871, 0x86dbe0fa, 0x86dbe0fa, 0x86dbe0fa, 0xc9cbf769, 0x572a3b40, 0x572a3b40, 0xc9cbf769, }, 20 }, + { "gfxterm_fr", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xbc06fffc, 0x364aa5c7, 0xbc06fffc, 0x7a1ba536, 0x9813a416, 0x9813a416, 0xabce4a73, 0xabce4a73, 0xabce4a73, 0xa03b4edc, 0xa03b4edc, 0xa03b4edc, 0xb4398c45, 0xb4398c45, 0xb4398c45, 0x9813a416, 0x7a1ba536, 0x7a1ba536, 0x9813a416, }, 20 }, + { "gfxterm_fr", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xb0b4fa0c, 0xc7b12a4e, 0xb0b4fa0c, 0x353acb3c, 0x5fcf013d, 0x5fcf013d, 0xe300c643, 0xe300c643, 0xe300c643, 0x1243c35e, 0x1243c35e, 0x1243c35e, 0x55bcc0d9, 0x55bcc0d9, 0x55bcc0d9, 0x5fcf013d, 0x353acb3c, 0x353acb3c, 0x5fcf013d, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x20eb710, 0x97329eb5, 0x20eb710, 0x245ae7b, 0xdd28f52b, 0xdd28f52b, 0x7a1d74fd, 0x7a1d74fd, 0x7a1d74fd, 0x70b3339, 0x70b3339, 0x70b3339, 0x6439ed13, 0x6439ed13, 0x6439ed13, 0xdd28f52b, 0x245ae7b, 0x245ae7b, 0xdd28f52b, }, 20 }, + { "gfxterm_fr", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0x78b258dc, 0x5543ab2b, 0x78b258dc, 0x31d615b5, 0x59c36f00, 0x59c36f00, 0xc73a1033, 0xc73a1033, 0xc73a1033, 0x9b2810d1, 0x9b2810d1, 0x9b2810d1, 0xde64244f, 0xde64244f, 0xde64244f, 0x59c36f00, 0x31d615b5, 0x31d615b5, 0x59c36f00, }, 20 }, + { "gfxterm_fr", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x8cfc9a2, 0xe48bee7d, 0x8cfc9a2, 0x545c7a2d, 0xaa4593fe, 0xaa4593fe, 0xb30e5e1c, 0xb30e5e1c, 0xb30e5e1c, 0x6989f127, 0x6989f127, 0x6989f127, 0x5585e16e, 0x5585e16e, 0x5585e16e, 0xaa4593fe, 0x545c7a2d, 0x545c7a2d, 0xaa4593fe, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x82e0293c, 0xef26570d, 0x82e0293c, 0x572a3b40, 0xc9cbf769, 0xc9cbf769, 0x9056af5f, 0x9056af5f, 0x9056af5f, 0xa4bf8871, 0xa4bf8871, 0xa4bf8871, 0x86dbe0fa, 0x86dbe0fa, 0x86dbe0fa, 0xc9cbf769, 0x572a3b40, 0x572a3b40, 0xc9cbf769, }, 20 }, + { "gfxterm_fr", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x5e677bb0, 0x10a60901, 0x5e677bb0, 0x2c04f42d, 0x5387d57f, 0x5387d57f, 0x8c4b382b, 0x8c4b382b, 0x8c4b382b, 0xaf2afe21, 0xaf2afe21, 0xaf2afe21, 0x771bbec, 0x771bbec, 0x771bbec, 0x5387d57f, 0x2c04f42d, 0x2c04f42d, 0x5387d57f, }, 20 }, + { "gfxterm_fr", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x9cd2ed2a, 0xf0d4a2d6, 0x9cd2ed2a, 0x850d763c, 0xf83ee7aa, 0xf83ee7aa, 0xd8cdc484, 0xd8cdc484, 0xd8cdc484, 0x1cfa4f65, 0x1cfa4f65, 0x1cfa4f65, 0xd3e41c77, 0xd3e41c77, 0xd3e41c77, 0xf83ee7aa, 0x850d763c, 0x850d763c, 0xf83ee7aa, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x9a851848, 0xa76e7d2d, 0x9a851848, 0x7987b0ef, 0x724366e5, 0x724366e5, 0xdcd2c529, 0xdcd2c529, 0xdcd2c529, 0x3f220d4f, 0x3f220d4f, 0x3f220d4f, 0x81609837, 0x81609837, 0x81609837, 0x724366e5, 0x7987b0ef, 0x7987b0ef, 0x724366e5, }, 20 }, + { "gfxterm_fr", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x97619707, 0x6f50f077, 0x97619707, 0x2fc44597, 0x5387d57f, 0x5387d57f, 0x50f935e4, 0x50f935e4, 0x50f935e4, 0xae2c6aed, 0xae2c6aed, 0xae2c6aed, 0xa6d4f3de, 0xa6d4f3de, 0xa6d4f3de, 0x5387d57f, 0x2fc44597, 0x2fc44597, 0x5387d57f, }, 20 }, + { "gfxterm_fr", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xa1fd9dc7, 0xe73a78a6, 0xa1fd9dc7, 0x716ff77f, 0xf83ee7aa, 0xf83ee7aa, 0x78dde9c4, 0x78dde9c4, 0x78dde9c4, 0x368bb049, 0x368bb049, 0x368bb049, 0xdc57cb80, 0xdc57cb80, 0xdc57cb80, 0xf83ee7aa, 0x716ff77f, 0x716ff77f, 0xf83ee7aa, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xbb37d363, 0x5f4bb8c9, 0xbb37d363, 0xe9d91fe5, 0x724366e5, 0x724366e5, 0x9a5fce9e, 0x9a5fce9e, 0x9a5fce9e, 0x5bc6df74, 0x5bc6df74, 0x5bc6df74, 0xdf93543c, 0xdf93543c, 0xdf93543c, 0x724366e5, 0xe9d91fe5, 0xe9d91fe5, 0x724366e5, }, 20 }, + { "gfxterm_fr", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xd073c0ae, 0x88549625, 0xd073c0ae, 0x2542b920, 0x1c955882, 0x1c955882, 0xf8a21e7d, 0xf8a21e7d, 0xf8a21e7d, 0x7af4f1cd, 0x7af4f1cd, 0x7af4f1cd, 0xb51c74b1, 0xb51c74b1, 0xb51c74b1, 0x1c955882, 0x2542b920, 0x2542b920, 0x1c955882, }, 20 }, + { "gfxterm_fr", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x11271f36, 0x6ea425b6, 0x11271f36, 0x1d8e21df, 0x4d266f7a, 0x4d266f7a, 0xbc41aef9, 0xbc41aef9, 0xbc41aef9, 0xf014fdbf, 0xf014fdbf, 0xf014fdbf, 0xd2b54f41, 0xd2b54f41, 0xd2b54f41, 0x4d266f7a, 0x1d8e21df, 0x1d8e21df, 0x4d266f7a, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x58a685bc, 0x38ce9715, 0x58a685bc, 0xf3d2b5be, 0x1ed9d731, 0x1ed9d731, 0x8cc54d61, 0x8cc54d61, 0x8cc54d61, 0x38c40de9, 0x38c40de9, 0x38c40de9, 0x35e811aa, 0x35e811aa, 0x35e811aa, 0x1ed9d731, 0xf3d2b5be, 0xf3d2b5be, 0x1ed9d731, }, 20 }, + { "gfxterm_fr", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x5e677bb0, 0x10a60901, 0x5e677bb0, 0x2c04f42d, 0x5387d57f, 0x5387d57f, 0x8c4b382b, 0x8c4b382b, 0x8c4b382b, 0xaf2afe21, 0xaf2afe21, 0xaf2afe21, 0x771bbec, 0x771bbec, 0x771bbec, 0x5387d57f, 0x2c04f42d, 0x2c04f42d, 0x5387d57f, }, 20 }, + { "gfxterm_fr", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x9cd2ed2a, 0xf0d4a2d6, 0x9cd2ed2a, 0x850d763c, 0xf83ee7aa, 0xf83ee7aa, 0xd8cdc484, 0xd8cdc484, 0xd8cdc484, 0x1cfa4f65, 0x1cfa4f65, 0x1cfa4f65, 0xd3e41c77, 0xd3e41c77, 0xd3e41c77, 0xf83ee7aa, 0x850d763c, 0x850d763c, 0xf83ee7aa, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x9a851848, 0xa76e7d2d, 0x9a851848, 0x7987b0ef, 0x724366e5, 0x724366e5, 0xdcd2c529, 0xdcd2c529, 0xdcd2c529, 0x3f220d4f, 0x3f220d4f, 0x3f220d4f, 0x81609837, 0x81609837, 0x81609837, 0x724366e5, 0x7987b0ef, 0x7987b0ef, 0x724366e5, }, 20 }, + { "gfxterm_fr", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x97619707, 0x6f50f077, 0x97619707, 0x2fc44597, 0x5387d57f, 0x5387d57f, 0x50f935e4, 0x50f935e4, 0x50f935e4, 0xae2c6aed, 0xae2c6aed, 0xae2c6aed, 0xa6d4f3de, 0xa6d4f3de, 0xa6d4f3de, 0x5387d57f, 0x2fc44597, 0x2fc44597, 0x5387d57f, }, 20 }, + { "gfxterm_fr", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xa1fd9dc7, 0xe73a78a6, 0xa1fd9dc7, 0x716ff77f, 0xf83ee7aa, 0xf83ee7aa, 0x78dde9c4, 0x78dde9c4, 0x78dde9c4, 0x368bb049, 0x368bb049, 0x368bb049, 0xdc57cb80, 0xdc57cb80, 0xdc57cb80, 0xf83ee7aa, 0x716ff77f, 0x716ff77f, 0xf83ee7aa, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xbb37d363, 0x5f4bb8c9, 0xbb37d363, 0xe9d91fe5, 0x724366e5, 0x724366e5, 0x9a5fce9e, 0x9a5fce9e, 0x9a5fce9e, 0x5bc6df74, 0x5bc6df74, 0x5bc6df74, 0xdf93543c, 0xdf93543c, 0xdf93543c, 0x724366e5, 0xe9d91fe5, 0xe9d91fe5, 0x724366e5, }, 20 }, + { "gfxterm_fr", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0xd073c0ae, 0x88549625, 0xd073c0ae, 0x2542b920, 0x1c955882, 0x1c955882, 0xf8a21e7d, 0xf8a21e7d, 0xf8a21e7d, 0x7af4f1cd, 0x7af4f1cd, 0x7af4f1cd, 0xb51c74b1, 0xb51c74b1, 0xb51c74b1, 0x1c955882, 0x2542b920, 0x2542b920, 0x1c955882, }, 20 }, + { "gfxterm_fr", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x11271f36, 0x6ea425b6, 0x11271f36, 0x1d8e21df, 0x4d266f7a, 0x4d266f7a, 0xbc41aef9, 0xbc41aef9, 0xbc41aef9, 0xf014fdbf, 0xf014fdbf, 0xf014fdbf, 0xd2b54f41, 0xd2b54f41, 0xd2b54f41, 0x4d266f7a, 0x1d8e21df, 0x1d8e21df, 0x4d266f7a, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x58a685bc, 0x38ce9715, 0x58a685bc, 0xf3d2b5be, 0x1ed9d731, 0x1ed9d731, 0x8cc54d61, 0x8cc54d61, 0x8cc54d61, 0x38c40de9, 0x38c40de9, 0x38c40de9, 0x35e811aa, 0x35e811aa, 0x35e811aa, 0x1ed9d731, 0xf3d2b5be, 0xf3d2b5be, 0x1ed9d731, }, 20 }, + { "gfxterm_fr", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0xbc06fffc, 0x364aa5c7, 0xbc06fffc, 0x7a1ba536, 0x9813a416, 0x9813a416, 0xabce4a73, 0xabce4a73, 0xabce4a73, 0xa03b4edc, 0xa03b4edc, 0xa03b4edc, 0xb4398c45, 0xb4398c45, 0xb4398c45, 0x9813a416, 0x7a1ba536, 0x7a1ba536, 0x9813a416, }, 20 }, + { "gfxterm_fr", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xb0b4fa0c, 0xc7b12a4e, 0xb0b4fa0c, 0x353acb3c, 0x5fcf013d, 0x5fcf013d, 0xe300c643, 0xe300c643, 0xe300c643, 0x1243c35e, 0x1243c35e, 0x1243c35e, 0x55bcc0d9, 0x55bcc0d9, 0x55bcc0d9, 0x5fcf013d, 0x353acb3c, 0x353acb3c, 0x5fcf013d, }, 20 }, + { "gfxterm_fr", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x20eb710, 0x97329eb5, 0x20eb710, 0x245ae7b, 0xdd28f52b, 0xdd28f52b, 0x7a1d74fd, 0x7a1d74fd, 0x7a1d74fd, 0x70b3339, 0x70b3339, 0x70b3339, 0x6439ed13, 0x6439ed13, 0x6439ed13, 0xdd28f52b, 0x245ae7b, 0x245ae7b, 0xdd28f52b, }, 20 }, + { "gfxterm_quot", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xe229a7f0, 0x2a317e27, 0xe229a7f0, 0xab4dea99, 0x59c36f00, 0x59c36f00, 0xcba09304, 0xcba09304, 0xcba09304, 0x97b293e6, 0x97b293e6, 0x97b293e6, 0xd2fea778, 0xd2fea778, 0xd2fea778, 0x59c36f00, 0xab4dea99, 0xab4dea99, 0x59c36f00, }, 20 }, + { "gfxterm_quot", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x8639bc17, 0x91a6078e, 0x8639bc17, 0xdaaa0f98, 0xaa4593fe, 0xaa4593fe, 0xfda7eac8, 0xfda7eac8, 0xfda7eac8, 0x272045f3, 0x272045f3, 0x272045f3, 0x1b2c55ba, 0x1b2c55ba, 0x1b2c55ba, 0xaa4593fe, 0xdaaa0f98, 0xdaaa0f98, 0xaa4593fe, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xe6177bfd, 0xaa145d1, 0xe6177bfd, 0x33dd6981, 0xc9cbf769, 0xc9cbf769, 0x270340e6, 0x270340e6, 0x270340e6, 0x13ea67c8, 0x13ea67c8, 0x13ea67c8, 0x318e0f43, 0x318e0f43, 0x318e0f43, 0xc9cbf769, 0x33dd6981, 0x33dd6981, 0xc9cbf769, }, 20 }, + { "gfxterm_quot", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xec257a83, 0x19d65004, 0xec257a83, 0x2a382049, 0x9813a416, 0x9813a416, 0x8c097a93, 0x8c097a93, 0x8c097a93, 0x87fc7e3c, 0x87fc7e3c, 0x87fc7e3c, 0x93febca5, 0x93febca5, 0x93febca5, 0x9813a416, 0x2a382049, 0x2a382049, 0x9813a416, }, 20 }, + { "gfxterm_quot", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x3255e8e, 0xdce0e3fa, 0x3255e8e, 0x86ab6fbe, 0x5fcf013d, 0x5fcf013d, 0xcacb7f18, 0xcacb7f18, 0xcacb7f18, 0x3b887a05, 0x3b887a05, 0x3b887a05, 0x7c777982, 0x7c777982, 0x7c777982, 0x5fcf013d, 0x86ab6fbe, 0x86ab6fbe, 0x5fcf013d, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x673a2dc2, 0x88c6d4d9, 0x673a2dc2, 0x677134a9, 0xdd28f52b, 0xdd28f52b, 0x35beeea3, 0x35beeea3, 0x35beeea3, 0x48a8a967, 0x48a8a967, 0x48a8a967, 0x2b9a774d, 0x2b9a774d, 0x2b9a774d, 0xdd28f52b, 0x677134a9, 0x677134a9, 0xdd28f52b, }, 20 }, + { "gfxterm_quot", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xe229a7f0, 0x2a317e27, 0xe229a7f0, 0xab4dea99, 0x59c36f00, 0x59c36f00, 0xcba09304, 0xcba09304, 0xcba09304, 0x97b293e6, 0x97b293e6, 0x97b293e6, 0xd2fea778, 0xd2fea778, 0xd2fea778, 0x59c36f00, 0xab4dea99, 0xab4dea99, 0x59c36f00, }, 20 }, + { "gfxterm_quot", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x8639bc17, 0x91a6078e, 0x8639bc17, 0xdaaa0f98, 0xaa4593fe, 0xaa4593fe, 0xfda7eac8, 0xfda7eac8, 0xfda7eac8, 0x272045f3, 0x272045f3, 0x272045f3, 0x1b2c55ba, 0x1b2c55ba, 0x1b2c55ba, 0xaa4593fe, 0xdaaa0f98, 0xdaaa0f98, 0xaa4593fe, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xe6177bfd, 0xaa145d1, 0xe6177bfd, 0x33dd6981, 0xc9cbf769, 0xc9cbf769, 0x270340e6, 0x270340e6, 0x270340e6, 0x13ea67c8, 0x13ea67c8, 0x13ea67c8, 0x318e0f43, 0x318e0f43, 0x318e0f43, 0xc9cbf769, 0x33dd6981, 0x33dd6981, 0xc9cbf769, }, 20 }, + { "gfxterm_quot", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x29e73016, 0x795de1bc, 0x29e73016, 0x5b84bf8b, 0x5387d57f, 0x5387d57f, 0x4e647c93, 0x4e647c93, 0x4e647c93, 0x6d05ba99, 0x6d05ba99, 0x6d05ba99, 0xc55eff54, 0xc55eff54, 0xc55eff54, 0x5387d57f, 0x5b84bf8b, 0x5b84bf8b, 0x5387d57f, }, 20 }, + { "gfxterm_quot", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xa14eb75d, 0xa45fd855, 0xa14eb75d, 0xb8912c4b, 0xf83ee7aa, 0xf83ee7aa, 0xf25c3281, 0xf25c3281, 0xf25c3281, 0x366bb960, 0x366bb960, 0x366bb960, 0xf975ea72, 0xf975ea72, 0xf975ea72, 0xf83ee7aa, 0xb8912c4b, 0xb8912c4b, 0xf83ee7aa, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0xa97a7639, 0xb31826b0, 0xa97a7639, 0x4a78de9e, 0x724366e5, 0x724366e5, 0x10d1a394, 0x10d1a394, 0x10d1a394, 0xf3216bf2, 0xf3216bf2, 0xf3216bf2, 0x4d63fe8a, 0x4d63fe8a, 0x4d63fe8a, 0x724366e5, 0x4a78de9e, 0x4a78de9e, 0x724366e5, }, 20 }, + { "gfxterm_quot", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0xd37ff64e, 0x4bc20364, 0xd37ff64e, 0x6bda24de, 0x5387d57f, 0x5387d57f, 0x4bd38a03, 0x4bd38a03, 0x4bd38a03, 0xb506d50a, 0xb506d50a, 0xb506d50a, 0xbdfe4c39, 0xbdfe4c39, 0xbdfe4c39, 0x5387d57f, 0x6bda24de, 0x6bda24de, 0x5387d57f, }, 20 }, + { "gfxterm_quot", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x83a05a57, 0xbb856709, 0x83a05a57, 0x533230ef, 0xf83ee7aa, 0xf83ee7aa, 0x63d64c93, 0x63d64c93, 0x63d64c93, 0x2d80151e, 0x2d80151e, 0x2d80151e, 0xc75c6ed7, 0xc75c6ed7, 0xc75c6ed7, 0xf83ee7aa, 0x533230ef, 0x533230ef, 0xf83ee7aa, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x6bb86239, 0xfa8581a4, 0x6bb86239, 0x3956aebf, 0x724366e5, 0x724366e5, 0xe0762c40, 0xe0762c40, 0xe0762c40, 0x21ef3daa, 0x21ef3daa, 0x21ef3daa, 0xa5bab6e2, 0xa5bab6e2, 0xa5bab6e2, 0x724366e5, 0x3956aebf, 0x3956aebf, 0x724366e5, }, 20 }, + { "gfxterm_quot", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0x8c1945b9, 0xd6bd3ceb, 0x8c1945b9, 0x79283c37, 0x1c955882, 0x1c955882, 0x97519c3a, 0x97519c3a, 0x97519c3a, 0x1507738a, 0x1507738a, 0x1507738a, 0xdaeff6f6, 0xdaeff6f6, 0xdaeff6f6, 0x1c955882, 0x79283c37, 0x79283c37, 0x1c955882, }, 20 }, + { "gfxterm_quot", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x1a7618f6, 0xf685e337, 0x1a7618f6, 0x16df261f, 0x4d266f7a, 0x4d266f7a, 0x2d145f78, 0x2d145f78, 0x2d145f78, 0x61410c3e, 0x61410c3e, 0x61410c3e, 0x43e0bec0, 0x43e0bec0, 0x43e0bec0, 0x4d266f7a, 0x16df261f, 0x16df261f, 0x4d266f7a, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x86d73465, 0x85c814e6, 0x86d73465, 0x2da30467, 0x1ed9d731, 0x1ed9d731, 0xa1c3fdf0, 0xa1c3fdf0, 0xa1c3fdf0, 0x15c2bd78, 0x15c2bd78, 0x15c2bd78, 0x18eea13b, 0x18eea13b, 0x18eea13b, 0x1ed9d731, 0x2da30467, 0x2da30467, 0x1ed9d731, }, 20 }, + { "gfxterm_quot", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x29e73016, 0x795de1bc, 0x29e73016, 0x5b84bf8b, 0x5387d57f, 0x5387d57f, 0x4e647c93, 0x4e647c93, 0x4e647c93, 0x6d05ba99, 0x6d05ba99, 0x6d05ba99, 0xc55eff54, 0xc55eff54, 0xc55eff54, 0x5387d57f, 0x5b84bf8b, 0x5b84bf8b, 0x5387d57f, }, 20 }, + { "gfxterm_quot", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xa14eb75d, 0xa45fd855, 0xa14eb75d, 0xb8912c4b, 0xf83ee7aa, 0xf83ee7aa, 0xf25c3281, 0xf25c3281, 0xf25c3281, 0x366bb960, 0x366bb960, 0x366bb960, 0xf975ea72, 0xf975ea72, 0xf975ea72, 0xf83ee7aa, 0xb8912c4b, 0xb8912c4b, 0xf83ee7aa, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0xa97a7639, 0xb31826b0, 0xa97a7639, 0x4a78de9e, 0x724366e5, 0x724366e5, 0x10d1a394, 0x10d1a394, 0x10d1a394, 0xf3216bf2, 0xf3216bf2, 0xf3216bf2, 0x4d63fe8a, 0x4d63fe8a, 0x4d63fe8a, 0x724366e5, 0x4a78de9e, 0x4a78de9e, 0x724366e5, }, 20 }, + { "gfxterm_quot", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0xd37ff64e, 0x4bc20364, 0xd37ff64e, 0x6bda24de, 0x5387d57f, 0x5387d57f, 0x4bd38a03, 0x4bd38a03, 0x4bd38a03, 0xb506d50a, 0xb506d50a, 0xb506d50a, 0xbdfe4c39, 0xbdfe4c39, 0xbdfe4c39, 0x5387d57f, 0x6bda24de, 0x6bda24de, 0x5387d57f, }, 20 }, + { "gfxterm_quot", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x83a05a57, 0xbb856709, 0x83a05a57, 0x533230ef, 0xf83ee7aa, 0xf83ee7aa, 0x63d64c93, 0x63d64c93, 0x63d64c93, 0x2d80151e, 0x2d80151e, 0x2d80151e, 0xc75c6ed7, 0xc75c6ed7, 0xc75c6ed7, 0xf83ee7aa, 0x533230ef, 0x533230ef, 0xf83ee7aa, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0x6bb86239, 0xfa8581a4, 0x6bb86239, 0x3956aebf, 0x724366e5, 0x724366e5, 0xe0762c40, 0xe0762c40, 0xe0762c40, 0x21ef3daa, 0x21ef3daa, 0x21ef3daa, 0xa5bab6e2, 0xa5bab6e2, 0xa5bab6e2, 0x724366e5, 0x3956aebf, 0x3956aebf, 0x724366e5, }, 20 }, + { "gfxterm_quot", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x8c1945b9, 0xd6bd3ceb, 0x8c1945b9, 0x79283c37, 0x1c955882, 0x1c955882, 0x97519c3a, 0x97519c3a, 0x97519c3a, 0x1507738a, 0x1507738a, 0x1507738a, 0xdaeff6f6, 0xdaeff6f6, 0xdaeff6f6, 0x1c955882, 0x79283c37, 0x79283c37, 0x1c955882, }, 20 }, + { "gfxterm_quot", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x1a7618f6, 0xf685e337, 0x1a7618f6, 0x16df261f, 0x4d266f7a, 0x4d266f7a, 0x2d145f78, 0x2d145f78, 0x2d145f78, 0x61410c3e, 0x61410c3e, 0x61410c3e, 0x43e0bec0, 0x43e0bec0, 0x43e0bec0, 0x4d266f7a, 0x16df261f, 0x16df261f, 0x4d266f7a, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x86d73465, 0x85c814e6, 0x86d73465, 0x2da30467, 0x1ed9d731, 0x1ed9d731, 0xa1c3fdf0, 0xa1c3fdf0, 0xa1c3fdf0, 0x15c2bd78, 0x15c2bd78, 0x15c2bd78, 0x18eea13b, 0x18eea13b, 0x18eea13b, 0x1ed9d731, 0x2da30467, 0x2da30467, 0x1ed9d731, }, 20 }, + { "gfxterm_quot", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0xec257a83, 0x19d65004, 0xec257a83, 0x2a382049, 0x9813a416, 0x9813a416, 0x8c097a93, 0x8c097a93, 0x8c097a93, 0x87fc7e3c, 0x87fc7e3c, 0x87fc7e3c, 0x93febca5, 0x93febca5, 0x93febca5, 0x9813a416, 0x2a382049, 0x2a382049, 0x9813a416, }, 20 }, + { "gfxterm_quot", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x3255e8e, 0xdce0e3fa, 0x3255e8e, 0x86ab6fbe, 0x5fcf013d, 0x5fcf013d, 0xcacb7f18, 0xcacb7f18, 0xcacb7f18, 0x3b887a05, 0x3b887a05, 0x3b887a05, 0x7c777982, 0x7c777982, 0x7c777982, 0x5fcf013d, 0x86ab6fbe, 0x86ab6fbe, 0x5fcf013d, }, 20 }, + { "gfxterm_quot", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x673a2dc2, 0x88c6d4d9, 0x673a2dc2, 0x677134a9, 0xdd28f52b, 0xdd28f52b, 0x35beeea3, 0x35beeea3, 0x35beeea3, 0x48a8a967, 0x48a8a967, 0x48a8a967, 0x2b9a774d, 0x2b9a774d, 0x2b9a774d, 0xdd28f52b, 0x677134a9, 0x677134a9, 0xdd28f52b, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xae107385, 0xbf8fb82e, 0xae107385, 0xe7743eec, 0x59c36f00, 0x59c36f00, 0xebc12bda, 0xebc12bda, 0xebc12bda, 0xb7d32b38, 0xb7d32b38, 0xb7d32b38, 0xf29f1fa6, 0xf29f1fa6, 0xf29f1fa6, 0x59c36f00, 0xe7743eec, 0xe7743eec, 0x59c36f00, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xfbcace84, 0x6f1a084e, 0xfbcace84, 0xa7597d0b, 0xaa4593fe, 0xaa4593fe, 0x3ae147d7, 0x3ae147d7, 0x3ae147d7, 0xe066e8ec, 0xe066e8ec, 0xe066e8ec, 0xdc6af8a5, 0xdc6af8a5, 0xdc6af8a5, 0xaa4593fe, 0xa7597d0b, 0xa7597d0b, 0xaa4593fe, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xffa6bec, 0x6dcf8053, 0xffa6bec, 0xda307990, 0xc9cbf769, 0xc9cbf769, 0x5a4cfacb, 0x5a4cfacb, 0x5a4cfacb, 0x6ea5dde5, 0x6ea5dde5, 0x6ea5dde5, 0x4cc1b56e, 0x4cc1b56e, 0x4cc1b56e, 0xc9cbf769, 0xda307990, 0xda307990, 0xc9cbf769, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xfa42c2ea, 0xea757246, 0xfa42c2ea, 0x3c5f9820, 0x9813a416, 0x9813a416, 0x290af708, 0x290af708, 0x290af708, 0x22fff3a7, 0x22fff3a7, 0x22fff3a7, 0x36fd313e, 0x36fd313e, 0x36fd313e, 0x9813a416, 0x3c5f9820, 0x3c5f9820, 0x9813a416, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x2ca306b9, 0x97e67cf5, 0x2ca306b9, 0xa92d3789, 0x5fcf013d, 0x5fcf013d, 0x5b42cac9, 0x5b42cac9, 0x5b42cac9, 0xaa01cfd4, 0xaa01cfd4, 0xaa01cfd4, 0xedfecc53, 0xedfecc53, 0xedfecc53, 0x5fcf013d, 0xa92d3789, 0xa92d3789, 0x5fcf013d, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x3a839aae, 0x89837837, 0x3a839aae, 0x3ac883c5, 0xdd28f52b, 0xdd28f52b, 0x8de395a5, 0x8de395a5, 0x8de395a5, 0xf0f5d261, 0xf0f5d261, 0xf0f5d261, 0x93c70c4b, 0x93c70c4b, 0x93c70c4b, 0xdd28f52b, 0x3ac883c5, 0x3ac883c5, 0xdd28f52b, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xae107385, 0xbf8fb82e, 0xae107385, 0xe7743eec, 0x59c36f00, 0x59c36f00, 0xebc12bda, 0xebc12bda, 0xebc12bda, 0xb7d32b38, 0xb7d32b38, 0xb7d32b38, 0xf29f1fa6, 0xf29f1fa6, 0xf29f1fa6, 0x59c36f00, 0xe7743eec, 0xe7743eec, 0x59c36f00, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0xfbcace84, 0x6f1a084e, 0xfbcace84, 0xa7597d0b, 0xaa4593fe, 0xaa4593fe, 0x3ae147d7, 0x3ae147d7, 0x3ae147d7, 0xe066e8ec, 0xe066e8ec, 0xe066e8ec, 0xdc6af8a5, 0xdc6af8a5, 0xdc6af8a5, 0xaa4593fe, 0xa7597d0b, 0xa7597d0b, 0xaa4593fe, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xffa6bec, 0x6dcf8053, 0xffa6bec, 0xda307990, 0xc9cbf769, 0xc9cbf769, 0x5a4cfacb, 0x5a4cfacb, 0x5a4cfacb, 0x6ea5dde5, 0x6ea5dde5, 0x6ea5dde5, 0x4cc1b56e, 0x4cc1b56e, 0x4cc1b56e, 0xc9cbf769, 0xda307990, 0xda307990, 0xc9cbf769, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x46bfc6c9, 0x8e4ed344, 0x46bfc6c9, 0x34dc4954, 0x5387d57f, 0x5387d57f, 0xc95c2bb9, 0xc95c2bb9, 0xc95c2bb9, 0xea3dedb3, 0xea3dedb3, 0xea3dedb3, 0x4266a87e, 0x4266a87e, 0x4266a87e, 0x5387d57f, 0x34dc4954, 0x34dc4954, 0x5387d57f, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xf8fa8dd6, 0x46e7e0cb, 0xf8fa8dd6, 0xe12516c0, 0xf83ee7aa, 0xf83ee7aa, 0xff88f7e1, 0xff88f7e1, 0xff88f7e1, 0x3bbf7c00, 0x3bbf7c00, 0x3bbf7c00, 0xf4a12f12, 0xf4a12f12, 0xf4a12f12, 0xf83ee7aa, 0xe12516c0, 0xe12516c0, 0xf83ee7aa, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x64084d93, 0x156d5456, 0x64084d93, 0x870ae534, 0x724366e5, 0x724366e5, 0x4c4f3106, 0x4c4f3106, 0x4c4f3106, 0xafbff960, 0xafbff960, 0xafbff960, 0x11fd6c18, 0x11fd6c18, 0x11fd6c18, 0x724366e5, 0x870ae534, 0x870ae534, 0x724366e5, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0xc2887c69, 0xe0257645, 0xc2887c69, 0x7a2daef9, 0x5387d57f, 0x5387d57f, 0xf127fce0, 0xf127fce0, 0xf127fce0, 0xff2a3e9, 0xff2a3e9, 0xff2a3e9, 0x70a3ada, 0x70a3ada, 0x70a3ada, 0x5387d57f, 0x7a2daef9, 0x7a2daef9, 0x5387d57f, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x8486eeef, 0x5e732c64, 0x8486eeef, 0x54148457, 0xf83ee7aa, 0xf83ee7aa, 0x143cae9e, 0x143cae9e, 0x143cae9e, 0x5a6af713, 0x5a6af713, 0x5a6af713, 0xb0b68cda, 0xb0b68cda, 0xb0b68cda, 0xf83ee7aa, 0x54148457, 0x54148457, 0xf83ee7aa, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xaad4c3b8, 0x90ce661c, 0xaad4c3b8, 0xf83a0f3e, 0x724366e5, 0x724366e5, 0xa7ac6799, 0xa7ac6799, 0xa7ac6799, 0x66357673, 0x66357673, 0x66357673, 0xe260fd3b, 0xe260fd3b, 0xe260fd3b, 0x724366e5, 0xf83a0f3e, 0xf83a0f3e, 0x724366e5, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0x60563832, 0xa0d8e41f, 0x60563832, 0x956741bc, 0x1c955882, 0x1c955882, 0x9abc058d, 0x9abc058d, 0x9abc058d, 0x18eaea3d, 0x18eaea3d, 0x18eaea3d, 0xd7026f41, 0xd7026f41, 0xd7026f41, 0x1c955882, 0x956741bc, 0x956741bc, 0x1c955882, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x9f11c3db, 0x5e6faffc, 0x9f11c3db, 0x93b8fd32, 0x4d266f7a, 0x4d266f7a, 0xdddadbb1, 0xdddadbb1, 0xdddadbb1, 0x918f88f7, 0x918f88f7, 0x918f88f7, 0xb32e3a09, 0xb32e3a09, 0xb32e3a09, 0x4d266f7a, 0x93b8fd32, 0x93b8fd32, 0x4d266f7a, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xd58db96, 0x29ecb6a6, 0xd58db96, 0xa62ceb94, 0x1ed9d731, 0x1ed9d731, 0x65cad63c, 0x65cad63c, 0x65cad63c, 0xd1cb96b4, 0xd1cb96b4, 0xd1cb96b4, 0xdce78af7, 0xdce78af7, 0xdce78af7, 0x1ed9d731, 0xa62ceb94, 0xa62ceb94, 0x1ed9d731, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x46bfc6c9, 0x8e4ed344, 0x46bfc6c9, 0x34dc4954, 0x5387d57f, 0x5387d57f, 0xc95c2bb9, 0xc95c2bb9, 0xc95c2bb9, 0xea3dedb3, 0xea3dedb3, 0xea3dedb3, 0x4266a87e, 0x4266a87e, 0x4266a87e, 0x5387d57f, 0x34dc4954, 0x34dc4954, 0x5387d57f, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xf8fa8dd6, 0x46e7e0cb, 0xf8fa8dd6, 0xe12516c0, 0xf83ee7aa, 0xf83ee7aa, 0xff88f7e1, 0xff88f7e1, 0xff88f7e1, 0x3bbf7c00, 0x3bbf7c00, 0x3bbf7c00, 0xf4a12f12, 0xf4a12f12, 0xf4a12f12, 0xf83ee7aa, 0xe12516c0, 0xe12516c0, 0xf83ee7aa, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x64084d93, 0x156d5456, 0x64084d93, 0x870ae534, 0x724366e5, 0x724366e5, 0x4c4f3106, 0x4c4f3106, 0x4c4f3106, 0xafbff960, 0xafbff960, 0xafbff960, 0x11fd6c18, 0x11fd6c18, 0x11fd6c18, 0x724366e5, 0x870ae534, 0x870ae534, 0x724366e5, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0xc2887c69, 0xe0257645, 0xc2887c69, 0x7a2daef9, 0x5387d57f, 0x5387d57f, 0xf127fce0, 0xf127fce0, 0xf127fce0, 0xff2a3e9, 0xff2a3e9, 0xff2a3e9, 0x70a3ada, 0x70a3ada, 0x70a3ada, 0x5387d57f, 0x7a2daef9, 0x7a2daef9, 0x5387d57f, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x8486eeef, 0x5e732c64, 0x8486eeef, 0x54148457, 0xf83ee7aa, 0xf83ee7aa, 0x143cae9e, 0x143cae9e, 0x143cae9e, 0x5a6af713, 0x5a6af713, 0x5a6af713, 0xb0b68cda, 0xb0b68cda, 0xb0b68cda, 0xf83ee7aa, 0x54148457, 0x54148457, 0xf83ee7aa, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xaad4c3b8, 0x90ce661c, 0xaad4c3b8, 0xf83a0f3e, 0x724366e5, 0x724366e5, 0xa7ac6799, 0xa7ac6799, 0xa7ac6799, 0x66357673, 0x66357673, 0x66357673, 0xe260fd3b, 0xe260fd3b, 0xe260fd3b, 0x724366e5, 0xf83a0f3e, 0xf83a0f3e, 0x724366e5, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x60563832, 0xa0d8e41f, 0x60563832, 0x956741bc, 0x1c955882, 0x1c955882, 0x9abc058d, 0x9abc058d, 0x9abc058d, 0x18eaea3d, 0x18eaea3d, 0x18eaea3d, 0xd7026f41, 0xd7026f41, 0xd7026f41, 0x1c955882, 0x956741bc, 0x956741bc, 0x1c955882, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x9f11c3db, 0x5e6faffc, 0x9f11c3db, 0x93b8fd32, 0x4d266f7a, 0x4d266f7a, 0xdddadbb1, 0xdddadbb1, 0xdddadbb1, 0x918f88f7, 0x918f88f7, 0x918f88f7, 0xb32e3a09, 0xb32e3a09, 0xb32e3a09, 0x4d266f7a, 0x93b8fd32, 0x93b8fd32, 0x4d266f7a, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xd58db96, 0x29ecb6a6, 0xd58db96, 0xa62ceb94, 0x1ed9d731, 0x1ed9d731, 0x65cad63c, 0x65cad63c, 0x65cad63c, 0xd1cb96b4, 0xd1cb96b4, 0xd1cb96b4, 0xdce78af7, 0xdce78af7, 0xdce78af7, 0x1ed9d731, 0xa62ceb94, 0xa62ceb94, 0x1ed9d731, }, 20 }, + { "gfxterm_piglatin", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0xfa42c2ea, 0xea757246, 0xfa42c2ea, 0x3c5f9820, 0x9813a416, 0x9813a416, 0x290af708, 0x290af708, 0x290af708, 0x22fff3a7, 0x22fff3a7, 0x22fff3a7, 0x36fd313e, 0x36fd313e, 0x36fd313e, 0x9813a416, 0x3c5f9820, 0x3c5f9820, 0x9813a416, }, 20 }, + { "gfxterm_piglatin", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x2ca306b9, 0x97e67cf5, 0x2ca306b9, 0xa92d3789, 0x5fcf013d, 0x5fcf013d, 0x5b42cac9, 0x5b42cac9, 0x5b42cac9, 0xaa01cfd4, 0xaa01cfd4, 0xaa01cfd4, 0xedfecc53, 0xedfecc53, 0xedfecc53, 0x5fcf013d, 0xa92d3789, 0xa92d3789, 0x5fcf013d, }, 20 }, + { "gfxterm_piglatin", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x3a839aae, 0x89837837, 0x3a839aae, 0x3ac883c5, 0xdd28f52b, 0xdd28f52b, 0x8de395a5, 0x8de395a5, 0x8de395a5, 0xf0f5d261, 0xf0f5d261, 0xf0f5d261, 0x93c70c4b, 0x93c70c4b, 0x93c70c4b, 0xdd28f52b, 0x3ac883c5, 0x3ac883c5, 0xdd28f52b, }, 20 }, + { "gfxterm_ch", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xbad0b774, 0x11b3aba3, 0xbad0b774, 0xf3b4fa1d, 0x59c36f00, 0x59c36f00, 0x8fd469d6, 0x8fd469d6, 0x8fd469d6, 0xd3c66934, 0xd3c66934, 0xd3c66934, 0x968a5daa, 0x968a5daa, 0x968a5daa, 0x59c36f00, 0xf3b4fa1d, 0xf3b4fa1d, 0x59c36f00, }, 20 }, + { "gfxterm_ch", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x65ca84be, 0xf8d1eb4f, 0x65ca84be, 0x39593731, 0xaa4593fe, 0xaa4593fe, 0xdb2e71a5, 0xdb2e71a5, 0xdb2e71a5, 0x1a9de9e, 0x1a9de9e, 0x1a9de9e, 0x3da5ced7, 0x3da5ced7, 0x3da5ced7, 0xaa4593fe, 0x39593731, 0x39593731, 0xaa4593fe, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xdea05d4f, 0xb662c223, 0xdea05d4f, 0xb6a4f33, 0xc9cbf769, 0xc9cbf769, 0xadcc90df, 0xadcc90df, 0xadcc90df, 0x9925b7f1, 0x9925b7f1, 0x9925b7f1, 0xbb41df7a, 0xbb41df7a, 0xbb41df7a, 0xc9cbf769, 0xb6a4f33, 0xb6a4f33, 0xc9cbf769, }, 20 }, + { "gfxterm_ch", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x97582aea, 0x106653a, 0x97582aea, 0x51457020, 0x9813a416, 0x9813a416, 0x6fbc18ae, 0x6fbc18ae, 0x6fbc18ae, 0x64491c01, 0x64491c01, 0x64491c01, 0x704bde98, 0x704bde98, 0x704bde98, 0x9813a416, 0x51457020, 0x51457020, 0x9813a416, }, 20 }, + { "gfxterm_ch", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x964f65ea, 0x34ae6fb6, 0x964f65ea, 0x13c154da, 0x5fcf013d, 0x5fcf013d, 0xa4ebbaa6, 0xa4ebbaa6, 0xa4ebbaa6, 0x55a8bfbb, 0x55a8bfbb, 0x55a8bfbb, 0x1257bc3c, 0x1257bc3c, 0x1257bc3c, 0x5fcf013d, 0x13c154da, 0x13c154da, 0x5fcf013d, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x75e6834a, 0x28165e16, 0x75e6834a, 0x75ad9a21, 0xdd28f52b, 0xdd28f52b, 0x6ae4a429, 0x6ae4a429, 0x6ae4a429, 0x17f2e3ed, 0x17f2e3ed, 0x17f2e3ed, 0x74c03dc7, 0x74c03dc7, 0x74c03dc7, 0xdd28f52b, 0x75ad9a21, 0x75ad9a21, 0xdd28f52b, }, 20 }, + { "gfxterm_ch", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xbad0b774, 0x11b3aba3, 0xbad0b774, 0xf3b4fa1d, 0x59c36f00, 0x59c36f00, 0x8fd469d6, 0x8fd469d6, 0x8fd469d6, 0xd3c66934, 0xd3c66934, 0xd3c66934, 0x968a5daa, 0x968a5daa, 0x968a5daa, 0x59c36f00, 0xf3b4fa1d, 0xf3b4fa1d, 0x59c36f00, }, 20 }, + { "gfxterm_ch", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x65ca84be, 0xf8d1eb4f, 0x65ca84be, 0x39593731, 0xaa4593fe, 0xaa4593fe, 0xdb2e71a5, 0xdb2e71a5, 0xdb2e71a5, 0x1a9de9e, 0x1a9de9e, 0x1a9de9e, 0x3da5ced7, 0x3da5ced7, 0x3da5ced7, 0xaa4593fe, 0x39593731, 0x39593731, 0xaa4593fe, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xdea05d4f, 0xb662c223, 0xdea05d4f, 0xb6a4f33, 0xc9cbf769, 0xc9cbf769, 0xadcc90df, 0xadcc90df, 0xadcc90df, 0x9925b7f1, 0x9925b7f1, 0x9925b7f1, 0xbb41df7a, 0xbb41df7a, 0xbb41df7a, 0xc9cbf769, 0xb6a4f33, 0xb6a4f33, 0xc9cbf769, }, 20 }, + { "gfxterm_ch", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xb382d720, 0xb8de6436, 0xb382d720, 0xc1e158bd, 0x5387d57f, 0x5387d57f, 0x929048c4, 0x929048c4, 0x929048c4, 0xb1f18ece, 0xb1f18ece, 0xb1f18ece, 0x19aacb03, 0x19aacb03, 0x19aacb03, 0x5387d57f, 0xc1e158bd, 0xc1e158bd, 0x5387d57f, }, 20 }, + { "gfxterm_ch", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x3f3d9790, 0xa35395ab, 0x3f3d9790, 0x26e20c86, 0xf83ee7aa, 0xf83ee7aa, 0xf9737ced, 0xf9737ced, 0xf9737ced, 0x3d44f70c, 0x3d44f70c, 0x3d44f70c, 0xf25aa41e, 0xf25aa41e, 0xf25aa41e, 0xf83ee7aa, 0x26e20c86, 0x26e20c86, 0xf83ee7aa, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x758a32e3, 0xdee0d5cb, 0x758a32e3, 0x96889a44, 0x724366e5, 0x724366e5, 0xb047ef22, 0xb047ef22, 0xb047ef22, 0x53b72744, 0x53b72744, 0x53b72744, 0xedf5b23c, 0xedf5b23c, 0xedf5b23c, 0x724366e5, 0x96889a44, 0x96889a44, 0x724366e5, }, 20 }, + { "gfxterm_ch", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x1dc9c0fa, 0x33ac9864, 0x1dc9c0fa, 0xa56c126a, 0x5387d57f, 0x5387d57f, 0xba18c4c3, 0xba18c4c3, 0xba18c4c3, 0x44cd9bca, 0x44cd9bca, 0x44cd9bca, 0x4c3502f9, 0x4c3502f9, 0x4c3502f9, 0x5387d57f, 0xa56c126a, 0xa56c126a, 0x5387d57f, }, 20 }, + { "gfxterm_ch", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xd974fae3, 0x3ccb6dc6, 0xd974fae3, 0x9e6905b, 0xf83ee7aa, 0xf83ee7aa, 0xc06251ed, 0xc06251ed, 0xc06251ed, 0x8e340860, 0x8e340860, 0x8e340860, 0x64e873a9, 0x64e873a9, 0x64e873a9, 0xf83ee7aa, 0x9e6905b, 0x9e6905b, 0xf83ee7aa, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xe1a82093, 0xb564e19c, 0xe1a82093, 0xb346ec15, 0x724366e5, 0x724366e5, 0x97406bcb, 0x97406bcb, 0x97406bcb, 0x56d97a21, 0x56d97a21, 0x56d97a21, 0xd28cf169, 0xd28cf169, 0xd28cf169, 0x724366e5, 0xb346ec15, 0xb346ec15, 0x724366e5, }, 20 }, + { "gfxterm_ch", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xd60d9c2e, 0x8d9d3fca, 0xd60d9c2e, 0x233ce5a0, 0x1c955882, 0x1c955882, 0xf3109705, 0xf3109705, 0xf3109705, 0x714678b5, 0x714678b5, 0x714678b5, 0xbeaefdc9, 0xbeaefdc9, 0xbeaefdc9, 0x1c955882, 0x233ce5a0, 0x233ce5a0, 0x1c955882, }, 20 }, + { "gfxterm_ch", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x8ae42c6c, 0xbf04c68c, 0x8ae42c6c, 0x864d1285, 0x4d266f7a, 0x4d266f7a, 0xdf5e9f05, 0xdf5e9f05, 0xdf5e9f05, 0x930bcc43, 0x930bcc43, 0x930bcc43, 0xb1aa7ebd, 0xb1aa7ebd, 0xb1aa7ebd, 0x4d266f7a, 0x864d1285, 0x864d1285, 0x4d266f7a, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xbb7bd38a, 0x76b75720, 0xbb7bd38a, 0x100fe388, 0x1ed9d731, 0x1ed9d731, 0x9dccb1ba, 0x9dccb1ba, 0x9dccb1ba, 0x29cdf132, 0x29cdf132, 0x29cdf132, 0x24e1ed71, 0x24e1ed71, 0x24e1ed71, 0x1ed9d731, 0x100fe388, 0x100fe388, 0x1ed9d731, }, 20 }, + { "gfxterm_ch", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0xb382d720, 0xb8de6436, 0xb382d720, 0xc1e158bd, 0x5387d57f, 0x5387d57f, 0x929048c4, 0x929048c4, 0x929048c4, 0xb1f18ece, 0xb1f18ece, 0xb1f18ece, 0x19aacb03, 0x19aacb03, 0x19aacb03, 0x5387d57f, 0xc1e158bd, 0xc1e158bd, 0x5387d57f, }, 20 }, + { "gfxterm_ch", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x3f3d9790, 0xa35395ab, 0x3f3d9790, 0x26e20c86, 0xf83ee7aa, 0xf83ee7aa, 0xf9737ced, 0xf9737ced, 0xf9737ced, 0x3d44f70c, 0x3d44f70c, 0x3d44f70c, 0xf25aa41e, 0xf25aa41e, 0xf25aa41e, 0xf83ee7aa, 0x26e20c86, 0x26e20c86, 0xf83ee7aa, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x758a32e3, 0xdee0d5cb, 0x758a32e3, 0x96889a44, 0x724366e5, 0x724366e5, 0xb047ef22, 0xb047ef22, 0xb047ef22, 0x53b72744, 0x53b72744, 0x53b72744, 0xedf5b23c, 0xedf5b23c, 0xedf5b23c, 0x724366e5, 0x96889a44, 0x96889a44, 0x724366e5, }, 20 }, + { "gfxterm_ch", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x1dc9c0fa, 0x33ac9864, 0x1dc9c0fa, 0xa56c126a, 0x5387d57f, 0x5387d57f, 0xba18c4c3, 0xba18c4c3, 0xba18c4c3, 0x44cd9bca, 0x44cd9bca, 0x44cd9bca, 0x4c3502f9, 0x4c3502f9, 0x4c3502f9, 0x5387d57f, 0xa56c126a, 0xa56c126a, 0x5387d57f, }, 20 }, + { "gfxterm_ch", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xd974fae3, 0x3ccb6dc6, 0xd974fae3, 0x9e6905b, 0xf83ee7aa, 0xf83ee7aa, 0xc06251ed, 0xc06251ed, 0xc06251ed, 0x8e340860, 0x8e340860, 0x8e340860, 0x64e873a9, 0x64e873a9, 0x64e873a9, 0xf83ee7aa, 0x9e6905b, 0x9e6905b, 0xf83ee7aa, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xe1a82093, 0xb564e19c, 0xe1a82093, 0xb346ec15, 0x724366e5, 0x724366e5, 0x97406bcb, 0x97406bcb, 0x97406bcb, 0x56d97a21, 0x56d97a21, 0x56d97a21, 0xd28cf169, 0xd28cf169, 0xd28cf169, 0x724366e5, 0xb346ec15, 0xb346ec15, 0x724366e5, }, 20 }, + { "gfxterm_ch", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0xd60d9c2e, 0x8d9d3fca, 0xd60d9c2e, 0x233ce5a0, 0x1c955882, 0x1c955882, 0xf3109705, 0xf3109705, 0xf3109705, 0x714678b5, 0x714678b5, 0x714678b5, 0xbeaefdc9, 0xbeaefdc9, 0xbeaefdc9, 0x1c955882, 0x233ce5a0, 0x233ce5a0, 0x1c955882, }, 20 }, + { "gfxterm_ch", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x8ae42c6c, 0xbf04c68c, 0x8ae42c6c, 0x864d1285, 0x4d266f7a, 0x4d266f7a, 0xdf5e9f05, 0xdf5e9f05, 0xdf5e9f05, 0x930bcc43, 0x930bcc43, 0x930bcc43, 0xb1aa7ebd, 0xb1aa7ebd, 0xb1aa7ebd, 0x4d266f7a, 0x864d1285, 0x864d1285, 0x4d266f7a, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xbb7bd38a, 0x76b75720, 0xbb7bd38a, 0x100fe388, 0x1ed9d731, 0x1ed9d731, 0x9dccb1ba, 0x9dccb1ba, 0x9dccb1ba, 0x29cdf132, 0x29cdf132, 0x29cdf132, 0x24e1ed71, 0x24e1ed71, 0x24e1ed71, 0x1ed9d731, 0x100fe388, 0x100fe388, 0x1ed9d731, }, 20 }, + { "gfxterm_ch", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x97582aea, 0x106653a, 0x97582aea, 0x51457020, 0x9813a416, 0x9813a416, 0x6fbc18ae, 0x6fbc18ae, 0x6fbc18ae, 0x64491c01, 0x64491c01, 0x64491c01, 0x704bde98, 0x704bde98, 0x704bde98, 0x9813a416, 0x51457020, 0x51457020, 0x9813a416, }, 20 }, + { "gfxterm_ch", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x964f65ea, 0x34ae6fb6, 0x964f65ea, 0x13c154da, 0x5fcf013d, 0x5fcf013d, 0xa4ebbaa6, 0xa4ebbaa6, 0xa4ebbaa6, 0x55a8bfbb, 0x55a8bfbb, 0x55a8bfbb, 0x1257bc3c, 0x1257bc3c, 0x1257bc3c, 0x5fcf013d, 0x13c154da, 0x13c154da, 0x5fcf013d, }, 20 }, + { "gfxterm_ch", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x75e6834a, 0x28165e16, 0x75e6834a, 0x75ad9a21, 0xdd28f52b, 0xdd28f52b, 0x6ae4a429, 0x6ae4a429, 0x6ae4a429, 0x17f2e3ed, 0x17f2e3ed, 0x17f2e3ed, 0x74c03dc7, 0x74c03dc7, 0x74c03dc7, 0xdd28f52b, 0x75ad9a21, 0x75ad9a21, 0xdd28f52b, }, 20 }, { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, }, 5 }, { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, }, 5 }, { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, }, 5 }, + { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x2b154617, 0x692e98df, 0xaf62fb87, 0xed59254f, 0x26164bc6, }, 5 }, + { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x3b0fbc56, 0xd9d57c0e, 0xfb564a17, 0x198c8a4f, 0xbe502625, }, 5 }, + { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0x6e6c9b36, 0x4ae9f137, 0x27664f34, 0x3e32535, 0xfc793332, }, 5 }, { "videotest", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, }, 5 }, { "videotest", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0x327d1082, 0x327d1082, 0x327d1082, 0x327d1082, 0x327d1082, }, 5 }, { "videotest", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xadd0f186, 0xadd0f186, 0xadd0f186, 0xadd0f186, 0xadd0f186, }, 5 }, @@ -73,9 +346,6 @@ { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x61db45b7, 0x1d867efe, 0x99613325, 0xe53c086c, 0x9543de62, }, 5 }, { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0xa46eb37f, 0xd2a59656, 0x49f8f92d, 0x3f33dc04, 0x7aae512a, }, 5 }, { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0xb864a496, 0x6c22313b, 0x1505f93d, 0xc1436c90, 0xe74a6931, }, 5 }, - { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x2b154617, 0x692e98df, 0xaf62fb87, 0xed59254f, 0x26164bc6, }, 5 }, - { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x3b0fbc56, 0xd9d57c0e, 0xfb564a17, 0x198c8a4f, 0xbe502625, }, 5 }, - { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0x6e6c9b36, 0x4ae9f137, 0x27664f34, 0x3e32535, 0xfc793332, }, 5 }, { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, }, 5 }, { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, }, 5 }, { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, }, 5 }, diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c index e4aae1252..030ec3335 100644 --- a/grub-core/tests/gfxterm_menu.c +++ b/grub-core/tests/gfxterm_menu.c @@ -26,12 +26,12 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); static const char testfile[] = - "terminal_output gfxterm\n" "menuentry \"test\" {\n" "\ttrue\n" "}\n" @@ -68,12 +68,36 @@ struct grub_procfs_entry test_cfg = .get_contents = get_test_cfg }; +struct +{ + const char *name; + const char *var; + const char *val; +} tests[] = + { + { "gfxterm_menu", NULL, NULL }, + { "gfxmenu", "theme", "starfield/theme.txt" }, + { "gfxterm_ar", "lang", "en@arabic" }, + { "gfxterm_cyr", "lang", "en@cyrillic" }, + { "gfxterm_heb", "lang", "en@hebrew" }, + { "gfxterm_gre", "lang", "en@greek" }, + { "gfxterm_ru", "lang", "ru" }, + { "gfxterm_fr", "lang", "fr" }, + { "gfxterm_quot", "lang", "en@quot" }, + { "gfxterm_piglatin", "lang", "en@piglatin" }, + { "gfxterm_ch", "lang", "de_CH" }, + }; + /* Functional test main method. */ static void gfxterm_menu (void) { unsigned i, j; + grub_dl_load ("png"); + grub_dl_load ("gettext"); + grub_dl_load ("gfxterm"); + if (grub_font_load ("unicode") == 0) { grub_test_assert (0, "unicode font not found: %s", grub_errmsg); @@ -82,28 +106,63 @@ gfxterm_menu (void) grub_procfs_register ("test.cfg", &test_cfg); - for (j = 0; j < 2; j++) - for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++) + for (j = 0; j < ARRAY_SIZE (tests); j++) + for (i = 0; i < GRUB_TEST_VIDEO_SMALL_N_MODES; i++) { + struct grub_term_output *saved_outputs; + struct grub_term_output *saved_gfxnext; + struct grub_term_output *gfxterm; + grub_uint64_t start = grub_get_time_ms (); + grub_video_capture_start (&grub_test_video_modes[i], grub_video_fbstd_colors, grub_test_video_modes[i].number_of_colors); - grub_terminal_input_fake_sequence ((int []) { -1, -1, -1, GRUB_TERM_KEY_DOWN, -1, '\e' }, 6); + grub_terminal_input_fake_sequence ((int []) { -1, -1, -1, GRUB_TERM_KEY_DOWN, -1, 'e', + -1, GRUB_TERM_KEY_RIGHT, -1, 'x', -1, '\e', -1, '\e' }, 14); - grub_video_checksum (j ? "gfxmenu" : "gfxterm_menu"); + grub_video_checksum (tests[j].name); + + saved_outputs = grub_term_outputs; + + FOR_ACTIVE_TERM_OUTPUTS (gfxterm) + if (grub_strcmp (gfxterm->name, "gfxterm") == 0) + break; + if (!gfxterm) + FOR_DISABLED_TERM_OUTPUTS (gfxterm) + if (grub_strcmp (gfxterm->name, "gfxterm") == 0) + break; + + if (!gfxterm) + { + grub_test_assert (0, "terminal `%s' isn't found", "gfxterm"); + return; + } + + saved_gfxnext = gfxterm->next; + grub_term_outputs = gfxterm; + gfxterm->next = 0; + gfxterm->init (gfxterm); grub_env_context_open (); - if (j) - grub_env_set ("theme", "starfield/theme.txt"); + if (tests[j].var) + grub_env_set (tests[j].var, tests[j].val); grub_normal_execute ("(proc)/test.cfg", 1, 0); grub_env_context_close (); - char *args[] = { (char *) "console", 0 }; - grub_command_execute ("terminal_output", 1, args); + gfxterm->fini (gfxterm); + gfxterm->next = saved_gfxnext; + grub_term_outputs = saved_outputs; grub_terminal_input_fake_sequence_end (); grub_video_checksum_end (); grub_video_capture_end (); + + if (tests[j].var) + grub_env_unset (tests[j].var); + grub_printf ("%s %dx%dx%s done %lld ms\n", tests[j].name, + grub_test_video_modes[i].width, + grub_test_video_modes[i].height, + grub_video_checksum_get_modename (), (long long) (grub_get_time_ms () - start)); } grub_procfs_unregister (&test_cfg); diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c index f3eb9fc5f..68c61ffd0 100644 --- a/grub-core/tests/video_checksum.c +++ b/grub-core/tests/video_checksum.c @@ -59,6 +59,25 @@ struct grub_video_mode_info grub_test_video_modes[30] = { .bytes_per_pixel = 1, .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS }, + { + .width = 640, + .height = 480, + .pitch = 640 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + { + .width = 800, + .height = 600, + .pitch = 800 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + { + .width = 1024, + .height = 768, + .pitch = 1024 * 4, + GRUB_VIDEO_MI_RGBA8888() + }, + { .width = 640, .height = 480, @@ -86,6 +105,10 @@ struct grub_video_mode_info grub_test_video_modes[30] = { .bytes_per_pixel = 1, .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS }, + + + + { .width = 640, .height = 480, @@ -140,25 +163,6 @@ struct grub_video_mode_info grub_test_video_modes[30] = { .pitch = 1024 * 3, GRUB_VIDEO_MI_RGB888 () }, - { - .width = 640, - .height = 480, - .pitch = 640 * 4, - GRUB_VIDEO_MI_RGBA8888() - }, - { - .width = 800, - .height = 600, - .pitch = 800 * 4, - GRUB_VIDEO_MI_RGBA8888() - }, - { - .width = 1024, - .height = 768, - .pitch = 1024 * 4, - GRUB_VIDEO_MI_RGBA8888() - }, - { .width = 640, .height = 480, @@ -440,8 +444,8 @@ grub_video_capture_write_bmp (const char *fname, #endif -static const char * -get_modename (void) +const char * +grub_video_checksum_get_modename (void) { static char buf[40]; if (capt_mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) @@ -465,11 +469,39 @@ get_modename (void) } //#define GENERATE_MODE 1 +//#define SAVE_ALL_IMAGES +//#define COLLECT_TIME_STATISTICS 1 #if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) int genfd = -1; #endif +#include + +static void +write_time (void) +{ +#if defined (GRUB_MACHINE_EMU) && defined (COLLECT_TIME_STATISTICS) + char buf[60]; + static grub_uint64_t prev; + grub_uint64_t cur; + static int tmrfd = -1; + if (tmrfd < 0) + tmrfd = open ("time.txt", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + cur = grub_get_time_ms (); + grub_snprintf (buf, sizeof (buf), "%s_%dx%dx%s:%d: %" PRIuGRUB_UINT64_T " ms\n", + basename, + capt_mode_info.width, + capt_mode_info.height, + grub_video_checksum_get_modename (), ctr, + cur - prev); + prev = cur; + if (tmrfd >= 0) + write (tmrfd, buf, grub_strlen (buf)); +#endif +} + + static void checksum (void) { @@ -478,6 +510,8 @@ checksum (void) ptr = grub_video_capture_get_framebuffer (); + write_time (); + #ifdef GRUB_CPU_WORDS_BIGENDIAN switch (capt_mode_info.bytes_per_pixel) { @@ -549,35 +583,6 @@ checksum (void) #else crc = grub_getcrc32c (0, ptr, capt_mode_info.pitch * capt_mode_info.height); #endif - if (!checksums || ctr >= nchk) - { - grub_test_assert (0, "Unexpected checksum %s_%dx%dx%s:%d: 0x%x", - basename, - capt_mode_info.width, - capt_mode_info.height, get_modename (), ctr, crc); - } - else if (crc != checksums[ctr]) - { - grub_test_assert (0, "Checksum %s_%dx%dx%s:%d failed: 0x%x vs 0x%x", - basename, - capt_mode_info.width, - capt_mode_info.height, get_modename (), - ctr, crc, checksums[ctr]); - } - else - { -#if !(defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU)) - ctr++; - return; -#endif - } -#ifdef GRUB_MACHINE_EMU - char *name = grub_xasprintf ("%s_%dx%dx%s_%d.bmp", basename, - capt_mode_info.width, - capt_mode_info.height, get_modename (), - ctr); - grub_video_capture_write_bmp (name, ptr, &capt_mode_info); -#endif #if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU) if (genfd >= 0) @@ -588,6 +593,43 @@ checksum (void) } #endif + if (!checksums || ctr >= nchk) + { + grub_test_assert (0, "Unexpected checksum %s_%dx%dx%s:%d: 0x%x", + basename, + capt_mode_info.width, + capt_mode_info.height, + grub_video_checksum_get_modename (), ctr, crc); + } + else if (crc != checksums[ctr]) + { + grub_test_assert (0, "Checksum %s_%dx%dx%s:%d failed: 0x%x vs 0x%x", + basename, + capt_mode_info.width, + capt_mode_info.height, + grub_video_checksum_get_modename (), + ctr, crc, checksums[ctr]); + } +#if !(defined (SAVE_ALL_IMAGES) && defined (GRUB_MACHINE_EMU)) + else + { + write_time (); + ctr++; + return; + } +#endif +#ifdef GRUB_MACHINE_EMU + char *name = grub_xasprintf ("%s_%dx%dx%s_%d.bmp", basename, + capt_mode_info.width, + capt_mode_info.height, + grub_video_checksum_get_modename (), + ctr); + grub_video_capture_write_bmp (name, ptr, &capt_mode_info); + grub_free (name); +#endif + + write_time (); + ctr++; } @@ -691,14 +733,15 @@ grub_video_checksum_end (void) if (genfd >= 0) { char buf[40]; - grub_snprintf (buf, sizeof (buf), "}, %x },\n", ctr); + grub_snprintf (buf, sizeof (buf), "}, %d },\n", ctr); write (genfd, buf, grub_strlen (buf)); } #endif grub_test_assert (ctr == nchk, "Not enough checksums %s_%dx%dx%s: %d vs %d", basename, capt_mode_info.width, - capt_mode_info.height, get_modename (), + capt_mode_info.height, + grub_video_checksum_get_modename (), ctr, nchk); grub_free (basename); basename = 0; diff --git a/grub-core/video/video.c b/grub-core/video/video.c index 90b525325..5215ac967 100644 --- a/grub-core/video/video.c +++ b/grub-core/video/video.c @@ -499,6 +499,9 @@ grub_video_set_mode (const char *modestring, char *current_mode; char *modevar; + if (grub_video_adapter_active && grub_video_adapter_active->id == GRUB_VIDEO_ADAPTER_CAPTURE) + return GRUB_ERR_NONE; + modevalue &= modemask; /* Take copy of env.var. as we don't want to modify that. */ @@ -510,9 +513,6 @@ grub_video_set_mode (const char *modestring, if (! modevar) return grub_errno; - if (grub_video_adapter_active && grub_video_adapter_active->id == GRUB_VIDEO_ADAPTER_CAPTURE) - return GRUB_ERR_NONE; - if (grub_memcmp (next_mode, "keep", sizeof ("keep")) == 0 || grub_memcmp (next_mode, "keep,", sizeof ("keep,") - 1) == 0 || grub_memcmp (next_mode, "keep;", sizeof ("keep;") - 1) == 0) diff --git a/include/grub/test.h b/include/grub/test.h index 946a81b1c..cc4e4a82a 100644 --- a/include/grub/test.h +++ b/include/grub/test.h @@ -101,7 +101,11 @@ void grub_terminal_input_fake_sequence (int *seq_in, int nseq_in); void grub_terminal_input_fake_sequence_end (void); +const char * +grub_video_checksum_get_modename (void); + +#define GRUB_TEST_VIDEO_SMALL_N_MODES 6 extern struct grub_video_mode_info grub_test_video_modes[30]; #endif /* ! GRUB_TEST_HEADER */ diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in index a149cf96d..4bf3b92ea 100644 --- a/tests/grub_func_test.in +++ b/tests/grub_func_test.in @@ -3,7 +3,7 @@ set -e . "@builddir@/grub-core/modinfo.sh" -out=`echo all_functional_test | @builddir@/grub-shell` +out=`echo all_functional_test | @builddir@/grub-shell --timeout=3600` if [ "$(echo "$out" | tail -n 1)" != "ALL TESTS PASSED" ]; then echo "Functional test failure: $out" diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index dee3962e2..f259bb3f9 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -411,8 +411,10 @@ elif [ x$boot = xemu ]; then grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" mkdir -p "$grubdir/fonts" mkdir -p "$grubdir/themes" + mkdir -p "$grubdir/locale" cp "@builddir@/"unicode.pf2 "$grubdir/fonts/unicode.pf2" cp -R "@srcdir@/themes/starfield" "$grubdir/themes/starfield" + cp -R "@srcdir@/po/"*.gmo "$grubdir/locale/" cp "${cfgfile}" "$grubdir/grub.cfg" cp "${source}" "$grubdir/testcase.cfg" @builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim From 22b06e9685da56ce301c3f733af8dd593ff9a77a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 15:07:13 +0200 Subject: [PATCH 154/187] Speed-up gfxterm by slightly agglomerating mallocs. --- ChangeLog | 4 +++ grub-core/term/gfxterm.c | 61 +++++++++++----------------------------- include/grub/unicode.h | 24 ++++++++++++++++ 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index a13face96..963792e32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-04 Vladimir Serbinenko + + Speed-up gfxterm by slightly agglomerating mallocs. + 2013-05-04 Vladimir Serbinenko More video checks. diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c index 54636d771..0cb4037dc 100644 --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -49,7 +49,7 @@ struct grub_dirty_region struct grub_colored_char { /* An Unicode codepoint. */ - struct grub_unicode_glyph *code; + struct grub_unicode_glyph code; /* Color values. */ grub_video_color_t fg_color; @@ -175,14 +175,8 @@ set_term_color (grub_uint8_t term_color) static void clear_char (struct grub_colored_char *c) { - if (c->code) - { - grub_free (c->code->combining); - grub_free (c->code); - } - c->code = grub_unicode_glyph_from_code (' '); - if (!c->code) - grub_errno = GRUB_ERR_NONE; + grub_free (c->code.combining); + grub_unicode_set_glyph_from_code (&c->code, ' '); c->fg_color = virtual_screen.fg_color; c->bg_color = virtual_screen.bg_color; } @@ -197,11 +191,7 @@ grub_virtual_screen_free (void) for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++) - if (virtual_screen.text_buffer[i].code) - { - grub_free (virtual_screen.text_buffer[i].code->combining); - grub_free (virtual_screen.text_buffer[i].code); - } + grub_free (virtual_screen.text_buffer[i].code.combining); grub_free (virtual_screen.text_buffer); } @@ -277,7 +267,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y, /* Clear out text buffer. */ for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++) { - virtual_screen.text_buffer[i].code = 0; + virtual_screen.text_buffer[i].code.combining = 0; clear_char (&(virtual_screen.text_buffer[i])); } @@ -418,12 +408,9 @@ grub_gfxterm_term_fini (struct grub_term_output *term __attribute__ ((unused))) for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++) { - if (virtual_screen.text_buffer[i].code) - { - grub_free (virtual_screen.text_buffer[i].code->combining); - grub_free (virtual_screen.text_buffer[i].code); - } - virtual_screen.text_buffer[i].code = 0; + grub_free (virtual_screen.text_buffer[i].code.combining); + virtual_screen.text_buffer[i].code.combining = 0; + virtual_screen.text_buffer[i].code.base = 0; } /* Clear error state. */ @@ -634,11 +621,11 @@ paint_char (unsigned cx, unsigned cy) p = (virtual_screen.text_buffer + cx + (cy * virtual_screen.columns)); - if (!p->code) + if (!p->code.base) return; /* Get glyph for character. */ - glyph = grub_font_construct_glyph (virtual_screen.font, p->code); + glyph = grub_font_construct_glyph (virtual_screen.font, &p->code); if (!glyph) { grub_errno = GRUB_ERR_NONE; @@ -817,11 +804,7 @@ scroll_up (void) /* Clear first line in text buffer. */ for (i = 0; i < virtual_screen.columns; i++) - if (virtual_screen.text_buffer[i].code) - { - grub_free (virtual_screen.text_buffer[i].code->combining); - grub_free (virtual_screen.text_buffer[i].code); - } + grub_free (virtual_screen.text_buffer[i].code.combining); /* Scroll text buffer with one line to up. */ grub_memmove (virtual_screen.text_buffer, @@ -834,10 +817,7 @@ scroll_up (void) for (i = virtual_screen.columns * (virtual_screen.rows - 1); i < virtual_screen.columns * virtual_screen.rows; i++) - { - virtual_screen.text_buffer[i].code = 0; - clear_char (&(virtual_screen.text_buffer[i])); - } + clear_char (&(virtual_screen.text_buffer[i])); virtual_screen.total_scroll++; } @@ -897,14 +877,9 @@ grub_gfxterm_putchar (struct grub_term_output *term, p = (virtual_screen.text_buffer + virtual_screen.cursor_x + virtual_screen.cursor_y * virtual_screen.columns); - if (p->code) - { - grub_free (p->code->combining); - grub_free (p->code); - } - p->code = grub_unicode_glyph_dup (c); - if (!p->code) - grub_errno = GRUB_ERR_NONE; + grub_free (p->code.combining); + grub_unicode_set_glyph (&p->code, c); + grub_errno = GRUB_ERR_NONE; p->fg_color = virtual_screen.fg_color; p->bg_color = virtual_screen.bg_color; @@ -916,11 +891,9 @@ grub_gfxterm_putchar (struct grub_term_output *term, for (i = 1; i < char_width && p + i < virtual_screen.text_buffer + virtual_screen.columns * virtual_screen.rows; i++) - if (p[i].code) { - grub_free (p[i].code->combining); - grub_free (p[i].code); - p[i].code = NULL; + grub_free (p[i].code.combining); + p[i].code.base = 0; } } diff --git a/include/grub/unicode.h b/include/grub/unicode.h index 5a96a196f..3d79c4c5e 100644 --- a/include/grub/unicode.h +++ b/include/grub/unicode.h @@ -274,6 +274,21 @@ grub_unicode_glyph_dup (const struct grub_unicode_glyph *in) return out; } +static inline void +grub_unicode_set_glyph (struct grub_unicode_glyph *out, + const struct grub_unicode_glyph *in) +{ + grub_memcpy (out, in, sizeof (*in)); + if (in->combining) + { + out->combining = grub_malloc (in->ncomb * sizeof (out->combining[0])); + if (!out->combining) + return; + grub_memcpy (out->combining, in->combining, + in->ncomb * sizeof (out->combining[0])); + } +} + static inline struct grub_unicode_glyph * grub_unicode_glyph_from_code (grub_uint32_t code) { @@ -287,6 +302,15 @@ grub_unicode_glyph_from_code (grub_uint32_t code) return ret; } +static inline void +grub_unicode_set_glyph_from_code (struct grub_unicode_glyph *glyph, + grub_uint32_t code) +{ + grub_memset (glyph, 0, sizeof (*glyph)); + + glyph->base = code; +} + grub_uint32_t grub_unicode_mirror_code (grub_uint32_t in); grub_uint32_t From 85002bf34aae2c8443d064a32de3a9e4ad66b5e5 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 4 May 2013 22:23:23 +0200 Subject: [PATCH 155/187] Agglomerate more mallocs to speed-up gfxterm. --- ChangeLog | 4 + grub-core/font/font.c | 91 +++++++++---- grub-core/gfxmenu/font.c | 7 +- grub-core/gfxmenu/gui_list.c | 1 + grub-core/gfxmenu/gui_progress_bar.c | 3 + grub-core/kern/term.c | 1 - grub-core/normal/charset.c | 193 +++++++++++++-------------- grub-core/normal/menu_entry.c | 2 +- grub-core/normal/menu_text.c | 8 +- grub-core/normal/term.c | 18 +-- grub-core/term/gfxterm.c | 19 ++- grub-core/tests/video_checksum.c | 10 +- grub-core/video/fb/fbblit.c | 6 - include/grub/emu/export.h | 2 + include/grub/unicode.h | 76 ++++++++--- 15 files changed, 254 insertions(+), 187 deletions(-) diff --git a/ChangeLog b/ChangeLog index 963792e32..57bce5008 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-04 Vladimir Serbinenko + + Agglomerate more mallocs to speed-up gfxterm. + 2013-05-04 Vladimir Serbinenko Speed-up gfxterm by slightly agglomerating mallocs. diff --git a/grub-core/font/font.c b/grub-core/font/font.c index 4758f6c0a..50b1799b1 100644 --- a/grub-core/font/font.c +++ b/grub-core/font/font.c @@ -1064,6 +1064,7 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code) return best_glyph; } +#if 0 static struct grub_font_glyph * grub_font_dup_glyph (struct grub_font_glyph *glyph) { @@ -1075,6 +1076,7 @@ grub_font_dup_glyph (struct grub_font_glyph *glyph) + (glyph->width * glyph->height + 7) / 8); return ret; } +#endif /* FIXME: suboptimal. */ static void @@ -1202,6 +1204,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, signed above_leftx, above_lefty; signed below_rightx, below_righty; signed min_devwidth = 0; + const struct grub_unicode_combining *comb; if (glyph) glyph->device_width = main_glyph->device_width; @@ -1222,6 +1225,8 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, below_rightx = ctx.bounds.x + ctx.bounds.width; below_righty = ctx.bounds.y; + comb = grub_unicode_get_comb (glyph_id); + for (i = 0; i < glyph_id->ncomb; i++) { grub_int16_t space = 0; @@ -1232,10 +1237,10 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, continue; targetx = (ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x; /* CGJ is to avoid diacritics reordering. */ - if (glyph_id->combining[i].code + if (comb[i].code == GRUB_UNICODE_COMBINING_GRAPHEME_JOINER) continue; - switch (glyph_id->combining[i].type) + switch (comb[i].type) { case GRUB_UNICODE_COMB_OVERLAY: do_blit (combining_glyphs[i], @@ -1361,7 +1366,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, break; case GRUB_UNICODE_COMB_MN: - switch (glyph_id->combining[i].code) + switch (comb[i].code) { case GRUB_UNICODE_THAANA_ABAFILI: case GRUB_UNICODE_THAANA_AABAAFILI: @@ -1410,17 +1415,14 @@ static struct grub_font_glyph * grub_font_construct_dry_run (grub_font_t hinted_font, const struct grub_unicode_glyph *glyph_id, struct grub_video_signed_rect *bounds, - struct grub_font_glyph ***combining_glyphs_out, + struct grub_font_glyph **combining_glyphs, int *device_width) { struct grub_font_glyph *main_glyph = NULL; - struct grub_font_glyph **combining_glyphs; grub_uint32_t desired_attributes = 0; unsigned i; grub_uint32_t base = glyph_id->base; - - if (combining_glyphs_out) - *combining_glyphs_out = NULL; + const struct grub_unicode_combining *comb; if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED) desired_attributes |= GRUB_FONT_CODE_RIGHT_JOINED; @@ -1428,11 +1430,12 @@ grub_font_construct_dry_run (grub_font_t hinted_font, if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED) desired_attributes |= GRUB_FONT_CODE_LEFT_JOINED; + comb = grub_unicode_get_comb (glyph_id); if (base == 'i' || base == 'j') { for (i = 0; i < glyph_id->ncomb; i++) - if (glyph_id->combining[i].type == GRUB_UNICODE_STACK_ABOVE) + if (comb[i].type == GRUB_UNICODE_STACK_ABOVE) break; if (i < glyph_id->ncomb && base == 'i') base = GRUB_UNICODE_DOTLESS_LOWERCASE_I; @@ -1461,8 +1464,6 @@ grub_font_construct_dry_run (grub_font_t hinted_font, if (!glyph_id->ncomb && !glyph_id->attributes) return main_glyph; - combining_glyphs = grub_malloc (sizeof (combining_glyphs[0]) - * glyph_id->ncomb); if (glyph_id->ncomb && !combining_glyphs) { grub_errno = GRUB_ERR_NONE; @@ -1472,18 +1473,33 @@ grub_font_construct_dry_run (grub_font_t hinted_font, for (i = 0; i < glyph_id->ncomb; i++) combining_glyphs[i] = grub_font_get_glyph_with_fallback (main_glyph->font, - glyph_id->combining[i].code); + comb[i].code); blit_comb (glyph_id, NULL, bounds, main_glyph, combining_glyphs, device_width); - if (combining_glyphs_out) - *combining_glyphs_out = combining_glyphs; - else - grub_free (combining_glyphs); return main_glyph; } +static struct grub_font_glyph **render_combining_glyphs = 0; +static grub_size_t render_max_comb_glyphs = 0; + +static void +ensure_comb_space (const struct grub_unicode_glyph *glyph_id) +{ + if (glyph_id->ncomb <= render_max_comb_glyphs) + return; + + render_max_comb_glyphs = 2 * glyph_id->ncomb; + if (render_max_comb_glyphs < 8) + render_max_comb_glyphs = 8; + grub_free (render_combining_glyphs); + render_combining_glyphs = grub_malloc (render_max_comb_glyphs + * sizeof (render_combining_glyphs[0])); + if (!render_combining_glyphs) + grub_errno = 0; +} + int grub_font_get_constructed_device_width (grub_font_t hinted_font, const struct grub_unicode_glyph @@ -1491,8 +1507,11 @@ grub_font_get_constructed_device_width (grub_font_t hinted_font, { int ret; struct grub_font_glyph *main_glyph; + + ensure_comb_space (glyph_id); + main_glyph = grub_font_construct_dry_run (hinted_font, glyph_id, NULL, - NULL, &ret); + render_combining_glyphs, &ret); if (!main_glyph) return unknown_glyph->device_width; return ret; @@ -1504,26 +1523,42 @@ grub_font_construct_glyph (grub_font_t hinted_font, { struct grub_font_glyph *main_glyph; struct grub_video_signed_rect bounds; - struct grub_font_glyph *glyph; - struct grub_font_glyph **combining_glyphs; + static struct grub_font_glyph *glyph = 0; + static grub_size_t max_glyph_size = 0; + + ensure_comb_space (glyph_id); main_glyph = grub_font_construct_dry_run (hinted_font, glyph_id, - &bounds, &combining_glyphs, NULL); + &bounds, render_combining_glyphs, + NULL); if (!main_glyph) - return grub_font_dup_glyph (unknown_glyph); + return unknown_glyph; - if (!combining_glyphs) - return grub_font_dup_glyph (main_glyph); + if (!render_combining_glyphs && glyph_id->ncomb) + return main_glyph; - glyph = - grub_zalloc (sizeof (*glyph) + (bounds.width * bounds.height + 7) / 8); + if (!glyph_id->ncomb && !glyph_id->attributes) + return main_glyph; + + if (max_glyph_size < sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) + { + grub_free (glyph); + max_glyph_size = (sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) * 2; + if (max_glyph_size < 8) + max_glyph_size = 8; + glyph = grub_malloc (max_glyph_size); + } if (!glyph) { grub_errno = GRUB_ERR_NONE; - return grub_font_dup_glyph (main_glyph); + return main_glyph; } + grub_memset (glyph, 0, sizeof (*glyph) + + (bounds.width * bounds.height + + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT); + glyph->font = main_glyph->font; glyph->width = bounds.width; glyph->height = bounds.height; @@ -1542,9 +1577,7 @@ grub_font_construct_glyph (grub_font_t hinted_font, (glyph->height + glyph->offset_y) - (main_glyph->height + main_glyph->offset_y)); - blit_comb (glyph_id, glyph, NULL, main_glyph, combining_glyphs, NULL); - - grub_free (combining_glyphs); + blit_comb (glyph_id, glyph, NULL, main_glyph, render_combining_glyphs, NULL); return glyph; } diff --git a/grub-core/gfxmenu/font.c b/grub-core/gfxmenu/font.c index 9c6e2d491..64d52670b 100644 --- a/grub-core/gfxmenu/font.c +++ b/grub-core/gfxmenu/font.c @@ -42,7 +42,6 @@ grub_font_draw_string (const char *str, grub_font_t font, int left_x, int baseline_y) { int x; - struct grub_font_glyph *glyph; grub_uint32_t *logical; grub_ssize_t logical_len, visual_len; struct grub_unicode_glyph *visual, *ptr; @@ -60,18 +59,18 @@ grub_font_draw_string (const char *str, grub_font_t font, for (ptr = visual, x = left_x; ptr < visual + visual_len; ptr++) { grub_err_t err; + struct grub_font_glyph *glyph; glyph = grub_font_construct_glyph (font, ptr); if (!glyph) return grub_errno; err = grub_font_draw_glyph (glyph, color, x, baseline_y); x += glyph->device_width; - grub_free (glyph); if (err) return err; } for (ptr = visual; ptr < visual + visual_len; ptr++) - grub_free (ptr->combining); + grub_unicode_destroy_glyph (ptr); grub_free (visual); return GRUB_ERR_NONE; @@ -104,7 +103,7 @@ grub_font_get_string_width (grub_font_t font, const char *str) &glyph); width += grub_font_get_constructed_device_width (font, &glyph); - grub_free (glyph.combining); + grub_unicode_destroy_glyph (&glyph); } grub_free (logical); diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c index 1a2a16d32..3d227eec4 100644 --- a/grub-core/gfxmenu/gui_list.c +++ b/grub-core/gfxmenu/gui_list.c @@ -87,6 +87,7 @@ list_destroy (void *vself) self->scrollbar_thumb->destroy (self->scrollbar_thumb); if (self->scrollbar_frame) self->scrollbar_frame->destroy (self->scrollbar_frame); + grub_free (self->scrollbar_thumb_pattern); grub_free (self); } diff --git a/grub-core/gfxmenu/gui_progress_bar.c b/grub-core/gfxmenu/gui_progress_bar.c index cb709302b..b29efc016 100644 --- a/grub-core/gfxmenu/gui_progress_bar.c +++ b/grub-core/gfxmenu/gui_progress_bar.c @@ -59,6 +59,9 @@ static void progress_bar_destroy (void *vself) { grub_gui_progress_bar_t self = vself; + grub_free (self->theme_dir); + grub_free (self->template); + grub_free (self->id); grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self); grub_free (self); } diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c index 66c597130..6eca68b72 100644 --- a/grub-core/kern/term.c +++ b/grub-core/kern/term.c @@ -46,7 +46,6 @@ grub_putcode_dumb (grub_uint32_t code, .variant = 0, .attributes = 0, .ncomb = 0, - .combining = 0, .estimated_width = 1 }; diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c index ab3101b00..f4268ec02 100644 --- a/grub-core/normal/charset.c +++ b/grub-core/normal/charset.c @@ -435,7 +435,6 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, out->attributes = 0; out->ncomb = 0; out->estimated_width = 1; - out->combining = NULL; return 1; } @@ -473,25 +472,42 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, || comb_type == GRUB_UNICODE_COMB_ME || comb_type == GRUB_UNICODE_COMB_MN) last_comb_pointer = out->ncomb; - n = grub_realloc (out->combining, - sizeof (n[0]) * (out->ncomb + 1)); - if (!n) + + if (out->ncomb + 1 <= (int) ARRAY_SIZE (out->combining_inline)) + n = out->combining_inline; + else if (out->ncomb > (int) ARRAY_SIZE (out->combining_inline)) { - grub_errno = GRUB_ERR_NONE; - continue; + n = grub_realloc (out->combining_ptr, + sizeof (n[0]) * (out->ncomb + 1)); + if (!n) + { + grub_errno = GRUB_ERR_NONE; + continue; + } + out->combining_ptr = n; + } + else + { + n = grub_malloc (sizeof (n[0]) * (out->ncomb + 1)); + if (!n) + { + grub_errno = GRUB_ERR_NONE; + continue; + } + grub_memcpy (n, out->combining_inline, + sizeof (out->combining_inline)); + out->combining_ptr = n; } - out->combining = n; for (j = last_comb_pointer; j < out->ncomb; j++) - if (is_type_after (out->combining[j].type, comb_type)) + if (is_type_after (n[j].type, comb_type)) break; - grub_memmove (out->combining + j + 1, - out->combining + j, + grub_memmove (n + j + 1, + n + j, (out->ncomb - j) - * sizeof (out->combining[0])); - out->combining = n; - out->combining[j].code = *ptr; - out->combining[j].type = comb_type; + * sizeof (n[0])); + n[j].code = *ptr; + n[j].type = comb_type; out->ncomb++; continue; } @@ -503,7 +519,6 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, out->attributes = 0; out->ncomb = 0; out->estimated_width = 1; - out->combining = NULL; } return ptr - in; } @@ -511,7 +526,7 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, static grub_ssize_t bidi_line_wrap (struct grub_unicode_glyph *visual_out, struct grub_unicode_glyph *visual, - grub_size_t visual_len, unsigned *levels, + grub_size_t visual_len, grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), void *getcharwidth_arg, grub_size_t maxwidth, grub_size_t startwidth, @@ -531,7 +546,7 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out, void revert (unsigned start, unsigned end) { struct grub_unicode_glyph t; - unsigned i, tl; + unsigned i; int a, b; if (pos) { @@ -549,9 +564,6 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out, pos[visual[start + i].orig_pos].x = a + b - pos[visual[start + i].orig_pos].x; pos[visual[end - i].orig_pos].x = a + b - pos[visual[end - i].orig_pos].x; } - tl = levels[start + i]; - levels[start + i] = levels[end - i]; - levels[end - i] = tl; } } @@ -611,10 +623,10 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out, unsigned i; for (i = line_start; i < k; i++) { - if (levels[i] > max_level) - max_level = levels[i]; - if (levels[i] < min_odd_level && (levels[i] & 1)) - min_odd_level = levels[i]; + if (visual[i].bidi_level > max_level) + max_level = visual[i].bidi_level; + if (visual[i].bidi_level < min_odd_level && (visual[i].bidi_level & 1)) + min_odd_level = visual[i].bidi_level; } } @@ -627,9 +639,11 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out, unsigned i; for (i = line_start; i < k; i++) { - if (i != line_start && levels[i] >= j && levels[i-1] < j) + if (i != line_start && visual[i].bidi_level >= j + && visual[i-1].bidi_level < j) in = i; - if (levels[i] >= j && (i + 1 == k || levels[i+1] < j)) + if (visual[i].bidi_level >= j && (i + 1 == k + || visual[i+1].bidi_level < j)) revert (in, i); } } @@ -639,10 +653,10 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out, unsigned i; for (i = line_start; i < k; i++) { - if (is_mirrored (visual[i].base) && levels[i]) + if (is_mirrored (visual[i].base) && visual[i].bidi_level) visual[i].attributes |= GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR; if ((visual[i].attributes & GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN) - && levels[i]) + && visual[i].bidi_level) { int left, right; left = visual[i].attributes @@ -763,8 +777,6 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, { enum grub_bidi_type type = GRUB_BIDI_TYPE_L; enum override_status {OVERRIDE_NEUTRAL = 0, OVERRIDE_R, OVERRIDE_L}; - unsigned *levels; - enum grub_bidi_type *resolved_types; unsigned base_level; enum override_status cur_override; unsigned i; @@ -808,24 +820,9 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, cur_override = stack_override[stack_depth]; } - levels = grub_malloc (sizeof (levels[0]) * logical_len); - if (!levels) - return -1; - - resolved_types = grub_malloc (sizeof (resolved_types[0]) * logical_len); - if (!resolved_types) - { - grub_free (levels); - return -1; - } - visual = grub_malloc (sizeof (visual[0]) * logical_len); if (!visual) - { - grub_free (resolved_types); - grub_free (levels); - return -1; - } + return -1; for (i = 0; i < logical_len; i++) { @@ -930,13 +927,13 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, join_state = JOIN_DEFAULT; zwj_propagate_to_previous = 1; - levels[visual_len] = cur_level; + visual[visual_len].bidi_level = cur_level; if (cur_override != OVERRIDE_NEUTRAL) - resolved_types[visual_len] = + visual[visual_len].bidi_type = (cur_override == OVERRIDE_L) ? GRUB_BIDI_TYPE_L : GRUB_BIDI_TYPE_R; else - resolved_types[visual_len] = type; + visual[visual_len].bidi_type = type; visual_len++; } } @@ -951,16 +948,16 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, unsigned prev_level, next_level, cur_run_level; unsigned last_type, last_strong_type; for (run_end = run_start; run_end < visual_len && - levels[run_end] == levels[run_start]; run_end++); + visual[run_end].bidi_level == visual[run_start].bidi_level; run_end++); if (run_start == 0) prev_level = base_level; else - prev_level = levels[run_start - 1]; + prev_level = visual[run_start - 1].bidi_level; if (run_end == visual_len) next_level = base_level; else - next_level = levels[run_end]; - cur_run_level = levels[run_start]; + next_level = visual[run_end].bidi_level; + cur_run_level = visual[run_start].bidi_level; if (prev_level & 1) last_type = GRUB_BIDI_TYPE_R; else @@ -968,48 +965,48 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, last_strong_type = last_type; for (i = run_start; i < run_end; i++) { - switch (resolved_types[i]) + switch (visual[i].bidi_type) { case GRUB_BIDI_TYPE_NSM: - resolved_types[i] = last_type; + visual[i].bidi_type = last_type; break; case GRUB_BIDI_TYPE_EN: if (last_strong_type == GRUB_BIDI_TYPE_AL) - resolved_types[i] = GRUB_BIDI_TYPE_AN; + visual[i].bidi_type = GRUB_BIDI_TYPE_AN; break; case GRUB_BIDI_TYPE_L: case GRUB_BIDI_TYPE_R: - last_strong_type = resolved_types[i]; + last_strong_type = visual[i].bidi_type; break; case GRUB_BIDI_TYPE_ES: if (last_type == GRUB_BIDI_TYPE_EN && i + 1 < run_end - && resolved_types[i + 1] == GRUB_BIDI_TYPE_EN) - resolved_types[i] = GRUB_BIDI_TYPE_EN; + && visual[i + 1].bidi_type == GRUB_BIDI_TYPE_EN) + visual[i].bidi_type = GRUB_BIDI_TYPE_EN; else - resolved_types[i] = GRUB_BIDI_TYPE_ON; + visual[i].bidi_type = GRUB_BIDI_TYPE_ON; break; case GRUB_BIDI_TYPE_ET: { unsigned j; if (last_type == GRUB_BIDI_TYPE_EN) { - resolved_types[i] = GRUB_BIDI_TYPE_EN; + visual[i].bidi_type = GRUB_BIDI_TYPE_EN; break; } for (j = i; j < run_end - && resolved_types[j] == GRUB_BIDI_TYPE_ET; j++); - if (j != run_end && resolved_types[j] == GRUB_BIDI_TYPE_EN) + && visual[j].bidi_type == GRUB_BIDI_TYPE_ET; j++); + if (j != run_end && visual[j].bidi_type == GRUB_BIDI_TYPE_EN) { for (; i < run_end - && resolved_types[i] == GRUB_BIDI_TYPE_ET; i++) - resolved_types[i] = GRUB_BIDI_TYPE_EN; + && visual[i].bidi_type == GRUB_BIDI_TYPE_ET; i++) + visual[i].bidi_type = GRUB_BIDI_TYPE_EN; i--; break; } for (; i < run_end - && resolved_types[i] == GRUB_BIDI_TYPE_ET; i++) - resolved_types[i] = GRUB_BIDI_TYPE_ON; + && visual[i].bidi_type == GRUB_BIDI_TYPE_ET; i++) + visual[i].bidi_type = GRUB_BIDI_TYPE_ON; i--; break; } @@ -1017,33 +1014,33 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, case GRUB_BIDI_TYPE_CS: if (last_type == GRUB_BIDI_TYPE_EN && i + 1 < run_end - && resolved_types[i + 1] == GRUB_BIDI_TYPE_EN) + && visual[i + 1].bidi_type == GRUB_BIDI_TYPE_EN) { - resolved_types[i] = GRUB_BIDI_TYPE_EN; + visual[i].bidi_type = GRUB_BIDI_TYPE_EN; break; } if (last_type == GRUB_BIDI_TYPE_AN && i + 1 < run_end - && (resolved_types[i + 1] == GRUB_BIDI_TYPE_AN - || (resolved_types[i + 1] == GRUB_BIDI_TYPE_EN + && (visual[i + 1].bidi_type == GRUB_BIDI_TYPE_AN + || (visual[i + 1].bidi_type == GRUB_BIDI_TYPE_EN && last_strong_type == GRUB_BIDI_TYPE_AL))) { - resolved_types[i] = GRUB_BIDI_TYPE_EN; + visual[i].bidi_type = GRUB_BIDI_TYPE_EN; break; } - resolved_types[i] = GRUB_BIDI_TYPE_ON; + visual[i].bidi_type = GRUB_BIDI_TYPE_ON; break; case GRUB_BIDI_TYPE_AL: - last_strong_type = resolved_types[i]; - resolved_types[i] = GRUB_BIDI_TYPE_R; + last_strong_type = visual[i].bidi_type; + visual[i].bidi_type = GRUB_BIDI_TYPE_R; break; default: /* Make GCC happy. */ break; } - last_type = resolved_types[i]; - if (resolved_types[i] == GRUB_BIDI_TYPE_EN + last_type = visual[i].bidi_type; + if (visual[i].bidi_type == GRUB_BIDI_TYPE_EN && last_strong_type == GRUB_BIDI_TYPE_L) - resolved_types[i] = GRUB_BIDI_TYPE_L; + visual[i].bidi_type = GRUB_BIDI_TYPE_L; } if (prev_level & 1) last_type = GRUB_BIDI_TYPE_R; @@ -1054,13 +1051,13 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, unsigned j; unsigned next_type; for (j = i; j < run_end && - (resolved_types[j] == GRUB_BIDI_TYPE_B - || resolved_types[j] == GRUB_BIDI_TYPE_S - || resolved_types[j] == GRUB_BIDI_TYPE_WS - || resolved_types[j] == GRUB_BIDI_TYPE_ON); j++); + (visual[j].bidi_type == GRUB_BIDI_TYPE_B + || visual[j].bidi_type == GRUB_BIDI_TYPE_S + || visual[j].bidi_type == GRUB_BIDI_TYPE_WS + || visual[j].bidi_type == GRUB_BIDI_TYPE_ON); j++); if (j == i) { - if (resolved_types[i] == GRUB_BIDI_TYPE_L) + if (visual[i].bidi_type == GRUB_BIDI_TYPE_L) last_type = GRUB_BIDI_TYPE_L; else last_type = GRUB_BIDI_TYPE_R; @@ -1071,39 +1068,39 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, next_type = (next_level & 1) ? GRUB_BIDI_TYPE_R : GRUB_BIDI_TYPE_L; else { - if (resolved_types[j] == GRUB_BIDI_TYPE_L) + if (visual[j].bidi_type == GRUB_BIDI_TYPE_L) next_type = GRUB_BIDI_TYPE_L; else next_type = GRUB_BIDI_TYPE_R; } if (next_type == last_type) for (; i < j; i++) - resolved_types[i] = last_type; + visual[i].bidi_type = last_type; else for (; i < j; i++) - resolved_types[i] = (cur_run_level & 1) ? GRUB_BIDI_TYPE_R + visual[i].bidi_type = (cur_run_level & 1) ? GRUB_BIDI_TYPE_R : GRUB_BIDI_TYPE_L; } } for (i = 0; i < visual_len; i++) { - if (!(levels[i] & 1) && resolved_types[i] == GRUB_BIDI_TYPE_R) + if (!(visual[i].bidi_level & 1) && visual[i].bidi_type == GRUB_BIDI_TYPE_R) { - levels[i]++; + visual[i].bidi_level++; continue; } - if (!(levels[i] & 1) && (resolved_types[i] == GRUB_BIDI_TYPE_AN - || resolved_types[i] == GRUB_BIDI_TYPE_EN)) + if (!(visual[i].bidi_level & 1) && (visual[i].bidi_type == GRUB_BIDI_TYPE_AN + || visual[i].bidi_type == GRUB_BIDI_TYPE_EN)) { - levels[i] += 2; + visual[i].bidi_level += 2; continue; } - if ((levels[i] & 1) && (resolved_types[i] == GRUB_BIDI_TYPE_L - || resolved_types[i] == GRUB_BIDI_TYPE_AN - || resolved_types[i] == GRUB_BIDI_TYPE_EN)) + if ((visual[i].bidi_level & 1) && (visual[i].bidi_type == GRUB_BIDI_TYPE_L + || visual[i].bidi_type == GRUB_BIDI_TYPE_AN + || visual[i].bidi_type == GRUB_BIDI_TYPE_EN)) { - levels[i]++; + visual[i].bidi_level++; continue; } } @@ -1111,16 +1108,14 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, else { for (i = 0; i < visual_len; i++) - levels[i] = 0; + visual[i].bidi_level = 0; } - grub_free (resolved_types); { grub_ssize_t ret; - ret = bidi_line_wrap (visual_out, visual, visual_len, levels, + ret = bidi_line_wrap (visual_out, visual, visual_len, getcharwidth, getcharwidth_arg, maxwidth, startwidth, contchar, pos, primitive_wrap, log_end); - grub_free (levels); grub_free (visual); return ret; } diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c index 3cc0c0113..fae258a3f 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c @@ -624,7 +624,7 @@ backward_char (struct screen *screen, int update) linep->buf + screen->column) - linep->buf; - grub_free (glyph.combining); + grub_unicode_destroy_glyph (&glyph); } else if (screen->line > 0) { diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c index d7e564158..36f8e738c 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -56,10 +56,10 @@ grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position, while (str < last_position) { struct grub_unicode_glyph glyph; - glyph.combining = 0; + glyph.ncomb = 0; str += grub_unicode_aglomerate_comb (str, last_position - str, &glyph); width += grub_term_getcharwidth (term, &glyph); - grub_free (glyph.combining); + grub_unicode_destroy_glyph (&glyph); } return width; } @@ -259,7 +259,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, len - i, &glyph); width = grub_term_getcharwidth (term, &glyph); - grub_free (glyph.combining); + + grub_unicode_destroy_glyph (&glyph); if (x + width <= (int) (GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (term) @@ -284,7 +285,6 @@ print_entry (int y, int highlight, grub_menu_entry_t entry, .variant = 0, .attributes = 0, .ncomb = 0, - .combining = 0, .estimated_width = 1 }; x += grub_term_getcharwidth (term, &pseudo_glyph); diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index 820156f48..83b3bcef0 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -29,7 +29,7 @@ struct term_state { struct term_state *next; - const struct grub_unicode_glyph *backlog_glyphs; + struct grub_unicode_glyph *backlog_glyphs; const grub_uint32_t *backlog_ucs4; int backlog_fixed_tab; grub_size_t backlog_len; @@ -228,7 +228,6 @@ grub_puts_terminal (const char *str, struct grub_term_output *term) .variant = 0, .attributes = 0, .ncomb = 0, - .combining = 0, .estimated_width = 1, .base = *str }; @@ -422,7 +421,6 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term, .variant = 0, .attributes = 0, .ncomb = 0, - .combining = 0, .estimated_width = 1 }; @@ -475,7 +473,7 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term, } } else - code = c->combining[i].code; + code = grub_unicode_get_comb (c) [i].code; grub_ucs4_to_utf8 (&code, 1, u8, sizeof (u8)); @@ -506,7 +504,6 @@ putcode_real (grub_uint32_t code, struct grub_term_output *term, int fixed_tab) .variant = 0, .attributes = 0, .ncomb = 0, - .combining = 0, .estimated_width = 1 }; @@ -534,7 +531,6 @@ get_maxwidth (struct grub_term_output *term, .variant = 0, .attributes = 0, .ncomb = 0, - .combining = 0 }; return (grub_term_width (term) - grub_term_getcharwidth (term, &space_glyph) @@ -615,7 +611,6 @@ print_ucs4_terminal (const grub_uint32_t * str, .variant = 0, .attributes = 0, .ncomb = 0, - .combining = 0 }; c.base = *ptr; if (pos) @@ -779,14 +774,14 @@ find_term_state (struct grub_term_output *term) } static int -put_glyphs_terminal (const struct grub_unicode_glyph *visual, +put_glyphs_terminal (struct grub_unicode_glyph *visual, grub_ssize_t visual_len, int margin_left, int margin_right, struct grub_term_output *term, struct term_state *state, int fixed_tab, grub_uint32_t contchar) { - const struct grub_unicode_glyph *visual_ptr; + struct grub_unicode_glyph *visual_ptr; int since_last_nl = 1; for (visual_ptr = visual; visual_ptr < visual + visual_len; visual_ptr++) { @@ -813,7 +808,7 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual, grub_term_gotoxy (term, margin_left, grub_term_getxy (term) & 0xff); } - grub_free (visual_ptr->combining); + grub_unicode_destroy_glyph (visual_ptr); } if (contchar && since_last_nl) fill_margin (term, margin_right); @@ -953,7 +948,7 @@ print_ucs4_real (const grub_uint32_t * str, if (visual_len_show && visual[visual_len_show - 1].base != '\n') ret++; for (vptr = visual; vptr < visual + visual_len; vptr++) - grub_free (vptr->combining); + grub_unicode_destroy_glyph (vptr); grub_free (visual); } else @@ -1030,7 +1025,6 @@ grub_xnputs (const char *str, grub_size_t msg_len) .variant = 0, .attributes = 0, .ncomb = 0, - .combining = 0, .estimated_width = 1, .base = *str }; diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c index 0cb4037dc..0e5bcd95f 100644 --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -175,7 +175,7 @@ set_term_color (grub_uint8_t term_color) static void clear_char (struct grub_colored_char *c) { - grub_free (c->code.combining); + grub_unicode_destroy_glyph (&c->code); grub_unicode_set_glyph_from_code (&c->code, ' '); c->fg_color = virtual_screen.fg_color; c->bg_color = virtual_screen.bg_color; @@ -191,7 +191,7 @@ grub_virtual_screen_free (void) for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++) - grub_free (virtual_screen.text_buffer[i].code.combining); + grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code); grub_free (virtual_screen.text_buffer); } @@ -267,7 +267,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y, /* Clear out text buffer. */ for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++) { - virtual_screen.text_buffer[i].code.combining = 0; + virtual_screen.text_buffer[i].code.ncomb = 0; clear_char (&(virtual_screen.text_buffer[i])); } @@ -408,8 +408,8 @@ grub_gfxterm_term_fini (struct grub_term_output *term __attribute__ ((unused))) for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++) { - grub_free (virtual_screen.text_buffer[i].code.combining); - virtual_screen.text_buffer[i].code.combining = 0; + grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code); + virtual_screen.text_buffer[i].code.ncomb = 0; virtual_screen.text_buffer[i].code.base = 0; } @@ -651,7 +651,6 @@ paint_char (unsigned cx, unsigned cy) /* Mark character to be drawn. */ dirty_region_add (virtual_screen.offset_x + x, virtual_screen.offset_y + y, width, height); - grub_free (glyph); } static inline void @@ -804,8 +803,8 @@ scroll_up (void) /* Clear first line in text buffer. */ for (i = 0; i < virtual_screen.columns; i++) - grub_free (virtual_screen.text_buffer[i].code.combining); - + grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code); + /* Scroll text buffer with one line to up. */ grub_memmove (virtual_screen.text_buffer, virtual_screen.text_buffer + virtual_screen.columns, @@ -877,7 +876,7 @@ grub_gfxterm_putchar (struct grub_term_output *term, p = (virtual_screen.text_buffer + virtual_screen.cursor_x + virtual_screen.cursor_y * virtual_screen.columns); - grub_free (p->code.combining); + grub_unicode_destroy_glyph (&p->code); grub_unicode_set_glyph (&p->code, c); grub_errno = GRUB_ERR_NONE; p->fg_color = virtual_screen.fg_color; @@ -892,7 +891,7 @@ grub_gfxterm_putchar (struct grub_term_output *term, virtual_screen.text_buffer + virtual_screen.columns * virtual_screen.rows; i++) { - grub_free (p[i].code.combining); + grub_unicode_destroy_glyph (&p[i].code); p[i].code.base = 0; } } diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c index 68c61ffd0..ec9d33a0b 100644 --- a/grub-core/tests/video_checksum.c +++ b/grub-core/tests/video_checksum.c @@ -478,6 +478,11 @@ int genfd = -1; #include +#if defined (GRUB_MACHINE_EMU) && defined (COLLECT_TIME_STATISTICS) +#include +#include +#endif + static void write_time (void) { @@ -486,9 +491,12 @@ write_time (void) static grub_uint64_t prev; grub_uint64_t cur; static int tmrfd = -1; + struct tms tm; if (tmrfd < 0) tmrfd = open ("time.txt", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); - cur = grub_get_time_ms (); + + times (&tm); + cur = (tm.tms_utime * 1000ULL) / sysconf(_SC_CLK_TCK); grub_snprintf (buf, sizeof (buf), "%s_%dx%dx%s:%d: %" PRIuGRUB_UINT64_T " ms\n", basename, capt_mode_info.width, diff --git a/grub-core/video/fb/fbblit.c b/grub-core/video/fb/fbblit.c index c206ac872..789507e28 100644 --- a/grub-core/video/fb/fbblit.c +++ b/grub-core/video/fb/fbblit.c @@ -1085,15 +1085,9 @@ grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst, { color = *srcptr++; -#ifdef GRUB_CPU_WORDS_BIGENDIAN - sb = (color >> 0) & 0xFF; - sg = (color >> 8) & 0xFF; - sr = (color >> 16) & 0xFF; -#else sr = (color >> 0) & 0xFF; sg = (color >> 8) & 0xFF; sb = (color >> 16) & 0xFF; -#endif color = grub_video_fb_map_rgb(sr, sg, sb); *dstptr++ = color & 0xFF; diff --git a/include/grub/emu/export.h b/include/grub/emu/export.h index 7f9e4e158..4da9c4758 100644 --- a/include/grub/emu/export.h +++ b/include/grub/emu/export.h @@ -5,3 +5,5 @@ void EXPORT_FUNC (write) (void); void EXPORT_FUNC (ioctl) (void); void EXPORT_FUNC (__errno_location) (void); void EXPORT_FUNC (strerror) (void); +void EXPORT_FUNC (sysconf) (void); +void EXPORT_FUNC (times) (void); diff --git a/include/grub/unicode.h b/include/grub/unicode.h index 3d79c4c5e..d38ddbf62 100644 --- a/include/grub/unicode.h +++ b/include/grub/unicode.h @@ -132,21 +132,33 @@ enum grub_comb_type GRUB_UNICODE_COMB_MN = 255, }; +struct grub_unicode_combining +{ + grub_uint32_t code:21; + enum grub_comb_type type:8; +}; /* This structure describes a glyph as opposed to character. */ struct grub_unicode_glyph { - grub_uint32_t base; - grub_uint16_t variant:9; - grub_uint8_t attributes:5; - grub_size_t ncomb; - grub_size_t orig_pos; - struct grub_unicode_combining { - grub_uint32_t code; - enum grub_comb_type type; - } *combining; + grub_uint32_t base:23; /* minimum: 21 */ + grub_uint16_t variant:9; /* minimum: 9 */ + + grub_uint8_t attributes:5; /* minimum: 5 */ + grub_uint8_t bidi_level:6; /* minimum: 6 */ + enum grub_bidi_type bidi_type:5; /* minimum: :5 */ + + unsigned ncomb:8; /* Hint by unicode subsystem how wide this character usually is. Real width is determined by font. Set only in UTF-8 stream. */ - int estimated_width; + int estimated_width:8; + + grub_size_t orig_pos; + union + { + struct grub_unicode_combining combining_inline[sizeof (void *) + / sizeof (struct grub_unicode_combining)]; + struct grub_unicode_combining *combining_ptr; + }; }; #define GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR 0x1 @@ -253,6 +265,24 @@ grub_size_t grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, struct grub_unicode_glyph *out); +static inline const struct grub_unicode_combining * +grub_unicode_get_comb (const struct grub_unicode_glyph *in) +{ + if (in->ncomb == 0) + return NULL; + if (in->ncomb > ARRAY_SIZE (in->combining_inline)) + return in->combining_ptr; + return in->combining_inline; +} + +static inline void +grub_unicode_destroy_glyph (struct grub_unicode_glyph *glyph) +{ + if (glyph->ncomb > ARRAY_SIZE (glyph->combining_inline)) + grub_free (glyph->combining_ptr); + glyph->ncomb = 0; +} + static inline struct grub_unicode_glyph * grub_unicode_glyph_dup (const struct grub_unicode_glyph *in) { @@ -260,17 +290,20 @@ grub_unicode_glyph_dup (const struct grub_unicode_glyph *in) if (!out) return NULL; grub_memcpy (out, in, sizeof (*in)); - if (in->combining) + if (in->ncomb > ARRAY_SIZE (out->combining_inline)) { - out->combining = grub_malloc (in->ncomb * sizeof (out->combining[0])); - if (!out->combining) + out->combining_ptr = grub_malloc (in->ncomb * sizeof (out->combining_ptr[0])); + if (!out->combining_ptr) { grub_free (out); return NULL; } - grub_memcpy (out->combining, in->combining, - in->ncomb * sizeof (out->combining[0])); + grub_memcpy (out->combining_ptr, in->combining_ptr, + in->ncomb * sizeof (out->combining_ptr[0])); } + else + grub_memcpy (&out->combining_inline, &in->combining_inline, + sizeof (out->combining_inline)); return out; } @@ -279,14 +312,17 @@ grub_unicode_set_glyph (struct grub_unicode_glyph *out, const struct grub_unicode_glyph *in) { grub_memcpy (out, in, sizeof (*in)); - if (in->combining) + if (in->ncomb > ARRAY_SIZE (out->combining_inline)) { - out->combining = grub_malloc (in->ncomb * sizeof (out->combining[0])); - if (!out->combining) + out->combining_ptr = grub_malloc (in->ncomb * sizeof (out->combining_ptr[0])); + if (!out->combining_ptr) return; - grub_memcpy (out->combining, in->combining, - in->ncomb * sizeof (out->combining[0])); + grub_memcpy (out->combining_ptr, in->combining_ptr, + in->ncomb * sizeof (out->combining_ptr[0])); } + else + grub_memcpy (&out->combining_inline, &in->combining_inline, + sizeof (out->combining_inline)); } static inline struct grub_unicode_glyph * From 310d42144b04d8362b629edbc31e3baf806ff28e Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 5 May 2013 11:31:53 +0200 Subject: [PATCH 156/187] Factor-out human-size printing. --- ChangeLog | 4 ++++ grub-core/commands/ls.c | 31 +------------------------------ grub-core/normal/misc.c | 34 ++++++++++++++++++++++++++++++++++ include/grub/normal.h | 3 +++ 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57bce5008..c9e6f06a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-05 Vladimir Serbinenko + + Factor-out human-size printing. + 2013-05-04 Vladimir Serbinenko Agglomerate more mallocs to speed-up gfxterm. diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c index 83930aabf..6c608f6da 100644 --- a/grub-core/commands/ls.c +++ b/grub-core/commands/ls.c @@ -43,8 +43,6 @@ static const struct grub_arg_option options[] = {0, 0, 0, 0, 0, 0} }; -static const char grub_human_sizes[] = {' ', 'K', 'M', 'G', 'T'}; - /* Helper for grub_ls_list_devices. */ static int grub_ls_print_devices (const char *name, void *data) @@ -143,34 +141,7 @@ print_files_long (const char *filename, const struct grub_dirhook_info *info, if (! ctx->human) grub_printf ("%-12llu", (unsigned long long) file->size); else - { - grub_uint64_t fsize = file->size * 100ULL; - grub_uint64_t fsz = file->size; - int units = 0; - char buf[20]; - - while (fsz / 1024) - { - fsize = (fsize + 512) / 1024; - fsz /= 1024; - units++; - } - - if (units) - { - grub_uint64_t whole, fraction; - - whole = grub_divmod64 (fsize, 100, &fraction); - grub_snprintf (buf, sizeof (buf), - "%" PRIuGRUB_UINT64_T - ".%02" PRIuGRUB_UINT64_T "%c", whole, fraction, - grub_human_sizes[units]); - grub_printf ("%-12s", buf); - } - else - grub_printf ("%-12llu", (unsigned long long) file->size); - - } + grub_printf ("%-12s", grub_get_human_size (file->size, 1)); grub_file_close (file); grub_free (pathname); } diff --git a/grub-core/normal/misc.c b/grub-core/normal/misc.c index d23de62e6..1a86e0f8c 100644 --- a/grub-core/normal/misc.c +++ b/grub-core/normal/misc.c @@ -28,6 +28,40 @@ #include #include +static const char *grub_human_sizes[] = {N_("B"), N_("KiB"), N_("MiB"), N_("GiB"), N_("TiB")}; +static const char *grub_human_short_sizes[] = {"", "K", "M", "G", "T"}; + +const char * +grub_get_human_size (grub_uint64_t size, int sh) +{ + grub_uint64_t fsize = size * 100ULL; + grub_uint64_t fsz = size; + int units = 0; + static char buf[20]; + + while (fsz / 1024) + { + fsize = (fsize + 512) / 1024; + fsz /= 1024; + units++; + } + + if (units) + { + grub_uint64_t whole, fraction; + + whole = grub_divmod64 (fsize, 100, &fraction); + grub_snprintf (buf, sizeof (buf), + "%" PRIuGRUB_UINT64_T + ".%02" PRIuGRUB_UINT64_T "%s", whole, fraction, + sh ? grub_human_short_sizes[units] : _(grub_human_sizes[units])); + } + else + grub_snprintf (buf, sizeof (buf), "%llu%s", (unsigned long long) size, + sh ? grub_human_short_sizes[units] : _(grub_human_sizes[units])); + return buf; +} + /* Print the information on the device NAME. */ grub_err_t grub_normal_print_device_info (const char *name) diff --git a/include/grub/normal.h b/include/grub/normal.h index 4fcc3da66..930b3b93e 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -150,4 +150,7 @@ grub_dyncmd_get_cmd (grub_command_t cmd); void grub_gettext_reread_prefix (const char *val); +const char * +grub_get_human_size (grub_uint64_t size, int sh); + #endif /* ! GRUB_NORMAL_HEADER */ From fa2923436bee4e1aa95ed2a76827d33e53f0cacc Mon Sep 17 00:00:00 2001 From: Bean Date: Sun, 5 May 2013 18:16:48 +0200 Subject: [PATCH 157/187] * grub-core/commands/testspeed.c: New command testspeed. --- ChangeLog | 4 ++ grub-core/Makefile.core.def | 4 ++ grub-core/commands/ls.c | 3 +- grub-core/commands/testspeed.c | 115 +++++++++++++++++++++++++++++++++ grub-core/normal/misc.c | 44 +++++++++---- include/grub/normal.h | 9 ++- 6 files changed, 165 insertions(+), 14 deletions(-) create mode 100644 grub-core/commands/testspeed.c diff --git a/ChangeLog b/ChangeLog index c9e6f06a5..b79c57ae6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-05 Bean + + * grub-core/commands/testspeed.c: New command testspeed. + 2013-05-05 Vladimir Serbinenko Factor-out human-size printing. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 469524fe0..56a1ec331 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2019,3 +2019,7 @@ module = { enable = i386; }; +module = { + name = testspeed; + common = commands/testspeed.c; +}; diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c index 6c608f6da..0eaf83652 100644 --- a/grub-core/commands/ls.c +++ b/grub-core/commands/ls.c @@ -141,7 +141,8 @@ print_files_long (const char *filename, const struct grub_dirhook_info *info, if (! ctx->human) grub_printf ("%-12llu", (unsigned long long) file->size); else - grub_printf ("%-12s", grub_get_human_size (file->size, 1)); + grub_printf ("%-12s", grub_get_human_size (file->size, + GRUB_HUMAN_SIZE_SHORT)); grub_file_close (file); grub_free (pathname); } diff --git a/grub-core/commands/testspeed.c b/grub-core/commands/testspeed.c new file mode 100644 index 000000000..d45fa7c05 --- /dev/null +++ b/grub-core/commands/testspeed.c @@ -0,0 +1,115 @@ +/* testspeed.c - Command to test file read speed */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2012 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +#define DEFAULT_BLOCK_SIZE 65536 + +static const struct grub_arg_option options[] = + { + {"size", 's', 0, N_("Specify size for each read operation"), 0, ARG_TYPE_INT}, + {0, 0, 0, 0, 0, 0} + }; + +static grub_err_t +grub_cmd_testspeed (grub_extcmd_context_t ctxt, int argc, char **args) +{ + struct grub_arg_list *state = ctxt->state; + grub_uint64_t start; + grub_uint64_t end; + grub_ssize_t block_size; + grub_disk_addr_t total_size; + char *buffer; + grub_file_t file; + grub_uint64_t whole, fraction; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); + + block_size = (state[0].set) ? + grub_strtoul (state[0].arg, 0, 0) : DEFAULT_BLOCK_SIZE; + + if (block_size <= 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid block size")); + + buffer = grub_malloc (block_size); + if (buffer == NULL) + return grub_errno; + + file = grub_file_open (args[0]); + if (file == NULL) + goto quit; + + total_size = 0; + start = grub_get_time_ms (); + while (1) + { + grub_ssize_t size = grub_file_read (file, buffer, block_size); + if (size <= 0) + break; + total_size += size; + } + end = grub_get_time_ms (); + grub_file_close (file); + + grub_printf_ (N_("File size: %s\n"), + grub_get_human_size (total_size, GRUB_HUMAN_SIZE_NORMAL)); + whole = grub_divmod64 (end - start, 1000, &fraction); + grub_printf_ (N_("Elapsed time: %llu.%03llu s \n"), + (unsigned long long) whole, + (unsigned long long) fraction); + + if (end != start) + { + grub_uint64_t speed = + grub_divmod64 (total_size * 100ULL * 1000ULL, end - start, 0); + + grub_printf_ (N_("Speed: %s \n"), + grub_get_human_size (speed, + GRUB_HUMAN_SIZE_SPEED)); + } + + quit: + grub_free (buffer); + + return grub_errno; +} + +static grub_extcmd_t cmd; + +GRUB_MOD_INIT(testspeed) +{ + cmd = grub_register_extcmd ("testspeed", grub_cmd_testspeed, 0, N_("[-s SIZE] FILENAME"), + N_("Test file read speed."), + options); +} + +GRUB_MOD_FINI(testspeed) +{ + grub_unregister_extcmd (cmd); +} diff --git a/grub-core/normal/misc.c b/grub-core/normal/misc.c index 1a86e0f8c..bc6ce170b 100644 --- a/grub-core/normal/misc.c +++ b/grub-core/normal/misc.c @@ -28,25 +28,45 @@ #include #include -static const char *grub_human_sizes[] = {N_("B"), N_("KiB"), N_("MiB"), N_("GiB"), N_("TiB")}; -static const char *grub_human_short_sizes[] = {"", "K", "M", "G", "T"}; +static const char *grub_human_sizes[3][6] = + { + /* This algorithm in reality would work only up to (2^64) / 100 B = 81 PiB. + Put here all possible suffixes it can produce so no array bounds check + is needed. + */ + /* TRANSLATORS: that's the list of binary unit prefixes. */ + { N_("B"), N_("KiB"), N_("MiB"), N_("GiB"), N_("TiB"), N_("PiB")}, + /* TRANSLATORS: that's the list of binary unit prefixes. */ + { "", N_("K"), N_("M"), N_("G"), N_("T"), N_("P") }, + /* TRANSLATORS: that's the list of binary unit prefixes. */ + { N_("B/s"), N_("KiB/s"), N_("MiB/s"), N_("GiB/s"), N_("TiB/s"), N_("PiB/s"), }, + }; const char * -grub_get_human_size (grub_uint64_t size, int sh) +grub_get_human_size (grub_uint64_t size, enum grub_human_size_type type) { - grub_uint64_t fsize = size * 100ULL; - grub_uint64_t fsz = size; - int units = 0; - static char buf[20]; + grub_uint64_t fsize; + unsigned units = 0; + static char buf[30]; + const char *umsg; - while (fsz / 1024) + if (type != GRUB_HUMAN_SIZE_SPEED) + fsize = size * 100ULL; + else + fsize = size; + + /* Since 2^64 / 1024^5 < 102400, this can give at most 5 iterations. + So units <=5, so impossible to go past the end of array. + */ + while (fsize >= 102400) { fsize = (fsize + 512) / 1024; - fsz /= 1024; units++; } - if (units) + umsg = _(grub_human_sizes[type][units]); + + if (units || type == GRUB_HUMAN_SIZE_SPEED) { grub_uint64_t whole, fraction; @@ -54,11 +74,11 @@ grub_get_human_size (grub_uint64_t size, int sh) grub_snprintf (buf, sizeof (buf), "%" PRIuGRUB_UINT64_T ".%02" PRIuGRUB_UINT64_T "%s", whole, fraction, - sh ? grub_human_short_sizes[units] : _(grub_human_sizes[units])); + umsg); } else grub_snprintf (buf, sizeof (buf), "%llu%s", (unsigned long long) size, - sh ? grub_human_short_sizes[units] : _(grub_human_sizes[units])); + umsg); return buf; } diff --git a/include/grub/normal.h b/include/grub/normal.h index 930b3b93e..c32bc96a0 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -150,7 +150,14 @@ grub_dyncmd_get_cmd (grub_command_t cmd); void grub_gettext_reread_prefix (const char *val); +enum grub_human_size_type + { + GRUB_HUMAN_SIZE_NORMAL, + GRUB_HUMAN_SIZE_SHORT, + GRUB_HUMAN_SIZE_SPEED, + }; + const char * -grub_get_human_size (grub_uint64_t size, int sh); +grub_get_human_size (grub_uint64_t size, enum grub_human_size_type type); #endif /* ! GRUB_NORMAL_HEADER */ From 5945c2f8496cab51b64ed9bd35d494dc04b8e5a6 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Mon, 6 May 2013 22:13:34 +0400 Subject: [PATCH 158/187] Reimplement grub-reboot to not depend on saved_entry. Use next_entry variable for one time boot menu entry. --- ChangeLog | 5 +++++ util/grub-reboot.in | 17 ++++++----------- util/grub-set-default.in | 1 + util/grub.d/00_header.in | 14 +++++++++++++- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index b79c57ae6..16c54048c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-06 Andrey Borzenkov + + Reimplement grub-reboot to not depend on saved_entry. Use next_entry + variable for one time boot menu entry. + 2013-05-05 Bean * grub-core/commands/testspeed.c: New command testspeed. diff --git a/util/grub-reboot.in b/util/grub-reboot.in index 1a91d369a..d132e4f30 100644 --- a/util/grub-reboot.in +++ b/util/grub-reboot.in @@ -46,8 +46,6 @@ export TEXTDOMAINDIR="@localedir@" usage () { gettext_printf "Usage: %s [OPTION] MENU_ENTRY\n" "$self" gettext "Set the default boot menu entry for GRUB, for the next boot only."; echo - gettext_printf "This requires setting GRUB_DEFAULT=saved in %s/default/grub.\n" "$sysconfdir" - echo print_option_help "-h, --help" "$(gettext "print this message and exit")" print_option_help "-v, --version" "$(gettext "print the version information and exit")" dirmsg="$(gettext_printf "expect GRUB images under the directory DIR/%s instead of the %s directory" "@grubdirname@" "$grubdir")" @@ -129,17 +127,14 @@ fi grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'` -prev_saved_entry=`$grub_editenv ${grubdir}/grubenv list | sed -n 's/^saved_entry=//p'` +# Restore saved_entry if it was set by previous version +prev_saved_entry=`$grub_editenv ${grubdir}/grubenv list | sed -n 's/^prev_saved_entry=//p'` if [ "$prev_saved_entry" ]; then - $grub_editenv ${grubdir}/grubenv set prev_saved_entry="$prev_saved_entry" -else - # We need some non-empty value for prev_saved_entry so that GRUB will - # recognise that grub-reboot has been used and restore the previous - # saved entry. "0" is the same as an empty value, i.e. the first menu - # entry. - $grub_editenv ${grubdir}/grubenv set prev_saved_entry=0 + $grub_editenv ${grubdir}/grubenv set saved_entry="$prev_saved_entry" + $grub_editenv ${grubdir}/grubenv unset prev_saved_entry fi -$grub_editenv ${grubdir}/grubenv set saved_entry="$entry" + +$grub_editenv ${grubdir}/grubenv set next_entry="$entry" # Bye. exit 0 diff --git a/util/grub-set-default.in b/util/grub-set-default.in index ea18da14f..d607318ed 100644 --- a/util/grub-set-default.in +++ b/util/grub-set-default.in @@ -130,6 +130,7 @@ fi grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'` $grub_editenv ${grubdir}/grubenv unset prev_saved_entry +$grub_editenv ${grubdir}/grubenv unset next_entry $grub_editenv ${grubdir}/grubenv set saved_entry="$entry" # Bye. diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index 3da5d123f..2c4bb0a6f 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -51,13 +51,25 @@ if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then cat < Date: Tue, 7 May 2013 11:26:15 +0200 Subject: [PATCH 159/187] * grub-core/font/font.c: Use grub_dprintf for debug statements rather than printf. --- ChangeLog | 5 +++++ grub-core/font/font.c | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16c54048c..0fa3be0cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-07 Vladimir Serbinenko + + * grub-core/font/font.c: Use grub_dprintf for debug statements rather + than printf. + 2013-05-06 Andrey Borzenkov Reimplement grub-reboot to not depend on saved_entry. Use next_entry diff --git a/grub-core/font/font.c b/grub-core/font/font.c index 50b1799b1..3a380b9a9 100644 --- a/grub-core/font/font.c +++ b/grub-core/font/font.c @@ -293,7 +293,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct grub_uint32_t last_code; #if FONT_DEBUG >= 2 - grub_printf ("load_font_index(sect_length=%d)\n", sect_length); + grub_dprintf ("font", "load_font_index(sect_length=%d)\n", sect_length); #endif /* Sanity check: ensure section length is divisible by the entry size. */ @@ -321,7 +321,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct #if FONT_DEBUG >= 2 - grub_printf ("num_chars=%d)\n", font->num_chars); + grub_dprintf ("font", "num_chars=%d)\n", font->num_chars); #endif last_code = 0; @@ -365,7 +365,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct #if FONT_DEBUG >= 5 /* Print the 1st 10 characters. */ if (i < 10) - grub_printf ("c=%d o=%d\n", entry->code, entry->offset); + grub_dprintf ("font", "c=%d o=%d\n", entry->code, entry->offset); #endif } @@ -431,7 +431,7 @@ grub_font_load (const char *filename) grub_font_t font = 0; #if FONT_DEBUG >= 1 - grub_printf ("add_font(%s)\n", filename); + grub_dprintf ("font", "add_font(%s)\n", filename); #endif if (filename[0] == '(' || filename[0] == '/' || filename[0] == '+') @@ -462,7 +462,7 @@ grub_font_load (const char *filename) goto fail; #if FONT_DEBUG >= 3 - grub_printf ("file opened\n"); + grub_dprintf ("font", "file opened\n"); #endif /* Read the FILE section. It indicates the file format. */ @@ -470,7 +470,7 @@ grub_font_load (const char *filename) goto fail; #if FONT_DEBUG >= 3 - grub_printf ("opened FILE section\n"); + grub_dprintf ("font", "opened FILE section\n"); #endif if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FILE, sizeof (FONT_FORMAT_SECTION_NAMES_FILE) - 1) != 0) @@ -481,7 +481,7 @@ grub_font_load (const char *filename) } #if FONT_DEBUG >= 3 - grub_printf ("section name ok\n"); + grub_dprintf ("font", "section name ok\n"); #endif if (section.length != 4) { @@ -492,14 +492,14 @@ grub_font_load (const char *filename) } #if FONT_DEBUG >= 3 - grub_printf ("section length ok\n"); + grub_dprintf ("font", "section length ok\n"); #endif /* Check the file format type code. */ if (grub_file_read (file, magic, 4) != 4) goto fail; #if FONT_DEBUG >= 3 - grub_printf ("read magic ok\n"); + grub_dprintf ("font", "read magic ok\n"); #endif if (grub_memcmp (magic, FONT_FORMAT_PFF2_MAGIC, 4) != 0) @@ -510,7 +510,7 @@ grub_font_load (const char *filename) } #if FONT_DEBUG >= 3 - grub_printf ("compare magic ok\n"); + grub_dprintf ("font", "compare magic ok\n"); #endif /* Allocate the font object. */ @@ -522,7 +522,7 @@ grub_font_load (const char *filename) font->file = file; #if FONT_DEBUG >= 3 - grub_printf ("allocate font ok; loading font info\n"); + grub_dprintf ("font", "allocate font ok; loading font info\n"); #endif /* Load the font information. */ @@ -537,7 +537,7 @@ grub_font_load (const char *filename) } #if FONT_DEBUG >= 2 - grub_printf ("opened section %c%c%c%c ok\n", + grub_dprintf ("font", "opened section %c%c%c%c ok\n", section.name[0], section.name[1], section.name[2], section.name[3]); #endif @@ -621,7 +621,7 @@ grub_font_load (const char *filename) { /* Unhandled section type, simply skip past it. */ #if FONT_DEBUG >= 3 - grub_printf ("Unhandled section type, skipping.\n"); + grub_dprintf ("font", "Unhandled section type, skipping.\n"); #endif grub_off_t section_end = grub_file_tell (file) + section.length; if ((int) grub_file_seek (file, section_end) == -1) @@ -636,7 +636,7 @@ grub_font_load (const char *filename) } #if FONT_DEBUG >= 1 - grub_printf ("Loaded font `%s'.\n" + grub_dprintf ("font", "Loaded font `%s'.\n" "Ascent=%d Descent=%d MaxW=%d MaxH=%d Number of characters=%d.\n", font->name, font->ascent, font->descent, From 1eed0e6ebc4c1d79872ffce2505744e78c73007d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 11:30:48 +0200 Subject: [PATCH 160/187] * tests/priority_queue_unit_test.cc: New test. --- ChangeLog | 4 ++ Makefile.util.def | 17 +++++ configure.ac | 5 ++ grub-core/lib/priority_queue.c | 94 -------------------------- include/grub/misc.h | 2 +- include/grub/priority_queue.h | 8 +++ include/grub/test.h | 8 +++ tests/priority_queue_unit_test.cc | 105 ++++++++++++++++++++++++++++++ 8 files changed, 148 insertions(+), 95 deletions(-) create mode 100644 tests/priority_queue_unit_test.cc diff --git a/ChangeLog b/ChangeLog index 0fa3be0cd..0fe18bb39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + * tests/priority_queue_unit_test.cc: New test. + 2013-05-07 Vladimir Serbinenko * grub-core/font/font.c: Use grub_dprintf for debug statements rather diff --git a/Makefile.util.def b/Makefile.util.def index d0ae67f72..086ca1285 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -857,6 +857,23 @@ program = { ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; }; +program = { + testcase; + name = priority_queue_unit_test; + common = tests/priority_queue_unit_test.cc; + common = tests/lib/unit_test.c; + common = grub-core/kern/list.c; + common = grub-core/kern/misc.c; + common = grub-core/tests/lib/test.c; + common = grub-core/lib/priority_queue.c; + ldadd = libgrubmods.a; + ldadd = libgrubgcry.a; + ldadd = libgrubkern.a; + ldadd = grub-core/gnulib/libgnu.a; + ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + condition = COND_HAVE_CXX; +}; + program = { testcase; name = cmp_test; diff --git a/configure.ac b/configure.ac index 00540e6be..6c310f779 100644 --- a/configure.ac +++ b/configure.ac @@ -320,12 +320,15 @@ AC_PATH_PROGS(MAKEINFO, makeinfo true) AC_PROG_CC gl_EARLY +AC_PROG_CXX AM_PROG_CC_C_O AM_PROG_AS # Must be GCC. test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) +AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no) + AC_GNU_SOURCE AM_GNU_GETTEXT([external]) AC_SYS_LARGEFILE @@ -1178,6 +1181,8 @@ AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1]) AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1]) +AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes]) + AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1]) AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin]) AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x]) diff --git a/grub-core/lib/priority_queue.c b/grub-core/lib/priority_queue.c index a790910a8..659be0b7f 100644 --- a/grub-core/lib/priority_queue.c +++ b/grub-core/lib/priority_queue.c @@ -16,37 +16,12 @@ * along with GRUB. If not, see . */ -#ifndef TEST #include #include #include GRUB_MOD_LICENSE ("GPLv3+"); -#else -#include -#include -#include - -#include - -using namespace std; - -typedef size_t grub_size_t; -typedef int (*grub_comparator_t) (const void *a, const void *b); -typedef unsigned char grub_uint8_t; -#define grub_malloc malloc -#define grub_memcpy memcpy -#define grub_realloc realloc -#define grub_free free - -typedef enum - { - GRUB_ERR_NONE, - grub_errno - } grub_err_t; -#endif - struct grub_priority_queue { grub_size_t elsize; @@ -56,10 +31,6 @@ struct grub_priority_queue void *els; }; -#ifdef TEST -typedef struct grub_priority_queue *grub_priority_queue_t; -#endif - static inline void * element (struct grub_priority_queue *pq, grub_size_t k) { @@ -189,69 +160,4 @@ grub_priority_queue_pop (grub_priority_queue_t pq) } } -#ifdef TEST -static int -compar (const void *a_, const void *b_) -{ - int a = *(int *) a_; - int b = *(int *) b_; - if (a < b) - return -1; - if (a > b) - return +1; - return 0; -} - -int -main (void) -{ - priority_queue pq; - grub_priority_queue_t pq2; - int counter; - int s = 0; - pq2 = grub_priority_queue_new (sizeof (int), compar); - if (!pq2) - return 1; - srand (1); - - for (counter = 0; counter < 1000000; counter++) - { - int op = rand () % 10; - if (s && *(int *) grub_priority_queue_top (pq2) != pq.top ()) - { - printf ("Error at %d\n", counter); - return 2; - } - if (op < 3 && s) - { - grub_priority_queue_pop (pq2); - pq.pop (); - s--; - } - else - { - int v = rand (); - int e; - pq.push (v); - e = grub_priority_queue_push (pq2, &v); - if (e) - return 3; - s++; - } - } - while (s) - { - if (*(int *) grub_priority_queue_top (pq2) != pq.top ()) - { - printf ("Error at the end. %d elements remaining.\n", s); - return 4; - } - grub_priority_queue_pop (pq2); - pq.pop (); - s--; - } - printf ("All tests passed successfully\n"); - return 0; -} -#endif diff --git a/include/grub/misc.h b/include/grub/misc.h index c191c1f51..9d7f2121d 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -392,7 +392,7 @@ void EXPORT_FUNC (__deregister_frame_info) (void); static inline char * grub_memchr (const void *p, int c, grub_size_t len) { - const char *s = p; + const char *s = (const char *) p; const char *e = s + len; for (; s < e; s++) diff --git a/include/grub/priority_queue.h b/include/grub/priority_queue.h index a5d98c8c9..64cbc4512 100644 --- a/include/grub/priority_queue.h +++ b/include/grub/priority_queue.h @@ -22,6 +22,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct grub_priority_queue; typedef struct grub_priority_queue *grub_priority_queue_t; typedef int (*grub_comparator_t) (const void *a, const void *b); @@ -33,4 +37,8 @@ void *grub_priority_queue_top (grub_priority_queue_t pq); void grub_priority_queue_pop (grub_priority_queue_t pq); grub_err_t grub_priority_queue_push (grub_priority_queue_t pq, const void *el); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/grub/test.h b/include/grub/test.h index cc4e4a82a..8df85d010 100644 --- a/include/grub/test.h +++ b/include/grub/test.h @@ -28,6 +28,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct grub_test { /* The next test. */ @@ -108,4 +112,8 @@ grub_video_checksum_get_modename (void); #define GRUB_TEST_VIDEO_SMALL_N_MODES 6 extern struct grub_video_mode_info grub_test_video_modes[30]; +#ifdef __cplusplus +} +#endif + #endif /* ! GRUB_TEST_HEADER */ diff --git a/tests/priority_queue_unit_test.cc b/tests/priority_queue_unit_test.cc new file mode 100644 index 000000000..bb0060e5e --- /dev/null +++ b/tests/priority_queue_unit_test.cc @@ -0,0 +1,105 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +using namespace std; + +static int +compar (const void *a_, const void *b_) +{ + int a = *(int *) a_; + int b = *(int *) b_; + if (a < b) + return -1; + if (a > b) + return +1; + return 0; +} + +static void +priority_queue_test (void) +{ + priority_queue pq; + grub_priority_queue_t pq2; + int counter; + int s = 0; + pq2 = grub_priority_queue_new (sizeof (int), compar); + if (!pq2) + { + grub_test_assert (0, + "priority queue: queue creating failed\n"); + return; + } + srand (1); + + for (counter = 0; counter < 1000000; counter++) + { + int op = rand () % 10; + if (s && *(int *) grub_priority_queue_top (pq2) != pq.top ()) + { + printf ("Error at %d\n", counter); + grub_test_assert (0, + "priority queue: error at %d\n", counter); + return; + } + if (op < 3 && s) + { + grub_priority_queue_pop (pq2); + pq.pop (); + s--; + } + else + { + int v = rand (); + pq.push (v); + if (grub_priority_queue_push (pq2, &v) != 0) + { + grub_test_assert (0, + "priority queue: push failed"); + return; + } + s++; + } + } + while (s) + { + if (*(int *) grub_priority_queue_top (pq2) != pq.top ()) + { + grub_test_assert (0, + "priority queue: Error at the end. %d elements remaining.\n", s); + return; + } + grub_priority_queue_pop (pq2); + pq.pop (); + s--; + } + printf ("priority_queue: passed successfully\n"); +} + +GRUB_UNIT_TEST ("priority_queue_unit_test", priority_queue_test); From 47cf82b4617aced7a9b6db83024629df3f28bc96 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 11:37:11 +0200 Subject: [PATCH 161/187] * grub-core/video/readers/jpeg.c: Use grub_dprintf for debug statements rather than printf. * grub-core/video/readers/tga.c: Likewise. --- ChangeLog | 6 ++++++ grub-core/video/readers/jpeg.c | 4 +--- grub-core/video/readers/tga.c | 6 ++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0fe18bb39..04a2f000d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-05-07 Vladimir Serbinenko + + * grub-core/video/readers/jpeg.c: Use grub_dprintf for debug statements + rather than printf. + * grub-core/video/readers/tga.c: Likewise. + 2013-05-07 Vladimir Serbinenko * tests/priority_queue_unit_test.cc: New test. diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c index 33f28c32b..0067b7dc1 100644 --- a/grub-core/video/readers/jpeg.c +++ b/grub-core/video/readers/jpeg.c @@ -693,9 +693,7 @@ grub_jpeg_decode_jpeg (struct grub_jpeg_data *data) if (grub_errno) break; -#ifdef JPEG_DEBUG - grub_printf ("jpeg marker: %x\n", marker); -#endif + grub_dprintf ("jpeg", "jpeg marker: %x\n", marker); switch (marker) { diff --git a/grub-core/video/readers/tga.c b/grub-core/video/readers/tga.c index 84be68a0a..5aa4c7dc2 100644 --- a/grub-core/video/readers/tga.c +++ b/grub-core/video/readers/tga.c @@ -29,8 +29,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); /* Uncomment following define to enable TGA debug. */ //#define TGA_DEBUG +#define dump_int_field(x) grub_dprintf ("tga", #x " = %d (0x%04x)\n", x, x); #if defined(TGA_DEBUG) -#define dump_int_field(x) grub_printf( #x " = %d (0x%04x)\n", x, x); static grub_command_t cmd; #endif @@ -347,8 +347,7 @@ grub_video_reader_tga (struct grub_video_bitmap **bitmap, return grub_errno; } -#if defined(TGA_DEBUG) - grub_printf("tga: header\n"); + grub_dprintf("tga", "tga: header\n"); dump_int_field(header.id_length); dump_int_field(header.color_map_type); dump_int_field(header.image_type); @@ -361,7 +360,6 @@ grub_video_reader_tga (struct grub_video_bitmap **bitmap, dump_int_field(header.image_height); dump_int_field(header.image_bpp); dump_int_field(header.image_descriptor); -#endif /* Check that bitmap encoding is supported. */ switch (header.image_type) From e34092fdf11fcbb9412a4187d99f67dec845d8b0 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 11:38:49 +0200 Subject: [PATCH 162/187] * grub-core/loader/linux.c: Use grub_dprintf for debug statements rather than printf. --- ChangeLog | 5 +++++ grub-core/loader/linux.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 04a2f000d..fc647b886 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-07 Vladimir Serbinenko + + * grub-core/loader/linux.c: Use grub_dprintf for debug statements + rather than printf. + 2013-05-07 Vladimir Serbinenko * grub-core/video/readers/jpeg.c: Use grub_dprintf for debug statements diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c index cbe3c5363..af067a5a4 100644 --- a/grub-core/loader/linux.c +++ b/grub-core/loader/linux.c @@ -126,7 +126,7 @@ insert_dir (const char *name, struct dir **root, n->name = grub_strndup (cb, ce - cb); if (ptr) { - grub_printf ("Creating directory %s, %s\n", name, ce); + grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce); ptr = make_header (ptr, name, ce - name, 040777, 0); } From d22840ec12357b08f595aadf18364aba95f2fa0d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 11:41:47 +0200 Subject: [PATCH 163/187] Mark few forgotten strings for translation. --- ChangeLog | 4 ++++ grub-core/commands/acpihalt.c | 4 ++-- grub-core/commands/nativedisk.c | 2 +- grub-core/loader/i386/pc/freedos.c | 2 +- grub-core/normal/misc.c | 4 +++- util/grub-render-label.c | 6 +++--- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc647b886..9c8a14a11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + Mark few forgotten strings for translation. + 2013-05-07 Vladimir Serbinenko * grub-core/loader/linux.c: Use grub_dprintf for debug statements diff --git a/grub-core/commands/acpihalt.c b/grub-core/commands/acpihalt.c index a8014de14..6f156fd05 100644 --- a/grub-core/commands/acpihalt.c +++ b/grub-core/commands/acpihalt.c @@ -311,13 +311,13 @@ main (int argc, char **argv) buf = malloc (len); if (!buf) { - printf ("Couldn't malloc buffer\n"); + printf (_("error: %s.\n"), _("out of memory")); fclose (f); return 2; } if (fread (buf, 1, len, f) != len) { - printf ("Read failed\n"); + printf (_("cannot read `%s': %s"), strerror (errno)); free (buf); fclose (f); return 2; diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c index 453faadea..71d7bc410 100644 --- a/grub-core/commands/nativedisk.c +++ b/grub-core/commands/nativedisk.c @@ -301,7 +301,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(nativedisk) { - cmd = grub_register_command ("nativedisk", grub_cmd_nativedisk, "[MODULE1 MODULE2 ...]", + cmd = grub_register_command ("nativedisk", grub_cmd_nativedisk, N_("[MODULE1 MODULE2 ...]"), N_("Switch to native disk drivers. If no modules are specified default set (pata,ahci,usbms,ohci,uhci,ehci) is used")); } diff --git a/grub-core/loader/i386/pc/freedos.c b/grub-core/loader/i386/pc/freedos.c index e685c6e1d..478f3c513 100644 --- a/grub-core/loader/i386/pc/freedos.c +++ b/grub-core/loader/i386/pc/freedos.c @@ -145,7 +145,7 @@ grub_cmd_freedos (grub_command_t cmd __attribute__ ((unused)), if (kernelsyssize > GRUB_FREEDOS_MAX_SIZE) { grub_error (GRUB_ERR_BAD_OS, - N_("file `%s' is too large"), argv[0]); + N_("the size of `%s' is too large"), argv[0]); goto fail; } diff --git a/grub-core/normal/misc.c b/grub-core/normal/misc.c index bc6ce170b..34d505eda 100644 --- a/grub-core/normal/misc.c +++ b/grub-core/normal/misc.c @@ -181,7 +181,9 @@ grub_normal_print_device_info (const char *name) else grub_printf (_(" - Total size %llu%sKiB"), (unsigned long long) (grub_disk_get_size (dev->disk) >> 1), - (grub_disk_get_size (dev->disk) & 1) ? ".5" : ""); + /* TRANSLATORS: Replace dot with appropriate decimal separator for + your language. */ + (grub_disk_get_size (dev->disk) & 1) ? _(".5") : ""); grub_device_close (dev); } diff --git a/util/grub-render-label.c b/util/grub-render-label.c index 32d37746d..1b28ab7db 100644 --- a/util/grub-render-label.c +++ b/util/grub-render-label.c @@ -55,7 +55,7 @@ static struct argp_option options[] = { {"bgcolor", 'b', N_("COLOR"), 0, N_("use COLOR for background"), 0}, {"text", 't', N_("STR"), 0, - N_("supply the string."), 0}, + N_("set the label to render."), 0}, {"output", 'o', N_("FILE"), 0, N_("set output filename. Default is STDOUT"), 0}, {"font", 'f', N_("FILE"), 0, @@ -89,13 +89,13 @@ argp_parser (int key, char *arg, struct argp_state *state) case 'b': err = grub_video_parse_color (arg, &arguments->bgcolor); if (err) - grub_util_error (_("Invalud color `%s'"), arg); + grub_util_error (_("invalid color specification `%s'"), arg); break; case 'c': err = grub_video_parse_color (arg, &arguments->fgcolor); if (err) - grub_util_error (_("Invalud color `%s'"), arg); + grub_util_error (_("invalid color specification `%s'"), arg); break; case 'f': From fb2666b56041376054f03ffbfc0853ec89ac2f85 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 11:44:15 +0200 Subject: [PATCH 164/187] Simplify few strings. --- ChangeLog | 4 ++++ grub-core/fs/zfs/zfscrypt.c | 4 ++-- grub-core/lib/relocator.c | 3 ++- grub-core/loader/machoXX.c | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c8a14a11..92af2ddbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + Simplify few strings. + 2013-05-07 Vladimir Serbinenko Mark few forgotten strings for translation. diff --git a/grub-core/fs/zfs/zfscrypt.c b/grub-core/fs/zfs/zfscrypt.c index 4ea53b863..d5f9dcdbc 100644 --- a/grub-core/fs/zfs/zfscrypt.c +++ b/grub-core/fs/zfs/zfscrypt.c @@ -263,8 +263,8 @@ algo_decrypt (grub_crypto_cipher_handle_t cipher, grub_uint64_t algo, return grub_gcm_decrypt (cipher, out, in, psize, mac_out, nonce, 15 - l, m); default: - return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "algorithm %" - PRIuGRUB_UINT64_T " is not supported yet", algo); + return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "algorithm %lld is not supported yet", + (long long) algo); } } diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c index e08551403..b86a6c0dc 100644 --- a/grub-core/lib/relocator.c +++ b/grub-core/lib/relocator.c @@ -599,7 +599,8 @@ malloc_in_range (struct grub_relocator *rel, do { if (p->magic != GRUB_MM_FREE_MAGIC) - grub_fatal (__FILE__":%d free magic broken at %p (0x%x)\n", + grub_fatal ("%s:%d free magic broken at %p (0x%x)\n", + __FILE__, __LINE__, p, p->magic); if (p == (grub_mm_header_t) (r + 1)) { diff --git a/grub-core/loader/machoXX.c b/grub-core/loader/machoXX.c index 3a382b3d6..95c3fe564 100644 --- a/grub-core/loader/machoXX.c +++ b/grub-core/loader/machoXX.c @@ -55,7 +55,7 @@ SUFFIX (grub_macho_parse) (grub_macho_t macho, const char *filename) if (head.macho.magic != GRUB_MACHO_MAGIC) { - grub_error (GRUB_ERR_BAD_OS, "invalid Mach-O " XX "-bit header"); + grub_error (GRUB_ERR_BAD_OS, "invalid Mach-O header"); macho->offsetXX = -1; return; } @@ -154,7 +154,7 @@ grub_macho_cmds_iterate (grub_macho_t macho, } if (! macho->cmdsXX) - return grub_error (GRUB_ERR_BAD_OS, "couldn't find " XX "-bit Mach-O"); + return grub_error (GRUB_ERR_BAD_OS, "couldn't find Mach-O commands"); hdrs = macho->cmdsXX; for (i = 0; i < macho->ncmdsXX; i++) { From bed061426d32a01c137c9d2acbd31f874c20feb7 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 11:45:47 +0200 Subject: [PATCH 165/187] * autogen.sh: Exclude unused libgcrypt files from translation. --- ChangeLog | 4 ++++ autogen.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 92af2ddbb..d6a68b7c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + * autogen.sh: Exclude unused libgcrypt files from translation. + 2013-05-07 Vladimir Serbinenko Simplify few strings. diff --git a/autogen.sh b/autogen.sh index 00fdafca9..60ae5db8e 100755 --- a/autogen.sh +++ b/autogen.sh @@ -6,7 +6,7 @@ export LC_CTYPE=C export LC_COLLATE=C unset LC_ALL -find . -iname '*.[ch]' -not -ipath './grub-core/lib/libgcrypt-grub/*' -not -ipath './build-aux/*' |sort > po/POTFILES.in +find . -iname '*.[ch]' -not -ipath './grub-core/lib/libgcrypt-grub/*' -not -ipath './build-aux/*' -not -ipath './grub-core/lib/libgcrypt/src/misc.c' -not -ipath './grub-core/lib/libgcrypt/src/global.c' -not -ipath './grub-core/lib/libgcrypt/src/secmem.c' |sort > po/POTFILES.in autogen --version >/dev/null || exit 1 From 43fe02cbaf96ec5326fbe3539730f3cd12ed2d13 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 11:47:30 +0200 Subject: [PATCH 166/187] * tests/gettext_strings_test.in: A test to check for strings not marked for translation. --- ChangeLog | 5 + Makefile.util.def | 6 + po/exclude.pot | 4988 +++++++++++++++++++++++++++++++++ tests/gettext_strings_test.in | 20 + 4 files changed, 5019 insertions(+) create mode 100644 po/exclude.pot create mode 100644 tests/gettext_strings_test.in diff --git a/ChangeLog b/ChangeLog index d6a68b7c7..67b4c6f25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-07 Vladimir Serbinenko + + * tests/gettext_strings_test.in: A test to check for strings not + marked for translation. + 2013-05-07 Vladimir Serbinenko * autogen.sh: Exclude unused libgcrypt files from translation. diff --git a/Makefile.util.def b/Makefile.util.def index 086ca1285..588831421 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -545,6 +545,12 @@ script = { common = tests/example_scripted_test.in; }; +script = { + testcase; + name = gettext_strings_test; + common = tests/gettext_strings_test.in; +}; + script = { testcase; name = pata_test; diff --git a/po/exclude.pot b/po/exclude.pot new file mode 100644 index 000000000..341c45ec3 --- /dev/null +++ b/po/exclude.pot @@ -0,0 +1,4988 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2013-05-07 00:07+0200\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "GPLv3+" +msgstr "" + +#: grub-core/bus/usb/serial/common.c:62 +#, c-format +msgid "usb%d" +msgstr "" + +#: grub-core/commands/acpi.c:373 +msgid "RSDT" +msgstr "" + +#: grub-core/commands/acpi.c:427 +msgid "XSDT" +msgstr "" + +#: grub-core/commands/acpi.c:539 +msgid "facp" +msgstr "" + +#: grub-core/commands/acpi.c:558 grub-core/commands/acpi.c:559 +msgid "dsdt" +msgstr "" + +#: grub-core/commands/acpi.c:678 grub-core/commands/acpihalt.c:371 +msgid "DSDT" +msgstr "" + +#: grub-core/commands/acpihalt.c:218 +msgid "_S5_" +msgstr "" + +#: grub-core/commands/acpihalt.c:218 +msgid "\\_S5_" +msgstr "" + +#: grub-core/commands/acpihalt.c:302 grub-core/kern/emu/hostfs.c:112 +#: grub-core/lib/reed_solomon.c:428 grub-core/lib/reed_solomon.c:445 +#: util/grub-editenv.c:151 util/grub-editenv.c:156 util/grub-fstest.c:309 +#: util/grub-fstest.c:561 util/grub-mkpasswd-pbkdf2.c:176 +#: util/grub-mount.c:477 util/grub-setup.c:734 util/misc.c:111 util/misc.c:135 +msgid "rb" +msgstr "" + +#: grub-core/commands/acpihalt.c:359 include/grub/acpi.h:61 +msgid "FACP" +msgstr "" + +#: grub-core/commands/acpihalt.c:376 +msgid "SSDT" +msgstr "" + +#: grub-core/commands/arc/lsdev.c:33 grub-core/commands/cacheinfo.c:43 +#: grub-core/commands/xnu_uuid.c:90 grub-core/font/font_cmd.c:56 +#: grub-core/fs/zfs/zfsinfo.c:402 grub-core/gettext/gettext.c:492 +#: grub-core/hello/hello.c:36 grub-core/lib/arg.c:147 +#: grub-core/lib/hexdump.c:63 grub-core/loader/ia64/efi/linux.c:123 +#: grub-core/loader/ia64/efi/linux.c:130 grub-core/net/bootp.c:381 +#: grub-core/net/bootp.c:417 grub-core/net/dns.c:628 grub-core/net/dns.c:644 +#: grub-core/net/net.c:1086 util/grub-mkfont.c:770 util/grub-mkimage.c:1967 +#: util/grub-mkrelpath.c:99 util/ieee1275/grub-ofpathname.c:46 +#: util/ieee1275/grub-ofpathname.c:51 +#, c-format +msgid "%s\n" +msgstr "" + +#: grub-core/commands/blocklist.c:46 grub-core/commands/minicmd.c:162 +#: grub-core/disk/geli.c:427 grub-core/disk/luks.c:334 +#: grub-core/disk/lvm.c:496 grub-core/normal/completion.c:172 +msgid "," +msgstr "" + +#: grub-core/commands/blocklist.c:48 +#, c-format +msgid "%llu" +msgstr "" + +#: grub-core/commands/blocklist.c:50 +#, c-format +msgid "+%u" +msgstr "" + +#: grub-core/commands/blocklist.c:52 +#, c-format +msgid "[%u-%u]" +msgstr "" + +#: grub-core/commands/cacheinfo.c:37 +#, c-format +msgid "(%lu.%lu%%)\n" +msgstr "" + +#: grub-core/commands/cat.c:66 grub-core/commands/minicmd.c:59 +#: grub-core/commands/read.c:52 grub-core/normal/auth.c:188 +#: util/spkmodem-recv.c:101 +#, c-format +msgid "%c" +msgstr "" + +msgid "\n" +msgstr "" + +#: grub-core/commands/cat.c:75 grub-core/commands/minicmd.c:63 +#, c-format +msgid "<%x>" +msgstr "" + +#: grub-core/commands/configfile.c:38 +msgid "extract_entries_" +msgstr "" + +#: grub-core/commands/echo.c:116 grub-core/commands/parttool.c:131 +#: grub-core/commands/videoinfo.c:54 grub-core/disk/cryptodisk.c:1029 +#: grub-core/fs/zfs/zfsinfo.c:38 grub-core/kern/emu/misc.c:74 +#: grub-core/kern/emu/misc.c:90 grub-core/kern/emu/misc.c:105 +#: grub-core/lib/arg.c:145 grub-core/normal/cmdline.c:367 +#: grub-core/normal/cmdline.c:474 grub-core/normal/completion.c:137 +#: grub-core/normal/completion.c:348 grub-core/normal/completion.c:358 +#: grub-core/normal/completion.c:364 grub-core/normal/completion.c:366 +#: grub-core/normal/completion.c:380 grub-core/normal/completion.c:451 +#: grub-core/normal/misc.c:97 grub-core/normal/misc.c:102 +#: grub-core/normal/misc.c:130 grub-core/normal/misc.c:145 +#: grub-core/script/execute.c:309 util/grub-probe.c:515 util/grub-probe.c:524 +#: util/grub-probe.c:533 +#, c-format +msgid " " +msgstr "" + +#: grub-core/commands/efi/efifwsetup.c:41 +#: grub-core/commands/efi/efifwsetup.c:47 +msgid "OsIndications" +msgstr "" + +#: grub-core/commands/efi/efifwsetup.c:66 +msgid "OsIndicationsSupported" +msgstr "" + +#: grub-core/commands/efi/fixvideo.c:39 +msgid "Intel 945GM" +msgstr "" + +#: grub-core/commands/efi/fixvideo.c:40 +msgid "Intel 965GM" +msgstr "" + +#: grub-core/commands/hashsum.c:46 grub-core/commands/verify.c:127 +msgid "sha1" +msgstr "" + +#: grub-core/commands/hashsum.c:47 grub-core/commands/verify.c:126 +msgid "md5" +msgstr "" + +#: grub-core/commands/hashsum.c:124 grub-core/commands/ls.c:125 +#: util/grub-mount.c:304 util/misc.c:82 +#, c-format +msgid "%s/%s" +msgstr "" + +#: grub-core/commands/hashsum.c:249 grub-core/disk/geli.c:192 +#: grub-core/loader/i386/xnu.c:767 util/grub-probe.c:721 +#, c-format +msgid "%02x" +msgstr "" + +#: grub-core/commands/hashsum.c:250 +#, c-format +msgid " %s\n" +msgstr "" + +#: grub-core/commands/help.c:51 +#, c-format +msgid "%s %s" +msgstr "" + +#: grub-core/commands/help.c:126 grub-core/normal/menu.c:682 +#: grub-core/normal/menu.c:694 grub-core/normal/menu_entry.c:1128 +msgid "" +"\n" +"\n" +msgstr "" + +#: grub-core/commands/help.c:132 +#, c-format +msgid "" +"%s %s %s\n" +"%s\n" +msgstr "" + +#: grub-core/commands/hexdump.c:53 +msgid "(mem)" +msgstr "" + +#: grub-core/commands/i386/cmosdump.c:38 +#, c-format +msgid "%02x: " +msgstr "" + +#: grub-core/commands/i386/cmosdump.c:44 grub-core/commands/testload.c:129 +#: grub-core/fs/reiserfs.c:306 grub-core/fs/reiserfs.c:334 +#: grub-core/lib/hexdump.c:42 +#, c-format +msgid "%02x " +msgstr "" + +#: grub-core/commands/i386/cpuid.c:34 grub-core/efiemu/i386/coredetect.c:24 +#: grub-core/efiemu/runtime/efiemu.c:187 grub-core/gdb/i386/idt.c:53 +#: grub-core/loader/i386/xnu.c:145 grub-core/loader/i386/xnu.c:155 +#: grub-core/video/i386/pc/vbe.c:63 grub-core/video/i386/pc/vbe.c:67 +#: include/grub/i386/io.h:31 include/grub/i386/io.h:40 +#: include/grub/i386/io.h:49 include/grub/i386/tsc.h:52 +#: include/grub/i386/tsc.h:73 include/grub/i386/tsc.h:96 +msgid "=a" +msgstr "" + +#: grub-core/commands/i386/cpuid.c:35 grub-core/efiemu/i386/coredetect.c:25 +#: grub-core/net/tftp.c:347 grub-core/net/tftp.c:348 grub-core/net/tftp.c:349 +#: grub-core/normal/menu.c:188 grub-core/script/execute.c:1051 +#: grub-core/video/i386/pc/vbe.c:64 +msgid "0" +msgstr "" + +#: grub-core/commands/i386/cpuid.c:76 grub-core/efiemu/i386/coredetect.c:41 +msgid "i" +msgstr "" + +#: grub-core/commands/i386/cpuid.c:98 +msgid "[-l]" +msgstr "" + +#: grub-core/commands/i386/pc/halt.c:118 +msgid "[-n]" +msgstr "" + +#: grub-core/commands/iorw.c:50 +msgid "in" +msgstr "" + +#: grub-core/commands/iorw.c:67 grub-core/commands/memrw.c:44 +#: grub-core/commands/setpci.c:124 +msgid "XXXXXXXX" +msgstr "" + +#: grub-core/commands/iorw.c:68 grub-core/commands/memrw.c:67 +#: grub-core/commands/setpci.c:125 +#, c-format +msgid "%x" +msgstr "" + +#: grub-core/commands/iorw.c:72 grub-core/commands/memrw.c:71 +#, c-format +msgid "0x%x\n" +msgstr "" + +#: grub-core/commands/iorw.c:92 +msgid "out" +msgstr "" + +#: grub-core/commands/keylayouts.c:214 +#, c-format +msgid "%s/layouts/%s.gkb" +msgstr "" + +#: grub-core/commands/keystatus.c:104 +msgid "[--shift] [--ctrl] [--alt]" +msgstr "" + +#: grub-core/commands/legacycfg.c:127 grub-core/commands/legacycfg.c:712 +#: grub-core/commands/legacycfg.c:717 grub-core/commands/legacycfg.c:724 +msgid "legacy" +msgstr "" + +#: grub-core/commands/legacycfg.c:203 +msgid "extract_legacy_entries_" +msgstr "" + +#: grub-core/commands/legacycfg.c:204 +msgid "legacy_" +msgstr "" + +#: grub-core/commands/legacycfg.c:251 +msgid "--no-mem-option" +msgstr "" + +#: grub-core/commands/legacycfg.c:262 +msgid "--type=linux" +msgstr "" + +#: grub-core/commands/legacycfg.c:263 +msgid "--type=biglinux" +msgstr "" + +#: grub-core/commands/legacycfg.c:271 +msgid "--type=multiboot" +msgstr "" + +#: grub-core/commands/legacycfg.c:279 +msgid "--type=freebsd" +msgstr "" + +#: grub-core/commands/legacycfg.c:287 +msgid "--type=openbsd" +msgstr "" + +#: grub-core/commands/legacycfg.c:295 +msgid "--type=netbsd" +msgstr "" + +#: grub-core/commands/legacycfg.c:380 +msgid "adXXXXXXXXXXXXsXXXXXXXXXXXXYYY" +msgstr "" + +#: grub-core/commands/legacycfg.c:384 +#, c-format +msgid "ad%ds%d%c" +msgstr "" + +#: grub-core/commands/legacycfg.c:387 +#, c-format +msgid "ad%ds%d" +msgstr "" + +#: grub-core/commands/legacycfg.c:390 +#, c-format +msgid "ad%d" +msgstr "" + +#: grub-core/commands/legacycfg.c:409 +msgid "wdXXXXXXXXXXXXY" +msgstr "" + +#: grub-core/commands/legacycfg.c:417 +msgid "-r" +msgstr "" + +#: grub-core/commands/legacycfg.c:424 +#, c-format +msgid "wd%d%c" +msgstr "" + +#: grub-core/commands/legacycfg.c:512 grub-core/loader/multiboot.c:290 +msgid "--nounzip" +msgstr "" + +#: grub-core/commands/legacycfg.c:645 +msgid "--md5" +msgstr "" + +#: grub-core/commands/loadenv.c:154 grub-core/kern/corecmd.c:43 +#: util/grub-editenv.c:190 +#, c-format +msgid "%s=%s\n" +msgstr "" + +#: grub-core/commands/ls.c:55 grub-core/kern/corecmd.c:95 +#, c-format +msgid "(%s) " +msgstr "" + +#: grub-core/commands/ls.c:75 grub-core/commands/terminal.c:55 +#: grub-core/commands/terminal.c:59 grub-core/commands/terminal.c:78 +#: grub-core/disk/cryptodisk.c:756 grub-core/disk/cryptodisk.c:758 +#: grub-core/disk/cryptodisk.c:760 grub-core/disk/cryptodisk.c:762 +#: grub-core/disk/cryptodisk.c:764 grub-core/disk/cryptodisk.c:766 +#: grub-core/disk/cryptodisk.c:773 grub-core/disk/diskfilter.c:365 +#: grub-core/net/net.c:1128 util/grub-probe.c:89 util/grub-probe.c:310 +#, c-format +msgid "%s " +msgstr "" + +#: grub-core/commands/ls.c:102 grub-core/kern/corecmd.c:105 +#, c-format +msgid "%s%s " +msgstr "" + +#: grub-core/commands/ls.c:102 grub-core/commands/ls.c:168 +#: grub-core/commands/test.c:116 grub-core/commands/wildcard.c:451 +#: grub-core/disk/ieee1275/ofdisk.c:240 grub-core/fs/iso9660.c:624 +#: grub-core/fs/iso9660.c:640 grub-core/fs/zfs/zfs.c:2950 +#: grub-core/gfxmenu/gui_string_util.c:129 +#: grub-core/gfxmenu/gui_string_util.c:203 grub-core/kern/corecmd.c:105 +#: grub-core/kern/emu/hostfs.c:53 grub-core/kern/fs.c:73 +#: grub-core/kern/fs.c:97 grub-core/kern/ieee1275/cmain.c:65 +#: grub-core/kern/ieee1275/mmap.c:35 grub-core/kern/ieee1275/openfw.c:156 +#: grub-core/loader/xnu.c:241 grub-core/loader/xnu.c:252 +#: grub-core/loader/xnu.c:1209 grub-core/normal/completion.c:312 +#: include/grub/emu/misc.h:37 include/grub/emu/misc.h:39 +#: util/grub-editenv.c:36 util/grub-fstest.c:288 util/grub-fstest.c:290 +#: util/grub-mount.c:183 +msgid "/" +msgstr "" + +#: grub-core/commands/ls.c:123 grub-core/commands/menuentry.c:100 +#: grub-core/commands/wildcard.c:310 grub-core/kern/main.c:169 +#: grub-core/kern/main.c:173 grub-core/net/drivers/ieee1275/ofnet.c:46 +#: util/grub-menulst2cfg.c:106 +#, c-format +msgid "%s%s" +msgstr "" + +#: grub-core/commands/ls.c:142 +#, c-format +msgid "%-12llu" +msgstr "" + +#: grub-core/commands/ls.c:144 grub-core/commands/ls.c:150 +#, c-format +msgid "%-12s" +msgstr "" + +#: grub-core/commands/ls.c:168 +#, c-format +msgid "%s%s\n" +msgstr "" + +#: grub-core/commands/memrw.c:50 +msgid "read_" +msgstr "" + +#: grub-core/commands/memrw.c:91 +msgid "write_" +msgstr "" + +#: grub-core/commands/menuentry.c:59 +msgid "f1" +msgstr "" + +#: grub-core/commands/menuentry.c:60 +msgid "f2" +msgstr "" + +#: grub-core/commands/menuentry.c:61 +msgid "f3" +msgstr "" + +#: grub-core/commands/menuentry.c:62 +msgid "f4" +msgstr "" + +#: grub-core/commands/menuentry.c:63 +msgid "f5" +msgstr "" + +#: grub-core/commands/menuentry.c:64 +msgid "f6" +msgstr "" + +#: grub-core/commands/menuentry.c:65 +msgid "f7" +msgstr "" + +#: grub-core/commands/menuentry.c:66 +msgid "f8" +msgstr "" + +#: grub-core/commands/menuentry.c:67 +msgid "f9" +msgstr "" + +#: grub-core/commands/menuentry.c:68 +msgid "f10" +msgstr "" + +#: grub-core/commands/menuentry.c:69 +msgid "f11" +msgstr "" + +#: grub-core/commands/menuentry.c:70 +msgid "f12" +msgstr "" + +#: grub-core/commands/menuentry.c:247 +msgid "'\\''" +msgstr "" + +#: grub-core/commands/nativedisk.c:37 +msgid "ehcipata" +msgstr "" + +#: grub-core/commands/nativedisk.c:143 +#, c-format +msgid "(%s)/%s" +msgstr "" + +#: grub-core/commands/nativedisk.c:226 grub-core/commands/parttool.c:190 +#: grub-core/efiemu/main.c:239 grub-core/kern/dl.c:721 +#: grub-core/normal/autofs.c:73 grub-core/normal/completion.c:146 +#: grub-core/normal/crypto.c:89 grub-core/normal/dyncmd.c:103 +#: grub-core/normal/term.c:325 +#, c-format +msgid "%s/" +msgstr "" + +#: grub-core/commands/nativedisk.c:226 grub-core/commands/parttool.c:190 +#: grub-core/efiemu/main.c:239 grub-core/kern/dl.c:721 +#: grub-core/kern/main.c:186 grub-core/kern/main.c:187 +#: grub-core/kern/main.c:188 grub-core/kern/main.c:189 +#: grub-core/loader/xnu.c:949 grub-core/loader/xnu.c:1253 +#: grub-core/loader/xnu.c:1259 grub-core/normal/autofs.c:73 +#: grub-core/normal/crypto.c:89 grub-core/normal/dyncmd.c:103 +#: grub-core/normal/term.c:325 util/grub-editenv.c:296 +msgid "-" +msgstr "" + +#: grub-core/commands/nativedisk.c:226 grub-core/kern/dl.c:721 +#, c-format +msgid "/%s.mod" +msgstr "" + +#: grub-core/commands/parttool.c:34 grub-core/lib/pbkdf2.c:26 +#: grub-core/parttool/msdospart.c:32 +msgid "GPLv2+" +msgstr "" + +#: grub-core/commands/parttool.c:118 +msgid "+/-" +msgstr "" + +#: grub-core/commands/parttool.c:191 +msgid "/parttool.lst" +msgstr "" + +#: grub-core/commands/password_pbkdf2.c:95 +#: grub-core/commands/password_pbkdf2.c:96 +#: grub-core/commands/password_pbkdf2.c:99 +msgid "grub.pbkdf2.sha512." +msgstr "" + +#: grub-core/commands/pcidump.c:65 +#, c-format +msgid "%08x " +msgstr "" + +#: grub-core/commands/search.c:80 grub-core/kern/main.c:198 +#, c-format +msgid "(%s)%s" +msgstr "" + +#: grub-core/commands/search.c:160 grub-core/normal/cmdline.c:204 +#, c-format +msgid " %s" +msgstr "" + +#: grub-core/commands/search.c:179 grub-core/disk/efi/efidisk.c:855 +#: grub-core/kern/device.c:123 grub-core/normal/completion.c:114 +#: util/grub-fstest.c:755 util/grub-mount.c:579 util/grub-probe.c:269 +#, c-format +msgid "%s,%s" +msgstr "" + +#: grub-core/commands/search_file.c:3 +msgid "search.file" +msgstr "" + +#: grub-core/commands/search_label.c:3 +msgid "search.fs_label" +msgstr "" + +#: grub-core/commands/search_uuid.c:3 +msgid "search.fs_uuid" +msgstr "" + +#: grub-core/commands/search_wrap.c:164 +msgid "--hint-" +msgstr "" +#: util/grub-mkpasswd-pbkdf2.c:146 +#, c-format +msgid "" +"\n" +"%s" +msgstr "" + +#: util/grub-mkpasswd-pbkdf2.c:176 +msgid "/dev/urandom" +msgstr "" + +#: util/grub-mkpasswd-pbkdf2.c:223 util/grub-mkpasswd-pbkdf2.c:225 +msgid "grub.pbkdf2.sha512.XXXXXXXXXXXXXXXXXXX.S.S" +msgstr "" + +#: util/grub-mkpasswd-pbkdf2.c:227 +#, c-format +msgid "grub.pbkdf2.sha512.%d.%s.%s" +msgstr "" + +#: util/grub-probe.c:250 +#, c-format +msgid "ata%d" +msgstr "" + +#: util/grub-probe.c:256 +#, c-format +msgid "ahci%d" +msgstr "" + +#: util/grub-probe.c:296 +#, c-format +msgid "lvm " +msgstr "" + +#: util/grub-probe.c:300 +#, c-format +msgid "ldm " +msgstr "" + +#: util/grub-probe.c:308 +#, c-format +msgid "diskfilter " +msgstr "" + +#: util/grub-probe.c:313 +#, c-format +msgid "raid5rec " +msgstr "" + +#: util/grub-probe.c:315 +#, c-format +msgid "raid6rec " +msgstr "" + +#: util/grub-probe.c:421 +msgid "false\n" +msgstr "" + +#: util/grub-probe.c:429 +msgid "true\n" +msgstr "" + +#: util/grub-probe.c:504 +#, c-format +msgid "--hint-ieee1275='" +msgstr "" + +#: util/grub-probe.c:513 +#, c-format +msgid "--hint-bios=" +msgstr "" + +#: util/grub-probe.c:522 +#, c-format +msgid "--hint-efi=" +msgstr "" + +#: util/grub-probe.c:531 +#, c-format +msgid "--hint-baremetal=" +msgstr "" + +#: util/grub-probe.c:542 +#, c-format +msgid "--hint='" +msgstr "" + +#: util/grub-probe.c:740 +msgid "" +"(fs|fs_uuid|fs_label|drive|device|partmap|abstraction|cryptodisk_uuid|" +"msdos_parttype)" +msgstr "" + +#: util/grub-probe.c:791 +msgid "fs_uuid" +msgstr "" + +#: util/grub-probe.c:793 +msgid "fs_label" +msgstr "" + +#: util/grub-probe.c:795 +msgid "drive" +msgstr "" + +#: util/grub-probe.c:801 +msgid "abstraction" +msgstr "" + +#: util/grub-probe.c:803 +msgid "cryptodisk_uuid" +msgstr "" + +#: util/grub-probe.c:805 +msgid "msdos_parttype" +msgstr "" + +#: util/grub-probe.c:807 +msgid "hints_string" +msgstr "" + +#: util/grub-probe.c:809 +msgid "bios_hints" +msgstr "" + +#: util/grub-probe.c:811 +msgid "ieee1275_hints" +msgstr "" + +#: util/grub-probe.c:813 +msgid "baremetal_hints" +msgstr "" + +#: util/grub-probe.c:815 +msgid "efi_hints" +msgstr "" + +#: util/grub-probe.c:817 +msgid "arc_hints" +msgstr "" + +#: util/grub-probe.c:819 +msgid "compatibility_hint" +msgstr "" + +#: util/grub-probe.c:821 +msgid "zero_check" +msgstr "" + +#: util/grub-render-label.c:273 +#, c-format +msgid "(host)/%s" +msgstr "" + +#: util/grub-setup.c:87 +msgid "core.img" +msgstr "" + +#: util/grub-setup.c:147 util/grub-setup.c:173 +#, c-format +msgid ",%u,%u>" +msgstr "" + +#: util/grub-setup.c:665 +msgid "dump.img" +msgstr "" + +#: util/grub-setup.c:672 +msgid "dump2.img" +msgstr "" + +#: util/grub-setup.c:896 +msgid "r+b" +msgstr "" + +#: util/ieee1275/grub-ofpathname.c:44 +msgid "--version" +msgstr "" + +#: util/resolve.c:148 util/resolve.c:170 +msgid ".mod" +msgstr "" + +#: util/resolve.c:175 +#, c-format +msgid "%s.mod" +msgstr "" + +#: util/spkmodem-recv.c:90 +#, c-format +msgid "%d %d %d @%d\n" +msgstr "" + +#: util/spkmodem-recv.c:99 +#, c-format +msgid "<%c, %x>" +msgstr "" + +#: util/grub-mkimage.c:764 +msgid "moddep.lst" +msgstr "" + +#: util/grub-mkimage.c:766 +msgid "kernel.img" +msgstr "" + +#: util/grub-mkimage.c:973 +msgid "xz_decompress.img" +msgstr "" + +#: util/grub-mkimage.c:976 +msgid "lzma_decompress.img" +msgstr "" + +#: util/grub-mkimage.c:979 +msgid "none_decompress.img" +msgstr "" + +#: util/grub-mkimage.c:1079 +msgid "pxeboot.img" +msgstr "" + +#: util/grub-mkimage.c:1101 util/grub-mkimage.c:1380 +msgid "diskboot.img" +msgstr "" + +#: util/grub-mkimage.c:1158 +msgid "PE" +msgstr "" + +#: util/grub-mkimage.c:1263 +msgid ".data" +msgstr "" + +#: util/grub-mkimage.c:1275 +msgid ".bss" +msgstr "" + +#: util/grub-mkimage.c:1289 +msgid "mods" +msgstr "" + +#: util/grub-mkimage.c:1300 +msgid ".reloc" +msgstr "" + +#: util/grub-mkimage.c:1321 util/grub-setup.c:86 +msgid "boot.img" +msgstr "" + +#: util/grub-mkimage.c:1435 +msgid "fwstart_fuloong2f.img" +msgstr "" + +#: util/grub-mkimage.c:1440 +msgid "fwstart.img" +msgstr "" + +#: util/grub-mkimage.c:1766 +msgid "(xz|none|auto)" +msgstr "" + +#: util/grub-mkimage.c:1798 +#, c-format +msgid "" +"%s\n" +"%s %s" +msgstr "" + + +#: util/grub-mkimage.c:113 util/grub-mkimage.c:114 +msgid "i386-coreboot" +msgstr "" + +#: util/grub-mkimage.c:132 util/grub-mkimage.c:133 +msgid "i386-multiboot" +msgstr "" + +#: util/grub-mkimage.c:151 util/grub-mkimage.c:152 util/grub-mkimage.c:167 +msgid "i386-pc" +msgstr "" + +#: util/grub-mkimage.c:168 +msgid "i386-pc-pxe" +msgstr "" + +#: util/grub-mkimage.c:183 util/grub-mkimage.c:184 +msgid "i386-efi" +msgstr "" + +#: util/grub-mkimage.c:199 util/grub-mkimage.c:200 +msgid "i386-ieee1275" +msgstr "" + +#: util/grub-mkimage.c:218 util/grub-mkimage.c:219 +msgid "i386-qemu" +msgstr "" + +#: util/grub-mkimage.c:233 util/grub-mkimage.c:234 +msgid "x86_64-efi" +msgstr "" + +#: util/grub-mkimage.c:249 util/grub-mkimage.c:267 util/grub-mkimage.c:285 +msgid "mipsel-loongson" +msgstr "" + +#: util/grub-mkimage.c:250 +msgid "mipsel-yeeloong-flash" +msgstr "" + +#: util/grub-mkimage.c:268 +msgid "mipsel-fuloong2f-flash" +msgstr "" + +#: util/grub-mkimage.c:286 +msgid "mipsel-loongson-elf" +msgstr "" + +#: util/grub-mkimage.c:286 +msgid "mipsel-yeeloong-elf" +msgstr "" + +#: util/grub-mkimage.c:287 +msgid "mipsel-fuloong2f-elf" +msgstr "" + +#: util/grub-mkimage.c:287 +msgid "mipsel-fuloong2e-elf" +msgstr "" + +#: util/grub-mkimage.c:288 +msgid "mipsel-fuloong-elf" +msgstr "" + +#: util/grub-mkimage.c:305 util/grub-mkimage.c:306 +msgid "powerpc-ieee1275" +msgstr "" + +#: util/grub-mkimage.c:324 util/grub-mkimage.c:339 util/grub-mkimage.c:354 +msgid "sparc64-ieee1275" +msgstr "" + +#: util/grub-mkimage.c:325 +msgid "sparc64-ieee1275-raw" +msgstr "" + +#: util/grub-mkimage.c:340 +msgid "sparc64-ieee1275-cdcore" +msgstr "" + +#: util/grub-mkimage.c:355 +msgid "sparc64-ieee1275-aout" +msgstr "" + +#: util/grub-mkimage.c:369 util/grub-mkimage.c:370 +msgid "ia64-efi" +msgstr "" + +#: util/grub-mkimage.c:385 util/grub-mkimage.c:386 +msgid "mips-arc" +msgstr "" + +#: util/grub-mkimage.c:403 util/grub-mkimage.c:404 +msgid "mipsel-arc" +msgstr "" + +#: util/grub-mkimage.c:421 util/grub-mkimage.c:457 +msgid "mipsel-qemu_mips" +msgstr "" + +#: util/grub-mkimage.c:422 +msgid "mipsel-qemu_mips-elf" +msgstr "" + +#: util/grub-mkimage.c:439 util/grub-mkimage.c:475 +msgid "mips-qemu_mips" +msgstr "" + +#: util/grub-mkimage.c:440 +msgid "mips-qemu_mips-flash" +msgstr "" + +#: util/grub-mkimage.c:458 +msgid "mipsel-qemu_mips-flash" +msgstr "" + +#: util/grub-mkimage.c:476 +msgid "mips-qemu_mips-elf" +msgstr "" + + +#: grub-core/commands/terminal.c:85 grub-core/commands/terminal.c:145 +msgid "--append" +msgstr "" + +#: grub-core/commands/terminal.c:86 grub-core/commands/terminal.c:166 +msgid "--remove" +msgstr "" + +#: grub-core/commands/terminal.c:99 grub-core/commands/terminal.c:105 +#: grub-core/commands/terminal.c:116 grub-core/commands/terminal.c:151 +#: grub-core/commands/terminal.c:172 grub-core/commands/terminal.c:192 +#: grub-core/commands/terminal.c:212 grub-core/loader/i386/linux.c:552 +msgid "ofconsole" +msgstr "" + +#: grub-core/commands/terminal.c:129 grub-core/commands/terminal.c:130 +msgid "serial_usb" +msgstr "" + +#: grub-core/commands/test.c:168 +msgid "=" +msgstr "" + +#: grub-core/commands/test.c:169 +msgid "==" +msgstr "" + +#: grub-core/commands/test.c:177 +msgid "!=" +msgstr "" + +#: grub-core/commands/test.c:186 grub-core/fs/reiserfs.c:569 +#: grub-core/kern/emu/argp_common.c:38 util/grub-editenv.c:66 +msgid "<" +msgstr "" + +#: grub-core/commands/test.c:194 +msgid "<=" +msgstr "" + +#: grub-core/commands/test.c:210 +msgid ">=" +msgstr "" + +#: grub-core/commands/test.c:219 +msgid "-eq" +msgstr "" + +#: grub-core/commands/test.c:227 +msgid "-ge" +msgstr "" + +#: grub-core/commands/test.c:235 +msgid "-gt" +msgstr "" + +#: grub-core/commands/test.c:243 +msgid "-le" +msgstr "" + +#: grub-core/commands/test.c:251 +msgid "-lt" +msgstr "" + +#: grub-core/commands/test.c:259 +msgid "-ne" +msgstr "" + +#: grub-core/commands/test.c:269 grub-core/commands/test.c:283 +msgid "-pgt" +msgstr "" + +#: grub-core/commands/test.c:270 +msgid "-plt" +msgstr "" + +#: grub-core/commands/test.c:295 grub-core/commands/test.c:311 +msgid "-nt" +msgstr "" + +#: grub-core/commands/test.c:296 +msgid "-ot" +msgstr "" + +#: grub-core/commands/test.c:330 util/grub-fstest.c:492 util/grub-mount.c:422 +msgid "-d" +msgstr "" + +#: grub-core/commands/test.c:338 +msgid "-e" +msgstr "" + +#: grub-core/commands/test.c:346 +msgid "-f" +msgstr "" + +#: grub-core/commands/test.c:355 util/grub-mount.c:552 +msgid "-s" +msgstr "" + +#: grub-core/commands/test.c:369 +msgid "-n" +msgstr "" + +#: grub-core/commands/test.c:376 +msgid "-z" +msgstr "" + +#: grub-core/commands/test.c:387 grub-core/normal/completion.c:120 +#: grub-core/normal/completion.c:178 util/grub-mkimagexx.c:349 +msgid ")" +msgstr "" + +#: grub-core/commands/test.c:393 +msgid "(" +msgstr "" + +#: grub-core/commands/test.c:400 grub-core/script/execute.c:917 +msgid "!" +msgstr "" + +#: grub-core/commands/test.c:406 util/grub-fstest.c:408 util/grub-mount.c:383 +msgid "-a" +msgstr "" + +#: grub-core/commands/test.c:411 +msgid "-o" +msgstr "" + +#: grub-core/commands/test.c:432 +msgid "]" +msgstr "" + +#: grub-core/commands/verify.c:128 +msgid "ripemd160" +msgstr "" + +#: grub-core/commands/verify.c:130 +msgid "sha384" +msgstr "" + +#: grub-core/commands/verify.c:132 +msgid "sha224" +msgstr "" + +#: grub-core/commands/verify.c:142 grub-core/commands/verify.c:143 +msgid "rsa" +msgstr "" + +#: grub-core/commands/verify.c:144 +msgid "dsa" +msgstr "" + +#: grub-core/commands/verify.c:258 +msgid "" +msgstr "" + +#: grub-core/commands/verify.c:531 +msgid "gcry_dsa" +msgstr "" + +#: grub-core/commands/verify.c:587 +#, c-format +msgid "%02x%02x " +msgstr "" + +#: grub-core/commands/verify.c:696 +msgid "verified_read" +msgstr "" + +#: grub-core/commands/verify.c:714 grub-core/commands/verify.c:718 +msgid ".sig" +msgstr "" + +#: grub-core/commands/verify.c:771 grub-core/commands/verify.c:836 +msgid "enforce" +msgstr "" + +#: grub-core/commands/verify.c:771 grub-core/commands/verify.c:836 +#: grub-core/term/serial.c:217 +msgid "no" +msgstr "" + +#: grub-core/commands/videoinfo.c:48 +msgid " " +msgstr "" + +#: grub-core/commands/videoinfo.c:52 grub-core/script/execute.c:254 +#: grub-core/script/execute.c:296 +msgid "*" +msgstr "" + +#: grub-core/commands/videoinfo.c:55 +#, c-format +msgid " 0x%03x " +msgstr "" + +#: grub-core/commands/videoinfo.c:57 +#, c-format +msgid "%4d x %4d x %2d (%4d) " +msgstr "" + +#: grub-core/commands/videotest.c:56 grub-core/loader/i386/linux.c:48 +#: grub-core/loader/i386/xnu.c:41 grub-core/loader/multiboot.c:57 +#: grub-core/loader/multiboot.c:212 grub-core/term/gfxterm.c:36 +#: grub-core/video/video.c:437 util/grub-mkimage.c:1907 +msgid "auto" +msgstr "" + +#: grub-core/commands/videotest.c:82 grub-core/commands/videotest.c:83 +#: grub-core/commands/videotest.c:84 grub-core/gfxmenu/gui_label.c:261 +#: grub-core/gfxmenu/gui_list.c:594 grub-core/gfxmenu/gui_progress_bar.c:391 +#: grub-core/gfxmenu/view.c:74 +msgid "Unknown Regular 16" +msgstr "" + +#: grub-core/commands/videotest.c:85 +msgid "Fixed 20" +msgstr "" + +#: grub-core/commands/wildcard.c:234 util/grub-probe.c:387 +#, c-format +msgid "(%s)" +msgstr "" + +#: grub-core/commands/wildcard.c:301 grub-core/fs/affs.c:421 +#: grub-core/fs/hfsplus.c:829 grub-core/fs/iso9660.c:557 +#: grub-core/fs/iso9660.c:731 grub-core/fs/reiserfs.c:938 +#: grub-core/fs/squash4.c:536 grub-core/fs/udf.c:886 grub-core/fs/xfs.c:522 +#: grub-core/gfxmenu/gui_string_util.c:98 grub-core/normal/completion.c:142 +#: util/grub-fstest.c:286 +msgid ".." +msgstr "" + +#: grub-core/commands/xnu_uuid.c:51 +msgid "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +msgstr "" + +#: grub-core/commands/xnu_uuid.c:59 util/grub-fstest.c:463 +msgid "-l" +msgstr "" + +#: grub-core/commands/xnu_uuid.c:75 grub-core/fs/jfs.c:924 +#: grub-core/fs/nilfs2.c:1135 +#, c-format +msgid "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" +msgstr "" + +#: grub-core/disk/ahci.c:968 +msgid ", %x, %x (%" +msgstr "" + +#: grub-core/disk/ahci.c:969 grub-core/fs/btrfs.c:720 +#: grub-core/fs/zfs/zfs.c:1307 +msgid ")\n" +msgstr "" + +#: grub-core/disk/arc/arcdisk.c:117 +msgid "partition(0)" +msgstr "" + +#: grub-core/disk/arc/arcdisk.c:119 +msgid "partition(10)" +msgstr "" + +#: grub-core/disk/arc/arcdisk.c:166 +msgid "arc/" +msgstr "" + +#: grub-core/disk/ata.c:426 grub-core/disk/scsi.c:445 +#: grub-core/loader/xnu.c:576 +#, c-format +msgid "%s%d" +msgstr "" + +#: grub-core/disk/cryptodisk.c:467 +#, c-format +msgid "crypto%lu" +msgstr "" + +#: grub-core/disk/cryptodisk.c:483 grub-core/disk/cryptodisk.c:486 +msgid "cryptouuid/" +msgstr "" + +#: grub-core/disk/cryptodisk.c:753 +#, c-format +msgid "cryptodisk %s " +msgstr "" + +#: grub-core/disk/cryptodisk.c:1006 grub-core/disk/cryptodisk.c:1026 +msgid "luks_mount " +msgstr "" + +#: grub-core/disk/cryptodisk.c:1037 +msgid "-ecb" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1040 +msgid "-cbc" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1043 +msgid "-pcbc" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1046 +msgid "-xts" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1049 +msgid "-lrw" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1056 +msgid "-null" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1059 +msgid "-plain" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1062 +msgid "-plain64" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1065 +msgid "-benbi" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1068 +msgid "-essiv:" +msgstr "" + +#: grub-core/disk/cryptodisk.c:1089 grub-core/disk/cryptodisk.c:1101 +msgid "luks_script" +msgstr "" + +#: grub-core/disk/diskfilter.c:118 grub-core/disk/diskfilter.c:431 +msgid "md" +msgstr "" + +#: grub-core/disk/diskfilter.c:119 grub-core/disk/diskfilter.c:432 +#: grub-core/disk/lvm.c:369 grub-core/disk/lvm.c:374 grub-core/disk/lvm.c:375 +#: util/grub-probe.c:295 +msgid "lvm/" +msgstr "" + +#: grub-core/disk/diskfilter.c:120 grub-core/disk/diskfilter.c:433 +#: util/grub-probe.c:299 +msgid "ldm/" +msgstr "" + +#: grub-core/disk/diskfilter.c:396 grub-core/disk/diskfilter.c:398 +msgid "mduuid/" +msgstr "" + +#: grub-core/disk/diskfilter.c:688 +msgid "raid6rec" +msgstr "" + +#: grub-core/disk/diskfilter.c:698 +msgid "raid5rec" +msgstr "" + +#: grub-core/disk/diskfilter.c:892 +#, c-format +msgid "%s_%d" +msgstr "" + +#: grub-core/disk/diskfilter.c:978 +#, c-format +msgid "md/%s" +msgstr "" + +#: grub-core/disk/dmraid_nvidia.c:173 +msgid "dmraid_nv" +msgstr "" + +#: grub-core/disk/efi/efidisk.c:419 grub-core/disk/i386/pc/biosdisk.c:284 +#: util/grub-probe.c:192 util/grub-probe.c:221 +#, c-format +msgid "hd%d" +msgstr "" + +#: grub-core/disk/efi/efidisk.c:428 grub-core/disk/i386/pc/biosdisk.c:284 +#: util/grub-probe.c:198 util/grub-probe.c:227 +#, c-format +msgid "fd%d" +msgstr "" + +#: grub-core/disk/efi/efidisk.c:436 +#, c-format +msgid "cd%d" +msgstr "" + +#: grub-core/disk/efi/efidisk.c:718 +msgid "XdXXXXXXXXXX" +msgstr "" + +#: grub-core/disk/efi/efidisk.c:729 +#, c-format +msgid "d%d" +msgstr "" + +#: grub-core/disk/geli.c:103 +msgid "GEOM::ELI" +msgstr "" + +#: grub-core/disk/geli.c:127 +msgid "des" +msgstr "" + +#: grub-core/disk/geli.c:128 +msgid "3des" +msgstr "" + +#: grub-core/disk/geli.c:129 +msgid "blowfish" +msgstr "" + +#: grub-core/disk/geli.c:130 +msgid "cast5" +msgstr "" + +#: grub-core/disk/geli.c:132 grub-core/disk/geli.c:135 +msgid "aes" +msgstr "" + +#: grub-core/disk/geli.c:134 +msgid "camellia128" +msgstr "" + +#: grub-core/disk/i386/pc/biosdisk.c:281 +msgid "cd" +msgstr "" + +#: grub-core/disk/ieee1275/nand.c:84 grub-core/disk/ieee1275/nand.c:85 +msgid "nand/" +msgstr "" + +#: grub-core/disk/ieee1275/nand.c:105 grub-core/disk/ieee1275/ofdisk.c:597 +msgid "block-size" +msgstr "" + +#: grub-core/disk/ieee1275/nand.c:173 +msgid "pio-read" +msgstr "" + +#: grub-core/disk/ieee1275/ofdisk.c:162 +msgid "vscsi" +msgstr "" + +#: grub-core/disk/ieee1275/ofdisk.c:182 +msgid "vscsi-report-luns" +msgstr "" + +#: grub-core/disk/ieee1275/ofdisk.c:205 +msgid "/disk@%" +msgstr "" + +#: grub-core/disk/ieee1275/ofdisk.c:215 grub-core/disk/ieee1275/ofdisk.c:235 +#: grub-core/disk/ieee1275/ofdisk.c:370 grub-core/kern/ieee1275/openfw.c:422 +msgid "block" +msgstr "" + +#: grub-core/disk/ieee1275/ofdisk.c:281 +msgid "sdmmc" +msgstr "" + +#: grub-core/disk/ieee1275/ofdisk.c:292 grub-core/disk/ieee1275/ofdisk.c:295 +#: grub-core/disk/ieee1275/ofdisk.c:347 grub-core/disk/ieee1275/ofdisk.c:350 +#: grub-core/kern/ieee1275/openfw.c:482 grub-core/kern/ieee1275/openfw.c:492 +#: grub-core/term/ieee1275/serial.c:233 grub-core/term/ieee1275/serial.c:238 +#: grub-core/term/serial.c:156 grub-core/term/serial.c:158 +#: util/grub-probe.c:500 util/grub-probe.c:502 util/grub-probe.c:617 +#: util/grub-probe.c:619 +msgid "ieee1275/" +msgstr "" + +#: grub-core/disk/ieee1275/ofdisk.c:541 grub-core/kern/ieee1275/init.c:115 +#: grub-core/net/drivers/ieee1275/ofnet.c:207 +msgid "network" +msgstr "" + +#: grub-core/disk/ldm.c:53 +msgid "VBLK" +msgstr "" + +#: grub-core/disk/ldm.c:89 +msgid "PRIVHEAD" +msgstr "" + +#: grub-core/disk/ldm.c:362 +#, c-format +msgid "ldm/%s/%s" +msgstr "" + +#: grub-core/disk/ldm.c:1004 +msgid "Volume5" +msgstr "" + +#: grub-core/disk/luks.c:40 +msgid "LUKS" +msgstr "" + +#: grub-core/disk/luks.c:150 +msgid "ecb" +msgstr "" + +#: grub-core/disk/luks.c:156 grub-core/disk/luks.c:218 +msgid "plain" +msgstr "" + +#: grub-core/disk/luks.c:162 grub-core/disk/luks.c:165 +msgid "cbc-" +msgstr "" + +#: grub-core/disk/luks.c:167 grub-core/disk/luks.c:170 +msgid "pcbc-" +msgstr "" + +#: grub-core/disk/luks.c:172 grub-core/disk/luks.c:175 +msgid "xts-" +msgstr "" + +#: grub-core/disk/luks.c:197 grub-core/disk/luks.c:200 +msgid "lrw-" +msgstr "" + +#: grub-core/disk/luks.c:220 +msgid "plain64" +msgstr "" + +#: grub-core/disk/luks.c:222 +msgid "benbi" +msgstr "" + +#: grub-core/disk/luks.c:233 +msgid "null" +msgstr "" + +#: grub-core/disk/luks.c:235 +msgid "essiv:" +msgstr "" + +#: grub-core/disk/luks.c:40 +msgid "LUKS" +msgstr "" + +#: grub-core/disk/mdraid_linux.c:250 +#, c-format +msgid "md%d" +msgstr "" + +#: grub-core/disk/mdraid_linux.c:263 +msgid "mdraid09_be" +msgstr "" + +#: grub-core/disk/memdisk.c:49 +msgid "mdsk" +msgstr "" + +#: grub-core/disk/scsi.c:459 +#, c-format +msgid "%s%d%c" +msgstr "" + +#: grub-core/efiemu/i386/coredetect.c:43 grub-core/efiemu/i386/coredetect.c:50 +#: grub-core/efiemu/i386/coredetect.c:55 grub-core/efiemu/i386/coredetect.c:58 +msgid "efiemu32.o" +msgstr "" + +#: grub-core/efiemu/i386/coredetect.c:58 +msgid "efiemu64.o" +msgstr "" + +#: grub-core/efiemu/i386/pc/cfgtables.c:63 +msgid "_SM_" +msgstr "" + +#: grub-core/efiemu/loadcore.c:166 grub-core/efiemu/runtime/efiemu.c:52 +msgid ".text-physical" +msgstr "" + +#: grub-core/efiemu/main.c:239 +#, c-format +msgid "/%s" +msgstr "" + +#: grub-core/efiemu/pnvram.c:129 grub-core/efiemu/pnvram.c:130 +#: grub-core/efiemu/pnvram.c:133 +msgid "EfiEmu.pnvram." +msgstr "" + +#: grub-core/efiemu/runtime/efiemu.c:50 +msgid "_text-physical, _text-physical" +msgstr "" + +#: grub-core/efiemu/runtime/efiemu.c:116 +msgid "EFIEMULOG" +msgstr "" + +#: grub-core/fs/affs.c:205 +msgid "DOS" +msgstr "" + +#: grub-core/fs/bfs.c:1096 +msgid "be:volume_id" +msgstr "" + +#: grub-core/fs/bfs.c:1099 +msgid "%016" +msgstr "" + +#: grub-core/fs/btrfs.c:34 +msgid "_BHRfS_M" +msgstr "" + +#: grub-core/fs/btrfs.c:414 grub-core/fs/btrfs.c:446 grub-core/fs/btrfs.c:499 +msgid " %x %" +msgstr "" + +#: grub-core/fs/btrfs.c:663 grub-core/loader/i386/pc/plan9.c:211 +msgid " %" +msgstr "" + +#: grub-core/fs/btrfs.c:663 +msgid " \n" +msgstr "" + +#: grub-core/fs/btrfs.c:718 grub-core/fs/btrfs.c:813 grub-core/fs/btrfs.c:1074 +msgid "+0x%" +msgstr "" + +#: grub-core/fs/cpio.c:36 +msgid "070707" +msgstr "" + +#: grub-core/fs/cpio.c:53 grub-core/loader/linux.c:66 +msgid "070701" +msgstr "" + +#: grub-core/fs/cpio.c:54 +msgid "070702" +msgstr "" + +#: grub-core/fs/cpio.c:76 +msgid "q" +msgstr "" + +#: grub-core/fs/cpio.c:78 +msgid "q" +msgstr "" + +#: grub-core/fs/cpio.c:96 +msgid "ustar" +msgstr "" + +#: grub-core/fs/cpio.c:246 grub-core/loader/linux.c:193 +#: grub-core/loader/linux.c:214 grub-core/loader/linux.c:268 +#: grub-core/loader/linux.c:290 +msgid "TRAILER!!!" +msgstr "" + +#: grub-core/fs/fat.c:245 +msgid "EXFAT " +msgstr "" + +#: grub-core/fs/fat.c:1164 +#, c-format +msgid "%04x-%04x" +msgstr "" + +#: grub-core/fs/hfsplus.c:1145 grub-core/fs/ntfs.c:1233 +#: grub-core/fs/zfs/zfs.c:3484 +#, c-format +msgid "%016llx" +msgstr "" + +#: grub-core/fs/iso9660.c:287 +msgid "ST" +msgstr "" + +#: grub-core/fs/iso9660.c:291 +msgid "CE" +msgstr "" + +#: grub-core/fs/iso9660.c:352 +msgid "ER" +msgstr "" + +#: grub-core/fs/iso9660.c:402 +msgid "SP" +msgstr "" + +#: grub-core/fs/iso9660.c:458 grub-core/fs/udf.c:96 +msgid "CD001" +msgstr "" + +#: grub-core/fs/iso9660.c:549 +msgid "NM" +msgstr "" + +#: grub-core/fs/iso9660.c:586 +msgid "PX" +msgstr "" + +#: grub-core/fs/iso9660.c:608 +msgid "SL" +msgstr "" + +#: grub-core/fs/iso9660.c:632 +msgid "./" +msgstr "" + +#: grub-core/fs/iso9660.c:636 +msgid "../" +msgstr "" + +#: grub-core/fs/jfs.c:364 +msgid "JFS1" +msgstr "" + +#: grub-core/fs/minix.c:670 +msgid "minix3_be" +msgstr "" + +#: grub-core/fs/minix.c:672 +msgid "minix2_be" +msgstr "" + +#: grub-core/fs/minix.c:674 +msgid "minix_be" +msgstr "" + +#: grub-core/fs/ntfs.c:483 +msgid "ntfscomp" +msgstr "" + +#: grub-core/fs/ntfs.c:757 +msgid "/??/" +msgstr "" + +#: grub-core/fs/ntfs.c:894 +msgid "INDX" +msgstr "" + +#: grub-core/fs/ntfs.c:938 grub-core/loader/i386/pc/chainloader.c:93 +msgid "NTFS" +msgstr "" + +#: grub-core/fs/ntfs.c:1167 +msgid "/$Volume" +msgstr "" + +#: grub-core/fs/reiserfs.c:57 +msgid "ReIsEr" +msgstr "" + +#: grub-core/fs/reiserfs.c:58 +msgid "ReIsErLB" +msgstr "" + +#: grub-core/fs/romfs.c:32 +msgid "-rom1fs-" +msgstr "" + +#: grub-core/fs/sfs.c:377 +msgid "SFS" +msgstr "" + +#: grub-core/fs/udf.c:94 +msgid "BEA01" +msgstr "" + +#: grub-core/fs/udf.c:95 +msgid "BOOT2" +msgstr "" + +#: grub-core/fs/udf.c:97 +msgid "CDW02" +msgstr "" + +#: grub-core/fs/udf.c:98 +msgid "NSR02" +msgstr "" + +#: grub-core/fs/udf.c:99 +msgid "NSR03" +msgstr "" + +#: grub-core/fs/udf.c:100 +msgid "TEA01" +msgstr "" + +#: grub-core/fs/ufs.c:798 +#, c-format +msgid "%08x%08x" +msgstr "" + +#: grub-core/fs/ufs.c:847 +msgid "ufs1_be" +msgstr "" + +#: grub-core/fs/xfs.c:271 +msgid "IN" +msgstr "" + +#: grub-core/fs/xfs.c:325 +msgid "BMAP" +msgstr "" + +#: grub-core/fs/xfs.c:674 +msgid "XFSB" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:60 +msgid "bootfs" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:318 grub-core/fs/zfs/zfs.c:367 +#: grub-core/gfxmenu/gui_list.c:432 grub-core/gfxmenu/gui_list.c:443 +msgid "inherit" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:319 grub-core/fs/zfs/zfs.c:368 +msgid "on" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:320 grub-core/fs/zfs/zfs.c:369 +#: grub-core/loader/ia64/efi/linux.c:429 +msgid "off" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:321 +msgid "lzjb" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:322 +msgid "empty" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:323 +msgid "gzip-1" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:324 +msgid "gzip-2" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:325 +msgid "gzip-3" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:326 +msgid "gzip-4" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:327 +msgid "gzip-5" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:328 +msgid "gzip-6" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:329 +msgid "gzip-7" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:330 +msgid "gzip-8" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:331 +msgid "gzip-9" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:332 +msgid "zle" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:371 +msgid "gang_header" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:372 +msgid "zilog" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:373 +msgid "fletcher2" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:374 +msgid "fletcher4" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:375 grub-core/lib/xzembed/xz_dec_stream.c:445 +msgid "SHA256" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:376 +msgid "zilog2" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:377 +msgid "SHA256+MAC" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:623 grub-core/loader/i386/xnu.c:776 +msgid "guid" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:631 +msgid "ashift" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:677 +msgid "nparity" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:1305 +msgid "+%u (%" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:1305 +msgid ", %" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:1306 +msgid ") -> (0x%" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:1306 grub-core/kern/mm.c:594 +msgid ", 0x%" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:1637 +msgid "zfscrypt" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:2464 +msgid "casesensitivity" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:3940 grub-core/script/execute.c:255 +#: grub-core/script/execute.c:317 +msgid "@" +msgstr "" + +#: grub-core/gdb/cstub.c:281 grub-core/gdb/cstub.c:293 +#: grub-core/gdb/cstub.c:299 grub-core/gdb/cstub.c:327 +msgid "OK" +msgstr "" + +#: grub-core/gdb/cstub.c:315 +msgid "E01" +msgstr "" + +#: grub-core/gdb/cstub.c:332 +msgid "E02" +msgstr "" + +#: grub-core/gdb/i386/idt.c:64 grub-core/gdb/i386/idt.c:65 +#: grub-core/gdb/i386/idt.c:71 +msgid "m" +msgstr "" + +#: grub-core/gettext/gettext.c:353 +#, c-format +msgid "%s%s/%s.mo" +msgstr "" + +#: grub-core/gettext/gettext.c:364 +#, c-format +msgid "%s%s/%s.mo.gz" +msgstr "" + +#: grub-core/gettext/gettext.c:375 +#, c-format +msgid "%s%s/%s.gmo" +msgstr "" + +#: grub-core/gettext/gettext.c:403 +msgid "/locale" +msgstr "" + +#: grub-core/gfxmenu/gfxmenu.c:78 +#, c-format +msgid "%s/themes/%s" +msgstr "" + +#: grub-core/gfxmenu/gui_box.c:83 grub-core/gfxmenu/gui_canvas.c:75 +#: grub-core/gfxmenu/gui_circular_progress.c:71 +#: grub-core/gfxmenu/gui_image.c:65 grub-core/gfxmenu/gui_label.c:79 +#: grub-core/gfxmenu/gui_list.c:157 grub-core/gfxmenu/gui_progress_bar.c:79 +msgid "component" +msgstr "" + +#: grub-core/gfxmenu/gui_box.c:84 grub-core/gfxmenu/gui_canvas.c:76 +#: grub-core/gfxmenu/gui_util.c:44 grub-core/gfxmenu/gui_util.c:82 +#: grub-core/gfxmenu/theme_loader.c:503 +msgid "container" +msgstr "" + +#: grub-core/gfxmenu/gui_circular_progress.c:237 +msgid "deg" +msgstr "" + +#: grub-core/gfxmenu/gui_circular_progress.c:249 +msgid "num_ticks" +msgstr "" + +#: grub-core/gfxmenu/gui_circular_progress.c:253 +msgid "start_angle" +msgstr "" + +#: grub-core/gfxmenu/gui_circular_progress.c:257 +msgid "ticks_disappear" +msgstr "" + +#: grub-core/gfxmenu/gui_circular_progress.c:261 +msgid "center_bitmap" +msgstr "" + +#: grub-core/gfxmenu/gui_circular_progress.c:267 +msgid "tick_bitmap" +msgstr "" + +#: grub-core/gfxmenu/gui_circular_progress.c:273 +#: grub-core/gfxmenu/gui_image.c:210 grub-core/gfxmenu/gui_list.c:520 +#: grub-core/gfxmenu/gui_progress_bar.c:339 +#: grub-core/gfxmenu/theme_loader.c:458 +msgid "theme_dir" +msgstr "" + +#: grub-core/gfxmenu/gui_label.c:30 +msgid "center" +msgstr "" + +#: grub-core/gfxmenu/gui_label.c:164 grub-core/hook/datehook.c:81 +#: grub-core/kern/emu/hostdisk.c:713 grub-core/kern/ieee1275/openfw.c:509 +#: grub-core/kern/partition.c:265 grub-core/normal/menu.c:111 +#: grub-core/script/execute.c:801 grub-core/script/execute.c:956 +#: grub-core/script/execute.c:1004 grub-core/term/tparm.c:544 +#, c-format +msgid "%d" +msgstr "" + +#: grub-core/gfxmenu/gui_label.c:182 +msgid "@KEYMAP_LONG@" +msgstr "" + +#: grub-core/gfxmenu/gui_label.c:186 +msgid "@KEYMAP_MIDDLE@" +msgstr "" + +#: grub-core/gfxmenu/gui_label.c:190 +msgid "@KEYMAP_SHORT@" +msgstr "" + +#: grub-core/gfxmenu/gui_label.c:205 +msgid "align" +msgstr "" + +#: grub-core/gfxmenu/gui_label.c:217 grub-core/gfxmenu/gui_list.c:484 +msgid "visible" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:401 grub-core/gfxmenu/gui_list.c:403 +msgid "Typical OS" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:426 +msgid "item_font" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:430 +msgid "selected_item_font" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:437 +msgid "item_color" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:441 +msgid "selected_item_color" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:454 +msgid "icon_width" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:461 +msgid "icon_height" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:468 +msgid "item_height" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:472 +msgid "item_padding" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:476 +msgid "item_icon_space" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:480 +msgid "item_spacing" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:488 +msgid "menu_pixmap_style" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:494 +msgid "selected_item_pixmap_style" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:500 +msgid "scrollbar_frame" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:506 +msgid "scrollbar_thumb" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:512 +msgid "scrollbar_width" +msgstr "" + +#: grub-core/gfxmenu/gui_list.c:516 +msgid "scrollbar" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:259 +msgid "XXXXXXXXXX" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:289 +msgid "@TIMEOUT_NOTIFICATION_LONG@" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:292 +msgid "@TIMEOUT_NOTIFICATION_MIDDLE@" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:297 +msgid "@TIMEOUT_NOTIFICATION_SHORT@" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:309 +msgid "text_color" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:313 +msgid "border_color" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:317 +msgid "bg_color" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:321 +msgid "fg_color" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:325 +msgid "bar_style" +msgstr "" + +#: grub-core/gfxmenu/gui_progress_bar.c:332 +msgid "highlight_style" +msgstr "" + +#: grub-core/gfxmenu/icon_manager.c:32 grub-core/video/readers/png.c:948 +msgid ".png" +msgstr "" + +#: grub-core/gfxmenu/icon_manager.c:201 +msgid "icons/" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:126 +msgid "title-font" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:128 +msgid "message-font" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:130 +msgid "terminal-font" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:137 +msgid "title-color" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:139 +msgid "message-color" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:141 +msgid "message-bg-color" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:143 +msgid "desktop-image" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:172 +msgid "desktop-color" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:174 +msgid "terminal-box" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:181 +msgid "title-text" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:418 +msgid "image" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:422 +msgid "vbox" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:426 +msgid "hbox" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:430 +msgid "canvas" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:434 +msgid "progress_bar" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:438 +msgid "circular_progress" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:442 +msgid "boot_menu" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:459 +msgid "theme_path" +msgstr "" + +#: grub-core/gfxmenu/theme_loader.c:552 +msgid "top" +msgstr "" + +#: grub-core/gfxmenu/view.c:82 +msgid "Fixed 10" +msgstr "" + +#: grub-core/gfxmenu/widget-box.c:38 +msgid "nw" +msgstr "" + +#: grub-core/gfxmenu/widget-box.c:38 +msgid "ne" +msgstr "" + +#: grub-core/gfxmenu/widget-box.c:38 +msgid "se" +msgstr "" + +#: grub-core/gfxmenu/widget-box.c:38 +msgid "sw" +msgstr "" + +#: grub-core/gfxmenu/widget-box.c:40 +msgid "n" +msgstr "" + +#: grub-core/gfxmenu/widget-box.c:40 +msgid "e" +msgstr "" + +#: grub-core/gfxmenu/widget-box.c:40 +msgid "s" +msgstr "" + +#: grub-core/gfxmenu/widget-box.c:40 util/grub-menulst2cfg.c:61 +msgid "w" +msgstr "" + +#: grub-core/hook/datehook.c:31 +msgid "YEAR" +msgstr "" + +#: grub-core/hook/datehook.c:32 +msgid "MONTH" +msgstr "" + +#: grub-core/hook/datehook.c:33 +msgid "DAY" +msgstr "" + +#: grub-core/hook/datehook.c:34 +msgid "HOUR" +msgstr "" + +#: grub-core/hook/datehook.c:35 +msgid "MINUTE" +msgstr "" + +#: grub-core/hook/datehook.c:36 +msgid "SECOND" +msgstr "" + +#: grub-core/hook/datehook.c:37 +msgid "WEEKDAY" +msgstr "" + +#: grub-core/io/lzopio.c:30 +msgid "LZO" +msgstr "" + +#: grub-core/kern/dl.c:412 +msgid "grub_mod_init" +msgstr "" + +#: grub-core/kern/dl.c:414 +msgid "grub_mod_fini" +msgstr "" + +#: grub-core/kern/dl.c:457 +msgid ".module_license" +msgstr "" + +#: grub-core/kern/dl.c:459 +msgid "LICENSE=GPLv3" +msgstr "" + +#: grub-core/kern/dl.c:460 +msgid "LICENSE=GPLv3+" +msgstr "" + +#: grub-core/kern/dl.c:461 +msgid "LICENSE=GPLv2+" +msgstr "" + +#: grub-core/kern/dl.c:481 +msgid ".modname" +msgstr "" + +#: grub-core/kern/dl.c:508 +msgid ".moddeps" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:147 +msgid "/dev/.devfsd" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:460 +msgid "linear" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:539 +msgid "part" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:561 util/grub-mkimagexx.c:131 +msgid "start" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:579 grub-core/kern/emu/hostdisk.c:581 +#: grub-core/kern/emu/hostdisk.c:877 +msgid "/dev/" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:694 +msgid "/disc" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:697 +#, c-format +msgid "part%d" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:699 grub-core/kern/emu/hostdisk.c:700 +msgid "/dev/disk/by-id/" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:703 +#, c-format +msgid "-part%d" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:708 +#, c-format +msgid "p%d" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:833 grub-core/kern/emu/hostdisk.c:834 +#: grub-core/kern/emu/hostdisk.c:835 grub-core/kern/emu/hostdisk.c:1347 +#: grub-core/kern/emu/hostdisk.c:1348 grub-core/kern/emu/hostdisk.c:1349 +msgid "hostdisk/" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:954 grub-core/kern/emu/hostdisk.c:961 +#: grub-core/kern/emu/hostdisk.c:1003 +msgid "kern.geom.debugflags" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:1250 grub-core/kern/emu/hostdisk.c:1257 +#: grub-core/kern/emu/hostdisk.c:1265 grub-core/kern/emu/hostdisk.c:1310 +#, c-format +msgid "%s:%d: %s" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:1335 include/grub/util/lvm.h:26 +msgid "/dev/mapper/" +msgstr "" + +#: grub-core/kern/emu/misc.c:78 grub-core/kern/emu/misc.c:94 +#: grub-core/kern/emu/misc.c:109 +#, c-format +msgid ".\n" +msgstr "" + +#: grub-core/kern/i386/coreboot/mmap.c:29 +msgid "LBIO" +msgstr "" + +#: grub-core/kern/i386/pc/init.c:91 +#, c-format +msgid "%cd%u" +msgstr "" + +#: grub-core/kern/i386/pc/init.c:97 grub-core/kern/i386/pc/init.c:101 +#, c-format +msgid ",%u" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:66 grub-core/term/ieee1275/console.c:107 +msgid "/options" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:67 +msgid "/openprom" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:76 grub-core/kern/ieee1275/cmain.c:77 +msgid "SmartFirmware(tm)" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:82 +msgid "OLPC" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:87 +msgid "Emulated PC" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:90 +msgid "IBM" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:101 +msgid "PowerBook3,3" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:111 grub-core/kern/ieee1275/cmain.c:112 +#: grub-core/kern/ieee1275/cmain.c:113 +msgid "MacRISC" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:145 +msgid "1.0" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:146 +msgid "1.1" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:147 +msgid "1.2" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:148 +msgid "1.3" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:189 +msgid "/rom/boot-rom" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:190 +msgid "/boot-rom" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:193 grub-core/kern/ieee1275/cmain.c:194 +msgid "PPC Open Hack'Ware" +msgstr "" + +#: grub-core/kern/ieee1275/cmain.c:208 +msgid "/chosen" +msgstr "" + +#: grub-core/kern/ieee1275/ieee1275.c:581 +msgid "color!" +msgstr "" + +#: grub-core/kern/ieee1275/mmap.c:45 +msgid "/memory" +msgstr "" + +#: grub-core/kern/ieee1275/openfw.c:169 +msgid "/aliases" +msgstr "" + +#: grub-core/kern/ieee1275/openfw.c:410 +#, c-format +msgid "\\%s" +msgstr "" + +#: grub-core/kern/ieee1275/openfw.c:483 +msgid ",XXXXXXXXXXXX" +msgstr "" + +#: grub-core/kern/ieee1275/openfw.c:509 +msgid "XXXXXXXXXXXX" +msgstr "" + +#: grub-core/kern/mips/dl.c:254 +msgid "__gnu_local_gp" +msgstr "" + +#: grub-core/kern/misc.c:172 +#, c-format +msgid "%s:%d: " +msgstr "" + +#: grub-core/kern/misc.c:919 +msgid "0x" +msgstr "" + +#: grub-core/kern/misc.c:1018 +msgid "(null)" +msgstr "" + +#: grub-core/lib/backtrace.c:47 +#, c-format +msgid "%p" +msgstr "" + +#: grub-core/lib/crc64.c:100 grub-core/lib/xzembed/xz_dec_stream.c:444 +msgid "CRC64" +msgstr "" + +#: grub-core/lib/crypto.c:450 +msgid "/dev/tty" +msgstr "" + +#: grub-core/lib/crypto.c:450 +msgid "w+c" +msgstr "" + +#: grub-core/lib/i386/backtrace.c:60 grub-core/lib/i386/backtrace.c:63 +msgid "grub_backtrace_pointer" +msgstr "" + +#: grub-core/lib/ieee1275/cmos.c:41 +msgid "m5819" +msgstr "" + +#: grub-core/lib/ieee1275/datetime.c:37 +msgid "rtc" +msgstr "" + +#: grub-core/lib/ieee1275/datetime.c:87 +msgid "get-time" +msgstr "" + +#: grub-core/lib/ieee1275/datetime.c:139 +msgid "set-time" +msgstr "" + +#: grub-core/lib/ieee1275/halt.c:28 +msgid "power-off" +msgstr "" + +#: grub-core/lib/ieee1275/halt.c:29 +msgid "shut-down" +msgstr "" + +#: grub-core/lib/ieee1275/halt.c:30 +msgid "poweroff" +msgstr "" + +#: grub-core/lib/ieee1275/reboot.c:25 +msgid "reset-all" +msgstr "" + +#: grub-core/lib/ieee1275/cmos.c:41 +msgid "m5819" +msgstr "" + +#: grub-core/lib/ieee1275/datetime.c:37 +msgid "rtc" +msgstr "" + +#: grub-core/lib/ieee1275/datetime.c:87 +msgid "get-time" +msgstr "" + +#: grub-core/lib/ieee1275/datetime.c:139 +msgid "set-time" +msgstr "" + +#: grub-core/lib/ieee1275/halt.c:28 +msgid "power-off" +msgstr "" + +#: grub-core/lib/ieee1275/halt.c:29 +msgid "shut-down" +msgstr "" + +#: grub-core/lib/ieee1275/halt.c:30 +msgid "poweroff" +msgstr "" + +#: grub-core/lib/ieee1275/reboot.c:25 +msgid "reset-all" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:32 grub-core/lib/posix_wrap/wctype.h:42 +msgid "xdigit" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:39 +msgid "alnum" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:39 +msgid "cntrl" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:39 +msgid "lower" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:40 +msgid "alpha" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:40 +msgid "digit" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:41 +msgid "print" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:41 +msgid "upper" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:41 +msgid "blank" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:42 +msgid "graph" +msgstr "" + +#: grub-core/lib/posix_wrap/wctype.h:42 +msgid "punct" +msgstr "" + +#: grub-core/lib/reed_solomon.c:64 grub-core/lib/reed_solomon.c:65 +#: grub-core/lib/reed_solomon.c:66 grub-core/lib/reed_solomon.c:67 +#: grub-core/lib/reed_solomon.c:68 grub-core/lib/reed_solomon.c:69 +#: grub-core/lib/reed_solomon.c:70 grub-core/lib/reed_solomon.c:71 +#: grub-core/lib/reed_solomon.c:72 grub-core/lib/reed_solomon.c:73 +#: include/grub/mips/loongson/kernel.h:31 +#: include/grub/mips/loongson/memory.h:46 +#: include/grub/mips/loongson/memory.h:47 include/grub/mips/loongson/time.h:25 +#: include/grub/mips/qemu_mips/memory.h:33 include/grub/mips/time.h:29 +#: util/grub-mkimage.c:1253 util/grub-mkimage.c:1564 +msgid ".text" +msgstr "" + +#: grub-core/lib/reed_solomon.c:428 +msgid "tst.bin" +msgstr "" + +#: grub-core/lib/reed_solomon.c:441 grub-core/lib/reed_solomon.c:445 +msgid "tst_rs.bin" +msgstr "" + +#: grub-core/lib/reed_solomon.c:441 grub-core/lib/reed_solomon.c:460 +#: grub-core/lib/reed_solomon.c:465 util/grub-editenv.c:121 +#: util/grub-editenv.c:209 util/grub-fstest.c:202 util/grub-glue-efi.c:199 +#: util/grub-mkfont.c:782 util/grub-mkfont.c:819 util/grub-mkfont.c:843 +#: util/grub-mkimage.c:1975 util/grub-render-label.c:257 util/grub-setup.c:665 +#: util/grub-setup.c:672 +msgid "wb" +msgstr "" + +#: grub-core/lib/reed_solomon.c:460 +msgid "tst_dam.bin" +msgstr "" + +#: grub-core/lib/reed_solomon.c:465 +msgid "tst_rec.bin" +msgstr "" + +#: grub-core/loader/efi/appleloader.c:142 +msgid "Core Duo/Solo" +msgstr "" + +#: grub-core/loader/efi/appleloader.c:143 +msgid "Mac Pro" +msgstr "" + +#: grub-core/loader/efi/appleloader.c:144 +msgid "MBP" +msgstr "" + +#: grub-core/loader/efi/appleloader.c:145 +msgid "MBA" +msgstr "" + +#: grub-core/loader/efi/appleloader.c:146 +msgid "MB NV" +msgstr "" + +#: grub-core/loader/efi/appleloader.c:147 +msgid "MB NV2" +msgstr "" + +#: grub-core/loader/efi/appleloader.c:148 +msgid "MBP2011" +msgstr "" + +#: grub-core/loader/efi/appleloader.c:149 +msgid "MBP2012" +msgstr "" + +#: grub-core/loader/i386/bsd.c:135 +msgid "wdXY" +msgstr "" + +#: grub-core/loader/i386/bsd.c:428 grub-core/loader/i386/bsd.c:429 +msgid "/boot/zfs/zpool.cache" +msgstr "" + +#: grub-core/loader/i386/bsd.c:1606 grub-core/loader/i386/bsd.c:1609 +#: grub-core/loader/i386/bsd.c:1700 grub-core/loader/i386/bsd.c:1708 +#: grub-core/loader/i386/bsd.c:1710 +msgid "com" +msgstr "" + +#: grub-core/loader/i386/bsd.c:1735 +msgid "pc" +msgstr "" + +#: grub-core/loader/i386/bsd.c:1825 +#, c-format +msgid "kFreeBSD.%s" +msgstr "" + +#: grub-core/loader/i386/bsd.c:1892 +msgid "type=" +msgstr "" + +#: grub-core/loader/i386/bsdXX.c:369 +msgid "_DYNAMIC" +msgstr "" + +#: grub-core/loader/i386/bsdXX.c:604 +msgid "rd_root_image" +msgstr "" + +#: grub-core/loader/i386/bsdXX.c:606 +msgid "rd_root_size" +msgstr "" + +#: grub-core/loader/i386/linux.c:550 grub-core/term/i386/pc/vga_text.c:256 +#: grub-core/term/i386/pc/vga_text.c:281 +msgid "vga_text" +msgstr "" + +#: grub-core/loader/i386/linux.c:900 grub-core/loader/i386/pc/linux.c:244 +msgid "vga=" +msgstr "" + +#: grub-core/loader/i386/linux.c:913 grub-core/loader/i386/pc/linux.c:252 +msgid "ext" +msgstr "" + +#: grub-core/loader/i386/linux.c:915 grub-core/loader/i386/pc/linux.c:254 +msgid "ask" +msgstr "" + +#: grub-core/loader/i386/linux.c:985 grub-core/loader/i386/pc/linux.c:264 +msgid "mem=" +msgstr "" + +#: grub-core/loader/i386/pc/chainloader.c:104 +msgid "FAT12" +msgstr "" + +#: grub-core/loader/i386/pc/chainloader.c:105 +msgid "FAT16" +msgstr "" + +#: grub-core/loader/i386/pc/chainloader.c:106 +msgid "FAT32" +msgstr "" + +#: grub-core/loader/i386/pc/chainloader.c:256 +msgid "--force" +msgstr "" + +#: grub-core/loader/i386/pc/chainloader.c:263 +msgid "--bpb" +msgstr "" + +#: grub-core/loader/i386/pc/linux.c:235 +msgid "bzImage" +msgstr "" + +#: grub-core/loader/i386/pc/linux.c:235 +msgid "zImage" +msgstr "" + +#: include/grub/util/lvm.h:28 +msgid "/dev/linux_lvm/" +msgstr "" + +#: include/grub/zfs/dmu.h:110 +msgid "root_dataset" +msgstr "" + +#: include/grub/zfs/dmu.h:111 +msgid "sync_bplist" +msgstr "" + +#: include/grub/zfs/dmu.h:112 +msgid "errlog_scrub" +msgstr "" + +#: include/grub/zfs/dmu.h:113 +msgid "errlog_last" +msgstr "" + +#: include/grub/zfs/dmu.h:114 +msgid "spares" +msgstr "" + +#: include/grub/zfs/dmu.h:115 +msgid "deflate" +msgstr "" + +#: include/grub/zfs/dmu.h:116 +msgid "history" +msgstr "" + +#: include/grub/zfs/dmu.h:117 +msgid "pool_props" +msgstr "" + +#: include/grub/zfs/dmu.h:118 +msgid "l2cache" +msgstr "" + +#: include/grub/zfs/zfs_znode.h:29 +msgid "ROOT" +msgstr "" + +#: include/grub/zfs/zfs_znode.h:30 +msgid "VERSION" +msgstr "" + +#: include/grub/zfs/zfs_znode.h:31 +msgid "SA_ATTRS" +msgstr "" + +#: util/grub-editenv.c:106 util/grub-setup.c:1117 +msgid "\v" +msgstr "" + +#: util/grub-editenv.c:120 +#, c-format +msgid "%s.new" +msgstr "" + +#: util/grub-fstest.c:547 util/grub-mount.c:463 +msgid "prompt" +msgstr "" + +#: util/grub-fstest.c:666 +msgid "cp" +msgstr "" + +#: util/grub-fstest.c:747 util/grub-mount.c:571 +msgid "loop0" +msgstr "" + +#: util/grub-fstest.c:747 util/grub-mount.c:571 +msgid "md0" +msgstr "" + +#: util/grub-mkfont.c:981 +msgid "ascii-bitmaps" +msgstr "" + +#: util/grub-mkfont.c:982 +msgid "width-spec" +msgstr "" + +#: util/grub-mkfont.c:1003 +msgid "no-hinting" +msgstr "" + +#: util/grub-mkfont.c:1004 +msgid "no-bitmap" +msgstr "" + +#: util/grub-mkimage.c:574 +msgid "PowerPC" +msgstr "" + +#: util/grub-mkimage.c:1878 +msgid "(memdisk)/boot/grub" +msgstr "" + +#: util/grub-mkimage.c:1896 +msgid "xz" +msgstr "" + +#: util/misc.c:312 +msgid "PHYSICALDRIVE" +msgstr "" + +#: grub-core/term/ns8250.c:268 +#, c-format +msgid "com%d" +msgstr "" + +#: grub-core/term/ns8250.c:315 grub-core/term/serial.c:190 +#, c-format +msgid "port%lx" +msgstr "" + +#: grub-core/term/serial.c:183 +#, c-format +msgid "com%ld" +msgstr "" + +#: grub-core/term/serial.c:199 grub-core/term/serial.c:268 +msgid "com0" +msgstr "" + +#: grub-core/term/serial.c:219 +msgid "odd" +msgstr "" + +#: grub-core/term/serial.c:221 +msgid "even" +msgstr "" + +#: grub-core/term/serial.c:230 +msgid "1" +msgstr "" + +#: grub-core/term/serial.c:232 +msgid "2" +msgstr "" + +#: grub-core/term/serial.c:234 +msgid "1.5" +msgstr "" + +#: grub-core/term/serial.c:269 +msgid "com2" +msgstr "" + +#: grub-core/term/serial.c:270 +msgid "com1" +msgstr "" + +#: grub-core/term/serial.c:295 +#, c-format +msgid "serial_%s" +msgstr "" + +#: grub-core/term/serial.c:338 grub-core/term/serial.c:339 +#: grub-core/term/serial.c:343 grub-core/term/serial.c:344 +#: grub-core/term/serial.c:347 grub-core/term/serial.c:348 +msgid "serial_*" +msgstr "" + +#: grub-core/term/usb_keyboard.c:217 +#, c-format +msgid "usb_keyboard%d" +msgstr "" + +#: grub-core/video/efi_gop.c:308 +msgid "agp-internal-edid" +msgstr "" + +#: grub-core/video/efi_uga.c:134 +msgid "VMEM" +msgstr "" + +#: grub-core/video/efi_uga.c:134 +msgid "MMIO" +msgstr "" + +#: grub-core/video/ieee1275.c:74 +msgid "display" +msgstr "" + +#: grub-core/video/readers/jpeg.c:802 +msgid ".jpg" +msgstr "" + +#: grub-core/video/readers/jpeg.c:808 +msgid ".jpeg" +msgstr "" + +#: grub-core/video/readers/tga.c:477 +msgid ".tga" +msgstr "" + +#: grub-core/video/video.c:516 grub-core/video/video.c:545 +msgid "keep" +msgstr "" + +#: grub-core/video/video.c:517 +msgid "keep," +msgstr "" + +#: grub-core/video/video.c:518 +msgid "keep;" +msgstr "" + +#: include/grub/acpi.h:27 +msgid "RSD PTR " +msgstr "" + +#: include/grub/acpi.h:76 +msgid "APIC" +msgstr "" + +#: include/grub/dl.h:82 +msgid ", _" +msgstr "" + +#: include/grub/dl.h:113 include/grub/dl.h:121 include/grub/dl.h:128 +msgid "LICENSE=" +msgstr "" + +#: include/grub/dl.h:129 +msgid "\\license" +msgstr "" + +#: include/grub/efi/api.h:465 include/grub/types.h:78 include/grub/types.h:96 +#: include/grub/types.h:97 +msgid "lx" +msgstr "" + +#: include/grub/elf.h:117 +msgid "ELF" +msgstr "" + +#: include/grub/elf.h:968 +msgid "SUNW Solaris" +msgstr "" + +#: include/grub/elf.h:971 +msgid "GNU" +msgstr "" + +#: include/grub/emu/misc.h:42 +msgid "/device.map" +msgstr "" + +#: include/grub/fontformat.h:23 +msgid "PFF2" +msgstr "" + +#: include/grub/fontformat.h:26 +msgid "PTSZ" +msgstr "" + +#: include/grub/fontformat.h:27 +msgid "WEIG" +msgstr "" + +#: include/grub/fontformat.h:28 +msgid "MAXW" +msgstr "" + +#: include/grub/fontformat.h:29 +msgid "MAXH" +msgstr "" + +#: include/grub/fontformat.h:30 +msgid "ASCE" +msgstr "" + +#: include/grub/fontformat.h:31 +msgid "DESC" +msgstr "" + +#: include/grub/fontformat.h:32 +msgid "CHIX" +msgstr "" + +#: include/grub/fontformat.h:33 +msgid "DATA" +msgstr "" + +#: include/grub/fontformat.h:34 +msgid "FAMI" +msgstr "" + +#: include/grub/fontformat.h:35 +msgid "SLAN" +msgstr "" + +#: include/grub/gcrypt/gcrypt.h:55 +msgid "@VERSION@" +msgstr "" + +#: include/grub/gui.h:32 +msgid "__timeout__" +msgstr "" + +#: include/grub/i386/bsd.h:48 +msgid "elf kernel" +msgstr "" + +#: include/grub/i386/bsd.h:49 +msgid "elf64 kernel" +msgstr "" + +#: include/grub/i386/bsd.h:50 +msgid "elf module" +msgstr "" + +#: include/grub/i386/bsd.h:51 +msgid "elf obj module" +msgstr "" + +#: include/grub/i386/pc/pxe.h:166 +msgid "PXENV+" +msgstr "" + +#: include/grub/i386/pc/pxe.h:193 +msgid "!PXE" +msgstr "" + +#: include/grub/keyboard_layouts.h:22 +msgid "GRUBLAYO" +msgstr "" + +#: grub-core/video/sm712.c:263 +#, c-format +msgid " {-1, 0x%x, 0x5},\n" +msgstr "" + +#: grub-core/video/sm712.c:248 +#, c-format +msgid " {1, 0x%x, 0x%x},\n" +msgstr "" + +#: grub-core/video/sm712.c:250 +#, c-format +msgid " .byte 0x%02x, 0x%02x\n" +msgstr "" + +#: include/grub/types.h:74 include/grub/types.h:113 include/grub/types.h:114 +msgid "x" +msgstr "" + +#: include/grub/types.h:75 include/grub/types.h:115 +msgid "u" +msgstr "" + +#: include/grub/types.h:79 include/grub/types.h:98 +msgid "lu" +msgstr "" + +#: include/grub/types.h:82 include/grub/types.h:101 include/grub/types.h:102 +msgid "llx" +msgstr "" + +#: include/grub/types.h:83 include/grub/types.h:103 +msgid "llu" +msgstr "" + +#: include/grub/types.h:99 +msgid "ld" +msgstr "" + +#: include/grub/types.h:104 +msgid "lld" +msgstr "" + +#: util/grub-fstest.c:363 +#, c-format +msgid "%08x\n" +msgstr "" + +#: util/grub-fstest.c:387 util/grub-fstest.c:488 util/grub-mount.c:363 +#: util/grub-mount.c:418 +#, c-format +msgid "loop%d" +msgstr "" + +#: util/grub-fstest.c:391 util/grub-mount.c:367 +#, c-format +msgid "(host)%s" +msgstr "" + +#: util/grub-menulst2cfg.c:95 util/grub-menulst2cfg.c:112 +#, c-format +msgid "" +"}\n" +"\n" +msgstr "" + +#: util/grub-menulst2cfg.c:99 +#, c-format +msgid "menuentry '%s' {\n" +msgstr "" + +#: util/grub-mkfont.c:159 util/grub-mkfont.c:1203 +#, c-format +msgid ": %s\n" +msgstr "" + +#: util/grub-mkfont.c:171 +#, c-format +msgid "%x\n" +msgstr "" + +#: grub-core/loader/i386/xnu.c:181 grub-core/loader/i386/xnu.c:186 +#: include/grub/i386/tsc.h:45 include/grub/i386/tsc.h:48 +#: include/grub/i386/tsc.h:127 include/grub/i386/tsc.h:133 +msgid "%rax" +msgstr "" + +#: grub-core/loader/i386/xnu.c:459 +msgid "device-properties" +msgstr "" + +#: grub-core/loader/i386/xnu.c:658 +msgid "firmware-revision" +msgstr "" + +#: grub-core/loader/i386/xnu.c:668 +msgid "firmware-vendor" +msgstr "" + +#: grub-core/loader/i386/xnu.c:679 +msgid "firmware-abi" +msgstr "" + +#: grub-core/loader/i386/xnu.c:682 grub-core/loader/i386/xnu.c:687 +msgid "EFI32" +msgstr "" + +#: grub-core/loader/i386/xnu.c:689 +msgid "EFI64" +msgstr "" + +#: grub-core/loader/i386/xnu.c:693 +msgid "platform" +msgstr "" + +#: grub-core/loader/i386/xnu.c:698 +msgid "FSBFrequency" +msgstr "" + +#: grub-core/loader/i386/xnu.c:720 +msgid "configuration-table" +msgstr "" + +#: grub-core/loader/i386/xnu.c:761 +#, c-format +msgid "%08x-%04x-%04x-%02x%02x-" +msgstr "" + +#: grub-core/loader/i386/xnu.c:786 grub-core/loader/i386/xnu.c:820 +msgid "table" +msgstr "" + +#: grub-core/loader/i386/xnu.c:804 +msgid "alias" +msgstr "" + +#: grub-core/loader/i386/xnu.c:817 +msgid "runtime-services" +msgstr "" + +#: grub-core/loader/ia64/efi/linux.c:343 +msgid "b" +msgstr "" + +#: grub-core/loader/ia64/efi/linux.c:522 include/grub/lib/cmdline.h:25 +msgid "BOOT_IMAGE=" +msgstr "" + +#: grub-core/loader/ia64/efi/linux.c:539 +msgid "BOOT_IMAGE" +msgstr "" + +#: grub-core/loader/linux.c:164 +msgid "newc:" +msgstr "" + +#: grub-core/loader/macho32.c:18 +msgid "32" +msgstr "" + +#: grub-core/loader/macho64.c:18 +msgid "64" +msgstr "" + +#: grub-core/loader/mips/linux.c:46 +msgid "machtype=lemote-yeeloong-2f-8.9inches" +msgstr "" + +#: grub-core/loader/mips/linux.c:47 +msgid "machtype=lemote-fuloong-2f-box" +msgstr "" + +#: grub-core/loader/mips/linux.c:48 +msgid "machtype=lemote-fuloong-2e-unknown" +msgstr "" + +#: grub-core/loader/mips/linux.c:280 grub-core/loader/mips/linux.c:357 +#: grub-core/loader/mips/linux.c:466 +msgid "rd_start=0xXXXXXXXXXXXXXXXX" +msgstr "" + +#: grub-core/loader/mips/linux.c:281 grub-core/loader/mips/linux.c:362 +msgid "rd_size=0xXXXXXXXXXXXXXXXX" +msgstr "" + +#: grub-core/loader/mips/linux.c:286 grub-core/loader/mips/linux.c:374 +msgid "memsize=XXXXXXXXXXXXXXXXXXXX" +msgstr "" + +#: grub-core/loader/mips/linux.c:287 grub-core/loader/mips/linux.c:380 +msgid "highmemsize=XXXXXXXXXXXXXXXXXXXX" +msgstr "" + +#: grub-core/loader/mips/linux.c:288 grub-core/loader/mips/linux.c:387 +msgid "busclock=XXXXXXXXXX" +msgstr "" + +#: grub-core/loader/mips/linux.c:289 grub-core/loader/mips/linux.c:392 +msgid "cpuclock=XXXXXXXXXX" +msgstr "" + +#: grub-core/loader/mips/linux.c:375 +#, c-format +msgid "memsize=%lld" +msgstr "" + +#: grub-core/loader/mips/linux.c:381 +#, c-format +msgid "highmemsize=%lld" +msgstr "" + +#: grub-core/loader/mips/linux.c:388 +#, c-format +msgid "busclock=%d" +msgstr "" + +#: grub-core/loader/mips/linux.c:393 +#, c-format +msgid "cpuclock=%d" +msgstr "" + +#: grub-core/loader/mips/linux.c:456 +msgid "%s rd_start=0x%" +msgstr "" + +#: grub-core/loader/mips/linux.c:457 +msgid " rd_size=0x%" +msgstr "" + +#: grub-core/loader/mips/linux.c:466 +#, c-format +msgid "rd_start=0x%llx" +msgstr "" + +#: grub-core/loader/mips/linux.c:473 +msgid "rd_size=0xXXXXXXXXXXXXXXXXX" +msgstr "" + +#: grub-core/loader/mips/linux.c:473 +#, c-format +msgid "rd_size=0x%llx" +msgstr "" + +#: grub-core/loader/multiboot.c:207 +#, c-format +msgid "%dx%dx%d,%dx%d,auto" +msgstr "" + +#: grub-core/loader/multiboot.c:210 +#, c-format +msgid "%dx%d,auto" +msgstr "" + +#: grub-core/loader/sparc64/ieee1275/linux.c:454 +msgid "/virtual-memory" +msgstr "" + +#: grub-core/loader/xnu.c:222 grub-core/loader/xnu.c:568 +msgid "memory-map" +msgstr "" + +#: grub-core/loader/xnu.c:229 +msgid "DeviceTree" +msgstr "" + +#: grub-core/loader/xnu.c:617 +msgid "/Contents/" +msgstr "" + +#: grub-core/loader/xnu.c:748 +msgid "Driver-" +msgstr "" + +#: grub-core/loader/xnu.c:867 +msgid "DriversPackage-" +msgstr "" + +#: grub-core/loader/xnu.c:907 +msgid "RAMDisk" +msgstr "" + +#: grub-core/loader/xnu.c:961 +msgid "OSBundleRequired" +msgstr "" + +#: grub-core/loader/xnu.c:964 +msgid "CFBundleExecutable" +msgstr "" + +#: grub-core/loader/xnu.c:998 +msgid "key" +msgstr "" + +#: grub-core/loader/xnu.c:1000 grub-core/net/bootp.c:373 +msgid "string" +msgstr "" + +#: grub-core/loader/xnu.c:1002 +msgid "/key" +msgstr "" + +#: grub-core/loader/xnu.c:1043 +msgid ".kext" +msgstr "" + +#: grub-core/loader/xnu.c:1128 +msgid "Contents" +msgstr "" + +#: grub-core/loader/xnu.c:1133 +msgid "Plugins" +msgstr "" + +#: grub-core/loader/xnu.c:1139 +msgid "MacOS" +msgstr "" + +#: grub-core/loader/xnu.c:1143 +msgid "Info.plist" +msgstr "" + +#: grub-core/loader/xnu.c:1204 grub-core/loader/xnu.c:1207 +msgid "/MacOS/" +msgstr "" + +#: grub-core/loader/xnu.c:1283 +msgid "console,root,local-root,network-root" +msgstr "" + +#: grub-core/loader/xnu.c:1344 grub-core/loader/xnu.c:1345 +#: grub-core/loader/xnu.c:1348 +msgid "XNU.DeviceTree." +msgstr "" + +#: grub-core/net/bootp.c:40 +msgid "net_" +msgstr "" + +#: grub-core/net/bootp.c:40 include/grub/dl.h:82 include/grub/symbol.h:34 +msgid "_" +msgstr "" + +#: grub-core/net/bootp.c:43 +#, c-format +msgid "net_%s_%s" +msgstr "" + +#: grub-core/net/bootp.c:102 +msgid ":default" +msgstr "" + +#: grub-core/net/bootp.c:109 +#, c-format +msgid "%s:default" +msgstr "" + +#: grub-core/net/bootp.c:127 +msgid "hostname" +msgstr "" + +#: grub-core/net/bootp.c:131 +msgid "domain" +msgstr "" + +#: grub-core/net/bootp.c:135 +msgid "rootpath" +msgstr "" + +#: grub-core/net/bootp.c:139 +msgid "extensionspath" +msgstr "" + +#: grub-core/net/bootp.c:183 +msgid ":gw" +msgstr "" + +#: grub-core/net/bootp.c:190 +#, c-format +msgid "%s:gw" +msgstr "" + +#: grub-core/net/bootp.c:200 +msgid "boot_file" +msgstr "" + +#: grub-core/net/bootp.c:206 grub-core/net/net.c:713 +#, c-format +msgid "%d.%d.%d.%d" +msgstr "" + +#: grub-core/net/bootp.c:216 +#, c-format +msgid "tftp,%d.%d.%d.%d" +msgstr "" + +#: grub-core/net/bootp.c:226 +msgid "dhcp_server_name" +msgstr "" + +#: grub-core/net/bootp.c:235 +#, c-format +msgid "tftp,%s" +msgstr "" + +#: grub-core/net/bootp.c:277 +#, c-format +msgid "%s:dhcp" +msgstr "" + +#: grub-core/net/bootp.c:294 +msgid ":dhcp_tmp" +msgstr "" + +#: grub-core/net/bootp.c:387 +msgid "number" +msgstr "" + +#: grub-core/net/bootp.c:394 +#, c-format +msgid "%llu\n" +msgstr "" + +#: grub-core/net/bootp.c:398 +#, c-format +msgid "%lld\n" +msgstr "" + +#: grub-core/net/bootp.c:460 +#, c-format +msgid "%s:dhcp_tmp" +msgstr "" + +#: grub-core/net/drivers/arc/arcnet.c:89 +#, c-format +msgid "<%lu>" +msgstr "" + +#: grub-core/net/drivers/efi/efinet.c:205 +#, c-format +msgid "efinet%d" +msgstr "" + +#: grub-core/net/drivers/emu/emunet.c:104 +msgid "/dev/net/tun" +msgstr "" + +#: grub-core/net/drivers/ieee1275/ofnet.c:43 +#: grub-core/net/drivers/ieee1275/ofnet.c:47 +msgid ":speed=auto,duplex=auto,1.1.1.1,dummy,1.1.1.1,1.1.1.1,5,5,1.1.1.1,512" +msgstr "" + +#: grub-core/net/drivers/ieee1275/ofnet.c:135 +msgid "bootp-response" +msgstr "" + +#: grub-core/net/drivers/ieee1275/ofnet.c:136 +msgid "dhcp-response" +msgstr "" + +#: grub-core/net/drivers/ieee1275/ofnet.c:137 +msgid "bootpreply-packet" +msgstr "" + +#: grub-core/net/drivers/ieee1275/ofnet.c:266 +msgid "alloc-mem" +msgstr "" + +#: grub-core/net/drivers/ieee1275/ofnet.c:291 +#, c-format +msgid "ofnet_%s" +msgstr "" + +#: grub-core/net/http.c:103 grub-core/net/http.c:109 +msgid "HTTP/1.1 " +msgstr "" + +#: grub-core/net/http.c:133 grub-core/net/http.c:136 +msgid "Content-Length: " +msgstr "" + +#: grub-core/net/http.c:141 grub-core/net/http.c:142 +msgid "Transfer-Encoding: chunked" +msgstr "" + +#: grub-core/net/http.c:317 grub-core/net/http.c:330 grub-core/net/http.c:336 +msgid "GET " +msgstr "" + +#: grub-core/net/http.c:319 grub-core/net/http.c:349 grub-core/net/http.c:355 +#: grub-core/net/http.c:356 +msgid "" +" HTTP/1.1\r\n" +"Host: " +msgstr "" + +#: grub-core/net/http.c:321 grub-core/net/http.c:370 grub-core/net/http.c:377 +#: grub-core/net/http.c:378 +msgid "" +"\r\n" +"User-Agent: " +msgstr "" + +#: grub-core/net/http.c:322 grub-core/net/http.c:370 grub-core/net/http.c:377 +#: grub-core/net/http.c:378 grub-core/net/http.c:392 +msgid "\r\n" +msgstr "" + +#: grub-core/net/http.c:323 grub-core/net/http.c:383 +msgid "" +"Range: bytes=XXXXXXXXXXXXXXXXXXXX-\r\n" +"\r\n" +msgstr "" + +#: grub-core/net/http.c:386 +msgid "Range: bytes=%" +msgstr "" + +#: grub-core/net/http.c:386 +msgid "" +"-\r\n" +"\r\n" +msgstr "" + +#: grub-core/net/icmp6.c:416 +msgid ":XXXXXXXXXXXXXXXXXXXX" +msgstr "" + +#: grub-core/net/icmp6.c:417 +#, c-format +msgid "%s:%d" +msgstr "" + +#: grub-core/net/net.c:230 grub-core/net/net.c:238 +msgid ":slaac" +msgstr "" + +#: grub-core/net/net.c:253 grub-core/net/net.c:276 +msgid ":link" +msgstr "" + +#: grub-core/net/net.c:822 +msgid "net__mac" +msgstr "" + +#: grub-core/net/net.c:825 +#, c-format +msgid "net_%s_mac" +msgstr "" + +#: grub-core/net/net.c:835 +msgid "net__ip" +msgstr "" + +#: grub-core/net/net.c:838 +#, c-format +msgid "net_%s_ip" +msgstr "" + +#: grub-core/net/net.c:908 +#, c-format +msgid "%s:local" +msgstr "" + +#: grub-core/net/net.c:1054 +msgid "gw" +msgstr "" + +#: grub-core/net/net.c:1091 +#, c-format +msgid "%d.%d.%d.%d/%d " +msgstr "" + +#: grub-core/net/net.c:1184 grub-core/net/net.c:1188 +msgid "pxe:" +msgstr "" + +#: grub-core/net/tftp.c:180 grub-core/net/tftp.c:181 grub-core/net/tftp.c:343 +#: grub-core/net/tftp.c:344 grub-core/net/tftp.c:345 +msgid "tsize" +msgstr "" + +#: grub-core/net/tftp.c:183 grub-core/net/tftp.c:184 grub-core/net/tftp.c:335 +#: grub-core/net/tftp.c:336 grub-core/net/tftp.c:337 +msgid "blksize" +msgstr "" + +#: grub-core/net/tftp.c:331 grub-core/net/tftp.c:332 grub-core/net/tftp.c:333 +msgid "octet" +msgstr "" + +#: grub-core/net/tftp.c:339 grub-core/net/tftp.c:340 grub-core/net/tftp.c:341 +msgid "1024" +msgstr "" + +#: grub-core/net/tftp.c:431 grub-core/net/tftp.c:437 +msgid "closed" +msgstr "" + +#: grub-core/normal/auth.c:178 +msgid "\b" +msgstr "" + +#: grub-core/normal/autofs.c:74 +msgid "/fs.lst" +msgstr "" + +#: grub-core/normal/completion.c:133 +msgid "\" " +msgstr "" + +#: grub-core/normal/completion.c:135 util/grub-probe.c:506 +#: util/grub-probe.c:544 +#, c-format +msgid "' " +msgstr "" + +#: grub-core/normal/completion.c:337 +msgid "- " +msgstr "" + +#: grub-core/normal/completion.c:348 +msgid "-u" +msgstr "" + +#: grub-core/normal/completion.c:364 util/ieee1275/grub-ofpathname.c:39 +msgid "--help" +msgstr "" + +#: grub-core/normal/completion.c:366 +msgid "--usage" +msgstr "" + +#: grub-core/normal/crypto.c:90 +msgid "/crypto.lst" +msgstr "" + +#: grub-core/normal/dyncmd.c:104 +msgid "/command.lst" +msgstr "" + +#: grub-core/normal/main.c:363 +#, c-format +msgid "%s/grub.cfg" +msgstr "" + +#: grub-core/normal/main.c:516 +msgid "feature_chainloader_bpb" +msgstr "" + +#: grub-core/normal/main.c:516 +msgid "feature_ntldr" +msgstr "" + +#: grub-core/normal/main.c:516 +msgid "feature_platform_search_hint" +msgstr "" + +#: grub-core/normal/main.c:517 +msgid "feature_default_font_path" +msgstr "" + +#: grub-core/normal/main.c:517 +msgid "feature_all_video_module" +msgstr "" + +#: grub-core/normal/main.c:518 +msgid "feature_menuentry_id" +msgstr "" + +#: grub-core/normal/main.c:518 +msgid "feature_menuentry_options" +msgstr "" + +#: grub-core/normal/main.c:518 +msgid "feature_200_final" +msgstr "" + +#: grub-core/normal/main.c:519 +msgid "feature_nativedisk_cmd" +msgstr "" + +#: grub-core/normal/main.c:568 +msgid "white/black" +msgstr "" + +#: grub-core/normal/main.c:569 +msgid "black/white" +msgstr "" + +#: grub-core/normal/term.c:326 +msgid "/terminal.lst" +msgstr "" + +#: grub-core/partmap/amiga.c:34 +msgid "RDSK" +msgstr "" + +#: grub-core/partmap/amiga.c:51 +msgid "PART" +msgstr "" + +#: grub-core/term/at_keyboard.c:642 grub-core/term/at_keyboard.c:654 +msgid "at_keyboard" +msgstr "" + +#: grub-core/term/efi/serial.c:170 grub-core/term/efi/serial.c:173 +msgid "efiXXXXXXXXXXXXXXXXXXXX" +msgstr "" + +#: grub-core/term/efi/serial.c:174 +#, c-format +msgid "efi%d" +msgstr "" + +#: grub-core/term/emu/console.c:166 +msgid "vt100-color" +msgstr "" + +#: grub-core/term/i386/pc/vga_text.c:254 grub-core/term/i386/pc/vga_text.c:279 +msgid "mda_text" +msgstr "" + +#: grub-core/term/ieee1275/console.c:152 +msgid "cursor-on" +msgstr "" + +#: grub-core/term/ieee1275/console.c:154 +msgid "cursor-off" +msgstr "" + +#: grub-core/term/ieee1275/console.c:179 +msgid "output-device output" +msgstr "" + +#: grub-core/term/ieee1275/console.c:255 +msgid "dumb" +msgstr "" + +#: grub-core/term/ieee1275/console.c:257 +msgid "ieee1275-nocursor" +msgstr "" + +#: grub-core/term/ieee1275/console.c:259 +msgid "ieee1275" +msgstr "" + +#: grub-core/term/ieee1275/escc.c:229 +#, c-format +msgid "escc-ch-%c" +msgstr "" + +#: grub-core/term/ieee1275/escc.c:250 +msgid "mac-io" +msgstr "" + +#: grub-core/term/ieee1275/escc.c:269 +msgid "escc" +msgstr "" + +#: grub-core/term/morse.c:126 +msgid "audio" +msgstr "" + +#: include/grub/lvm.h:32 +msgid "LABELONE" +msgstr "" + +#: include/grub/lvm.h:33 +msgid "LVM2 001" +msgstr "" + +#: include/grub/macho.h:127 +msgid "complzss" +msgstr "" + +#: include/grub/net.h:459 +msgid "XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX" +msgstr "" + +#: include/grub/net.h:466 +msgid "XX:XX:XX:XX:XX:XX" +msgstr "" + +#: include/grub/symbol.h:44 +msgid "function" +msgstr "" + +#: include/grub/symbol.h:45 +msgid "object" +msgstr "" + +#: grub-core/lib/adler32.c:84 +msgid "ADLER32" +msgstr "" + +#: grub-core/lib/arg.c:123 +msgid "-h, " +msgstr "" + +#: grub-core/lib/arg.c:125 +msgid "-u, " +msgstr "" + +#: grub-core/lib/arg.c:127 +msgid " " +msgstr "" + +#: grub-core/lib/arg.c:131 grub-core/normal/completion.c:376 +#, c-format +msgid "--%s" +msgstr "" + +#: grub-core/lib/arg.c:136 +#, c-format +msgid "=%s" +msgstr "" + +#: grub-core/loader/i386/xnu.c:55 +msgid "ACPI_20" +msgstr "" + +#: grub-core/loader/i386/xnu.c:56 grub-core/loader/i386/xnu.c:644 +#: grub-core/loader/i386/xnu.c:645 grub-core/loader/i386/xnu.c:649 +#: grub-core/loader/i386/xnu.c:650 +msgid "ACPI" +msgstr "" + +#: grub-core/net/net.c:1132 +msgid "gw " +msgstr "" + +#: grub-core/kern/rescue_reader.c:40 +msgid "> " +msgstr "" + +#: grub-core/kern/rescue_reader.c:40 +msgid "grub rescue> " +msgstr "" + +#: grub-core/term/arc/console.c:87 grub-core/term/arc/console.c:88 +#: grub-core/term/arc/console.c:89 grub-core/term/arc/console.c:91 +msgid "line" +msgstr "" + +#: grub-core/term/arc/console.c:120 +msgid "ConsoleOut" +msgstr "" + +#: grub-core/term/arc/console.c:206 grub-core/term/serial.c:252 +#: grub-core/term/serial.c:334 +msgid "vt100" +msgstr "" + +#: grub-core/term/arc/console.c:208 +msgid "arc" +msgstr "" + +#: grub-core/parttool/msdospart.c:88 +msgid "hidden" +msgstr "" + +#: grub-core/loader/xnu.c:1422 grub-core/term/gfxterm.c:1153 +msgid "stretch" +msgstr "" + +#: grub-core/loader/machoXX.c:326 grub-core/loader/machoXX.c:328 +#: grub-core/loader/machoXX.c:329 grub-core/loader/machoXX.c:331 +#: grub-core/loader/machoXX.c:333 +msgid "Darwin Kernel Version " +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:267 +#, c-format +msgid "sdB%u" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:270 +#, c-format +msgid "fd%u" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:290 +msgid "sdZ0" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:296 grub-core/loader/i386/pc/plan9.c:299 +#: grub-core/loader/i386/pc/plan9.c:308 grub-core/loader/i386/pc/plan9.c:311 +msgid "ata0" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:300 grub-core/loader/i386/pc/plan9.c:313 +#, c-format +msgid "sd%c%d" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:320 +#, c-format +msgid "sd0%u" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:331 grub-core/loader/i386/pc/plan9.c:346 +#: grub-core/loader/i386/pc/plan9.c:347 +msgid "part=" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:416 +#, c-format +msgid "%s!%s!%s" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:419 +#, c-format +msgid "%s!%s" +msgstr "" + +#: grub-core/commands/wildcard.c:83 +msgid "*.\\|+{}[]?" +msgstr "" + +#: grub-core/disk/dmraid_nvidia.c:71 +msgid "NVIDIA" +msgstr "" + +#: grub-core/commands/sleep.c:45 +#, c-format +msgid "%d " +msgstr "" + +#: grub-core/commands/verify.c:258 +msgid "" +msgstr "" + +#: grub-core/disk/cryptodisk.c:576 +msgid " sectors from sector 0x%" +msgstr "" + +#: grub-core/disk/cryptodisk.c:577 grub-core/disk/cryptodisk.c:626 +msgid " with offset of %" +msgstr "" + +#: grub-core/disk/cryptodisk.c:625 +msgid " sectors to sector 0x%" +msgstr "" + +#: grub-core/disk/geli.c:469 +msgid "" +msgstr "" + +#: grub-core/disk/luks.c:40 +msgid "LUKS" +msgstr "" + +#: grub-core/font/font.c:450 grub-core/font/font.c:454 +msgid "/fonts/" +msgstr "" + +#: grub-core/font/font.c:450 grub-core/font/font.c:456 +msgid ".pf2" +msgstr "" + +#: grub-core/fs/zfs/zfsinfo.c:117 +msgid "path" +msgstr "" + +#: grub-core/fs/zfs/zfsinfo.c:389 +#, c-format +msgid "zfs-bootfs=%s/%llu%s%s%s%s%s%s" +msgstr "" + +#: grub-core/fs/zfs/zfsinfo.c:391 +msgid ",bootpath=\"" +msgstr "" + +#: grub-core/fs/zfs/zfsinfo.c:393 grub-core/fs/zfs/zfsinfo.c:396 +msgid "\"" +msgstr "" + +#: grub-core/fs/zfs/zfsinfo.c:394 +msgid ",diskdevid=\"" +msgstr "" + +#: grub-core/gdb/cstub.c:26 +msgid "0123456789abcdef" +msgstr "" + +#: grub-core/lib/i386/halt.c:26 +msgid "Shutdown" +msgstr "" + +#: grub-core/lib/minilzo/lzoconf.h:48 +msgid "2.05" +msgstr "" + +#: grub-core/lib/minilzo/lzoconf.h:49 +msgid "Apr 23 2011" +msgstr "" + +#: grub-core/lib/minilzo/lzoconf.h:80 grub-core/lib/minilzo/lzoconf.h:233 +#: grub-core/lib/minilzo/minilzo.h:68 include/grub/gcrypt/gcrypt.h:44 +msgid "C" +msgstr "" + +#: grub-core/loader/i386/bsd.c:611 grub-core/loader/i386/bsd.c:613 +#: grub-core/loader/i386/bsd.c:657 grub-core/loader/i386/bsd.c:659 +msgid "kFreeBSD." +msgstr "" + +#: grub-core/loader/i386/bsd.c:939 grub-core/loader/i386/linux.c:497 +#: grub-core/loader/i386/xnu.c:870 grub-core/loader/multiboot.c:106 +#: grub-core/term/gfxterm.c:378 +#, c-format +msgid "%s;" +msgstr "" + +#: grub-core/loader/i386/linux.c:966 +#, c-format +msgid "%ux%ux%u,%ux%u" +msgstr "" + + +#: grub-core/loader/i386/pc/plan9.c:119 +msgid "linuxswap" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:146 grub-core/partmap/plan.c:46 +#: grub-core/partmap/plan.c:55 +msgid "part " +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:196 +#, c-format +msgid "%s.%d" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:457 grub-core/loader/i386/pc/plan9.c:479 +msgid "bootfile=" +msgstr "" + +#: grub-core/loader/i386/xnu.c:149 +msgid "ineIntel" +msgstr "" + +#: grub-core/loader/i386/xnu.c:159 +msgid "GenuineIntel" +msgstr "" + +#: grub-core/loader/i386/bsd.c:50 +msgid "800x600" +msgstr "" + +#: util/misc.c:151 +#, c-format +msgid " bytes at offset 0x%llx" +msgstr "" + +#: util/misc.c:165 +msgid " bytes" +msgstr "" + +#: include/grub/lib/envblk.h:22 +msgid "# GRUB Environment Block\n" +msgstr "" + +#: include/grub/lib/envblk.h:23 +msgid "grubenv" +msgstr "" + +#: grub-core/normal/misc.c:120 +msgid "ext*" +msgstr "" + +#: grub-core/partmap/msdos.c:74 +msgid "A" +msgstr "" + +#: grub-core/partmap/msdos.c:80 +msgid "A" +msgstr "" + +#: grub-core/partmap/msdos.c:86 +msgid "HP Backup and Recovery Manager (?)" +msgstr "" + +#: grub-core/partmap/msdos.c:87 +msgid "p]F5=U>" +msgstr "" + +#: grub-core/partmap/msdos.c:94 +msgid "ycgl" +msgstr "" + +#: grub-core/partmap/msdos.c:100 +msgid "Acer registration utility (?)" +msgstr "" + +#: grub-core/partmap/msdos.c:101 +msgid "GREGRegDone.Tag" +msgstr "" + +#: grub-core/script/execute.c:253 grub-core/script/execute.c:289 +msgid "#" +msgstr "" + +#: grub-core/script/execute.c:292 grub-core/script/execute.c:489 +#, c-format +msgid "%u" +msgstr "" + +#: grub-core/script/execute.c:693 +msgid "{" +msgstr "" + +#: grub-core/script/execute.c:705 +msgid "}" +msgstr "" + +#: grub-core/term/usb_keyboard.c:410 +#, c-format +msgid " report: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n" +msgstr "" + +#: grub-core/loader/i386/pc/plan9.c:47 +msgid "ZORT 0\r\n" +msgstr "" + +#: grub-core/loader/i386/bsd.c:486 +#, c-format +msgid " %-18s %-18s%14s%14s\n" +msgstr "" + +#: grub-core/loader/i386/bsd.c:495 +#, c-format +msgid " %-18s" +msgstr "" + +#: grub-core/loader/i386/bsd.c:502 +#, c-format +msgid " 0x%08x" +msgstr "" + +#: grub-core/loader/i386/bsd.c:510 +#, c-format +msgid " 0x%08x\n" +msgstr "" + +#: grub-core/loader/i386/bsd.c:552 +#, c-format +msgid " %-18s%14s%14s%14s\n" +msgstr "" + +#: grub-core/loader/i386/bsd.c:556 +#, c-format +msgid " %-18s 0x%08x 0x%08x 0x%08x" +msgstr "" + +#: grub-core/loader/mips/linux.c:271 grub-core/loader/mips/linux.c:324 +#: grub-core/loader/mips/linux.c:328 +msgid "a0" +msgstr "" + +#: grub-core/fs/btrfs.c:719 grub-core/fs/btrfs.c:814 +msgid " (%d stripes (%d substripes) of %" +msgstr "" + +#: grub-core/fs/btrfs.c:815 +msgid ") stripe %" +msgstr "" + +#: grub-core/fs/btrfs.c:816 +msgid " maps to 0x%" +msgstr "" + +#: grub-core/fs/btrfs.c:824 +msgid " for laddr 0x%" +msgstr "" + +#: grub-core/fs/btrfs.c:1671 grub-core/fs/ext2.c:961 +#: grub-core/fs/reiserfs.c:1363 grub-core/fs/xfs.c:881 +#, c-format +msgid "%04x%04x-%04x-%04x-%04x-%04x%04x%04x" +msgstr "" + +#: grub-core/lib/arg.c:109 grub-core/net/net.c:1169 +#, c-format +msgid "%s %s %s\n" +msgstr "" + +#: grub-core/lib/arg.c:121 +#, c-format +msgid "-%c%c " +msgstr "" + +#: grub-core/lib/arg.c:159 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" + +#: grub-core/normal/menu.c:680 grub-core/normal/menu_entry.c:1126 +#: util/grub-menulst2cfg.c:106 +msgid " " +msgstr "" + +#: grub-core/normal/menu.c:692 +msgid "" +"\n" +" " +msgstr "" + +#: grub-core/normal/menu.c:708 +msgid "" +"\n" +" " +msgstr "" + +#: grub-core/normal/menu_entry.c:1052 +msgid "" +"\n" +" " +msgstr "" + +#: grub-core/normal/misc.c:76 +msgid ".%02" +msgstr "" + +#: grub-core/normal/misc.c:80 +#, c-format +msgid "%llu%s" +msgstr "" + +#: grub-core/normal/misc.c:95 +msgid "\t" +msgstr "" + +#: grub-core/normal/main.c:573 +msgid "y" +msgstr "" + +#: grub-core/normal/menu.c:300 grub-core/normal/menu.c:572 +msgid "fallback" +msgstr "" + +#: grub-core/net/net.c:737 +#, c-format +msgid "%02x:" +msgstr "" + +#: grub-core/net/net.c:1105 +#, c-format +msgid "%s/%d " +msgstr "" + +#: grub-core/net/net.c:1152 +#, c-format +msgid "%s %s\n" +msgstr "" + +#: grub-core/net/net.c:234 grub-core/net/net.c:272 grub-core/net/net.c:696 +#: grub-core/net/net.c:703 +msgid ":" +msgstr "" + +#: grub-core/net/ip.c:427 grub-core/net/ip.c:685 +msgid ", expected %" +msgstr "" + +#: grub-core/disk/geli.c:151 +#, c-format +msgid " keysize=%d\n" +msgstr "" + +#: grub-core/disk/scsi.c:619 +#, c-format +msgid ", blocksize=%u\n" +msgstr "" + +#: grub-core/fs/iso9660.c:1045 +#, c-format +msgid "%c%c%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:1492 +msgid "big-endian gang\n" +msgstr "" + +#: grub-core/fs/zfs/zfs.c:1660 +msgid ", %p) for txg %" +msgstr "" + +#: include/grub/lvm.h:65 +msgid " LVM2 x[5A%r0N*>" +msgstr "" + +#: grub-core/video/sm712.c:267 +#, c-format +msgid " .byte 0x%04x, 0x00\n" +msgstr "" + +#: grub-core/kern/efi/mm.c:429 +#, c-format +msgid "MD: t=%x, p=%llx, v=%llx, n=%llx, a=%llx\n" +msgstr "" + +#: grub-core/kern/mm.c:402 +#, c-format +msgid "%s:%d: q=%p, q->size=0x%x, q->magic=0x%x\n" +msgstr "" + +#: grub-core/kern/mm.c:501 grub-core/kern/mm.c:529 +#, c-format +msgid "F:%p:%u:%p\n" +msgstr "" + +#: grub-core/kern/mm.c:516 +#, c-format +msgid "called at line %u\n" +msgstr "" + +#: grub-core/kern/mm.c:533 +#, c-format +msgid "A:%p:%u\n" +msgstr "" + +#: grub-core/kern/mm.c:548 +msgid "%s:%d: malloc (0x%" +msgstr "" + +#: grub-core/kern/mm.c:548 grub-core/kern/mm.c:561 grub-core/kern/mm.c:580 +#: grub-core/kern/mm.c:595 +msgid ") = " +msgstr "" + +#: grub-core/kern/mm.c:551 grub-core/kern/mm.c:564 grub-core/kern/mm.c:583 +#: grub-core/kern/mm.c:598 +#, c-format +msgid "%p\n" +msgstr "" + +#: grub-core/kern/mm.c:561 +msgid "%s:%d: zalloc (0x%" +msgstr "" + +#: grub-core/kern/mm.c:572 +#, c-format +msgid "%s:%d: free (%p)\n" +msgstr "" + +#: grub-core/kern/mm.c:580 +msgid "%s:%d: realloc (%p, 0x%" +msgstr "" + +#: grub-core/kern/mm.c:594 +msgid "%s:%d: memalign (0x%" +msgstr "" + +#: grub-core/lib/hexdump.c:49 grub-core/normal/menu_entry.c:1023 +msgid " " +msgstr "" + +#: grub-core/lib/hexdump.c:71 +msgid "*\n" +msgstr "" + +#: grub-core/lib/i386/backtrace.c:38 +#, c-format +msgid "%p: " +msgstr "" + +#: grub-core/lib/i386/backtrace.c:40 +msgid " (" +msgstr "" + +#: grub-core/lib/i386/backtrace.c:42 +#, c-format +msgid "%p," +msgstr "" + +#: grub-core/lib/i386/backtrace.c:43 +#, c-format +msgid "%p)\n" +msgstr "" + +#: grub-core/net/net.c:738 +msgid "XX:" +msgstr "" + +#: util/grub-mkimagexx.c:131 +msgid "_start" +msgstr "" + +#: grub-core/gfxmenu/gui_circular_progress.c:240 +msgid "°" +msgstr "" + +#: grub-core/kern/emu/argp_common.c:33 util/grub-editenv.c:61 +#: util/grub-fstest.c:531 util/grub-mount.c:449 +#, c-format +msgid "%s (%s) %s\n" +msgstr "" + +#: grub-core/video/sm712.c:252 grub-core/video/sm712.c:266 +#, c-format +msgid "FAIL\n" +msgstr "" + +#: grub-core/lib/hexdump.c:34 +#, c-format +msgid "%08lx " +msgstr "" + +#: grub-core/lib/backtrace.c:41 +msgid "%s.%x+%" +msgstr "" + +#: grub-core/commands/minicmd.c:113 +#, c-format +msgid "%x%x " +msgstr "" + +#: grub-core/commands/minicmd.c:158 +#, c-format +msgid "%s\t%d\t\t" +msgstr "" + +#: grub-core/disk/arc/arcdisk.c:238 grub-core/disk/arc/arcdisk.c:275 +#, c-format +msgid " failed: %ld\n" +msgstr "" + +#: grub-core/lib/xzembed/xz_stream.h:35 +msgid "7zXZ" +msgstr "" + +#: grub-core/lib/xzembed/xz_stream.h:38 +msgid "YZ" +msgstr "" + +#: grub-core/font/font.c:197 +msgid "" +msgstr "" + +#: grub-core/font/font.c:635 +msgid "Unknown" +msgstr "" + +#: grub-core/lib/crypto.c:83 grub-core/lib/libgcrypt_wrap/mem.c:99 +msgid "gcrypt" +msgstr "" + +#: grub-core/lib/crypto.c:85 +msgid "gcrypt error: " +msgstr "" + +#: grub-core/commands/acpihalt.c:217 +msgid "\\" +msgstr "" + +#: grub-core/commands/minicmd.c:85 +#, c-format +msgid "%s (%d%c)\t%s\n" +msgstr "" + +#: grub-core/commands/probe.c:77 grub-core/commands/probe.c:91 +#: util/grub-mkimage.c:1905 +msgid "none" +msgstr "" + +#: grub-core/lib/libgcrypt_wrap/mem.c:101 +msgid "gcrypt: " +msgstr "" + +#: grub-core/lib/libgcrypt_wrap/mem.c:113 +msgid "gcrypt bug: " +msgstr "" + +#: grub-core/lib/posix_wrap/assert.h:30 +#, c-format +msgid "Assertion failed at %s:%d\n" +msgstr "" + +#: include/grub/list.h:42 +msgid "bad type cast between incompatible grub types" +msgstr "" + +#: grub-core/kern/mm.c:117 +#, c-format +msgid "Using memory for heap: start=%p, end=%p\n" +msgstr "" + +#: grub-core/loader/efi/chainloader.c:263 +msgid "file path: " +msgstr "" + +#: grub-core/net/net.c:720 +#, c-format +msgid "Unknown address type %d" +msgstr "" + +#: grub-core/normal/misc.c:164 +#, c-format +msgid ", UUID %s" +msgstr "" + +#: grub-core/video/readers/jpeg.c:817 +msgid "Tests loading of JPEG bitmap." +msgstr "" + +#: grub-core/video/readers/png.c:959 +msgid "Tests loading of PNG bitmap." +msgstr "" + +#: grub-core/video/readers/tga.c:485 +msgid "Tests loading of TGA bitmap." +msgstr "" + +#: util/grub-mkimagexx.c:107 +#, c-format +msgid "undefined symbol %s" +msgstr "" + +#: util/grub-mkimagexx.c:112 +#, c-format +msgid "section %d does not exist" +msgstr "" + +#: util/grub-mkimagexx.c:348 +msgid "trampoline offset too big (%" +msgstr "" + +#: util/grub-mkimagexx.c:395 +#, c-format +msgid " at the offset 0x%llx" +msgstr "" + +#: util/grub-mkimagexx.c:412 +#, c-format +msgid "unknown architecture type %d" +msgstr "" + +#: util/grub-mkimagexx.c:502 +msgid "too many fixup entries" +msgstr "" + +#: util/grub-mkimagexx.c:584 +msgid "can't add fixup entry for R_X86_64_32(S)" +msgstr "" + +#: util/grub-mkimagexx.c:639 +#, c-format +msgid "unknown machine type 0x%x" +msgstr "" + +#: util/grub-mkimagexx.c:828 +msgid "invalid ELF header" +msgstr "" + +#: util/grub-mkimagexx.c:946 +msgid "start symbol is not defined" +msgstr "" + +#: grub-core/commands/acpihalt.c:132 grub-core/commands/acpihalt.c:284 +#, c-format +msgid "Unknown opcode 0x%x\n" +msgstr "" + +#: grub-core/commands/acpihalt.c:176 +#, c-format +msgid "Unexpected extended opcode: 0x%x\n" +msgstr "" + +#: grub-core/commands/acpihalt.c:226 +#, c-format +msgid "Unknown opcode in _S5: 0x%x\n" +msgstr "" + +#: grub-core/commands/acpihalt.c:245 +#, c-format +msgid "Unknown data type in _S5: 0x%x\n" +msgstr "" + +#: grub-core/commands/acpihalt.c:301 +#, c-format +msgid "Usage: %s FILE\n" +msgstr "" + +#: grub-core/commands/acpihalt.c:305 +#, c-format +msgid "Couldn't open file\n" +msgstr "" + +#: grub-core/commands/acpihalt.c:326 +#, c-format +msgid "Sleep type = %d\n" +msgstr "" + +#: grub-core/loader/sparc64/ieee1275/linux.c:456 +msgid "Cannot find /virtual-memory node.\n" +msgstr "" + +#: grub-core/loader/sparc64/ieee1275/linux.c:462 +msgid "Cannot find /virtual-memory/translations size.\n" +msgstr "" + +#: grub-core/loader/sparc64/ieee1275/linux.c:469 +msgid "Cannot allocate translations buffer.\n" +msgstr "" + +#: grub-core/loader/sparc64/ieee1275/linux.c:475 +msgid "Cannot fetch /virtual-memory/translations property.\n" +msgstr "" + +#: grub-core/mmap/efi/mmap.c:87 +#, c-format +msgid "Unknown memory type %d, considering reserved\n" +msgstr "" + +#: grub-core/gdb/cstub.c:215 +#, c-format +msgid "Unhandled exception 0x%x at " +msgstr "" + +#: grub-core/gfxmenu/view.c:476 +#, c-format +msgid "Booting '%s'" +msgstr "" + +#: grub-core/gfxmenu/view.c:494 +#, c-format +msgid "Falling back to '%s'" +msgstr "" + +#: grub-core/disk/ieee1275/ofdisk.c:524 grub-core/kern/ieee1275/init.c:98 +msgid "/chosen/bootpath property missing!\n" +msgstr "" + +#: grub-core/commands/videotest.c:95 grub-core/commands/videotest.c:100 +msgid "The quick brown fox jumped over the lazy dog." +msgstr "" + +#: grub-core/commands/videotest.c:122 +msgid "Unicode test: happy☺ £ 5.00 ¡τäu! ℤ⊆ℝ" +msgstr "" + +#: grub-core/kern/i386/multiboot_mmap.c:51 +#, c-format +msgid "" +"WARNING: Memory map size exceeds limit (0x%x > 0x%x); it will be truncated\n" +msgstr "" + +#: grub-core/kern/main.c:261 +msgid "" +"Welcome to GRUB!\n" +"\n" +msgstr "" + +#: grub-core/kern/misc.c:1105 +msgid "" +"\n" +"Aborted." +msgstr "" + +#: grub-core/kern/misc.c:1111 +msgid " Press any key to exit." +msgstr "" + +#: grub-core/kern/err.c:131 +msgid "assert: error stack overflow detected!\n" +msgstr "" + +#: grub-core/kern/ieee1275/init.c:202 +msgid "Warning: attempt to claim over our own code!\n" +msgstr "" + +#: grub-core/lib/arg.c:177 +#, c-format +msgid "" +"\n" +"Report bugs to <%s>.\n" +msgstr "" + +#: grub-core/lib/i386/backtrace.c:48 +#, c-format +msgid "Invalid stack frame at %p (%p)\n" +msgstr "" + +#: grub-core/kern/efi/mm.c:511 +msgid "printing memory map\n" +msgstr "" + +#: grub-core/bus/emu/pci.c:58 +#, c-format +msgid "mapping 0x%x failed (error %d)\n" +msgstr "" + +#: grub-core/bus/usb/ehci.c:1572 +#, c-format +msgid "%s: prev not found, queues are corrupt\n" +msgstr "" + +#: grub-core/commands/boottime.c:46 +#, c-format +msgid "%3d.%03ds %2d.%03ds %s:%d %s\n" +msgstr "" + +#: grub-core/commands/date.c:49 +#, c-format +msgid "%d-%02d-%02d %02d:%02d:%02d %s\n" +msgstr "" + +#: grub-core/commands/i386/pc/drivemap.c:195 +#, c-format +msgid "%cD #%-3u (0x%02x) %cd%d\n" +msgstr "" + +#: grub-core/commands/i386/pc/drivemap.c:259 +msgid "Swapping" +msgstr "" + +#: grub-core/commands/i386/pc/drivemap.c:259 +msgid "Mapping" +msgstr "" + +#: grub-core/kern/rescue_parser.c:71 +msgid "Try `help' for usage\n" +msgstr "" + +#: grub-core/kern/rescue_reader.c:81 +msgid "Entering rescue mode...\n" +msgstr "" + +#: grub-core/kern/corecmd.c:153 +#, c-format +msgid "(%s): Filesystem is %s.\n" +msgstr "" + +#: grub-core/kern/corecmd.c:154 +msgid "unknown" +msgstr "" + +#: grub-core/commands/ls.c:157 +#, c-format +msgid " %d-%02d-%02d %02d:%02d:%02d %-11s " +msgstr "" + +#: grub-core/commands/ls.c:163 +#, c-format +msgid " %04d%02d%02d%02d%02d%02d " +msgstr "" + +#: grub-core/commands/testload.c:72 +#, c-format +msgid "Reading %s sequentially" +msgstr "" + +#: grub-core/commands/testload.c:76 grub-core/commands/testload.c:101 +#: grub-core/commands/testload.c:140 +msgid " Done.\n" +msgstr "" + +#: grub-core/commands/testload.c:79 +#, c-format +msgid "Reading %s sequentially again" +msgstr "" + +#: grub-core/commands/testload.c:96 grub-core/commands/testload.c:125 +#, c-format +msgid "" +"\n" +"Differs in %lld\n" +msgstr "" + +#: grub-core/commands/testload.c:104 +#, c-format +msgid "Reading %s backwards" +msgstr "" + +#: grub-core/commands/keylayouts.c:177 +#, c-format +msgid "Unknown key 0x%x detected\n" +msgstr "" + +#: grub-core/commands/videotest.c:203 +#, c-format +msgid "color %d: %08x\n" +msgstr "" + +#: grub-core/kern/efi/mm.c:196 +msgid "Trying to terminate EFI services again\n" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:639 +#, c-format +msgid "cannot get disk label of `%s'" +msgstr "" + +#: grub-core/term/at_keyboard.c:370 +msgid "No supported scancode set found\n" +msgstr "" + +#: grub-core/term/usb_keyboard.c:402 +#, c-format +msgid "%s failed. Stopped\n" +msgstr "" + +#: util/grub-setup.c:343 +#, c-format +msgid "guessing the root device failed, because of `%s'" +msgstr "" + +#: grub-core/commands/keylayouts.c:177 +#, c-format +msgid "Unknown key 0x%x detected\n" +msgstr "" + +#: grub-core/commands/videotest.c:203 +#, c-format +msgid "color %d: %08x\n" +msgstr "" + +#: grub-core/kern/efi/mm.c:196 +msgid "Trying to terminate EFI services again\n" +msgstr "" + +#: grub-core/kern/emu/hostdisk.c:639 +#, c-format +msgid "cannot get disk label of `%s'" +msgstr "" + +#: grub-core/term/at_keyboard.c:370 +msgid "No supported scancode set found\n" +msgstr "" + +#: grub-core/term/usb_keyboard.c:402 +#, c-format +msgid "%s failed. Stopped\n" +msgstr "" + +#: util/grub-setup.c:343 +#, c-format +msgid "guessing the root device failed, because of `%s'" +msgstr "" diff --git a/tests/gettext_strings_test.in b/tests/gettext_strings_test.in new file mode 100644 index 000000000..ffbb73dfe --- /dev/null +++ b/tests/gettext_strings_test.in @@ -0,0 +1,20 @@ +#!/bin/sh + +cd '@srcdir@' + +tdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" + +xgettext -f po/POTFILES.in -L C -o "$tdir/"skip.pot -x po/grub.pot --keyword=grub_util_info --keyword=grub_dprintf:1,2 --keyword=grub_register_command --keyword=grub_register_extcmd --keyword=grub_efiemu_resolve_symbol --keyword=grub_efiemu_register_symbol --keyword=grub_dl_load --keyword=grub_crypto_lookup_md_by_name --keyword=grub_crypto_lookup_cipher_by_name --keyword=grub_efiemu_resolve_symbol --keyword=alias --keyword=grub_ieee1275_get_property:2 --keyword=grub_ieee1275_find_device --keyword=grub_ieee1275_get_integer_property:2 --keyword=INIT_IEEE1275_COMMON:2 --keyword=grub_boot_time --keyword=grub_env_get --keyword=grub_env_set --keyword=grub_register_variable_hook --keyword=grub_fatal --keyword=__asm__ --keyword=volatile --keyword=__volatile__ --keyword=grub_error:2 --from-code=iso-8859-1 +xgettext -f po/POTFILES.in -L C -o "$tdir/"skip2.pot -x po/grub.pot --keyword=volatile:2 --keyword=__volatile__:2 --keyword=grub_dprintf:2 --from-code=iso-8859-1 +xgettext -f po/POTFILES.in -L C -o "$tdir/"skip3.pot -x po/grub.pot --keyword=volatile:3 --keyword=__volatile__:3 --from-code=iso-8859-1 + +cat po/POTFILES.in | xargs grep -hE -o "( | ){\"[a-z0-9\-]*\",[[:space:]]*('.'|[0-9]|-[0-9])," |sed "s,[[:space:]]*{\",,g;s,\"\,[[:space:]]*\('.'\|[0-9]\|-[0-9]\)\,,,g" | awk '{ print "msgid \"" $0 "\"\nmsgstr \"\"" ; }' > "$tdir/"opts.pot +cat po/POTFILES.in | xargs grep -hE -o "[[:space:]]*\.name[[:space:]]*=[[:space:]]*\"[a-zA-Z0-9 ()]*\"" |sed "s,[[:space:]]*\.name[[:space:]]*=[[:space:]]*\",,g;s,\",,g" | awk '{ print "msgid \"" $0 "\"\nmsgstr \"\"" ; }' > "$tdir/"name.pot + +out="$(cat po/POTFILES.in | grep -v '\(colors.c\|lsefisystab.c\|lsefimmap.c\|lssal.c\|hdparm.c\|sendkey.c\|lsacpi.c\|lspci.c\|usbtest.c\|legacy_parse.c\|/libgcrypt/\|hfs.c\|/efi\.c$\|gnulib\|tests/\|util/ieee1275/ofpath.c\|minilzo.c\|terminfo.c\|setpci.c\|bin2h.c\|cb_timestamps.c\|grub-pe2elf.c\|getroot.c\|arc/init.c\|color.c\|grub-mklayout.c\|gentrigtables.c\|lzodefs.h\|lsefi.c\|cbls.c\|/zfs\.h$\|grub-macho2img.c\|lvm.c\|efidisk.c\|grub-mkfont.c\|reiserfs.c\|LzmaEnc.c\)' | xgettext -f - -L C -o - -x po/grub.pot -x "$tdir/"skip.pot -x "$tdir/"skip2.pot -x "$tdir/"skip3.pot -x "$tdir/"opts.pot -x "$tdir/"name.pot -x po/exclude.pot -a --from-code=iso-8859-1)" +rm -rf "$tdir" +if [ x"$out" != x ]; then + echo "$out" + exit 1; +fi + From 2aa072d76a9c7df837a6a81bf80958094a522740 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 12:05:36 +0200 Subject: [PATCH 167/187] New variables 'net_default_*' to determine MAC/IP of default interface. --- ChangeLog | 4 +++ grub-core/net/bootp.c | 3 ++ grub-core/net/net.c | 69 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 67b4c6f25..cbd5d9793 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + New variables 'net_default_*' to determine MAC/IP of default interface. + 2013-05-07 Vladimir Serbinenko * tests/gettext_strings_test.in: A test to check for strings not diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c index 33f860ae1..c8ef4d662 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -211,6 +211,9 @@ grub_net_configure_by_dhcp_ack (const char *name, grub_print_error (); } + if (is_def) + grub_env_set ("net_default_interface", name); + if (device && !*device && bp->server_ip) { *device = grub_xasprintf ("tftp,%d.%d.%d.%d", diff --git a/grub-core/net/net.c b/grub-core/net/net.c index aebbe4b75..8ea69066b 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2010,2011 Free Software Foundation, Inc. + * Copyright (C) 2010,2011,2012,2013 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -813,6 +813,69 @@ defserver_get_env (struct grub_env_var *var __attribute__ ((unused)), return grub_net_default_server ? : ""; } +static const char * +defip_get_env (struct grub_env_var *var __attribute__ ((unused)), + const char *val __attribute__ ((unused))) +{ + const char *intf = grub_env_get ("net_default_interface"); + const char *ret = NULL; + if (intf) + { + char *buf = grub_xasprintf ("net_%s_ip", intf); + if (buf) + ret = grub_env_get (buf); + grub_free (buf); + } + return ret; +} + +static char * +defip_set_env (struct grub_env_var *var __attribute__ ((unused)), + const char *val) +{ + const char *intf = grub_env_get ("net_default_interface"); + if (intf) + { + char *buf = grub_xasprintf ("net_%s_ip", intf); + if (buf) + grub_env_set (buf, val); + grub_free (buf); + } + return NULL; +} + + +static const char * +defmac_get_env (struct grub_env_var *var __attribute__ ((unused)), + const char *val __attribute__ ((unused))) +{ + const char *intf = grub_env_get ("net_default_interface"); + const char *ret = NULL; + if (intf) + { + char *buf = grub_xasprintf ("net_%s_mac", intf); + if (buf) + ret = grub_env_get (buf); + grub_free (buf); + } + return ret; +} + +static char * +defmac_set_env (struct grub_env_var *var __attribute__ ((unused)), + const char *val) +{ + const char *intf = grub_env_get ("net_default_interface"); + if (intf) + { + char *buf = grub_xasprintf ("net_%s_mac", intf); + if (buf) + grub_env_set (buf, val); + grub_free (buf); + } + return NULL; +} + static void grub_net_network_level_interface_register (struct grub_net_network_level_interface *inter) @@ -1560,6 +1623,10 @@ GRUB_MOD_INIT(net) defserver_set_env); grub_register_variable_hook ("pxe_default_server", defserver_get_env, defserver_set_env); + grub_register_variable_hook ("net_default_ip", defip_get_env, + defip_set_env); + grub_register_variable_hook ("net_default_mac", defmac_get_env, + defmac_set_env); cmd_addaddr = grub_register_command ("net_add_addr", grub_cmd_addaddr, /* TRANSLATORS: HWADDRESS stands for From 011f8ae8d2fbd5b07b047154f478dd3838c1ab35 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 12:28:59 +0200 Subject: [PATCH 168/187] * grub-core/tests/setjmp_test.c: New test. --- ChangeLog | 4 ++ grub-core/Makefile.core.def | 5 ++ grub-core/tests/lib/functional_test.c | 1 + grub-core/tests/setjmp_test.c | 74 +++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 grub-core/tests/setjmp_test.c diff --git a/ChangeLog b/ChangeLog index cbd5d9793..aeb61cdb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + * grub-core/tests/setjmp_test.c: New test. + 2013-05-07 Vladimir Serbinenko New variables 'net_default_*' to determine MAC/IP of default interface. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 56a1ec331..7dc106ee1 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1742,6 +1742,11 @@ module = { common = tests/example_functional_test.c; }; +module = { + name = setjmp_test; + common = tests/setjmp_test.c; +}; + module = { name = videotest_checksum; common = tests/videotest_checksum.c; diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c index 957354e05..8f66fe33b 100644 --- a/grub-core/tests/lib/functional_test.c +++ b/grub-core/tests/lib/functional_test.c @@ -56,6 +56,7 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), grub_dl_load ("exfctest"); grub_dl_load ("videotest_checksum"); grub_dl_load ("gfxterm_menu"); + grub_dl_load ("setjmp_test"); FOR_LIST_ELEMENTS (test, grub_test_list) ok = !grub_test_run (test) && ok; diff --git a/grub-core/tests/setjmp_test.c b/grub-core/tests/setjmp_test.c new file mode 100644 index 000000000..29aab2535 --- /dev/null +++ b/grub-core/tests/setjmp_test.c @@ -0,0 +1,74 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +static grub_jmp_buf jmp_point; +static int expected, ctr; + +static void +jmp0 (void) +{ + grub_longjmp (jmp_point, 0); +} + +static void +jmp1 (void) +{ + grub_longjmp (jmp_point, 1); +} + +static void +jmp2 (void) +{ + grub_longjmp (jmp_point, 2); +} + +static void +setjmp_test (void) +{ + int val; + + expected = 0; + val = grub_setjmp (jmp_point); + + grub_test_assert (val == expected, "setjmp returned %d instead of %d", + val, expected); + switch (ctr++) + { + case 0: + expected = 1; + jmp0 (); + case 1: + expected = 1; + jmp1 (); + case 2: + expected = 2; + jmp2 (); + case 3: + return; + } + grub_test_assert (0, "setjmp didn't return enough times"); +} + +/* Register example_test method as a functional test. */ +GRUB_FUNCTIONAL_TEST (setjmp_test, setjmp_test); From c5dbc13d28a1fc5a0334200fc902685f78bd8ede Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 14:38:29 +0200 Subject: [PATCH 169/187] Menu color test. --- ChangeLog | 4 +++ grub-core/tests/checksums.h | 62 +++++++++++++++++++++++++++++++- grub-core/tests/gfxterm_menu.c | 2 ++ grub-core/tests/video_checksum.c | 3 +- include/grub/test.h | 4 ++- 5 files changed, 72 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index aeb61cdb4..b7b37773b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + Menu color test. + 2013-05-07 Vladimir Serbinenko * grub-core/tests/setjmp_test.c: New test. diff --git a/grub-core/tests/checksums.h b/grub-core/tests/checksums.h index ac677bbec..aa4ae999a 100644 --- a/grub-core/tests/checksums.h +++ b/grub-core/tests/checksums.h @@ -36,7 +36,7 @@ { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0x1e1a41fe, 0x237e53c4, 0x1e1a41fe, 0xd5890062, 0x7180f3ea, 0x6be1ad05, 0x6be1ad05, 0x6be1ad05, 0x680e4253, 0x680e4253, 0x680e4253, 0xed2cabb8, 0xed2cabb8, 0xed2cabb8, 0xef4a3312, 0xd5890062, 0xd5890062, }, 18 }, { "gfxmenu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xcfa0e627, 0x8b7088da, 0xcfa0e627, 0xcd807142, 0xdc37dab7, 0x3886aa8f, 0x3886aa8f, 0x3886aa8f, 0xedbc0794, 0xedbc0794, 0xedbc0794, 0x427d9139, 0x427d9139, 0x427d9139, 0x59c36f00, 0xcd807142, 0xcd807142, }, 18 }, { "gfxmenu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x64807934, 0x85d684c9, 0x64807934, 0x61726a79, 0x71c38b, 0x33c86a46, 0x33c86a46, 0x33c86a46, 0xe549629b, 0xe549629b, 0xe549629b, 0xc30c9588, 0xc30c9588, 0xc30c9588, 0xaa4593fe, 0x61726a79, 0x61726a79, }, 18 }, - { "gfxmenu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x9792b643, 0x1d769dd8, 0x9386dd8c, 0x9792b643, 0x3d74bd2f, 0x4411e313, 0xcbff8eae, 0xcbff8eae, 0xcbff8eae, 0x7e7b418b, 0x7e7b418b, 0x7e7b418b, 0xbaa0dd46, 0xbaa0dd46, 0xbaa0dd46, 0xc9cbf769, 0x3d74bd2f, 0x3d74bd2f, }, 19 }, + { "gfxmenu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x9792b643, 0x1d769dd8, 0x9792b643, 0x3d74bd2f, 0x4411e313, 0xcbff8eae, 0xcbff8eae, 0xcbff8eae, 0x7e7b418b, 0x7e7b418b, 0x7e7b418b, 0xbaa0dd46, 0xbaa0dd46, 0xbaa0dd46, 0xc9cbf769, 0x3d74bd2f, 0x3d74bd2f, }, 18 }, { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xbdb8f583, 0x1e27b76, 0xbdb8f583, 0x91be6e17, 0xf93a81be, 0x8632932e, 0x8632932e, 0x8632932e, 0xa297894, 0xa297894, 0xa297894, 0x66f16747, 0x66f16747, 0x66f16747, 0x5387d57f, 0x91be6e17, 0x91be6e17, }, 18 }, { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbe72e1cb, 0x4943add3, 0xbe72e1cb, 0xa207f983, 0x58397d1d, 0x809530c5, 0x809530c5, 0x809530c5, 0x8b80ad8a, 0x8b80ad8a, 0x8b80ad8a, 0x425ad0af, 0x425ad0af, 0x425ad0af, 0xf83ee7aa, 0xa207f983, 0xa207f983, }, 18 }, { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0xbc064047, 0x9e12d9ac, 0xbc064047, 0xf9bdce43, 0x7184c3f8, 0xc8fd1102, 0xc8fd1102, 0xc8fd1102, 0x81f910a3, 0x81f910a3, 0x81f910a3, 0xdb64e608, 0xdb64e608, 0xdb64e608, 0x724366e5, 0xf9bdce43, 0xf9bdce43, }, 18 }, @@ -328,6 +328,66 @@ { "gfxterm_ch", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x97582aea, 0x106653a, 0x97582aea, 0x51457020, 0x9813a416, 0x9813a416, 0x6fbc18ae, 0x6fbc18ae, 0x6fbc18ae, 0x64491c01, 0x64491c01, 0x64491c01, 0x704bde98, 0x704bde98, 0x704bde98, 0x9813a416, 0x51457020, 0x51457020, 0x9813a416, }, 20 }, { "gfxterm_ch", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x964f65ea, 0x34ae6fb6, 0x964f65ea, 0x13c154da, 0x5fcf013d, 0x5fcf013d, 0xa4ebbaa6, 0xa4ebbaa6, 0xa4ebbaa6, 0x55a8bfbb, 0x55a8bfbb, 0x55a8bfbb, 0x1257bc3c, 0x1257bc3c, 0x1257bc3c, 0x5fcf013d, 0x13c154da, 0x13c154da, 0x5fcf013d, }, 20 }, { "gfxterm_ch", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x75e6834a, 0x28165e16, 0x75e6834a, 0x75ad9a21, 0xdd28f52b, 0xdd28f52b, 0x6ae4a429, 0x6ae4a429, 0x6ae4a429, 0x17f2e3ed, 0x17f2e3ed, 0x17f2e3ed, 0x74c03dc7, 0x74c03dc7, 0x74c03dc7, 0xdd28f52b, 0x75ad9a21, 0x75ad9a21, 0xdd28f52b, }, 20 }, + { "gfxterm_red", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x5cf3c4a7, 0x94eb1d70, 0x5cf3c4a7, 0x5e6250e4, 0x59c36f00, 0x59c36f00, 0xd9b250a8, 0xd9b250a8, 0xd9b250a8, 0x85a0504a, 0x85a0504a, 0x85a0504a, 0xc0ec64d4, 0xc0ec64d4, 0xc0ec64d4, 0x59c36f00, 0x5e6250e4, 0x5e6250e4, 0x59c36f00, }, 20 }, + { "gfxterm_red", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xcf628ae2, 0xd8fd317b, 0xcf628ae2, 0x7b7418a9, 0xaa4593fe, 0xaa4593fe, 0x1f6005c4, 0x1f6005c4, 0x1f6005c4, 0xc5e7aaff, 0xc5e7aaff, 0xc5e7aaff, 0xf9ebbab6, 0xf9ebbab6, 0xf9ebbab6, 0xaa4593fe, 0x7b7418a9, 0x7b7418a9, 0xaa4593fe, }, 20 }, + { "gfxterm_red", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x7dd5389a, 0x916306b6, 0x7dd5389a, 0x6f3ea6a4, 0xc9cbf769, 0xc9cbf769, 0x38e2544b, 0x38e2544b, 0x38e2544b, 0xc0b7365, 0xc0b7365, 0xc0b7365, 0x2e6f1bee, 0x2e6f1bee, 0x2e6f1bee, 0xc9cbf769, 0x6f3ea6a4, 0x6f3ea6a4, 0xc9cbf769, }, 20 }, + { "gfxterm_red", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xaa0df0af, 0x5ffeda28, 0xaa0df0af, 0xd27f25fe, 0x9813a416, 0x9813a416, 0xe30e3d0b, 0xe30e3d0b, 0xe30e3d0b, 0xe8fb39a4, 0xe8fb39a4, 0xe8fb39a4, 0xfcf9fb3d, 0xfcf9fb3d, 0xfcf9fb3d, 0x9813a416, 0xd27f25fe, 0xd27f25fe, 0x9813a416, }, 20 }, + { "gfxterm_red", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xdb0cf5b5, 0x4c948c1, 0xdb0cf5b5, 0x67c135cd, 0x5fcf013d, 0x5fcf013d, 0xafc78d19, 0xafc78d19, 0xafc78d19, 0x5e848804, 0x5e848804, 0x5e848804, 0x197b8b83, 0x197b8b83, 0x197b8b83, 0x5fcf013d, 0x67c135cd, 0x67c135cd, 0x5fcf013d, }, 20 }, + { "gfxterm_red", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xa9bbe611, 0x46471f0a, 0xa9bbe611, 0xeca63699, 0xdd28f52b, 0xdd28f52b, 0x9bb2ba8d, 0x9bb2ba8d, 0x9bb2ba8d, 0xe6a4fd49, 0xe6a4fd49, 0xe6a4fd49, 0x85962363, 0x85962363, 0x85962363, 0xdd28f52b, 0xeca63699, 0xeca63699, 0xdd28f52b, }, 20 }, + { "gfxterm_red", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0x5cf3c4a7, 0x94eb1d70, 0x5cf3c4a7, 0x5e6250e4, 0x59c36f00, 0x59c36f00, 0xd9b250a8, 0xd9b250a8, 0xd9b250a8, 0x85a0504a, 0x85a0504a, 0x85a0504a, 0xc0ec64d4, 0xc0ec64d4, 0xc0ec64d4, 0x59c36f00, 0x5e6250e4, 0x5e6250e4, 0x59c36f00, }, 20 }, + { "gfxterm_red", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0xcf628ae2, 0xd8fd317b, 0xcf628ae2, 0x7b7418a9, 0xaa4593fe, 0xaa4593fe, 0x1f6005c4, 0x1f6005c4, 0x1f6005c4, 0xc5e7aaff, 0xc5e7aaff, 0xc5e7aaff, 0xf9ebbab6, 0xf9ebbab6, 0xf9ebbab6, 0xaa4593fe, 0x7b7418a9, 0x7b7418a9, 0xaa4593fe, }, 20 }, + { "gfxterm_red", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x7dd5389a, 0x916306b6, 0x7dd5389a, 0x6f3ea6a4, 0xc9cbf769, 0xc9cbf769, 0x38e2544b, 0x38e2544b, 0x38e2544b, 0xc0b7365, 0xc0b7365, 0xc0b7365, 0x2e6f1bee, 0x2e6f1bee, 0x2e6f1bee, 0xc9cbf769, 0x6f3ea6a4, 0x6f3ea6a4, 0xc9cbf769, }, 20 }, + { "gfxterm_red", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xf7a6bbc0, 0xa71c6a6a, 0xf7a6bbc0, 0x2c00e54, 0x5387d57f, 0x5387d57f, 0x9a524c3, 0x9a524c3, 0x9a524c3, 0x2ac4e2c9, 0x2ac4e2c9, 0x2ac4e2c9, 0x829fa704, 0x829fa704, 0x829fa704, 0x5387d57f, 0x2c00e54, 0x2c00e54, 0x5387d57f, }, 20 }, + { "gfxterm_red", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x336ec267, 0x367fad6f, 0x336ec267, 0xf645cfe7, 0xf83ee7aa, 0xf83ee7aa, 0xf286d882, 0xf286d882, 0xf286d882, 0x36b15363, 0x36b15363, 0x36b15363, 0xf9af0071, 0xf9af0071, 0xf9af0071, 0xf83ee7aa, 0xf645cfe7, 0xf645cfe7, 0xf83ee7aa, }, 20 }, + { "gfxterm_red", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x2c87bcd6, 0x36e5ec5f, 0x2c87bcd6, 0xc87d72f9, 0x724366e5, 0x724366e5, 0x46a60453, 0x46a60453, 0x46a60453, 0xa556cc35, 0xa556cc35, 0xa556cc35, 0x1b14594d, 0x1b14594d, 0x1b14594d, 0x724366e5, 0xc87d72f9, 0xc87d72f9, 0x724366e5, }, 20 }, + { "gfxterm_red", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0xf34510a5, 0x6bf8e58f, 0xf34510a5, 0xd44e115c, 0x5387d57f, 0x5387d57f, 0xf35640b5, 0xf35640b5, 0xf35640b5, 0xd831fbc, 0xd831fbc, 0xd831fbc, 0x57b868f, 0x57b868f, 0x57b868f, 0x5387d57f, 0xd44e115c, 0xd44e115c, 0x5387d57f, }, 20 }, + { "gfxterm_red", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xd50edb2e, 0xed2be670, 0xd50edb2e, 0xab5fbf82, 0xf83ee7aa, 0xf83ee7aa, 0x9d8f9101, 0x9d8f9101, 0x9d8f9101, 0xd3d9c88c, 0xd3d9c88c, 0xd3d9c88c, 0x3905b345, 0x3905b345, 0x3905b345, 0xf83ee7aa, 0xab5fbf82, 0xab5fbf82, 0xf83ee7aa, }, 20 }, + { "gfxterm_red", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x12b2c01b, 0x838f2386, 0x12b2c01b, 0xcc209686, 0x724366e5, 0x724366e5, 0x2fc9378e, 0x2fc9378e, 0x2fc9378e, 0xee502664, 0xee502664, 0xee502664, 0x6a05ad2c, 0x6a05ad2c, 0x6a05ad2c, 0x724366e5, 0xcc209686, 0xcc209686, 0x724366e5, }, 20 }, + { "gfxterm_red", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xbd1e8fde, 0xe7baf68c, 0xbd1e8fde, 0xf81e08b0, 0x1c955882, 0x1c955882, 0xcf34908a, 0xcf34908a, 0xcf34908a, 0x4d627f3a, 0x4d627f3a, 0x4d627f3a, 0x828afa46, 0x828afa46, 0x828afa46, 0x1c955882, 0xf81e08b0, 0xf81e08b0, 0x1c955882, }, 20 }, + { "gfxterm_red", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xeacfb81e, 0x63c43df, 0xeacfb81e, 0xb7b61016, 0x4d266f7a, 0x4d266f7a, 0xe07e5e3f, 0xe07e5e3f, 0xe07e5e3f, 0xac2b0d79, 0xac2b0d79, 0xac2b0d79, 0x8e8abf87, 0x8e8abf87, 0x8e8abf87, 0x4d266f7a, 0xb7b61016, 0xb7b61016, 0x4d266f7a, }, 20 }, + { "gfxterm_red", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xfd37e5b2, 0xfe28c531, 0xfd37e5b2, 0xdbb7d339, 0x1ed9d731, 0x1ed9d731, 0x1976c7dc, 0x1976c7dc, 0x1976c7dc, 0xad778754, 0xad778754, 0xad778754, 0xa05b9b17, 0xa05b9b17, 0xa05b9b17, 0x1ed9d731, 0xdbb7d339, 0xdbb7d339, 0x1ed9d731, }, 20 }, + { "gfxterm_red", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x7e970e8f, 0x2e2ddf25, 0x7e970e8f, 0x2f4a6620, 0x5387d57f, 0x5387d57f, 0x3bb33ccf, 0x3bb33ccf, 0x3bb33ccf, 0x18d2fac5, 0x18d2fac5, 0x18d2fac5, 0xb089bf08, 0xb089bf08, 0xb089bf08, 0x5387d57f, 0x2f4a6620, 0x2f4a6620, 0x5387d57f, }, 20 }, + { "gfxterm_red", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xb8a2e5df, 0xbdb38ad7, 0xb8a2e5df, 0x8002db7c, 0xf83ee7aa, 0xf83ee7aa, 0xc1252296, 0xc1252296, 0xc1252296, 0x512a977, 0x512a977, 0x512a977, 0xca0cfa65, 0xca0cfa65, 0xca0cfa65, 0xf83ee7aa, 0x8002db7c, 0x8002db7c, 0xf83ee7aa, }, 20 }, + { "gfxterm_red", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x9b5f3db9, 0x813d6d30, 0x9b5f3db9, 0x181c309c, 0x724366e5, 0x724366e5, 0x4b2cfbfc, 0x4b2cfbfc, 0x4b2cfbfc, 0xa8dc339a, 0xa8dc339a, 0xa8dc339a, 0x169ea6e2, 0x169ea6e2, 0x169ea6e2, 0x724366e5, 0x181c309c, 0x181c309c, 0x724366e5, }, 20 }, + { "gfxterm_red", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0xe2b12f83, 0x7a0cdaa9, 0xe2b12f83, 0xaf70144a, 0x5387d57f, 0x5387d57f, 0xc2ca0f0b, 0xc2ca0f0b, 0xc2ca0f0b, 0x3c1f5002, 0x3c1f5002, 0x3c1f5002, 0x34e7c931, 0x34e7c931, 0x34e7c931, 0x5387d57f, 0xaf70144a, 0xaf70144a, 0x5387d57f, }, 20 }, + { "gfxterm_red", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xcc7f1afa, 0xf45a27a4, 0xcc7f1afa, 0xed3bbe5b, 0xf83ee7aa, 0xf83ee7aa, 0xb7cca9d4, 0xb7cca9d4, 0xb7cca9d4, 0xf99af059, 0xf99af059, 0xf99af059, 0x13468b90, 0x13468b90, 0x13468b90, 0xf83ee7aa, 0xed3bbe5b, 0xed3bbe5b, 0xf83ee7aa, }, 20 }, + { "gfxterm_red", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0x5c3aa415, 0xcd074788, 0x5c3aa415, 0xc18dd60, 0x724366e5, 0x724366e5, 0x6b991528, 0x6b991528, 0x6b991528, 0xaa0004c2, 0xaa0004c2, 0xaa0004c2, 0x2e558f8a, 0x2e558f8a, 0x2e558f8a, 0x724366e5, 0xc18dd60, 0xc18dd60, 0x724366e5, }, 20 }, + { "gfxterm_red", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0xa53a6439, 0xff9e1d6b, 0xa53a6439, 0x50714ec2, 0x1c955882, 0x1c955882, 0x4ad2fbd7, 0x4ad2fbd7, 0x4ad2fbd7, 0xc8841467, 0xc8841467, 0xc8841467, 0x76c911b, 0x76c911b, 0x76c911b, 0x1c955882, 0x50714ec2, 0x50714ec2, 0x1c955882, }, 20 }, + { "gfxterm_red", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xd93e9fad, 0x35cd646c, 0xd93e9fad, 0xb5499771, 0x4d266f7a, 0x4d266f7a, 0x65922dd6, 0x65922dd6, 0x65922dd6, 0x29c77e90, 0x29c77e90, 0x29c77e90, 0xb66cc6e, 0xb66cc6e, 0xb66cc6e, 0x4d266f7a, 0xb5499771, 0xb5499771, 0x4d266f7a, }, 20 }, + { "gfxterm_red", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xd555d094, 0xd64af017, 0xd555d094, 0xffdaa0c9, 0x1ed9d731, 0x1ed9d731, 0x3538bf56, 0x3538bf56, 0x3538bf56, 0x8139ffde, 0x8139ffde, 0x8139ffde, 0x8c15e39d, 0x8c15e39d, 0x8c15e39d, 0x1ed9d731, 0xffdaa0c9, 0xffdaa0c9, 0x1ed9d731, }, 20 }, + { "gfxterm_red", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x579012d2, 0xa2633855, 0x579012d2, 0x1b8a22e1, 0x9813a416, 0x9813a416, 0x4e6d1775, 0x4e6d1775, 0x4e6d1775, 0x459813da, 0x459813da, 0x459813da, 0x519ad143, 0x519ad143, 0x519ad143, 0x9813a416, 0x1b8a22e1, 0x1b8a22e1, 0x9813a416, }, 20 }, + { "gfxterm_red", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xd0e01f27, 0xf25a253, 0xd0e01f27, 0x345a8b55, 0x5fcf013d, 0x5fcf013d, 0x7d7b66d1, 0x7d7b66d1, 0x7d7b66d1, 0x8c3863cc, 0x8c3863cc, 0x8c3863cc, 0xcbc7604b, 0xcbc7604b, 0xcbc7604b, 0x5fcf013d, 0x345a8b55, 0x345a8b55, 0x5fcf013d, }, 20 }, + { "gfxterm_red", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x8afabe5a, 0x65064741, 0x8afabe5a, 0xc2abbdb0, 0xdd28f52b, 0xdd28f52b, 0x762c541c, 0x762c541c, 0x762c541c, 0xb3a13d8, 0xb3a13d8, 0xb3a13d8, 0x6808cdf2, 0x6808cdf2, 0x6808cdf2, 0xdd28f52b, 0xc2abbdb0, 0xc2abbdb0, 0xdd28f52b, }, 20 }, + { "gfxterm_high", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7e8663fd, 0xb69eba2a, 0x7e8663fd, 0xf10bac5f, 0x59c36f00, 0x59c36f00, 0xcba09304, 0xcba09304, 0xcba09304, 0x97b293e6, 0x97b293e6, 0x97b293e6, 0xd2fea778, 0xd2fea778, 0xd2fea778, 0x59c36f00, 0xf10bac5f, 0xf10bac5f, 0x59c36f00, }, 20 }, + { "gfxterm_high", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x1dc170f, 0x1643ac96, 0x1dc170f, 0x218c75e1, 0xaa4593fe, 0xaa4593fe, 0xfda7eac8, 0xfda7eac8, 0xfda7eac8, 0x272045f3, 0x272045f3, 0x272045f3, 0x1b2c55ba, 0x1b2c55ba, 0x1b2c55ba, 0xaa4593fe, 0x218c75e1, 0x218c75e1, 0xaa4593fe, }, 20 }, + { "gfxterm_high", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xf8ec494, 0xe338fab8, 0xf8ec494, 0x78b294ad, 0xc9cbf769, 0xc9cbf769, 0x270340e6, 0x270340e6, 0x270340e6, 0x13ea67c8, 0x13ea67c8, 0x13ea67c8, 0x318e0f43, 0x318e0f43, 0x318e0f43, 0xc9cbf769, 0x78b294ad, 0x78b294ad, 0xc9cbf769, }, 20 }, + { "gfxterm_high", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x7c5fb1db, 0x89ac9b5c, 0x7c5fb1db, 0xd6bcbd37, 0x9813a416, 0x9813a416, 0x8c097a93, 0x8c097a93, 0x8c097a93, 0x87fc7e3c, 0x87fc7e3c, 0x87fc7e3c, 0x93febca5, 0x93febca5, 0x93febca5, 0x9813a416, 0xd6bcbd37, 0xd6bcbd37, 0x9813a416, }, 20 }, + { "gfxterm_high", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x2c17ec5e, 0xf3d2512a, 0x2c17ec5e, 0xc24c3b8e, 0x5fcf013d, 0x5fcf013d, 0xcacb7f18, 0xcacb7f18, 0xcacb7f18, 0x3b887a05, 0x3b887a05, 0x3b887a05, 0x7c777982, 0x7c777982, 0x7c777982, 0x5fcf013d, 0xc24c3b8e, 0xc24c3b8e, 0x5fcf013d, }, 20 }, + { "gfxterm_high", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x962fd585, 0x79d32c9e, 0x962fd585, 0x4acac797, 0xdd28f52b, 0xdd28f52b, 0x35beeea3, 0x35beeea3, 0x35beeea3, 0x48a8a967, 0x48a8a967, 0x48a8a967, 0x2b9a774d, 0x2b9a774d, 0x2b9a774d, 0xdd28f52b, 0x4acac797, 0x4acac797, 0xdd28f52b, }, 20 }, + { "gfxterm_high", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0x7e8663fd, 0xb69eba2a, 0x7e8663fd, 0xf10bac5f, 0x59c36f00, 0x59c36f00, 0xcba09304, 0xcba09304, 0xcba09304, 0x97b293e6, 0x97b293e6, 0x97b293e6, 0xd2fea778, 0xd2fea778, 0xd2fea778, 0x59c36f00, 0xf10bac5f, 0xf10bac5f, 0x59c36f00, }, 20 }, + { "gfxterm_high", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x1dc170f, 0x1643ac96, 0x1dc170f, 0x218c75e1, 0xaa4593fe, 0xaa4593fe, 0xfda7eac8, 0xfda7eac8, 0xfda7eac8, 0x272045f3, 0x272045f3, 0x272045f3, 0x1b2c55ba, 0x1b2c55ba, 0x1b2c55ba, 0xaa4593fe, 0x218c75e1, 0x218c75e1, 0xaa4593fe, }, 20 }, + { "gfxterm_high", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xf8ec494, 0xe338fab8, 0xf8ec494, 0x78b294ad, 0xc9cbf769, 0xc9cbf769, 0x270340e6, 0x270340e6, 0x270340e6, 0x13ea67c8, 0x13ea67c8, 0x13ea67c8, 0x318e0f43, 0x318e0f43, 0x318e0f43, 0xc9cbf769, 0x78b294ad, 0x78b294ad, 0xc9cbf769, }, 20 }, + { "gfxterm_high", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x451af230, 0x15a0239a, 0x451af230, 0x8fa4a0e3, 0x5387d57f, 0x5387d57f, 0x4e647c93, 0x4e647c93, 0x4e647c93, 0x6d05ba99, 0x6d05ba99, 0x6d05ba99, 0xc55eff54, 0xc55eff54, 0xc55eff54, 0x5387d57f, 0x8fa4a0e3, 0x8fa4a0e3, 0x5387d57f, }, 20 }, + { "gfxterm_high", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x626e4125, 0x677f2e2d, 0x626e4125, 0x1739712c, 0xf83ee7aa, 0xf83ee7aa, 0xf25c3281, 0xf25c3281, 0xf25c3281, 0x366bb960, 0x366bb960, 0x366bb960, 0xf975ea72, 0xf975ea72, 0xf975ea72, 0xf83ee7aa, 0x1739712c, 0x1739712c, 0xf83ee7aa, }, 20 }, + { "gfxterm_high", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x24d014be, 0x3eb24437, 0x24d014be, 0xa4cf9a3c, 0x724366e5, 0x724366e5, 0x10d1a394, 0x10d1a394, 0x10d1a394, 0xf3216bf2, 0xf3216bf2, 0xf3216bf2, 0x4d63fe8a, 0x4d63fe8a, 0x4d63fe8a, 0x724366e5, 0xa4cf9a3c, 0xa4cf9a3c, 0x724366e5, }, 20 }, + { "gfxterm_high", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0xfc4a546f, 0x64f7a145, 0xfc4a546f, 0xf9e32ee9, 0x5387d57f, 0x5387d57f, 0x4bd38a03, 0x4bd38a03, 0x4bd38a03, 0xb506d50a, 0xb506d50a, 0xb506d50a, 0xbdfe4c39, 0xbdfe4c39, 0xbdfe4c39, 0x5387d57f, 0xf9e32ee9, 0xf9e32ee9, 0x5387d57f, }, 20 }, + { "gfxterm_high", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xd61baafd, 0xee3e97a3, 0xd61baafd, 0x8ee7986d, 0xf83ee7aa, 0xf83ee7aa, 0x63d64c93, 0x63d64c93, 0x63d64c93, 0x2d80151e, 0x2d80151e, 0x2d80151e, 0xc75c6ed7, 0xc75c6ed7, 0xc75c6ed7, 0xf83ee7aa, 0x8ee7986d, 0x8ee7986d, 0xf83ee7aa, }, 20 }, + { "gfxterm_high", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x6822467e, 0xf91fa5e3, 0x6822467e, 0xc7c3650b, 0x724366e5, 0x724366e5, 0xe0762c40, 0xe0762c40, 0xe0762c40, 0x21ef3daa, 0x21ef3daa, 0x21ef3daa, 0xa5bab6e2, 0xa5bab6e2, 0xa5bab6e2, 0x724366e5, 0xc7c3650b, 0xc7c3650b, 0x724366e5, }, 20 }, + { "gfxterm_high", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0x50ace7c2, 0xa089e90, 0x50ace7c2, 0x1a5ebad4, 0x1c955882, 0x1c955882, 0x97519c3a, 0x97519c3a, 0x97519c3a, 0x1507738a, 0x1507738a, 0x1507738a, 0xdaeff6f6, 0xdaeff6f6, 0xdaeff6f6, 0x1c955882, 0x1a5ebad4, 0x1a5ebad4, 0x1c955882, }, 20 }, + { "gfxterm_high", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x179140a7, 0xfb62bb66, 0x179140a7, 0xf545d06d, 0x4d266f7a, 0x4d266f7a, 0x2d145f78, 0x2d145f78, 0x2d145f78, 0x61410c3e, 0x61410c3e, 0x61410c3e, 0x43e0bec0, 0x43e0bec0, 0x43e0bec0, 0x4d266f7a, 0xf545d06d, 0xf545d06d, 0x4d266f7a, }, 20 }, + { "gfxterm_high", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x679bf29f, 0x6484d21c, 0x679bf29f, 0x653f204e, 0x1ed9d731, 0x1ed9d731, 0xa1c3fdf0, 0xa1c3fdf0, 0xa1c3fdf0, 0x15c2bd78, 0x15c2bd78, 0x15c2bd78, 0x18eea13b, 0x18eea13b, 0x18eea13b, 0x1ed9d731, 0x653f204e, 0x653f204e, 0x1ed9d731, }, 20 }, + { "gfxterm_high", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x4fce7a63, 0x1f74abc9, 0x4fce7a63, 0x21cbf58b, 0x5387d57f, 0x5387d57f, 0x4e647c93, 0x4e647c93, 0x4e647c93, 0x6d05ba99, 0x6d05ba99, 0x6d05ba99, 0xc55eff54, 0xc55eff54, 0xc55eff54, 0x5387d57f, 0x21cbf58b, 0x21cbf58b, 0x5387d57f, }, 20 }, + { "gfxterm_high", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xc49c3074, 0xc18d5f7c, 0xc49c3074, 0x4c40335e, 0xf83ee7aa, 0xf83ee7aa, 0xf25c3281, 0xf25c3281, 0xf25c3281, 0x366bb960, 0x366bb960, 0x366bb960, 0xf975ea72, 0xf975ea72, 0xf975ea72, 0xf83ee7aa, 0x4c40335e, 0x4c40335e, 0xf83ee7aa, }, 20 }, + { "gfxterm_high", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x877bea63, 0x9d19baea, 0x877bea63, 0x60dda7eb, 0x724366e5, 0x724366e5, 0x10d1a394, 0x10d1a394, 0x10d1a394, 0xf3216bf2, 0xf3216bf2, 0xf3216bf2, 0x4d63fe8a, 0x4d63fe8a, 0x4d63fe8a, 0x724366e5, 0x60dda7eb, 0x60dda7eb, 0x724366e5, }, 20 }, + { "gfxterm_high", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0xadddaf19, 0x35605a33, 0xadddaf19, 0xc2beefaf, 0x5387d57f, 0x5387d57f, 0x4bd38a03, 0x4bd38a03, 0x4bd38a03, 0xb506d50a, 0xb506d50a, 0xb506d50a, 0xbdfe4c39, 0xbdfe4c39, 0xbdfe4c39, 0x5387d57f, 0xc2beefaf, 0xc2beefaf, 0x5387d57f, }, 20 }, + { "gfxterm_high", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x44a04df, 0x3c6f3981, 0x44a04df, 0x3a3f642, 0xf83ee7aa, 0xf83ee7aa, 0x63d64c93, 0x63d64c93, 0x63d64c93, 0x2d80151e, 0x2d80151e, 0x2d80151e, 0xc75c6ed7, 0xc75c6ed7, 0xc75c6ed7, 0xf83ee7aa, 0x3a3f642, 0x3a3f642, 0xf83ee7aa, }, 20 }, + { "gfxterm_high", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xb9287527, 0x281596ba, 0xb9287527, 0x987979ba, 0x724366e5, 0x724366e5, 0xe0762c40, 0xe0762c40, 0xe0762c40, 0x21ef3daa, 0x21ef3daa, 0x21ef3daa, 0xa5bab6e2, 0xa5bab6e2, 0xa5bab6e2, 0x724366e5, 0x987979ba, 0x987979ba, 0x724366e5, }, 20 }, + { "gfxterm_high", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x63bc909f, 0x3918e9cd, 0x63bc909f, 0x9905601c, 0x1c955882, 0x1c955882, 0x97519c3a, 0x97519c3a, 0x97519c3a, 0x1507738a, 0x1507738a, 0x1507738a, 0xdaeff6f6, 0xdaeff6f6, 0xdaeff6f6, 0x1c955882, 0x9905601c, 0x9905601c, 0x1c955882, }, 20 }, + { "gfxterm_high", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x134e846f, 0xffbd7fae, 0x134e846f, 0xc094b471, 0x4d266f7a, 0x4d266f7a, 0x2d145f78, 0x2d145f78, 0x2d145f78, 0x61410c3e, 0x61410c3e, 0x61410c3e, 0x43e0bec0, 0x43e0bec0, 0x43e0bec0, 0x4d266f7a, 0xc094b471, 0xc094b471, 0x4d266f7a, }, 20 }, + { "gfxterm_high", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xd9dd0da7, 0xdac22d24, 0xd9dd0da7, 0xd77699a0, 0x1ed9d731, 0x1ed9d731, 0xa1c3fdf0, 0xa1c3fdf0, 0xa1c3fdf0, 0x15c2bd78, 0x15c2bd78, 0x15c2bd78, 0x18eea13b, 0x18eea13b, 0x18eea13b, 0x1ed9d731, 0xd77699a0, 0xd77699a0, 0x1ed9d731, }, 20 }, + { "gfxterm_high", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x6bb5fb50, 0x9e46d1d7, 0x6bb5fb50, 0xf53e12de, 0x9813a416, 0x9813a416, 0x8c097a93, 0x8c097a93, 0x8c097a93, 0x87fc7e3c, 0x87fc7e3c, 0x87fc7e3c, 0x93febca5, 0x93febca5, 0x93febca5, 0x9813a416, 0xf53e12de, 0xf53e12de, 0x9813a416, }, 20 }, + { "gfxterm_high", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xb2497aec, 0x6d8cc798, 0xb2497aec, 0x465f936, 0x5fcf013d, 0x5fcf013d, 0xcacb7f18, 0xcacb7f18, 0xcacb7f18, 0x3b887a05, 0x3b887a05, 0x3b887a05, 0x7c777982, 0x7c777982, 0x7c777982, 0x5fcf013d, 0x465f936, 0x465f936, 0x5fcf013d, }, 20 }, + { "gfxterm_high", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0x404f2a96, 0xafb3d38d, 0x404f2a96, 0x91e6ebe6, 0xdd28f52b, 0xdd28f52b, 0x35beeea3, 0x35beeea3, 0x35beeea3, 0x48a8a967, 0x48a8a967, 0x48a8a967, 0x2b9a774d, 0x2b9a774d, 0x2b9a774d, 0xdd28f52b, 0x91e6ebe6, 0x91e6ebe6, 0xdd28f52b, }, 20 }, { "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, }, 5 }, { "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, }, 5 }, { "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, }, 5 }, diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c index 030ec3335..8fd5eed40 100644 --- a/grub-core/tests/gfxterm_menu.c +++ b/grub-core/tests/gfxterm_menu.c @@ -86,6 +86,8 @@ struct { "gfxterm_quot", "lang", "en@quot" }, { "gfxterm_piglatin", "lang", "en@piglatin" }, { "gfxterm_ch", "lang", "de_CH" }, + { "gfxterm_red", "menu_color_normal", "red/blue" }, + { "gfxterm_high", "menu_color_highlight", "blue/red" }, }; diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c index ec9d33a0b..76cc1829f 100644 --- a/grub-core/tests/video_checksum.c +++ b/grub-core/tests/video_checksum.c @@ -696,7 +696,8 @@ grub_video_checksum (const char *basename_in) capt_mode_info.reserved_field_pos, capt_mode_info.reserved_mask_size, capt_mode_info.width, - capt_mode_info.height, get_modename ()); + capt_mode_info.height, + grub_video_checksum_get_modename ()); write (genfd, " { \"", 5); write (genfd, basename_in, grub_strlen (basename_in)); diff --git a/include/grub/test.h b/include/grub/test.h index 8df85d010..ced47b212 100644 --- a/include/grub/test.h +++ b/include/grub/test.h @@ -110,7 +110,9 @@ grub_video_checksum_get_modename (void); #define GRUB_TEST_VIDEO_SMALL_N_MODES 6 -extern struct grub_video_mode_info grub_test_video_modes[30]; +#define GRUB_TEST_VIDEO_ALL_N_MODES 30 + +extern struct grub_video_mode_info grub_test_video_modes[GRUB_TEST_VIDEO_ALL_N_MODES]; #ifdef __cplusplus } From 16940e077c2b596c28e79226f374422371bada1c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 14:44:05 +0200 Subject: [PATCH 170/187] * grub-core/commands/videoinfo.c: Use "paletted" rather than "packed pixel". --- ChangeLog | 5 +++++ grub-core/commands/videoinfo.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7b37773b..8b7775977 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-07 Vladimir Serbinenko + + * grub-core/commands/videoinfo.c: Use "paletted" rather than "packed + pixel". + 2013-05-07 Vladimir Serbinenko Menu color test. diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c index 7a75c9d5a..4be8107d5 100644 --- a/grub-core/commands/videoinfo.c +++ b/grub-core/commands/videoinfo.c @@ -73,9 +73,9 @@ hook (const struct grub_video_mode_info *info, void *hook_arg) info->blue_field_pos, info->reserved_field_pos); if (info->mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) - /* TRANSLATORS: In "packed pixel" mode you write the index of the color - in the palette. Synonyms include "paletted color". */ - grub_xputs (_("Packed pixel ")); + /* TRANSLATORS: In "paletted color" mode you write the index of the color + in the palette. Synonyms include "packed pixel". */ + grub_xputs (_("Paletted ")); if (info->mode_type & GRUB_VIDEO_MODE_TYPE_YUV) grub_xputs (_("YUV ")); if (info->mode_type & GRUB_VIDEO_MODE_TYPE_PLANAR) From 8098f65556ee7c8ff46d3178448b78a5058d8670 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 15:46:17 +0200 Subject: [PATCH 171/187] Compressed HFS+ support. --- ChangeLog | 4 + Makefile.util.def | 1 + grub-core/Makefile.core.def | 5 + grub-core/fs/hfsplus.c | 272 +++++++++++--------------------- grub-core/fs/hfspluscomp.c | 302 ++++++++++++++++++++++++++++++++++++ include/grub/hfsplus.h | 217 ++++++++++++++++++++++++++ 6 files changed, 618 insertions(+), 183 deletions(-) create mode 100644 grub-core/fs/hfspluscomp.c create mode 100644 include/grub/hfsplus.h diff --git a/ChangeLog b/ChangeLog index 8b7775977..04302497f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + Compressed HFS+ support. + 2013-05-07 Vladimir Serbinenko * grub-core/commands/videoinfo.c: Use "paletted" rather than "packed diff --git a/Makefile.util.def b/Makefile.util.def index 588831421..dc621db20 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -85,6 +85,7 @@ library = { common = grub-core/fs/fshelp.c; common = grub-core/fs/hfs.c; common = grub-core/fs/hfsplus.c; + common = grub-core/fs/hfspluscomp.c; common = grub-core/fs/iso9660.c; common = grub-core/fs/jfs.c; common = grub-core/fs/minix.c; diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 7dc106ee1..bb62dce50 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1185,6 +1185,11 @@ module = { common = fs/hfsplus.c; }; +module = { + name = hfspluscomp; + common = fs/hfspluscomp.c; +}; + module = { name = iso9660; common = fs/iso9660.c; diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c index a507c0f1a..790562450 100644 --- a/grub-core/fs/hfsplus.c +++ b/grub-core/fs/hfsplus.c @@ -19,6 +19,7 @@ /* HFS+ is documented at http://developer.apple.com/technotes/tn/tn1150.html */ +#define grub_fshelp_node grub_hfsplus_file #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -36,42 +38,6 @@ GRUB_MOD_LICENSE ("GPLv3+"); #define GRUB_HFSPLUSX_MAGIC 0x4858 #define GRUB_HFSPLUS_SBLOCK 2 -/* A HFS+ extent. */ -struct grub_hfsplus_extent -{ - /* The first block of a file on disk. */ - grub_uint32_t start; - /* The amount of blocks described by this extent. */ - grub_uint32_t count; -} __attribute__ ((packed)); - -/* The descriptor of a fork. */ -struct grub_hfsplus_forkdata -{ - grub_uint64_t size; - grub_uint32_t clumpsize; - grub_uint32_t blocks; - struct grub_hfsplus_extent extents[8]; -} __attribute__ ((packed)); - -/* The HFS+ Volume Header. */ -struct grub_hfsplus_volheader -{ - grub_uint16_t magic; - grub_uint16_t version; - grub_uint32_t attributes; - grub_uint8_t unused1[12]; - grub_uint32_t utime; - grub_uint8_t unused2[16]; - grub_uint32_t blksize; - grub_uint8_t unused3[60]; - grub_uint64_t num_serial; - struct grub_hfsplus_forkdata allocations_file; - struct grub_hfsplus_forkdata extents_file; - struct grub_hfsplus_forkdata catalog_file; - struct grub_hfsplus_forkdata attrib_file; - struct grub_hfsplus_forkdata startup_file; -} __attribute__ ((packed)); /* The type of node. */ enum grub_hfsplus_btnode_type @@ -82,16 +48,6 @@ enum grub_hfsplus_btnode_type GRUB_HFSPLUS_BTNODE_TYPE_MAP = 2, }; -struct grub_hfsplus_btnode -{ - grub_uint32_t next; - grub_uint32_t prev; - grub_int8_t type; - grub_uint8_t height; - grub_uint16_t count; - grub_uint16_t unused; -} __attribute__ ((packed)); - /* The header of a HFS+ B+ Tree. */ struct grub_hfsplus_btheader { @@ -111,35 +67,6 @@ struct grub_hfsplus_btheader grub_uint32_t attributes; } __attribute__ ((packed)); -/* The on disk layout of a catalog key. */ -struct grub_hfsplus_catkey -{ - grub_uint16_t keylen; - grub_uint32_t parent; - grub_uint16_t namelen; - grub_uint16_t name[30]; -} __attribute__ ((packed)); - -/* The on disk layout of an extent overflow file key. */ -struct grub_hfsplus_extkey -{ - grub_uint16_t keylen; - grub_uint8_t type; - grub_uint8_t unused; - grub_uint32_t fileid; - grub_uint32_t start; -} __attribute__ ((packed)); - -struct grub_hfsplus_key -{ - union - { - struct grub_hfsplus_extkey extkey; - struct grub_hfsplus_catkey catkey; - grub_uint16_t keylen; - }; -} __attribute__ ((packed)); - struct grub_hfsplus_catfile { grub_uint16_t type; @@ -162,9 +89,13 @@ struct grub_hfsplus_catfile #define GRUB_HFSPLUS_FILEMODE_SYMLINK 0120000 /* Some pre-defined file IDs. */ -#define GRUB_HFSPLUS_FILEID_ROOTDIR 2 -#define GRUB_HFSPLUS_FILEID_OVERFLOW 3 -#define GRUB_HFSPLUS_FILEID_CATALOG 4 +enum + { + GRUB_HFSPLUS_FILEID_ROOTDIR = 2, + GRUB_HFSPLUS_FILEID_OVERFLOW = 3, + GRUB_HFSPLUS_FILEID_CATALOG = 4, + GRUB_HFSPLUS_FILEID_ATTR = 8 + }; enum grub_hfsplus_filetype { @@ -177,98 +108,15 @@ enum grub_hfsplus_filetype #define GRUB_HFSPLUSX_BINARYCOMPARE 0xBC #define GRUB_HFSPLUSX_CASEFOLDING 0xCF -/* Internal representation of a catalog key. */ -struct grub_hfsplus_catkey_internal -{ - grub_uint32_t parent; - const grub_uint16_t *name; - grub_size_t namelen; -}; - -/* Internal representation of an extent overflow key. */ -struct grub_hfsplus_extkey_internal -{ - grub_uint32_t fileid; - grub_uint8_t type; - grub_uint32_t start; -}; - -struct grub_hfsplus_key_internal -{ - union - { - struct grub_hfsplus_extkey_internal extkey; - struct grub_hfsplus_catkey_internal catkey; - }; -}; - - - -struct grub_fshelp_node -{ - struct grub_hfsplus_data *data; - struct grub_hfsplus_extent extents[8]; - grub_uint64_t size; - grub_uint32_t fileid; - grub_int32_t mtime; -}; - -struct grub_hfsplus_btree -{ - grub_uint32_t root; - grub_size_t nodesize; - - /* Catalog file node. */ - struct grub_fshelp_node file; -}; - -/* Information about a "mounted" HFS+ filesystem. */ -struct grub_hfsplus_data -{ - struct grub_hfsplus_volheader volheader; - grub_disk_t disk; - - unsigned int log2blksize; - - struct grub_hfsplus_btree catalog_tree; - struct grub_hfsplus_btree extoverflow_tree; - - struct grub_fshelp_node dirroot; - struct grub_fshelp_node opened_file; - - /* This is the offset into the physical disk for an embedded HFS+ - filesystem (one inside a plain HFS wrapper). */ - grub_disk_addr_t embedded_offset; - int case_sensitive; -}; - static grub_dl_t my_mod; -/* Return the offset of the record with the index INDEX, in the node - NODE which is part of the B+ tree BTREE. */ -static inline grub_off_t -grub_hfsplus_btree_recoffset (struct grub_hfsplus_btree *btree, - struct grub_hfsplus_btnode *node, int index) -{ - char *cnode = (char *) node; - void *recptr; - recptr = (&cnode[btree->nodesize - index * sizeof (grub_uint16_t) - 2]); - return grub_be_to_cpu16 (grub_get_unaligned16 (recptr)); -} - -/* Return a pointer to the record with the index INDEX, in the node - NODE which is part of the B+ tree BTREE. */ -static inline struct grub_hfsplus_key * -grub_hfsplus_btree_recptr (struct grub_hfsplus_btree *btree, - struct grub_hfsplus_btnode *node, int index) -{ - char *cnode = (char *) node; - grub_off_t offset; - offset = grub_hfsplus_btree_recoffset (btree, node, index); - return (struct grub_hfsplus_key *) &cnode[offset]; -} +grub_err_t (*grub_hfsplus_open_compressed) (struct grub_fshelp_node *node); +grub_ssize_t (*grub_hfsplus_read_compressed) (struct grub_hfsplus_file *node, + grub_off_t pos, + grub_size_t len, + char *buf); /* Find the extent that points to FILEBLOCK. If it is not in one of the 8 extents described by EXTENT, return -1. In that case set @@ -292,14 +140,6 @@ grub_hfsplus_find_block (struct grub_hfsplus_extent *extent, return 0xffffffffffffffffULL; } -static grub_err_t -grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree, - struct grub_hfsplus_key_internal *key, - int (*compare_keys) (struct grub_hfsplus_key *keya, - struct grub_hfsplus_key_internal *keyb), - struct grub_hfsplus_btnode **matchnode, - grub_off_t *keyoffset); - static int grub_hfsplus_cmp_extkey (struct grub_hfsplus_key *keya, struct grub_hfsplus_key_internal *keyb); @@ -310,7 +150,8 @@ grub_hfsplus_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) { struct grub_hfsplus_btnode *nnode = 0; grub_disk_addr_t blksleft = fileblock; - struct grub_hfsplus_extent *extents = &node->extents[0]; + struct grub_hfsplus_extent *extents = node->compressed + ? &node->resource_extents[0] : &node->extents[0]; while (1) { @@ -344,10 +185,11 @@ grub_hfsplus_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) extoverflow.extkey.fileid = node->fileid; extoverflow.extkey.type = 0; extoverflow.extkey.start = fileblock - blksleft; - + extoverflow.extkey.type = node->compressed ? 0xff : 0; if (grub_hfsplus_btree_search (&node->data->extoverflow_tree, &extoverflow, - grub_hfsplus_cmp_extkey, &nnode, &ptr)) + grub_hfsplus_cmp_extkey, &nnode, &ptr) + || !nnode) { grub_error (GRUB_ERR_READ_ERROR, "no block found for the file id 0x%x and the block offset 0x%x", @@ -373,7 +215,7 @@ grub_hfsplus_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) /* Read LEN bytes from the file described by DATA starting with byte POS. Return the amount of read bytes in READ. */ -static grub_ssize_t +grub_ssize_t grub_hfsplus_read_file (grub_fshelp_node_t node, grub_disk_read_hook_t read_hook, void *read_hook_data, grub_off_t pos, grub_size_t len, char *buf) @@ -460,15 +302,27 @@ grub_hfsplus_mount (grub_disk_t disk) /* Make a new node for the catalog tree. */ data->catalog_tree.file.data = data; data->catalog_tree.file.fileid = GRUB_HFSPLUS_FILEID_CATALOG; + data->catalog_tree.file.compressed = 0; grub_memcpy (&data->catalog_tree.file.extents, data->volheader.catalog_file.extents, sizeof data->volheader.catalog_file.extents); data->catalog_tree.file.size = grub_be_to_cpu64 (data->volheader.catalog_file.size); + data->attr_tree.file.data = data; + data->attr_tree.file.fileid = GRUB_HFSPLUS_FILEID_ATTR; + grub_memcpy (&data->attr_tree.file.extents, + data->volheader.attr_file.extents, + sizeof data->volheader.attr_file.extents); + + data->attr_tree.file.size = + grub_be_to_cpu64 (data->volheader.attr_file.size); + data->attr_tree.file.compressed = 0; + /* Make a new node for the extent overflow file. */ data->extoverflow_tree.file.data = data; data->extoverflow_tree.file.fileid = GRUB_HFSPLUS_FILEID_OVERFLOW; + data->extoverflow_tree.file.compressed = 0; grub_memcpy (&data->extoverflow_tree.file.extents, data->volheader.extents_file.extents, sizeof data->volheader.catalog_file.extents); @@ -501,6 +355,20 @@ grub_hfsplus_mount (grub_disk_t disk) data->extoverflow_tree.root = grub_be_to_cpu32 (header.root); data->extoverflow_tree.nodesize = grub_be_to_cpu16 (header.nodesize); + if (grub_hfsplus_read_file (&data->attr_tree.file, 0, 0, + sizeof (struct grub_hfsplus_btnode), + sizeof (header), (char *) &header) <= 0) + { + grub_errno = 0; + data->attr_tree.root = 0; + data->attr_tree.nodesize = 0; + } + else + { + data->attr_tree.root = grub_be_to_cpu32 (header.root); + data->attr_tree.nodesize = grub_be_to_cpu16 (header.nodesize); + } + data->dirroot.data = data; data->dirroot.fileid = GRUB_HFSPLUS_FILEID_ROOTDIR; @@ -586,6 +454,12 @@ grub_hfsplus_cmp_extkey (struct grub_hfsplus_key *keya, return 1; if (extkey_a->type < extkey_b->type) return -1; + + if (extkey_a->type > extkey_b->type) + return +1; + + if (extkey_a->type < extkey_b->type) + return -1; akey = grub_be_to_cpu32 (extkey_a->start); if (akey > extkey_b->start) @@ -668,7 +542,7 @@ grub_hfsplus_btree_iterate_node (struct grub_hfsplus_btree *btree, keys using the function COMPARE_KEYS. When a match is found, return the node in MATCHNODE and a pointer to the data in this node in KEYOFFSET. MATCHNODE should be freed by the caller. */ -static grub_err_t +grub_err_t grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree, struct grub_hfsplus_key_internal *key, int (*compare_keys) (struct grub_hfsplus_key *keya, @@ -683,6 +557,12 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree, grub_uint64_t save_node; grub_uint64_t node_count = 0; + if (!btree->nodesize) + { + *matchnode = 0; + return 0; + } + node = grub_malloc (btree->nodesize); if (! node) return grub_errno; @@ -760,7 +640,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree, { *matchnode = 0; grub_free (node); - return 1; + return 0; } } } @@ -872,11 +752,17 @@ list_nodes (void *record, void *hook_arg) if (!node) return 1; node->data = ctx->dir->data; + node->compressed = 0; + node->cbuf = 0; + node->compress_index = 0; grub_memcpy (node->extents, fileinfo->data.extents, sizeof (node->extents)); + grub_memcpy (node->resource_extents, fileinfo->resource.extents, + sizeof (node->resource_extents)); node->mtime = grub_be_to_cpu32 (fileinfo->mtime) - 2082844800; node->size = grub_be_to_cpu64 (fileinfo->data.size); + node->resource_size = grub_be_to_cpu64 (fileinfo->resource.size); node->fileid = grub_be_to_cpu32 (fileinfo->fileid); ctx->ret = ctx->hook (filename, type, node, ctx->hook_data); @@ -919,7 +805,8 @@ grub_hfsplus_iterate_dir (grub_fshelp_node_t dir, /* First lookup the first entry. */ if (grub_hfsplus_btree_search (&dir->data->catalog_tree, &intern, - grub_hfsplus_cmp_catkey, &node, &ptr)) + grub_hfsplus_cmp_catkey, &node, &ptr) + || !node) return 0; /* Iterate over all entries in this directory. */ @@ -950,6 +837,14 @@ grub_hfsplus_open (struct grub_file *file, const char *name) if (grub_errno) goto fail; + if (grub_hfsplus_open_compressed) + { + grub_err_t err; + err = grub_hfsplus_open_compressed (fdiro); + if (err) + goto fail; + } + file->size = fdiro->size; data->opened_file = *fdiro; grub_free (fdiro); @@ -973,7 +868,13 @@ grub_hfsplus_open (struct grub_file *file, const char *name) static grub_err_t grub_hfsplus_close (grub_file_t file) { - grub_free (file->data); + struct grub_hfsplus_data *data = + (struct grub_hfsplus_data *) file->data; + + grub_free (data->opened_file.cbuf); + grub_free (data->opened_file.compress_index); + + grub_free (data); grub_dl_unref (my_mod); @@ -987,6 +888,10 @@ grub_hfsplus_read (grub_file_t file, char *buf, grub_size_t len) struct grub_hfsplus_data *data = (struct grub_hfsplus_data *) file->data; + if (grub_hfsplus_read_compressed && data->opened_file.compressed) + return grub_hfsplus_read_compressed (&data->opened_file, + file->offset, len, buf); + return grub_hfsplus_read_file (&data->opened_file, file->read_hook, file->read_hook_data, file->offset, len, buf); @@ -1076,7 +981,8 @@ grub_hfsplus_label (grub_device_t device, char **label) /* First lookup the first entry. */ if (grub_hfsplus_btree_search (&data->catalog_tree, &intern, - grub_hfsplus_cmp_catkey_id, &node, &ptr)) + grub_hfsplus_cmp_catkey_id, &node, &ptr) + || !node) { grub_free (data); return 0; diff --git a/grub-core/fs/hfspluscomp.c b/grub-core/fs/hfspluscomp.c new file mode 100644 index 000000000..b3434418c --- /dev/null +++ b/grub-core/fs/hfspluscomp.c @@ -0,0 +1,302 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2012 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +/* HFS+ is documented at http://developer.apple.com/technotes/tn/tn1150.html */ + +#include +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + +/* big-endian. */ +struct grub_hfsplus_compress_header1 +{ + grub_uint32_t header_size; + grub_uint32_t end_descriptor_offset; + grub_uint32_t total_compressed_size_including_seek_blocks_and_header2; + grub_uint32_t value_0x32; + grub_uint8_t unused[0xf0]; +} __attribute__ ((packed)); + +/* big-endian. */ +struct grub_hfsplus_compress_header2 +{ + grub_uint32_t total_compressed_size_including_seek_blocks; +} __attribute__ ((packed)); + +/* little-endian. */ +struct grub_hfsplus_compress_header3 +{ + grub_uint32_t num_chunks; +} __attribute__ ((packed)); + +/* little-endian. */ +struct grub_hfsplus_compress_block_descriptor +{ + grub_uint32_t offset; + grub_uint32_t size; +}; + +struct grub_hfsplus_compress_end_descriptor +{ + grub_uint8_t always_the_same[50]; +} __attribute__ ((packed)); + +struct grub_hfsplus_attr_header +{ + grub_uint8_t unused[3]; + grub_uint8_t type; + grub_uint32_t unknown[1]; + grub_uint64_t size; +} __attribute__ ((packed)); + +struct grub_hfsplus_compress_attr +{ + grub_uint32_t magic; + grub_uint32_t type; + grub_uint32_t uncompressed_inline_size; + grub_uint32_t always_0; +}; + +enum + { + HFSPLUS_COMPRESSION_INLINE = 3, + HFSPLUS_COMPRESSION_RESOURCE = 4 + }; + +static int +grub_hfsplus_cmp_attrkey (struct grub_hfsplus_key *keya, + struct grub_hfsplus_key_internal *keyb) +{ + struct grub_hfsplus_attrkey *attrkey_a = &keya->attrkey; + struct grub_hfsplus_attrkey_internal *attrkey_b = &keyb->attrkey; + grub_uint32_t aparent = grub_be_to_cpu32 (attrkey_a->cnid); + grub_size_t len; + int diff; + + if (aparent > attrkey_b->cnid) + return 1; + if (aparent < attrkey_b->cnid) + return -1; + + len = grub_be_to_cpu16 (attrkey_a->namelen); + if (len > attrkey_b->namelen) + len = attrkey_b->namelen; + /* Since it's big-endian memcmp gives the same result as manually comparing + uint16_t but may be faster. */ + diff = grub_memcmp (attrkey_a->name, attrkey_b->name, + len * sizeof (attrkey_a->name[0])); + if (diff == 0) + diff = grub_be_to_cpu16 (attrkey_a->namelen) - attrkey_b->namelen; + return diff; +} + +#define HFSPLUS_COMPRESS_BLOCK_SIZE 65536 + +static grub_ssize_t +hfsplus_read_compressed_real (struct grub_hfsplus_file *node, + grub_off_t pos, grub_size_t len, char *buf) +{ + char *tmp_buf = 0; + grub_size_t len0 = len; + + if (node->compressed == 1) + { + grub_memcpy (buf, node->cbuf + pos, len); + return len; + } + + while (len) + { + grub_uint32_t block = pos / HFSPLUS_COMPRESS_BLOCK_SIZE; + grub_size_t curlen = HFSPLUS_COMPRESS_BLOCK_SIZE + - (pos % HFSPLUS_COMPRESS_BLOCK_SIZE); + + if (curlen > len) + curlen = len; + + if (node->cbuf_block != block) + { + grub_uint32_t sz = grub_le_to_cpu32 (node->compress_index[block].size); + grub_size_t ts; + if (!tmp_buf) + tmp_buf = grub_malloc (HFSPLUS_COMPRESS_BLOCK_SIZE); + if (!tmp_buf) + return -1; + if (grub_hfsplus_read_file (node, 0, 0, + grub_le_to_cpu32 (node->compress_index[block].start) + 0x104, + sz, tmp_buf) + != (grub_ssize_t) sz) + { + grub_free (tmp_buf); + return -1; + } + ts = HFSPLUS_COMPRESS_BLOCK_SIZE; + if (ts > node->size - (pos & ~(HFSPLUS_COMPRESS_BLOCK_SIZE))) + ts = node->size - (pos & ~(HFSPLUS_COMPRESS_BLOCK_SIZE)); + if (grub_zlib_decompress (tmp_buf, sz, 0, + node->cbuf, ts) < 0) + { + grub_free (tmp_buf); + return -1; + } + node->cbuf_block = block; + } + grub_memcpy (buf, node->cbuf + (pos % HFSPLUS_COMPRESS_BLOCK_SIZE), + curlen); + buf += curlen; + pos += curlen; + len -= curlen; + } + grub_free (tmp_buf); + return len0; +} + +static grub_err_t +hfsplus_open_compressed_real (struct grub_hfsplus_file *node) +{ + grub_err_t err; + struct grub_hfsplus_btnode *attr_node; + grub_off_t attr_off; + struct grub_hfsplus_key_internal key; + struct grub_hfsplus_attr_header *attr_head; + struct grub_hfsplus_compress_attr *cmp_head; +#define c grub_cpu_to_be16_compile_time + const grub_uint16_t compress_attr_name[] = + { + c('c'), c('o'), c('m'), c('.'), c('a'), c('p'), c('p'), c('l'), c('e'), + c('.'), c('d'), c('e'), c('c'), c('m'), c('p'), c('f'), c('s') }; +#undef c + if (node->size) + return 0; + + key.attrkey.cnid = node->fileid; + key.attrkey.namelen = sizeof (compress_attr_name) / sizeof (compress_attr_name[0]); + key.attrkey.name = compress_attr_name; + + err = grub_hfsplus_btree_search (&node->data->attr_tree, &key, + grub_hfsplus_cmp_attrkey, + &attr_node, &attr_off); + if (err || !attr_node) + { + grub_errno = 0; + return 0; + } + + attr_head = (struct grub_hfsplus_attr_header *) + ((char *) grub_hfsplus_btree_recptr (&node->data->attr_tree, + attr_node, attr_off) + + sizeof (struct grub_hfsplus_attrkey) + sizeof (compress_attr_name)); + if (attr_head->type != 0x10 + || !(attr_head->size & grub_cpu_to_be64_compile_time(~0xfULL))) + { + grub_free (attr_node); + return 0; + } + cmp_head = (struct grub_hfsplus_compress_attr *) (attr_head + 1); + if (cmp_head->magic != grub_cpu_to_be32_compile_time (0x66706d63)) + { + grub_free (attr_node); + return 0; + } + node->size = grub_le_to_cpu32 (cmp_head->uncompressed_inline_size); + + if (cmp_head->type == grub_cpu_to_le32_compile_time (HFSPLUS_COMPRESSION_RESOURCE)) + { + grub_uint32_t index_size; + node->compressed = 2; + + if (grub_hfsplus_read_file (node, 0, 0, + 0x104, sizeof (index_size), + (char *) &index_size) + != 4) + { + node->compressed = 0; + grub_free (attr_node); + grub_errno = 0; + return 0; + } + node->compress_index_size = grub_le_to_cpu32 (index_size); + node->compress_index = grub_malloc (node->compress_index_size + * sizeof (node->compress_index[0])); + if (!node->compress_index) + { + node->compressed = 0; + grub_free (attr_node); + return grub_errno; + } + if (grub_hfsplus_read_file (node, 0, 0, + 0x104 + sizeof (index_size), + node->compress_index_size + * sizeof (node->compress_index[0]), + (char *) node->compress_index) + != (grub_ssize_t) (node->compress_index_size + * sizeof (node->compress_index[0]))) + { + node->compressed = 0; + grub_free (attr_node); + grub_free (node->compress_index); + grub_errno = 0; + return 0; + } + + node->cbuf_block = -1; + + node->cbuf = grub_malloc (HFSPLUS_COMPRESS_BLOCK_SIZE); + grub_free (attr_node); + if (!node->cbuf) + { + node->compressed = 0; + grub_free (node->compress_index); + return grub_errno; + } + return 0; + } + if (cmp_head->type != HFSPLUS_COMPRESSION_INLINE) + { + grub_free (attr_node); + return 0; + } + + node->cbuf = grub_malloc (node->size); + if (!node->cbuf) + return grub_errno; + + if (grub_zlib_decompress ((char *) (cmp_head + 1), + grub_cpu_to_be64 (attr_head->size) + - sizeof (*cmp_head), 0, + node->cbuf, node->size) < 0) + return grub_errno; + node->compressed = 1; + return 0; +} + +GRUB_MOD_INIT(hfspluscomp) +{ + grub_hfsplus_open_compressed = hfsplus_open_compressed_real; + grub_hfsplus_read_compressed = hfsplus_read_compressed_real; +} + +GRUB_MOD_FINI(hfspluscomp) +{ + grub_hfsplus_open_compressed = 0; + grub_hfsplus_read_compressed = 0; +} diff --git a/include/grub/hfsplus.h b/include/grub/hfsplus.h new file mode 100644 index 000000000..0defd35b3 --- /dev/null +++ b/include/grub/hfsplus.h @@ -0,0 +1,217 @@ + +#include +#include + +/* A HFS+ extent. */ +struct grub_hfsplus_extent +{ + /* The first block of a file on disk. */ + grub_uint32_t start; + /* The amount of blocks described by this extent. */ + grub_uint32_t count; +} __attribute__ ((packed)); + +/* The descriptor of a fork. */ +struct grub_hfsplus_forkdata +{ + grub_uint64_t size; + grub_uint32_t clumpsize; + grub_uint32_t blocks; + struct grub_hfsplus_extent extents[8]; +} __attribute__ ((packed)); + +/* The HFS+ Volume Header. */ +struct grub_hfsplus_volheader +{ + grub_uint16_t magic; + grub_uint16_t version; + grub_uint32_t attributes; + grub_uint8_t unused1[12]; + grub_uint32_t utime; + grub_uint8_t unused2[16]; + grub_uint32_t blksize; + grub_uint8_t unused3[60]; + grub_uint64_t num_serial; + struct grub_hfsplus_forkdata allocations_file; + struct grub_hfsplus_forkdata extents_file; + struct grub_hfsplus_forkdata catalog_file; + struct grub_hfsplus_forkdata attr_file; + struct grub_hfsplus_forkdata startup_file; +} __attribute__ ((packed)); + +struct grub_hfsplus_compress_index +{ + grub_uint32_t start; + grub_uint32_t size; +}; + +struct grub_hfsplus_file +{ + struct grub_hfsplus_data *data; + struct grub_hfsplus_extent extents[8]; + struct grub_hfsplus_extent resource_extents[8]; + grub_uint64_t size; + grub_uint64_t resource_size; + grub_uint32_t fileid; + grub_int32_t mtime; + int compressed; + char *cbuf; + struct grub_hfsplus_compress_index *compress_index; + grub_uint32_t cbuf_block; + grub_uint32_t compress_index_size; +}; + +struct grub_hfsplus_btree +{ + grub_uint32_t root; + grub_size_t nodesize; + + /* Catalog file node. */ + struct grub_hfsplus_file file; +}; + +/* Information about a "mounted" HFS+ filesystem. */ +struct grub_hfsplus_data +{ + struct grub_hfsplus_volheader volheader; + grub_disk_t disk; + + unsigned int log2blksize; + + struct grub_hfsplus_btree catalog_tree; + struct grub_hfsplus_btree extoverflow_tree; + struct grub_hfsplus_btree attr_tree; + + struct grub_hfsplus_file dirroot; + struct grub_hfsplus_file opened_file; + + /* This is the offset into the physical disk for an embedded HFS+ + filesystem (one inside a plain HFS wrapper). */ + grub_disk_addr_t embedded_offset; + int case_sensitive; +}; + +/* Internal representation of a catalog key. */ +struct grub_hfsplus_catkey_internal +{ + grub_uint32_t parent; + const grub_uint16_t *name; + grub_size_t namelen; +}; + +/* Internal representation of an extent overflow key. */ +struct grub_hfsplus_extkey_internal +{ + grub_uint32_t fileid; + grub_uint32_t start; + grub_uint8_t type; +}; + +struct grub_hfsplus_attrkey +{ + grub_uint16_t keylen; + grub_uint16_t unknown1[1]; + grub_uint32_t cnid; + grub_uint16_t unknown2[2]; + grub_uint16_t namelen; + grub_uint16_t name[0]; +} __attribute__ ((packed)); + +struct grub_hfsplus_attrkey_internal +{ + grub_uint32_t cnid; + const grub_uint16_t *name; + grub_size_t namelen; +}; + +struct grub_hfsplus_key_internal +{ + union + { + struct grub_hfsplus_extkey_internal extkey; + struct grub_hfsplus_catkey_internal catkey; + struct grub_hfsplus_attrkey_internal attrkey; + }; +}; + +/* The on disk layout of a catalog key. */ +struct grub_hfsplus_catkey +{ + grub_uint16_t keylen; + grub_uint32_t parent; + grub_uint16_t namelen; + grub_uint16_t name[30]; +} __attribute__ ((packed)); + +/* The on disk layout of an extent overflow file key. */ +struct grub_hfsplus_extkey +{ + grub_uint16_t keylen; + grub_uint8_t type; + grub_uint8_t unused; + grub_uint32_t fileid; + grub_uint32_t start; +} __attribute__ ((packed)); + +struct grub_hfsplus_key +{ + union + { + struct grub_hfsplus_extkey extkey; + struct grub_hfsplus_catkey catkey; + struct grub_hfsplus_attrkey attrkey; + grub_uint16_t keylen; + }; +} __attribute__ ((packed)); + +struct grub_hfsplus_btnode +{ + grub_uint32_t next; + grub_uint32_t prev; + grub_int8_t type; + grub_uint8_t height; + grub_uint16_t count; + grub_uint16_t unused; +} __attribute__ ((packed)); + +/* Return the offset of the record with the index INDEX, in the node + NODE which is part of the B+ tree BTREE. */ +static inline grub_off_t +grub_hfsplus_btree_recoffset (struct grub_hfsplus_btree *btree, + struct grub_hfsplus_btnode *node, int index) +{ + char *cnode = (char *) node; + void *recptr; + recptr = (&cnode[btree->nodesize - index * sizeof (grub_uint16_t) - 2]); + return grub_be_to_cpu16 (grub_get_unaligned16 (recptr)); +} + +/* Return a pointer to the record with the index INDEX, in the node + NODE which is part of the B+ tree BTREE. */ +static inline struct grub_hfsplus_key * +grub_hfsplus_btree_recptr (struct grub_hfsplus_btree *btree, + struct grub_hfsplus_btnode *node, int index) +{ + char *cnode = (char *) node; + grub_off_t offset; + offset = grub_hfsplus_btree_recoffset (btree, node, index); + return (struct grub_hfsplus_key *) &cnode[offset]; +} + +extern grub_err_t (*grub_hfsplus_open_compressed) (struct grub_hfsplus_file *node); +extern grub_ssize_t (*grub_hfsplus_read_compressed) (struct grub_hfsplus_file *node, + grub_off_t pos, + grub_size_t len, + char *buf); + +grub_ssize_t +grub_hfsplus_read_file (struct grub_hfsplus_file *node, + grub_disk_read_hook_t read_hook, void *read_hook_data, + grub_off_t pos, grub_size_t len, char *buf); +grub_err_t +grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree, + struct grub_hfsplus_key_internal *key, + int (*compare_keys) (struct grub_hfsplus_key *keya, + struct grub_hfsplus_key_internal *keyb), + struct grub_hfsplus_btnode **matchnode, + grub_off_t *keyoffset); From e56d9637aed08faa00b9b9275e25c7d6545a80fd Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 20:40:00 +0200 Subject: [PATCH 172/187] * grub-core/term/efi/console.c: Fix compile error. --- ChangeLog | 4 ++++ grub-core/term/efi/console.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 04302497f..5b0b35706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-07 Vladimir Serbinenko + + * grub-core/term/efi/console.c: Fix compile error. + 2013-05-07 Vladimir Serbinenko Compressed HFS+ support. diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c index 2d6c6f9b9..9f76d23c0 100644 --- a/grub-core/term/efi/console.c +++ b/grub-core/term/efi/console.c @@ -86,7 +86,7 @@ grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)), j = 1; for (i = 0; i < c->ncomb; i++) if (c->base < 0xffff) - str[j++] = c->combining[i].code; + str[j++] = grub_unicode_get_comb (c)[i].code; str[j] = 0; /* Should this test be cached? */ From 89e0240c1c55a64f63c8143eb2b2ce35e222325d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 7 May 2013 20:42:05 +0200 Subject: [PATCH 173/187] * configure.ac: Don't use extended registers on x86_64. Reported by: Peter Jones. --- ChangeLog | 5 +++++ configure.ac | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5b0b35706..db874e50d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-07 Vladimir Serbinenko + + * configure.ac: Don't use extended registers on x86_64. + Reported by: Peter Jones. + 2013-05-07 Vladimir Serbinenko * grub-core/term/efi/console.c: Fix compile error. diff --git a/configure.ac b/configure.ac index 6c310f779..80549b000 100644 --- a/configure.ac +++ b/configure.ac @@ -464,7 +464,9 @@ if test "x$target_cpu" = xi386; then else TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" fi +fi +if test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64; then # Some toolchains enable these features by default, but they need # registers that aren't set up properly in GRUB. TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" From ee0220bc264bbece630e7b1ef8d173cafe1f1ab3 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 8 May 2013 11:01:11 +0200 Subject: [PATCH 174/187] * configure.ac: Don't disable extended registers on emu. --- ChangeLog | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index db874e50d..39dc05152 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-08 Vladimir Serbinenko + + * configure.ac: Don't disable extended registers on emu. + 2013-05-07 Vladimir Serbinenko * configure.ac: Don't use extended registers on x86_64. diff --git a/configure.ac b/configure.ac index 80549b000..fa0e00a12 100644 --- a/configure.ac +++ b/configure.ac @@ -466,7 +466,7 @@ if test "x$target_cpu" = xi386; then fi fi -if test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64; then +if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then # Some toolchains enable these features by default, but they need # registers that aren't set up properly in GRUB. TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" From 3e912fda81113e1f2d20ca5c920ec1b6da73d604 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 8 May 2013 11:05:37 +0200 Subject: [PATCH 175/187] * conf/Makefile.common: Poison float and double on non-emu. --- ChangeLog | 4 ++++ conf/Makefile.common | 5 +++++ util/import_gcry.py | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 39dc05152..0da7177af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-08 Vladimir Serbinenko + + * conf/Makefile.common: Poison float and double on non-emu. + 2013-05-08 Vladimir Serbinenko * configure.ac: Don't disable extended registers on emu. diff --git a/conf/Makefile.common b/conf/Makefile.common index c185a553d..ca1cb17f6 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -40,6 +40,11 @@ endif # Other options +if ! COND_emu +CFLAGS_PLATFORM += -Dfloat=__grub_poision +CFLAGS_PLATFORM += -Ddouble=__grub_poision +endif + CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\" CPPFLAGS_DEFAULT += -I$(builddir) CPPFLAGS_DEFAULT += -I$(srcdir) diff --git a/util/import_gcry.py b/util/import_gcry.py index 18f525347..afa8e697e 100644 --- a/util/import_gcry.py +++ b/util/import_gcry.py @@ -488,6 +488,12 @@ for src in sorted (os.listdir (os.path.join (indir, "src"))): fw.close () continue f = codecs.open (infile, "r", "utf-8") + if src == "types.h": + fw.write (f.read ().replace ("float f;", "").replace ("double g;", "")) + f.close () + fw.close () + continue + fw.write (f.read ()) f.close () fw.close () From 16f7c8f6d372c4a5fe209cafdcec0def95d69169 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 8 May 2013 11:09:08 +0200 Subject: [PATCH 176/187] * grub-core/commands/cat.c: Show UTF-8 characters. --- ChangeLog | 4 ++ grub-core/commands/cat.c | 85 ++++++++++++++++++++++++++++++++++------ include/grub/charset.h | 16 ++++++++ 3 files changed, 94 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0da7177af..a57d103b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-08 Vladimir Serbinenko + + * grub-core/commands/cat.c: Show UTF-8 characters. + 2013-05-08 Vladimir Serbinenko * conf/Makefile.common: Poison float and double on non-emu. diff --git a/grub-core/commands/cat.c b/grub-core/commands/cat.c index cd2d76099..8a7f1af78 100644 --- a/grub-core/commands/cat.c +++ b/grub-core/commands/cat.c @@ -24,6 +24,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -39,9 +40,15 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args) struct grub_arg_list *state = ctxt->state; int dos = 0; grub_file_t file; - char buf[GRUB_DISK_SECTOR_SIZE]; + unsigned char buf[GRUB_DISK_SECTOR_SIZE]; grub_ssize_t size; int key = GRUB_TERM_NO_KEY; + grub_uint32_t code = 0; + int count = 0; + unsigned char utbuf[GRUB_MAX_UTF8_PER_CODEPOINT + 1]; + int utcount = 0; + int is_0d = 0; + int j; if (state[0].set) dos = 1; @@ -60,21 +67,65 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args) for (i = 0; i < size; i++) { - unsigned char c = buf[i]; + utbuf[utcount++] = buf[i]; - if ((grub_isprint (c) || grub_isspace (c)) && c != '\r') - grub_printf ("%c", c); - else if (dos && c == '\r' && i + 1 < size && buf[i + 1] == '\n') - { - grub_printf ("\n"); - i++; - } - else + if (is_0d && buf[i] != '\n') { grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); - grub_printf ("<%x>", (int) c); + grub_printf ("<%x>", (int) '\r'); grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); } + + is_0d = 0; + + if (!grub_utf8_process (buf[i], &code, &count)) + { + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + for (j = 0; j < utcount - 1; j++) + grub_printf ("<%x>", (unsigned int) utbuf[j]); + code = 0; + count = 0; + if (utcount == 1 || !grub_utf8_process (buf[i], &code, &count)) + { + grub_printf ("<%x>", (unsigned int) buf[i]); + code = 0; + count = 0; + utcount = 0; + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + continue; + } + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + utcount = 1; + } + if (count) + continue; + + if ((code >= 0xa1 || grub_isprint (code) + || grub_isspace (code)) && code != '\r') + { + grub_printf ("%C", code); + count = 0; + code = 0; + utcount = 0; + continue; + } + + if (dos && code == '\r') + { + is_0d = 1; + count = 0; + code = 0; + utcount = 0; + continue; + } + + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + for (j = 0; j < utcount; j++) + grub_printf ("<%x>", (unsigned int) utbuf[j]); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + count = 0; + code = 0; + utcount = 0; } do @@ -82,6 +133,18 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args) while (key != GRUB_TERM_ESC && key != GRUB_TERM_NO_KEY); } + if (is_0d) + { + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + grub_printf ("<%x>", (unsigned int) '\r'); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + } + + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + for (j = 0; j < utcount; j++) + grub_printf ("<%x>", (unsigned int) utbuf[j]); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + grub_xputs ("\n"); grub_refresh (); grub_file_close (file); diff --git a/include/grub/charset.h b/include/grub/charset.h index ab9202884..d14faea32 100644 --- a/include/grub/charset.h +++ b/include/grub/charset.h @@ -41,6 +41,7 @@ You need at least three UTF-8 bytes to have 2 UTF-16 words (surrogate pairs). */ #define GRUB_MAX_UTF16_PER_UTF8 1 +#define GRUB_MAX_UTF8_PER_CODEPOINT 4 #define GRUB_UCS2_LIMIT 0x10000 #define GRUB_UTF16_UPPER_SURROGATE(code) \ @@ -67,6 +68,14 @@ grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int *count) *code <<= 6; *code |= (c & GRUB_UINT8_6_TRAILINGBITS); (*count)--; + /* Overlong. */ + if ((*count == 1 && *code <= 0x1f) + || (*count == 2 && *code <= 0xf)) + { + *code = 0; + *count = 0; + return 0; + } return 1; } } @@ -80,6 +89,13 @@ grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int *count) { *count = 1; *code = c & GRUB_UINT8_5_TRAILINGBITS; + /* Overlong */ + if (*code <= 1) + { + *count = 0; + *code = 0; + return 0; + } return 1; } if ((c & GRUB_UINT8_4_LEADINGBITS) == GRUB_UINT8_3_LEADINGBITS) From 0e7b2e32172baa9d213f647ab4bd8edf38a348a9 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 8 May 2013 11:49:25 +0200 Subject: [PATCH 177/187] New test: cmdline and cat. --- ChangeLog | 4 + grub-core/Makefile.core.def | 5 ++ grub-core/tests/checksums.h | 6 ++ grub-core/tests/cmdline_cat_test.c | 117 ++++++++++++++++++++++++++ grub-core/tests/gfxterm_menu.c | 29 +------ grub-core/tests/lib/functional_test.c | 1 + grub-core/tests/video_checksum.c | 40 +++++++++ include/grub/test.h | 4 + 8 files changed, 180 insertions(+), 26 deletions(-) create mode 100644 grub-core/tests/cmdline_cat_test.c diff --git a/ChangeLog b/ChangeLog index a57d103b0..dcd43934f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-08 Vladimir Serbinenko + + New test: cmdline and cat. + 2013-05-08 Vladimir Serbinenko * grub-core/commands/cat.c: Show UTF-8 characters. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index bb62dce50..602b49765 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -1762,6 +1762,11 @@ module = { common = tests/gfxterm_menu.c; }; +module = { + name = cmdline_cat_test; + common = tests/cmdline_cat_test.c; +}; + module = { name = bitmap; common = video/bitmap.c; diff --git a/grub-core/tests/checksums.h b/grub-core/tests/checksums.h index aa4ae999a..3539b64dd 100644 --- a/grub-core/tests/checksums.h +++ b/grub-core/tests/checksums.h @@ -1,3 +1,9 @@ + { "cmdline_cat", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7dbff368, 0x7dbff368, 0x5a5bdc8d, 0x5a5bdc8d, 0x79753177, 0x79753177, 0xd01ede5b, 0xd01ede5b, 0x13708a73, 0x13708a73, 0x90186de3, 0x90186de3, 0xe63d02a2, 0xe63d02a2, 0x2c9dc262, 0x2c9dc262, 0x3eebd7b, 0x3eebd7b, 0xe8f3a5d8, 0xe8f3a5d8, 0xd38ecfe3, 0xd38ecfe3, 0x51878485, 0x51878485, 0xcbdb6d67, 0xcbdb6d67, 0xca25582, 0xca25582, 0x5bea0484, 0x5bea0484, 0x9ec5f71d, 0x9ec5f71d, 0x3f0bd7bc, 0x3f0bd7bc, 0xdbb0a5d2, 0xdbb0a5d2, 0xea710e2f, 0xea710e2f, 0xd14933fe, 0xd14933fe, 0x4906b783, 0xad94ffeb, 0xf31c9259, 0xf31c9259, }, 45 }, + { "cmdline_cat", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xfeea303f, 0xfeea303f, 0x9a6d5200, 0x9a6d5200, 0x784f6e43, 0x784f6e43, 0xc3973f40, 0xc3973f40, 0x954a7cb1, 0x954a7cb1, 0x8b7c607f, 0x8b7c607f, 0x290bf4b3, 0x290bf4b3, 0x5d67148d, 0x5d67148d, 0x37008df4, 0x37008df4, 0xce9d51c7, 0xce9d51c7, 0xe29b4663, 0xe29b4663, 0xefb7cd59, 0xefb7cd59, 0xe12cc621, 0xe12cc621, 0xd6d4461f, 0xd6d4461f, 0x4d4490ef, 0x4d4490ef, 0x6ce4a360, 0x6ce4a360, 0x812e6359, 0x812e6359, 0xe2f82bc9, 0xe2f82bc9, 0x9621917d, 0x9621917d, 0xbbe37c69, 0xbbe37c69, 0x719d9b99, 0xe95c1cc3, 0xe0476ad0, 0xe0476ad0, }, 45 }, + { "cmdline_cat", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0x50b82239, 0x50b82239, 0x82c36c12, 0x82c36c12, 0x6311208d, 0x6311208d, 0x816bd4b3, 0x816bd4b3, 0xc9281fd0, 0xc9281fd0, 0x75767bac, 0x75767bac, 0x52edeac, 0x52edeac, 0xfdb551f7, 0xfdb551f7, 0xba21cd3, 0xba21cd3, 0xf2b3468a, 0xf2b3468a, 0xd5560323, 0xd5560323, 0x12c650f6, 0x12c650f6, 0x3d6c5861, 0x3d6c5861, 0x50062423, 0x50062423, 0x2ce22983, 0x2ce22983, 0x4996bc4d, 0x4996bc4d, 0x50450525, 0x50450525, 0xe1c94312, 0xe1c94312, 0x21224aac, 0x21224aac, 0x94cbe214, 0x94cbe214, 0x4578c664, 0xcb360887, 0x5a749f1d, 0x5a749f1d, }, 45 }, + { "cmdline_cat", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0xbb687653, 0xbb687653, 0xa81427a7, 0xa81427a7, 0x71d7f3b, 0x71d7f3b, 0x25fea6ca, 0x25fea6ca, 0x17c19d74, 0x17c19d74, 0x4779bf48, 0x4779bf48, 0xe424e759, 0xe424e759, 0xb57fb5ae, 0xb57fb5ae, 0xd877002b, 0xd877002b, 0xdd8d7442, 0xdd8d7442, 0xe2536fde, 0xe2536fde, 0x1ebba341, 0x1ebba341, 0xef042176, 0xef042176, 0x6137f228, 0x6137f228, 0xf04a8558, 0xf04a8558, 0xff72172d, 0xff72172d, 0x5f26278f, 0x5f26278f, 0x3ed777c, 0x3ed777c, 0xb1d686e, 0xb1d686e, 0x5cead249, 0x5cead249, 0x271487f6, 0x3b9ece9a, 0xccc3db5e, 0xccc3db5e, }, 45 }, + { "cmdline_cat", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0xd594219a, 0xd594219a, 0x254fa44c, 0x254fa44c, 0x30177d61, 0x30177d61, 0x1a576e20, 0x1a576e20, 0xe439395f, 0xe439395f, 0xb289a26f, 0xb289a26f, 0xc9eaceca, 0xc9eaceca, 0x9e76037b, 0x9e76037b, 0xfa098eb4, 0xfa098eb4, 0x5881d993, 0x5881d993, 0x3a4ac117, 0x3a4ac117, 0x203e9716, 0x203e9716, 0x67aed713, 0x67aed713, 0xb740eccb, 0xb740eccb, 0xd50247da, 0xd50247da, 0xe0c382bf, 0xe0c382bf, 0x95d81f9d, 0x95d81f9d, 0x1051b5ac, 0x1051b5ac, 0x71f00e30, 0x71f00e30, 0xe35fe082, 0xe35fe082, 0xeda25a7a, 0xc4543b1e, 0x4725b91c, 0x4725b91c, }, 45 }, + { "cmdline_cat", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xd803b53b, 0xd803b53b, 0x70b7ae8b, 0x70b7ae8b, 0xa20d9a15, 0xa20d9a15, 0x6113d33b, 0x6113d33b, 0xfd38d301, 0xfd38d301, 0x8b04db4, 0x8b04db4, 0xdae859df, 0xdae859df, 0x80cf138b, 0x80cf138b, 0xdfa6ef9, 0xdfa6ef9, 0x856adaf0, 0x856adaf0, 0x7023cc2d, 0x7023cc2d, 0xad7e7d54, 0xad7e7d54, 0xde8eff49, 0xde8eff49, 0x34355cc3, 0x34355cc3, 0x25adccda, 0x25adccda, 0x6d6c350d, 0x6d6c350d, 0x1c49b499, 0x1c49b499, 0x8188f1b4, 0x8188f1b4, 0x5556dc0c, 0x5556dc0c, 0xbd9ef1f5, 0xbd9ef1f5, 0x5176575b, 0xd3e2f7f1, 0xccda996c, 0xccda996c, }, 45 }, { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, 0x59c36f00, 0xcba09304, 0xcba09304, 0xcba09304, 0x97b293e6, 0x97b293e6, 0x97b293e6, 0xd2fea778, 0xd2fea778, 0xd2fea778, 0x59c36f00, 0xe82e990f, 0xe82e990f, 0x59c36f00, }, 20 }, { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, 0xaa4593fe, 0xfda7eac8, 0xfda7eac8, 0xfda7eac8, 0x272045f3, 0x272045f3, 0x272045f3, 0x1b2c55ba, 0x1b2c55ba, 0x1b2c55ba, 0xaa4593fe, 0xff6942c6, 0xff6942c6, 0xaa4593fe, }, 20 }, { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, 0xc9cbf769, 0x270340e6, 0x270340e6, 0x270340e6, 0x13ea67c8, 0x13ea67c8, 0x13ea67c8, 0x318e0f43, 0x318e0f43, 0x318e0f43, 0xc9cbf769, 0x2e0276, 0x2e0276, 0xc9cbf769, }, 20 }, diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c new file mode 100644 index 000000000..cd08b2243 --- /dev/null +++ b/grub-core/tests/cmdline_cat_test.c @@ -0,0 +1,117 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +/* All tests need to include test.h for GRUB testing framework. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GRUB_MOD_LICENSE ("GPLv3+"); + + +static const char testfile[] = + /* Chinese & UTF-8 test from Carbon Jiao. */ + "从硬盘的第一主分区启动\n" + "The quick brown fox jumped over the lazy dog.\n" + /* Characters used: + Code point Description UTF-8 encoding + ----------- ------------------------------ -------------- + U+263A unfilled smiley face E2 98 BA + U+00A1 inverted exclamation point C2 A1 + U+00A3 British pound currency symbol C2 A3 + U+03C4 Greek tau CF 84 + U+00E4 lowercase letter a with umlaut C3 A4 + U+2124 set 'Z' symbol (integers) E2 84 A4 + U+2286 subset symbol E2 8A 86 + U+211D set 'R' symbol (real numbers) E2 84 9D */ + "Unicode test: happy\xE2\x98\xBA \xC2\xA3 5.00" + " \xC2\xA1\xCF\x84\xC3\xA4u! " + " \xE2\x84\xA4\xE2\x8A\x86\xE2\x84\x9D\n" + /* Test handling of bad (non-UTF8) sequences*/ + "\x99Hello\xc2Hello\xc1\x81Hello\n"; +; + +static char * +get_test_txt (void) +{ + return grub_strdup (testfile); +} + +struct grub_procfs_entry test_txt = +{ + .name = "test.txt", + .get_contents = get_test_txt +}; + + +/* Functional test main method. */ +static void +cmdline_cat_test (void) +{ + unsigned i; + + grub_dl_load ("gfxterm"); + + if (grub_font_load ("unicode") == 0) + { + grub_test_assert (0, "unicode font not found: %s", grub_errmsg); + return; + } + + grub_procfs_register ("test.txt", &test_txt); + + for (i = 0; i < GRUB_TEST_VIDEO_SMALL_N_MODES; i++) + { + grub_video_capture_start (&grub_test_video_modes[i], + grub_video_fbstd_colors, + grub_test_video_modes[i].number_of_colors); + grub_terminal_input_fake_sequence ((int []) + { 'c', 'a', 't', ' ', + '(', 'p', 'r', 'o', 'c', ')', + '/', 't', 'e', 's', 't', '.', + 't', 'x', 't', '\n', + GRUB_TERM_NO_KEY, + GRUB_TERM_NO_KEY, '\e'}, + 23); + + grub_video_checksum ("cmdline_cat"); + + if (grub_test_use_gfxterm ()) + return; + + grub_cmdline_run (1); + + grub_test_use_gfxterm_end (); + + grub_terminal_input_fake_sequence_end (); + grub_video_checksum_end (); + grub_video_capture_end (); + } + + grub_procfs_unregister (&test_txt); +} + +/* Register example_test method as a functional test. */ +GRUB_FUNCTIONAL_TEST (cmdline_cat_test, cmdline_cat_test); diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c index 8fd5eed40..82c38027a 100644 --- a/grub-core/tests/gfxterm_menu.c +++ b/grub-core/tests/gfxterm_menu.c @@ -111,9 +111,6 @@ gfxterm_menu (void) for (j = 0; j < ARRAY_SIZE (tests); j++) for (i = 0; i < GRUB_TEST_VIDEO_SMALL_N_MODES; i++) { - struct grub_term_output *saved_outputs; - struct grub_term_output *saved_gfxnext; - struct grub_term_output *gfxterm; grub_uint64_t start = grub_get_time_ms (); grub_video_capture_start (&grub_test_video_modes[i], @@ -124,26 +121,8 @@ gfxterm_menu (void) grub_video_checksum (tests[j].name); - saved_outputs = grub_term_outputs; - - FOR_ACTIVE_TERM_OUTPUTS (gfxterm) - if (grub_strcmp (gfxterm->name, "gfxterm") == 0) - break; - if (!gfxterm) - FOR_DISABLED_TERM_OUTPUTS (gfxterm) - if (grub_strcmp (gfxterm->name, "gfxterm") == 0) - break; - - if (!gfxterm) - { - grub_test_assert (0, "terminal `%s' isn't found", "gfxterm"); - return; - } - - saved_gfxnext = gfxterm->next; - grub_term_outputs = gfxterm; - gfxterm->next = 0; - gfxterm->init (gfxterm); + if (grub_test_use_gfxterm ()) + return; grub_env_context_open (); if (tests[j].var) @@ -151,9 +130,7 @@ gfxterm_menu (void) grub_normal_execute ("(proc)/test.cfg", 1, 0); grub_env_context_close (); - gfxterm->fini (gfxterm); - gfxterm->next = saved_gfxnext; - grub_term_outputs = saved_outputs; + grub_test_use_gfxterm_end (); grub_terminal_input_fake_sequence_end (); grub_video_checksum_end (); diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c index 8f66fe33b..a41fb978d 100644 --- a/grub-core/tests/lib/functional_test.c +++ b/grub-core/tests/lib/functional_test.c @@ -57,6 +57,7 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)), grub_dl_load ("videotest_checksum"); grub_dl_load ("gfxterm_menu"); grub_dl_load ("setjmp_test"); + grub_dl_load ("cmdline_cat_test"); FOR_LIST_ELEMENTS (test, grub_test_list) ok = !grub_test_run (test) && ok; diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c index 76cc1829f..a11e2dd85 100644 --- a/grub-core/tests/video_checksum.c +++ b/grub-core/tests/video_checksum.c @@ -22,6 +22,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -759,3 +760,42 @@ grub_video_checksum_end (void) ctr = 0; grub_video_capture_refresh_cb = 0; } + +static struct grub_term_output *saved_outputs; +static struct grub_term_output *saved_gfxnext; +static struct grub_term_output *gfxterm; + +int +grub_test_use_gfxterm (void) +{ + saved_outputs = grub_term_outputs; + + FOR_ACTIVE_TERM_OUTPUTS (gfxterm) + if (grub_strcmp (gfxterm->name, "gfxterm") == 0) + break; + if (!gfxterm) + FOR_DISABLED_TERM_OUTPUTS (gfxterm) + if (grub_strcmp (gfxterm->name, "gfxterm") == 0) + break; + + if (!gfxterm) + { + grub_test_assert (0, "terminal `%s' isn't found", "gfxterm"); + return 1; + } + + saved_gfxnext = gfxterm->next; + grub_term_outputs = gfxterm; + gfxterm->next = 0; + gfxterm->init (gfxterm); + + return 0; +} + +void +grub_test_use_gfxterm_end (void) +{ + gfxterm->fini (gfxterm); + gfxterm->next = saved_gfxnext; + grub_term_outputs = saved_outputs; +} diff --git a/include/grub/test.h b/include/grub/test.h index ced47b212..aa3a7ca7b 100644 --- a/include/grub/test.h +++ b/include/grub/test.h @@ -114,6 +114,10 @@ grub_video_checksum_get_modename (void); extern struct grub_video_mode_info grub_test_video_modes[GRUB_TEST_VIDEO_ALL_N_MODES]; +int +grub_test_use_gfxterm (void); +void grub_test_use_gfxterm_end (void); + #ifdef __cplusplus } #endif From 091945b239463380a60ff216a0e5530810323a56 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Wed, 8 May 2013 18:42:48 +0400 Subject: [PATCH 178/187] * docs/grub.texi: (Network): Add description of net_default_interface, net_default_ip and net_default_mac. Rewrite variables description to emphasize that they are per-interface. --- ChangeLog | 6 +++ docs/grub.texi | 115 +++++++++++++++++++++++++++++++++---------------- 2 files changed, 85 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index dcd43934f..33d1265cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-05-08 Andrey Borzenkov + + * docs/grub.texi (Network): Add description of net_default_interface, + net_default_ip and net_default_mac. Rewrite variables description + to emphasize that they are per-interface. + 2013-05-08 Vladimir Serbinenko New test: cmdline and cat. diff --git a/docs/grub.texi b/docs/grub.texi index bfd42ee51..70c0de81b 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2134,37 +2134,52 @@ this should be changed both in the prefix and in any references to the device name in the configuration file. GRUB provides several environment variables which may be used to inspect or -change the behaviour of the PXE device: +change the behaviour of the PXE device. In the following description +@var{} is placeholder for the name of network interface (platform +dependent): @table @samp -@item net_pxe_ip -The IP address of this machine. Read-only. +@item net_@var{}_ip +The network interface's IP address. Read-only. -@item net_pxe_mac +@item net_@var{}_mac The network interface's MAC address. Read-only. -@item net_pxe_hostname +@item net_@var{}_hostname The client host name provided by DHCP. Read-only. -@item net_pxe_domain +@item net_@var{}_domain The client domain name provided by DHCP. Read-only. -@item net_pxe_rootpath +@item net_@var{}_rootpath The path to the client's root disk provided by DHCP. Read-only. -@item net_pxe_extensionspath +@item net_@var{}_extensionspath The path to additional DHCP vendor extensions provided by DHCP. Read-only. -@item net_pxe_boot_file +@item net_@var{}_boot_file The boot file name provided by DHCP. Read-only. -@item net_pxe_dhcp_server_name +@item net_@var{}_dhcp_server_name The name of the DHCP server responsible for these boot parameters. Read-only. +@item net_default_interface +Initially set to name of network interface that was used to load grub. +Read-write, although setting it affects only interpretation of +@samp{net_default_ip} and @samp{net_default_mac} + +@item net_default_ip +The IP address of default interface. Read-only. This is alias for the +@samp{net_$@{net_default_interface@}_ip}. + +@item net_default_mac +The default interface's MAC address. Read-only. This is alias for the +@samp{net_$@{net_default_interface@}_mac}. + @item net_default_server -The default server. Read-write, although setting this is only useful -before opening a network device. +The default server used by network drives (@pxref{Device syntax}). Read-write, +although setting this is only useful before opening a network device. @end table @@ -2735,14 +2750,18 @@ These variables have special meaning to GRUB. * locale_dir:: * menu_color_highlight:: * menu_color_normal:: -* net_pxe_boot_file:: -* net_pxe_dhcp_server_name:: -* net_pxe_domain:: -* net_pxe_extensionspath:: -* net_pxe_hostname:: -* net_pxe_ip:: -* net_pxe_mac:: -* net_pxe_rootpath:: +* net_@var{}_boot_file:: +* net_@var{}_dhcp_server_name:: +* net_@var{}_domain:: +* net_@var{}_extensionspath:: +* net_@var{}_hostname:: +* net_@var{}_ip:: +* net_@var{}_mac:: +* net_@var{}_rootpath:: +* net_default_interface:: +* net_default_ip:: +* net_default_mac:: +* net_default_server:: * pager:: * prefix:: * pxe_blksize:: @@ -3009,50 +3028,74 @@ variable changes those colors. For the available color names, The default is the value of @samp{color_normal} (@pxref{color_normal}). -@node net_pxe_boot_file -@subsection net_pxe_boot_file +@node net_@var{}_boot_file +@subsection net_@var{}_boot_file @xref{Network}. -@node net_pxe_dhcp_server_name -@subsection net_pxe_dhcp_server_name +@node net_@var{}_dhcp_server_name +@subsection net_@var{}_dhcp_server_name @xref{Network}. -@node net_pxe_domain -@subsection net_pxe_domain +@node net_@var{}_domain +@subsection net_@var{}_domain @xref{Network}. -@node net_pxe_extensionspath -@subsection net_pxe_extensionspath +@node net_@var{}_extensionspath +@subsection net_@var{}_extensionspath @xref{Network}. -@node net_pxe_hostname -@subsection net_pxe_hostname +@node net_@var{}_hostname +@subsection net_@var{}_hostname @xref{Network}. -@node net_pxe_ip -@subsection net_pxe_ip +@node net_@var{}_ip +@subsection net_@var{}_ip @xref{Network}. -@node net_pxe_mac -@subsection net_pxe_mac +@node net_@var{}_mac +@subsection net_@var{}_mac @xref{Network}. -@node net_pxe_rootpath -@subsection net_pxe_rootpath +@node net_@var{}_rootpath +@subsection net_@var{}_rootpath + +@xref{Network}. + + +@node net_default_interface +@subsection net_default_interface + +@xref{Network}. + + +@node net_default_ip +@subsection net_default_ip + +@xref{Network}. + + +@node net_default_mac +@subsection net_default_mac + +@xref{Network}. + + +@node net_default_server +@subsection net_default_server @xref{Network}. From 8200fa1597494473b3a6a87101ed499bee178d49 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 10 May 2013 14:07:41 +0200 Subject: [PATCH 179/187] * grub-core/term/terminfo.c: Rename ANSI_C0 to ANSI_CSI to avoid misnomer. --- ChangeLog | 5 +++++ grub-core/term/terminfo.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33d1265cc..89bcec3a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-10 Vladimir Serbinenko + + * grub-core/term/terminfo.c: Rename ANSI_C0 to ANSI_CSI to avoid + misnomer. + 2013-05-08 Andrey Borzenkov * docs/grub.texi (Network): Add description of net_default_interface, diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c index a46bb4b27..37e948255 100644 --- a/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c @@ -39,8 +39,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); -#define ANSI_C0 0x9b -#define ANSI_C0_STR "\x9b" +#define ANSI_CSI 0x9b +#define ANSI_CSI_STR "\x9b" static struct grub_term_output *terminfo_outputs; @@ -132,14 +132,14 @@ grub_terminfo_set_current (struct grub_term_output *term, if (grub_strcmp ("arc", str) == 0) { data->name = grub_strdup ("arc"); - data->gotoxy = grub_strdup (ANSI_C0_STR "%i%p1%d;%p2%dH"); - data->cls = grub_strdup (ANSI_C0_STR "2J"); - data->reverse_video_on = grub_strdup (ANSI_C0_STR "7m"); - data->reverse_video_off = grub_strdup (ANSI_C0_STR "0m"); + data->gotoxy = grub_strdup (ANSI_CSI_STR "%i%p1%d;%p2%dH"); + data->cls = grub_strdup (ANSI_CSI_STR "2J"); + data->reverse_video_on = grub_strdup (ANSI_CSI_STR "7m"); + data->reverse_video_off = grub_strdup (ANSI_CSI_STR "0m"); data->cursor_on = 0; data->cursor_off = 0; - data->setcolor = grub_strdup (ANSI_C0_STR "3%p1%dm" - ANSI_C0_STR "4%p2%dm"); + data->setcolor = grub_strdup (ANSI_CSI_STR "3%p1%dm" + ANSI_CSI_STR "4%p2%dm"); return grub_errno; } @@ -427,7 +427,7 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, } *len = 1; keys[0] = c; - if (c != ANSI_C0 && c != '\e') + if (c != ANSI_CSI && c != '\e') { /* Backspace: Ctrl-h. */ if (c == 0x7f) From 0ef7478b5b7bfc4702005f0fb30f474e4ecfd9ff Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 10 May 2013 14:17:10 +0200 Subject: [PATCH 180/187] * grub-core/net/net.c (grub_net_open_real): Autoload network modules. --- ChangeLog | 4 +++ grub-core/net/net.c | 62 ++++++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89bcec3a0..f1667a804 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-10 Vladimir Serbinenko + + * grub-core/net/net.c (grub_net_open_real): Autoload network modules. + 2013-05-10 Vladimir Serbinenko * grub-core/term/terminfo.c: Rename ANSI_C0 to ANSI_CSI to avoid diff --git a/grub-core/net/net.c b/grub-core/net/net.c index 8ea69066b..5d2c2f0dd 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1243,6 +1243,7 @@ grub_net_open_real (const char *name) grub_net_app_level_t proto; const char *protname, *server; grub_size_t protnamelen; + int try; if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0) { @@ -1280,32 +1281,53 @@ grub_net_open_real (const char *name) return NULL; } - FOR_NET_APP_LEVEL (proto) - { - if (grub_memcmp (proto->name, protname, protnamelen) == 0 - && proto->name[protnamelen] == 0) + for (try = 0; try < 2; try++) + { + FOR_NET_APP_LEVEL (proto) { - grub_net_t ret = grub_zalloc (sizeof (*ret)); - if (!ret) - return NULL; - ret->protocol = proto; - if (server) + if (grub_memcmp (proto->name, protname, protnamelen) == 0 + && proto->name[protnamelen] == 0) { - ret->server = grub_strdup (server); - if (!ret->server) + grub_net_t ret = grub_zalloc (sizeof (*ret)); + if (!ret) + return NULL; + ret->protocol = proto; + if (server) { - grub_free (ret); - return NULL; + ret->server = grub_strdup (server); + if (!ret->server) + { + grub_free (ret); + return NULL; + } } + else + ret->server = NULL; + ret->fs = &grub_net_fs; + ret->offset = 0; + ret->eof = 0; + return ret; } - else - ret->server = NULL; - ret->fs = &grub_net_fs; - ret->offset = 0; - ret->eof = 0; - return ret; } - } + if (try == 0) + { + if (sizeof ("http") - 1 == protnamelen + && grub_memcmp ("http", protname, protnamelen) == 0) + { + grub_dl_load ("http"); + grub_errno = GRUB_ERR_NONE; + continue; + } + if (sizeof ("tftp") - 1 == protnamelen + && grub_memcmp ("tftp", protname, protnamelen) == 0) + { + grub_dl_load ("tftp"); + grub_errno = GRUB_ERR_NONE; + continue; + } + } + break; + } /* Restore original error. */ grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"), From b4c1da628261d2bb7c1398b35b3c5a3dcb18138e Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 10 May 2013 16:17:13 +0200 Subject: [PATCH 181/187] * po/POTFILES-shell.in: Autogenerate it. --- ChangeLog | 4 ++++ autogen.sh | 1 + po/POTFILES-shell.in | 21 --------------------- 3 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 po/POTFILES-shell.in diff --git a/ChangeLog b/ChangeLog index f1667a804..969f9b301 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-10 Vladimir Serbinenko + + * po/POTFILES-shell.in: Autogenerate it. + 2013-05-10 Vladimir Serbinenko * grub-core/net/net.c (grub_net_open_real): Autoload network modules. diff --git a/autogen.sh b/autogen.sh index 60ae5db8e..d63a79a22 100755 --- a/autogen.sh +++ b/autogen.sh @@ -7,6 +7,7 @@ export LC_COLLATE=C unset LC_ALL find . -iname '*.[ch]' -not -ipath './grub-core/lib/libgcrypt-grub/*' -not -ipath './build-aux/*' -not -ipath './grub-core/lib/libgcrypt/src/misc.c' -not -ipath './grub-core/lib/libgcrypt/src/global.c' -not -ipath './grub-core/lib/libgcrypt/src/secmem.c' |sort > po/POTFILES.in +find util -iname '*.in' -not -name Makefile.in |sort > po/POTFILES-shell.in autogen --version >/dev/null || exit 1 diff --git a/po/POTFILES-shell.in b/po/POTFILES-shell.in deleted file mode 100644 index 46c589f03..000000000 --- a/po/POTFILES-shell.in +++ /dev/null @@ -1,21 +0,0 @@ -util/grub.d/00_header.in -util/grub.d/10_hurd.in -util/grub.d/10_illumos.in -util/grub.d/10_kfreebsd.in -util/grub.d/10_linux.in -util/grub.d/10_netbsd.in -util/grub.d/10_windows.in -util/grub.d/20_linux_xen.in -util/grub.d/30_os-prober.in -util/grub.d/40_custom.in -util/grub.d/41_custom.in -util/grub-install.in -util/grub-kbdcomp.in -util/grub-mkconfig.in -util/grub-mkconfig_lib.in -util/grub-mknetdir.in -util/grub-mkrescue.in -util/grub-mkstandalone.in -util/grub-reboot.in -util/grub-set-default.in -util/powerpc/ieee1275/grub-mkrescue.in From f8024c3f9a0c0878df0688f19ee0dea6cf8a6962 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 10 May 2013 16:23:47 +0200 Subject: [PATCH 182/187] * util/grub-mkrescue.in: Replace `STR' with `STRING' to avoid adding yet another string (pun intended) to translate. --- ChangeLog | 5 +++++ util/grub-mkrescue.in | 4 ++-- util/grub-render-label.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 969f9b301..7263dcea6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-10 Vladimir Serbinenko + + * util/grub-mkrescue.in: Replace `STR' with `STRING' to avoid adding + yet another string (pun intended) to translate. + 2013-05-10 Vladimir Serbinenko * po/POTFILES-shell.in: Autogenerate it. diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index b942c8f7d..0adde3b65 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -65,8 +65,8 @@ usage () { print_option_help "--label-font=$filetrans" "$(gettext "use FILE as font for label")" print_option_help "--label-color=$(gettext "COLOR")" "$(gettext "use COLOR for label")" print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")" - print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")" - print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")" + print_option_help "--product-name=$(gettext "STRING")" "$(gettext "use STRING as product name")" + print_option_help "--product-version=$(gettext "STRING")" "$(gettext "use STRING as product version")" print_option_help "--sparc-boot" "$(gettext "enable sparc boot. Disables HFS+, APM, ARCS and boot as disk image for i386-pc")" print_option_help "--arcs-boot" "$(gettext "enable ARCS (big-endian mips machines, mostly SGI) boot. Disables HFS+, APM, sparc64 and boot as disk image for i386-pc")" echo diff --git a/util/grub-render-label.c b/util/grub-render-label.c index 1b28ab7db..325af6d69 100644 --- a/util/grub-render-label.c +++ b/util/grub-render-label.c @@ -54,7 +54,7 @@ static struct argp_option options[] = { N_("use COLOR for text"), 0}, {"bgcolor", 'b', N_("COLOR"), 0, N_("use COLOR for background"), 0}, - {"text", 't', N_("STR"), 0, + {"text", 't', N_("STRING"), 0, N_("set the label to render."), 0}, {"output", 'o', N_("FILE"), 0, N_("set output filename. Default is STDOUT"), 0}, From 0dc11c08d7406a51080c8530ac5cee89fc8d17e2 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 10 May 2013 16:25:36 +0200 Subject: [PATCH 183/187] * grub-core/commands/testspeed.c: Reuse formatting string to decrease new strings to translate. --- ChangeLog | 5 +++++ grub-core/commands/testspeed.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7263dcea6..f5d8fd7a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-10 Vladimir Serbinenko + + * grub-core/commands/testspeed.c: Reuse formatting string to decrease + new strings to translate. + 2013-05-10 Vladimir Serbinenko * util/grub-mkrescue.in: Replace `STR' with `STRING' to avoid adding diff --git a/grub-core/commands/testspeed.c b/grub-core/commands/testspeed.c index d45fa7c05..042645f8d 100644 --- a/grub-core/commands/testspeed.c +++ b/grub-core/commands/testspeed.c @@ -80,9 +80,9 @@ grub_cmd_testspeed (grub_extcmd_context_t ctxt, int argc, char **args) grub_printf_ (N_("File size: %s\n"), grub_get_human_size (total_size, GRUB_HUMAN_SIZE_NORMAL)); whole = grub_divmod64 (end - start, 1000, &fraction); - grub_printf_ (N_("Elapsed time: %llu.%03llu s \n"), - (unsigned long long) whole, - (unsigned long long) fraction); + grub_printf_ (N_("Elapsed time: %d.%03d s \n"), + (unsigned) whole, + (unsigned) fraction); if (end != start) { From 30b03dc22eeef3507296dbfa62fcfd12c9a3c505 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 10 May 2013 16:58:25 +0200 Subject: [PATCH 184/187] * util/grub-install.in: Handle efibootmgr presence check. Reported by: Leif Lindholm. --- ChangeLog | 5 +++++ util/grub-install.in | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5d8fd7a3..fdfa56b80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-10 Vladimir Serbinenko + + * util/grub-install.in: Handle efibootmgr presence check. + Reported by: Leif Lindholm. + 2013-05-10 Vladimir Serbinenko * grub-core/commands/testspeed.c: Reuse formatting string to decrease diff --git a/util/grub-install.in b/util/grub-install.in index 3dbd5da73..9fb0ee69b 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -754,9 +754,21 @@ elif [ x"$grub_modinfo_platform" = xefi ]; then fi # Try to make this image bootable using the EFI Boot Manager, if available. - efibootmgr="`which efibootmgr`" - if test "$removable" = no && test -n "$efi_distributor" && \ - test -n "$efibootmgr"; then + if test "$removable" = no; then + + efibootmgr="`which efibootmgr`" || { + # TRANSLATORS: This message is shown when required executable `%s' + # isn't found + gettext_printf "%s: Not found.\n" "efibootmgr" 1>&2 + exit 1 + } + + test -n "$efi_distributor" || { + gettext "EFI distributor id isn't specified." 1>&2 + echo 1>&2 + exit 1 + } + # On Linux, we need the efivars kernel modules. case "$host_os" in linux*) From 0f7e980b29612e0c231f94170b02d0dadea51248 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 10 May 2013 20:57:32 +0200 Subject: [PATCH 185/187] Redirect xasprintf to grub_xvasprintf rather than having #ifdef's for vasprintf presence. --- ChangeLog | 5 +++++ configure.ac | 2 +- grub-core/kern/emu/misc.c | 39 +++------------------------------------ include/grub/emu/misc.h | 8 -------- 4 files changed, 9 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index fdfa56b80..a57e631c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-10 Vladimir Serbinenko + + Redirect xasprintf to grub_xvasprintf rather than having #ifdef's + for vasprintf presence. + 2013-05-10 Vladimir Serbinenko * util/grub-install.in: Handle efibootmgr presence check. diff --git a/configure.ac b/configure.ac index fa0e00a12..bb4071a90 100644 --- a/configure.ac +++ b/configure.ac @@ -355,7 +355,7 @@ else fi # Check for functions and headers. -AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent) +AC_CHECK_FUNCS(posix_memalign memalign getextmntent) AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h) AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c index 21954ed50..ce338fd20 100644 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@ -145,36 +145,6 @@ xstrdup (const char *str) return newstr; } -#ifndef HAVE_VASPRINTF - -int -vasprintf (char **buf, const char *fmt, va_list ap) -{ - /* Should be large enough. */ - *buf = xmalloc (512); - - return vsnprintf (*buf, 512, fmt, ap); -} - -#endif - -#ifndef HAVE_ASPRINTF - -int -asprintf (char **buf, const char *fmt, ...) -{ - int status; - va_list ap; - - va_start (ap, fmt); - status = vasprintf (buf, fmt, ap); - va_end (ap); - - return status; -} - -#endif - char * xasprintf (const char *fmt, ...) { @@ -182,12 +152,9 @@ xasprintf (const char *fmt, ...) char *result; va_start (ap, fmt); - if (vasprintf (&result, fmt, ap) < 0) - { - if (errno == ENOMEM) - grub_util_error ("%s", _("out of memory")); - return NULL; - } + result = grub_xvasprintf (fmt, ap); + if (!result) + grub_util_error ("%s", _("out of memory")); return result; } diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 3c9f07ed3..92669f09a 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -64,14 +64,6 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format ( void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2), noreturn)); -#ifndef HAVE_VASPRINTF -int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap); -#endif - -#ifndef HAVE_ASPRINTF -int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...); -#endif - extern char * canonicalize_file_name (const char *path); #ifdef HAVE_DEVICE_MAPPER From 34b22f5cdae96c0b8944720d7ec90ae9eb46e2a0 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Sat, 11 May 2013 09:23:26 +0400 Subject: [PATCH 186/187] * docs/grub.texi (Device syntax): Clarify description of network drives. --- ChangeLog | 5 +++++ docs/grub.texi | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a57e631c9..28df32468 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-11 Andrey Borzenkov + + * docs/grub.texi (Device syntax): Clarify description of network + drives. + 2013-05-10 Vladimir Serbinenko Redirect xasprintf to grub_xvasprintf rather than having #ifdef's diff --git a/docs/grub.texi b/docs/grub.texi index 70c0de81b..75a5ea4ce 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2531,8 +2531,10 @@ of the partition when installing GRUB). (hd0,1,3) @end example -If you enabled the network support, the special drives @samp{(tftp)}, -@samp{(http)} and so on ars also available. +If you enabled the network support, the special drives +@code{(@var{protocol}[,@var{server}])} are also available. Supported protocols +are @samp{http} and @samp{tftp}. If @var{server} is omitted, value of +environment variable @samp{net_default_server} is used. Before using the network drive, you must initialize the network. @xref{Network}, for more information. From f011353675c7a15d0f84df19e0544d51f8f1eb0b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 11 May 2013 09:35:33 +0200 Subject: [PATCH 187/187] Ignore po/POTFILES-shell.in --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 1e8924bdf..e33c74de4 100644 --- a/.bzrignore +++ b/.bzrignore @@ -175,3 +175,4 @@ po/LINGUAS include/grub/gcrypt/gcrypt.h include/grub/gcrypt/g10lib.h po/POTFILES.in +po/POTFILES-shell.in