Skip to contentSkip to conversation

cmosclean command name

DISCUSSION Colin Watson 2 participants 4 messages Dec 27, 2013 – Dec 28, 2013

lore
Share & tools
lore
#0 lore raw

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.

If we're going to rename this, we should ideally do it before 2.02.

Thanks,

Signature · 1 line
Colin Watson                                       [[email protected]]
#1 lore raw

В Пт, 27/12/2013 в 02:22 +0000, Colin Watson пишет:

Quoted 6 lines

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".

Quoted 4 lines

If we're going to rename this, we should ideally do it before 2.02.

Thanks,

#2 lore raw
Quoted 8 lines · Andrey Borzenkov

В Пт, 27/12/2013 в 02:22 +0000, Colin Watson пишет:

Quoted 5 lines

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.

docs/grub.texi +7 -5
index 46b9e7f..145f051 100644
@@ -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
 
grub-core/commands/i386/cmostest.c +8 -3
index e5dea07..fb8ebec 100644
@@ -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;
 
 
 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);
 }
util/grub-mkconfig.in +6 -1
index ca040dd..a5f2cf2 100644
@@ -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 \
util/grub.d/00_header.in +2 -2
index 0c82f23..8e920c3 100644
@@ -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,

Signature · 1 line
Colin Watson                                       [[email protected]]
#3 lore raw

В Сб, 28/12/2013 в 02:31 +0000, Colin Watson пишет:

Quoted 10 lines · Andrey Borzenkov
Quoted 8 lines

В Пт, 27/12/2013 в 02:22 +0000, Colin Watson пишет:

Quoted 5 lines

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".

Quoted 9 lines

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.

Good occasion to also add description of "GRUB_BUTTON_CMOS_CLEAR" to documentation :)