public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: GN Keshava <keshava.gn@gmail.com>
To: Andrew Fish <afish@apple.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	 "edk2-devel@lists.sourceforge.net"
	<edk2-devel@lists.sourceforge.net>
Subject: Re: How to open a file by it's full path in UEFI
Date: Tue, 27 Sep 2016 09:28:58 +0000	[thread overview]
Message-ID: <CABKwMdvc8xdLKMuAiz76F0UyO_z+Gfa4qzfQdmXxoPiK7rd-Yw@mail.gmail.com> (raw)
In-Reply-To: <0B851A39-2877-465C-AE96-13E2F47A6099@apple.com>

Hi Andrew,

Thanks for the reply.

Can you tell more about (or some links) about the Shell APIs that you have
mentioned? Is it possible to access these from my C code? (not script, its
C code for my .efi app).

Also, can you give more idea about how I can map my volume name to device
path in my C file?

Thanks.
With regards,
Keshava

On Tue, 27 Sep 2016 at 14:37 Andrew Fish <afish@apple.com> wrote:

> On Sep 27, 2016, at 2:03 AM, GN Keshava <keshava.gn@gmail.com> wrote:
>
> Hi all,
>
>
> I'm trying to open a file from my UEFI application. The path of file is
>
> fs1:/myfolder/myfile.txt
>
>
> Keshava,
>
> The volume names are EFI Shell concepts, not UEFI Firmware concepts.
> Basically the Shell uses "fs1:" to match one of the Simple File System
> Handles. There is also an EFI Device Path on the handle with the Simple
> File System Handle and that is what maps to "fs1".
>
> So if you want to use these shell volume names you need to use Shell APIs.
>
> Thanks,
>
> Andrew Fish
>
>
> The code :
>
> efiStatus = bs->LocateHandleBuffer(ByProtocol,
>                                   &sfspGuid,
>                                   NULL,
>                                   &handleCount,
>                                   &handles);
>
> for (index = 0; index < (int)handleCount; ++ index)
> {
>    EFI_SIMPLE_FILE_SYSTEM_PROTOCOL* fs = NULL;
>
>    efiStatus = bs->HandleProtocol(
>        handles[index],
>        &sfspGuid,
>        (void**)&fs);
>
>    EFI_FILE_PROTOCOL* root = NULL;
>    ...
>    efiStatus = fs->OpenVolume(fs, &root);
>
>    EFI_FILE_PROTOCOL* token = NULL;
>
>    efiStatus = root->Open(
>        root,
>        &token,
>        L"myfolder\\myfile.txt",
>        EFI_FILE_MODE_READ,
>        EFI_FILE_READ_ONLY | EFI_FILE_HIDDEN | EFI_FILE_SYSTEM);
> }
>
> But using this method, I can only go through all the file system handles
> and open each volume and try opening my file.
>
> But I want to give full path to my file and open it in it's volume.
>
> How can I acheive this?
> Thanks.
> With regards,
> Keshava GN
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>
>
>


  reply	other threads:[~2016-09-27  9:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27  9:03 How to open a file by it's full path in UEFI GN Keshava
2016-09-27  9:07 ` Andrew Fish
2016-09-27  9:28   ` GN Keshava [this message]
2016-09-27  9:16 ` Laszlo Ersek
2016-09-27  9:25   ` GN Keshava
2016-09-27  9:49     ` Laszlo Ersek
2016-09-27 10:46       ` GN Keshava
2016-09-27 11:17         ` Laszlo Ersek
2016-09-27 11:51           ` GN Keshava
2016-09-27 15:07             ` Carsey, Jaben
2016-09-27 15:13               ` Laszlo Ersek
2016-09-27 16:44             ` Jarlstrom, Laurie
2016-09-27 16:48               ` Andrew Fish
2016-09-27 16:56                 ` GN Keshava
2016-09-29 10:22               ` GN Keshava

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-list 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=CABKwMdvc8xdLKMuAiz76F0UyO_z+Gfa4qzfQdmXxoPiK7rd-Yw@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox