merge trunk

This commit is contained in:
Colin Watson 2011-04-21 10:36:09 +01:00
commit 2e0fbe00d2
319 changed files with 12002 additions and 1453 deletions

View file

@ -50,7 +50,7 @@ grub_script.yy.h: script/yylex.l
grub_script.yy.c: grub_script.yy.h
rs_decoder.S: $(srcdir)/lib/reed_solomon.c
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3
kern/i386/pc/startup.S: $(builddir)/rs_decoder.S
@ -303,7 +303,7 @@ platform_DATA += moddep.lst
CLEANFILES += config.log syminfo.lst moddep.lst
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT)
sh $^ $@
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
platform_DATA += $(MOD_FILES)
CLEANFILES += $(MOD_FILES)

View file

@ -200,7 +200,7 @@ program = {
ldadd = 'kernel.img$(EXEEXT)';
ldadd = '$(MODULE_FILES)';
ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
enable = emu;
};
@ -212,7 +212,7 @@ program = {
emu_nodist = symlist.c;
ldadd = 'kernel.img$(EXEEXT)';
ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
enable = emu;
};
@ -324,6 +324,7 @@ image = {
name = fwstart;
mips_yeeloong = boot/mips/yeeloong/fwstart.S;
objcopyflags = '-O binary';
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_yeeloong;
};
@ -1013,6 +1014,19 @@ module = {
common = fs/xfs.c;
};
module = {
name = zfs;
common = fs/zfs/zfs.c;
common = fs/zfs/zfs_lzjb.c;
common = fs/zfs/zfs_sha256.c;
common = fs/zfs/zfs_fletcher.c;
};
module = {
name = zfsinfo;
common = fs/zfs/zfsinfo.c;
};
module = {
name = pxe;
i386_pc = fs/i386/pc/pxe.c;
@ -1142,6 +1156,7 @@ module = {
module = {
name = linux16;
i386_pc = loader/i386/pc/linux.c;
i386_pc = lib/cmdline.c;
enable = i386_pc;
};
@ -1176,6 +1191,7 @@ module = {
mips = loader/mips/linux.c;
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
common = lib/cmdline.c;
enable = noemu;
};
@ -1454,7 +1470,6 @@ module = {
name = ieee1275_fb;
ieee1275 = video/ieee1275.c;
enable = powerpc;
enable = sparc64;
};
module = {

View file

@ -459,6 +459,8 @@ 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

View file

@ -178,8 +178,13 @@ real_code_2:
pushw %es
popw %ds
#if GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4 < 0x200
movl $0x200, %ecx
addl %ecx, %esi
#else
movl $(GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4), %ecx
addl $0x200, %esi
#endif
movl $DATA_ADDR, %edi
call LOCAL(move_memory)
@ -196,7 +201,11 @@ real_code_2:
1:
movl %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE), %ecx
#if GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4 < 0x200
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - 0x200), %ecx
#else
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - (GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4)), %ecx
#endif
2:
call LOCAL(move_memory)

View file

@ -120,7 +120,7 @@ __start:
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2
lui $a0, %hi(unimplemented_memory_type)
bne $t0, $v0, fatal
addiu $a0, $a0, %hi(unimplemented_memory_type)
addiu $a0, $a0, %lo(unimplemented_memory_type)
/* And here is our goal: DDR2 controller initialisation. */
lui $t0, %hi(GRUB_CPU_LOONGSON_CORECFG)

View file

@ -38,7 +38,7 @@ write_bases (void)
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
& GRUB_MACHINE_PCI_WIN_MASK)
>> (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
<< (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
}

View file

@ -22,6 +22,10 @@
#include <grub/time.h>
#include <grub/ata.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
int
grub_cs5536_find (grub_pci_device_t *devp)
{

View file

@ -21,6 +21,8 @@
#include <grub/pci.h>
#include <grub/mm.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* FIXME: correctly support 64-bit architectures. */
/* #if GRUB_TARGET_SIZEOF_VOID_P == 4 */
struct grub_pci_dma_chunk *
@ -90,7 +92,14 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
/* Check if there is a device present. */
if (id >> 16 == 0xFFFF)
continue;
{
if (dev.function == 0)
/* Devices are required to implement function 0, so if
it's missing then there is no device here. */
break;
else
continue;
}
#ifdef GRUB_MACHINE_MIPS_YEELOONG
/* Skip ghosts. */

View file

@ -24,6 +24,8 @@
#include <grub/usb.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
static struct grub_usb_controller_dev usb_controller =
{

View file

@ -29,6 +29,8 @@
#include <grub/cs5536.h>
#include <grub/loader.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_ohci_hcca
{
/* Pointers to Interrupt Endpoint Descriptors. Not used by

View file

@ -18,6 +18,9 @@
#include <grub/serial.h>
#include <grub/usbserial.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
void
grub_usbserial_fini (struct grub_serial_port *port)

View file

@ -24,6 +24,8 @@
#include <grub/usb.h>
#include <grub/usbserial.h>
GRUB_MOD_LICENSE ("GPLv3+");
enum
{
GRUB_FTDI_MODEM_CTRL = 0x01,

View file

@ -24,6 +24,8 @@
#include <grub/usb.h>
#include <grub/usbserial.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* Convert speed to divisor. */
static grub_uint32_t
is_speed_supported (unsigned int speed)

View file

@ -26,6 +26,8 @@
#include <grub/i386/io.h>
#include <grub/time.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_UHCI_IOMASK (0x7FF << 5)
#define N_QH 256
@ -749,8 +751,7 @@ grub_uhci_detect_dev (grub_usb_controller_t dev, int port, int *changed)
else if (port == 1)
reg = GRUB_UHCI_REG_PORTSC2;
else
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"UHCI Root Hub port does not exist");
return GRUB_USB_SPEED_NONE;
status = grub_uhci_readreg16 (u, reg);

View file

@ -24,8 +24,10 @@
#include <grub/list.h>
#include <grub/term.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_usb_controller_dev_t grub_usb_list;
struct grub_usb_attach_desc *attach_hooks;
static struct grub_usb_attach_desc *attach_hooks;
void
grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)

View file

@ -39,7 +39,7 @@ struct grub_usb_hub
grub_usb_device_t dev;
};
struct grub_usb_hub *hubs;
static struct grub_usb_hub *hubs;
/* Add a device that currently has device number 0 and resides on
CONTROLLER, the Hub reported that the device speed is SPEED. */
@ -110,7 +110,7 @@ static grub_usb_err_t
grub_usb_add_hub (grub_usb_device_t dev)
{
struct grub_usb_usb_hubdesc hubdesc;
grub_err_t err;
grub_usb_err_t err;
int i;
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN

View file

@ -97,7 +97,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
if (! transfer)
{
grub_dma_free (data_chunk);
return grub_errno;
return GRUB_USB_ERR_INTERNAL;
}
setupdata_chunk = grub_memalign_dma32 (32, sizeof (*setupdata));
@ -105,7 +105,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
{
grub_free (transfer);
grub_dma_free (data_chunk);
return grub_errno;
return GRUB_USB_ERR_INTERNAL;
}
setupdata = grub_dma_get_virt (setupdata_chunk);
@ -139,7 +139,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
grub_free (transfer);
grub_dma_free (setupdata_chunk);
grub_dma_free (data_chunk);
return grub_errno;
return GRUB_USB_ERR_INTERNAL;
}
/* Build a Setup packet. XXX: Endianness. */

View file

@ -33,6 +33,8 @@
#include <grub/efi/api.h>
#endif
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = {
{"exclude", 'x', 0,
N_("Don't load host tables specified by comma-separated list."),

View file

@ -36,6 +36,7 @@ typedef uint8_t grub_uint8_t;
#ifndef GRUB_DSDT_TEST
#include <grub/misc.h>
#include <grub/time.h>
#include <grub/cpu/io.h>
#endif
@ -324,6 +325,8 @@ grub_acpi_halt (void)
}
}
grub_millisleep (1500);
grub_printf ("ACPI shutdown failed\n");
}
#endif

