2006-10-14 Yoshinori K. Okuji <okuji@enbug.org>
* DISTLIST: Added commands/echo.c, disk/lvm.c, disk/raid.c, include/grub/bitmap.h, include/grub/lvm.h, include/grub/raid.h, include/grub/i386/pc/vbeutil.h, include/grub/util/lvm.h, include/grub/util/raid.h, util/lvm.c, util/raid.c, video/bitmap.c, video/readers/tga.c and video/i386/pc/vbeutil.c. 2006-10-14 Jeroen Dekkers <jeroen@dekkers.cx> Added support for RAID and LVM. * disk/lvm.c: New file. * disk/raid.c: Likewise. * include/grub/lvm.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/raid.h: Likewise. * util/lvm.c: Likewise. * util/raid.c: Likewise. * include/grub/disk.h (grub_disk_dev_id): Add GRUB_DISK_DEVICE_RAID_ID and GRUB_DISK_DEVICE_LVM_ID. (grub_disk_get_size): New prototype. * kern/disk.c (grub_disk_open): Check whether grub_partition_probe() returns a partition. (grub_disk_get_size): New function. * kern/i386/pc/init.c (make_install_device): Copy the prefix verbatim if grub_install_dos_part is -2. * util/i386/pc/getroot.c (grub_guess_root_device): Support RAID and LVM devices. * util/i386/pc/grub-setup.c (setup): New argument MUST_EMBED. Force embedding of GRUB when the argument is true. Close FILE before returning. (main): Add support for RAID and LVM. * conf/common.rmk: Add RAID and LVM modules. * conf/i386-pc.rmk (grub_setup_SOURCES): Add util/raid.c and util/lvm.c. (grub_emu_SOURCES): Add disk/raid.c and disk/lvm.c. * kern/misc.c (grub_strstr): New function. * include/grub/misc.h (grub_strstr): New prototype.
This commit is contained in:
parent
050548d018
commit
2b00217369
23 changed files with 2347 additions and 100 deletions
48
kern/misc.c
48
kern/misc.c
|
@ -1,7 +1,7 @@
|
|||
/* misc.c - definitions of misc functions */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -256,6 +256,52 @@ grub_strrchr (const char *s, int c)
|
|||
return p;
|
||||
}
|
||||
|
||||
/* Copied from gnulib.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2005. */
|
||||
char *
|
||||
grub_strstr (const char *haystack, const char *needle)
|
||||
{
|
||||
/* Be careful not to look at the entire extent of haystack or needle
|
||||
until needed. This is useful because of these two cases:
|
||||
- haystack may be very long, and a match of needle found early,
|
||||
- needle may be very long, and not even a short initial segment of
|
||||
needle may be found in haystack. */
|
||||
if (*needle != '\0')
|
||||
{
|
||||
/* Speed up the following searches of needle by caching its first
|
||||
character. */
|
||||
char b = *needle++;
|
||||
|
||||
for (;; haystack++)
|
||||
{
|
||||
if (*haystack == '\0')
|
||||
/* No match. */
|
||||
return NULL;
|
||||
if (*haystack == b)
|
||||
/* The first character matches. */
|
||||
{
|
||||
const char *rhaystack = haystack + 1;
|
||||
const char *rneedle = needle;
|
||||
|
||||
for (;; rhaystack++, rneedle++)
|
||||
{
|
||||
if (*rneedle == '\0')
|
||||
/* Found a match. */
|
||||
return (char *) haystack;
|
||||
if (*rhaystack == '\0')
|
||||
/* No match. */
|
||||
return NULL;
|
||||
if (*rhaystack != *rneedle)
|
||||
/* Nothing in this round. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return (char *) haystack;
|
||||
}
|
||||
|
||||
int
|
||||
grub_strword (const char *haystack, const char *needle)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue