grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] nested partitions


From: Robert Millan
Subject: Re: [PATCH] nested partitions
Date: Mon, 3 Aug 2009 00:02:36 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Thu, Jul 16, 2009 at 10:52:37PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> @@ -94,10 +95,28 @@ grub_chainloader_cmd (const char *filename, 
> grub_chainloader_flags_t flags)
>    dev = grub_device_open (0);
>    if (dev && dev->disk && dev->disk->partition)
>      {
> -      grub_disk_read (dev->disk, dev->disk->partition->offset, 446, 64,
> -                   (void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
> -      part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
> -                         + (dev->disk->partition->index << 4));
> +      grub_disk_t disk = dev->disk;
> +
> +      if (disk)
> +     {
> +       grub_partition_t p = disk->partition;
> +
> +       /* In i386-pc, the id is equal to the BIOS drive number.  */
> +       drive = (int) disk->id;
> +
> +       if (p && grub_strcmp (p->partmap->name, "pc_partition_map") == 0)
> +         {
> +           disk->partition = p->parent;
> +           grub_disk_read (disk, p->offset, 446, 64,
> +                           (void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
> +           part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
> +                                 + (((struct grub_pc_partition *) p->data)
> +                                    ->index << 4));
> +           disk->partition = p;
> +         }
> +     }
> +
> +      grub_device_close (dev);

I don't think we should allow chainload at all in partitions other than msdos
ones.  There's no existing use of this for other labels "in the wild", and we
shouldn't encourage it to appear IMO.

If we have partitions and the "pc_partition_map" match fails, I would just
abort.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




reply via email to

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