[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/3] efidisk: implement alignment-respecting malloc functi
From: |
Andrei Borzenkov |
Subject: |
Re: [PATCH v2 2/3] efidisk: implement alignment-respecting malloc function |
Date: |
Wed, 2 Mar 2016 06:46:52 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
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?
- [PATCH v2 0/3] some disk reworking reposted, Leif Lindholm, 2016/03/01
- [PATCH v2 2/3] efidisk: implement alignment-respecting malloc function, Leif Lindholm, 2016/03/01
- Re: [PATCH v2 2/3] efidisk: implement alignment-respecting malloc function,
Andrei Borzenkov <=
- [PATCH v2 1/3] disk: Add support for device-specific malloc function, Leif Lindholm, 2016/03/01
- [PATCH v2 3/3] disk: read into cache directly, Leif Lindholm, 2016/03/01
- RE: [PATCH v2 3/3] disk: read into cache directly, Elliott, Robert (Persistent Memory), 2016/03/02