zio.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. /*
  8. * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  9. */
  10. #ifndef _ZIO_H
  11. #define _ZIO_H
  12. #include <zfs/spa.h>
  13. #define ZEC_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */
  14. typedef struct zio_eck {
  15. uint64_t zec_magic; /* for validation, endianness */
  16. zio_cksum_t zec_cksum; /* 256-bit checksum */
  17. } zio_eck_t;
  18. /*
  19. * Gang block headers are self-checksumming and contain an array
  20. * of block pointers.
  21. */
  22. #define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE
  23. #define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \
  24. sizeof(zio_eck_t)) / sizeof(blkptr_t))
  25. #define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \
  26. sizeof(zio_eck_t) - \
  27. (SPA_GBH_NBLKPTRS * sizeof(blkptr_t))) /\
  28. sizeof(uint64_t))
  29. #define ZIO_GET_IOSIZE(zio) \
  30. (BP_IS_GANG((zio)->io_bp) ? \
  31. SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp))
  32. typedef struct zio_gbh {
  33. blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS];
  34. uint64_t zg_filler[SPA_GBH_FILLER];
  35. zio_eck_t zg_tail;
  36. } zio_gbh_phys_t;
  37. enum zio_checksum {
  38. ZIO_CHECKSUM_INHERIT = 0,
  39. ZIO_CHECKSUM_ON,
  40. ZIO_CHECKSUM_OFF,
  41. ZIO_CHECKSUM_LABEL,
  42. ZIO_CHECKSUM_GANG_HEADER,
  43. ZIO_CHECKSUM_ZILOG,
  44. ZIO_CHECKSUM_FLETCHER_2,
  45. ZIO_CHECKSUM_FLETCHER_4,
  46. ZIO_CHECKSUM_SHA256,
  47. ZIO_CHECKSUM_ZILOG2,
  48. ZIO_CHECKSUM_FUNCTIONS
  49. };
  50. #define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2
  51. #define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON
  52. enum zio_compress {
  53. ZIO_COMPRESS_INHERIT = 0,
  54. ZIO_COMPRESS_ON,
  55. ZIO_COMPRESS_OFF,
  56. ZIO_COMPRESS_LZJB,
  57. ZIO_COMPRESS_EMPTY,
  58. ZIO_COMPRESS_GZIP1,
  59. ZIO_COMPRESS_GZIP2,
  60. ZIO_COMPRESS_GZIP3,
  61. ZIO_COMPRESS_GZIP4,
  62. ZIO_COMPRESS_GZIP5,
  63. ZIO_COMPRESS_GZIP6,
  64. ZIO_COMPRESS_GZIP7,
  65. ZIO_COMPRESS_GZIP8,
  66. ZIO_COMPRESS_GZIP9,
  67. ZIO_COMPRESS_FUNCTIONS
  68. };
  69. #endif /* _ZIO_H */