View file

@ -26,6 +26,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)

View file

@ -25,6 +25,8 @@
#include <grub/mm.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t (*grub_loader_boot_func) (void);
static grub_err_t (*grub_loader_unload_func) (void);
static int grub_loader_noreturn;

View file

@ -25,6 +25,8 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{"dos", -1, 0, N_("Accept DOS-style CR/NL line endings."), 0, 0},

View file

@ -24,6 +24,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define BUFFER_SIZE 512
static grub_err_t

View file

@ -24,6 +24,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_source (grub_command_t cmd, int argc, char **args)
{

View file

@ -24,6 +24,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_DATETIME_SET_YEAR 1
#define GRUB_DATETIME_SET_MONTH 2
#define GRUB_DATETIME_SET_DAY 4

View file

@ -1,7 +1,7 @@
/* echo.c - Command to display a line of text */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
* Copyright (C) 2006,2007,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
@ -21,6 +21,9 @@
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
#include <grub/term.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
@ -43,8 +46,14 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
for (i = 0; i < argc; i++)
{
char *arg = *args;
/* Unescaping results in a string no longer than the original. */
char *unescaped = grub_malloc (grub_strlen (arg) + 1);
char *p = unescaped;
args++;
if (!unescaped)
return grub_errno;
while (*arg)
{
/* In case `-e' is used, parse backslashes. */
@ -57,11 +66,11 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
switch (*arg)
{
case '\\':
grub_printf ("\\");
*p++ = '\\';
break;
case 'a':
grub_printf ("\a");
*p++ = '\a';
break;
case 'c':
@ -69,23 +78,23 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
break;
case 'f':
grub_printf ("\f");
*p++ = '\f';
break;
case 'n':
grub_printf ("\n");
*p++ = '\n';
break;
case 'r':
grub_printf ("\r");
*p++ = '\r';
break;
case 't':
grub_printf ("\t");
*p++ = '\t';
break;
case 'v':
grub_printf ("\v");
*p++ = '\v';
break;
}
arg++;
@ -94,10 +103,14 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
/* This was not an escaped character, or escaping is not
enabled. */
grub_printf ("%c", *arg);
*p++ = *arg;
arg++;
}
*p = '\0';
grub_xputs (unescaped);
grub_free (unescaped);
/* If another argument follows, insert a space. */
if (i != argc - 1)
grub_printf (" " );
@ -106,6 +119,8 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
if (newline)
grub_printf ("\n");
grub_refresh ();
return 0;
}

View file

@ -24,6 +24,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static struct grub_video_patch
{
const char *name;

View file

@ -25,6 +25,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
static grub_efi_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;

View file

@ -23,6 +23,8 @@
#include <grub/efi/efi.h>
#include <grub/command.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define ADD_MEMORY_DESCRIPTOR(desc, size) \
((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))

View file

@ -18,12 +18,15 @@
*/
#include <grub/types.h>
#include <grub/mm.h>
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/normal.h>
#include <grub/charset.h>
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct guid_mapping
{
grub_efi_guid_t guid;

View file

@ -23,6 +23,9 @@
#include <grub/charset.h>
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
static void
disp_sal (void *table)

View file

@ -22,6 +22,9 @@
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/script_sh.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
grub_err_t
grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,

View file

@ -29,6 +29,8 @@
#include <grub/fs.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* Convert a LBA address to a CHS address in the INT 13 format. */
/* Taken from grub1. */
/* XXX: use hardcoded geometry of C = 1024, H = 255, S = 63.

View file

@ -22,6 +22,8 @@
#include <grub/misc.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),

View file

@ -26,6 +26,8 @@
#include <grub/normal.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = {
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
@ -36,7 +38,7 @@ static const struct grub_arg_option options[] = {
{0, 0, 0, 0, 0, 0}
};
struct { const char *name; const char *hashname; } aliases[] =
static struct { const char *name; const char *hashname; } aliases[] =
{
{"sha256sum", "sha256"},
{"sha512sum", "sha512"},

View file

@ -26,6 +26,8 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = {
{"apm", 'B', 0, N_("Set Advanced Power Management\n"
"(1=low, ..., 254=high, 255=off)."),

View file

@ -26,6 +26,8 @@
#include <grub/normal.h>
#include <grub/charset.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
char **args)

View file

@ -25,6 +25,8 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = {
{"skip", 's', 0, N_("Skip offset bytes from the beginning of file."), 0,
ARG_TYPE_INT},

View file

@ -21,6 +21,8 @@
#include <grub/misc.h>
#include <grub/cmos.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
parse_args (int argc, char *argv[], int *byte, int *bit)
{

View file

@ -27,6 +27,8 @@
#include <grub/i386/cpuid.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define cpuid(num,a,b,c,d) \
asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" \
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \

View file

@ -29,6 +29,7 @@
#include <grub/memory.h>
#include <grub/machine/memory.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */
static grub_uint32_t *const int13slot = UINT_TO_PTR (4 * 0x13);

View file

@ -24,6 +24,8 @@
#include <grub/machine/int.h>
#include <grub/acpi.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{"no-apm", 'n', 0, N_("Do not use APM to halt the computer."), 0, 0},

View file

@ -22,6 +22,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
int
grub_apm_get_info (struct grub_apm_info *info)
{

View file

@ -29,6 +29,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define BASE_TEMPO (60 * GRUB_TICKS_PER_SECOND)
/* The speaker port. */

View file

@ -24,6 +24,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),

View file

@ -27,6 +27,8 @@
#include <grub/cpu/io.h>
#include <grub/loader.h>
GRUB_MOD_LICENSE ("GPLv2+");
static char sendkey[0x20];
/* Length of sendkey. */
static int keylen = 0;

View file

@ -24,6 +24,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),

View file

@ -24,6 +24,8 @@
#include <grub/cpu/io.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;

View file

@ -28,6 +28,8 @@
#include <grub/i18n.h>
#include <grub/file.h>
GRUB_MOD_LICENSE ("GPLv3+");
static struct grub_keyboard_layout layout_us = {
.keyboard_map = {
/* Keyboard errors. Handled by driver. */

View file

@ -23,6 +23,8 @@
#include <grub/term.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{"shift", 's', 0, N_("Check Shift key."), 0, 0},

View file

@ -33,6 +33,8 @@
#include <grub/disk.h>
#include <grub/partition.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
legacy_file (const char *filename)
{
@ -83,9 +85,13 @@ legacy_file (const char *filename)
{
char *oldname = NULL;
char *newsuffix;
char *ptr;
for (ptr = buf; *ptr && grub_isspace (*ptr); ptr++);
oldname = entryname;
parsed = grub_legacy_parse (buf, &entryname, &newsuffix);
parsed = grub_legacy_parse (ptr, &entryname, &newsuffix);
grub_free (buf);
buf = NULL;
if (newsuffix)
{
@ -209,7 +215,7 @@ grub_cmd_legacy_source (struct grub_command *cmd,
grub_menu_t menu;
menu = grub_env_get_menu ();
if (menu && menu->size)
grub_show_menu (menu, 1);
grub_show_menu (menu, 1, 0);
if (!extractor)
grub_env_context_close ();
}
@ -765,12 +771,12 @@ GRUB_MOD_INIT(legacycfg)
= grub_register_command ("extract_legacy_entries_source",
grub_cmd_legacy_source,
N_("FILE"),
N_("Parse legacy config in same context taking onl entries"));
N_("Parse legacy config in same context taking only menu entries"));
cmd_configfile_extract
= grub_register_command ("extract_legacy_entries_configfile",
grub_cmd_legacy_source,
N_("FILE"),
N_("Parse legacy config in new context taking onl entries"));
N_("Parse legacy config in new context taking only menu entries"));
cmd_kernel = grub_register_command ("legacy_kernel",
grub_cmd_legacy_kernel,

View file

@ -28,6 +28,8 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, N_("Specify filename."), 0, ARG_TYPE_PATHNAME},

View file

@ -32,6 +32,8 @@
#include <grub/datetime.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{"long", 'l', 0, N_("Show a long list with more detailed information."), 0, 0},

View file

@ -25,6 +25,8 @@
#include <grub/i18n.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
static void
print_strn (grub_uint8_t *str, grub_size_t len)
{

View file

@ -22,6 +22,8 @@
#include <grub/i18n.h>
#include <grub/memory.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const char *names[] =
{
[GRUB_MEMORY_AVAILABLE] = "available",

View file

@ -23,6 +23,8 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_pci_classname
{
int class;

View file

@ -23,6 +23,8 @@
#include <grub/env.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;

View file

@ -29,6 +29,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* cat FILE */
static grub_err_t
grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),

View file

@ -24,6 +24,8 @@
#include <grub/command.h>
#include <grub/cs5536.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_lsspd (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),

View file

@ -31,6 +31,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv2+");
static struct grub_parttool *parts = 0;
static int curhandle = 0;
static grub_dl_t mymod;

View file

@ -26,6 +26,8 @@
#include <grub/dl.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_dl_t my_mod;
static grub_err_t

View file

@ -26,6 +26,8 @@
#include <grub/dl.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_dl_t my_mod;
struct pbkdf2_password

View file

@ -32,9 +32,11 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
{"set", 's', 0,
N_("Set a variable to return value."), "VAR", ARG_TYPE_STRING},
{"driver", 'd', 0, N_("Determine driver."), 0, 0},
{"partmap", 'p', 0, N_("Determine partition map type."), 0, 0},
@ -150,7 +152,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT (probe)
{
cmd = grub_register_extcmd ("probe", grub_cmd_probe, 0, N_("[DEVICE]"),
cmd = grub_register_extcmd ("probe", grub_cmd_probe, 0, N_("DEVICE"),
N_("Retrieve device info."), options);
}

View file

@ -26,6 +26,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static char *
grub_getline (void)
{

View file

@ -22,6 +22,8 @@
#include <grub/misc.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),

View file

@ -27,6 +27,8 @@
#include <grub/script_sh.h>
#include <regex.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{ "set", 's', GRUB_ARG_OPTION_REPEATABLE,
@ -87,7 +89,6 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
static grub_err_t
grub_cmd_regexp (grub_extcmd_context_t ctxt, int argc, char **args)
{
int argn = 0;
regex_t regex;
int ret;
grub_size_t s;

View file

@ -31,6 +31,8 @@
#include <grub/disk.h>
#include <grub/partition.h>
GRUB_MOD_LICENSE ("GPLv3+");
void
FUNC_NAME (const char *key, const char *var, int no_floppy,
char **hints, unsigned nhints)

View file

@ -27,6 +27,8 @@
#include <grub/search.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, N_("Search devices by a file."), 0, 0},

View file

@ -25,6 +25,8 @@
#include <grub/mm.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct pci_register
{
const char *name;
@ -32,7 +34,7 @@ struct pci_register
unsigned size;
};
struct pci_register pci_registers[] =
static struct pci_register pci_registers[] =
{
{"VENDOR_ID", GRUB_PCI_REG_VENDOR , 2},
{"DEVICE_ID", GRUB_PCI_REG_DEVICE , 2},

View file

@ -25,6 +25,8 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{"verbose", 'v', 0, N_("Verbose countdown."), 0, 0},

View file

@ -23,6 +23,8 @@
#include <grub/i18n.h>
#include <grub/misc.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_term_autoload *grub_term_input_autoload = NULL;
struct grub_term_autoload *grub_term_output_autoload = NULL;
@ -210,11 +212,11 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, init);
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, fini);
return handle_command (argc, args,
(struct abstract_terminal **) &grub_term_inputs,
(struct abstract_terminal **) &grub_term_inputs_disabled,
grub_term_input_autoload,
N_ ("Active input terminals:"),
N_ ("Available input terminals:"));
(struct abstract_terminal **) (void *) &grub_term_inputs,
(struct abstract_terminal **) (void *) &grub_term_inputs_disabled,
grub_term_input_autoload,
N_ ("Active input terminals:"),
N_ ("Available input terminals:"));
}
static grub_err_t
@ -225,11 +227,12 @@ grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, name);
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, init);
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, fini);
return handle_command (argc, args, (struct abstract_terminal **) &grub_term_outputs,
(struct abstract_terminal **) &grub_term_outputs_disabled,
grub_term_output_autoload,
N_ ("Active output terminals:"),
N_ ("Available output terminals:"));
return handle_command (argc, args,
(struct abstract_terminal **) (void *) &grub_term_outputs,
(struct abstract_terminal **) (void *) &grub_term_outputs_disabled,
grub_term_output_autoload,
N_ ("Active output terminals:"),
N_ ("Available output terminals:"));
}
static grub_command_t cmd_terminal_input, cmd_terminal_output;

View file

@ -27,6 +27,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* A simple implementation for signed numbers. */
static int
grub_strtosl (char *arg, char **end, int base)

View file

@ -29,6 +29,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_testload (struct grub_command *cmd __attribute__ ((unused)),
int argc, char *argv[])

View file

@ -21,6 +21,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_true (struct grub_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),

View file

@ -27,6 +27,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const char *usb_classes[] =
{
"Unknown",

View file

@ -25,6 +25,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
static unsigned height, width, depth;
static int

View file

@ -28,6 +28,8 @@
#include <grub/gfxmenu_view.h>
#include <grub/env.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)

View file

@ -266,7 +266,6 @@ match_files (const char *prefix, const char *suffix, const char *end,
const regex_t *regexp)
{
int i;
int error;
char **files;
unsigned nfile;
char *dir;
@ -440,8 +439,6 @@ wildcard_expand (const char *s, char ***strs)
else if (*start == '/') /* no device part */
{
char **r;
unsigned n;
char *root;
char *prefix;

View file

@ -34,6 +34,8 @@
#include <grub/i18n.h>
#include <grub/crypto.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* This prefix is used by xnu and boot-132 to hash
together with volume serial. */
static grub_uint8_t hash_prefix[16]

View file

@ -26,6 +26,8 @@
#include <grub/scsi.h>
#include <grub/cs5536.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* At the moment, only two IDE ports are supported. */
static const grub_port_t grub_ata_ioaddress[] = { GRUB_ATA_CH0_PORT1,
GRUB_ATA_CH1_PORT1 };

View file

@ -22,6 +22,7 @@
#include <grub/dl.h>
#include <grub/mm.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* ATA pass through support, used by hdparm.mod. */
static grub_err_t

View file

@ -24,6 +24,8 @@
#include <grub/misc.h>
#include <grub/raid.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define NV_SIGNATURES 4
#define NV_IDLE 0

View file

@ -28,6 +28,8 @@
#include <grub/err.h>
#include <grub/term.h>
GRUB_MOD_LICENSE ("GPLv3+");
static int cd_drive = 0;
static int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
@ -624,6 +626,11 @@ GRUB_MOD_INIT(biosdisk)
((cdrp->media_type & GRUB_BIOSDISK_CDTYPE_MASK)
== GRUB_BIOSDISK_CDTYPE_NO_EMUL))
cd_drive = cdrp->drive_no;
/* Since diskboot.S rejects devices over 0x90 it must be a CD booted with
cdboot.S
*/
if (grub_boot_drive >= 0x90)
cd_drive = grub_boot_drive;
grub_disk_dev_register (&grub_biosdisk_dev);
}

View file

@ -23,6 +23,8 @@
#include <grub/dl.h>
#include <grub/ieee1275/ieee1275.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_nand_data
{
grub_ieee1275_ihandle_t handle;

View file

@ -62,11 +62,10 @@ ofdisk_hash_find (const char *devpath)
}
static struct ofdisk_hash_ent *
ofdisk_hash_add (char *devpath)
ofdisk_hash_add_real (char *devpath)
{
struct ofdisk_hash_ent *p;
struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)];
struct ofdisk_hash_ent *p, *pcan;
char *curcan;
p = grub_malloc(sizeof (*p));
if (!p)
@ -76,17 +75,27 @@ ofdisk_hash_add (char *devpath)
p->next = *head;
p->shortest = 0;
*head = p;
return p;
}
static struct ofdisk_hash_ent *
ofdisk_hash_add (char *devpath, char *curcan)
{
struct ofdisk_hash_ent *p, *pcan;
p = ofdisk_hash_add_real (devpath);
grub_dprintf ("disk", "devpath = %s, canonical = %s\n", devpath, curcan);
curcan = grub_ieee1275_canonicalise_devname (devpath);
if (!curcan)
{
grub_errno = GRUB_ERR_NONE;
p->shortest = devpath;
return p;
}
pcan = ofdisk_hash_find (curcan);
if (!pcan)
pcan = ofdisk_hash_add (curcan);
pcan = ofdisk_hash_add_real (curcan);
else
grub_free (curcan);
@ -118,17 +127,22 @@ scan (void)
return 0;
grub_dprintf ("disk", "disk name = %s\n", alias->name);
grub_dprintf ("disk", "disk name = %s, path = %s\n", alias->name,
alias->path);
op = ofdisk_hash_find (alias->path);
op = ofdisk_hash_find (alias->name);
if (!op)
{
char *name = grub_strdup (alias->name);
if (!name)
char *can = grub_strdup (alias->path);
if (!name || !can)
{
grub_errno = GRUB_ERR_NONE;
grub_free (name);
grub_free (can);
return 0;
}
op = ofdisk_hash_add (name);
op = ofdisk_hash_add (name, can);
}
return 0;
}
@ -247,7 +261,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
struct ofdisk_hash_ent *op;
op = ofdisk_hash_find (devpath);
if (!op)
op = ofdisk_hash_add (devpath);
op = ofdisk_hash_add (devpath, NULL);
else
grub_free (devpath);
if (!op)

View file

@ -25,6 +25,8 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_loopback
{
char *devname;
@ -97,10 +99,6 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args)
if (newdev)
{
char *newname = grub_strdup (args[1]);
if (! newname)
goto fail;
grub_file_close (newdev->file);
newdev->file = file;
@ -166,7 +164,7 @@ grub_loopback_open (const char *name, grub_disk_t disk)
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
disk->id = (unsigned long) dev;
disk->data = dev->file;
disk->data = dev;
return 0;
}
@ -175,7 +173,7 @@ static grub_err_t
grub_loopback_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
grub_file_t file = (grub_file_t) disk->data;
grub_file_t file = ((struct grub_loopback *) disk->data)->file;
grub_off_t pos;
grub_file_seek (file, sector << GRUB_DISK_SECTOR_BITS);
@ -222,7 +220,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(loopback)
{
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback, 0,
N_("[-d|-p] DEVICENAME FILE."),
N_("[-d] DEVICENAME FILE."),
N_("Make a device of a file."), options);
grub_disk_dev_register (&grub_loopback_dev);
}

View file

@ -28,6 +28,8 @@
#include <grub/emu/misc.h>
#endif
GRUB_MOD_LICENSE ("GPLv3+");
static struct grub_lvm_vg *vg_list;
static int lv_count;
@ -45,6 +47,7 @@ grub_lvm_getvalue (char **p, char *str)
return grub_strtoul (*p, NULL, 10);
}
#if 0
static int
grub_lvm_checkvalue (char **p, char *str, char *tmpl)
{
@ -57,6 +60,7 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl)
return 0;
return (grub_memcmp (*p + 1, tmpl, tmpllen) == 0 && (*p)[tmpllen + 1] == '"');
}
#endif
static int
grub_lvm_check_flag (char *p, char *str, char *flag)
@ -100,7 +104,7 @@ grub_lvm_iterate (int (*hook) (const char *name))
struct grub_lvm_lv *lv;
if (vg->lvs)
for (lv = vg->lvs; lv; lv = lv->next)
if (hook (lv->name))
if (lv->visible && hook (lv->name))
return 1;
}
@ -164,18 +168,45 @@ grub_lvm_close (grub_disk_t disk __attribute ((unused)))
}
static grub_err_t
grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
grub_size_t size, char *buf);
static grub_err_t
read_node (const struct grub_lvm_node *node, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
/* Check whether we actually know the physical volume we want to
read from. */
if (node->pv)
{
if (node->pv->disk)
return grub_disk_read (node->pv->disk, sector + node->pv->start, 0,
size << GRUB_DISK_SECTOR_BITS, buf);
else
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"physical volume %s not found", node->pv->name);
}
if (node->lv)
return read_lv (node->lv, sector, size, buf);
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name);
}
static grub_err_t
read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
grub_err_t err = 0;
struct grub_lvm_lv *lv = disk->data;
struct grub_lvm_vg *vg = lv->vg;
struct grub_lvm_segment *seg = lv->segments;
struct grub_lvm_pv *pv;
struct grub_lvm_node *node;
grub_uint64_t offset;
grub_uint64_t extent;
unsigned int i;
if (!lv)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown volume");
extent = grub_divmod64 (sector, vg->extent_size, NULL);
/* Find the right segment. */
@ -190,59 +221,75 @@ grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
seg++;
}
if (seg->stripe_count == 1)
if (i == lv->segment_count)
return grub_error (GRUB_ERR_READ_ERROR, "incorrect segment");
switch (seg->type)
{
/* This segment is linear, so that's easy. We just need to find
out the offset in the physical volume and read SIZE bytes
from that. */
struct grub_lvm_stripe *stripe = seg->stripes;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
case GRUB_LVM_STRIPED:
if (seg->node_count == 1)
{
/* This segment is linear, so that's easy. We just need to find
out the offset in the physical volume and read SIZE bytes
from that. */
struct grub_lvm_node *stripe = seg->nodes;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
pv = stripe->pv;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size) + pv->start;
node = stripe;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size);
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size) + seg_offset;
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size) + seg_offset;
}
else
{
/* This is a striped segment. We have to find the right PV
similar to RAID0. */
struct grub_lvm_node *stripe = seg->nodes;
grub_uint32_t a, b;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
unsigned int stripenr;
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size);
a = grub_divmod64 (offset, seg->stripe_size, NULL);
grub_divmod64 (a, seg->node_count, &stripenr);
a = grub_divmod64 (offset, seg->stripe_size * seg->node_count, NULL);
grub_divmod64 (offset, seg->stripe_size, &b);
offset = a * seg->stripe_size + b;
stripe += stripenr;
node = stripe;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size);
offset += seg_offset;
}
return read_node (node, offset, size, buf);
case GRUB_LVM_MIRROR:
i = 0;
while (1)
{
err = read_node (&seg->nodes[i], sector, size, buf);
if (!err)
return err;
if (++i >= seg->node_count)
return err;
grub_errno = GRUB_ERR_NONE;
}
}
else
{
/* This is a striped segment. We have to find the right PV
similar to RAID0. */
struct grub_lvm_stripe *stripe = seg->stripes;
grub_uint32_t a, b;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
unsigned int stripenr;
return grub_error (GRUB_ERR_IO, "unknown LVM segment");
}
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size);
a = grub_divmod64 (offset, seg->stripe_size, NULL);
grub_divmod64 (a, seg->stripe_count, &stripenr);
a = grub_divmod64 (offset, seg->stripe_size * seg->stripe_count, NULL);
grub_divmod64 (offset, seg->stripe_size, &b);
offset = a * seg->stripe_size + b;
stripe += stripenr;
pv = stripe->pv;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size) + pv->start;
offset += seg_offset;
}
/* Check whether we actually know the physical volume we want to
read from. */
if (pv->disk)
err = grub_disk_read (pv->disk, offset, 0,
size << GRUB_DISK_SECTOR_BITS, buf);
else
err = grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"physical volume %s not found", pv->name);
return err;
static grub_err_t
grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
return read_lv (disk->data, sector, size, buf);
}
static grub_err_t
@ -303,7 +350,7 @@ grub_lvm_scan_device (const char *name)
if (i == GRUB_LVM_LABEL_SCAN_SECTORS)
{
#ifdef GRUB_UTIL
grub_util_info ("no LVM signature found\n");
grub_util_info ("no LVM signature found");
#endif
goto fail;
}
@ -511,6 +558,7 @@ grub_lvm_scan_device (const char *name)
int skip_lv = 0;
struct grub_lvm_lv *lv;
struct grub_lvm_segment *seg;
int is_pvmove;
while (grub_isspace (*p))
p++;
@ -533,11 +581,8 @@ grub_lvm_scan_device (const char *name)
lv->size = 0;
if (!grub_lvm_check_flag (p, "status", "VISIBLE"))
{
skip_lv = 1;
goto lv_parsed;
}
lv->visible = grub_lvm_check_flag (p, "status", "VISIBLE");
is_pvmove = grub_lvm_check_flag (p, "status", "PVMOVE");
lv->segment_count = grub_lvm_getvalue (&p, "segment_count = ");
if (p == NULL)
@ -552,7 +597,6 @@ grub_lvm_scan_device (const char *name)
for (i = 0; i < lv->segment_count; i++)
{
struct grub_lvm_stripe *stripe;
p = grub_strstr (p, "segment");
if (p == NULL)
@ -580,90 +624,147 @@ grub_lvm_scan_device (const char *name)
goto lvs_segment_fail;
}
if (grub_lvm_checkvalue (&p, "type = ", "snapshot"))
{
/* Found a snapshot, give up and move on. */
skip_lv = 1;
break;
}
seg->stripe_count = grub_lvm_getvalue (&p, "stripe_count = ");
p = grub_strstr (p, "type = \"");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripe_count\n");
#endif
goto lvs_segment_fail;
}
goto lvs_segment_fail;
p += sizeof("type = \"") - 1;
lv->size += seg->extent_count * vg->extent_size;
if (seg->stripe_count != 1)
seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
if (grub_memcmp (p, "striped\"",
sizeof ("striped\"") - 1) == 0)
{
struct grub_lvm_node *stripe;
seg->stripes = grub_malloc (sizeof (*stripe)
* seg->stripe_count);
stripe = seg->stripes;
seg->type = GRUB_LVM_STRIPED;
seg->node_count = grub_lvm_getvalue (&p, "stripe_count = ");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripe_count\n");
#endif
goto lvs_segment_fail;
}
p = grub_strstr (p, "stripes = [");
if (p == NULL)
if (seg->node_count != 1)
seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
seg->nodes = grub_zalloc (sizeof (*stripe)
* seg->node_count);
stripe = seg->nodes;
p = grub_strstr (p, "stripes = [");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripes\n");
#endif
goto lvs_segment_fail2;
}
p += sizeof("stripes = [") - 1;
for (j = 0; j < seg->node_count; j++)
{
p = grub_strchr (p, '"');
if (p == NULL)
continue;
q = ++p;
while (*q != '"')
q++;
s = q - p;
stripe->name = grub_malloc (s + 1);
if (stripe->name == NULL)
goto lvs_segment_fail2;
grub_memcpy (stripe->name, p, s);
stripe->name[s] = '\0';
stripe->start = grub_lvm_getvalue (&p, ",");
if (p == NULL)
continue;
stripe++;
}
}
else if (grub_memcmp (p, "mirror\"", sizeof ("mirror\"") - 1)
== 0)
{
seg->type = GRUB_LVM_MIRROR;
seg->node_count = grub_lvm_getvalue (&p, "mirror_count = ");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown mirror_count\n");
#endif
goto lvs_segment_fail;
}
seg->nodes = grub_zalloc (sizeof (seg->nodes[0])
* seg->node_count);
p = grub_strstr (p, "mirrors = [");
if (p == NULL)
{
#ifdef GRUB_UTIL
grub_util_info ("unknown mirrors\n");
#endif
goto lvs_segment_fail2;
}
p += sizeof("mirrors = [") - 1;
for (j = 0; j < seg->node_count; j++)
{
char *lvname;
p = grub_strchr (p, '"');
if (p == NULL)
continue;
q = ++p;
while (*q != '"')
q++;
s = q - p;
lvname = grub_malloc (s + 1);
if (lvname == NULL)
goto lvs_segment_fail2;
grub_memcpy (lvname, p, s);
lvname[s] = '\0';
seg->nodes[j].name = lvname;
p = q + 1;
}
/* Only first (original) is ok with in progress pvmove. */
if (is_pvmove)
seg->node_count = 1;
}
else
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripes\n");
char *p2;
p2 = grub_strchr (p, '"');
if (p2)
*p2 = 0;
grub_util_info ("unknown LVM type %s\n", p);
if (p2)
*p2 ='"';
#endif
goto lvs_segment_fail2;
}
p += sizeof("stripes = [") - 1;
for (j = 0; j < seg->stripe_count; j++)
{
char *pvname;
p = grub_strchr (p, '"');
if (p == NULL)
continue;
q = ++p;
while (*q != '"')
q++;
s = q - p;
pvname = grub_malloc (s + 1);
if (pvname == NULL)
goto lvs_segment_fail2;
grub_memcpy (pvname, p, s);
pvname[s] = '\0';
if (vg->pvs)
for (pv = vg->pvs; pv; pv = pv->next)
{
if (! grub_strcmp (pvname, pv->name))
{
stripe->pv = pv;
break;
}
}
grub_free(pvname);
stripe->start = grub_lvm_getvalue (&p, ",");
if (p == NULL)
continue;
stripe++;
/* Found a non-supported type, give up and move on. */
skip_lv = 1;
break;
}
seg++;
continue;
lvs_segment_fail2:
grub_free (seg->stripes);
grub_free (seg->nodes);
lvs_segment_fail:
goto fail4;
}
lv_parsed:
if (p != NULL)
p = grub_strchr (p, '}');
if (p == NULL)
@ -690,6 +791,33 @@ grub_lvm_scan_device (const char *name)
}
}
/* Match lvs. */
{
struct grub_lvm_lv *lv1;
struct grub_lvm_lv *lv2;
for (lv1 = vg->lvs; lv1; lv1 = lv1->next)
for (i = 0; i < lv1->segment_count; i++)
for (j = 0; j < lv1->segments[i].node_count; j++)
{
if (vg->pvs)
for (pv = vg->pvs; pv; pv = pv->next)
{
if (! grub_strcmp (pv->name,
lv1->segments[i].nodes[j].name))
{
lv1->segments[i].nodes[j].pv = pv;
break;
}
}
if (lv1->segments[i].nodes[j].pv == NULL)
for (lv2 = vg->lvs; lv2; lv2 = lv2->next)
if (grub_strcmp (lv2->name + grub_strlen (vg->name) + 1,
lv1->segments[i].nodes[j].name) == 0)
lv1->segments[i].nodes[j].lv = lv2;
}
}
vg->next = vg_list;
vg_list = vg;
}
@ -728,6 +856,7 @@ grub_lvm_scan_device (const char *name)
grub_disk_close (disk);
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_errno = GRUB_ERR_NONE;
grub_print_error ();
return 0;
}

