From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] Refer to kernel of FreeBSD as "kFreeBSD"
Date: Wed, 14 Oct 2009 14:28:48 +0200 [thread overview]
Message-ID: <20091014122848.GA29883@thorin> (raw)
[-- 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
next reply other threads:[~2009-10-14 12:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-14 12:28 Robert Millan [this message]
2009-10-14 12:43 ` [PATCH] Refer to kernel of FreeBSD as "kFreeBSD" Colin Watson
2009-10-14 16:49 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091014122848.GA29883@thorin \
--to=rmh@aybabtu.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.