merge commits from before Savannah compromise

This commit is contained in:
Colin Watson 2010-11-30 17:01:52 +00:00
commit 725d286634
9 changed files with 127 additions and 55 deletions

View file

@ -3,6 +3,67 @@
* grub-core/commands/echo.c: Include `<grub/term.h>'.
(grub_cmd_echo): Call grub_refresh() after printing a message.
2010-11-26 Colin Watson <cjwatson@ubuntu.com>
Fix LVM-on-RAID probing.
* util/grub-probe.c (probe): Remember which disk was detected as
RAID (perhaps an LVM physical volume). Use that disk's raidname
rather than that of the top-level disk.
2010-11-25 BVK Chaitanya <bvk.groups@gmail.com>
Fix cmdline argument quotes for setparams command of menuentry
definitions.
* grub-core/commands/menuentry.c (setparams_prefix): Use single
quotes for arguments.
* grub-core/lib/legacy_parse.c (grub_legacy_escape): Use
grub_strchrsub function instead.
* include/grub/misc.h (grub_strchrsub): New function.
2010-11-24 Colin Watson <cjwatson@ubuntu.com>
* util/deviceiter.c (grub_util_iterate_devices): Save a bit of
effort by skipping "." and ".." entries up-front.
Suggested by: Michael Lazarev.
2010-11-24 Colin Watson <cjwatson@ubuntu.com>
* grub-core/Makefile.core.def (xz_decompress): Move -lgcc from
ldflags to ldadd, to fix link line ordering.
(none_decompress): Likewise.
2010-11-24 Colin Watson <cjwatson@ubuntu.com>
* grub-core/Makefile.core.def (kernel): Add kern/emu/cache.S for emu
platforms.
(grub-emu-lite): Remove kern/emu/cache.S.
2010-11-23 Colin Watson <cjwatson@ubuntu.com>
* util/deviceiter.c (compare_devices): If the by-id link for a
device couldn't be resolved, fall back to sorting by the by-id link
rather than segfaulting.
Reported and tested by: Daniel Mierswa.
2010-11-23 Colin Watson <cjwatson@ubuntu.com>
* Makefile.util.def (grub-menulst2cfg): List libraries in ldadd, not
ldflags, to fix link line ordering.
2010-11-23 Colin Watson <cjwatson@ubuntu.com>
* grub-core/Makefile.am (gentrigtables): Put -lm after $<; some
linkers are picky about this.
2010-11-23 Colin Watson <cjwatson@ubuntu.com>
* grub-core/Makefile.am (command.lst): Adjust sed expression
ordering so that extended and priority commands aren't treated as
ordinary commands.
2010-11-23 Colin Watson <cjwatson@ubuntu.com>
* include/grub/gpt_partition.h (GRUB_GPT_PARTITION_TYPE_BIOS_BOOT):

View file

@ -620,5 +620,5 @@ program = {
ldadd = libgrubmods.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR)';
};

View file

@ -30,7 +30,7 @@ CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
# gentrigtables
gentrigtables: gentrigtables.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) -lm $<
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) $< -lm
CLEANFILES += gentrigtables
# trigtables.c
@ -237,9 +237,9 @@ command.lst: $(MARKER_FILES)
(for pp in $^; do \
b=`basename $$pp .marker`; \
sed -n \
-e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
-e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
-e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" $$pp; \
-e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
-e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
done) | sort -u > $@
platform_DATA += command.lst
CLEANFILES += command.lst

View file

@ -162,6 +162,7 @@ kernel = {
emu = disk/host.c;
emu = gnulib/progname.c;
emu = gnulib/error.c;
emu = kern/emu/cache.S;
emu = kern/emu/console.c;
emu = kern/emu/getroot.c;
emu = kern/emu/hostdisk.c;
@ -208,7 +209,6 @@ program = {
name = grub-emu-lite;
emu = kern/emu/lite.c;
emu = kern/emu/cache.S;
emu_nodist = symlist.c;
ldadd = 'kernel.img$(EXEEXT)';
@ -300,7 +300,8 @@ image = {
mips_cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1 -DGRUB_MACHINE_LINK_ADDR=0x80200000';
objcopyflags = '-O binary';
ldflags = '-lgcc -static-libgcc -Wl,-Ttext,0x80100000';
ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
ldadd = '-lgcc';
cflags = '-static-libgcc';
enable = mips;
};
@ -313,7 +314,8 @@ image = {
mips_cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1 -DGRUB_MACHINE_LINK_ADDR=0x80200000';
objcopyflags = '-O binary';
ldflags = '-lgcc -static-libgcc -Wl,-Ttext,0x80100000';
ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
ldadd = '-lgcc';
cflags = '-static-libgcc';
enable = mips;
};

View file

@ -206,20 +206,6 @@ setparams_prefix (int argc, char **args)
char *p;
char *result;
grub_size_t len = 10;
static const char *escape_characters = "\"\\";
auto char *strescpy (char *, const char *, const char *);
char * strescpy (char *d, const char *s, const char *escapes)
{
while (*s)
{
if (grub_strchr (escapes, *s))
*d++ = '\\';
*d++ = *s++;
}
*d = '\0';
return d;
}
/* Count resulting string length */
for (i = 0; i < argc; i++)
@ -227,7 +213,7 @@ setparams_prefix (int argc, char **args)
len += 3; /* 3 = 1 space + 2 quotes */
p = args[i];
while (*p)
len += grub_strchr (escape_characters, *p++) ? 2 : 1;
len += (*p++ == '\'' ? 3 : 1);
}
result = grub_malloc (len + 2);
@ -235,17 +221,17 @@ setparams_prefix (int argc, char **args)
return 0;
grub_strcpy (result, "setparams");
i = 9;
p = result + 9;
for (j = 0; j < argc; j++)
{
result[i++] = ' ';
result[i++] = '"';
i = strescpy (result + i, args[j], escape_characters) - result;
result[i++] = '"';
*p++ = ' ';
*p++ = '\'';
p = grub_strchrsub (p, args[j], '\'', "'\\''");
*p++ = '\'';
}
result[i++] = '\n';
result[i] = '\0';
*p++ = '\n';
*p = '\0';
return result;
}

View file

@ -322,30 +322,23 @@ struct legacy_command legacy_commands[] =
char *
grub_legacy_escape (const char *in, grub_size_t len)
{
const char *ptr;
char *ret, *outptr;
char *ptr;
char *ret;
char saved;
int overhead = 0;
for (ptr = in; ptr < in + len && *ptr; ptr++)
for (ptr = (char*)in; ptr < in + len && *ptr; ptr++)
if (*ptr == '\'')
overhead += 3;
ret = grub_malloc (ptr - in + overhead + 1);
if (!ret)
return NULL;
outptr = ret;
for (ptr = in; ptr < in + len && *ptr; ptr++)
{
if (*ptr == '\'')
{
*outptr++ = '\'';
*outptr++ = '\\';
*outptr++ = '\'';
*outptr++ = '\'';
continue;
}
*outptr++ = *ptr;
}
*outptr++ = 0;
ptr = (char*)in;
saved = ptr[len];
ptr[len] = '\0';
grub_strchrsub (ret, ptr, '\'', "'\\''");
ptr[len] = saved;
return ret;
}

View file

@ -193,6 +193,26 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
}
/* Replace all `ch' characters of `input' with `with' and copy the
result into `output'; return EOS address of `output'. */
static inline char *
grub_strchrsub (char *output, const char *input, char ch, const char *with)
{
grub_size_t grub_strlen (const char *s);
while (*input)
{
if (*input == ch)
{
grub_strcpy (output, with);
output += grub_strlen (with);
input++;
continue;
}
*output++ = *input++;
}
*output = '\0';
return output;
}
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);

