VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_hfs.h@ 46408

Last change on this file since 46408 was 46408, checked in by vboxsync, 12 years ago

Use iprt/formats/hfs.h. Also use IPRT for endian conversion.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: fsw_hfs.h 46408 2013-06-06 13:28:44Z vboxsync $ */
2/** @file
3 * fsw_hfs.h - HFS file system driver 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#ifndef _FSW_HFS_H_
19#define _FSW_HFS_H_
20
21#define VOLSTRUCTNAME fsw_hfs_volume
22#define DNODESTRUCTNAME fsw_hfs_dnode
23
24#include "fsw_core.h"
25#include "iprt/formats/hfs.h"
26#include "iprt/asm.h" /* endian conversion */
27
28
29//! Block size for HFS volumes.
30#define HFS_BLOCKSIZE 512
31
32//! Block number where the HFS superblock resides.
33#define HFS_SUPERBLOCK_BLOCKNO 2
34
35#ifdef _MSC_VER
36/* vasily: disable warning for non-standard anonymous struct/union
37 * declarations
38 */
39# pragma warning (disable:4201)
40#endif
41
42struct hfs_dirrec {
43 fsw_u8 _dummy;
44};
45
46#pragma pack(1)
47struct fsw_hfs_key
48{
49 union
50 {
51 struct HFSPlusExtentKey ext_key;
52 struct HFSPlusCatalogKey cat_key;
53 fsw_u16 key_len; /* Length is at the beginning of all keys */
54 };
55};
56#pragma pack()
57
58typedef enum {
59 /* Regular HFS */
60 FSW_HFS_PLAIN = 0,
61 /* HFS+ */
62 FSW_HFS_PLUS,
63 /* HFS+ embedded to HFS */
64 FSW_HFS_PLUS_EMB
65} fsw_hfs_kind;
66
67/**
68 * HFS: Dnode structure with HFS-specific data.
69 */
70struct fsw_hfs_dnode
71{
72 struct fsw_dnode g; //!< Generic dnode structure
73 HFSPlusExtentRecord extents;
74 fsw_u32 ctime;
75 fsw_u32 mtime;
76 fsw_u64 used_bytes;
77};
78
79/**
80 * HFS: In-memory B-tree structure.
81 */
82struct fsw_hfs_btree
83{
84 fsw_u32 root_node;
85 fsw_u32 node_size;
86 struct fsw_hfs_dnode* file;
87};
88
89
90/**
91 * HFS: In-memory volume structure with HFS-specific data.
92 */
93
94struct fsw_hfs_volume
95{
96 struct fsw_volume g; //!< Generic volume structure
97
98 struct HFSPlusVolumeHeader *primary_voldesc; //!< Volume Descriptor
99 struct fsw_hfs_btree catalog_tree; // Catalog tree
100 struct fsw_hfs_btree extents_tree; // Extents overflow tree
101 struct fsw_hfs_dnode root_file;
102 int case_sensitive;
103 fsw_u32 block_size_shift;
104 fsw_hfs_kind hfs_kind;
105 fsw_u32 emb_block_off;
106};
107
108/* Endianess swappers. */
109DECLINLINE(fsw_u16)
110be16_to_cpu(fsw_u16 x)
111{
112 return RT_BE2H_U16(x);
113}
114
115DECLINLINE(fsw_u16)
116cpu_to_be16(fsw_u16 x)
117{
118 return RT_H2BE_U16(x);
119}
120
121
122DECLINLINE(fsw_u32)
123cpu_to_be32(fsw_u32 x)
124{
125 return RT_H2BE_U32(x);
126}
127
128DECLINLINE(fsw_u32)
129be32_to_cpu(fsw_u32 x)
130{
131 return RT_BE2H_U32(x);
132}
133
134DECLINLINE(fsw_u64)
135be64_to_cpu(fsw_u64 x)
136{
137 return RT_BE2H_U64(x);
138}
139
140#endif
141
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette