grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 2/3] efidisk: implement alignment-respecting malloc functi


From: Leif Lindholm
Subject: Re: [PATCH v2 2/3] efidisk: implement alignment-respecting malloc function
Date: Wed, 2 Mar 2016 14:00:26 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Mar 02, 2016 at 06:46:52AM +0300, Andrei Borzenkov wrote:
> 02.03.2016 03:14, Leif Lindholm пишет:
> > Implement a driver-specific malloc function that allocates a buffer
> > with the alignment specified by grub_efi_block_io_media structure.
> > ---
> >  grub-core/disk/efi/efidisk.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
> > index 3b79f7b..ac99ea7 100644
> > --- a/grub-core/disk/efi/efidisk.c
> > +++ b/grub-core/disk/efi/efidisk.c
> > @@ -457,6 +457,13 @@ get_device (struct grub_efidisk_data *devices, int num)
> >    return 0;
> >  }
> >  
> > +static void *
> > +aligned_malloc (struct grub_disk *disk, grub_size_t size)
> > +{
> > +  struct grub_efidisk_data *d = disk->data;
> > +  return grub_memalign (d->block_io->media->io_align, size);
> > +}
> > +
> >  static grub_err_t
> >  grub_efidisk_open (const char *name, struct grub_disk *disk)
> >  {
> > @@ -512,6 +519,7 @@ grub_efidisk_open (const char *name, struct grub_disk 
> > *disk)
> >         (1U << disk->log_sector_size) < m->block_size;
> >         disk->log_sector_size++);
> >    disk->data = d;
> > +  disk->malloc = aligned_malloc;
> >  
> >    grub_dprintf ("efidisk", "opening %s succeeded\n", name);
> 
> Did you drop sanity check in grub_efidisk_open intentionally?

Not consiously, but my unconsious may well have done it intentionally.

Mmmno, I left it out because 51f375d688529b7c1819ba40188ee52b9333887c
already includes that.

/
    Leif



reply via email to

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