ia64/xen-unstable

view tools/libfsimage/zfs/zfs-include/zap_impl.h @ 19648:f0e2df69a8eb

x86 hvm: Allow cross-vendor migration

Intercept #UD and emulate SYSCALL/SYSENTER/SYSEXIT as necessary.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 26 15:01:36 2009 +0100 (2009-05-26)
parents 64f790e90d3d
children
line source
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /*
20 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
21 * Use is subject to license terms.
22 */
24 #ifndef _SYS_ZAP_IMPL_H
25 #define _SYS_ZAP_IMPL_H
27 #define ZAP_MAGIC 0x2F52AB2ABULL
29 #define ZAP_HASHBITS 28
30 #define MZAP_ENT_LEN 64
31 #define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2)
32 #define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT
33 #define MZAP_MAX_BLKSZ (1 << MZAP_MAX_BLKSHIFT)
35 typedef struct mzap_ent_phys {
36 uint64_t mze_value;
37 uint32_t mze_cd;
38 uint16_t mze_pad; /* in case we want to chain them someday */
39 char mze_name[MZAP_NAME_LEN];
40 } mzap_ent_phys_t;
42 typedef struct mzap_phys {
43 uint64_t mz_block_type; /* ZBT_MICRO */
44 uint64_t mz_salt;
45 uint64_t mz_pad[6];
46 mzap_ent_phys_t mz_chunk[1];
47 /* actually variable size depending on block size */
48 } mzap_phys_t;
50 /*
51 * The (fat) zap is stored in one object. It is an array of
52 * 1<<FZAP_BLOCK_SHIFT byte blocks. The layout looks like one of:
53 *
54 * ptrtbl fits in first block:
55 * [zap_phys_t zap_ptrtbl_shift < 6] [zap_leaf_t] ...
56 *
57 * ptrtbl too big for first block:
58 * [zap_phys_t zap_ptrtbl_shift >= 6] [zap_leaf_t] [ptrtbl] ...
59 *
60 */
62 #define ZBT_LEAF ((1ULL << 63) + 0)
63 #define ZBT_HEADER ((1ULL << 63) + 1)
64 #define ZBT_MICRO ((1ULL << 63) + 3)
65 /* any other values are ptrtbl blocks */
67 /*
68 * the embedded pointer table takes up half a block:
69 * block size / entry size (2^3) / 2
70 */
71 #define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1)
73 /*
74 * The embedded pointer table starts half-way through the block. Since
75 * the pointer table itself is half the block, it starts at (64-bit)
76 * word number (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap)).
77 */
78 #define ZAP_EMBEDDED_PTRTBL_ENT(zap, idx) \
79 ((uint64_t *)(zap)->zap_f.zap_phys) \
80 [(idx) + (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap))]
82 /*
83 * TAKE NOTE:
84 * If zap_phys_t is modified, zap_byteswap() must be modified.
85 */
86 typedef struct zap_phys {
87 uint64_t zap_block_type; /* ZBT_HEADER */
88 uint64_t zap_magic; /* ZAP_MAGIC */
90 struct zap_table_phys {
91 uint64_t zt_blk; /* starting block number */
92 uint64_t zt_numblks; /* number of blocks */
93 uint64_t zt_shift; /* bits to index it */
94 uint64_t zt_nextblk; /* next (larger) copy start block */
95 uint64_t zt_blks_copied; /* number source blocks copied */
96 } zap_ptrtbl;
98 uint64_t zap_freeblk; /* the next free block */
99 uint64_t zap_num_leafs; /* number of leafs */
100 uint64_t zap_num_entries; /* number of entries */
101 uint64_t zap_salt; /* salt to stir into hash function */
102 /*
103 * This structure is followed by padding, and then the embedded
104 * pointer table. The embedded pointer table takes up second
105 * half of the block. It is accessed using the
106 * ZAP_EMBEDDED_PTRTBL_ENT() macro.
107 */
108 } zap_phys_t;
110 #endif /* _SYS_ZAP_IMPL_H */