merge mainline into legacy_parser
This commit is contained in:
commit
0cb2f2813f
124 changed files with 3369 additions and 1991 deletions
|
@ -231,7 +231,6 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
{
|
||||
int curarg;
|
||||
int arglen;
|
||||
int complete = 0;
|
||||
char **argl = 0;
|
||||
int num = 0;
|
||||
auto grub_err_t add_arg (char *s);
|
||||
|
@ -258,7 +257,8 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
char *option = 0;
|
||||
|
||||
/* No option is used. */
|
||||
if (arg[0] != '-' || grub_strlen (arg) == 1)
|
||||
if ((num && GRUB_COMMAND_OPTIONS_AT_START)
|
||||
|| arg[0] != '-' || grub_strlen (arg) == 1)
|
||||
{
|
||||
if (add_arg (arg) != 0)
|
||||
goto fail;
|
||||
|
@ -269,11 +269,28 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
/* One or more short options. */
|
||||
if (arg[1] != '-')
|
||||
{
|
||||
char *curshort = arg + 1;
|
||||
char *curshort;
|
||||
|
||||
if (cmd->cmd->flags & GRUB_COMMAND_ACCEPT_DASH)
|
||||
{
|
||||
for (curshort = arg + 1; *curshort; curshort++)
|
||||
if (!find_short (cmd->options, *curshort))
|
||||
break;
|
||||
|
||||
if (*curshort)
|
||||
{
|
||||
if (add_arg (arg) != 0)
|
||||
goto fail;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
curshort = arg + 1;
|
||||
|
||||
while (1)
|
||||
{
|
||||
opt = find_short (cmd->options, *curshort);
|
||||
|
||||
if (! opt)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
|
@ -330,6 +347,14 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
}
|
||||
|
||||
opt = find_long (cmd->options, arg + 2, arglen);
|
||||
|
||||
if (!opt && (cmd->cmd->flags & GRUB_COMMAND_ACCEPT_DASH))
|
||||
{
|
||||
if (add_arg (arg) != 0)
|
||||
goto fail;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! opt)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown argument `%s'", arg);
|
||||
|
@ -398,13 +423,12 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|||
}
|
||||
}
|
||||
|
||||
complete = 1;
|
||||
|
||||
*args = argl;
|
||||
*argnum = num;
|
||||
return 1;
|
||||
|
||||
fail:
|
||||
return complete;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct grub_arg_list*
|
||||
|
|
|
@ -22,11 +22,13 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/acpi.h>
|
||||
|
||||
void
|
||||
grub_halt (void)
|
||||
{
|
||||
grub_machine_fini ();
|
||||
grub_acpi_halt ();
|
||||
efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
|
||||
GRUB_EFI_RESET_SHUTDOWN, GRUB_EFI_SUCCESS, 0, NULL);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/acpi.h>
|
||||
|
||||
const char bochs_shutdown[] = "Shutdown";
|
||||
|
||||
|
@ -40,6 +41,10 @@ grub_halt (void)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT)
|
||||
grub_acpi_halt ();
|
||||
#endif
|
||||
|
||||
/* Disable interrupts. */
|
||||
__asm__ __volatile__ ("cli");
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ static enum xz_ret dec_block(struct xz_dec *s, struct xz_buf *b)
|
|||
s->block.hash.uncompressed += s->block.uncompressed;
|
||||
|
||||
GRUB_MD_CRC32->write(s->block.hash.crc32_context,
|
||||
(const uint8_t *)&s->block.hash, sizeof(s->block.hash));
|
||||
(const uint8_t *)&s->block.hash, 2 * sizeof(vli_type));
|
||||
|
||||
++s->block.count;
|
||||
}
|
||||
|
@ -329,8 +329,7 @@ static enum xz_ret dec_index(struct xz_dec *s, struct xz_buf *b)
|
|||
s->index.hash.uncompressed += s->vli;
|
||||
|
||||
GRUB_MD_CRC32->write(s->index.hash.crc32_context,
|
||||
(const uint8_t *)&s->index.hash,
|
||||
sizeof(s->index.hash));
|
||||
(const uint8_t *)&s->index.hash, 2 * sizeof(vli_type));
|
||||
|
||||
--s->index.count;
|
||||
s->index.sequence = SEQ_INDEX_UNPADDED;
|
||||
|
@ -671,8 +670,17 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
|
|||
index_update(s, b);
|
||||
|
||||
/* Compare the hashes to validate the Index field. */
|
||||
if (! memeq(&s->block.hash, &s->index.hash, sizeof(s->block.hash)))
|
||||
GRUB_MD_CRC32->final(s->block.hash.crc32_context);
|
||||
GRUB_MD_CRC32->final(s->index.hash.crc32_context);
|
||||
uint32_t block_crc = *(uint32_t*)GRUB_MD_CRC32->read(s->block.hash.crc32_context);
|
||||
uint32_t index_crc = *(uint32_t*)GRUB_MD_CRC32->read(s->index.hash.crc32_context);
|
||||
|
||||
if (s->block.hash.unpadded != s->index.hash.unpadded
|
||||
|| s->block.hash.uncompressed != s->index.hash.uncompressed
|
||||
|| block_crc != index_crc)
|
||||
{
|
||||
return XZ_DATA_ERROR;
|
||||
}
|
||||
|
||||
s->sequence = SEQ_INDEX_CRC32;
|
||||
|
||||
|
@ -853,6 +861,9 @@ void xz_dec_end(struct xz_dec *s)
|
|||
{
|
||||
if (s != NULL) {
|
||||
xz_dec_lzma2_end(s->lzma2);
|
||||
kfree(s->index.hash.crc32_context);
|
||||
kfree(s->block.hash.crc32_context);
|
||||
kfree(s->crc32_context);
|
||||
#ifdef XZ_DEC_BCJ
|
||||
xz_dec_bcj_end(s->bcj);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue