]> code.delx.au - refind/blob - filesystems/fsw_efi.h
Fixed bug that caused also_scan_dirs to ignore volume specifier.
[refind] / filesystems / fsw_efi.h
1 /* $Id: fsw_efi.h 33540 2010-10-28 09:27:05Z vboxsync $ */
2 /** @file
3 * fsw_efi.h - EFI host environment header.
4 */
5
6 /*
7 * Copyright (C) 2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18 /*-
19 * This code is based on:
20 *
21 * Copyright (c) 2006 Christoph Pfisterer
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions are
25 * met:
26 *
27 * * Redistributions of source code must retain the above copyright
28 * notice, this list of conditions and the following disclaimer.
29 *
30 * * Redistributions in binary form must reproduce the above copyright
31 * notice, this list of conditions and the following disclaimer in the
32 * documentation and/or other materials provided with the
33 * distribution.
34 *
35 * * Neither the name of Christoph Pfisterer nor the names of the
36 * contributors may be used to endorse or promote products derived
37 * from this software without specific prior written permission.
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
40 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
41 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
42 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
43 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
46 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
47 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
49 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 */
51
52 #ifndef _FSW_EFI_H_
53 #define _FSW_EFI_H_
54
55 #include "fsw_core.h"
56
57 #ifdef __MAKEWITH_GNUEFI
58 #define CompareGuid(a, b) CompareGuid(a, b)==0
59 #endif
60
61 // extern CHAR8 *msgCursor;
62 // extern MESSAGE_LOG_PROTOCOL *Msg;
63
64 /**
65 * EFI Host: Private per-volume structure.
66 */
67
68 typedef struct {
69 UINT64 Signature; //!< Used to identify this structure
70
71 EFI_FILE_IO_INTERFACE FileSystem; //!< Published EFI protocol interface structure
72
73 EFI_HANDLE Handle; //!< The device handle the protocol is attached to
74 EFI_DISK_IO *DiskIo; //!< The Disk I/O protocol we use for disk access
75 UINT32 MediaId; //!< The media ID from the Block I/O protocol
76 EFI_STATUS LastIOStatus; //!< Last status from Disk I/O
77
78 struct fsw_volume *vol; //!< FSW volume structure
79
80 } FSW_VOLUME_DATA;
81
82 /** Signature for the volume structure. */
83 #define FSW_VOLUME_DATA_SIGNATURE EFI_SIGNATURE_32 ('f', 's', 'w', 'V')
84 /** Access macro for the volume structure. */
85 #define FSW_VOLUME_FROM_FILE_SYSTEM(a) CR (a, FSW_VOLUME_DATA, FileSystem, FSW_VOLUME_DATA_SIGNATURE)
86
87 /**
88 * EFI Host: Private structure for a EFI_FILE interface.
89 */
90
91 typedef struct {
92 UINT64 Signature; //!< Used to identify this structure
93
94 EFI_FILE FileHandle; //!< Published EFI protocol interface structure
95
96 UINT64 Type; //!< File type used for dispatching
97 struct fsw_shandle shand; //!< FSW handle for this file
98
99 } FSW_FILE_DATA;
100
101 /** File type: regular file. */
102 #define FSW_EFI_FILE_TYPE_FILE (0)
103 /** File type: directory. */
104 #define FSW_EFI_FILE_TYPE_DIR (1)
105
106 /** Signature for the file handle structure. */
107 #define FSW_FILE_DATA_SIGNATURE EFI_SIGNATURE_32 ('f', 's', 'w', 'F')
108 /** Access macro for the file handle structure. */
109 #define FSW_FILE_FROM_FILE_HANDLE(a) CR (a, FSW_FILE_DATA, FileHandle, FSW_FILE_DATA_SIGNATURE)
110
111
112 //
113 // Library functions
114 //
115
116 VOID fsw_efi_decode_time(OUT EFI_TIME *EfiTime, IN UINT32 UnixTime);
117
118 UINTN fsw_efi_strsize(struct fsw_string *s);
119 VOID fsw_efi_strcpy(CHAR16 *Dest, struct fsw_string *src);
120
121
122 #endif