1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group.                                               *
3  * Copyright by the Board of Trustees of the University of Illinois.         *
4  * All rights reserved.                                                      *
5  *                                                                           *
6  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
7  * terms governing use, modification, and redistribution, is contained in    *
8  * the COPYING file, which can be found at the root of the source code       *
9  * distribution tree, or in https://www.hdfgroup.org/licenses.               *
10  * If you do not have access to either file, you may request a copy from     *
11  * help@hdfgroup.org.                                                        *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*
15  * This file contains private information about the H5D module
16  */
17 #ifndef H5Dprivate_H
18 #define H5Dprivate_H
19 
20 /* Include package's public header */
21 #include "H5Dpublic.h"
22 
23 /* Private headers needed by this file */
24 #include "H5FDprivate.h" /* File drivers                */
25 #include "H5Oprivate.h"  /* Object headers              */
26 #include "H5Sprivate.h"  /* Dataspaces                  */
27 #include "H5Zprivate.h"  /* Data filters                */
28 
29 /**************************/
30 /* Library Private Macros */
31 /**************************/
32 
33 /*
34  * Feature: Define H5D_DEBUG on the compiler command line if you want to
35  *        debug dataset I/O. NDEBUG must not be defined in order for this
36  *        to have any effect.
37  */
38 #ifdef NDEBUG
39 #undef H5D_DEBUG
40 #endif
41 
42 /* ========  Dataset creation property names ======== */
43 #define H5D_CRT_LAYOUT_NAME            "layout"           /* Storage layout */
44 #define H5D_CRT_FILL_VALUE_NAME        "fill_value"       /* Fill value */
45 #define H5D_CRT_ALLOC_TIME_STATE_NAME  "alloc_time_state" /* Space allocation time state */
46 #define H5D_CRT_EXT_FILE_LIST_NAME     "efl"              /* External file list */
47 #define H5D_CRT_MIN_DSET_HDR_SIZE_NAME "dset_oh_minimize" /* Minimize object header */
48 
49 /* ========  Dataset access property names ======== */
50 #define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots"          /* Size of raw data chunk cache(slots) */
51 #define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes"          /* Size of raw data chunk cache(bytes) */
52 #define H5D_ACS_PREEMPT_READ_CHUNKS_NAME  "rdcc_w0"              /* Preemption read chunks first */
53 #define H5D_ACS_VDS_VIEW_NAME             "vds_view"             /* VDS view option */
54 #define H5D_ACS_VDS_PRINTF_GAP_NAME       "vds_printf_gap"       /* VDS printf gap size */
55 #define H5D_ACS_VDS_PREFIX_NAME           "vds_prefix"           /* VDS file prefix */
56 #define H5D_ACS_APPEND_FLUSH_NAME         "append_flush"         /* Append flush actions */
57 #define H5D_ACS_EFILE_PREFIX_NAME         "external file prefix" /* External file prefix */
58 
59 /* ======== Data transfer properties ======== */
60 #define H5D_XFER_MAX_TEMP_BUF_NAME          "max_temp_buf"        /* Maximum temp buffer size */
61 #define H5D_XFER_TCONV_BUF_NAME             "tconv_buf"           /* Type conversion buffer */
62 #define H5D_XFER_BKGR_BUF_NAME              "bkgr_buf"            /* Background buffer */
63 #define H5D_XFER_BKGR_BUF_TYPE_NAME         "bkgr_buf_type"       /* Background buffer type */
64 #define H5D_XFER_BTREE_SPLIT_RATIO_NAME     "btree_split_ratio"   /* B-tree node splitting ratio */
65 #define H5D_XFER_VLEN_ALLOC_NAME            "vlen_alloc"          /* Vlen allocation function */
66 #define H5D_XFER_VLEN_ALLOC_INFO_NAME       "vlen_alloc_info"     /* Vlen allocation info */
67 #define H5D_XFER_VLEN_FREE_NAME             "vlen_free"           /* Vlen free function */
68 #define H5D_XFER_VLEN_FREE_INFO_NAME        "vlen_free_info"      /* Vlen free info */
69 #define H5D_XFER_VFL_ID_NAME                "vfl_id"              /* File driver ID */
70 #define H5D_XFER_VFL_INFO_NAME              "vfl_info"            /* File driver info */
71 #define H5D_XFER_HYPER_VECTOR_SIZE_NAME     "vec_size"            /* Hyperslab vector size */
72 #define H5D_XFER_IO_XFER_MODE_NAME          "io_xfer_mode"        /* I/O transfer mode */
73 #define H5D_XFER_MPIO_COLLECTIVE_OPT_NAME   "mpio_collective_opt" /* Optimization of MPI-IO transfer mode */
74 #define H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME   "mpio_chunk_opt_hard"
75 #define H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME    "mpio_chunk_opt_num"
76 #define H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME  "mpio_chunk_opt_ratio"
77 #define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME "actual_chunk_opt_mode"
78 #define H5D_MPIO_ACTUAL_IO_MODE_NAME        "actual_io_mode"
79 #define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME                                                              \
80     "local_no_collective_cause" /* cause of broken collective I/O in each process */
81 #define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME                                                             \
82     "global_no_collective_cause"                 /* cause of broken collective I/O in all processes */
83 #define H5D_XFER_EDC_NAME       "err_detect"     /* EDC */
84 #define H5D_XFER_FILTER_CB_NAME "filter_cb"      /* Filter callback function */
85 #define H5D_XFER_CONV_CB_NAME   "type_conv_cb"   /* Type conversion callback function */
86 #define H5D_XFER_XFORM_NAME     "data_transform" /* Data transform */
87 #ifdef H5_HAVE_INSTRUMENTED_LIBRARY
88 /* Collective chunk instrumentation properties */
89 #define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME        "coll_chunk_link_hard"
90 #define H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME       "coll_chunk_multi_hard"
91 #define H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME    "coll_chunk_link_true"
92 #define H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME   "coll_chunk_link_false"
93 #define H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME "coll_chunk_multi_coll"
94 #define H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME  "coll_chunk_multi_ind"
95 
96 /* Definitions for all collective chunk instrumentation properties */
97 #define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned)
98 #define H5D_XFER_COLL_CHUNK_DEF  1
99 
100 /* General collective I/O instrumentation properties */
101 #define H5D_XFER_COLL_RANK0_BCAST_NAME "coll_rank0_bcast"
102 
103 /* Definitions for general collective I/O instrumentation properties */
104 #define H5D_XFER_COLL_RANK0_BCAST_SIZE sizeof(hbool_t)
105 #define H5D_XFER_COLL_RANK0_BCAST_DEF  FALSE
106 #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
107 
108 /* Default temporary buffer size */
109 #define H5D_TEMP_BUF_SIZE (1024 * 1024)
110 
111 /* Default I/O vector size */
112 #define H5D_IO_VECTOR_SIZE 1024
113 
114 /* Default VL allocation & free info */
115 #define H5D_VLEN_ALLOC      NULL
116 #define H5D_VLEN_ALLOC_INFO NULL
117 #define H5D_VLEN_FREE       NULL
118 #define H5D_VLEN_FREE_INFO  NULL
119 
120 /* Default virtual dataset list size */
121 #define H5D_VIRTUAL_DEF_LIST_SIZE 8
122 
123 /****************************/
124 /* Library Private Typedefs */
125 /****************************/
126 
127 /* Typedef for dataset in memory (defined in H5Dpkg.h) */
128 typedef struct H5D_t H5D_t;
129 
130 /* Typedef for cached dataset creation property list information */
131 typedef struct H5D_dcpl_cache_t {
132     H5O_fill_t  fill;  /* Fill value info (H5D_CRT_FILL_VALUE_NAME) */
133     H5O_pline_t pline; /* I/O pipeline info (H5O_CRT_PIPELINE_NAME) */
134     H5O_efl_t   efl;   /* External file list info (H5D_CRT_EXT_FILE_LIST_NAME) */
135 } H5D_dcpl_cache_t;
136 
137 /* Callback information for copying datasets */
138 typedef struct H5D_copy_file_ud_t {
139     H5O_copy_file_ud_common_t common;           /* Shared information (must be first) */
140     struct H5S_extent_t *     src_space_extent; /* Copy of dataspace extent for dataset */
141     H5T_t *                   src_dtype;        /* Copy of datatype for dataset */
142 } H5D_copy_file_ud_t;
143 
144 /* Structure for dataset append flush property (H5Pset_append_flush) */
145 typedef struct H5D_append_flush_t {
146     unsigned        ndims;                  /* The # of dimensions for "boundary" */
147     hsize_t         boundary[H5S_MAX_RANK]; /* The dimension sizes for determining boundary */
148     H5D_append_cb_t func;                   /* The callback function */
149     void *          udata;                  /* User data */
150 } H5D_append_flush_t;
151 
152 /*****************************/
153 /* Library Private Variables */
154 /*****************************/
155 
156 /******************************/
157 /* Library Private Prototypes */
158 /******************************/
159 
160 H5_DLL herr_t H5D_init(void);
161 H5_DLL H5D_t *H5D_open(const H5G_loc_t *loc, hid_t dapl_id);
162 H5_DLL herr_t H5D_close(H5D_t *dataset);
163 H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id);
164 H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset);
165 H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
166 H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset);
167 H5_DLL herr_t      H5D_flush_all(H5F_t *f);
168 H5_DLL hid_t       H5D_get_create_plist(const H5D_t *dset);
169 H5_DLL hid_t       H5D_get_access_plist(const H5D_t *dset);
170 
171 /* Functions that operate on chunked storage */
172 H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
173 
174 /* Functions that operate on virtual storage */
175 H5_DLL herr_t H5D_virtual_check_mapping_pre(const H5S_t *vspace, const H5S_t *src_space,
176                                             H5O_virtual_space_status_t space_status);
177 H5_DLL herr_t H5D_virtual_check_mapping_post(const H5O_storage_virtual_ent_t *ent);
178 H5_DLL herr_t H5D_virtual_check_min_dims(const H5D_t *dset);
179 H5_DLL herr_t H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx);
180 H5_DLL herr_t H5D_virtual_parse_source_name(const char *                     source_name,
181                                             H5O_storage_virtual_name_seg_t **parsed_name,
182                                             size_t *static_strlen, size_t *nsubs);
183 H5_DLL herr_t H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_seg);
184 
185 /* Functions that operate on indexed storage */
186 H5_DLL herr_t H5D_btree_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, unsigned ndims,
187                               const uint32_t *dim);
188 
189 #endif /* H5Dprivate_H */
190