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