1 /*++ @file
2   Produce Simple File System abstractions for a directory on your PC using Unix APIs.
3   The configuration of what devices to mount or emulate comes from
4   environment variables.
5 
6 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
7 Portions copyright (c) 2011, Apple Inc. All rights reserved.
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution.  The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12 
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 
16 
17 **/
18 
19 #ifndef _EMU_SIMPLE_FILE_SYSTEM_H_
20 #define _EMU_SIMPLE_FILE_SYSTEM_H_
21 
22 #include "PiDxe.h"
23 
24 #include <Guid/FileSystemInfo.h>
25 #include <Guid/FileInfo.h>
26 #include <Guid/FileSystemVolumeLabelInfo.h>
27 
28 #include <Protocol/EmuIoThunk.h>
29 #include <Protocol/SimpleFileSystem.h>
30 
31 #include <Library/DebugLib.h>
32 #include <Library/BaseLib.h>
33 #include <Library/UefiDriverEntryPoint.h>
34 #include <Library/UefiLib.h>
35 #include <Library/BaseMemoryLib.h>
36 #include <Library/MemoryAllocationLib.h>
37 #include <Library/UefiBootServicesTableLib.h>
38 
39 
40 extern EFI_DRIVER_BINDING_PROTOCOL  gEmuSimpleFileSystemDriverBinding;
41 extern EFI_COMPONENT_NAME_PROTOCOL  gEmuSimpleFileSystemComponentName;
42 extern EFI_COMPONENT_NAME2_PROTOCOL gEmuSimpleFileSystemComponentName2;
43 
44 #define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'M', 'f', 's')
45 
46 typedef struct {
47   UINTN                           Signature;
48   EMU_IO_THUNK_PROTOCOL           *IoThunk;
49   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFileSystem;
50   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Io;
51   EFI_UNICODE_STRING_TABLE        *ControllerNameTable;
52 } EMU_SIMPLE_FILE_SYSTEM_PRIVATE;
53 
54 #define EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS(a) \
55   CR (a, \
56       EMU_SIMPLE_FILE_SYSTEM_PRIVATE, \
57       SimpleFileSystem, \
58       EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
59       )
60 
61 #define EMU_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('e', 'm', 'f', 's')
62 
63 typedef struct {
64   UINTN                           Signature;
65   EMU_IO_THUNK_PROTOCOL           *IoThunk;
66   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
67   EFI_FILE_PROTOCOL               EfiFile;
68   EFI_FILE_PROTOCOL               *Io;
69 } EMU_EFI_FILE_PRIVATE;
70 
71 #define EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS(a) \
72   CR (a, \
73       EMU_EFI_FILE_PRIVATE, \
74       EfiFile, \
75       EMU_EFI_FILE_PRIVATE_SIGNATURE \
76       )
77 
78 
79 
80 #endif
81