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>
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.
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.
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,
21 * $Id: volume.h,v 1.11 2000/10/17 05:58:46 hasi Exp $
27 /* Open the device, read and verify the volume header
29 extern int volume_open(volume* vol, int os_fd);
31 /* Write back all data eventually cached and close the device. */
32 extern int volume_close(volume* vol);
34 /* read multiple blocks into given memory.
36 * returns given pointer or NULL on failure.
38 extern void* volume_readfromfork(volume* vol, void* buf,
39 hfsp_fork_raw* f, UInt32 block,
40 UInt32 count, UInt8 forktype, UInt32 fileId);
42 /* Fill a given buffer with the given block in volume.
44 int volume_readinbuf(volume * vol,void* buf, long block);
46 /* invalidat cache hold in volume, will be removed when
47 * caching strategy is clear to me. */
49 extern inline void volume_invalidate_cache(volume* vol)
51 vol -> currblock = (UInt32) -1;
55 /* Check in Allocation file if given block is allocated. */
56 extern int volume_allocated(volume* v, UInt32 block);
58 /* Read a raw hfsp_extent_rec from memory. */
59 extern void* volume_readextent(void *p, hfsp_extent_rec er);
61 /* Read fork information from raw memory */
62 extern void* volume_readfork(void *p, hfsp_fork_raw* f);
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);
68 /* accessor for entends btree, is created on demand */
69 static inline btree* volume_get_extents_tree(volume* vol) {
71 volume_create_extents_tree(vol);
75 /* Determine whether the volume is a HFS-plus volume */
76 int volume_probe(int fd, long long offset);
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);
87 #endif /* _H_VOLUME */