All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/3] efi_loader: disk: install file system protocol to a whole disk
Date: Thu, 3 Oct 2019 16:21:41 +0900	[thread overview]
Message-ID: <20191003072141.GM18778@linaro.org> (raw)
In-Reply-To: <1ccff3d4-8a78-576f-870c-9c6b6295f307@gmx.de>

Heinrich,

On Thu, Sep 12, 2019 at 11:21:51AM +0200, Heinrich Schuchardt wrote:
> On 9/12/19 6:51 AM, AKASHI Takahiro wrote:
> > Currently, a whole disk without any partitions is not associated
> > with EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. So even if it houses FAT
> > file system, there is a chance that we may not be able to access
> > it, particularly, when accesses are to be attempted after searching
> > that protocol against a device handle.
> >
> > With this patch, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed
> > to such a disk if part_get_info() shows there is not partition
> > table installed on it.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  lib/efi_loader/efi_disk.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> > index d72f455901f2..d36f22cedc52 100644
> > --- a/lib/efi_loader/efi_disk.c
> > +++ b/lib/efi_loader/efi_disk.c
> > @@ -253,6 +253,7 @@ static efi_status_t efi_disk_add_dev(
> >  				struct efi_disk_obj **disk)
> >  {
> >  	struct efi_disk_obj *diskobj;
> > +	disk_partition_t info;
> >  	efi_status_t ret;
> >
> >  	/* Don't add empty devices */
> > @@ -284,7 +285,9 @@ static efi_status_t efi_disk_add_dev(
> >  			       diskobj->dp);
> >  	if (ret != EFI_SUCCESS)
> >  		return ret;
> > -	if (part >= 1 && efi_fs_exists(desc, part)) {
> > +	/* partitions or whole disk without partitions */
> > +	if ((part >= 1 || part_get_info(desc, part, &info)) &&
> 
> part_get_info() returns -1 for part = 0 on a DOS partioned disk. So this
> check does not work.

Right.
So this statement should be simplified like:
        if (efi_fs_exists(desc, part)) {
                diskobj->volume = efi_simple_file_system(desc, part,
                                                         diskobj->dp);
                ret = efi_add_protocol(&diskobj->header,
                ...
        }

-Takahiro Akashi


> Best regards
> 
> Heinrich
> 
> > +	    efi_fs_exists(desc, part)) {
> >  		diskobj->volume = efi_simple_file_system(desc, part,
> >  							 diskobj->dp);
> >  		ret = efi_add_protocol(&diskobj->header,
> >
> 

      reply	other threads:[~2019-10-03  7:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12  4:51 [U-Boot] [PATCH v2 0/3] efi_loader: disk: install FILE_SYSTEM_PROTOCOL to whole disk AKASHI Takahiro
2019-09-12  4:51 ` [U-Boot] [PATCH v2 1/3] fs: export fs_close() AKASHI Takahiro
2019-09-12  4:51 ` [U-Boot] [PATCH v2 2/3] efi_loader: disk: install FILE_SYSTEM_PROTOCOL only if available AKASHI Takahiro
2019-09-12  8:57   ` Heinrich Schuchardt
2019-09-12  9:17     ` AKASHI Takahiro
2019-09-12  9:43       ` Heinrich Schuchardt
2019-09-12  9:51         ` AKASHI Takahiro
2019-10-03  7:09           ` AKASHI Takahiro
2019-10-03 13:44             ` Heinrich Schuchardt
2019-10-04  0:22               ` AKASHI Takahiro
2019-09-12  4:51 ` [U-Boot] [PATCH v2 3/3] efi_loader: disk: install file system protocol to a whole disk AKASHI Takahiro
2019-09-12  9:21   ` Heinrich Schuchardt
2019-10-03  7:21     ` AKASHI Takahiro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191003072141.GM18778@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.