[prev in list] [next in list] [prev in thread] [next in thread]
List: grub-devel
Subject: Re: [PATCH] grub2: add read_hook to blocklists
From: Daniel Kiper <dkiper () net-space ! pl>
Date: 2019-05-28 10:09:50
Message-ID: 20190528100950.hz6ditrajhtceoo2 () tomti ! i ! net-space ! pl
[Download RAW message or body]
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 <m.grzeschik@pengutronix.de>
> ---
> 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
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic