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