![]() |
|
|||
File indexing completed on 2025-09-16 09:13:28
0001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 0002 * Copyright by The HDF Group. * 0003 * All rights reserved. * 0004 * * 0005 * This file is part of HDF5. The full HDF5 copyright notice, including * 0006 * terms governing use, modification, and redistribution, is contained in * 0007 * the COPYING file, which can be found at the root of the source code * 0008 * distribution tree, or in https://www.hdfgroup.org/licenses. * 0009 * If you do not have access to either file, you may request a copy from * 0010 * help@hdfgroup.org. * 0011 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 0012 0013 #ifndef H5FDpublic_H 0014 #define H5FDpublic_H 0015 0016 #include "H5public.h" /* Generic Functions */ 0017 #include "H5Fpublic.h" /* Files */ 0018 #include "H5Ipublic.h" /* Identifiers */ 0019 0020 /*****************/ 0021 /* Public Macros */ 0022 /*****************/ 0023 0024 #define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */ 0025 0026 /* VFD identifier values 0027 * These are H5FD_class_value_t values, NOT hid_t values! 0028 */ 0029 #define H5_VFD_INVALID ((H5FD_class_value_t)(-1)) 0030 #define H5_VFD_SEC2 ((H5FD_class_value_t)(0)) 0031 #define H5_VFD_CORE ((H5FD_class_value_t)(1)) 0032 #define H5_VFD_LOG ((H5FD_class_value_t)(2)) 0033 #define H5_VFD_FAMILY ((H5FD_class_value_t)(3)) 0034 #define H5_VFD_MULTI ((H5FD_class_value_t)(4)) 0035 #define H5_VFD_STDIO ((H5FD_class_value_t)(5)) 0036 #define H5_VFD_SPLITTER ((H5FD_class_value_t)(6)) 0037 #define H5_VFD_MPIO ((H5FD_class_value_t)(7)) 0038 #define H5_VFD_DIRECT ((H5FD_class_value_t)(8)) 0039 #define H5_VFD_MIRROR ((H5FD_class_value_t)(9)) 0040 #define H5_VFD_HDFS ((H5FD_class_value_t)(10)) 0041 #define H5_VFD_ROS3 ((H5FD_class_value_t)(11)) 0042 #define H5_VFD_SUBFILING ((H5FD_class_value_t)(12)) 0043 #define H5_VFD_IOC ((H5FD_class_value_t)(13)) 0044 #define H5_VFD_ONION ((H5FD_class_value_t)(14)) 0045 0046 /* VFD IDs below this value are reserved for library use. */ 0047 #define H5_VFD_RESERVED 256 0048 0049 /* Maximum VFD ID */ 0050 #define H5_VFD_MAX 65535 0051 0052 /* Define VFL driver features that can be enabled on a per-driver basis */ 0053 /* These are returned with the 'query' function pointer in H5FD_class_t */ 0054 /* 0055 * Defining H5FD_FEAT_AGGREGATE_METADATA for a VFL driver means that 0056 * the library will attempt to allocate a larger block for metadata and 0057 * then sub-allocate each metadata request from that larger block. 0058 */ 0059 #define H5FD_FEAT_AGGREGATE_METADATA 0x00000001 0060 /* 0061 * Defining H5FD_FEAT_ACCUMULATE_METADATA for a VFL driver means that 0062 * the library will attempt to cache metadata as it is written to the file 0063 * and build up a larger block of metadata to eventually pass to the VFL 0064 * 'write' routine. 0065 * 0066 * Distinguish between updating the metadata accumulator on writes and 0067 * reads. This is particularly (perhaps only, even) important for MPI-I/O 0068 * where we guarantee that writes are collective, but reads may not be. 0069 * If we were to allow the metadata accumulator to be written during a 0070 * read operation, the application would hang. 0071 */ 0072 #define H5FD_FEAT_ACCUMULATE_METADATA_WRITE 0x00000002 0073 #define H5FD_FEAT_ACCUMULATE_METADATA_READ 0x00000004 0074 #define H5FD_FEAT_ACCUMULATE_METADATA \ 0075 (H5FD_FEAT_ACCUMULATE_METADATA_WRITE | H5FD_FEAT_ACCUMULATE_METADATA_READ) 0076 /* 0077 * Defining H5FD_FEAT_DATA_SIEVE for a VFL driver means that 0078 * the library will attempt to cache raw data as it is read from/written to 0079 * a file in a "data sieve" buffer. See Rajeev Thakur's papers: 0080 * http://www.mcs.anl.gov/~thakur/papers/romio-coll.ps.gz 0081 * http://www.mcs.anl.gov/~thakur/papers/mpio-high-perf.ps.gz 0082 */ 0083 #define H5FD_FEAT_DATA_SIEVE 0x00000008 0084 /* 0085 * Defining H5FD_FEAT_AGGREGATE_SMALLDATA for a VFL driver means that 0086 * the library will attempt to allocate a larger block for "small" raw data 0087 * and then sub-allocate "small" raw data requests from that larger block. 0088 */ 0089 #define H5FD_FEAT_AGGREGATE_SMALLDATA 0x00000010 0090 /* 0091 * Defining H5FD_FEAT_IGNORE_DRVRINFO for a VFL driver means that 0092 * the library will ignore the driver info that is encoded in the file 0093 * for the VFL driver. (This will cause the driver info to be eliminated 0094 * from the file when it is flushed/closed, if the file is opened R/W). 0095 */ 0096 #define H5FD_FEAT_IGNORE_DRVRINFO 0x00000020 0097 /** 0098 * Defining the H5FD_FEAT_DIRTY_DRVRINFO_LOAD for a VFL driver means that 0099 * the library will mark the driver info dirty when the file is opened 0100 * R/W. This will cause the driver info to be re-encoded when the file 0101 * is flushed/closed. 0102 * 0103 * \since 1.10.0 0104 */ 0105 #define H5FD_FEAT_DIRTY_DRVRINFO_LOAD 0x00000040 0106 /* 0107 * Defining H5FD_FEAT_POSIX_COMPAT_HANDLE for a VFL driver means that 0108 * the handle for the VFD (returned with the 'get_handle' callback) is 0109 * of type 'int' and is compatible with POSIX I/O calls. 0110 */ 0111 #define H5FD_FEAT_POSIX_COMPAT_HANDLE 0x00000080 0112 0113 /** 0114 * Defining H5FD_FEAT_HAS_MPI for a VFL driver means that 0115 * the driver makes use of MPI communication and code may retrieve 0116 * communicator/rank information from it 0117 * 0118 * \since 1.8.15 0119 */ 0120 #define H5FD_FEAT_HAS_MPI 0x00000100 0121 0122 #define H5FD_FEAT_ALLOCATE_EARLY 0x00000200 0123 /**< Defining the H5FD_FEAT_ALLOCATE_EARLY for a VFL driver will force 0124 * the library to use the H5D_ALLOC_TIME_EARLY on dataset create 0125 * instead of the default H5D_ALLOC_TIME_LATE 0126 * 0127 * \since 1.8.15 0128 */ 0129 0130 /* 0131 * Defining H5FD_FEAT_ALLOW_FILE_IMAGE for a VFL driver means that 0132 * the driver is able to use a file image in the fapl as the initial 0133 * contents of a file. 0134 */ 0135 #define H5FD_FEAT_ALLOW_FILE_IMAGE 0x00000400 0136 /* 0137 * Defining H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS for a VFL driver 0138 * means that the driver is able to use callbacks to make a copy of the 0139 * image to store in memory. 0140 */ 0141 #define H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS 0x00000800 0142 /** 0143 * Defining H5FD_FEAT_SUPPORTS_SWMR_IO for a VFL driver means that the 0144 * driver supports the single-writer/multiple-readers I/O pattern. 0145 * 0146 * \since 1.10.0 0147 */ 0148 #define H5FD_FEAT_SUPPORTS_SWMR_IO 0x00001000 0149 /** 0150 * Defining H5FD_FEAT_USE_ALLOC_SIZE for a VFL driver 0151 * means that the library will just pass the allocation size to the 0152 * the driver's allocation callback which will eventually handle alignment. 0153 * This is specifically used for the multi/split driver. 0154 * 0155 * \since 1.10.1 0156 */ 0157 #define H5FD_FEAT_USE_ALLOC_SIZE 0x00002000 0158 /** 0159 * Defining H5FD_FEAT_PAGED_AGGR for a VFL driver 0160 * means that the driver needs special file space mapping for paged aggregation. 0161 * This is specifically used for the multi/split driver. 0162 * 0163 * \since 1.10.1 0164 */ 0165 #define H5FD_FEAT_PAGED_AGGR 0x00004000 0166 /** 0167 * Defining H5FD_FEAT_DEFAULT_VFD_COMPATIBLE for a VFL driver 0168 * that creates a file which is compatible with the default VFD. 0169 * Generally, this means that the VFD creates a single file that follows 0170 * the canonical HDF5 file format. 0171 * Regarding the Splitter VFD specifically, only drivers with this flag 0172 * enabled may be used as the Write-Only (W/O) channel driver. 0173 * 0174 * \since 1.10.2 0175 */ 0176 #define H5FD_FEAT_DEFAULT_VFD_COMPATIBLE 0x00008000 0177 /* 0178 * Defining H5FD_FEAT_MEMMANAGE for a VFL driver means that 0179 * the driver uses special memory management routines or wishes 0180 * to do memory management in a specific manner. Therefore, HDF5 0181 * should request that the driver handle any memory management 0182 * operations when appropriate. 0183 */ 0184 #define H5FD_FEAT_MEMMANAGE 0x00010000 0185 0186 /* ctl function definitions: */ 0187 #define H5FD_CTL_OPC_RESERVED 512 /* Opcodes below this value are reserved for library use */ 0188 #define H5FD_CTL_OPC_EXPER_MIN \ 0189 H5FD_CTL_OPC_RESERVED /* Minimum opcode value available for experimental use \ 0190 */ 0191 #define H5FD_CTL_OPC_EXPER_MAX \ 0192 (H5FD_CTL_OPC_RESERVED + 511) /* Maximum opcode value available for experimental use */ 0193 0194 /* ctl function op codes: */ 0195 #define H5FD_CTL_INVALID_OPCODE 0 0196 #define H5FD_CTL_TEST_OPCODE 1 0197 #define H5FD_CTL_GET_MPI_COMMUNICATOR_OPCODE 2 0198 #define H5FD_CTL_GET_MPI_INFO_OPCODE 9 0199 #define H5FD_CTL_GET_MPI_RANK_OPCODE 3 0200 #define H5FD_CTL_GET_MPI_SIZE_OPCODE 4 0201 #define H5FD_CTL_MEM_ALLOC 5 0202 #define H5FD_CTL_MEM_FREE 6 0203 #define H5FD_CTL_MEM_COPY 7 0204 #define H5FD_CTL_GET_MPI_FILE_SYNC_OPCODE 8 0205 0206 /* ctl function flags: */ 0207 0208 /* Definitions: 0209 * 0210 * WARNING: While the following definitions of Terminal 0211 * and Passthrough VFDs should be workable for now, they 0212 * have to be adjusted as our use cases for VFDs expand. 0213 * 0214 * JRM -- 8/4/21 0215 * 0216 * 0217 * Terminal VFD: Lowest VFD in the VFD stack through 0218 * which all VFD calls pass. Note that this definition 0219 * is situational. For example, the sec2 VFD is typically 0220 * terminal. However, in the context of the family file 0221 * driver, it is not -- the family file driver is the 0222 * bottom VFD through which all VFD calls pass, and thus 0223 * it is terminal. 0224 * 0225 * Similarly, on the splitter VFD, a sec2 VFD on the 0226 * R/W channel is terminal, but a sec2 VFD on the W/O 0227 * channel is not. 0228 * 0229 * 0230 * Pass through VFD: Any VFD that relays all VFD calls 0231 * (with the possible exception of some non-I/O related 0232 * calls) to underlying VFD(s). 0233 */ 0234 0235 /* Unknown op codes should be ignored silently unless the 0236 * H5FD_CTL_FAIL_IF_UNKNOWN_FLAG is set. 0237 * 0238 * On terminal VFDs, unknown op codes should generate an 0239 * error unconditionally if this flag is set. 0240 * 0241 * On pass through VFDs, unknown op codes should be routed 0242 * to the underlying VFD(s) as indicated by any routing 0243 * flags. In the absence of such flags, the VFD should 0244 * generate an error. 0245 */ 0246 #define H5FD_CTL_FAIL_IF_UNKNOWN_FLAG 0x0001 0247 0248 /* The H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG is used only 0249 * by non-ternminal VFDs, and only applies to unknown 0250 * opcodes. (known op codes should be handled as 0251 * appropriate.) 0252 * 0253 * If this flag is set for an unknown op code, that 0254 * op code should be passed to the next VFD down 0255 * the VFD stack en-route to the terminal VFD. 0256 * If that VFD does not support the ctl call, the 0257 * pass through VFD should fail or succeed as directed 0258 * by the H5FD_CTL_FAIL_IF_UNKNOWN_FLAG. 0259 */ 0260 #define H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG 0x0002 0261 0262 /*******************/ 0263 /* Public Typedefs */ 0264 /*******************/ 0265 0266 /* 0267 * File driver identifiers. 0268 * 0269 * Values 0 through 255 are for drivers defined by the HDF5 library. 0270 * Values 256 through 511 are available for testing new drivers. 0271 * Subsequent values should be obtained from the HDF5 development 0272 * team at mailto:help@hdfgroup.org. 0273 */ 0274 typedef int H5FD_class_value_t; 0275 0276 /* Types of allocation requests: see H5Fpublic.h */ 0277 typedef enum H5F_mem_t H5FD_mem_t; 0278 0279 /** 0280 * Define enum for the source of file image callbacks 0281 */ 0282 //! <!-- [H5FD_file_image_op_t_snip] --> 0283 typedef enum { 0284 H5FD_FILE_IMAGE_OP_NO_OP, 0285 H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, 0286 /**< Passed to the \p image_malloc and \p image_memcpy callbacks when a 0287 * file image buffer is to be copied while being set in a file access 0288 * property list (FAPL)*/ 0289 H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, 0290 /**< Passed to the \p image_malloc and \p image_memcpy callbacks 0291 * when a file image buffer is to be copied when a FAPL is copied*/ 0292 H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, 0293 /**<Passed to the \p image_malloc and \p image_memcpy callbacks when 0294 * a file image buffer is to be copied while being retrieved from a FAPL*/ 0295 H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, 0296 /**<Passed to the \p image_free callback when a file image 0297 * buffer is to be released during a FAPL close operation*/ 0298 H5FD_FILE_IMAGE_OP_FILE_OPEN, 0299 /**<Passed to the \p image_malloc and 0300 * \p image_memcpy callbackswhen a 0301 * file image buffer is to be copied during a file open operation \n 0302 * While the file image being opened will typically be copied from a 0303 * FAPL, this need not always be the case. For example, the core file 0304 * driver, also known as the memory file driver, takes its initial 0305 * image from a file.*/ 0306 H5FD_FILE_IMAGE_OP_FILE_RESIZE, 0307 /**<Passed to the \p image_realloc callback when a file driver needs 0308 * to resize an image buffer*/ 0309 H5FD_FILE_IMAGE_OP_FILE_CLOSE 0310 /**<Passed to the \p image_free callback when an image buffer is to 0311 * be released during a file close operation*/ 0312 } H5FD_file_image_op_t; 0313 //! <!-- [H5FD_file_image_op_t_snip] --> 0314 0315 /** 0316 * Define structure to hold file image callbacks 0317 */ 0318 //! <!-- [H5FD_file_image_callbacks_t_snip] --> 0319 typedef struct { 0320 /** 0321 * \param[in] size Size in bytes of the file image buffer to allocate 0322 * \param[in] file_image_op A value from H5FD_file_image_op_t indicating 0323 * the operation being performed on the file image 0324 * when this callback is invoked 0325 * \param[in] udata Value passed in in the H5Pset_file_image_callbacks 0326 * parameter \p udata 0327 */ 0328 //! <!-- [image_malloc_snip] --> 0329 void *(*image_malloc)(size_t size, H5FD_file_image_op_t file_image_op, void *udata); 0330 //! <!-- [image_malloc_snip] --> 0331 /** 0332 * \param[in] dest Address of the destination buffer 0333 * \param[in] src Address of the source buffer 0334 * \param[in] size Size in bytes of the file image buffer to allocate 0335 * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating 0336 * the operation being performed on the file image 0337 * when this callback is invoked 0338 * \param[in] udata Value passed in in the H5Pset_file_image_callbacks 0339 * parameter \p udata 0340 */ 0341 //! <!-- [image_memcpy_snip] --> 0342 void *(*image_memcpy)(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op, 0343 void *udata); 0344 //! <!-- [image_memcpy_snip] --> 0345 /** 0346 * \param[in] ptr Pointer to the buffer being reallocated 0347 * \param[in] size Size in bytes of the file image buffer to allocate 0348 * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating 0349 * the operation being performed on the file image 0350 * when this callback is invoked 0351 * \param[in] udata Value passed in in the H5Pset_file_image_callbacks 0352 * parameter \p udata 0353 */ 0354 //! <!-- [image_realloc_snip] --> 0355 void *(*image_realloc)(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *udata); 0356 //! <!-- [image_realloc_snip] --> 0357 /** 0358 * \param[in] ptr Pointer to the buffer being reallocated 0359 * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating 0360 * the operation being performed on the file image 0361 * when this callback is invoked 0362 * \param[in] udata Value passed in in the H5Pset_file_image_callbacks 0363 * parameter \p udata 0364 */ 0365 //! <!-- [image_free_snip] --> 0366 herr_t (*image_free)(void *ptr, H5FD_file_image_op_t file_image_op, void *udata); 0367 //! <!-- [image_free_snip] --> 0368 /** 0369 * \param[in] udata Value passed in in the H5Pset_file_image_callbacks 0370 * parameter \p udata 0371 */ 0372 //! <!-- [udata_copy_snip] --> 0373 void *(*udata_copy)(void *udata); 0374 //! <!-- [udata_copy_snip] --> 0375 /** 0376 * \param[in] udata Value passed in in the H5Pset_file_image_callbacks 0377 * parameter \p udata 0378 */ 0379 //! <!-- [udata_free_snip] --> 0380 herr_t (*udata_free)(void *udata); 0381 //! <!-- [udata_free_snip] --> 0382 /** 0383 * \brief The final field in the #H5FD_file_image_callbacks_t struct, 0384 * provides a pointer to user-defined data. This pointer will be 0385 * passed to the image_malloc, image_memcpy, image_realloc, and 0386 * image_free callbacks. Define udata as NULL if no user-defined 0387 * data is provided. 0388 */ 0389 void *udata; 0390 } H5FD_file_image_callbacks_t; 0391 //! <!-- [H5FD_file_image_callbacks_t_snip] --> 0392 0393 /** 0394 * Define structure to hold "ctl memory copy" parameters 0395 */ 0396 //! <!-- [H5FD_ctl_memcpy_args_t_snip] --> 0397 typedef struct H5FD_ctl_memcpy_args_t { 0398 void *dstbuf; /**< Destination buffer */ 0399 hsize_t dst_off; /**< Offset within destination buffer */ 0400 const void *srcbuf; /**< Source buffer */ 0401 hsize_t src_off; /**< Offset within source buffer */ 0402 size_t len; /**< Length of data to copy from source buffer */ 0403 } H5FD_ctl_memcpy_args_t; 0404 //! <!-- [H5FD_ctl_memcpy_args_t_snip] --> 0405 0406 /********************/ 0407 /* Public Variables */ 0408 /********************/ 0409 0410 /*********************/ 0411 /* Public Prototypes */ 0412 /*********************/ 0413 0414 #ifdef __cplusplus 0415 extern "C" { 0416 #endif 0417 0418 /* Function prototypes */ 0419 0420 /** 0421 * \ingroup H5VFD 0422 * 0423 * \brief Allows querying a VFD ID for features before the file is opened 0424 * 0425 * \param[in] driver_id Virtual File Driver (VFD) ID 0426 * \param[out] flags VFD flags supported 0427 * 0428 * \return \herr_t 0429 * 0430 * \details Queries a virtual file driver (VFD) for feature flags. Takes a 0431 * VFD hid_t so it can be used before the file is opened. For example, 0432 * this could be used to check if a VFD supports SWMR. 0433 * 0434 * \note The flags obtained here are just those of the base driver and 0435 * do not take any configuration options (e.g., set via a fapl 0436 * call) into consideration. 0437 * 0438 * \since 1.10.2 0439 */ 0440 H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/); 0441 0442 #ifdef __cplusplus 0443 } 0444 #endif 0445 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |