grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Unify rescue and normal commands


From: Bean
Subject: [PATCH] Unify rescue and normal commands
Date: Fri, 6 Mar 2009 01:40:36 +0800

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: command.zip
Description: Zip archive


reply via email to

[Prev in Thread] Current Thread [Next in Thread]