merge mainline into butter
This commit is contained in:
commit
c7ba1ba62e
94 changed files with 4056 additions and 789 deletions
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -749,8 +749,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);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <grub/term.h>
|
||||
|
||||
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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -36,7 +36,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"},
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
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 +150,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,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},
|
||||
|
|
|
@ -97,10 +97,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 +162,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 +171,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 +218,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);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,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 +58,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 +102,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 +166,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 +219,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 +348,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 +556,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 +579,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 +595,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 +622,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 +789,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 +854,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,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.
|
||||
|
@ -193,16 +192,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)
|
||||
|
|
|
@ -202,7 +202,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;
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/raid.h>
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/util/misc.h>
|
||||
#endif
|
||||
|
||||
/* Linked list of RAID arrays. */
|
||||
static struct grub_raid_array *array_list;
|
||||
|
@ -638,6 +641,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;
|
||||
|
@ -696,7 +703,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)
|
||||
|
|
|
@ -70,7 +70,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 +412,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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -555,7 +555,7 @@ grub_ext2_read_inode (struct grub_ext2_data *data,
|
|||
|
||||
/* Read the inode. */
|
||||
if (grub_disk_read (data->disk,
|
||||
((grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno)
|
||||
(((grub_disk_addr_t) grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno)
|
||||
<< LOG2_EXT2_BLOCK_SIZE (data)),
|
||||
EXT2_INODE_SIZE (data) * blkoff,
|
||||
sizeof (struct grub_ext2_inode), inode))
|
||||
|
|
|
@ -481,7 +481,7 @@ parse_dhcp_vendor (void *vend, int limit)
|
|||
break;
|
||||
|
||||
/* If you need any other options please contact GRUB
|
||||
developpement team. */
|
||||
development team. */
|
||||
}
|
||||
|
||||
ptr += taglength;
|
||||
|
|
|
@ -808,6 +808,15 @@ grub_iso9660_label (grub_device_t device, char **label)
|
|||
((grub_uint16_t *) &data->voldesc.volname, 16);
|
||||
else
|
||||
*label = grub_strndup ((char *) data->voldesc.volname, 32);
|
||||
if (*label)
|
||||
{
|
||||
char *ptr;
|
||||
for (ptr = *label; *ptr;ptr++);
|
||||
ptr--;
|
||||
while (ptr >= *label && *ptr == ' ')
|
||||
*ptr-- = 0;
|
||||
}
|
||||
|
||||
grub_free (data);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -217,12 +217,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 +234,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 +294,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 +348,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 +381,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 +404,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 +482,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 +506,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 +547,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 +570,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 +649,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 +694,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)
|
||||
|
|
|
@ -161,7 +161,7 @@ struct grub_zfs_data
|
|||
grub_disk_addr_t vdev_phys_sector;
|
||||
};
|
||||
|
||||
decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = {
|
||||
static decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = {
|
||||
{"inherit", NULL}, /* ZIO_COMPRESS_INHERIT */
|
||||
{"on", lzjb_decompress}, /* ZIO_COMPRESS_ON */
|
||||
{"off", NULL}, /* ZIO_COMPRESS_OFF */
|
||||
|
@ -201,7 +201,7 @@ zio_checksum_off (const void *buf __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
/* Checksum Table and Values */
|
||||
zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
|
||||
static zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
|
||||
{NULL, 0, 0, "inherit"},
|
||||
{NULL, 0, 0, "on"},
|
||||
{zio_checksum_off, 0, 0, "off"},
|
||||
|
@ -837,14 +837,12 @@ zap_leaf_lookup (zap_leaf_phys_t * l, grub_zfs_endian_t endian,
|
|||
name))
|
||||
{
|
||||
struct zap_leaf_array *la;
|
||||
grub_uint8_t *ip;
|
||||
|
||||
if (le->le_int_size != 8 || le->le_value_length != 1)
|
||||
return grub_error (GRUB_ERR_BAD_FS, "invalid leaf chunk entry");
|
||||
|
||||
/* get the uint64_t property value */
|
||||
la = &ZAP_LEAF_CHUNK (l, blksft, le->le_value_chunk).l_array;
|
||||
ip = la->la_array;
|
||||
|
||||
*value = grub_be_to_cpu64 (la->la_array64);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ struct grub_gettext_msg
|
|||
const char *translated;
|
||||
};
|
||||
|
||||
struct grub_gettext_msg *grub_gettext_msg_list = NULL;
|
||||
static struct grub_gettext_msg *grub_gettext_msg_list = NULL;
|
||||
|
||||
#define GETTEXT_MAGIC_NUMBER 0
|
||||
#define GETTEXT_FILE_FORMAT 4
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <grub/gfxmenu_view.h>
|
||||
#include <grub/time.h>
|
||||
|
||||
grub_gfxmenu_view_t cached_view;
|
||||
static grub_gfxmenu_view_t cached_view;
|
||||
|
||||
static void
|
||||
grub_gfxmenu_viewer_fini (void *data __attribute__ ((unused)))
|
||||
|
@ -56,30 +56,15 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
|
|||
|
||||
theme_path = grub_env_get ("theme");
|
||||
if (! theme_path)
|
||||
{
|
||||
grub_error_push ();
|
||||
grub_gfxterm_fullscreen ();
|
||||
grub_error_pop ();
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
|
||||
}
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
|
||||
|
||||
instance = grub_zalloc (sizeof (*instance));
|
||||
if (!instance)
|
||||
{
|
||||
grub_error_push ();
|
||||
grub_gfxterm_fullscreen ();
|
||||
grub_error_pop ();
|
||||
return grub_errno;
|
||||
}
|
||||
return grub_errno;
|
||||
|
||||
err = grub_video_get_info (&mode_info);
|
||||
if (err)
|
||||
{
|
||||
grub_error_push ();
|
||||
grub_gfxterm_fullscreen ();
|
||||
grub_error_pop ();
|
||||
return err;
|
||||
}
|
||||
return err;
|
||||
|
||||
if (!cached_view || grub_strcmp (cached_view->theme_path, theme_path) != 0
|
||||
|| cached_view->screen.width != mode_info.width
|
||||
|
@ -94,9 +79,6 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
|
|||
if (! cached_view)
|
||||
{
|
||||
grub_free (instance);
|
||||
grub_error_push ();
|
||||
grub_gfxterm_fullscreen ();
|
||||
grub_error_pop ();
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
|
|
@ -935,7 +935,7 @@ weak_alias (__argp_parse, argp_parse)
|
|||
void *
|
||||
__argp_input (const struct argp *argp, const struct argp_state *state)
|
||||
{
|
||||
if (state)
|
||||
if (state && state->pstate)
|
||||
{
|
||||
struct group *group;
|
||||
struct parser *parser = state->pstate;
|
||||
|
|
|
@ -178,7 +178,7 @@ grub_find_root_device_from_mountinfo (const char *dir, char **relroot)
|
|||
static char *
|
||||
find_root_device_from_libzfs (const char *dir)
|
||||
{
|
||||
char *device;
|
||||
char *device = NULL;
|
||||
char *poolname;
|
||||
char *poolfs;
|
||||
|
||||
|
@ -219,7 +219,10 @@ find_root_device_from_libzfs (const char *dir)
|
|||
|
||||
struct stat st;
|
||||
if (stat (device, &st) == 0)
|
||||
break;
|
||||
{
|
||||
device = xstrdup (device);
|
||||
break;
|
||||
}
|
||||
|
||||
device = NULL;
|
||||
}
|
||||
|
@ -811,12 +814,30 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (mdadm_name)
|
||||
{
|
||||
char *newname;
|
||||
const char *q;
|
||||
|
||||
for (q = os_dev + strlen (os_dev) - 1; q >= os_dev
|
||||
&& grub_isdigit (*q); q--);
|
||||
|
||||
if (q >= os_dev && *q == 'p')
|
||||
{
|
||||
newname = xasprintf ("/dev/md/%sp%s", mdadm_name, q + 1);
|
||||
if (stat (newname, &st) == 0)
|
||||
{
|
||||
free (grub_dev);
|
||||
grub_dev = xasprintf ("md/%s,%s", mdadm_name, q + 1);
|
||||
goto done;
|
||||
}
|
||||
free (newname);
|
||||
}
|
||||
newname = xasprintf ("/dev/md/%s", mdadm_name);
|
||||
if (stat (newname, &st) == 0)
|
||||
{
|
||||
free (grub_dev);
|
||||
grub_dev = xasprintf ("md/%s", mdadm_name);
|
||||
}
|
||||
|
||||
done:
|
||||
free (newname);
|
||||
free (mdadm_name);
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ struct hd_geometry
|
|||
# include <sys/disk.h> /* DIOCGMEDIASIZE */
|
||||
# include <sys/param.h>
|
||||
# include <sys/sysctl.h>
|
||||
# define MAJOR(dev) major(dev)
|
||||
# define FLOPPY_MAJOR 2
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
@ -102,7 +104,9 @@ struct hd_geometry
|
|||
# include <libdevmapper.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#include <libgeom.h>
|
||||
#elif defined(__NetBSD__)
|
||||
# define HAVE_DIOCGDINFO
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/disklabel.h> /* struct disklabel */
|
||||
|
@ -134,6 +138,7 @@ struct grub_util_biosdisk_data
|
|||
char *dev;
|
||||
int access_mode;
|
||||
int fd;
|
||||
int is_disk;
|
||||
};
|
||||
|
||||
#ifdef __linux__
|
||||
|
@ -235,6 +240,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
data->dev = NULL;
|
||||
data->access_mode = 0;
|
||||
data->fd = -1;
|
||||
data->is_disk = 0;
|
||||
|
||||
/* Get the size. */
|
||||
#if defined(__MINGW32__)
|
||||
|
@ -275,6 +281,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
close (fd);
|
||||
goto fail;
|
||||
}
|
||||
data->is_disk = 1;
|
||||
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (ioctl (fd, DIOCGMEDIASIZE, &nr))
|
||||
|
@ -337,7 +344,68 @@ device_is_mapped (const char *dev)
|
|||
}
|
||||
#endif /* HAVE_DEVICE_MAPPER */
|
||||
|
||||
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO)
|
||||
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
/* FIXME: geom actually gives us the whole container hierarchy.
|
||||
It can be used more efficiently than this. */
|
||||
static void
|
||||
follow_geom_up (const char *name, grub_disk_addr_t *off_out, char **name_out)
|
||||
{
|
||||
struct gmesh mesh;
|
||||
struct gclass *class;
|
||||
int error;
|
||||
struct ggeom *geom;
|
||||
|
||||
grub_util_info ("following geom '%s'", name);
|
||||
|
||||
error = geom_gettree (&mesh);
|
||||
if (error != 0)
|
||||
grub_util_error ("couldn't open geom");
|
||||
|
||||
LIST_FOREACH (class, &mesh.lg_class, lg_class)
|
||||
if (strcasecmp (class->lg_name, "part") == 0)
|
||||
break;
|
||||
if (!class)
|
||||
grub_util_error ("couldn't open geom part");
|
||||
|
||||
LIST_FOREACH (geom, &class->lg_geom, lg_geom)
|
||||
{
|
||||
struct gprovider *provider;
|
||||
LIST_FOREACH (provider, &geom->lg_provider, lg_provider)
|
||||
if (strcmp (provider->lg_name, name) == 0)
|
||||
{
|
||||
char *name_tmp = xstrdup (geom->lg_name);
|
||||
grub_disk_addr_t off = 0;
|
||||
struct gconfig *config;
|
||||
grub_util_info ("geom '%s' has parent '%s'", name, geom->lg_name);
|
||||
|
||||
follow_geom_up (name_tmp, &off, name_out);
|
||||
free (name_tmp);
|
||||
LIST_FOREACH (config, &provider->lg_config, lg_config)
|
||||
if (strcasecmp (config->lg_name, "start") == 0)
|
||||
off += strtoull (config->lg_val, 0, 10);
|
||||
if (off_out)
|
||||
*off_out = off;
|
||||
return;
|
||||
}
|
||||
}
|
||||
grub_util_info ("geom '%s' has no parent", name);
|
||||
if (name_out)
|
||||
*name_out = xstrdup (name);
|
||||
if (off_out)
|
||||
*off_out = 0;
|
||||
}
|
||||
|
||||
static grub_disk_addr_t
|
||||
find_partition_start (const char *dev)
|
||||
{
|
||||
grub_disk_addr_t out;
|
||||
if (strncmp (dev, "/dev/", sizeof ("/dev/") - 1) != 0)
|
||||
return 0;
|
||||
follow_geom_up (dev + sizeof ("/dev/") - 1, &out, NULL);
|
||||
|
||||
return out;
|
||||
}
|
||||
#elif defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO)
|
||||
static grub_disk_addr_t
|
||||
find_partition_start (const char *dev)
|
||||
{
|
||||
|
@ -453,9 +521,12 @@ devmapper_fail:
|
|||
# if !defined(HAVE_DIOCGDINFO)
|
||||
return hdg.start;
|
||||
# else /* defined(HAVE_DIOCGDINFO) */
|
||||
p_index = dev[strlen(dev) - 1] - 'a';
|
||||
|
||||
if (p_index >= label.d_npartitions)
|
||||
if (dev[0])
|
||||
p_index = dev[strlen(dev) - 1] - 'a';
|
||||
else
|
||||
p_index = -1;
|
||||
|
||||
if (p_index >= label.d_npartitions || p_index < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE,
|
||||
"no disk label entry for `%s'", dev);
|
||||
|
@ -596,7 +667,18 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
|
|||
{
|
||||
free (data->dev);
|
||||
if (data->fd != -1)
|
||||
close (data->fd);
|
||||
{
|
||||
if (data->access_mode == O_RDWR || data->access_mode == O_WRONLY)
|
||||
{
|
||||
fsync (data->fd);
|
||||
#ifdef __linux__
|
||||
if (data->is_disk)
|
||||
ioctl (data->fd, BLKFLSBUF, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
close (data->fd);
|
||||
}
|
||||
|
||||
/* Open the partition. */
|
||||
grub_dprintf ("hostdisk", "opening the device `%s' in open_device()\n", dev);
|
||||
|
@ -607,10 +689,6 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Flush the buffer cache to the physical disk.
|
||||
XXX: This also empties the buffer cache. */
|
||||
ioctl (fd, BLKFLSBUF, 0);
|
||||
|
||||
data->dev = xstrdup (dev);
|
||||
data->access_mode = (flags & O_ACCMODE);
|
||||
data->fd = fd;
|
||||
|
@ -648,7 +726,17 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
|
|||
{
|
||||
free (data->dev);
|
||||
if (data->fd != -1)
|
||||
close (data->fd);
|
||||
{
|
||||
if (data->access_mode == O_RDWR || data->access_mode == O_WRONLY)
|
||||
{
|
||||
fsync (data->fd);
|
||||
#ifdef __linux__
|
||||
if (data->is_disk)
|
||||
ioctl (data->fd, BLKFLSBUF, 0);
|
||||
#endif
|
||||
}
|
||||
close (data->fd);
|
||||
}
|
||||
|
||||
fd = open (map[disk->id].device, flags);
|
||||
if (fd >= 0)
|
||||
|
@ -808,7 +896,6 @@ grub_util_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
if (nread (fd, buf, GRUB_DISK_SECTOR_SIZE) != GRUB_DISK_SECTOR_SIZE)
|
||||
{
|
||||
grub_error (GRUB_ERR_READ_ERROR, "cannot read `%s'", map[disk->id].device);
|
||||
close (fd);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
@ -865,7 +952,17 @@ grub_util_biosdisk_close (struct grub_disk *disk)
|
|||
|
||||
free (data->dev);
|
||||
if (data->fd != -1)
|
||||
close (data->fd);
|
||||
{
|
||||
if (data->access_mode == O_RDWR || data->access_mode == O_WRONLY)
|
||||
{
|
||||
fsync (data->fd);
|
||||
#ifdef __linux__
|
||||
if (data->is_disk)
|
||||
ioctl (data->fd, BLKFLSBUF, 0);
|
||||
#endif
|
||||
}
|
||||
close (data->fd);
|
||||
}
|
||||
free (data);
|
||||
}
|
||||
|
||||
|
@ -1284,7 +1381,17 @@ devmapper_out:
|
|||
path[8] = 0;
|
||||
return path;
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
char *out, *out2;
|
||||
if (strncmp (os_dev, "/dev/", sizeof ("/dev/") - 1) != 0)
|
||||
return xstrdup (os_dev);
|
||||
follow_geom_up (os_dev + sizeof ("/dev/") - 1, NULL, &out);
|
||||
|
||||
out2 = xasprintf ("/dev/%s", out);
|
||||
free (out);
|
||||
|
||||
return out2;
|
||||
#elif defined(__APPLE__)
|
||||
char *path = xstrdup (os_dev);
|
||||
if (strncmp ("/dev/", path, 5) == 0)
|
||||
{
|
||||
|
@ -1440,6 +1547,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
if (stat (os_dev, &st) < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE, "cannot stat `%s'", os_dev);
|
||||
grub_util_info ("cannot stat `%s'", os_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1448,6 +1556,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
{
|
||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"no mapping exists for `%s'", os_dev);
|
||||
grub_util_info ("no mapping exists for `%s'", os_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1462,7 +1571,8 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
#endif
|
||||
return make_device_name (drive, -1, -1);
|
||||
|
||||
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO)
|
||||
#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
/* Linux counts partitions uniformly, whether a BSD partition or a DOS
|
||||
partition, so mapping them to GRUB devices is not trivial.
|
||||
Here, get the start sector of a partition by HDIO_GETGEO, and
|
||||
|
|
|
@ -68,7 +68,7 @@ grub_file_open (const char *name)
|
|||
goto fail;
|
||||
|
||||
/* Get the file part of NAME. */
|
||||
file_name = grub_strchr (name, ')');
|
||||
file_name = (name[0] == '(') ? grub_strchr (name, ')') : NULL;
|
||||
if (file_name)
|
||||
file_name++;
|
||||
else
|
||||
|
|
|
@ -37,80 +37,80 @@
|
|||
.text
|
||||
|
||||
FUNCTION(efi_wrap_0)
|
||||
subq $40, %rsp
|
||||
subq $48, %rsp
|
||||
call *%rdi
|
||||
addq $40, %rsp
|
||||
addq $48, %rsp
|
||||
ret
|
||||
|
||||
FUNCTION(efi_wrap_1)
|
||||
subq $40, %rsp
|
||||
subq $48, %rsp
|
||||
mov %rsi, %rcx
|
||||
call *%rdi
|
||||
addq $40, %rsp
|
||||
addq $48, %rsp
|
||||
ret
|
||||
|
||||
FUNCTION(efi_wrap_2)
|
||||
subq $40, %rsp
|
||||
subq $48, %rsp
|
||||
mov %rsi, %rcx
|
||||
call *%rdi
|
||||
addq $40, %rsp
|
||||
addq $48, %rsp
|
||||
ret
|
||||
|
||||
FUNCTION(efi_wrap_3)
|
||||
subq $40, %rsp
|
||||
subq $48, %rsp
|
||||
mov %rcx, %r8
|
||||
mov %rsi, %rcx
|
||||
call *%rdi
|
||||
addq $40, %rsp
|
||||
addq $48, %rsp
|
||||
ret
|
||||
|
||||
FUNCTION(efi_wrap_4)
|
||||
subq $40, %rsp
|
||||
subq $48, %rsp
|
||||
mov %r8, %r9
|
||||
mov %rcx, %r8
|
||||
mov %rsi, %rcx
|
||||
call *%rdi
|
||||
addq $40, %rsp
|
||||
addq $48, %rsp
|
||||
ret
|
||||
|
||||
FUNCTION(efi_wrap_5)
|
||||
subq $40, %rsp
|
||||
subq $48, %rsp
|
||||
mov %r9, 32(%rsp)
|
||||
mov %r8, %r9
|
||||
mov %rcx, %r8
|
||||
mov %rsi, %rcx
|
||||
call *%rdi
|
||||
addq $40, %rsp
|
||||
addq $48, %rsp
|
||||
ret
|
||||
|
||||
FUNCTION(efi_wrap_6)
|
||||
subq $56, %rsp
|
||||
mov 56+8(%rsp), %rax
|
||||
subq $64, %rsp
|
||||
mov 64+8(%rsp), %rax
|
||||
mov %rax, 40(%rsp)
|
||||
mov %r9, 32(%rsp)
|
||||
mov %r8, %r9
|
||||
mov %rcx, %r8
|
||||
mov %rsi, %rcx
|
||||
call *%rdi
|
||||
addq $56, %rsp
|
||||
addq $64, %rsp
|
||||
ret
|
||||
|
||||
FUNCTION(efi_wrap_10)
|
||||
subq $88, %rsp
|
||||
mov 88+40(%rsp), %rax
|
||||
subq $96, %rsp
|
||||
mov 96+40(%rsp), %rax
|
||||
mov %rax, 72(%rsp)
|
||||
mov 88+32(%rsp), %rax
|
||||
mov 96+32(%rsp), %rax
|
||||
mov %rax, 64(%rsp)
|
||||
mov 88+24(%rsp), %rax
|
||||
mov 96+24(%rsp), %rax
|
||||
mov %rax, 56(%rsp)
|
||||
mov 88+16(%rsp), %rax
|
||||
mov 96+16(%rsp), %rax
|
||||
mov %rax, 48(%rsp)
|
||||
mov 88+8(%rsp), %rax
|
||||
mov 96+8(%rsp), %rax
|
||||
mov %rax, 40(%rsp)
|
||||
mov %r9, 32(%rsp)
|
||||
mov %r8, %r9
|
||||
mov %rcx, %r8
|
||||
mov %rsi, %rcx
|
||||
call *%rdi
|
||||
addq $88, %rsp
|
||||
addq $96, %rsp
|
||||
ret
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <grub/env.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/machine/biosnum.h>
|
||||
|
||||
static int
|
||||
grub_get_root_biosnumber_default (void)
|
||||
|
|
|
@ -58,7 +58,7 @@ struct legacy_command
|
|||
const char *longdesc;
|
||||
};
|
||||
|
||||
struct legacy_command legacy_commands[] =
|
||||
static struct legacy_command legacy_commands[] =
|
||||
{
|
||||
{"blocklist", "blocklist '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILE",
|
||||
"Print the blocklist notation of the file FILE."},
|
||||
|
@ -116,7 +116,7 @@ struct legacy_command legacy_commands[] =
|
|||
" immediately starts over using the NUM entry (same numbering as the"
|
||||
" `default' command). This obviously won't help if the machine"
|
||||
" was rebooted by a kernel that GRUB loaded."},
|
||||
{"find", "search -sf '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILENAME",
|
||||
{"find", "search -f '%s'\n", NULL, 0, 1, {TYPE_FILE}, 0, "FILENAME",
|
||||
"Search for the filename FILENAME in all of partitions and print the list of"
|
||||
" the devices which contain the file."},
|
||||
/* FIXME: fstest unsupported. */
|
||||
|
|
|
@ -77,10 +77,10 @@ struct grub_relocator_fw_leftover
|
|||
grub_uint8_t freebytes[GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT / 8];
|
||||
};
|
||||
|
||||
struct grub_relocator_fw_leftover *leftovers;
|
||||
static struct grub_relocator_fw_leftover *leftovers;
|
||||
#endif
|
||||
|
||||
struct grub_relocator_extra_block *extra_blocks;
|
||||
static struct grub_relocator_extra_block *extra_blocks;
|
||||
|
||||
void *
|
||||
get_virtual_current_address (grub_relocator_chunk_t in)
|
||||
|
@ -134,9 +134,10 @@ allocate_regstart (grub_phys_addr_t addr, grub_size_t size, grub_mm_region_t rb,
|
|||
grub_addr_t newreg_size, newreg_presize;
|
||||
grub_mm_header_t new_header;
|
||||
grub_mm_header_t hb = (grub_mm_header_t) (rb + 1);
|
||||
|
||||
grub_dprintf ("relocator", "ra = %p, rb = %p\n", regancestor, rb);
|
||||
|
||||
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||
grub_dprintf ("relocator", "ra = %p, rb = %p\n", regancestor, rb);
|
||||
#endif
|
||||
newreg_start = ALIGN_UP (newreg_raw_start, GRUB_MM_ALIGN);
|
||||
newreg_presize = newreg_start - newreg_raw_start;
|
||||
newreg_size = rb->size - (newreg_start - (grub_addr_t) rb);
|
||||
|
@ -179,11 +180,12 @@ allocate_regstart (grub_phys_addr_t addr, grub_size_t size, grub_mm_region_t rb,
|
|||
if ((void *) h < (void *) (newreg + 1))
|
||||
grub_fatal ("Failed to adjust memory region: %p, %p, %p, %p, %p",
|
||||
newreg, newreg->first, h, hp, hb);
|
||||
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||
if ((void *) h == (void *) (newreg + 1))
|
||||
grub_dprintf ("relocator",
|
||||
"Free start memory region: %p, %p, %p, %p, %p",
|
||||
newreg, newreg->first, h, hp, hb);
|
||||
|
||||
#endif
|
||||
hp = h;
|
||||
h = h->next;
|
||||
}
|
||||
|
@ -200,10 +202,12 @@ allocate_inreg (grub_phys_addr_t paddr, grub_size_t size,
|
|||
struct grub_mm_header *foll = NULL;
|
||||
grub_addr_t vaddr = (grub_addr_t) hb + (paddr - grub_vtop (hb));
|
||||
|
||||
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||
grub_dprintf ("relocator", "inreg paddr = 0x%lx, size = %lu,"
|
||||
" hb = %p, hbp = %p, rb = %p, vaddr = 0x%lx\n",
|
||||
(unsigned long) paddr, (unsigned long) size, hb, hbp,
|
||||
rb, (unsigned long) vaddr);
|
||||
#endif
|
||||
|
||||
if (ALIGN_UP (vaddr + size, GRUB_MM_ALIGN) + GRUB_MM_ALIGN
|
||||
<= (grub_addr_t) (hb + hb->size))
|
||||
|
@ -211,8 +215,10 @@ allocate_inreg (grub_phys_addr_t paddr, grub_size_t size,
|
|||
foll = (void *) ALIGN_UP (vaddr + size, GRUB_MM_ALIGN);
|
||||
foll->magic = GRUB_MM_FREE_MAGIC;
|
||||
foll->size = hb + hb->size - foll;
|
||||
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||
grub_dprintf ("relocator", "foll = %p, foll->size = %lu\n", foll,
|
||||
(unsigned long) foll->size);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (vaddr - (grub_addr_t) hb >= sizeof (*hb))
|
||||
|
@ -819,9 +825,11 @@ malloc_in_range (struct grub_relocator *rel,
|
|||
fend
|
||||
= ALIGN_UP (alloc_end,
|
||||
GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT);
|
||||
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||
grub_dprintf ("relocator", "requesting %lx-%lx\n",
|
||||
(unsigned long) fstart,
|
||||
(unsigned long) fend);
|
||||
#endif
|
||||
/* The failure here can be very expensive. */
|
||||
if (!grub_relocator_firmware_alloc_region (fstart,
|
||||
fend - fstart))
|
||||
|
@ -1282,23 +1290,8 @@ grub_relocator_alloc_chunk_addr (struct grub_relocator *rel,
|
|||
chunk->srcv = grub_map_memory (chunk->src, chunk->size);
|
||||
*out = chunk;
|
||||
#ifdef DEBUG_RELOCATOR
|
||||
{
|
||||
grub_mm_region_t r;
|
||||
grub_mm_header_t p;
|
||||
grub_memset (chunk->srcv, 0xfa, chunk->size);
|
||||
for (r = grub_mm_base; r; r = r->next)
|
||||
{
|
||||
p = r->first;
|
||||
do
|
||||
{
|
||||
if ((grub_addr_t) p < (grub_addr_t) (r + 1)
|
||||
|| (grub_addr_t) p >= (grub_addr_t) (r + 1) + r->size)
|
||||
grub_fatal (__FILE__ ":%d: out of range pointer: %p\n", __LINE__, p);
|
||||
p = p->next;
|
||||
}
|
||||
while (p != r->first);
|
||||
}
|
||||
}
|
||||
grub_memset (chunk->srcv, 0xfa, chunk->size);
|
||||
grub_mm_check ();
|
||||
#endif
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -1423,11 +1416,17 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
|
|||
break;
|
||||
}
|
||||
|
||||
grub_dprintf ("relocator", "relocators_size=%ld\n",
|
||||
(unsigned long) rel->relocators_size);
|
||||
|
||||
if (chunk->src < chunk->target)
|
||||
rel->relocators_size += grub_relocator_backward_size;
|
||||
if (chunk->src > chunk->target)
|
||||
rel->relocators_size += grub_relocator_forward_size;
|
||||
|
||||
grub_dprintf ("relocator", "relocators_size=%ld\n",
|
||||
(unsigned long) rel->relocators_size);
|
||||
|
||||
chunk->size = size;
|
||||
chunk->next = rel->chunks;
|
||||
rel->chunks = chunk;
|
||||
|
@ -1436,24 +1435,8 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
|
|||
chunk->srcv = grub_map_memory (chunk->src, chunk->size);
|
||||
*out = chunk;
|
||||
#ifdef DEBUG_RELOCATOR
|
||||
{
|
||||
grub_mm_region_t r;
|
||||
grub_mm_header_t p;
|
||||
|
||||
grub_memset (chunk->srcv, 0xfa, chunk->size);
|
||||
for (r = grub_mm_base; r; r = r->next)
|
||||
{
|
||||
p = r->first;
|
||||
do
|
||||
{
|
||||
if ((grub_addr_t) p < (grub_addr_t) (r + 1)
|
||||
|| (grub_addr_t) p >= (grub_addr_t) (r + 1) + r->size)
|
||||
grub_fatal (__FILE__ "%d: out of range pointer: %p\n", __LINE__, p);
|
||||
p = p->next;
|
||||
}
|
||||
while (p != r->first);
|
||||
}
|
||||
}
|
||||
grub_memset (chunk->srcv, 0xfa, chunk->size);
|
||||
grub_mm_check ();
|
||||
#endif
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ static void *kern_chunk_src;
|
|||
static grub_uint32_t bootflags;
|
||||
static int is_elf_kernel, is_64bit;
|
||||
static grub_uint32_t openbsd_root;
|
||||
struct grub_relocator *relocator = NULL;
|
||||
static struct grub_relocator *relocator = NULL;
|
||||
static struct grub_openbsd_ramdisk_descriptor openbsd_ramdisk;
|
||||
|
||||
struct bsd_tag
|
||||
|
|
|
@ -195,6 +195,11 @@ SUFFIX (grub_freebsd_load_elfmodule) (struct grub_relocator *relocator,
|
|||
chunk_size = s->sh_addr + s->sh_size;
|
||||
}
|
||||
|
||||
if (chunk_size < sizeof (e))
|
||||
chunk_size = sizeof (e);
|
||||
chunk_size += e.e_phnum * e.e_phentsize;
|
||||
chunk_size += e.e_shnum * e.e_shentsize;
|
||||
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
|
|
|
@ -136,7 +136,8 @@ find_efi_mmap_size (void)
|
|||
later, and EFI itself may allocate more. */
|
||||
mmap_size += (1 << 12);
|
||||
|
||||
return page_align (mmap_size);
|
||||
mmap_size = page_align (mmap_size);
|
||||
return mmap_size;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@ struct module
|
|||
int cmdline_size;
|
||||
};
|
||||
|
||||
struct module *modules, *modules_last;
|
||||
static struct module *modules, *modules_last;
|
||||
static grub_size_t cmdline_size;
|
||||
static grub_size_t total_modcmd;
|
||||
static unsigned modcnt;
|
||||
|
@ -435,7 +435,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
|||
bufsize = grub_multiboot_get_mbi_size ();
|
||||
|
||||
err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch,
|
||||
0, 0xffffffff - bufsize,
|
||||
0x10000, 0x100000 - bufsize,
|
||||
bufsize, 4,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE);
|
||||
if (err)
|
||||
|
|
|
@ -49,7 +49,7 @@ struct tbl_alias
|
|||
char *name;
|
||||
};
|
||||
|
||||
struct tbl_alias table_aliases[] =
|
||||
static struct tbl_alias table_aliases[] =
|
||||
{
|
||||
{GRUB_EFI_ACPI_20_TABLE_GUID, "ACPI_20"},
|
||||
{GRUB_EFI_ACPI_TABLE_GUID, "ACPI"},
|
||||
|
@ -219,7 +219,7 @@ struct property_descriptor
|
|||
void *data;
|
||||
};
|
||||
|
||||
struct grub_xnu_devprop_device_descriptor *devices = 0;
|
||||
static struct grub_xnu_devprop_device_descriptor *devices = 0;
|
||||
|
||||
grub_err_t
|
||||
grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
|
|
|
@ -379,8 +379,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_relocator_chunk_t ch;
|
||||
|
||||
err = grub_relocator_alloc_chunk_align (relocator, &ch,
|
||||
target_addr + linux_size + 0x10000,
|
||||
(0xffffffff - size) + 1,
|
||||
(target_addr & 0x1fffffff)
|
||||
+ linux_size + 0x10000,
|
||||
(0x10000000 - size),
|
||||
size, 0x10000,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ struct module
|
|||
int cmdline_size;
|
||||
};
|
||||
|
||||
struct module *modules, *modules_last;
|
||||
static struct module *modules, *modules_last;
|
||||
static grub_size_t cmdline_size;
|
||||
static grub_size_t total_modcmd;
|
||||
static unsigned modcnt;
|
||||
|
|
|
@ -1429,7 +1429,7 @@ grub_cmd_xnu_resume (grub_command_t cmd __attribute__ ((unused)),
|
|||
#endif
|
||||
|
||||
void
|
||||
grub_xnu_lock ()
|
||||
grub_xnu_lock (void)
|
||||
{
|
||||
if (!locked)
|
||||
grub_dl_ref (my_mod);
|
||||
|
@ -1437,7 +1437,7 @@ grub_xnu_lock ()
|
|||
}
|
||||
|
||||
void
|
||||
grub_xnu_unlock ()
|
||||
grub_xnu_unlock (void)
|
||||
{
|
||||
if (locked)
|
||||
grub_dl_unref (my_mod);
|
||||
|
|
|
@ -194,7 +194,6 @@ grub_mmap_unregister (int handle)
|
|||
{
|
||||
struct overlay *curover, *prevover;
|
||||
grub_efi_boot_services_t *b;
|
||||
grub_efi_status_t status;
|
||||
|
||||
b = grub_efi_system_table->boot_services;
|
||||
|
||||
|
@ -204,7 +203,7 @@ grub_mmap_unregister (int handle)
|
|||
{
|
||||
if (curover->handle == handle)
|
||||
{
|
||||
status = efi_call_2 (b->free_pages, curover->address, curover->pages);
|
||||
efi_call_2 (b->free_pages, curover->address, curover->pages);
|
||||
if (prevover != 0)
|
||||
prevover->next = curover->next;
|
||||
else
|
||||
|
|
|
@ -34,7 +34,7 @@ struct grub_auth_user
|
|||
int authenticated;
|
||||
};
|
||||
|
||||
struct grub_auth_user *users = NULL;
|
||||
static struct grub_auth_user *users = NULL;
|
||||
|
||||
grub_err_t
|
||||
grub_auth_register_authentication (const char *user,
|
||||
|
|
|
@ -240,7 +240,7 @@ grub_cmdline_get (const char *prompt)
|
|||
grub_term_gotoxy (cl_term->term, cl_term->xpos, cl_term->ypos);
|
||||
}
|
||||
|
||||
void cl_set_pos_all ()
|
||||
void cl_set_pos_all (void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < nterms; i++)
|
||||
|
|
|
@ -31,8 +31,8 @@ struct menu_pointer
|
|||
struct menu_pointer *prev;
|
||||
};
|
||||
|
||||
struct menu_pointer initial_menu;
|
||||
struct menu_pointer *current_menu = &initial_menu;
|
||||
static struct menu_pointer initial_menu;
|
||||
static struct menu_pointer *current_menu = &initial_menu;
|
||||
|
||||
void
|
||||
grub_env_unset_menu (void)
|
||||
|
|
|
@ -31,7 +31,7 @@ struct load_spec
|
|||
char *modname;
|
||||
};
|
||||
|
||||
struct load_spec *crypto_specs = NULL;
|
||||
static struct load_spec *crypto_specs = NULL;
|
||||
|
||||
static void
|
||||
grub_crypto_autoload (const char *name)
|
||||
|
|
|
@ -496,6 +496,7 @@ GRUB_MOD_INIT(normal)
|
|||
grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
|
||||
|
||||
grub_register_variable_hook ("pager", 0, grub_env_write_pager);
|
||||
grub_env_export ("pager");
|
||||
|
||||
/* Register a command "normal" for the rescue mode. */
|
||||
grub_register_command ("normal", grub_cmd_normal,
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <grub/i18n.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/script_sh.h>
|
||||
#include <grub/gfxterm.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
/* Time to delay after displaying an error message about a default/fallback
|
||||
entry failing to boot. */
|
||||
|
@ -345,18 +347,44 @@ static void
|
|||
menu_init (int entry, grub_menu_t menu, int nested)
|
||||
{
|
||||
struct grub_term_output *term;
|
||||
int gfxmenu = 0;
|
||||
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
if (grub_strcmp (term->name, "gfxterm") == 0)
|
||||
{
|
||||
if (grub_env_get ("theme"))
|
||||
{
|
||||
if (!grub_gfxmenu_try_hook)
|
||||
{
|
||||
grub_dl_load ("gfxmenu");
|
||||
grub_print_error ();
|
||||
}
|
||||
if (grub_gfxmenu_try_hook)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = grub_gfxmenu_try_hook (entry, menu, nested);
|
||||
if(!err)
|
||||
{
|
||||
gfxmenu = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
grub_error (GRUB_ERR_BAD_MODULE, "no gfxmenu found");
|
||||
grub_print_error ();
|
||||
grub_wait_after_message ();
|
||||
}
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
grub_gfxterm_fullscreen ();
|
||||
break;
|
||||
}
|
||||
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
{
|
||||
grub_err_t err;
|
||||
|
||||
if (grub_gfxmenu_try_hook && grub_strcmp (term->name, "gfxterm") == 0)
|
||||
{
|
||||
err = grub_gfxmenu_try_hook (entry, menu, nested);
|
||||
if(!err)
|
||||
continue;
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
if (grub_strcmp (term->name, "gfxterm") == 0 && gfxmenu)
|
||||
break;
|
||||
|
||||
err = grub_menu_try_text (term, entry, menu, nested);
|
||||
if(!err)
|
||||
|
|
|
@ -52,6 +52,8 @@ struct per_term_screen
|
|||
int x;
|
||||
/* The Y coordinate. */
|
||||
int y;
|
||||
/* Number of entries. */
|
||||
int num_entries;
|
||||
};
|
||||
|
||||
struct screen
|
||||
|
@ -87,7 +89,7 @@ init_line (struct line *linep)
|
|||
{
|
||||
linep->len = 0;
|
||||
linep->max_len = 80; /* XXX */
|
||||
linep->buf = grub_malloc (linep->max_len);
|
||||
linep->buf = grub_malloc (linep->max_len + 1);
|
||||
if (! linep->buf)
|
||||
return 0;
|
||||
|
||||
|
@ -188,7 +190,7 @@ print_down (int flag, struct per_term_screen *term_screen)
|
|||
grub_term_gotoxy (term_screen->term, GRUB_TERM_LEFT_BORDER_X
|
||||
+ grub_term_border_width (term_screen->term),
|
||||
GRUB_TERM_TOP_BORDER_Y
|
||||
+ grub_term_num_entries (term_screen->term));
|
||||
+ term_screen->num_entries);
|
||||
|
||||
if (flag)
|
||||
grub_putcode (GRUB_UNICODE_DOWNARROW, term_screen->term);
|
||||
|
@ -209,13 +211,12 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
|
|||
struct line *linep;
|
||||
|
||||
/* Check if scrolling is necessary. */
|
||||
if (term_screen->y < 0 || term_screen->y
|
||||
>= grub_term_num_entries (term_screen->term))
|
||||
if (term_screen->y < 0 || term_screen->y >= term_screen->num_entries)
|
||||
{
|
||||
if (term_screen->y < 0)
|
||||
term_screen->y = 0;
|
||||
else
|
||||
term_screen->y = grub_term_num_entries (term_screen->term) - 1;
|
||||
term_screen->y = term_screen->num_entries - 1;
|
||||
|
||||
region_start = 0;
|
||||
region_column = 0;
|
||||
|
@ -251,7 +252,7 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
|
|||
|
||||
for (column = 0;
|
||||
column <= linep->len
|
||||
&& y < grub_term_num_entries (term_screen->term);
|
||||
&& y < term_screen->num_entries;
|
||||
column += grub_term_entry_width (term_screen->term), y++)
|
||||
{
|
||||
if (y < 0)
|
||||
|
@ -272,7 +273,7 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
|
|||
print_line (linep, column, 0, y, term_screen);
|
||||
}
|
||||
|
||||
if (y == grub_term_num_entries (term_screen->term))
|
||||
if (y == term_screen->num_entries)
|
||||
{
|
||||
if (column <= linep->len || i + 1 < screen->num_lines)
|
||||
down_flag = 1;
|
||||
|
@ -282,11 +283,11 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
|
|||
i++;
|
||||
|
||||
if (mode == ALL_LINES && i == screen->num_lines)
|
||||
for (; y < grub_term_num_entries (term_screen->term); y++)
|
||||
for (; y < term_screen->num_entries; y++)
|
||||
print_empty_line (y, term_screen);
|
||||
|
||||
}
|
||||
while (y < grub_term_num_entries (term_screen->term));
|
||||
while (y < term_screen->num_entries);
|
||||
|
||||
/* Draw up and down arrows. */
|
||||
if (up)
|
||||
|
@ -1165,7 +1166,7 @@ run (struct screen *screen)
|
|||
{
|
||||
char *script;
|
||||
int errs_before;
|
||||
grub_menu_t menu;
|
||||
grub_menu_t menu = NULL;
|
||||
char *dummy[1] = { NULL };
|
||||
|
||||
auto char * editor_getsource (void);
|
||||
|
@ -1185,7 +1186,7 @@ run (struct screen *screen)
|
|||
size = 0;
|
||||
for (i = 0; i < screen->num_lines; i++)
|
||||
{
|
||||
grub_strcpy (source + size, screen->lines[i].buf);
|
||||
grub_memcpy (source + size, screen->lines[i].buf, screen->lines[i].len);
|
||||
size += screen->lines[i].len;
|
||||
source[size++] = '\n';
|
||||
}
|
||||
|
@ -1290,7 +1291,8 @@ grub_menu_entry_run (grub_menu_entry_t entry)
|
|||
}
|
||||
/* Draw the screen. */
|
||||
for (i = 0; i < screen->nterms; i++)
|
||||
grub_menu_init_page (0, 1, screen->terms[i].term);
|
||||
grub_menu_init_page (0, 1, &screen->terms[i].num_entries,
|
||||
screen->terms[i].term);
|
||||
update_screen_all (screen, 0, 0, 1, 1, ALL_LINES);
|
||||
for (i = 0; i < screen->nterms; i++)
|
||||
grub_term_setcursor (screen->terms[i].term, 1);
|
||||
|
|
|
@ -34,10 +34,19 @@ static grub_uint8_t grub_color_menu_highlight;
|
|||
struct menu_viewer_data
|
||||
{
|
||||
int first, offset;
|
||||
/* The number of entries shown at a time. */
|
||||
int num_entries;
|
||||
grub_menu_t menu;
|
||||
struct grub_term_output *term;
|
||||
};
|
||||
|
||||
static inline int
|
||||
grub_term_cursor_x (struct grub_term_output *term)
|
||||
{
|
||||
return (GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (term)
|
||||
- GRUB_TERM_MARGIN - 1);
|
||||
}
|
||||
|
||||
grub_ssize_t
|
||||
grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position,
|
||||
struct grub_term_output *term)
|
||||
|
@ -53,30 +62,45 @@ grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position,
|
|||
return width;
|
||||
}
|
||||
|
||||
void
|
||||
grub_print_message_indented (const char *msg, int margin_left, int margin_right,
|
||||
struct grub_term_output *term)
|
||||
static int
|
||||
grub_print_message_indented_real (const char *msg, int margin_left,
|
||||
int margin_right,
|
||||
struct grub_term_output *term, int dry_run)
|
||||
{
|
||||
grub_uint32_t *unicode_msg;
|
||||
grub_uint32_t *last_position;
|
||||
|
||||
int msg_len;
|
||||
int ret = 0;
|
||||
|
||||
msg_len = grub_utf8_to_ucs4_alloc (msg, &unicode_msg, &last_position);
|
||||
|
||||
if (msg_len < 0)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_print_ucs4 (unicode_msg, last_position, margin_left, margin_right, term);
|
||||
if (dry_run)
|
||||
ret = grub_ucs4_count_lines (unicode_msg, last_position, margin_left,
|
||||
margin_right, term);
|
||||
else
|
||||
grub_print_ucs4 (unicode_msg, last_position, margin_left,
|
||||
margin_right, term);
|
||||
|
||||
grub_free (unicode_msg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
grub_print_message_indented (const char *msg, int margin_left, int margin_right,
|
||||
struct grub_term_output *term)
|
||||
{
|
||||
grub_print_message_indented_real (msg, margin_left, margin_right, term, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_border (struct grub_term_output *term)
|
||||
draw_border (struct grub_term_output *term, int num_entries)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -88,7 +112,7 @@ draw_border (struct grub_term_output *term)
|
|||
grub_putcode (GRUB_UNICODE_HLINE, term);
|
||||
grub_putcode (GRUB_UNICODE_CORNER_UR, term);
|
||||
|
||||
for (i = 0; i < (unsigned) grub_term_num_entries (term); i++)
|
||||
for (i = 0; i < (unsigned) num_entries; i++)
|
||||
{
|
||||
grub_term_gotoxy (term, GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y + i + 1);
|
||||
grub_putcode (GRUB_UNICODE_VLINE, term);
|
||||
|
@ -99,7 +123,7 @@ draw_border (struct grub_term_output *term)
|
|||
}
|
||||
|
||||
grub_term_gotoxy (term, GRUB_TERM_MARGIN,
|
||||
GRUB_TERM_TOP_BORDER_Y + grub_term_num_entries (term) + 1);
|
||||
GRUB_TERM_TOP_BORDER_Y + num_entries + 1);
|
||||
grub_putcode (GRUB_UNICODE_CORNER_LL, term);
|
||||
for (i = 0; i < (unsigned) grub_term_border_width (term) - 2; i++)
|
||||
grub_putcode (GRUB_UNICODE_HLINE, term);
|
||||
|
@ -108,22 +132,27 @@ draw_border (struct grub_term_output *term)
|
|||
grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
|
||||
|
||||
grub_term_gotoxy (term, GRUB_TERM_MARGIN,
|
||||
(GRUB_TERM_TOP_BORDER_Y + grub_term_num_entries (term)
|
||||
(GRUB_TERM_TOP_BORDER_Y + num_entries
|
||||
+ GRUB_TERM_MARGIN + 1));
|
||||
}
|
||||
|
||||
static void
|
||||
print_message (int nested, int edit, struct grub_term_output *term)
|
||||
static int
|
||||
print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
|
||||
{
|
||||
int ret = 0;
|
||||
grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
|
||||
|
||||
if (edit)
|
||||
{
|
||||
grub_putcode ('\n', term);
|
||||
grub_print_message_indented (_("Minimum Emacs-like screen editing is \
|
||||
if(dry_run)
|
||||
ret++;
|
||||
else
|
||||
grub_putcode ('\n', term);
|
||||
ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \
|
||||
supported. TAB lists completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a \
|
||||
command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term);
|
||||
STANDARD_MARGIN, STANDARD_MARGIN,
|
||||
term, dry_run);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -134,30 +163,34 @@ command-line or ESC to discard edits and return to the GRUB menu."),
|
|||
msg_translated = grub_xasprintf (msg, GRUB_UNICODE_UPARROW,
|
||||
GRUB_UNICODE_DOWNARROW);
|
||||
if (!msg_translated)
|
||||
return;
|
||||
grub_putcode ('\n', term);
|
||||
grub_print_message_indented (msg_translated, STANDARD_MARGIN,
|
||||
STANDARD_MARGIN, term);
|
||||
return 0;
|
||||
if(dry_run)
|
||||
ret++;
|
||||
else
|
||||
grub_putcode ('\n', term);
|
||||
ret += grub_print_message_indented_real (msg_translated, STANDARD_MARGIN,
|
||||
STANDARD_MARGIN, term, dry_run);
|
||||
|
||||
grub_free (msg_translated);
|
||||
|
||||
if (nested)
|
||||
{
|
||||
grub_print_message_indented
|
||||
ret += grub_print_message_indented_real
|
||||
(_("Press enter to boot the selected OS, "
|
||||
"\'e\' to edit the commands before booting "
|
||||
"or \'c\' for a command-line. ESC to return previous menu.\n"),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term);
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_print_message_indented
|
||||
ret += grub_print_message_indented_real
|
||||
(_("Press enter to boot the selected OS, "
|
||||
"\'e\' to edit the commands before booting "
|
||||
"or \'c\' for a command-line.\n"),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term);
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -256,52 +289,56 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
|
|||
}
|
||||
|
||||
static void
|
||||
print_entries (grub_menu_t menu, int first, int offset,
|
||||
struct grub_term_output *term)
|
||||
print_entries (grub_menu_t menu, const struct menu_viewer_data *data)
|
||||
{
|
||||
grub_menu_entry_t e;
|
||||
int i;
|
||||
|
||||
grub_term_gotoxy (term,
|
||||
GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (term),
|
||||
grub_term_gotoxy (data->term,
|
||||
GRUB_TERM_LEFT_BORDER_X + grub_term_border_width (data->term),
|
||||
GRUB_TERM_FIRST_ENTRY_Y);
|
||||
|
||||
if (first)
|
||||
grub_putcode (GRUB_UNICODE_UPARROW, term);
|
||||
if (data->first)
|
||||
grub_putcode (GRUB_UNICODE_UPARROW, data->term);
|
||||
else
|
||||
grub_putcode (' ', term);
|
||||
grub_putcode (' ', data->term);
|
||||
|
||||
e = grub_menu_get_entry (menu, first);
|
||||
e = grub_menu_get_entry (menu, data->first);
|
||||
|
||||
for (i = 0; i < grub_term_num_entries (term); i++)
|
||||
for (i = 0; i < data->num_entries; i++)
|
||||
{
|
||||
print_entry (GRUB_TERM_FIRST_ENTRY_Y + i, offset == i, e, term);
|
||||
print_entry (GRUB_TERM_FIRST_ENTRY_Y + i, data->offset == i,
|
||||
e, data->term);
|
||||
if (e)
|
||||
e = e->next;
|
||||
}
|
||||
|
||||
grub_term_gotoxy (term, GRUB_TERM_LEFT_BORDER_X
|
||||
+ grub_term_border_width (term),
|
||||
GRUB_TERM_TOP_BORDER_Y + grub_term_num_entries (term));
|
||||
grub_term_gotoxy (data->term, GRUB_TERM_LEFT_BORDER_X
|
||||
+ grub_term_border_width (data->term),
|
||||
GRUB_TERM_TOP_BORDER_Y + data->num_entries);
|
||||
|
||||
if (e)
|
||||
grub_putcode (GRUB_UNICODE_DOWNARROW, term);
|
||||
grub_putcode (GRUB_UNICODE_DOWNARROW, data->term);
|
||||
else
|
||||
grub_putcode (' ', term);
|
||||
grub_putcode (' ', data->term);
|
||||
|
||||
grub_term_gotoxy (term, grub_term_cursor_x (term),
|
||||
GRUB_TERM_FIRST_ENTRY_Y + offset);
|
||||
grub_term_gotoxy (data->term, grub_term_cursor_x (data->term),
|
||||
GRUB_TERM_FIRST_ENTRY_Y + data->offset);
|
||||
}
|
||||
|
||||
/* Initialize the screen. If NESTED is non-zero, assume that this menu
|
||||
is run from another menu or a command-line. If EDIT is non-zero, show
|
||||
a message for the menu entry editor. */
|
||||
void
|
||||
grub_menu_init_page (int nested, int edit,
|
||||
grub_menu_init_page (int nested, int edit, int *num_entries,
|
||||
struct grub_term_output *term)
|
||||
{
|
||||
grub_uint8_t old_color_normal, old_color_highlight;
|
||||
|
||||
/* 3 lines for timeout message and bottom margin. 2 lines for the border. */
|
||||
*num_entries = grub_term_height (term) - GRUB_TERM_TOP_BORDER_Y
|
||||
- (print_message (nested, edit, term, 1) + 3) - 2;
|
||||
|
||||
grub_term_getcolor (term, &old_color_normal, &old_color_highlight);
|
||||
|
||||
/* By default, use the same colors for the menu. */
|
||||
|
@ -316,9 +353,9 @@ grub_menu_init_page (int nested, int edit,
|
|||
|
||||
grub_normal_init_page (term);
|
||||
grub_term_setcolor (term, grub_color_menu_normal, grub_color_menu_highlight);
|
||||
draw_border (term);
|
||||
draw_border (term, *num_entries);
|
||||
grub_term_setcolor (term, old_color_normal, old_color_highlight);
|
||||
print_message (nested, edit, term);
|
||||
print_message (nested, edit, term, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -359,10 +396,10 @@ menu_text_set_chosen_entry (int entry, void *dataptr)
|
|||
int complete_redraw = 0;
|
||||
|
||||
data->offset = entry - data->first;
|
||||
if (data->offset > grub_term_num_entries (data->term) - 1)
|
||||
if (data->offset > data->num_entries - 1)
|
||||
{
|
||||
data->first = entry - (grub_term_num_entries (data->term) - 1);
|
||||
data->offset = grub_term_num_entries (data->term) - 1;
|
||||
data->first = entry - (data->num_entries - 1);
|
||||
data->offset = data->num_entries - 1;
|
||||
complete_redraw = 1;
|
||||
}
|
||||
if (data->offset < 0)
|
||||
|
@ -372,7 +409,7 @@ menu_text_set_chosen_entry (int entry, void *dataptr)
|
|||
complete_redraw = 1;
|
||||
}
|
||||
if (complete_redraw)
|
||||
print_entries (data->menu, data->first, data->offset, data->term);
|
||||
print_entries (data->menu, data);
|
||||
else
|
||||
{
|
||||
print_entry (GRUB_TERM_FIRST_ENTRY_Y + oldoffset, 0,
|
||||
|
@ -436,15 +473,17 @@ grub_menu_try_text (struct grub_term_output *term,
|
|||
|
||||
data->offset = entry;
|
||||
data->first = 0;
|
||||
if (data->offset > grub_term_num_entries (data->term) - 1)
|
||||
{
|
||||
data->first = data->offset - (grub_term_num_entries (data->term) - 1);
|
||||
data->offset = grub_term_num_entries (data->term) - 1;
|
||||
}
|
||||
|
||||
grub_term_setcursor (data->term, 0);
|
||||
grub_menu_init_page (nested, 0, data->term);
|
||||
print_entries (menu, data->first, data->offset, data->term);
|
||||
grub_menu_init_page (nested, 0, &data->num_entries, data->term);
|
||||
|
||||
if (data->offset > data->num_entries - 1)
|
||||
{
|
||||
data->first = data->offset - (data->num_entries - 1);
|
||||
data->offset = data->num_entries - 1;
|
||||
}
|
||||
|
||||
print_entries (menu, data);
|
||||
grub_term_refresh (data->term);
|
||||
grub_menu_register_viewer (instance);
|
||||
|
||||
|
|
|
@ -112,14 +112,13 @@ grub_normal_print_device_info (const char *name)
|
|||
grub_printf ("%s", _("Not a known filesystem"));
|
||||
|
||||
if (dev->disk->partition)
|
||||
grub_printf (_(" - Partition start at %u"),
|
||||
grub_partition_get_start (dev->disk->partition));
|
||||
grub_printf (_(" - Partition start at %llu"),
|
||||
(unsigned long long) grub_partition_get_start (dev->disk->partition));
|
||||
if (grub_disk_get_size (dev->disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
grub_printf (_(" - Total size unknown"),
|
||||
grub_disk_get_size (dev->disk));
|
||||
grub_puts_ (" - Total size unknown");
|
||||
else
|
||||
grub_printf (_(" - Total size %u sectors"),
|
||||
grub_disk_get_size (dev->disk));
|
||||
grub_printf (_(" - Total size %llu sectors"),
|
||||
(unsigned long long) grub_disk_get_size (dev->disk));
|
||||
|
||||
grub_device_close (dev);
|
||||
}
|
||||
|
|
|
@ -515,14 +515,16 @@ print_ucs4_terminal (const grub_uint32_t * str,
|
|||
const grub_uint32_t * last_position,
|
||||
int margin_left, int margin_right,
|
||||
struct grub_term_output *term,
|
||||
struct term_state *state)
|
||||
struct term_state *state,
|
||||
int dry_run)
|
||||
{
|
||||
const grub_uint32_t *ptr;
|
||||
grub_ssize_t startwidth = get_startwidth (term, margin_left);
|
||||
grub_ssize_t startwidth = dry_run ? 0 : get_startwidth (term, margin_left);
|
||||
grub_ssize_t line_width = startwidth;
|
||||
grub_ssize_t lastspacewidth = 0;
|
||||
grub_ssize_t max_width = get_maxwidth (term, margin_left, margin_right);
|
||||
const grub_uint32_t *line_start = str, *last_space = str - 1;
|
||||
int lines = 0;
|
||||
|
||||
for (ptr = str; ptr < last_position; ptr++)
|
||||
{
|
||||
|
@ -552,7 +554,7 @@ print_ucs4_terminal (const grub_uint32_t * str,
|
|||
if (line_width > max_width && last_space > line_start)
|
||||
ptr = last_space;
|
||||
else if (line_width > max_width
|
||||
&& line_start == str && startwidth != 0)
|
||||
&& line_start == str && line_width - lastspacewidth < max_width - 5)
|
||||
{
|
||||
ptr = str;
|
||||
lastspacewidth = startwidth;
|
||||
|
@ -560,50 +562,59 @@ print_ucs4_terminal (const grub_uint32_t * str,
|
|||
else
|
||||
lastspacewidth = line_width - last_width;
|
||||
|
||||
for (ptr2 = line_start; ptr2 < ptr; ptr2++)
|
||||
{
|
||||
/* Skip combining characters on non-UTF8 terminals. */
|
||||
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
!= GRUB_TERM_CODE_TYPE_UTF8_LOGICAL
|
||||
&& grub_unicode_get_comb_type (*ptr2)
|
||||
!= GRUB_UNICODE_COMB_NONE)
|
||||
continue;
|
||||
putcode_real (*ptr2, term);
|
||||
}
|
||||
lines++;
|
||||
|
||||
grub_print_spaces (term, margin_right);
|
||||
grub_putcode ('\n', term);
|
||||
if (state && ++state->num_lines
|
||||
>= (grub_ssize_t) grub_term_height (term) - 2)
|
||||
if (!dry_run)
|
||||
{
|
||||
state->backlog_ucs4 = (ptr == last_space || *ptr == '\n')
|
||||
? ptr + 1 : ptr;
|
||||
state->backlog_len = last_position - state->backlog_ucs4;
|
||||
return 1;
|
||||
for (ptr2 = line_start; ptr2 < ptr; ptr2++)
|
||||
{
|
||||
/* Skip combining characters on non-UTF8 terminals. */
|
||||
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
!= GRUB_TERM_CODE_TYPE_UTF8_LOGICAL
|
||||
&& grub_unicode_get_comb_type (*ptr2)
|
||||
!= GRUB_UNICODE_COMB_NONE)
|
||||
continue;
|
||||
putcode_real (*ptr2, term);
|
||||
}
|
||||
|
||||
grub_print_spaces (term, margin_right);
|
||||
grub_putcode ('\n', term);
|
||||
if (state && ++state->num_lines
|
||||
>= (grub_ssize_t) grub_term_height (term) - 2)
|
||||
{
|
||||
state->backlog_ucs4 = (ptr == last_space || *ptr == '\n')
|
||||
? ptr + 1 : ptr;
|
||||
state->backlog_len = last_position - state->backlog_ucs4;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
line_width -= lastspacewidth;
|
||||
grub_print_spaces (term, margin_left);
|
||||
if (!dry_run)
|
||||
grub_print_spaces (term, margin_left);
|
||||
if (ptr == last_space || *ptr == '\n')
|
||||
ptr++;
|
||||
line_start = ptr;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const grub_uint32_t *ptr2;
|
||||
for (ptr2 = line_start; ptr2 < last_position; ptr2++)
|
||||
{
|
||||
/* Skip combining characters on non-UTF8 terminals. */
|
||||
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
!= GRUB_TERM_CODE_TYPE_UTF8_LOGICAL
|
||||
&& grub_unicode_get_comb_type (*ptr2)
|
||||
!= GRUB_UNICODE_COMB_NONE)
|
||||
continue;
|
||||
putcode_real (*ptr2, term);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
if (line_start < last_position)
|
||||
lines++;
|
||||
if (!dry_run)
|
||||
{
|
||||
const grub_uint32_t *ptr2;
|
||||
for (ptr2 = line_start; ptr2 < last_position; ptr2++)
|
||||
{
|
||||
/* Skip combining characters on non-UTF8 terminals. */
|
||||
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
!= GRUB_TERM_CODE_TYPE_UTF8_LOGICAL
|
||||
&& grub_unicode_get_comb_type (*ptr2)
|
||||
!= GRUB_UNICODE_COMB_NONE)
|
||||
continue;
|
||||
putcode_real (*ptr2, term);
|
||||
}
|
||||
}
|
||||
return dry_run ? lines : 0;
|
||||
}
|
||||
|
||||
static struct term_state *
|
||||
|
@ -672,7 +683,7 @@ print_backlog (struct grub_term_output *term,
|
|||
int ret;
|
||||
ret = print_ucs4_terminal (state->backlog_ucs4,
|
||||
state->backlog_ucs4 + state->backlog_len,
|
||||
margin_left, margin_right, term, state);
|
||||
margin_left, margin_right, term, state, 0);
|
||||
if (!ret)
|
||||
{
|
||||
grub_free (state->free);
|
||||
|
@ -706,15 +717,19 @@ static int
|
|||
print_ucs4_real (const grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position,
|
||||
int margin_left, int margin_right,
|
||||
struct grub_term_output *term, int backlog)
|
||||
struct grub_term_output *term, int backlog,
|
||||
int dry_run)
|
||||
{
|
||||
struct term_state *state = NULL;
|
||||
|
||||
if (backlog)
|
||||
state = find_term_state (term);
|
||||
if (!dry_run)
|
||||
{
|
||||
if (backlog)
|
||||
state = find_term_state (term);
|
||||
|
||||
if (((term->getxy (term) >> 8) & 0xff) < margin_left)
|
||||
grub_print_spaces (term, margin_left - ((term->getxy (term) >> 8) & 0xff));
|
||||
if (((term->getxy (term) >> 8) & 0xff) < margin_left)
|
||||
grub_print_spaces (term, margin_left - ((term->getxy (term) >> 8) & 0xff));
|
||||
}
|
||||
|
||||
if ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
== GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS
|
||||
|
@ -743,16 +758,30 @@ print_ucs4_real (const grub_uint32_t * str,
|
|||
grub_print_error ();
|
||||
return 0;
|
||||
}
|
||||
ret = put_glyphs_terminal (visual, visual_len, margin_left, margin_right,
|
||||
term, state);
|
||||
if (!ret)
|
||||
grub_free (visual);
|
||||
if (dry_run)
|
||||
{
|
||||
struct grub_unicode_glyph *vptr;
|
||||
ret = 0;
|
||||
for (vptr = visual; vptr < visual + visual_len; vptr++)
|
||||
if (vptr->base == '\n')
|
||||
ret++;
|
||||
if (visual_len && visual[visual_len - 1].base != '\n')
|
||||
ret++;
|
||||
grub_free (visual);
|
||||
}
|
||||
else
|
||||
state->free = visual;
|
||||
{
|
||||
ret = put_glyphs_terminal (visual, visual_len, margin_left,
|
||||
margin_right, term, state);
|
||||
if (!ret)
|
||||
grub_free (visual);
|
||||
else
|
||||
state->free = visual;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return print_ucs4_terminal (str, last_position, margin_left, margin_right,
|
||||
term, state);
|
||||
term, state, dry_run);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -762,9 +791,18 @@ grub_print_ucs4 (const grub_uint32_t * str,
|
|||
struct grub_term_output *term)
|
||||
{
|
||||
print_ucs4_real (str, last_position, margin_left, margin_right,
|
||||
term, 0);
|
||||
term, 0, 0);
|
||||
}
|
||||
|
||||
int
|
||||
grub_ucs4_count_lines (const grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position,
|
||||
int margin_left, int margin_right,
|
||||
struct grub_term_output *term)
|
||||
{
|
||||
return print_ucs4_real (str, last_position, margin_left, margin_right,
|
||||
term, 0, 1);
|
||||
}
|
||||
|
||||
void
|
||||
grub_xputs_normal (const char *str)
|
||||
|
@ -813,7 +851,7 @@ grub_xputs_normal (const char *str)
|
|||
{
|
||||
int cur;
|
||||
cur = print_ucs4_real (unicode_str, unicode_last_position, 0, 0,
|
||||
term, grub_more);
|
||||
term, grub_more, 0);
|
||||
if (cur)
|
||||
backlog = 1;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ int
|
|||
grub_script_lexer_yywrap (struct grub_parser_param *parserstate,
|
||||
const char *input)
|
||||
{
|
||||
int len;
|
||||
int len = 0;
|
||||
char *p = 0;
|
||||
char *line = 0;
|
||||
YY_BUFFER_STATE buffer;
|
||||
|
|
|
@ -147,6 +147,7 @@ argument : "case" { $$ = grub_script_add_arglist (state, 0, $1); }
|
|||
| "until" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| "while" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| "function" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| "time" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| word { $$ = $1; }
|
||||
;
|
||||
|
||||
|
|
|
@ -330,6 +330,11 @@ set_scancodes (void)
|
|||
return;
|
||||
}
|
||||
|
||||
#if !(defined (GRUB_MACHINE_MIPS_YEELOONG) || defined (GRUB_MACHINE_QEMU))
|
||||
current_set = 1;
|
||||
return;
|
||||
#endif
|
||||
|
||||
grub_keyboard_controller_write (grub_keyboard_controller_orig
|
||||
& ~KEYBOARD_AT_TRANSLATE);
|
||||
|
||||
|
|
|
@ -532,21 +532,8 @@ dirty_region_is_empty (void)
|
|||
}
|
||||
|
||||
static void
|
||||
dirty_region_add (int x, int y, unsigned int width, unsigned int height)
|
||||
dirty_region_add_real (int x, int y, unsigned int width, unsigned int height)
|
||||
{
|
||||
if ((width == 0) || (height == 0))
|
||||
return;
|
||||
|
||||
if (repaint_scheduled)
|
||||
{
|
||||
x = virtual_screen.offset_x;
|
||||
y = virtual_screen.offset_y;
|
||||
width = virtual_screen.width;
|
||||
height = virtual_screen.height;
|
||||
repaint_scheduled = 0;
|
||||
repaint_was_scheduled = 1;
|
||||
}
|
||||
|
||||
if (dirty_region_is_empty ())
|
||||
{
|
||||
dirty_region.top_left_x = x;
|
||||
|
@ -567,6 +554,22 @@ dirty_region_add (int x, int y, unsigned int width, unsigned int height)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dirty_region_add (int x, int y, unsigned int width, unsigned int height)
|
||||
{
|
||||
if ((width == 0) || (height == 0))
|
||||
return;
|
||||
|
||||
if (repaint_scheduled)
|
||||
{
|
||||
dirty_region_add_real (virtual_screen.offset_x, virtual_screen.offset_y,
|
||||
virtual_screen.width, virtual_screen.height);
|
||||
repaint_scheduled = 0;
|
||||
repaint_was_scheduled = 1;
|
||||
}
|
||||
dirty_region_add_real (x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
dirty_region_add_virtualscreen (void)
|
||||
{
|
||||
|
@ -945,6 +948,8 @@ calculate_normal_character_width (grub_font_t font)
|
|||
if (glyph->device_width > width)
|
||||
width = glyph->device_width;
|
||||
}
|
||||
if (!width)
|
||||
return 8;
|
||||
|
||||
return width;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ static const struct grub_arg_option options[] =
|
|||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
struct grub_serial_port *grub_serial_ports;
|
||||
static struct grub_serial_port *grub_serial_ports;
|
||||
|
||||
struct grub_serial_output_state
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ serial_fetch (grub_term_input_t term)
|
|||
return data->port->driver->fetch (data->port);
|
||||
}
|
||||
|
||||
const struct grub_serial_input_state grub_serial_terminfo_input_template =
|
||||
static const struct grub_serial_input_state grub_serial_terminfo_input_template =
|
||||
{
|
||||
.tinfo =
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ const struct grub_serial_input_state grub_serial_terminfo_input_template =
|
|||
}
|
||||
};
|
||||
|
||||
const struct grub_serial_output_state grub_serial_terminfo_output_template =
|
||||
static const struct grub_serial_output_state grub_serial_terminfo_output_template =
|
||||
{
|
||||
.tinfo =
|
||||
{
|
||||
|
@ -87,11 +87,11 @@ const struct grub_serial_output_state grub_serial_terminfo_output_template =
|
|||
}
|
||||
};
|
||||
|
||||
struct grub_serial_input_state grub_serial_terminfo_input;
|
||||
static struct grub_serial_input_state grub_serial_terminfo_input;
|
||||
|
||||
struct grub_serial_output_state grub_serial_terminfo_output;
|
||||
static struct grub_serial_output_state grub_serial_terminfo_output;
|
||||
|
||||
int registered = 0;
|
||||
static int registered = 0;
|
||||
|
||||
static struct grub_term_input grub_serial_term_input =
|
||||
{
|
||||
|
|
|
@ -435,7 +435,7 @@ grub_usb_keyboard_getkeystatus (struct grub_term_input *term)
|
|||
return interpret_status (termdata->status) | termdata->mods;
|
||||
}
|
||||
|
||||
struct grub_usb_attach_desc attach_hook =
|
||||
static struct grub_usb_attach_desc attach_hook =
|
||||
{
|
||||
.class = GRUB_USB_CLASS_HID,
|
||||
.hook = grub_usb_keyboard_attach
|
||||
|
|
|
@ -177,7 +177,7 @@ match_extension (const char *filename, const char *ext)
|
|||
|
||||
pos -= ext_len;
|
||||
|
||||
return grub_strcmp (filename + pos, ext) == 0;
|
||||
return grub_strcasecmp (filename + pos, ext) == 0;
|
||||
}
|
||||
|
||||
/* Loads bitmap using registered bitmap readers. */
|
||||
|
|
|
@ -199,7 +199,8 @@ grub_video_bochs_set_palette (unsigned int start, unsigned int count,
|
|||
|
||||
static grub_err_t
|
||||
grub_video_bochs_setup (unsigned int width, unsigned int height,
|
||||
unsigned int mode_type, unsigned int mode_mask)
|
||||
grub_video_mode_type_t mode_type,
|
||||
grub_video_mode_type_t mode_mask)
|
||||
{
|
||||
int depth;
|
||||
grub_err_t err;
|
||||
|
|
|
@ -235,7 +235,8 @@ grub_video_cirrus_set_palette (unsigned int start, unsigned int count,
|
|||
|
||||
static grub_err_t
|
||||
grub_video_cirrus_setup (unsigned int width, unsigned int height,
|
||||
unsigned int mode_type, unsigned int mode_mask)
|
||||
grub_video_mode_type_t mode_type,
|
||||
grub_video_mode_type_t mode_mask)
|
||||
{
|
||||
int depth;
|
||||
grub_err_t err;
|
||||
|
|
|
@ -1445,13 +1445,16 @@ grub_video_fb_setup (unsigned int mode_type, unsigned int mode_mask,
|
|||
GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED,
|
||||
0))
|
||||
{
|
||||
/* It was much nicer with the cast directly at function call but
|
||||
some older gcc versions don't accept it properly.*/
|
||||
void *tmp = (void *) page0_ptr;
|
||||
mode_info->mode_type |= (GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED
|
||||
| GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP);
|
||||
|
||||
err = grub_video_fb_doublebuf_blit_init (&framebuffer.front_target,
|
||||
&framebuffer.back_target,
|
||||
*mode_info,
|
||||
(void *) page0_ptr);
|
||||
tmp);
|
||||
|
||||
if (!err)
|
||||
{
|
||||
|
@ -1505,6 +1508,20 @@ grub_video_fb_get_info_and_fini (struct grub_video_mode_info *mode_info,
|
|||
{
|
||||
grub_memcpy (mode_info, &(framebuffer.front_target->mode_info),
|
||||
sizeof (*mode_info));
|
||||
|
||||
/* We are about to load a kernel. Switch back to page zero, since some
|
||||
kernel drivers expect that. */
|
||||
if ((mode_info->mode_type & GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED)
|
||||
&& framebuffer.set_page && framebuffer.displayed_page != 0)
|
||||
{
|
||||
/* Ensure both pages are exactly in sync. */
|
||||
grub_memcpy (framebuffer.back_target->data,
|
||||
framebuffer.front_target->data,
|
||||
framebuffer.back_target->mode_info.pitch
|
||||
* framebuffer.back_target->mode_info.height);
|
||||
grub_video_swap_buffers ();
|
||||
}
|
||||
|
||||
*framebuf = framebuffer.front_target->data;
|
||||
|
||||
grub_video_fb_fini ();
|
||||
|
|
|
@ -688,7 +688,8 @@ grub_video_vbe_iterate (int (*hook) (const struct grub_video_mode_info *info))
|
|||
|
||||
static grub_err_t
|
||||
grub_video_vbe_setup (unsigned int width, unsigned int height,
|
||||
unsigned int mode_type, unsigned int mode_mask)
|
||||
grub_video_mode_type_t mode_type,
|
||||
grub_video_mode_type_t mode_mask)
|
||||
{
|
||||
grub_uint16_t *p;
|
||||
struct grub_vbe_mode_info_block vbe_mode_info;
|
||||
|
|
|
@ -116,7 +116,8 @@ grub_video_vga_init (void)
|
|||
|
||||
static grub_err_t
|
||||
grub_video_vga_setup (unsigned int width, unsigned int height,
|
||||
unsigned int mode_type, unsigned int mode_mask)
|
||||
grub_video_mode_type_t mode_type,
|
||||
grub_video_mode_type_t mode_mask)
|
||||
{
|
||||
grub_err_t err;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue