Changeset 46408 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 6, 2013 1:28:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_hfs.h
r29125 r46408 23 23 24 24 #include "fsw_core.h" 25 #include "iprt/formats/hfs.h" 26 #include "iprt/asm.h" /* endian conversion */ 25 27 26 28 … … 31 33 #define HFS_SUPERBLOCK_BLOCKNO 2 32 34 33 /* Make world look Applish enough for the system header describing HFS layout */34 #define __APPLE_API_PRIVATE35 #define __APPLE_API_UNSTABLE36 37 #define u_int8_t fsw_u838 #define u_int16_t fsw_u1639 #define u_int32_t fsw_u3240 #define u_int64_t fsw_u6441 #define int8_t fsw_s842 #define int16_t fsw_s1643 #define int32_t fsw_s3244 #define int64_t fsw_s6445 46 #include "hfs_format.h"47 48 #undef u_int8_t49 #undef u_int16_t50 #undef u_int32_t51 #undef u_int64_t52 #undef int8_t53 #undef int16_t54 #undef int32_t55 #undef int64_t56 57 #pragma pack(1)58 35 #ifdef _MSC_VER 59 36 /* vasily: disable warning for non-standard anonymous struct/union … … 61 38 */ 62 39 # pragma warning (disable:4201) 63 # define inline __inline64 40 #endif 65 41 … … 68 44 }; 69 45 46 #pragma pack(1) 70 47 struct fsw_hfs_key 71 48 { … … 77 54 }; 78 55 }; 79 80 56 #pragma pack() 81 57 … … 92 68 * HFS: Dnode structure with HFS-specific data. 93 69 */ 94 95 70 struct fsw_hfs_dnode 96 71 { … … 131 106 }; 132 107 133 /* Endianess swappers */134 static inline fsw_u16 135 swab16(fsw_u16 x)108 /* Endianess swappers. */ 109 DECLINLINE(fsw_u16) 110 be16_to_cpu(fsw_u16 x) 136 111 { 137 return x<<8 | x>>8;112 return RT_BE2H_U16(x); 138 113 } 139 114 140 static inline fsw_u32 141 swab32(fsw_u32x)115 DECLINLINE(fsw_u16) 116 cpu_to_be16(fsw_u16 x) 142 117 { 143 return x<<24 | x>>24 | 144 (x & (fsw_u32)0x0000ff00UL)<<8 | 145 (x & (fsw_u32)0x00ff0000UL)>>8; 118 return RT_H2BE_U16(x); 146 119 } 147 120 148 121 149 static inline fsw_u64 150 swab64(fsw_u64x)122 DECLINLINE(fsw_u32) 123 cpu_to_be32(fsw_u32 x) 151 124 { 152 return x<<56 | x>>56 | 153 (x & (fsw_u64)0x000000000000ff00ULL)<<40 | 154 (x & (fsw_u64)0x0000000000ff0000ULL)<<24 | 155 (x & (fsw_u64)0x00000000ff000000ULL)<< 8 | 156 (x & (fsw_u64)0x000000ff00000000ULL)>> 8 | 157 (x & (fsw_u64)0x0000ff0000000000ULL)>>24 | 158 (x & (fsw_u64)0x00ff000000000000ULL)>>40; 125 return RT_H2BE_U32(x); 159 126 } 160 127 161 static inline fsw_u16 162 be 16_to_cpu(fsw_u16x)128 DECLINLINE(fsw_u32) 129 be32_to_cpu(fsw_u32 x) 163 130 { 164 return swab16(x);131 return RT_BE2H_U32(x); 165 132 } 166 133 167 static inline fsw_u16 168 cpu_to_be16(fsw_u16 x) 169 { 170 return swab16(x); 171 } 172 173 174 static inline fsw_u32 175 cpu_to_be32(fsw_u32 x) 176 { 177 return swab32(x); 178 } 179 180 static inline fsw_u32 181 be32_to_cpu(fsw_u32 x) 182 { 183 return swab32(x); 184 } 185 186 static inline fsw_u64 134 DECLINLINE(fsw_u64) 187 135 be64_to_cpu(fsw_u64 x) 188 136 { 189 return swab64(x);137 return RT_BE2H_U64(x); 190 138 } 191 139 192 140 #endif 141
Note:
See TracChangeset
for help on using the changeset viewer.