1 /////////////////////////////////////////////////////////////////////////
2 // $Id: vmware4.h,v 1.1 2006/12/17 08:17:28 vruppert Exp $
3 /////////////////////////////////////////////////////////////////////////
6 * This file provides support for VMWare's virtual disk image
7 * format version 4 and above.
9 * Author: Sharvil Nanavati
10 * Contact: snrrrub@gmail.com
12 * Copyright (C) 2006 Sharvil Nanavati.
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 class vmware4_image_t
: public device_image_t
36 virtual ~vmware4_image_t();
38 int open(const char* pathname
);
40 Bit64s
lseek(Bit64s offset
, int whence
);
41 ssize_t
read(void* buf
, size_t count
);
42 ssize_t
write(const void* buf
, size_t count
);
45 static const off_t INVALID_OFFSET
;
46 static const int SECTOR_SIZE
;
50 #elif defined(__MWERKS__) && defined(macintosh)
51 #pragma options align=packed
53 typedef struct _VM4_Header
59 Bit64u tlb_size_sectors
;
60 Bit64u description_offset_sectors
;
61 Bit64u description_size_sectors
;
63 Bit64u flb_offset_sectors
;
64 Bit64u flb_copy_offset_sectors
;
65 Bit64u tlb_offset_sectors
;
67 #if !defined(_MSC_VER)
68 GCC_ATTRIBUTE((packed
))
74 #elif defined(__MWERKS__) && defined(macintosh)
75 #pragma options align=reset
79 bool is_valid_header() const;
84 Bit32u
read_block_index(Bit64u sector
, Bit32u index
);
85 void write_block_index(Bit64u sector
, Bit32u index
, Bit32u block_sector
);