Upgraded GRUB2 to 2.00 release.
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / zfs / dnode.h
blobe4993df1ed6c88624df333986b7349f34d6a8696
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
5 * GRUB 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 3 of the License, or
8 * (at your option) any later version.
10 * GRUB 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.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
20 * Use is subject to license terms.
23 #ifndef _SYS_DNODE_H
24 #define _SYS_DNODE_H
26 #include <grub/zfs/spa.h>
29 * Fixed constants.
31 #define DNODE_SHIFT 9 /* 512 bytes */
32 #define DNODE_BLOCK_SHIFT 14 /* 16k */
33 #define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */
36 * Derived constants.
38 #define DNODE_SIZE (1 << DNODE_SHIFT)
39 #define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT)
40 #define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT))
42 #define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT)
43 #define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT)
45 #define DNODE_FLAG_SPILL_BLKPTR (1<<2)
47 #define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \
48 (((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t))))
50 typedef struct dnode_phys {
51 grub_uint8_t dn_type; /* dmu_object_type_t */
52 grub_uint8_t dn_indblkshift; /* ln2(indirect block size) */
53 grub_uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */
54 grub_uint8_t dn_nblkptr; /* length of dn_blkptr */
55 grub_uint8_t dn_bonustype; /* type of data in bonus buffer */
56 grub_uint8_t dn_checksum; /* ZIO_CHECKSUM type */
57 grub_uint8_t dn_compress; /* ZIO_COMPRESS type */
58 grub_uint8_t dn_flags; /* DNODE_FLAG_* */
59 grub_uint16_t dn_datablkszsec; /* data block size in 512b sectors */
60 grub_uint16_t dn_bonuslen; /* length of dn_bonus */
61 grub_uint8_t dn_pad2[4];
63 /* accounting is protected by dn_dirty_mtx */
64 grub_uint64_t dn_maxblkid; /* largest allocated block ID */
65 grub_uint64_t dn_used; /* bytes (or sectors) of disk space */
67 grub_uint64_t dn_pad3[4];
69 blkptr_t dn_blkptr[1];
70 grub_uint8_t dn_bonus[DN_MAX_BONUSLEN - sizeof (blkptr_t)];
71 blkptr_t dn_spill;
72 } dnode_phys_t;
74 #endif /* _SYS_DNODE_H */