diff options
author | Joursoir <chat@joursoir.net> | 2021-11-17 19:28:53 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2021-11-17 19:28:53 +0300 |
commit | 94e6019dc3df8057ca1192c553026ba3059a413a (patch) | |
tree | 512b0b7f3f2134af8f0dc9f1ffa378719c459879 /Library | |
parent | b9c0d81eac650a2b1df7d3cafe0d41caed33421f (diff) | |
download | ufm-94e6019dc3df8057ca1192c553026ba3059a413a.tar.gz ufm-94e6019dc3df8057ca1192c553026ba3059a413a.tar.bz2 ufm-94e6019dc3df8057ca1192c553026ba3059a413a.zip |
fs: get the desired map name from all aliases
Diffstat (limited to 'Library')
-rw-r--r-- | Library/UefiShellUfmCommandLib/fs.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Library/UefiShellUfmCommandLib/fs.c b/Library/UefiShellUfmCommandLib/fs.c index edde591..fe2d590 100644 --- a/Library/UefiShellUfmCommandLib/fs.c +++ b/Library/UefiShellUfmCommandLib/fs.c @@ -7,6 +7,46 @@ #include "fs.h" +STATIC BOOLEAN search_list(CONST CHAR16 *list, CONST CHAR16 *target, + OUT CHAR16 **var OPTIONAL, CONST BOOLEAN meta, CONST CHAR16 *delimiter) +{ + CHAR16 *temp_list, *temp_str; + CONST CHAR16 *list_walker; + BOOLEAN result; + + for(list_walker = list, temp_list = NULL; + list_walker != NULL && *list_walker != CHAR_NULL; ) + { + temp_list = StrnCatGrow(&temp_list, NULL, list_walker, 0); + ASSERT(temp_list != NULL); + + temp_str = StrStr(temp_list, delimiter); + if(temp_str != NULL) + *temp_str = CHAR_NULL; + + list_walker = StrStr(list_walker, delimiter); + while(list_walker != NULL && *list_walker == *delimiter) + list_walker++; + + if(meta) + result = gUnicodeCollation->MetaiMatch(gUnicodeCollation, temp_list, (CHAR16 *)target); + else + result = (BOOLEAN)(StrCmp(temp_list, target) == 0); + + if(result) { + if(var != NULL) + *var = temp_list; + else + FreePool(temp_list); + return TRUE; + } + FreePool(temp_list); + temp_list = NULL; + } + + return FALSE; +} + struct fs_array *fsa_alloc(EFI_HANDLE *handles, UINTN count) { UINTN i; @@ -28,6 +68,8 @@ struct fs_array *fsa_alloc(EFI_HANDLE *handles, UINTN count) for(i = 0; i < count; i++) { dev_path = DevicePathFromHandle(handles[i]); map_list = gEfiShellProtocol->GetMapFromDevicePath(&dev_path); + search_list(map_list, L"FS*:", &fsa->full_name[i], TRUE, L";"); + ASSERT(fsa->full_name[i] != NULL); } return fsa; |