[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] grub2: add read_hook to blocklists
From: |
Daniel Kiper |
Subject: |
Re: [PATCH] grub2: add read_hook to blocklists |
Date: |
Tue, 28 May 2019 12:09:50 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
CC-ing Vladimir.
On Mon, May 27, 2019 at 10:07:27AM +0200, Michael Grzeschik wrote:
> This is needed to make grubenv be stored in
> raw disk images. We now can run
>
> save_env -f (ata0)1024+2 VARIABLE
Why do we need/want this patch? What is the usage case for it?
Could you explain why you have to change grub_fs_blocklist_read()
just to read grubenv? Could not we do that in less intrusive way?
Daniel
> Signed-off-by: Michael Grzeschik <address@hidden>
> ---
> grub-core/kern/fs.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
> index 2b85f4950..d50d519d2 100644
> --- a/grub-core/kern/fs.c
> +++ b/grub-core/kern/fs.c
> @@ -208,6 +208,11 @@ grub_fs_blocklist_read (grub_file_t file, char *buf,
> grub_size_t len)
> grub_off_t offset;
> grub_ssize_t ret = 0;
>
> + if (file->read_hook)
> + file->device->disk->read_hook = file->read_hook;
> + if (file->read_hook_data)
> + file->device->disk->read_hook_data = file->read_hook_data;
> +
> if (len > file->size - file->offset)
> len = file->size - file->offset;
>
> @@ -236,6 +241,7 @@ grub_fs_blocklist_read (grub_file_t file, char *buf,
> grub_size_t len)
> else
> sector -= p->length;
> }
> + file->device->disk->read_hook = 0;
>
> return ret;
> }
> --
> 2.20.1