From: Felix Zielcke <fzielcke@z-51.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] add true and false commands
Date: Fri, 05 Jun 2009 15:04:22 +0200 [thread overview]
Message-ID: <1244207062.3416.45.camel@fz.local> (raw)
In-Reply-To: <87zlcmx3ws.fsf@xs4all.nl>
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]
Am Freitag, den 05.06.2009, 14:26 +0200 schrieb Marco Gerards:
> Felix Zielcke <fzielcke@z-51.de> writes:
> > So what should I do now?
> > Placing it in normal.mod or minicmd.mod where it's included in rescue
> > mode or placing it into a true.mod where the size increase would be
> > bigger?
>
> minicmd.mod is not a very descriptive name. Better call is
> truefalse.mod or something like that.
minicmd.mod already exists, see commands/minicmd.c (or my first patch).
That's where I put it in the first patch.
Anyway here's a new one which adds true.mod which gets 1264 bytes big.
Thanks Marco that you take the time for it.
--
Felix Zielcke
[-- Attachment #2: true_false.patch.4 --]
[-- Type: text/plain, Size: 2948 bytes --]
2009-06-05 Felix Zielcke <fzielcke@z-51.de>
* commands/true.c: New file. Implement the true and false commands.
* conf/common.rmk.c (pkglib_MODULES): Add `true.mod'.
(true_mod_SOURCES): New variable.
(true_mod_CFLAGS): Likewise.
(true_mod_LDFLAGS): Likewise.
diff --git a/commands/true.c b/commands/true.c
index e69de29..16ca315 100644
--- a/commands/true.c
+++ b/commands/true.c
@@ -0,0 +1,56 @@
+/* true.c - true and false commands. */
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2009 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/dl.h>
+#include <grub/command.h>
+
+static grub_err_t
+grub_cmd_true (struct grub_command *cmd __attribute__ ((unused)),
+ int argc __attribute__ ((unused)),
+ char *argv[] __attribute__ ((unused)))
+{
+ return 0;
+}
+
+static grub_err_t
+grub_cmd_false (struct grub_command *cmd __attribute__ ((unused)),
+ int argc __attribute__ ((unused)),
+ char *argv[] __attribute__ ((unused)))
+{
+ return grub_error (GRUB_ERR_TEST_FAILURE, "false");
+}
+
+static grub_command_t cmd_true, cmd_false;
+
+\f
+GRUB_MOD_INIT(true)
+{
+ cmd_true =
+ grub_register_command ("true", grub_cmd_true,
+ 0, "do nothing, successfully");
+ cmd_false =
+ grub_register_command ("false", grub_cmd_false,
+ 0, "do nothing, unsuccessfully");
+}
+
+GRUB_MOD_FINI(true)
+{
+ grub_unregister_command (cmd_true);
+ grub_unregister_command (cmd_false);
+}
diff --git a/conf/common.rmk b/conf/common.rmk
index ca18c53..48565bf 100644
--- a/conf/common.rmk
+++ b/conf/common.rmk
@@ -344,7 +344,7 @@ pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
terminfo.mod test.mod blocklist.mod hexdump.mod \
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
pcpart.mod memrw.mod boot.mod normal.mod sh.mod lua.mod \
- gptsync.mod
+ gptsync.mod true.mod
# For gptsync.mod.
gptsync_mod_SOURCES = commands/gptsync.c
@@ -476,6 +476,11 @@ memrw_mod_SOURCES = commands/memrw.c
memrw_mod_CFLAGS = $(COMMON_CFLAGS)
memrw_mod_LDFLAGS = $(COMMON_LDFLAGS)
+# For true.mod
+true_mod_SOURCES = commands/true.c
+true_mod_CFLAGS = $(COMMON_CFLAGS)
+true_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
# For normal.mod.
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
normal/autofs.c normal/handler.c \
next prev parent reply other threads:[~2009-06-05 13:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 12:16 [PATCH] add true and false commands Felix Zielcke
2009-05-30 15:14 ` Vladimir 'phcoder' Serbinenko
2009-06-01 14:18 ` Felix Zielcke
2009-06-01 14:24 ` Vladimir 'phcoder' Serbinenko
2009-06-03 15:45 ` Felix Zielcke
2009-06-04 8:21 ` Marco Gerards
2009-06-05 8:47 ` Felix Zielcke
2009-06-05 10:00 ` Marco Gerards
2009-06-05 10:32 ` Felix Zielcke
2009-06-05 12:26 ` Marco Gerards
2009-06-05 13:04 ` Felix Zielcke [this message]
2009-06-05 13:29 ` Marco Gerards
2009-06-05 15:56 ` Felix Zielcke
2009-06-08 7:32 ` Felix Zielcke
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=1244207062.3416.45.camel@fz.local \
--to=fzielcke@z-51.de \
--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.