|
|
1.1 root 1: /*
2: * libhfs - library for reading and writing Macintosh HFS volumes
3: *
4: * The iterator shown here iterates over the blocks of a fork.
5: *
6: * Copyright (C) 2000 Klaus Halfmann <[email protected]>
7: * Original work by 1996-1998 Robert Leslie <[email protected]>
8: * other work 2000 from Brad Boyer ([email protected])
9: *
10: * This program is free software; you can redistribute it and/or modify
11: * it under the terms of the GNU General Public License as published by
12: * the Free Software Foundation; either version 2 of the License, or
13: * (at your option) any later version.
14: *
15: * This program is distributed in the hope that it will be useful,
16: * but WITHOUT ANY WARRANTY; without even the implied warranty of
17: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: * GNU General Public License for more details.
19: *
20: * You should have received a copy of the GNU General Public License
21: * along with this program; if not, write to the Free Software
22: * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23: * MA 02110-1301, USA.
24: *
25: * $Id: blockiter.h,v 1.1 2000/10/10 11:14:05 hasi Exp $
26: */
27:
28: /* Structure of the blockiterator */
29: typedef struct
30: {
31: volume* vol; // volume we iterate over
32: UInt32 curr_block; // current, absolute block
33: UInt32 block; // relative block in current extent
34: UInt32 max_block; // Maximum allowed block
35: UInt32 fileId; // id of file we iterate over
36: int index; // 0 .. 7 in current extent
37: hfsp_extent* file; // original extent record from file
38: hfsp_extent* e; // current extentent under examination
39: UInt8 forktype; // type of fork we iterate over
40: UInt8 in_extent; // boolean 0 - in file extent
41: // 1 - in extents file
42: extent_record er; // record to iterate in extents file.
43: } blockiter;
44:
45: /* Initialize iterator for a given fork */
46: extern void blockiter_init(blockiter* b, volume* vol, hfsp_fork_raw* f,
47: UInt8 forktype, UInt32 fileId);
48:
49: /* find next block of the fork iterating over */
50: extern int blockiter_next(blockiter *b);
51:
52: /* skip the indicated number of blocks */
53: extern int blockiter_skip(blockiter *b, UInt32 skip);
54:
55: /* return current block */
56: static inline UInt32 blockiter_curr(blockiter *b)
57: {
58: return b->e->start_block + b->block;
59: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.