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

View file

@ -906,6 +906,7 @@ module = {
module = {
name = btrfs;
common = fs/btrfs.c;
common = lib/crc.c;
};
module = {

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

@ -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 *

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

View file

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

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

@ -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

@ -23,6 +23,8 @@
#include <grub/i18n.h>
#include <grub/term.h>
GRUB_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] =
{
{0, 'n', 0, N_("Do not output the trailing newline."), 0, 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},

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)
{

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

@ -33,6 +33,8 @@
#include <grub/i18n.h>
#include <grub/net.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,

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;

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;

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

@ -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);

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

@ -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);

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;
@ -165,6 +167,31 @@ grub_lvm_close (grub_disk_t disk __attribute ((unused)))
return;
}
static grub_err_t
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)
@ -172,7 +199,7 @@ read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
grub_err_t err = 0;
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;
@ -200,17 +227,17 @@ read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
switch (seg->type)
{
case GRUB_LVM_STRIPED:
if (seg->stripe_count == 1)
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_stripe *stripe = seg->stripes;
struct grub_lvm_node *stripe = seg->nodes;
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
pv = stripe->pv;
node = stripe;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size) + pv->start;
* (grub_uint64_t) vg->extent_size);
offset = sector - ((grub_uint64_t) seg->start_extent
* (grub_uint64_t) vg->extent_size) + seg_offset;
@ -219,7 +246,7 @@ read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
{
/* This is a striped segment. We have to find the right PV
similar to RAID0. */
struct grub_lvm_stripe *stripe = seg->stripes;
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;
@ -228,42 +255,29 @@ read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
* (grub_uint64_t) vg->extent_size);
a = grub_divmod64 (offset, seg->stripe_size, NULL);
grub_divmod64 (a, seg->stripe_count, &stripenr);
grub_divmod64 (a, seg->node_count, &stripenr);
a = grub_divmod64 (offset, seg->stripe_size * seg->stripe_count, NULL);
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;
pv = stripe->pv;
node = stripe;
seg_offset = ((grub_uint64_t) stripe->start
* (grub_uint64_t) vg->extent_size) + pv->start;
* (grub_uint64_t) vg->extent_size);
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;
return read_node (node, offset, size, buf);
case GRUB_LVM_MIRROR:
i = 0;
while (1)
{
if (!seg->mirrors[i].lv)
err = grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown volume '%s'",
seg->mirrors[i].lvname);
else
err = read_lv (seg->mirrors[i].lv, sector, size, buf);
err = read_node (&seg->nodes[i], sector, size, buf);
if (!err)
return err;
if (++i >= seg->mirror_count)
if (++i >= seg->node_count)
return err;
grub_errno = GRUB_ERR_NONE;
}
@ -544,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++;
@ -567,6 +582,7 @@ grub_lvm_scan_device (const char *name)
lv->size = 0;
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)
@ -618,10 +634,10 @@ grub_lvm_scan_device (const char *name)
if (grub_memcmp (p, "striped\"",
sizeof ("striped\"") - 1) == 0)
{
struct grub_lvm_stripe *stripe;
struct grub_lvm_node *stripe;
seg->type = GRUB_LVM_STRIPED;
seg->stripe_count = grub_lvm_getvalue (&p, "stripe_count = ");
seg->node_count = grub_lvm_getvalue (&p, "stripe_count = ");
if (p == NULL)
{
#ifdef GRUB_UTIL
@ -630,12 +646,12 @@ grub_lvm_scan_device (const char *name)
goto lvs_segment_fail;
}
if (seg->stripe_count != 1)
if (seg->node_count != 1)
seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
seg->stripes = grub_malloc (sizeof (*stripe)
* seg->stripe_count);
stripe = seg->stripes;
seg->nodes = grub_zalloc (sizeof (*stripe)
* seg->node_count);
stripe = seg->nodes;
p = grub_strstr (p, "stripes = [");
if (p == NULL)
@ -647,10 +663,8 @@ grub_lvm_scan_device (const char *name)
}
p += sizeof("stripes = [") - 1;
for (j = 0; j < seg->stripe_count; j++)
for (j = 0; j < seg->node_count; j++)
{
char *pvname;
p = grub_strchr (p, '"');
if (p == NULL)
continue;
@ -660,24 +674,12 @@ grub_lvm_scan_device (const char *name)
s = q - p;
pvname = grub_malloc (s + 1);
if (pvname == NULL)
stripe->name = grub_malloc (s + 1);
if (stripe->name == 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);
grub_memcpy (stripe->name, p, s);
stripe->name[s] = '\0';
stripe->start = grub_lvm_getvalue (&p, ",");
if (p == NULL)
@ -690,7 +692,7 @@ grub_lvm_scan_device (const char *name)
== 0)
{
seg->type = GRUB_LVM_MIRROR;
seg->mirror_count = grub_lvm_getvalue (&p, "mirror_count = ");
seg->node_count = grub_lvm_getvalue (&p, "mirror_count = ");
if (p == NULL)
{
#ifdef GRUB_UTIL
@ -699,8 +701,8 @@ grub_lvm_scan_device (const char *name)
goto lvs_segment_fail;
}
seg->mirrors = grub_zalloc (sizeof (seg->mirrors[0])
* seg->mirror_count);
seg->nodes = grub_zalloc (sizeof (seg->nodes[0])
* seg->node_count);
p = grub_strstr (p, "mirrors = [");
if (p == NULL)
@ -712,7 +714,7 @@ grub_lvm_scan_device (const char *name)
}
p += sizeof("mirrors = [") - 1;
for (j = 0; j < seg->mirror_count; j++)
for (j = 0; j < seg->node_count; j++)
{
char *lvname;
@ -731,9 +733,12 @@ grub_lvm_scan_device (const char *name)
grub_memcpy (lvname, p, s);
lvname[s] = '\0';
seg->mirrors[j].lvname = lvname;
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
{
@ -755,7 +760,7 @@ grub_lvm_scan_device (const char *name)
continue;
lvs_segment_fail2:
grub_free (seg->stripes);
grub_free (seg->nodes);
lvs_segment_fail:
goto fail4;
}
@ -786,18 +791,31 @@ grub_lvm_scan_device (const char *name)
}
}
/* Match mirrors */
/* 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++)
if (lv1->segments[i].type == GRUB_LVM_MIRROR)
for (j = 0; j < lv1->segments[i].mirror_count; j++)
for (lv2 = vg->lvs; lv2; lv2 = lv2->next)
if (grub_strcmp (lv2->name + grub_strlen (vg->name) + 1,
lv1->segments[i].mirrors[j].lvname) == 0)
lv1->segments[i].mirrors[j].lv = lv2;
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;
@ -838,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. */
@ -200,11 +202,14 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
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)

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)
@ -202,7 +204,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
"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_NOT_IMPLEMENTED_YET,
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"spares aren't implemented");
array->name = NULL;
@ -219,10 +221,10 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
return grub_errno;
uuid = (grub_uint32_t *) array->uuid;
uuid[0] = sb.set_uuid0;
uuid[1] = sb.set_uuid1;
uuid[2] = sb.set_uuid2;
uuid[3] = sb.set_uuid3;
uuid[0] = grub_swap_bytes32 (sb.set_uuid0);
uuid[1] = grub_swap_bytes32 (sb.set_uuid1);
uuid[2] = grub_swap_bytes32 (sb.set_uuid2);
uuid[3] = grub_swap_bytes32 (sb.set_uuid3);
*start_sector = 0;

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",

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)

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];

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;

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. */

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;
@ -191,7 +193,7 @@ grub_efiemu_load_file (const char *filename)
file = grub_file_open (filename);
if (! file)
return 0;
return grub_errno;
err = grub_efiemu_mm_init ();
if (err)

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
{

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

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,8 @@
#include <grub/disk.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
#ifndef MODE_USTAR
/* cpio support */
#define MAGIC_BCPIO 070707

View file

@ -51,6 +51,8 @@
#include <grub/types.h>
#include <grub/fshelp.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* Log2 size of ext2 block in 512 blocks. */
#define LOG2_EXT2_BLOCK_SIZE(data) \
(grub_le_to_cpu32 (data->sblock.log2_block_size) + 1)

View file

@ -27,6 +27,8 @@
#include <grub/dl.h>
#include <grub/charset.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_FAT_DIR_ENTRY_SIZE 32
#define GRUB_FAT_ATTR_READ_ONLY 0x01

View file

@ -22,7 +22,9 @@
#include <grub/misc.h>
#include <grub/disk.h>
#include <grub/fshelp.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
/* Lookup the node PATH. The node ROOTNODE describes the root of the
directory tree. The node found is returned in FOUNDNODE, which is

View file

@ -29,6 +29,8 @@
#include <grub/types.h>
#include <grub/hfs.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_HFS_SBLOCK 2
#define GRUB_HFS_EMBED_HFSPLUS_SIG 0x482B

View file

@ -30,6 +30,8 @@
#include <grub/hfs.h>
#include <grub/charset.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_HFSPLUS_MAGIC 0x482B
#define GRUB_HFSPLUSX_MAGIC 0x4858
#define GRUB_HFSPLUS_SBLOCK 2

View file

@ -28,6 +28,8 @@
#include <grub/fshelp.h>
#include <grub/charset.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_ISO9660_FSTYPE_DIR 0040000
#define GRUB_ISO9660_FSTYPE_REG 0100000
#define GRUB_ISO9660_FSTYPE_SYMLINK 0120000

View file

@ -26,6 +26,8 @@
#include <grub/types.h>
#include <grub/charset.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_JFS_MAX_SYMLNK_CNT 8
#define GRUB_JFS_FILETYPE_MASK 0170000
#define GRUB_JFS_FILETYPE_REG 0100000
@ -217,12 +219,12 @@ struct grub_jfs_diropen
struct grub_jfs_tree_dir header;
struct grub_jfs_leaf_dirent dirent[0];
struct grub_jfs_leaf_next_dirent next_dirent[0];
char sorted[0];
grub_uint8_t sorted[0];
} *dirpage __attribute__ ((packed));
struct grub_jfs_data *data;
struct grub_jfs_inode *inode;
int count;
char *sorted;
grub_uint8_t *sorted;
struct grub_jfs_leaf_dirent *leaf;
struct grub_jfs_leaf_next_dirent *next_leaf;
@ -234,13 +236,13 @@ struct grub_jfs_diropen
static grub_dl_t my_mod;
static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino);
static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino);
/* Get the block number for the block BLK in the node INODE in the
mounted filesystem DATA. */
static int
static grub_int64_t
grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode,
unsigned int blk)
grub_uint64_t blk)
{
auto int getblk (struct grub_jfs_treehead *treehead,
struct grub_jfs_tree_extent *extents);
@ -294,15 +296,15 @@ grub_jfs_blkno (struct grub_jfs_data *data, struct grub_jfs_inode *inode,
static grub_err_t
grub_jfs_read_inode (struct grub_jfs_data *data, int ino,
grub_jfs_read_inode (struct grub_jfs_data *data, grub_uint32_t ino,
struct grub_jfs_inode *inode)
{
struct grub_jfs_iag iag;
int iagnum = ino / 4096;
int inoext = (ino % 4096) / 32;
int inonum = (ino % 4096) % 32;
grub_uint32_t iagblk;
grub_uint32_t inoblk;
grub_uint32_t iagnum = ino / 4096;
unsigned inoext = (ino % 4096) / 32;
unsigned inonum = (ino % 4096) % 32;
grub_uint64_t iagblk;
grub_uint64_t inoblk;
iagblk = grub_jfs_blkno (data, &data->fileset, iagnum + 1);
if (grub_errno)
@ -348,6 +350,13 @@ grub_jfs_mount (grub_disk_t disk)
goto fail;
}
if (grub_le_to_cpu32 (data->sblock.blksz)
!= (1U << grub_le_to_cpu16 (data->sblock.log2_blksz)))
{
grub_error (GRUB_ERR_BAD_FS, "not a JFS filesystem");
goto fail;
}
data->disk = disk;
data->pos = 0;
data->linknest = 0;
@ -374,7 +383,7 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode)
{
struct grub_jfs_internal_dirent *de;
struct grub_jfs_diropen *diro;
int blk;
grub_disk_addr_t blk;
de = (struct grub_jfs_internal_dirent *) inode->dir.dirents;
@ -397,7 +406,7 @@ grub_jfs_opendir (struct grub_jfs_data *data, struct grub_jfs_inode *inode)
{
diro->leaf = inode->dir.dirents;
diro->next_leaf = (struct grub_jfs_leaf_next_dirent *) de;
diro->sorted = (char *) (inode->dir.header.sorted);
diro->sorted = inode->dir.header.sorted;
diro->count = inode->dir.header.count;
return diro;
@ -475,7 +484,7 @@ grub_jfs_getent (struct grub_jfs_diropen *diro)
/* The last node, read in more. */
if (diro->index == diro->count)
{
unsigned int next;
grub_disk_addr_t next;
/* If the inode contains the entry tree or if this was the last
node, there is nothing to read. */
@ -499,7 +508,7 @@ grub_jfs_getent (struct grub_jfs_diropen *diro)
diro->index = 0;
}
leaf = &diro->leaf[(int) diro->sorted[diro->index]];
leaf = &diro->leaf[diro->sorted[diro->index]];
next_leaf = &diro->next_leaf[diro->index];
len = leaf->len;
@ -540,21 +549,21 @@ static grub_ssize_t
grub_jfs_read_file (struct grub_jfs_data *data,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset, unsigned length),
int pos, grub_size_t len, char *buf)
grub_uint64_t pos, grub_size_t len, char *buf)
{
int i;
int blockcnt;
grub_uint64_t i;
grub_uint64_t blockcnt;
blockcnt = ((len + pos + grub_le_to_cpu32 (data->sblock.blksz) - 1)
/ grub_le_to_cpu32 (data->sblock.blksz));
blockcnt = (len + pos + grub_le_to_cpu32 (data->sblock.blksz) - 1)
>> grub_le_to_cpu16 (data->sblock.log2_blksz);
for (i = pos / grub_le_to_cpu32 (data->sblock.blksz); i < blockcnt; i++)
for (i = pos >> grub_le_to_cpu16 (data->sblock.log2_blksz); i < blockcnt; i++)
{
int blknr;
int blockoff = pos % grub_le_to_cpu32 (data->sblock.blksz);
int blockend = grub_le_to_cpu32 (data->sblock.blksz);
grub_disk_addr_t blknr;
grub_uint32_t blockoff = pos & (grub_le_to_cpu32 (data->sblock.blksz) - 1);
grub_uint32_t blockend = grub_le_to_cpu32 (data->sblock.blksz);
int skipfirst = 0;
grub_uint64_t skipfirst = 0;
blknr = grub_jfs_blkno (data, &data->currinode, i);
if (grub_errno)
@ -563,14 +572,14 @@ grub_jfs_read_file (struct grub_jfs_data *data,
/* Last block. */
if (i == blockcnt - 1)
{
blockend = (len + pos) % grub_le_to_cpu32 (data->sblock.blksz);
blockend = (len + pos) & (grub_le_to_cpu32 (data->sblock.blksz) - 1);
if (!blockend)
blockend = grub_le_to_cpu32 (data->sblock.blksz);
}
/* First block. */
if (i == (pos / (int) grub_le_to_cpu32 (data->sblock.blksz)))
if (i == (pos >> grub_le_to_cpu16 (data->sblock.log2_blksz)))
{
skipfirst = blockoff;
blockend -= skipfirst;
@ -642,8 +651,8 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
pathname. */
if (!grub_strcmp (name, diro->name))
{
int ino = diro->ino;
int dirino = grub_le_to_cpu32 (data->currinode.inode);
grub_uint32_t ino = diro->ino;
grub_uint32_t dirino = grub_le_to_cpu32 (data->currinode.inode);
grub_jfs_closedir (diro);
diro = 0;
@ -687,9 +696,9 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path)
static grub_err_t
grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino)
grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
{
int size = grub_le_to_cpu64 (data->currinode.size);
grub_uint64_t size = grub_le_to_cpu64 (data->currinode.size);
char symlink[size + 1];
if (++data->linknest > GRUB_JFS_MAX_SYMLNK_CNT)

View file

@ -25,6 +25,8 @@
#include <grub/dl.h>
#include <grub/types.h>
GRUB_MOD_LICENSE ("GPLv3+");
#ifdef MODE_MINIX2
#define GRUB_MINIX_MAGIC 0x2468
#define GRUB_MINIX_MAGIC_30 0x2478

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