* 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> 2010-09-14 Seth Goldberg <seth.goldberg@oracle.com>
Fix solaris compilation. Fix solaris compilation.

View file

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

View file

@ -91,7 +91,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(cat) 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."), N_("FILE"), N_("Show the contents of a file."),
options); options);
} }

View file

@ -113,7 +113,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(echo) 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."), N_("[-e|-n] STRING"), N_("Display a line of text."),
options); options);
} }

View file

@ -66,7 +66,7 @@ grub_extcmd_dispatch (struct grub_command *cmd, int argc, char **args)
grub_extcmd_t grub_extcmd_t
grub_register_extcmd_prio (const char *name, grub_extcmd_func_t func, 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 char *description,
const struct grub_arg_option *parser, const struct grub_arg_option *parser,
int prio) int prio)
@ -99,7 +99,7 @@ grub_register_extcmd_prio (const char *name, grub_extcmd_func_t func,
grub_extcmd_t grub_extcmd_t
grub_register_extcmd (const char *name, grub_extcmd_func_t func, 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 char *description,
const struct grub_arg_option *parser) 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) GRUB_MOD_INIT(hashsum)
{ {
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum, cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum, 0,
GRUB_COMMAND_FLAG_BOTH,
"hashsum -h HASH [-c FILE [-p PREFIX]] " "hashsum -h HASH [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]", "[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.", "Compute or check hash checksum.",
options); options);
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum, cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum, 0,
GRUB_COMMAND_FLAG_BOTH,
N_("[-c FILE [-p PREFIX]] " N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."), N_("Compute or check hash checksum."),
options); options);
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum, cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum, 0,
GRUB_COMMAND_FLAG_BOTH,
N_("[-c FILE [-p PREFIX]] " N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
"Compute or check hash checksum.", "Compute or check hash checksum.",
options); options);
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum, cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum, 0,
GRUB_COMMAND_FLAG_BOTH,
N_("[-c FILE [-p PREFIX]] " N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."), N_("Compute or check hash checksum."),

View file

@ -409,8 +409,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(hdparm) GRUB_MOD_INIT(hdparm)
{ {
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm, cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm, 0,
GRUB_COMMAND_FLAG_BOTH,
N_("[OPTIONS] DISK"), N_("[OPTIONS] DISK"),
N_("Get/set ATA disk parameters."), options); 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; grub_command_t cmd;
FOR_COMMANDS(cmd) FOR_COMMANDS(cmd)
{ {
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) && if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE))
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
{ {
struct grub_term_output *term; struct grub_term_output *term;
const char *summary_translated = _(cmd->summary); const char *summary_translated = _(cmd->summary);
@ -131,8 +130,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(help) GRUB_MOD_INIT(help)
{ {
cmd = grub_register_extcmd ("help", grub_cmd_help, cmd = grub_register_extcmd ("help", grub_cmd_help, 0,
GRUB_COMMAND_FLAG_CMDLINE,
N_("[PATTERN ...]"), N_("[PATTERN ...]"),
N_("Show a help message."), 0); N_("Show a help message."), 0);
} }

View file

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

View file

@ -88,7 +88,7 @@ GRUB_MOD_INIT(cpuid)
done: done:
#endif #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); "[-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_saved = grub_get_root_biosnumber;
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap; grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap, cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap, 0,
GRUB_COMMAND_FLAG_BOTH,
N_("-l | -r | [-s] grubdev osdisk."), N_("-l | -r | [-s] grubdev osdisk."),
N_("Manage the BIOS drive mappings."), N_("Manage the BIOS drive mappings."),
options); options);

View file

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

View file

@ -366,8 +366,7 @@ static void *preboot_hook;
GRUB_MOD_INIT (sendkey) GRUB_MOD_INIT (sendkey)
{ {
cmd = grub_register_extcmd ("sendkey", grub_cmd_sendkey, cmd = grub_register_extcmd ("sendkey", grub_cmd_sendkey, 0,
GRUB_COMMAND_FLAG_BOTH,
"sendkey [KEYSTROKE1] [KEYSTROKE2] ...", "sendkey [KEYSTROKE1] [KEYSTROKE2] ...",
"Emulate a keystroke", options); "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) GRUB_MOD_INIT(memrw)
{ {
cmd_read_byte = 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); N_("PORT"), N_("Read byte from PORT."), options);
cmd_read_word = 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); N_("PORT"), N_("Read word from PORT."), options);
cmd_read_dword = 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); N_("PORT"), N_("Read dword from PORT."), options);
cmd_write_byte = cmd_write_byte =
grub_register_command ("outb", grub_cmd_write, grub_register_command ("outb", grub_cmd_write,

View file

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

View file

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

View file

@ -269,7 +269,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(ls) 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_("[-l|-h|-a] [FILE]"),
N_("List devices and files."), options); N_("List devices and files."), options);
} }

