grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Drivemap module


From: Javier Martín
Subject: Re: [PATCH] Drivemap module
Date: Wed, 13 Aug 2008 14:16:25 +0200

El mié, 13-08-2008 a las 12:13 +0200, Marco Gerards escribió:
> Javier Martín <address@hidden> writes:
> 
> > In this reply-to-myself hoping to keep the thread continuity, I put
> > forth the new "version 7" of the patch with the following changes:
> >
> >   - A new switch -s/--swap has been implemented, so that running
> > "drivemap -s hd0 hd1" is equivalent to issuing the command twice with
> > the arguments normal, then reversed. There is one exception: if the
> > first mapping fails or the second drive does not exist, no mapping is
> > performed, whereas hand-performing the swap would have successfully
> > assigned BIOS disk #1 to hd0, then failed to assign bd#0 to non-existent
> > hd1.
> >   - Raw BIOS disk number parsing has been removed: the syntax "drivemap
> > hd1 0x80" is no longer legal. However, one can still map non-existent
> > BIOS disk numbers with "drivemap hd0 hd42" for example and (more
> > controversially, maybe I'll add a check eventually) assign a floppy to
> > an HD and back.
> 
> Ah good :-)
> 
> > The only file changed from the last patch ("version 6") is drivemap.c:
> > the rest of it should be the same, so if anyone was reviewing it you can
> > seamlessly "jump" to version 7. In particular, the functional changes
> > are localized in the drivemap_cmd function proper, and there are
> > cosmetic changes elsewhere (spurious tabs removed, etc.).
> 
> You only forgot the changelog entry ;-)
Oops, sorry... the only addition would be the new file drivemap.h, so
the "final" (I hope) version would be like this:

2008-08-13  Javier Martin  <address@hidden>

        * commands/i386/pc/drivemap.c: New file.
        * commands/i386/pc/drivemap_int13h.S: New file.
        * conf/i386-pc.rmk (pkglib_MODULES): Added drivemap.mod.
        (drivemap_mod_SOURCES): New variable.
        (drivemap_mod_ASFLAGS): Likewise.
        (drivemap_mod_CFLAGS): Likewise.
        (drivemap_mod_LDFLAGS): Likewise.
        * include/grub/i386/pc/drivemap.h: New file.
        * include/grub/loader.h (grub_loader_register_preboot): New
        function prototype.
        (grub_loader_unregister_preboot): Likewise.
        (grub_preboot_hookid): New typedef.
        * kern/loader.c (grub_loader_register_preboot): New function.
        (grub_loader_unregister_preboot): Likewise.
        (preboot_hooks): New variable.
        (grub_loader_boot): Call the list of preboot-hooks before the
        actual loader.

WRT the code, all your concerns were taken care of (I keep forgetting
the ".  " in comments, sorry), and about this snippet:

> +static grub_err_t
> > +grub_cmd_drivemap (struct grub_arg_list *state, int argc, char **args)
> > +{
> > +  if (state[OPTIDX_LIST].set)
> > +    {
> > +      /* Show: list mappings.  */
> > +      if (!drivemap)
> > +        grub_printf ("No drives have been remapped");
> > +      else
> > +        {
> > +          grub_printf ("Showing only remapped drives.\n");
> > +          grub_printf ("BIOS disk #num ----> GRUB device\n");
> 
> BIOS disk #num?
> 
> Can you give an example?

The "drivemap -l" command lists all remapped drives. The format of the listing 
has been reworked in order to be both understandable for end-users and 
unambiguous for devs and power users. It is now something akin to:

BIOS disk #num ----> GRUB device
FD #0   (0x00)       (fd3)
(...)
FD #127 (0x7f)       (hd15)
HD #0   (0x80)       (hd2)
(...)
HD #127 (0xff)       (fd0)

Of course, it only shows remapped drives, not the full 255 possibilities. Well, 
here is "version 8" of the patch... hope you like it ;)

-Habbit

Attachment: drivemap.patch.8
Description: Text Data

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente


reply via email to

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