View file

@ -24,6 +24,8 @@
#include <grub/misc.h>
#include <grub/raid.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* Linux RAID on disk structures and constants,
copied from include/linux/raid/md_p.h. */
@ -110,7 +112,6 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
struct grub_raid_super_1x sb;
grub_uint8_t minor_version;
/* The sector where the mdraid 0.90 superblock is stored, if available. */
size = grub_disk_get_size (disk);
/* Check for an 1.x superblock.
@ -143,24 +144,28 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
&sb))
return grub_errno;
if (sb.magic != SB_MAGIC)
if (grub_le_to_cpu32 (sb.magic) != SB_MAGIC
|| grub_le_to_cpu64 (sb.super_offset) != sector)
continue;
{
grub_uint64_t sb_size;
struct grub_raid_super_1x *real_sb;
grub_uint32_t level;
if (sb.major_version != 1)
if (grub_le_to_cpu32 (sb.major_version) != 1)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID version: %d",
sb.major_version);
grub_le_to_cpu32 (sb.major_version));
level = grub_le_to_cpu32 (sb.level);
/* Multipath. */
if ((int) sb.level == -4)
sb.level = 1;
if ((int) level == -4)
level = 1;
if (sb.level != 0 && sb.level != 1 && sb.level != 4 &&
sb.level != 5 && sb.level != 6 && sb.level != 10)
if (level != 0 && level != 1 && level != 4 &&
level != 5 && level != 6 && level != 10)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID level: %d", sb.level);
@ -189,16 +194,22 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
array->level = grub_le_to_cpu32 (real_sb->level);
array->layout = grub_le_to_cpu32 (real_sb->layout);
array->total_devs = grub_le_to_cpu32 (real_sb->raid_disks);
array->disk_size = grub_le_to_cpu64 (real_sb->size);
if (real_sb->size)
array->disk_size = grub_le_to_cpu64 (real_sb->size);
else
array->disk_size = grub_le_to_cpu64 (real_sb->data_size);
array->chunk_size = grub_le_to_cpu32 (real_sb->chunksize);
if (grub_le_to_cpu32 (real_sb->dev_number) >=
grub_le_to_cpu32 (real_sb->max_dev))
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
array->index = grub_le_to_cpu16
(real_sb->dev_roles[grub_le_to_cpu32 (real_sb->dev_number)]);
if (array->index >= array->total_devs)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
array->uuid_len = 16;
array->uuid = grub_malloc (16);
if (!array->uuid)
@ -209,7 +220,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
grub_memcpy (array->uuid, real_sb->set_uuid, 16);
*start_sector = real_sb->data_offset;
*start_sector = grub_le_to_cpu64 (real_sb->data_offset);
grub_free (real_sb);
return 0;