View file

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

View file

@ -224,8 +224,8 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(lspci) GRUB_MOD_INIT(lspci)
{ {
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH, cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, 0, "[-i]",
"[-i]", N_("List PCI devices."), options); N_("List PCI devices."), options);
} }
GRUB_MOD_FINI(lspci) 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) GRUB_MOD_INIT(memrw)
{ {
cmd_read_byte = 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); N_("ADDR"), N_("Read byte from ADDR."), options);
cmd_read_word = 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); N_("ADDR"), N_("Read word from ADDR."), options);
cmd_read_dword = 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); N_("ADDR"), N_("Read dword from ADDR."), options);
cmd_write_byte = cmd_write_byte =
grub_register_command ("write_byte", grub_cmd_write, grub_register_command ("write_byte", grub_cmd_write,

View file

@ -274,7 +274,7 @@ void
grub_menu_init (void) grub_menu_init (void)
{ {
cmd = grub_register_extcmd ("menuentry", grub_cmd_menuentry, 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); N_("BLOCK"), N_("Define a menuentry."), options);
} }

View file

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

View file

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

View file

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

View file

@ -329,7 +329,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(setpci) 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] " N_("[-s POSITION] [-d DEVICE] [-v VAR] "
"[REGISTER][=VALUE[:MASK]]"), "[REGISTER][=VALUE[:MASK]]"),
N_("Manipulate PCI devices."), options); N_("Manipulate PCI devices."), options);

View file

@ -101,7 +101,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(sleep) 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_("NUMBER_OF_SECONDS"),
N_("Wait for a specified number of seconds."), N_("Wait for a specified number of seconds."),
options); options);

View file

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

View file

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

View file

@ -40,7 +40,7 @@ grub_register_command_prio (const char *name,
cmd->summary = (summary) ? summary : ""; cmd->summary = (summary) ? summary : "";
cmd->description = description; cmd->description = description;
cmd->flags = GRUB_COMMAND_FLAG_BOTH; cmd->flags = 0;
cmd->prio = prio; cmd->prio = prio;
grub_prio_list_insert (GRUB_AS_PRIO_LIST_P (&grub_command_list), 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. */ /* Net and OpenBSD kernels are often compressed. */
grub_dl_load ("gzio"); grub_dl_load ("gzio");
cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd, cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd, 0,
GRUB_COMMAND_FLAG_BOTH,
N_("FILE"), N_("Load kernel of FreeBSD."), N_("FILE"), N_("Load kernel of FreeBSD."),
freebsd_opts); freebsd_opts);
cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd, cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd, 0,
GRUB_COMMAND_FLAG_BOTH,
N_("FILE"), N_("Load kernel of OpenBSD."), N_("FILE"), N_("Load kernel of OpenBSD."),
openbsd_opts); openbsd_opts);
cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd, cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd, 0,
GRUB_COMMAND_FLAG_BOTH,
N_("FILE"), N_("Load kernel of NetBSD."), N_("FILE"), N_("Load kernel of NetBSD."),
netbsd_opts); netbsd_opts);
cmd_freebsd_loadenv = cmd_freebsd_loadenv =

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -40,7 +40,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(test_blockarg) GRUB_MOD_INIT(test_blockarg)
{ {
cmd = grub_register_extcmd ("test_blockarg", 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_("BLOCK"),
N_("Print and execute block argument."), 0); N_("Print and execute block argument."), 0);
} }

View file

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