Merge mainline.

This commit is contained in:
Manoel Rebelo Abranches 2011-05-05 12:12:22 -03:00
commit 90eb90e24c
263 changed files with 5295 additions and 865 deletions

26
include/grub/deflate.h Normal file
View file

@ -0,0 +1,26 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_DEFLATE_HEADER
#define GRUB_DEFLATE_HEADER 1
grub_ssize_t
grub_zlib_decompress (char *inbuf, grub_size_t insize, grub_off_t off,
char *outbuf, grub_size_t outsize);
#endif

View file

@ -21,15 +21,18 @@
#define GRUB_DL_H 1
#include <grub/symbol.h>
#ifndef ASM_FILE
#include <grub/err.h>
#include <grub/types.h>
#include <grub/elf.h>
#endif
/*
* Macros GRUB_MOD_INIT and GRUB_MOD_FINI are also used by build rules
* to collect module names, so we define them only when they are not
* defined already.
*/
#ifndef ASM_FILE
#ifndef GRUB_MOD_INIT
#define GRUB_MOD_INIT(name) \
@ -63,8 +66,52 @@ __asm__ (".section .modname\n.asciz \"" #name "\"\n")
#define GRUB_MOD_DEP(name) \
__asm__ (".section .moddeps\n.asciz \"" #name "\"\n")
#endif
#endif
#ifndef ASM_FILE
#ifdef APPLE_CC
#define GRUB_MOD_SECTION(x) "_" #x ", _" #x ""
#else
#define GRUB_MOD_SECTION(x) "." #x
#endif
#else
#ifdef APPLE_CC
#define GRUB_MOD_SECTION(x) _ ## x , _ ##x
#else
#define GRUB_MOD_SECTION(x) . ## x
#endif
#endif
/* 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
multi-licensed under other licences as well) independently of the
presence of this check and solely by linking (module loading in GRUB
constitutes linking) and GRUB core being licensed under GPLv3+.
Be sure to understand your license obligations.
*/
#ifndef ASM_FILE
#define GRUB_MOD_LICENSE(license) \
static char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), used)) = "LICENSE=" license;
#else
#define GRUB_MOD_LICENSE(license) \
.section GRUB_MOD_SECTION(module_license), "a"; \
.ascii "LICENSE="; \
.ascii license; \
.byte 0
#endif
/* Under GPL license obligations you have to distribute your module
under GPLv3(+). However, you can also distribute the same code under
another license as long as GPLv3(+) version is provided.
*/
#define GRUB_MOD_DUAL_LICENSE(x)
#ifndef ASM_FILE
struct grub_dl_segment
{
struct grub_dl_segment *next;
@ -119,4 +166,6 @@ grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
void grub_arch_dl_init_linker (void);
#endif
#endif
#endif /* ! GRUB_DL_H */

View file

@ -21,6 +21,7 @@
#include <grub/efi/api.h>
#include <grub/file.h>
#include <grub/memory.h>
#define GRUB_EFIEMU_PAGESIZE 4096
@ -227,9 +228,7 @@ grub_efiemu_finish_boot_services (grub_efi_uintn_t *memory_map_size,
grub_efi_uint32_t *descriptor_version);
grub_err_t
grub_efiemu_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t));
grub_efiemu_mmap_iterate (grub_memory_hook_t hook);
int grub_efiemu_sizeof_uintn_t (void);
grub_err_t
grub_efiemu_get_lower_upper_memory (grub_uint64_t *lower, grub_uint64_t *upper);

View file

@ -28,5 +28,6 @@ char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
int grub_util_biosdisk_is_present (const char *name);
int grub_util_biosdisk_is_floppy (grub_disk_t disk);
grub_err_t grub_util_biosdisk_flush (struct grub_disk *disk);
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */

View file

@ -78,4 +78,6 @@ extern char * canonicalize_file_name (const char *path);
int grub_device_mapper_supported (void);
#endif
char *grub_find_root_device_from_mountinfo (const char *dir, char **relroot);
#endif /* GRUB_EMU_MISC_H */

View file

@ -59,7 +59,8 @@ typedef enum
GRUB_ERR_NET_BAD_ADDRESS,
GRUB_ERR_NET_ROUTE_LOOP,
GRUB_ERR_NET_NO_ROUTE,
GRUB_ERR_WAIT
GRUB_ERR_WAIT,
GRUB_ERR_BUG
}
grub_err_t;

View file

@ -31,9 +31,9 @@ struct grub_file;
struct grub_dirhook_info
{
int dir:1;
int mtimeset:1;
int case_insensitive:1;
unsigned dir:1;
unsigned mtimeset:1;
unsigned case_insensitive:1;
grub_int32_t mtime;
};

View file