View file

@ -27,6 +27,8 @@
/* Linux RAID on disk structures and constants,
copied from include/linux/raid/md_p.h. */
GRUB_MOD_LICENSE ("GPLv3+");
#define RESERVED_BYTES (64 * 1024)
#define RESERVED_SECTORS (RESERVED_BYTES / 512)
@ -167,6 +169,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
grub_uint64_t size;
struct grub_raid_super_09 sb;
grub_uint32_t *uuid;
grub_uint32_t level;
/* The sector where the mdraid 0.90 superblock is stored, if available. */
size = grub_disk_get_size (disk);
@ -178,36 +181,40 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
return grub_errno;
/* Look whether there is a mdraid 0.90 superblock. */
if (sb.md_magic != SB_MAGIC)
if (grub_le_to_cpu32 (sb.md_magic) != SB_MAGIC)
return grub_error (GRUB_ERR_OUT_OF_RANGE, "not 0.9x raid");
if (sb.major_version != 0 || sb.minor_version != 90)
if (grub_le_to_cpu32 (sb.major_version) != 0
|| grub_le_to_cpu32 (sb.minor_version) != 90)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"unsupported RAID version: %d.%d",
sb.major_version, sb.minor_version);
grub_le_to_cpu32 (sb.major_version),
grub_le_to_cpu32 (sb.minor_version));
/* FIXME: Check the checksum. */
level = grub_le_to_cpu32 (sb.level);
/* Multipath. */
if ((int) sb.level == -4)
sb.level = 1;
if ((int) level == -4)
level = 1;
if (sb.level != 0 && sb.level != 1 && sb.level != 4 &&
sb.level != 5 && sb.level != 6 && sb.level != 10)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"unsupported RAID level: %d", sb.level);
if (sb.this_disk.number == 0xffff || sb.this_disk.number == 0xfffe)
if (level != 0 && level != 1 && level != 4 &&
level != 5 && level != 6 && level != 10)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"unsupported RAID level: %d", level);
if (grub_le_to_cpu32 (sb.this_disk.number) == 0xffff
|| grub_le_to_cpu32 (sb.this_disk.number) == 0xfffe)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
array->name = NULL;
array->number = sb.md_minor;
array->level = sb.level;
array->layout = sb.layout;
array->total_devs = sb.raid_disks;
array->disk_size = (sb.size) ? sb.size * 2 : sector;
array->chunk_size = sb.chunk_size >> 9;
array->index = sb.this_disk.number;
array->number = grub_le_to_cpu32 (sb.md_minor);
array->level = level;
array->layout = grub_le_to_cpu32 (sb.layout);
array->total_devs = grub_le_to_cpu32 (sb.raid_disks);
array->disk_size = (sb.size) ? grub_le_to_cpu32 (sb.size) * 2 : sector;
array->chunk_size = grub_le_to_cpu32 (sb.chunk_size) >> 9;
array->index = grub_le_to_cpu32 (sb.this_disk.number);
array->uuid_len = 16;
array->uuid = grub_malloc (16);
if (!array->uuid)

