1 | /* $Id: fsw_base.h 69500 2017-10-28 15:14:05Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * fsw_base.h - Base definitions switch.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2017 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 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | * ---------------------------------------------------------------------------
|
---|
26 | * This code is based on:
|
---|
27 | *
|
---|
28 | * Copyright (c) 2006 Christoph Pfisterer
|
---|
29 | *
|
---|
30 | * Redistribution and use in source and binary forms, with or without
|
---|
31 | * modification, are permitted provided that the following conditions are
|
---|
32 | * met:
|
---|
33 | *
|
---|
34 | * * Redistributions of source code must retain the above copyright
|
---|
35 | * notice, this list of conditions and the following disclaimer.
|
---|
36 | *
|
---|
37 | * * Redistributions in binary form must reproduce the above copyright
|
---|
38 | * notice, this list of conditions and the following disclaimer in the
|
---|
39 | * documentation and/or other materials provided with the
|
---|
40 | * distribution.
|
---|
41 | *
|
---|
42 | * * Neither the name of Christoph Pfisterer nor the names of the
|
---|
43 | * contributors may be used to endorse or promote products derived
|
---|
44 | * from this software without specific prior written permission.
|
---|
45 | *
|
---|
46 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
47 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
48 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
---|
49 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
---|
50 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
51 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
52 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
56 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
57 | */
|
---|
58 |
|
---|
59 | #ifndef _FSW_BASE_H_
|
---|
60 | #define _FSW_BASE_H_
|
---|
61 |
|
---|
62 | #ifdef VBOX
|
---|
63 | #include "VBoxFswParam.h"
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | #ifndef FSW_DEBUG_LEVEL
|
---|
67 | /**
|
---|
68 | * Global debugging level. Can be set locally for the scope of a single
|
---|
69 | * file by defining the macro before fsw_base.h is included.
|
---|
70 | */
|
---|
71 | #define FSW_DEBUG_LEVEL 1
|
---|
72 | #endif
|
---|
73 |
|
---|
74 |
|
---|
75 | #ifdef HOST_EFI
|
---|
76 | #include "fsw_efi_base.h"
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | #ifdef HOST_POSIX
|
---|
80 | #include "fsw_posix_base.h"
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | // message printing
|
---|
84 |
|
---|
85 | #if FSW_DEBUG_LEVEL >= 1
|
---|
86 | #define FSW_MSG_ASSERT(params) FSW_MSGFUNC params
|
---|
87 | #else
|
---|
88 | #define FSW_MSG_ASSERT(params)
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #if FSW_DEBUG_LEVEL >= 2
|
---|
92 | #define FSW_MSG_DEBUG(params) FSW_MSGFUNC params
|
---|
93 | #else
|
---|
94 | #define FSW_MSG_DEBUG(params)
|
---|
95 | #endif
|
---|
96 |
|
---|
97 | #if FSW_DEBUG_LEVEL >= 3
|
---|
98 | #define FSW_MSG_DEBUGV(params) FSW_MSGFUNC params
|
---|
99 | #else
|
---|
100 | #define FSW_MSG_DEBUGV(params)
|
---|
101 | #endif
|
---|
102 |
|
---|
103 |
|
---|
104 | // Documentation for system-dependent defines
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * \typedef fsw_s8
|
---|
108 | * Signed 8-bit integer.
|
---|
109 | */
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * \typedef fsw_u8
|
---|
113 | * Unsigned 8-bit integer.
|
---|
114 | */
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * \typedef fsw_s16
|
---|
118 | * Signed 16-bit integer.
|
---|
119 | */
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * \typedef fsw_u16
|
---|
123 | * Unsigned 16-bit integer.
|
---|
124 | */
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * \typedef fsw_s32
|
---|
128 | * Signed 32-bit integer.
|
---|
129 | */
|
---|
130 |
|
---|
131 | /**
|
---|
132 | * \typedef fsw_u32
|
---|
133 | * Unsigned 32-bit integer.
|
---|
134 | */
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * \typedef fsw_s64
|
---|
138 | * Signed 64-bit integer.
|
---|
139 | */
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * \typedef fsw_u64
|
---|
143 | * Unsigned 64-bit integer.
|
---|
144 | */
|
---|
145 |
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * \def fsw_alloc(size,ptrptr)
|
---|
149 | * Allocate memory on the heap. This function or macro allocates \a size
|
---|
150 | * bytes of memory using host-specific methods. The address of the
|
---|
151 | * allocated memory block is stored into the pointer variable pointed
|
---|
152 | * to by \a ptrptr. A status code is returned; FSW_SUCCESS if the block
|
---|
153 | * was allocated or FSW_OUT_OF_MEMORY if there is not enough memory
|
---|
154 | * to allocated the requested block.
|
---|
155 | */
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * \def fsw_free(ptr)
|
---|
159 | * Release allocated memory. This function or macro returns an allocated
|
---|
160 | * memory block to the heap for reuse. Does not return a status.
|
---|
161 | */
|
---|
162 |
|
---|
163 | /**
|
---|
164 | * \def fsw_memcpy(dest,src,size)
|
---|
165 | * Copies a block of memory from \a src to \a dest. The two memory blocks
|
---|
166 | * must not overlap, or the result of the operation will be undefined.
|
---|
167 | * Does not return a status.
|
---|
168 | */
|
---|
169 |
|
---|
170 | /**
|
---|
171 | * \def fsw_memeq(dest,src,size)
|
---|
172 | * Compares two blocks of memory for equality. Returns boolean true if the
|
---|
173 | * memory blocks are equal, boolean false if they are different.
|
---|
174 | */
|
---|
175 |
|
---|
176 | /**
|
---|
177 | * \def fsw_memzero(dest,size)
|
---|
178 | * Initializes a block of memory with zeros. Does not return a status.
|
---|
179 | */
|
---|
180 |
|
---|
181 |
|
---|
182 | #endif
|
---|