* include/grub/command.h (GRUB_COMMAND_FLAG_CMDLINE): Removed. All

users updated.
	(GRUB_COMMAND_FLAG_MENU): Likewise.
	(GRUB_COMMAND_FLAG_BOTH): Likewise.
	(GRUB_COMMAND_FLAG_TITLE): Removed.
	(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
	(GRUB_COMMAND_FLAG_EXTCMD): Moved into enum.
	(GRUB_COMMAND_FLAG_DYNCMD): Likewise.
	(GRUB_COMMAND_FLAG_BLOCKS): Likewise.
	(grub_command_flags_t): New enum. All users updated.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-14 23:06:01 +02:00
parent 5fe7620a4e
commit ed80f7d586
39 changed files with 76 additions and 104 deletions

View file

@ -1,3 +1,16 @@
2010-09-14 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/command.h (GRUB_COMMAND_FLAG_CMDLINE): Removed. All
users updated.
(GRUB_COMMAND_FLAG_MENU): Likewise.
(GRUB_COMMAND_FLAG_BOTH): Likewise.
(GRUB_COMMAND_FLAG_TITLE): Removed.
(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
(GRUB_COMMAND_FLAG_EXTCMD): Moved into enum.
(GRUB_COMMAND_FLAG_DYNCMD): Likewise.
(GRUB_COMMAND_FLAG_BLOCKS): Likewise.
(grub_command_flags_t): New enum. All users updated.
2010-09-14 Seth Goldberg <seth.goldberg@oracle.com>
Fix solaris compilation.

View file

@ -758,8 +758,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(acpi)
{
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, 0,
N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
"--load-only=table1,table2] FILE1"
" [FILE2] [...]"),

View file

@ -91,7 +91,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(cat)
{
cmd = grub_register_extcmd ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("cat", grub_cmd_cat, 0,
N_("FILE"), N_("Show the contents of a file."),
options);
}

View file

@ -113,7 +113,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(echo)
{
cmd = grub_register_extcmd ("echo", grub_cmd_echo, GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("echo", grub_cmd_echo, 0,
N_("[-e|-n] STRING"), N_("Display a line of text."),
options);
}

View file

@ -66,7 +66,7 @@ grub_extcmd_dispatch (struct grub_command *cmd, int argc, char **args)
grub_extcmd_t
grub_register_extcmd_prio (const char *name, grub_extcmd_func_t func,
unsigned flags, const char *summary,
grub_command_flags_t flags, const char *summary,
const char *description,
const struct grub_arg_option *parser,
int prio)
@ -99,7 +99,7 @@ grub_register_extcmd_prio (const char *name, grub_extcmd_func_t func,
grub_extcmd_t
grub_register_extcmd (const char *name, grub_extcmd_func_t func,
unsigned flags, const char *summary,
grub_command_flags_t flags, const char *summary,
const char *description,
const struct grub_arg_option *parser)
{

View file

@ -252,26 +252,22 @@ static grub_extcmd_t cmd, cmd_md5, cmd_sha256, cmd_sha512;
GRUB_MOD_INIT(hashsum)
{
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum, 0,
"hashsum -h HASH [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
options);
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum, 0,
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."),
options);
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum, 0,
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
"Compute or check hash checksum.",
options);
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum, 0,
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."),

View file

@ -409,8 +409,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(hdparm)
{
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm, 0,
N_("[OPTIONS] DISK"),
N_("Get/set ATA disk parameters."), options);
}

View file

@ -38,8 +38,7 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
grub_command_t cmd;
FOR_COMMANDS(cmd)
{
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE))
{
struct grub_term_output *term;
const char *summary_translated = _(cmd->summary);
@ -131,8 +130,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(help)
{
cmd = grub_register_extcmd ("help", grub_cmd_help,
GRUB_COMMAND_FLAG_CMDLINE,
cmd = grub_register_extcmd ("help", grub_cmd_help, 0,
N_("[PATTERN ...]"),
N_("Show a help message."), 0);
}

View file

@ -119,8 +119,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT (hexdump)
{
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump, 0,
N_("[OPTIONS] FILE_OR_DEVICE"),
N_("Dump the contents of a file or memory."),
options);

View file

@ -88,7 +88,7 @@ GRUB_MOD_INIT(cpuid)
done:
#endif
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, 0,
"[-l]", N_("Check for CPU features."), options);
}

View file

@ -401,8 +401,7 @@ GRUB_MOD_INIT (drivemap)
{
grub_get_root_biosnumber_saved = grub_get_root_biosnumber;
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap, 0,
N_("-l | -r | [-s] grubdev osdisk."),
N_("Manage the BIOS drive mappings."),
options);

View file

@ -114,8 +114,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(halt)
{
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
"[-n]",
cmd = grub_register_extcmd ("halt", grub_cmd_halt, 0, "[-n]",
N_("Halt the system, if possible using APM."),
options);
}

View file

@ -366,8 +366,7 @@ static void *preboot_hook;
GRUB_MOD_INIT (sendkey)
{
cmd = grub_register_extcmd ("sendkey", grub_cmd_sendkey,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("sendkey", grub_cmd_sendkey, 0,
"sendkey [KEYSTROKE1] [KEYSTROKE2] ...",
"Emulate a keystroke", options);

View file

@ -117,13 +117,13 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
GRUB_MOD_INIT(memrw)
{
cmd_read_byte =
grub_register_extcmd ("inb", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
grub_register_extcmd ("inb", grub_cmd_read, 0,
N_("PORT"), N_("Read byte from PORT."), options);
cmd_read_word =
grub_register_extcmd ("inw", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
grub_register_extcmd ("inw", grub_cmd_read, 0,
N_("PORT"), N_("Read word from PORT."), options);
cmd_read_dword =
grub_register_extcmd ("inl", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
grub_register_extcmd ("inl", grub_cmd_read, 0,
N_("PORT"), N_("Read dword from PORT."), options);
cmd_write_byte =
grub_register_command ("outb", grub_cmd_write,

View file

@ -80,8 +80,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(keystatus)
{
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus, 0,
N_("[--shift] [--ctrl] [--alt]"),
N_("Check key modifier status."),
options);

View file

@ -375,20 +375,15 @@ static grub_extcmd_t cmd_load, cmd_list, cmd_save;
GRUB_MOD_INIT(loadenv)
{
cmd_load =
grub_register_extcmd ("load_env", grub_cmd_load_env,
GRUB_COMMAND_FLAG_BOTH,
N_("[-f FILE]"),
grub_register_extcmd ("load_env", grub_cmd_load_env, 0, N_("[-f FILE]"),
N_("Load variables from environment block file."),
options);
cmd_list =
grub_register_extcmd ("list_env", grub_cmd_list_env,
GRUB_COMMAND_FLAG_BOTH,
N_("[-f FILE]"),
grub_register_extcmd ("list_env", grub_cmd_list_env, 0, N_("[-f FILE]"),
N_("List variables from environment block file."),
options);
cmd_save =
grub_register_extcmd ("save_env", grub_cmd_save_env,
GRUB_COMMAND_FLAG_BOTH,
grub_register_extcmd ("save_env", grub_cmd_save_env, 0,
N_("[-f FILE] variable_name [...]"),
N_("Save variables to environment block file."),
options);

View file

@ -269,7 +269,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(ls)
{
cmd = grub_register_extcmd ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("ls", grub_cmd_ls, 0,
N_("[-l|-h|-a] [FILE]"),
N_("List devices and files."), options);
}

View file

@ -238,8 +238,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(lsapi)
{
cmd = grub_register_extcmd ("lsacpi", grub_cmd_lsacpi, GRUB_COMMAND_FLAG_BOTH,
N_("[-1|-2]"),
cmd = grub_register_extcmd ("lsacpi", grub_cmd_lsacpi, 0, N_("[-1|-2]"),
N_("Show ACPI information."), options);
}

View file

@ -224,8 +224,8 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(lspci)
{
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
"[-i]", N_("List PCI devices."), options);
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, 0, "[-i]",
N_("List PCI devices."), options);
}
GRUB_MOD_FINI(lspci)

View file

@ -119,13 +119,13 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
GRUB_MOD_INIT(memrw)
{
cmd_read_byte =
grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
grub_register_extcmd ("read_byte", grub_cmd_read, 0,
N_("ADDR"), N_("Read byte from ADDR."), options);
cmd_read_word =
grub_register_extcmd ("read_word", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
grub_register_extcmd ("read_word", grub_cmd_read, 0,
N_("ADDR"), N_("Read word from ADDR."), options);
cmd_read_dword =
grub_register_extcmd ("read_dword", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
grub_register_extcmd ("read_dword", grub_cmd_read, 0,
N_("ADDR"), N_("Read dword from ADDR."), options);
cmd_write_byte =
grub_register_command ("write_byte", grub_cmd_write,

View file

@ -274,7 +274,7 @@ void
grub_menu_init (void)
{
cmd = grub_register_extcmd ("menuentry", grub_cmd_menuentry,
GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_BLOCKS,
GRUB_COMMAND_FLAG_BLOCKS,
N_("BLOCK"), N_("Define a menuentry."), options);
}

View file

@ -150,8 +150,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT (probe)
{
cmd = grub_register_extcmd ("probe", grub_cmd_probe, GRUB_COMMAND_FLAG_BOTH,
N_("[DEVICE]"),
cmd = grub_register_extcmd ("probe", grub_cmd_probe, 0, N_("[DEVICE]"),
N_("Retrieve device info."), options);
}

View file

@ -136,8 +136,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(regexp)
{
cmd = grub_register_extcmd ("regexp", grub_cmd_regexp,
GRUB_COMMAND_FLAG_BOTH, N_("REGEXP STRING"),
cmd = grub_register_extcmd ("regexp", grub_cmd_regexp, 0, N_("REGEXP STRING"),
N_("Test if REGEXP matches STRING."), options);
/* Setup GRUB script wildcard translator. */

View file

@ -90,8 +90,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(search)
{
cmd =
grub_register_extcmd ("search", grub_cmd_search,
GRUB_COMMAND_FLAG_BOTH,
grub_register_extcmd ("search", grub_cmd_search, 0,
N_("[-f|-l|-u|-s|-n] [--hint HINT [--hint HINT] ...]"
" NAME"),
N_("Search devices by file, filesystem label"

View file

@ -329,7 +329,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(setpci)
{
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, 0,
N_("[-s POSITION] [-d DEVICE] [-v VAR] "
"[REGISTER][=VALUE[:MASK]]"),
N_("Manipulate PCI devices."), options);

View file

@ -101,7 +101,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(sleep)
{
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, 0,
N_("NUMBER_OF_SECONDS"),
N_("Wait for a specified number of seconds."),
options);

View file

@ -221,8 +221,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(loopback)
{
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback, 0,
N_("[-d|-p] DEVICENAME FILE."),
N_("Make a device of a file."), options);
grub_disk_dev_register (&grub_loopback_dev);

View file

@ -39,8 +39,8 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(hello)
{
cmd = grub_register_extcmd ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH,
0, N_("Say \"Hello World\"."), 0);
cmd = grub_register_extcmd ("hello", grub_cmd_hello, 0, 0,
N_("Say \"Hello World\"."), 0);
}
GRUB_MOD_FINI(hello)

View file

@ -40,7 +40,7 @@ grub_register_command_prio (const char *name,
cmd->summary = (summary) ? summary : "";
cmd->description = description;
cmd->flags = GRUB_COMMAND_FLAG_BOTH;
cmd->flags = 0;
cmd->prio = prio;
grub_prio_list_insert (GRUB_AS_PRIO_LIST_P (&grub_command_list),

View file

@ -1942,16 +1942,13 @@ GRUB_MOD_INIT (bsd)
/* Net and OpenBSD kernels are often compressed. */
grub_dl_load ("gzio");
cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd,
GRUB_COMMAND_FLAG_BOTH,
cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd, 0,
N_("FILE"), N_("Load kernel of FreeBSD."),
freebsd_opts);
cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd,
GRUB_COMMAND_FLAG_BOTH,
cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd, 0,
N_("FILE"), N_("Load kernel of OpenBSD."),
openbsd_opts);
cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd,
GRUB_COMMAND_FLAG_BOTH,
cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd, 0,
N_("FILE"), N_("Load kernel of NetBSD."),
netbsd_opts);
cmd_freebsd_loadenv =

View file

@ -1434,8 +1434,7 @@ GRUB_MOD_INIT(xnu)
"Load XNU ramdisk. "
"It will be seen as md0.");
cmd_splash = grub_register_extcmd ("xnu_splash",
grub_cmd_xnu_splash,
GRUB_COMMAND_FLAG_BOTH, 0,
grub_cmd_xnu_splash, 0, 0,
N_("Load a splash image for XNU."),
xnu_splash_cmd_options);

View file

@ -428,15 +428,12 @@ grub_normal_do_completion (char *buf, int *restore,
FOR_COMMANDS(cmd)
{
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
{
if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE)
{
if (add_completion (cmd->name, " ", GRUB_COMPLETION_TYPE_COMMAND))
goto fail;
}
}
}
}
else if (*current_word == '-')
{
if (complete_arguments (buf))

View file

@ -155,7 +155,6 @@ read_command_list (const char *prefix)
grub_dyncmd_dispatcher,
GRUB_COMMAND_FLAG_BLOCKS
| GRUB_COMMAND_FLAG_EXTCMD
| GRUB_COMMAND_FLAG_CMDLINE
| GRUB_COMMAND_FLAG_DYNCMD,
0, N_("not loaded"), 0,
prio);

View file

@ -1207,8 +1207,7 @@ GRUB_MOD_INIT(gfxterm)
grub_term_register_output ("gfxterm", &grub_video_term);
background_image_cmd_handle =
grub_register_extcmd ("background_image",
grub_gfxterm_background_image_cmd,
GRUB_COMMAND_FLAG_BOTH,
grub_gfxterm_background_image_cmd, 0,
N_("[-m (stretch|normal)] FILE"),
N_("Load background image for active terminal."),
background_image_cmd_options);

View file

@ -341,8 +341,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(serial)
{
cmd = grub_register_extcmd ("serial", grub_cmd_serial,
GRUB_COMMAND_FLAG_BOTH,
cmd = grub_register_extcmd ("serial", grub_cmd_serial, 0,
N_("[OPTIONS...]"),
N_("Configure serial port."), options);
#ifndef GRUB_MACHINE_EMU

View file

@ -37,8 +37,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT (functional_test)
{
cmd = grub_register_extcmd ("functional_test", grub_functional_test,
GRUB_COMMAND_FLAG_CMDLINE, 0,
cmd = grub_register_extcmd ("functional_test", grub_functional_test, 0, 0,
"Run all functional tests.", 0);
}

View file

@ -40,7 +40,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(test_blockarg)
{
cmd = grub_register_extcmd ("test_blockarg", test_blockarg,
GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_BLOCKS,
GRUB_COMMAND_FLAG_BLOCKS,
N_("BLOCK"),
N_("Print and execute block argument."), 0);
}

View file

@ -23,22 +23,15 @@
#include <grub/err.h>
#include <grub/list.h>
/* Can be run in the command-line. */
#define GRUB_COMMAND_FLAG_CMDLINE 0x1
/* Can be run in the menu. */
#define GRUB_COMMAND_FLAG_MENU 0x2
/* Can be run in both interfaces. */
#define GRUB_COMMAND_FLAG_BOTH 0x3
/* Only for the command title. */
#define GRUB_COMMAND_FLAG_TITLE 0x4
/* Don't print the command on booting. */
#define GRUB_COMMAND_FLAG_NO_ECHO 0x8
typedef enum grub_command_flags
{
/* This is an extended command. */
#define GRUB_COMMAND_FLAG_EXTCMD 0x10
GRUB_COMMAND_FLAG_EXTCMD = 0x10,
/* This is an dynamic command. */
#define GRUB_COMMAND_FLAG_DYNCMD 0x20
GRUB_COMMAND_FLAG_DYNCMD = 0x20,
/* This command accepts block arguments. */
#define GRUB_COMMAND_FLAG_BLOCKS 0x40
GRUB_COMMAND_FLAG_BLOCKS = 0x40
} grub_command_flags_t;
struct grub_command;
@ -61,7 +54,7 @@ struct grub_command
grub_command_func_t func;
/* The flags. */
unsigned flags;
grub_command_flags_t flags;
/* The summary of the command usage. */
const char *summary;

View file

@ -57,14 +57,14 @@ typedef struct grub_extcmd_context *grub_extcmd_context_t;
grub_extcmd_t grub_register_extcmd (const char *name,
grub_extcmd_func_t func,
unsigned flags,
grub_command_flags_t flags,
const char *summary,
const char *description,
const struct grub_arg_option *parser);
grub_extcmd_t grub_register_extcmd_prio (const char *name,
grub_extcmd_func_t func,
unsigned flags,
grub_command_flags_t flags,
const char *summary,
const char *description,
const struct grub_arg_option *parser,