aboutsummaryrefslogtreecommitdiff
path: root/vmdk.h
blob: dbb352d49742db093b302194c15b8474ced1e4e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
   Copyright (C) Matthew Chapman 2003

   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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#define SECTOR_BITS	9
#define SECTOR_SIZE	(1 << SECTOR_BITS)
#define SECTOR_MASK	(SECTOR_SIZE - 1)

#define L1_BITS		(SECTOR_BITS - 3)
#define L1_SIZE		(1 << L1_BITS)
#define L1_MASK		(L1_SIZE - 1)

#define L2_BITS		SECTOR_BITS
#define L2_SIZE		(1 << L2_BITS)
#define L2_MASK		(L2_SIZE - 1)

#define MIN(x,y)	(((x) < (y)) ? (x) : (y))

struct cowdisk_header
{
    uint32_t version;
    uint32_t flags;
    uint32_t disk_sectors;
    uint32_t granularity;
    uint32_t l1dir_offset;
    uint32_t l1dir_size;
    uint32_t file_sectors;
    uint32_t cylinders;
    uint32_t heads;
    uint32_t sectors_per_track;
};

struct cowdisk_header2
{
   uint32_t parent_ts;
   uint32_t timestamp;
};

/* based on vdk 3.1 10-11-2003 by Ken Kato */

struct vmdisk_header
{
    uint32_t version;
    uint32_t flags;
    
    int64_t capacity;
    int64_t granularity;
    int64_t desc_offset;
    int64_t desc_size;
    int32_t num_gtes_per_gte;
    int64_t rgd_offset;
    int64_t gd_offset;
    int64_t grain_offset;

    char filler[1];

    char check_bytes[4];
};