From: AKASHI Takahiro Date: Mon, 2 Mar 2020 10:00:29 +0900 Subject: [PATCH] efi_loader: file: set a backend block device for file operations In-Reply-To: <9a84710a-11b0-5dea-180c-41c36fd552d6@gmx.de> References: <20200228000549.1937-1-takahiro.akashi@linaro.org> <9a84710a-11b0-5dea-180c-41c36fd552d6@gmx.de> Message-ID: <20200302010028.GE13880@linaro.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, Feb 28, 2020 at 07:13:42PM +0100, Heinrich Schuchardt wrote: > On 2/28/20 1:05 AM, AKASHI Takahiro wrote: > > In the current implementation, set_blk_dev() is called in opening a file, > > but not in opening a directory. This will cause failures at succeeding > > directory operations as the "current" block device remains nullified. > > Adding set_blk_dev() fixes this issue. > > > > Signed-off-by: AKASHI Takahiro > > --- > > lib/efi_loader/efi_file.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c > > index 140116ddc4ac..ba55b2829e03 100644 > > --- a/lib/efi_loader/efi_file.c > > +++ b/lib/efi_loader/efi_file.c > > @@ -235,6 +235,9 @@ static struct efi_file_handle *file_open(struct file_system *fs, > > } else { > > fh->isdir = 1; > > strcpy(fh->path, ""); > > + > > + if (set_blk_dev(fh)) > > + goto error; > > In the 'true' path of the if statement is_dir() results in fs_type = > FS_TYPE_ANY. It would be inconsistent to call set_blk_dev() here. > > Which "succeeding directory operation" does not call set_blk_dev(fh)? > > Where did you observe an error? Ah, it would be better to fix my code as I had a mixed use of efi interface, open_volume(), and U-Boot interfaces, like fs_opendir()/ readdir(). Thanks, -Takahiro Akashi > > Best regards > > Heinrich > > } > > > > return &fh->base; > > >