zio.h 1.8 KB

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