* [PATCH] Refer to kernel of FreeBSD as "kFreeBSD"
@ 2009-10-14 12:28 Robert Millan
2009-10-14 12:43 ` Colin Watson
0 siblings, 1 reply; 3+ messages in thread
From: Robert Millan @ 2009-10-14 12:28 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 665 bytes --]
This fixes some confusing command names. They weren't present in 1.96, so
I'd like to stabilize those before 1.97 release.
Note: Some string lengths were hardcoded, and they're being replaced with
sizeof() statements. I triple-checked them for off-by-one mistakes, but it
doesn't hurt if someone else reviews it. Please avoid hardcoding constant
string lengths! It makes it more error-prone to change those strings later.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
[-- Attachment #2: kfreebsd.diff --]
[-- Type: text/x-diff, Size: 4181 bytes --]
2009-10-14 Robert Millan <rmh.grub@aybabtu.com>
Refer to kernel of FreeBSD "kFreeBSD" to avoid confusion between
the Operating System (FreeBSD) and its kernel (kernel of FreeBSD).
* loader/i386/bsd.c (grub_freebsd_boot): Read kernel environment
from "kFreeBSD" namespace (rather than "FreeBSD"). Update all
users.
(GRUB_MOD_INIT (bsd)): Rename "freebsd" command to "kfreebsd",
"openbsd" to "kopenbsd", "netbsd" to "knetbsd", "freebsd_loadenv"
to "kfreebsd_loadenv", "freebsd_module" to "kfreebsd_module",
and "freebsd_module_elf" to "kfreebsd_module_elf". Update all
users.
Index: loader/i386/bsd.c
===================================================================
--- loader/i386/bsd.c (revision 2629)
+++ loader/i386/bsd.c (working copy)
@@ -444,9 +444,9 @@ grub_freebsd_boot (void)
auto int iterate_env (struct grub_env_var *var);
int iterate_env (struct grub_env_var *var)
{
- if ((!grub_memcmp (var->name, "FreeBSD.", 8)) && (var->name[8]))
+ if ((!grub_memcmp (var->name, "kFreeBSD.", sizeof("kFreeBSD.") - 1)) && (var->name[sizeof("kFreeBSD.") - 1]))
{
- grub_strcpy (p, &var->name[8]);
+ grub_strcpy (p, &var->name[sizeof("kFreeBSD.") - 1]);
p += grub_strlen (p);
*(p++) = '=';
grub_strcpy (p, var->value);
@@ -1112,12 +1112,12 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __att
if (*curr)
{
- char name[grub_strlen (curr) + 8 + 1];
+ char name[grub_strlen (curr) + sizeof("kFreeBSD.")];
if (*p == '"')
p++;
- grub_sprintf (name, "FreeBSD.%s", curr);
+ grub_sprintf (name, "kFreeBSD.%s", curr);
if (grub_env_set (name, p))
goto fail;
}
@@ -1252,26 +1252,26 @@ static grub_command_t cmd_freebsd_module_elf;
GRUB_MOD_INIT (bsd)
{
- cmd_freebsd = grub_register_extcmd ("freebsd", grub_cmd_freebsd,
+ cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd,
GRUB_COMMAND_FLAG_BOTH,
- "freebsd FILE", "Load kernel of FreeBSD.",
+ "kfreebsd FILE", "Load kernel of FreeBSD.",
freebsd_opts);
- cmd_openbsd = grub_register_extcmd ("openbsd", grub_cmd_openbsd,
+ cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd,
GRUB_COMMAND_FLAG_BOTH,
- "openbsd FILE", "Load kernel of OpenBSD.",
+ "kopenbsd FILE", "Load kernel of OpenBSD.",
openbsd_opts);
- cmd_netbsd = grub_register_extcmd ("netbsd", grub_cmd_netbsd,
+ cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd,
GRUB_COMMAND_FLAG_BOTH,
- "netbsd FILE", "Load kernel of NetBSD.",
+ "knetbsd FILE", "Load kernel of NetBSD.",
netbsd_opts);
cmd_freebsd_loadenv =
- grub_register_command ("freebsd_loadenv", grub_cmd_freebsd_loadenv,
+ grub_register_command ("kfreebsd_loadenv", grub_cmd_freebsd_loadenv,
0, "load FreeBSD env");
cmd_freebsd_module =
- grub_register_command ("freebsd_module", grub_cmd_freebsd_module,
+ grub_register_command ("kfreebsd_module", grub_cmd_freebsd_module,
0, "load FreeBSD kernel module");
cmd_freebsd_module_elf =
- grub_register_command ("freebsd_module_elf", grub_cmd_freebsd_module_elf,
+ grub_register_command ("kfreebsd_module_elf", grub_cmd_freebsd_module_elf,
0, "load FreeBSD kernel module (ELF)");
my_mod = mod;
Index: util/grub.d/10_freebsd.in
===================================================================
--- util/grub.d/10_freebsd.in (revision 2629)
+++ util/grub.d/10_freebsd.in (working copy)
@@ -60,17 +60,17 @@ menuentry "${OS}" {
EOF
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
- freebsd ${kfreebsd_rel_dirname}/${kfreebsd_basename}
+ kfreebsd ${kfreebsd_rel_dirname}/${kfreebsd_basename}
EOF
if [ x"$devices" != "x" ] ; then
cat << EOF
- freebsd_loadenv ${devices_rel_dirname}/${devices_basename}
+ kfreebsd_loadenv ${devices_rel_dirname}/${devices_basename}
EOF
fi
cat << EOF
- set FreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE}
- set FreeBSD.vfs.root.mountfrom.options=rw
+ set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE}
+ set kFreeBSD.vfs.root.mountfrom.options=rw
}
EOF
fi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Refer to kernel of FreeBSD as "kFreeBSD"
2009-10-14 12:28 [PATCH] Refer to kernel of FreeBSD as "kFreeBSD" Robert Millan
@ 2009-10-14 12:43 ` Colin Watson
2009-10-14 16:49 ` Robert Millan
0 siblings, 1 reply; 3+ messages in thread
From: Colin Watson @ 2009-10-14 12:43 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Oct 14, 2009 at 02:28:48PM +0200, Robert Millan wrote:
> Note: Some string lengths were hardcoded, and they're being replaced with
> sizeof() statements. I triple-checked them for off-by-one mistakes, but it
> doesn't hurt if someone else reviews it. Please avoid hardcoding constant
> string lengths! It makes it more error-prone to change those strings later.
I reviewed the string code and it looks fine.
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Refer to kernel of FreeBSD as "kFreeBSD"
2009-10-14 12:43 ` Colin Watson
@ 2009-10-14 16:49 ` Robert Millan
0 siblings, 0 replies; 3+ messages in thread
From: Robert Millan @ 2009-10-14 16:49 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Oct 14, 2009 at 01:43:05PM +0100, Colin Watson wrote:
> On Wed, Oct 14, 2009 at 02:28:48PM +0200, Robert Millan wrote:
> > Note: Some string lengths were hardcoded, and they're being replaced with
> > sizeof() statements. I triple-checked them for off-by-one mistakes, but it
> > doesn't hurt if someone else reviews it. Please avoid hardcoding constant
> > string lengths! It makes it more error-prone to change those strings later.
>
> I reviewed the string code and it looks fine.
Thanks Colin. I committed this.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-14 16:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-14 12:28 [PATCH] Refer to kernel of FreeBSD as "kFreeBSD" Robert Millan
2009-10-14 12:43 ` Colin Watson
2009-10-14 16:49 ` Robert Millan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.