Debian Codegraph @

tools/libfsimage/zfs/zfs-include/zio.h

raw
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, see <http://www.gnu.org/licenses/>.
17 */
18 /*
19 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
20 * Use is subject to license terms.
21 */
22
23 #ifndef _ZIO_H
24 #define _ZIO_H
25
26 #define ZEC_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */
27
28 typedef struct zio_eck {
29 uint64_t zec_magic; /* for validation, endianness */
30 zio_cksum_t zec_cksum; /* 256-bit checksum */
31 } zio_eck_t;
32
33 /*
34 * Gang block headers are self-checksumming and contain an array
35 * of block pointers.
36 */
37 #define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE
38 #define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \
39 sizeof (zio_eck_t)) / sizeof (blkptr_t))
40 #define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \
41 sizeof (zio_eck_t) - \
42 (SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
43 sizeof (uint64_t))
44
45 #define ZIO_GET_IOSIZE(zio) \
46 (BP_IS_GANG((zio)->io_bp) ? \
47 SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp))
48
49 typedef struct zio_gbh {
50 blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS];
51 uint64_t zg_filler[SPA_GBH_FILLER];
52 zio_eck_t zg_tail;
53 } zio_gbh_phys_t;
54
55 enum zio_checksum {
56 ZIO_CHECKSUM_INHERIT = 0,
57 ZIO_CHECKSUM_ON,
58 ZIO_CHECKSUM_OFF,
59 ZIO_CHECKSUM_LABEL,
60 ZIO_CHECKSUM_GANG_HEADER,
61 ZIO_CHECKSUM_ZILOG,
62 ZIO_CHECKSUM_FLETCHER_2,
63 ZIO_CHECKSUM_FLETCHER_4,
64 ZIO_CHECKSUM_SHA256,
65 ZIO_CHECKSUM_ZILOG2,
66 ZIO_CHECKSUM_FUNCTIONS
67 };
68
69 enum zio_compress {
70 ZIO_COMPRESS_INHERIT = 0,
71 ZIO_COMPRESS_ON,
72 ZIO_COMPRESS_OFF,
73 ZIO_COMPRESS_LZJB,
74 ZIO_COMPRESS_EMPTY,
75 ZIO_COMPRESS_FUNCTIONS
76 };
77
78 #endif /* _ZIO_H */