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 files COPYING and Copyright.html.  COPYING can be found at the root   *
9  * of the source code distribution tree; Copyright.html can be found at the  *
10  * root level of an installed copy of the electronic HDF5 document set and   *
11  * is linked from the top-level documents page.  It can also be found at     *
12  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
13  * access to either file, you may request a copy from help@hdfgroup.org.     *
14  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /*
17  * This file contains private information about the H5D module
18  */
19 #ifndef _H5Dprivate_H
20 #define _H5Dprivate_H
21 
22 /* Include package's public header */
23 #include "H5Dpublic.h"
24 
25 /* Private headers needed by this file */
26 #include "H5FDprivate.h"	/* File drivers				*/
27 #include "H5Oprivate.h"		/* Object headers		  	*/
28 #include "H5Sprivate.h"		/* Dataspaces 				*/
29 #include "H5Zprivate.h"		/* Data filters				*/
30 
31 
32 /**************************/
33 /* Library Private Macros */
34 /**************************/
35 
36 /*
37  * Feature: Define H5D_DEBUG on the compiler command line if you want to
38  *	    debug dataset I/O. NDEBUG must not be defined in order for this
39  *	    to have any effect.
40  */
41 #ifdef NDEBUG
42 #  undef H5D_DEBUG
43 #endif
44 
45 /* ========  Dataset creation property names ======== */
46 #define H5D_CRT_LAYOUT_NAME        "layout"             /* Storage layout */
47 #define H5D_CRT_FILL_VALUE_NAME    "fill_value"         /* Fill value */
48 #define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */
49 #define H5D_CRT_EXT_FILE_LIST_NAME "efl"                /* External file list */
50 
51 /* ========  Dataset access property names ======== */
52 #define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME   "rdcc_nslots"   /* Size of raw data chunk cache(slots) */
53 #define H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME   "rdcc_nbytes"   /* Size of raw data chunk cache(bytes) */
54 #define H5D_ACS_PREEMPT_READ_CHUNKS_NAME    "rdcc_w0"       /* Preemption read chunks first */
55 
56 /* ======== Data transfer properties ======== */
57 #define H5D_XFER_MAX_TEMP_BUF_NAME      "max_temp_buf"  /* Maximum temp buffer size */
58 #define H5D_XFER_TCONV_BUF_NAME         "tconv_buf"     /* Type conversion buffer */
59 #define H5D_XFER_BKGR_BUF_NAME          "bkgr_buf"      /* Background buffer */
60 #define H5D_XFER_BKGR_BUF_TYPE_NAME     "bkgr_buf_type" /* Background buffer type */
61 #define H5D_XFER_BTREE_SPLIT_RATIO_NAME "btree_split_ratio" /* B-tree node splitting ratio */
62 #define H5D_XFER_VLEN_ALLOC_NAME        "vlen_alloc"    /* Vlen allocation function */
63 #define H5D_XFER_VLEN_ALLOC_INFO_NAME   "vlen_alloc_info" /* Vlen allocation info */
64 #define H5D_XFER_VLEN_FREE_NAME         "vlen_free"     /* Vlen free function */
65 #define H5D_XFER_VLEN_FREE_INFO_NAME    "vlen_free_info" /* Vlen free info */
66 #define H5D_XFER_VFL_ID_NAME            "vfl_id"        /* File driver ID */
67 #define H5D_XFER_VFL_INFO_NAME          "vfl_info"      /* File driver info */
68 #define H5D_XFER_HYPER_VECTOR_SIZE_NAME "vec_size"      /* Hyperslab vector size */
69 #ifdef H5_HAVE_PARALLEL
70 #define H5D_XFER_IO_XFER_MODE_NAME      "io_xfer_mode"  /* I/O transfer mode */
71 #define H5D_XFER_MPIO_COLLECTIVE_OPT_NAME "mpio_collective_opt" /* Optimization of MPI-IO transfer mode */
72 #define H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME "mpio_chunk_opt_hard"
73 #define H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME "mpio_chunk_opt_num"
74 #define H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME "mpio_chunk_opt_ratio"
75 #define H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME "actual_chunk_opt_mode"
76 #define H5D_MPIO_ACTUAL_IO_MODE_NAME    "actual_io_mode"
77 #define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME "local_no_collective_cause"  /* cause of broken collective I/O in each process */
78 #define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME "global_no_collective_cause"  /* cause of broken collective I/O in all processes */
79 #endif /* H5_HAVE_PARALLEL */
80 #define H5D_XFER_EDC_NAME               "err_detect"    /* EDC */
81 #define H5D_XFER_FILTER_CB_NAME         "filter_cb"     /* Filter callback function */
82 #define H5D_XFER_CONV_CB_NAME           "type_conv_cb"  /* Type conversion callback function */
83 #define H5D_XFER_XFORM_NAME             "data_transform" /* Data transform */
84 #ifdef H5_HAVE_INSTRUMENTED_LIBRARY
85 /* Collective chunk instrumentation properties */
86 #define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard"
87 #define H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME "coll_chunk_multi_hard"
88 #define H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME "coll_chunk_link_true"
89 #define H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME "coll_chunk_link_false"
90 #define H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME "coll_chunk_multi_coll"
91 #define H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME "coll_chunk_multi_ind"
92 
93 /* Definitions for all collective chunk instrumentation properties */
94 #define H5D_XFER_COLL_CHUNK_SIZE        sizeof(unsigned)
95 #define H5D_XFER_COLL_CHUNK_DEF         1
96 #define H5D_XFER_COLL_CHUNK_FIX         0
97 #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
98 
99 /* Default temporary buffer size */
100 #define H5D_TEMP_BUF_SIZE       (1024 * 1024)
101 
102 /* Default I/O vector size */
103 #define H5D_IO_VECTOR_SIZE      1024
104 
105 /* Default VL allocation & free info */
106 #define H5D_VLEN_ALLOC          NULL
107 #define H5D_VLEN_ALLOC_INFO     NULL
108 #define H5D_VLEN_FREE           NULL
109 #define H5D_VLEN_FREE_INFO      NULL
110 
111 
112 /****************************/
113 /* Library Private Typedefs */
114 /****************************/
115 
116 /* Typedef for dataset in memory (defined in H5Dpkg.h) */
117 typedef struct H5D_t H5D_t;
118 
119 /* Typedef for cached dataset transfer property list information */
120 typedef struct H5D_dxpl_cache_t {
121     size_t max_temp_buf;        /* Maximum temporary buffer size (H5D_XFER_MAX_TEMP_BUF_NAME) */
122     void *tconv_buf;            /* Temporary conversion buffer (H5D_XFER_TCONV_BUF_NAME) */
123     void *bkgr_buf;             /* Background conversion buffer (H5D_XFER_BKGR_BUF_NAME) */
124     H5T_bkg_t bkgr_buf_type;    /* Background buffer type (H5D_XFER_BKGR_BUF_NAME) */
125     H5Z_EDC_t err_detect;       /* Error detection info (H5D_XFER_EDC_NAME) */
126     double btree_split_ratio[3];/* B-tree split ratios (H5D_XFER_BTREE_SPLIT_RATIO_NAME) */
127     size_t vec_size;            /* Size of hyperslab vector (H5D_XFER_HYPER_VECTOR_SIZE_NAME) */
128 #ifdef H5_HAVE_PARALLEL
129     H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request (H5D_XFER_IO_XFER_MODE_NAME) */
130     H5FD_mpio_collective_opt_t coll_opt_mode; /* Parallel transfer with independent IO or collective IO with this mode */
131 #endif /*H5_HAVE_PARALLEL*/
132     H5Z_cb_t filter_cb;         /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
133     H5Z_data_xform_t *data_xform_prop; /* Data transform prop (H5D_XFER_XFORM_NAME) */
134 } H5D_dxpl_cache_t;
135 
136 /* Typedef for cached dataset creation property list information */
137 typedef struct H5D_dcpl_cache_t {
138     H5O_fill_t fill;            /* Fill value info (H5D_CRT_FILL_VALUE_NAME) */
139     H5O_pline_t pline;          /* I/O pipeline info (H5O_CRT_PIPELINE_NAME) */
140     H5O_efl_t efl;              /* External file list info (H5D_CRT_EXT_FILE_LIST_NAME) */
141 } H5D_dcpl_cache_t;
142 
143 /* Callback information for copying datasets */
144 typedef struct H5D_copy_file_ud_t {
145     H5O_copy_file_ud_common_t common;   /* Shared information (must be first) */
146     struct H5S_extent_t *src_space_extent;     /* Copy of dataspace extent for dataset */
147     H5T_t *src_dtype;                   /* Copy of datatype for dataset */
148 } H5D_copy_file_ud_t;
149 
150 
151 /*****************************/
152 /* Library Private Variables */
153 /*****************************/
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, hid_t dxpl_id);
162 H5_DLL herr_t H5D_close(H5D_t *dataset);
163 H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
164 H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset);
165 H5_DLL H5T_t *H5D_typeof(const H5D_t *dset);
166 H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id);
167 H5_DLL hid_t H5D_get_create_plist(H5D_t *dset);
168 
169 /* Functions that operate on vlen data */
170 H5_DLL herr_t H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id,
171     void *buf);
172 
173 /* Functions that operate on chunked storage */
174 H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
175 
176 /* Functions that operate on indexed storage */
177 H5_DLL herr_t H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream,
178 				int indent, int fwidth, unsigned ndims);
179 
180 #endif /* _H5Dprivate_H */
181 
182