]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Common/MemoryFile.h
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / C / Common / MemoryFile.h
CommitLineData
30fdf114 1/** @file\r
97fa0ee9 2Header file for helper functions useful for accessing files.\r
30fdf114 3\r
f7496d71 4Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
2e351cbe 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
30fdf114 6\r
30fdf114
LG
7**/\r
8\r
9#ifndef _EFI_MEMORY_FILE_H\r
10#define _EFI_MEMORY_FILE_H\r
11\r
12#include <stdio.h>\r
13#include <stdlib.h>\r
14#include <Common/UefiBaseTypes.h>\r
15\r
30fdf114
LG
16//\r
17// Common data structures\r
18//\r
19typedef struct {\r
20 CHAR8 *FileImage;\r
21 CHAR8 *Eof;\r
22 CHAR8 *CurrentFilePointer;\r
23} MEMORY_FILE;\r
24\r
25\r
26//\r
27// Functions declarations\r
28//\r
29\r
30EFI_STATUS\r
31GetMemoryFile (\r
32 IN CHAR8 *InputFileName,\r
33 OUT EFI_HANDLE *OutputMemoryFile\r
34 )\r
35;\r
36/**\r
37\r
38Routine Description:\r
39\r
40 This opens a file, reads it into memory and returns a memory file\r
41 object.\r
42\r
43Arguments:\r
44\r
45 InputFile Memory file image.\r
46 OutputMemoryFile Handle to memory file\r
47\r
48Returns:\r
49\r
50 EFI_STATUS\r
51 OutputMemoryFile is valid if !EFI_ERROR\r
52\r
53**/\r
54\r
55\r
56EFI_STATUS\r
57FreeMemoryFile (\r
58 IN EFI_HANDLE InputMemoryFile\r
59 )\r
60;\r
61/**\r
62\r
63Routine Description:\r
64\r
65 Frees all memory associated with the input memory file.\r
66\r
67Arguments:\r
68\r
69 InputMemoryFile Handle to memory file\r
70\r
71Returns:\r
72\r
73 EFI_STATUS\r
74\r
75**/\r
76\r
77\r
78CHAR8 *\r
79ReadMemoryFileLine (\r
80 IN EFI_HANDLE InputMemoryFile\r
81 )\r
82;\r
83/**\r
84\r
85Routine Description:\r
86\r
87 This function reads a line from the memory file. The newline characters\r
88 are stripped and a null terminated string is returned.\r
89\r
90 If the string pointer returned is non-NULL, then the caller must free the\r
91 memory associated with this string.\r
92\r
93Arguments:\r
94\r
95 InputMemoryFile Handle to memory file\r
96\r
97Returns:\r
98\r
99 NULL if error or EOF\r
100 NULL character termincated string otherwise (MUST BE FREED BY CALLER)\r
101\r
102**/\r
103\r
104\r
105#endif\r