Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / fs / hfsplus / include / volume.h
1 /*
2  * libhfs - library for reading and writing Macintosh HFS volumes
3  * Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>^
4  * Original 1996-1998 Robert Leslie <rob@mars.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  * $Id: volume.h,v 1.11 2000/10/17 05:58:46 hasi Exp $
22  */
23
24 #ifndef _H_VOLUME
25 #define _H_VOLUME
26
27 /* Open the device, read and verify the volume header
28    (and its backup) */
29 extern int volume_open(volume* vol, int os_fd);
30
31 /* Write back all data eventually cached and close the device. */
32 extern int volume_close(volume* vol);
33
34 /* read multiple blocks into given memory.
35  *
36  * returns given pointer or NULL on failure.
37  */
38 extern void* volume_readfromfork(volume* vol, void* buf,
39         hfsp_fork_raw* f, UInt32 block,
40         UInt32 count, UInt8 forktype, UInt32 fileId);
41
42 /* Fill a given buffer with the given block in volume.
43  */
44 int volume_readinbuf(volume * vol,void* buf, long block);
45
46 /* invalidat cache hold in volume, will be removed when
47  * caching strategy is clear to me. */
48 /*
49 extern inline void volume_invalidate_cache(volume* vol)
50 {
51     vol -> currblock = (UInt32) -1;
52 }
53 */
54
55 /* Check in Allocation file if given block is allocated. */
56 extern int volume_allocated(volume* v, UInt32 block);
57
58 /* Read a raw hfsp_extent_rec from memory. */
59 extern void* volume_readextent(void *p, hfsp_extent_rec er);
60
61 /* Read fork information from raw memory */
62 extern void* volume_readfork(void *p, hfsp_fork_raw* f);
63
64 /* internal function used to create the extents btree,
65    is called by following inline fucntion when needed */
66 extern void volume_create_extents_tree(volume* vol);
67
68 /* accessor for entends btree, is created on demand */
69 static inline btree* volume_get_extents_tree(volume* vol) {
70     if (!vol->extents)
71         volume_create_extents_tree(vol);
72     return vol->extents;
73 }
74
75 /* Determine whether the volume is a HFS-plus volume */
76 int volume_probe(int fd, long long offset);
77
78 #ifdef DEBUG
79     /* Print raw fork information to stdout */
80   void volume_print_fork(hfsp_fork_raw* f);
81     /* Dump all the volume information to stdout */
82   void volume_print(hfsp_vh* vol);
83 #endif
84
85
86
87 #endif   /* _H_VOLUME */