Received: from list by lists.gnu.org with archive (Exim 4.71) id 1hVZ3R-0005tE-01 for mharc-grub-devel@gnu.org; Tue, 28 May 2019 06:10:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVZ3O-0005qx-JB for grub-devel@gnu.org; Tue, 28 May 2019 06:09:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVZ3N-0006s4-MP for grub-devel@gnu.org; Tue, 28 May 2019 06:09:58 -0400 Received: from dibed.net-space.pl ([84.10.22.86]:50782) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.71) (envelope-from ) id 1hVZ3N-0006qT-C6 for grub-devel@gnu.org; Tue, 28 May 2019 06:09:57 -0400 Received: from router-fw.i.net-space.pl ([192.168.52.1]:41326 "EHLO tomti.i.net-space.pl") by router-fw-old.i.net-space.pl with ESMTP id S1909149AbfE1KJw (ORCPT ); Tue, 28 May 2019 12:09:52 +0200 X-Comment: RFC 2476 MSA function at dibed.net-space.pl logged sender identity as: dkiper Date: Tue, 28 May 2019 12:09:50 +0200 From: Daniel Kiper To: Michael Grzeschik Cc: grub-devel@gnu.org, kernel@pengutronix.de, phcoder@gmail.com Subject: Re: [PATCH] grub2: add read_hook to blocklists Message-ID: <20190528100950.hz6ditrajhtceoo2@tomti.i.net-space.pl> References: <20190527080727.5748-1-m.grzeschik@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190527080727.5748-1-m.grzeschik@pengutronix.de> User-Agent: NeoMutt/20170113 (1.7.2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 84.10.22.86 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 May 2019 10:09:59 -0000 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 > --- > 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