@ -36,6 +36,7 @@ struct grub_gfxmenu_box
void (*draw) (grub_gfxmenu_box_t self, int x, int y);
void (*set_content_size) (grub_gfxmenu_box_t self,
int width, int height);
int (*get_border_width) (grub_gfxmenu_box_t self);
int (*get_left_pad) (grub_gfxmenu_box_t self);
int (*get_top_pad) (grub_gfxmenu_box_t self);
int (*get_right_pad) (grub_gfxmenu_box_t self);

25
include/grub/lib/crc.h Normal file
View file

@ -0,0 +1,25 @@
/* crc.h - prototypes for crc */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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 <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CRC_H
#define GRUB_CRC_H 1
grub_uint32_t grub_getcrc32c (grub_uint32_t crc, const void *buf, int size);
#endif /* ! GRUB_CRC_H */

View file

@ -60,21 +60,16 @@ struct grub_lvm_segment {
unsigned int extent_count;
enum { GRUB_LVM_STRIPED, GRUB_LVM_MIRROR } type;
unsigned int mirror_count;
struct grub_lvm_mirror *mirrors;
unsigned int node_count;
struct grub_lvm_node *nodes;
unsigned int stripe_count;
unsigned int stripe_size;
struct grub_lvm_stripe *stripes; /* Pointer to stripe_count stripes. */
};
struct grub_lvm_stripe {
int start;
struct grub_lvm_node {
grub_disk_addr_t start;
char *name;
struct grub_lvm_pv *pv;
};
struct grub_lvm_mirror {
char *lvname;
struct grub_lvm_lv *lv;
};

View file

@ -287,8 +287,20 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) __attribute__ ((warn_unused_result));
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint32_t d, grub_uint32_t *r);
grub_uint64_t EXPORT_FUNC(grub_divmod64_full) (grub_uint64_t n,
grub_uint64_t d,
grub_uint64_t *r);
static inline grub_uint64_t grub_divmod64 (grub_uint64_t n,
grub_uint32_t d,
grub_uint32_t *r)
{
grub_uint64_t ret, rr;
ret = grub_divmod64_full (n, d, &rr);
if (r)
*r = rr;
return ret;
}
#if NEED_ENABLE_EXECUTE_STACK && !defined(GRUB_UTIL)
void EXPORT_FUNC(__enable_execute_stack) (void *addr);

View file

@ -51,7 +51,7 @@ extern int grub_normal_exit_level;
/* Defined in `main.c'. */
void grub_enter_normal_mode (const char *config);
void grub_normal_execute (const char *config, int nested, int batch);
void grub_menu_init_page (int nested, int edit,
void grub_menu_init_page (int nested, int edit, int *num_entries,
struct grub_term_output *term);
void grub_normal_init_page (struct grub_term_output *term);
char *grub_file_getline (grub_file_t file);
@ -80,6 +80,11 @@ grub_print_ucs4 (const grub_uint32_t * str,
const grub_uint32_t * last_position,
int margin_left, int margin_right,
struct grub_term_output *term);
int
grub_ucs4_count_lines (const grub_uint32_t * str,
const grub_uint32_t * last_position,
int margin_left, int margin_right,
struct grub_term_output *term);
grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
const grub_uint32_t * last_position,
struct grub_term_output *term);

View file

@ -38,9 +38,9 @@
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
/* The size of the first region which won't be compressed. */
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xca4
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xcd0
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x70c
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x730
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE

View file

@ -140,9 +140,6 @@ grub_term_color_state;
/* The X position of the left border. */
#define GRUB_TERM_LEFT_BORDER_X GRUB_TERM_MARGIN
/* The number of lines of messages at the bottom. */
#define GRUB_TERM_MESSAGE_HEIGHT 8
/* The Y position of the first entry. */
#define GRUB_TERM_FIRST_ENTRY_Y (GRUB_TERM_TOP_BORDER_Y + 1)
@ -339,29 +336,6 @@ grub_term_entry_width (struct grub_term_output *term)
return grub_term_border_width (term) - 2 - GRUB_TERM_MARGIN * 2 - 1;
}
/* The height of the border. */
static inline unsigned
grub_term_border_height (struct grub_term_output *term)
{
return grub_term_height (term) - GRUB_TERM_TOP_BORDER_Y
- GRUB_TERM_MESSAGE_HEIGHT;
}
/* The number of entries shown at a time. */
static inline int
grub_term_num_entries (struct grub_term_output *term)
{
return grub_term_border_height (term) - 2;
}
static inline int
grub_term_cursor_x (struct grub_term_output *term)
{
return (GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (term)
- GRUB_TERM_MARGIN - 1);
}
static inline grub_uint16_t
grub_term_getxy (struct grub_term_output *term)
{

View file

@ -21,7 +21,7 @@
#define GRUB_RAID_UTIL_HEADER 1
#ifdef __linux__
char** grub_util_raid_getmembers (char *name);
char** grub_util_raid_getmembers (const char *name);
#endif
#endif /* ! GRUB_RAID_UTIL_HEADER */