public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Andrew Fish <afish@apple.com>
To: Amit kumar <akamit91@hotmail.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: How to get fs index from controller handle.
Date: Thu, 06 Apr 2017 04:09:22 -0700	[thread overview]
Message-ID: <EA79D86F-595D-429B-B139-9025900A17B2@apple.com> (raw)
In-Reply-To: <MWHPR11MB1822A48158AD0C8366226315DC0D0@MWHPR11MB1822.namprd11.prod.outlook.com>


> On Apr 6, 2017, at 3:30 AM, Amit kumar <akamit91@hotmail.com> wrote:
> 
> Hi,
> 
> I want to get the fs index from the controller handle.
> e.g In map command i see my controller is mapped to fs10. 
> So i there any API i can use in my code to get the fs index( which is 10 as in example) from the controller handle. 
> 

Amit,

It is important to remember that fs0:, and the other device names are a Shell concept and not an EFI concept. So they only exist in the context of the shell. 

I took a quick look and I did not see an easy way to do this with the current Shell APIs. 

In the older Shell you could use this  protocol  EfiShellEnvironment2 Protocol has a function that converts a EFI_DEVICE_PATH_PROTOCOL (would be on your controller handle) to a CHAR16. Thus you can get the volume name the Shell would display to the user. I don't the index exists as a concept.  So  EFI_SHELL_ENVIRONMENT2.GetFsName() and  EFI_SHELL_ENVIRONMENT2.GetFsDevicepath() are the closest thing I can think of. 
https://github.com/tianocore/edk2/blob/master/ShellPkg/Include/Protocol/EfiShellEnvironment2.h#L812 <https://github.com/tianocore/edk2/blob/master/ShellPkg/Include/Protocol/EfiShellEnvironment2.h#L812>

The only problem with that is EfiShellEnvironment2 is not produced by the Shell by default. 

  ## This flag is used to control the protocols produced by the shell
  #  If TRUE the shell will produce EFI_SHELL_ENVIRONMENT2 and EFI_SHELL_INTERFACE
  gEfiShellPkgTokenSpaceGuid.PcdShellSupportOldProtocols|FALSE|BOOLEAN|0x00000002

I've use the EFI_SHELL_ENVIRONMENT2 in the past to enable a non Shell application to print out volume names that match the map command of the shell. Hopefully some one knows how to do this in the modern Shell?

Thanks,

Andrew Fish

> Regards 
> Amit
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



  reply	other threads:[~2017-04-06 11:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 10:30 How to get fs index from controller handle Amit kumar
2017-04-06 11:09 ` Andrew Fish [this message]
2017-04-06 16:44   ` Amit kumar
2017-04-06 20:30     ` Carsey, Jaben
2017-04-06 20:48       ` Andrew Fish
2017-04-06 20:52         ` Carsey, Jaben
2017-04-07 10:16           ` Amit kumar
2017-04-07 10:40             ` Amit kumar
2017-04-07 14:42               ` Andrew Fish
2017-04-07 15:23                 ` Amit kumar

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=EA79D86F-595D-429B-B139-9025900A17B2@apple.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