1 /////////////////////////////////////////////////////////////////////////
2 // $Id: vmware3.h,v 1.12 2008/01/26 22:24:03 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
6 * This file provides the interface for using VMWare's virtual
7 * disk image format under Bochs.
9 * Author: Sharvil Nanavati, for Net Integration Technologies, Inc.
10 * Contact: snrrrub@yahoo.com
12 * Copyright (C) 2003 Net Integration Technologies, Inc.
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 vmware3_image_t
: public device_image_t
35 vmware3_image_t() : FL_SHIFT(25), FL_MASK(0xFE000000)
37 int open(const char* pathname
);
39 Bit64s
lseek(Bit64s offset
, int whence
);
40 ssize_t
read(void* buf
, size_t count
);
41 ssize_t
write(const void* buf
, size_t count
);
44 static const off_t INVALID_OFFSET
;
46 #if defined(_MSC_VER) && (_MSC_VER<1300)
48 #elif defined(__MWERKS__) && defined(macintosh)
49 #pragma options align=packed
52 #if defined(_MSC_VER) && (_MSC_VER>=1300)
57 Bit32u header_version
;
60 Bit32u tlb_size_sectors
;
61 Bit32u flb_offset_sectors
;
63 Bit32u next_sector_to_allocate
;
68 Bit32u last_modified_time
;
70 Bit32u last_modified_time_save
;
73 Bit32u number_of_chains
;
74 Bit32u cylinders_in_disk
;
76 Bit32u sectors_in_disk
;
77 Bit32u total_sectors_in_disk
;
79 Bit32u vmware_version
;
82 #if !defined(_MSC_VER)
83 GCC_ATTRIBUTE((packed
))
87 #if defined(_MSC_VER) && (_MSC_VER<1300)
89 #elif defined(__MWERKS__) && defined(macintosh)
90 #pragma options align=reset
94 friend struct COW_Image
;
105 } * images
, * current
;
107 int read_header(int fd
, COW_Header
& header
);
108 int write_header(int fd
, COW_Header
& header
);
110 int read_ints(int fd
, Bit32u
*buffer
, size_t count
);
111 int write_ints(int fd
, Bit32u
*buffer
, size_t count
);
113 char * generate_cow_name(const char * filename
, Bit32u chain
);
114 bool is_valid_header(COW_Header
& header
);
115 off_t
perform_seek();
118 const Bit32u FL_SHIFT
;
119 const Bit32u FL_MASK
;
121 off_t requested_offset
;