grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Unify rescue and normal commands


From: Bean
Subject: Re: [PATCH] Unify rescue and normal commands
Date: Sun, 8 Mar 2009 01:25:37 +0800

On Fri, Mar 6, 2009 at 1:40 AM, Bean <address@hidden> wrote:
> 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.

Hi,

This is an update version of the patch:

1, Add new base class grub_prio_list, which represent a named list
with priority parameter:

struct
{
  next;
  name;
  prio;
}

The list would be sorted by name, then by priority, it would ensure
that first one found is of the highest priority.

Now grub_command is a subclass of grub_prio_list, and use its function
to insert/remove items.

grub_list -> grub_named_list -> grub_prio_list -> grub_command.

2, sync with svn r2021

3, Misc bug fixes.

-- 
Bean

Attachment: command_2.zip
Description: Zip archive


reply via email to

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