aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-11-17 19:30:11 +0300
committerJoursoir <chat@joursoir.net>2021-11-17 19:30:22 +0300
commit089a342b293c64436b491daa4fde4f971d92c64b (patch)
tree03cdee07f915972e9beb3e95172b9ed767a86f09
parent94e6019dc3df8057ca1192c553026ba3059a413a (diff)
downloadufm-089a342b293c64436b491daa4fde4f971d92c64b.tar.gz
ufm-089a342b293c64436b491daa4fde4f971d92c64b.tar.bz2
ufm-089a342b293c64436b491daa4fde4f971d92c64b.zip
fs: make scanfs()
-rw-r--r--Library/UefiShellUfmCommandLib/fs.c22
-rw-r--r--Library/UefiShellUfmCommandLib/fs.h7
2 files changed, 29 insertions, 0 deletions
diff --git a/Library/UefiShellUfmCommandLib/fs.c b/Library/UefiShellUfmCommandLib/fs.c
index fe2d590..a675688 100644
--- a/Library/UefiShellUfmCommandLib/fs.c
+++ b/Library/UefiShellUfmCommandLib/fs.c
@@ -87,3 +87,25 @@ VOID fsa_release(struct fs_array *fsa)
}
FreePool(fsa);
}
+
+struct fs_array *scanfs(VOID)
+{
+ UINTN handle_count;
+ EFI_HANDLE *handle_buffer;
+ struct fs_array *fsa;
+ EFI_STATUS status;
+
+ status = gBS->LocateHandleBuffer(
+ ByProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ &handle_count,
+ &handle_buffer
+ );
+ if(EFI_ERROR(status) || handle_count <= 0)
+ return NULL;
+
+ fsa = fsa_alloc(handle_buffer, handle_count);
+ FreePool(handle_buffer);
+ return fsa;
+} \ No newline at end of file
diff --git a/Library/UefiShellUfmCommandLib/fs.h b/Library/UefiShellUfmCommandLib/fs.h
index f7625b1..56df1ee 100644
--- a/Library/UefiShellUfmCommandLib/fs.h
+++ b/Library/UefiShellUfmCommandLib/fs.h
@@ -27,4 +27,11 @@ struct fs_array *fsa_alloc(EFI_HANDLE *handles, UINTN count);
*/
VOID fsa_release(struct fs_array *fsa);
+/*
+ * Gets names of filesystems represented on the system
+ *
+ * return: A pointer to the allocated structure or NULL if allocation fails
+*/
+struct fs_array *scanfs(VOID);
+
#endif /* UFM_FS_H */