summaryrefslogtreecommitdiffstats
path: root/qemu/roms/openbios/fs/hfsplus/include/blockiter.h
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@intel.com>2015-08-28 09:58:54 +0800
committerYang Zhang <yang.z.zhang@intel.com>2015-09-01 12:44:00 +0800
commite44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch)
tree66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/openbios/fs/hfsplus/include/blockiter.h
parent9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff)
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5 Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/openbios/fs/hfsplus/include/blockiter.h')
-rw-r--r--qemu/roms/openbios/fs/hfsplus/include/blockiter.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/qemu/roms/openbios/fs/hfsplus/include/blockiter.h b/qemu/roms/openbios/fs/hfsplus/include/blockiter.h
new file mode 100644
index 000000000..da3e480fd
--- /dev/null
+++ b/qemu/roms/openbios/fs/hfsplus/include/blockiter.h
@@ -0,0 +1,59 @@
+/*
+ * libhfs - library for reading and writing Macintosh HFS volumes
+ *
+ * The iterator shown here iterates over the blocks of a fork.
+ *
+ * Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
+ * Original work by 1996-1998 Robert Leslie <rob@mars.org>
+ * other work 2000 from Brad Boyer (flar@pants.nu)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * $Id: blockiter.h,v 1.1 2000/10/10 11:14:05 hasi Exp $
+ */
+
+/* Structure of the blockiterator */
+typedef struct
+{
+ volume* vol; // volume we iterate over
+ UInt32 curr_block; // current, absolute block
+ UInt32 block; // relative block in current extent
+ UInt32 max_block; // Maximum allowed block
+ UInt32 fileId; // id of file we iterate over
+ int index; // 0 .. 7 in current extent
+ hfsp_extent* file; // original extent record from file
+ hfsp_extent* e; // current extentent under examination
+ UInt8 forktype; // type of fork we iterate over
+ UInt8 in_extent; // boolean 0 - in file extent
+ // 1 - in extents file
+ extent_record er; // record to iterate in extents file.
+} blockiter;
+
+/* Initialize iterator for a given fork */
+extern void blockiter_init(blockiter* b, volume* vol, hfsp_fork_raw* f,
+ UInt8 forktype, UInt32 fileId);
+
+/* find next block of the fork iterating over */
+extern int blockiter_next(blockiter *b);
+
+/* skip the indicated number of blocks */
+extern int blockiter_skip(blockiter *b, UInt32 skip);
+
+/* return current block */
+static inline UInt32 blockiter_curr(blockiter *b)
+{
+ return b->e->start_block + b->block;
+}