]>
Commit | Line | Data |
---|---|---|
30fdf114 LG |
1 | /** @file\r |
2 | \r | |
1be2ed90 | 3 | Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r |
40d841f6 | 4 | This program and the accompanying materials \r |
30fdf114 LG |
5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | MemoryFile.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Header file for helper functions useful for accessing files.\r | |
19 | \r | |
20 | **/\r | |
21 | \r | |
22 | #ifndef _EFI_MEMORY_FILE_H\r | |
23 | #define _EFI_MEMORY_FILE_H\r | |
24 | \r | |
25 | #include <stdio.h>\r | |
26 | #include <stdlib.h>\r | |
27 | #include <Common/UefiBaseTypes.h>\r | |
28 | \r | |
30fdf114 LG |
29 | //\r |
30 | // Common data structures\r | |
31 | //\r | |
32 | typedef struct {\r | |
33 | CHAR8 *FileImage;\r | |
34 | CHAR8 *Eof;\r | |
35 | CHAR8 *CurrentFilePointer;\r | |
36 | } MEMORY_FILE;\r | |
37 | \r | |
38 | \r | |
39 | //\r | |
40 | // Functions declarations\r | |
41 | //\r | |
42 | \r | |
43 | EFI_STATUS\r | |
44 | GetMemoryFile (\r | |
45 | IN CHAR8 *InputFileName,\r | |
46 | OUT EFI_HANDLE *OutputMemoryFile\r | |
47 | )\r | |
48 | ;\r | |
49 | /**\r | |
50 | \r | |
51 | Routine Description:\r | |
52 | \r | |
53 | This opens a file, reads it into memory and returns a memory file\r | |
54 | object.\r | |
55 | \r | |
56 | Arguments:\r | |
57 | \r | |
58 | InputFile Memory file image.\r | |
59 | OutputMemoryFile Handle to memory file\r | |
60 | \r | |
61 | Returns:\r | |
62 | \r | |
63 | EFI_STATUS\r | |
64 | OutputMemoryFile is valid if !EFI_ERROR\r | |
65 | \r | |
66 | **/\r | |
67 | \r | |
68 | \r | |
69 | EFI_STATUS\r | |
70 | FreeMemoryFile (\r | |
71 | IN EFI_HANDLE InputMemoryFile\r | |
72 | )\r | |
73 | ;\r | |
74 | /**\r | |
75 | \r | |
76 | Routine Description:\r | |
77 | \r | |
78 | Frees all memory associated with the input memory file.\r | |
79 | \r | |
80 | Arguments:\r | |
81 | \r | |
82 | InputMemoryFile Handle to memory file\r | |
83 | \r | |
84 | Returns:\r | |
85 | \r | |
86 | EFI_STATUS\r | |
87 | \r | |
88 | **/\r | |
89 | \r | |
90 | \r | |
91 | CHAR8 *\r | |
92 | ReadMemoryFileLine (\r | |
93 | IN EFI_HANDLE InputMemoryFile\r | |
94 | )\r | |
95 | ;\r | |
96 | /**\r | |
97 | \r | |
98 | Routine Description:\r | |
99 | \r | |
100 | This function reads a line from the memory file. The newline characters\r | |
101 | are stripped and a null terminated string is returned.\r | |
102 | \r | |
103 | If the string pointer returned is non-NULL, then the caller must free the\r | |
104 | memory associated with this string.\r | |
105 | \r | |
106 | Arguments:\r | |
107 | \r | |
108 | InputMemoryFile Handle to memory file\r | |
109 | \r | |
110 | Returns:\r | |
111 | \r | |
112 | NULL if error or EOF\r | |
113 | NULL character termincated string otherwise (MUST BE FREED BY CALLER)\r | |
114 | \r | |
115 | **/\r | |
116 | \r | |
117 | \r | |
118 | #endif\r |