summaryrefslogtreecommitdiffstats
path: root/src/H5FDonion_header.h
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-08-02 19:54:40 (GMT)
committerGitHub <noreply@github.com>2022-08-02 19:54:40 (GMT)
commitfcf41b3cd60df51af9be529e379a9dd6c488d088 (patch)
treee486d5f8254a33b978c34069b9810ce171ba7c2c /src/H5FDonion_header.h
parentea13de1bb0aba8a97c75f10343dc4c792193b215 (diff)
downloadhdf5-fcf41b3cd60df51af9be529e379a9dd6c488d088.zip
hdf5-fcf41b3cd60df51af9be529e379a9dd6c488d088.tar.gz
hdf5-fcf41b3cd60df51af9be529e379a9dd6c488d088.tar.bz2
Onion VFD (#1953)
* Onion VFD feature * Fixes onion VFD errors with non-sec2 backing store VFDs * Disables the onion VFD tests w/ ph5diff * Disables non-sec2 VFDs as onion VFD backing stores * Committing clang-format changes * Formatted source * Typo * Adds onion VFD tools tests to CMake * Fixes for v16 API compatibility * Memset structs to avoid bad frees on errors * H5Dwrite() calls now use H5T_NATIVE_INT as the memory type vs LE * Properly decodes checksums on BE machines * Be more careful about uint64_t to haddr_t/hsize_t conversions * Another fix for BE data comparison * Removed double underscores from onion constants * Replace hard-coded onion header string w/ constant * Fixes cleanup paths in H5FD__onion_ingest_history() * Fixed use of size_t revision numbers * Fix h5dump revision count format string Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5FDonion_header.h')
-rw-r--r--src/H5FDonion_header.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/H5FDonion_header.h b/src/H5FDonion_header.h
new file mode 100644
index 0000000..cb3941b
--- /dev/null
+++ b/src/H5FDonion_header.h
@@ -0,0 +1,56 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Onion Virtual File Driver (VFD)
+ *
+ * Purpose: Interface for the onion file's header
+ */
+
+#ifndef H5FDonion_header_H
+#define H5FDonion_header_H
+
+/* Number of bytes to encode fixed-size components */
+#define H5FD_ONION_ENCODED_SIZE_HEADER 40
+
+/* Flags must align exactly one per bit, up to 24 bits */
+#define H5FD_ONION_HEADER_FLAG_WRITE_LOCK 0x1
+#define H5FD_ONION_HEADER_FLAG_DIVERGENT_HISTORY 0x2
+#define H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT 0x4
+#define H5FD_ONION_HEADER_SIGNATURE "OHDH"
+#define H5FD_ONION_HEADER_VERSION_CURR 1
+
+/* In-memory representation of the on-store onion history file header.
+ */
+typedef struct H5FD_onion_header_t {
+ uint8_t version;
+ uint32_t flags; /* At most three bytes used! */
+ uint32_t page_size;
+ uint64_t origin_eof; /* Size of the 'original' canonical file */
+ uint64_t history_addr;
+ uint64_t history_size;
+ uint32_t checksum;
+} H5FD_onion_header_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+H5_DLL herr_t H5FD__onion_ingest_header(H5FD_onion_header_t *hdr_out, H5FD_t *raw_file, haddr_t addr);
+H5_DLL herr_t H5FD__onion_write_header(H5FD_onion_header_t *header, H5FD_t *file);
+H5_DLL size_t H5FD__onion_header_decode(unsigned char *buf, H5FD_onion_header_t *header);
+H5_DLL size_t H5FD__onion_header_encode(H5FD_onion_header_t *header, unsigned char *buf, uint32_t *checksum);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H5FDonion_header_H */