grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Colin Watson <cjwatson@ubuntu.com>
To: grub-devel@gnu.org
Subject: Re: cmosclean command name
Date: Sat, 28 Dec 2013 02:31:48 +0000	[thread overview]
Message-ID: <20131228023147.GA5371@riva.ucam.org> (raw)
In-Reply-To: <1388117049.918.70.camel@opensuse.site>

On Fri, Dec 27, 2013 at 08:04:09AM +0400, Andrey Borzenkov wrote:
> В Пт, 27/12/2013 в 02:22 +0000, Colin Watson пишет:
> > While writing up NEWS entries for 2.02, I noticed a slight irregularity
> > in grub-core/commands/i386/cmostest.c: the "cmosclean" command is
> > described as "Clear bit at BYTE:BIT in CMOS.".  Wouldn't the command be
> > better named "cmosclear" rather than "cmosclean"?  "Clean" is an odd
> > verb to use for this in English.
> 
> Sounds fine and is better counterpart to"cmosset".

I realised that I was wrong that it was introduced in 2.02, though; it
was in fact new in 1.99, so it needs more of an effort at compatibility.
What do people think of this?

	* Rename "cmosclean" command to "cmosclear", leaving an alias for
	  compatibility.  Similarly, rename "GRUB_BUTTON_CMOS_CLEAN" to
	  "GRUB_BUTTON_CMOS_CLEAR" and leave an alias.

diff --git a/docs/grub.texi b/docs/grub.texi
index 46b9e7f..145f051 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -3771,7 +3771,7 @@ you forget a command, you can run the command @command{help}
 * cat::                         Show the contents of a file
 * chainloader::                 Chain-load another boot loader
 * clear::                       Clear the screen
-* cmosclean::                   Clear bit in CMOS
+* cmosclear::                   Clear bit in CMOS
 * cmosdump::                    Dump CMOS contents
 * cmostest::                    Test bit in CMOS
 * cmp::                         Compare two files
@@ -3986,12 +3986,14 @@ Clear the screen.
 @end deffn
 
 
-@node cmosclean
-@subsection cmosclean
+@node cmosclear
+@subsection cmosclear
 
-@deffn Command cmosclean byte:bit
+@deffn Command cmosclear byte:bit
 Clear value of bit in CMOS at location @var{byte}:@var{bit}. This command
 is available only on platforms that support CMOS.
+
+(Backward compatibility alias: cmosclean.)
 @end deffn
 
 
@@ -5717,7 +5719,7 @@ Advanced operations for power users:
 Miscelaneous:
 @itemize
 @item cmos (x86-*, ieee1275, mips-qemu_mips, mips-loongson): cmostest
-    (used on some laptops to check for special power-on key), cmosclean
+    (used on some laptops to check for special power-on key), cmosclear
 @item i386-pc: play
 @end itemize
 
diff --git a/grub-core/commands/i386/cmostest.c b/grub-core/commands/i386/cmostest.c
index e5dea07..fb8ebec 100644
--- a/grub-core/commands/i386/cmostest.c
+++ b/grub-core/commands/i386/cmostest.c
@@ -64,7 +64,7 @@ grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
 }
 
 static grub_err_t
-grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)),
+grub_cmd_cmosclear (struct grub_command *cmd __attribute__ ((unused)),
 		    int argc, char *argv[])
 {
   int byte, bit;
@@ -99,7 +99,7 @@ grub_cmd_cmosset (struct grub_command *cmd __attribute__ ((unused)),
   return grub_cmos_write (byte, value | (1 << bit));
 }
 
-static grub_command_t cmd, cmd_clean, cmd_set;
+static grub_command_t cmd, cmd_clear, cmd_clean, cmd_set;
 
 \f
 GRUB_MOD_INIT(cmostest)
@@ -107,7 +107,11 @@ GRUB_MOD_INIT(cmostest)
   cmd = grub_register_command ("cmostest", grub_cmd_cmostest,
 			       N_("BYTE:BIT"),
 			       N_("Test bit at BYTE:BIT in CMOS."));
-  cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean,
+  cmd_clear = grub_register_command ("cmosclear", grub_cmd_cmosclear,
+				     N_("BYTE:BIT"),
+				     N_("Clear bit at BYTE:BIT in CMOS."));
+  /* Backward compatibility alias.  */
+  cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclear,
 				     N_("BYTE:BIT"),
 				     N_("Clear bit at BYTE:BIT in CMOS."));
   cmd_set = grub_register_command ("cmosset", grub_cmd_cmosset,
@@ -119,6 +123,7 @@ GRUB_MOD_INIT(cmostest)
 GRUB_MOD_FINI(cmostest)
 {
   grub_unregister_command (cmd);
+  grub_unregister_command (cmd_clear);
   grub_unregister_command (cmd_clean);
   grub_unregister_command (cmd_set);
 }
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index ca040dd..a5f2cf2 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -174,6 +174,11 @@ GRUB_ACTUAL_DEFAULT="$GRUB_DEFAULT"
 
 if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub_editenv}" - list | sed -n '/^saved_entry=/ s,^saved_entry=,,p'`" ; fi
 
+if [ "x${GRUB_BUTTON_CMOS_CLEAR}" = x ] && \
+   [ "x${GRUB_BUTTON_CMOS_CLEAN}" != x ]; then
+    GRUB_BUTTON_CMOS_CLEAR="${GRUB_BUTTON_CMOS_CLEAN}"
+fi
+
 
 # These are defined in this script, export them here so that user can
 # override them.
@@ -197,7 +202,7 @@ export GRUB_DEFAULT \
   GRUB_TIMEOUT_BUTTON \
   GRUB_TIMEOUT_STYLE_BUTTON \
   GRUB_BUTTON_CMOS_ADDRESS \
-  GRUB_BUTTON_CMOS_CLEAN \
+  GRUB_BUTTON_CMOS_CLEAR \
   GRUB_DISTRIBUTOR \
   GRUB_CMDLINE_LINUX \
   GRUB_CMDLINE_LINUX_DEFAULT \
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 0c82f23..8e920c3 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -340,9 +340,9 @@ else
 make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
 fi
 
-if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then
+if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAR" = "xyes" ]; then
     cat <<EOF
-cmosclean $GRUB_BUTTON_CMOS_ADDRESS
+cmosclear $GRUB_BUTTON_CMOS_ADDRESS
 EOF
 fi
 

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


  reply	other threads:[~2013-12-28  2:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-27  2:22 cmosclean command name Colin Watson
2013-12-27  4:04 ` Andrey Borzenkov
2013-12-28  2:31   ` Colin Watson [this message]
2013-12-28  5:18     ` Andrey Borzenkov

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=20131228023147.GA5371@riva.ucam.org \
    --to=cjwatson@ubuntu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).