View file

@ -24,6 +24,8 @@
#include <grub/mm.h>
#include <grub/types.h>
GRUB_MOD_LICENSE ("GPLv3+");
static char *memdisk_addr;
static grub_off_t memdisk_size = 0;

View file

@ -23,6 +23,11 @@
#include <grub/err.h>
#include <grub/misc.h>
#include <grub/raid.h>
#ifdef GRUB_UTIL
#include <grub/util/misc.h>
#endif
GRUB_MOD_LICENSE ("GPLv3+");
/* Linked list of RAID arrays. */
static struct grub_raid_array *array_list;
@ -117,18 +122,49 @@ grub_raid_getname (struct grub_disk *disk)
}
#endif
static inline int
ascii2hex (char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return 0;
}
static grub_err_t
grub_raid_open (const char *name, grub_disk_t disk)
{
struct grub_raid_array *array;
unsigned n;
for (array = array_list; array != NULL; array = array->next)
if (grub_memcmp (name, "mduuid/", sizeof ("mduuid/") - 1) == 0)
{
if (!grub_strcmp (array->name, name))
if (grub_is_array_readable (array))
break;
const char *uuidstr = name + sizeof ("mduuid/") - 1;
grub_size_t uuid_len = grub_strlen (uuidstr) / 2;
grub_uint8_t uuidbin[uuid_len];
unsigned i;
for (i = 0; i < uuid_len; i++)
uuidbin[i] = ascii2hex (uuidstr[2 * i + 1])
| (ascii2hex (uuidstr[2 * i]) << 4);
for (array = array_list; array != NULL; array = array->next)
{
if (uuid_len == (unsigned) array->uuid_len
&& grub_memcmp (uuidbin, array->uuid, uuid_len) == 0)
if (grub_is_array_readable (array))
break;
}
}
else
for (array = array_list; array != NULL; array = array->next)
{
if (!grub_strcmp (array->name, name))
if (grub_is_array_readable (array))
break;
}
if (!array)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown RAID device %s",
@ -522,14 +558,16 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
/* We found more members of the array than the array
actually has according to its superblock. This shouldn't
happen normally. */
grub_dprintf ("raid", "array->nr_devs > array->total_devs (%d)?!?",
array->total_devs);
return grub_error (GRUB_ERR_BAD_DEVICE,
"superfluous RAID member (%d found)",
array->total_devs);
if (array->members[new_array->index].device != NULL)
/* We found multiple devices with the same number. Again,
this shouldn't happen. */
grub_dprintf ("raid", "Found two disks with the number %d?!?",
new_array->number);
return grub_error (GRUB_ERR_BAD_DEVICE,
"found two disks with the index %d for RAID %s",
new_array->index, array->name);
if (new_array->disk_size < array->disk_size)
array->disk_size = new_array->disk_size;
@ -568,7 +606,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
{
for (p = array_list; p != NULL; p = p->next)
{
if (! p->name && p->number == array->number)
if (p->number == array->number)
break;
}
}
@ -636,6 +674,10 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
grub_dprintf ("raid", "Found array %s (%s)\n", array->name,
scanner_name);
#ifdef GRUB_UTIL
grub_util_info ("Found array %s (%s)", array->name,
scanner_name);
#endif
/* Add our new array to the list. */
array->next = array_list;
@ -694,7 +736,12 @@ grub_raid_register (grub_raid_t raid)
struct grub_raid_array array;
grub_disk_addr_t start_sector;
grub_dprintf ("raid", "Scanning for RAID devices on disk %s\n", name);
grub_dprintf ("raid", "Scanning for %s RAID devices on disk %s\n",
grub_raid_list->name, name);
#ifdef GRUB_UTIL
grub_util_info ("Scanning for %s RAID devices on disk %s",
grub_raid_list->name, name);
#endif
disk = grub_disk_open (name);
if (!disk)

View file

@ -24,6 +24,8 @@
#include <grub/misc.h>
#include <grub/raid.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_raid5_recover (struct grub_raid_array *array, int disknr,
char *buf, grub_disk_addr_t sector, int size)
@ -45,7 +47,9 @@ grub_raid5_recover (struct grub_raid_array *array, int disknr,
if (i == disknr)
continue;
err = grub_disk_read (array->members[i].device, sector, 0, size, buf2);
err = grub_disk_read (array->members[i].device,
array->members[i].start_sector + sector,
0, size, buf2);
if (err)
{

View file

@ -24,6 +24,8 @@
#include <grub/misc.h>
#include <grub/raid.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_uint8_t raid6_table1[256][256];
static grub_uint8_t raid6_table2[256][256];
@ -119,7 +121,8 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
else
{
if ((array->members[pos].device) &&
(! grub_disk_read (array->members[pos].device, sector,
(! grub_disk_read (array->members[pos].device,
array->members[i].start_sector + sector,
0, size, buf)))
{
grub_raid_block_xor (pbuf, buf, size);
@ -150,7 +153,9 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
{
/* One bad device */
if ((array->members[p].device) &&
(! grub_disk_read (array->members[p].device, sector, 0, size, buf)))
(! grub_disk_read (array->members[p].device,
array->members[i].start_sector + sector,
0, size, buf)))
{
grub_raid_block_xor (buf, pbuf, size);
goto quit;
@ -163,7 +168,8 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
}
grub_errno = GRUB_ERR_NONE;
if (grub_disk_read (array->members[q].device, sector, 0, size, buf))
if (grub_disk_read (array->members[q].device,
array->members[i].start_sector + sector, 0, size, buf))
goto quit;
grub_raid_block_xor (buf, qbuf, size);
@ -181,12 +187,16 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
goto quit;
}
if (grub_disk_read (array->members[p].device, sector, 0, size, buf))
if (grub_disk_read (array->members[p].device,
array->members[i].start_sector + sector,
0, size, buf))
goto quit;
grub_raid_block_xor (pbuf, buf, size);
if (grub_disk_read (array->members[q].device, sector, 0, size, buf))
if (grub_disk_read (array->members[q].device,
array->members[i].start_sector + sector,
0, size, buf))
goto quit;
grub_raid_block_xor (qbuf, buf, size);

View file

@ -27,6 +27,8 @@
#include <grub/scsicmd.h>
#include <grub/time.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_scsi_dev_t grub_scsi_dev_list;
@ -506,7 +508,7 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
if (scsi->blocksize != GRUB_DISK_SECTOR_SIZE)
{
unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS;
if (! (spb != 0 && (scsi->blocksize & GRUB_DISK_SECTOR_SIZE) == 0))
if (spb == 0 || (scsi->blocksize & (GRUB_DISK_SECTOR_SIZE - 1)) != 0)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"unsupported SCSI block size");

View file

@ -24,6 +24,8 @@
#include <grub/scsicmd.h>
#include <grub/misc.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_USBMS_DIRECTION_BIT 7
/* The USB Mass Storage Command Block Wrapper. */
@ -70,7 +72,11 @@ static int first_available_slot = 0;
static grub_err_t
grub_usbms_reset (grub_usb_device_t dev, int interface)
{
return grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
grub_usb_err_t u;
u = grub_usb_control_msg (dev, 0x21, 255, 0, interface, 0, 0);
if (u)
return grub_error (GRUB_ERR_IO, "USB error %d", u);
return GRUB_ERR_NONE;
}
static void
@ -408,7 +414,7 @@ static struct grub_scsi_dev grub_usbms_dev =
.write = grub_usbms_write
};
struct grub_usb_attach_desc attach_hook =
static struct grub_usb_attach_desc attach_hook =
{
.class = GRUB_USB_CLASS_MASS_STORAGE,
.hook = grub_usbms_attach

View file

@ -24,7 +24,7 @@
#include <grub/acpi.h>
grub_err_t
grub_machine_efiemu_init_tables ()
grub_machine_efiemu_init_tables (void)
{
grub_uint8_t *ptr;
void *table;

View file

@ -32,6 +32,8 @@
#include <grub/command.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* System table. Two version depending on mode */
grub_efi_system_table32_t *grub_efiemu_system_table32 = 0;
grub_efi_system_table64_t *grub_efiemu_system_table64 = 0;

View file

@ -30,6 +30,8 @@
#include <grub/unicode.h>
#include <grub/fontformat.h>
GRUB_MOD_LICENSE ("GPLv3+");
#ifdef USE_ASCII_FAILBACK
#include "ascii.h"
#endif

View file

@ -26,6 +26,8 @@
#include <grub/types.h>
#include <grub/fshelp.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* The affs bootblock. */
struct grub_affs_bblock
{
@ -208,7 +210,7 @@ grub_affs_mount (grub_disk_t disk)
rblock = (struct grub_affs_rblock *) rootblock;
/* Read the rootblock. */
grub_disk_read (disk, (disk->total_sectors >> 1) + blocksize, 0,
grub_disk_read (disk, grub_be_to_cpu32 (data->bblock.rootblock), 0,
GRUB_DISK_SECTOR_SIZE * 16, rootblock);
if (grub_errno)
goto fail;
@ -240,7 +242,7 @@ grub_affs_mount (grub_disk_t disk)
data->disk = disk;
data->htsize = grub_be_to_cpu32 (rblock->htsize);
data->diropen.data = data;
data->diropen.block = (disk->total_sectors >> 1);
data->diropen.block = grub_be_to_cpu32 (data->bblock.rootblock);
grub_free (rootblock);
@ -507,7 +509,7 @@ grub_affs_label (grub_device_t device, char **label)
{
/* The rootblock maps quite well on a file header block, it's
something we can use here. */
grub_disk_read (data->disk, disk->total_sectors >> 1,
grub_disk_read (data->disk, grub_be_to_cpu32 (data->bblock.rootblock),
data->blocksize * (GRUB_DISK_SECTOR_SIZE
- GRUB_AFFS_FILE_LOCATION),
sizeof (file), &file);
@ -535,6 +537,9 @@ static struct grub_fs grub_affs_fs =
.read = grub_affs_read,
.close = grub_affs_close,
.label = grub_affs_label,
#ifdef GRUB_UTIL
.reserved_first_sector = 0,
#endif
.next = 0
};

View file

@ -26,6 +26,8 @@
#include <grub/types.h>
#include <grub/fshelp.h>
GRUB_MOD_LICENSE ("GPLv3+");
#ifdef MODE_BIGENDIAN
#define GRUB_AFS_FSNAME_SUFFIX "_be"
#else

Some files were not shown because too many files have changed in this diff Show more