View file

@ -485,11 +485,14 @@ compare_devices (const void *a, const void *b)
{
const struct device *left = (const struct device *) a;
const struct device *right = (const struct device *) b;
int ret;
ret = strcmp (left->kernel, right->kernel);
if (left->kernel && right->kernel)
{
int ret = strcmp (left->kernel, right->kernel);
if (ret)
return ret;
else
}
return strcmp (left->stable, right->stable);
}
#endif /* __linux__ */
@ -533,6 +536,10 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
necessary. */
for (entry = readdir (dir); entry; entry = readdir (dir))
{
/* Skip current and parent directory entries. */
if (strcmp (entry->d_name, ".") == 0 ||
strcmp (entry->d_name, "..") == 0)
continue;
/* Skip partition entries. */
if (strstr (entry->d_name, "-part"))
continue;

View file

@ -142,6 +142,7 @@ probe (const char *path, char *device_name)
int is_raid5 = 0;
int is_raid6 = 0;
int raid_level;
grub_disk_t raid_disk;
raid_level = probe_raid_level (dev->disk);
if (raid_level >= 0)
@ -149,6 +150,7 @@ probe (const char *path, char *device_name)
is_raid = 1;
is_raid5 |= (raid_level == 5);
is_raid6 |= (raid_level == 6);
raid_disk = dev->disk;
}
if ((is_lvm) && (dev->disk->dev->memberlist))
@ -161,6 +163,7 @@ probe (const char *path, char *device_name)
is_raid = 1;
is_raid5 |= (raid_level == 5);
is_raid6 |= (raid_level == 6);
raid_disk = list->disk;
}
tmp = list->next;
@ -175,8 +178,8 @@ probe (const char *path, char *device_name)
printf ("raid5rec ");
if (is_raid6)
printf ("raid6rec ");
if (dev->disk->dev->raidname)
printf ("%s ", dev->disk->dev->raidname (dev->disk));
if (raid_disk->dev->raidname)
printf ("%s ", raid_disk->dev->raidname (raid_disk));
}
if (is_lvm)