All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Unify rescue and normal commands
@ 2009-03-05 17:40 Bean
  2009-03-07 17:25 ` Bean
  2009-03-08 13:07 ` Robert Millan
  0 siblings, 2 replies; 9+ messages in thread
From: Bean @ 2009-03-05 17:40 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

Hi,

This patch unify the two command set, make them available in both
rescue and normal mode.

The basic command is registered using grub_register_command:

grub_command_t
grub_register_command (const char *name,
                                   grub_command_func_t func,
                                   const char *summary,
                                   const char *description);

The command function looks like this:
grub_err_t grub_cmd_func (grub_command_t cmd, int argc, char **args);

The extended command is built on top on basic command, it provides
argument parsing function. Extended command only depends on
extcmd.mod, which is much smaller than normal.mod.

grub_extcmd_t grub_register_extcmd (const char *name,
                                   grub_extcmd_func_t func,
                                   unsigned flags,
                                   const char *summary,
                                   const char *description,
                                   const struct grub_arg_option *parser);

static grub_err_t
grub_cmd_func (grub_extcmd_t ext, int argc, char **args);

The option state is in ext->state, to access the underlying command
structure, use ext->cmd.

There is another special command: dynamic command, which is used by
normal module to insert commands in command.lst. The module would only
be loaded when the dynamic command is invoked.

The command.lst now contains both basic and extended commands, the
extended command is prefixed by *.

The command structure has a priority parameter, for basic command, its
value is 0, for extended command, it's 1. When the command list is
search, it uses the priority value to decide which command to use.

I also move the rescue commands out of kernel to module minicmd. Only
set, unset, export, ls and insmod remains, as they're critical for
further modules loading.

-- 
Bean

[-- Attachment #2: command.zip --]
[-- Type: application/zip, Size: 40244 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-03-21  8:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-05 17:40 [PATCH] Unify rescue and normal commands Bean
2009-03-07 17:25 ` Bean
2009-03-08 12:28   ` Robert Millan
2009-03-08 12:39     ` Bean
2009-03-08 13:07 ` Robert Millan
2009-03-08 13:10   ` phcoder
2009-03-08 14:45   ` Bean
2009-03-14 15:19     ` Bean
2009-03-21  8:39       ` Bean

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.