|
|
|||
File indexing completed on 2025-11-05 10:00:42
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 /* 0014 * This file contains public declarations for the H5F module. 0015 */ 0016 #ifndef H5Fpublic_H 0017 #define H5Fpublic_H 0018 0019 #include "H5public.h" /* Generic Functions */ 0020 #include "H5ACpublic.h" /* Metadata Cache */ 0021 #include "H5Ipublic.h" /* Identifiers */ 0022 0023 /* When this header is included from a private header, don't make calls to H5check() */ 0024 #undef H5CHECK 0025 #ifndef H5private_H 0026 #define H5CHECK H5check(), 0027 #else /* H5private_H */ 0028 #define H5CHECK 0029 #endif /* H5private_H */ 0030 0031 /* When this header is included from a private HDF5 header, don't make calls to H5open() */ 0032 #undef H5OPEN 0033 #ifndef H5private_H 0034 #define H5OPEN H5open(), 0035 #else /* H5private_H */ 0036 #define H5OPEN 0037 #endif /* H5private_H */ 0038 0039 /* 0040 * These are the bits that can be passed to the `flags' argument of 0041 * H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine 0042 * them as needed. As a side effect, they call H5check_version() to make sure 0043 * that the application is compiled with a version of the hdf5 header files 0044 * which are compatible with the library to which the application is linked. 0045 * We're assuming that these constants are used rather early in the hdf5 0046 * session. 0047 */ 0048 #define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< Absence of RDWR: read-only */ 0049 #define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< Open for read and write */ 0050 #define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< Overwrite existing files */ 0051 #define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< Fail if file already exists*/ 0052 /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ 0053 #define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< Create non-existing files */ 0054 #define H5F_ACC_SWMR_WRITE \ 0055 (H5CHECK 0x0020u) /**< Indicates that this file is open for writing in a \ 0056 * single-writer/multi-reader (SWMR) scenario. \ 0057 * Note that the process(es) opening the file for reading \ 0058 * must open the file with #H5F_ACC_RDONLY and use the \ 0059 * #H5F_ACC_SWMR_READ access flag. */ 0060 #define H5F_ACC_SWMR_READ \ 0061 (H5CHECK 0x0040u) /**< Indicates that this file is open for reading in a \ 0062 * single-writer/multi-reader (SWMR) scenario. Note that \ 0063 * the process(es) opening the file for SWMR reading must \ 0064 * also open the file with the #H5F_ACC_RDONLY flag. */ 0065 0066 /** 0067 * Default file access 0068 * 0069 * \internal Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the parent file. 0070 * \internal ignore setting on lapl 0071 * \since 1.8.3 0072 */ 0073 #define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) 0074 0075 /* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */ 0076 #define H5F_OBJ_FILE (0x0001u) /**< File objects \since 1.6.0 */ 0077 #define H5F_OBJ_DATASET (0x0002u) /**< Dataset objects \since 1.6.0 */ 0078 #define H5F_OBJ_GROUP (0x0004u) /**< Group objects \since 1.6.0 */ 0079 #define H5F_OBJ_DATATYPE (0x0008u) /**< Datatype objects \since 1.6.0 */ 0080 #define H5F_OBJ_ATTR (0x0010u) /**< Attribute objects \since 1.6.0 */ 0081 /** All objects \since 1.6.0 */ 0082 #define H5F_OBJ_ALL (H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR) 0083 0084 /** 0085 * Restrict search to objects opened through current file ID (as opposed to 0086 * objects opened through any file ID accessing this file) \since 1.6.5 */ 0087 #define H5F_OBJ_LOCAL (0x0020u) 0088 0089 /** 0090 * Default value to pass into H5Pset_fapl_family() when the size of each file 0091 * member is unknown \since 1.8.0 */ 0092 #define H5F_FAMILY_DEFAULT 0 /* (hsize_t) */ 0093 0094 #ifdef H5_HAVE_PARALLEL 0095 /** 0096 * Use this constant string as the MPI_Info key to set H5Fmpio debug flags. 0097 * To turn on H5Fmpio debug flags, set the MPI_Info value with this key to 0098 * have the value of a string consisting of the characters that turn on the 0099 * desired flags. 0100 */ 0101 #define H5F_MPIO_DEBUG_KEY "H5F_mpio_debug_key" 0102 #endif /* H5_HAVE_PARALLEL */ 0103 0104 /** 0105 * The scope of an operation such as H5Fflush(), e.g., 0106 * a single file vs. a set of mounted files 0107 */ 0108 typedef enum H5F_scope_t { 0109 H5F_SCOPE_LOCAL = 0, /**< The specified file handle only */ 0110 H5F_SCOPE_GLOBAL = 1 /**< The entire virtual file */ 0111 } H5F_scope_t; 0112 0113 /** 0114 * Unlimited file size for H5Pset_external() 0115 */ 0116 #define H5F_UNLIMITED HSIZE_UNDEF 0117 0118 /** 0119 * How does file close behave? 0120 */ 0121 typedef enum H5F_close_degree_t { 0122 H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlying VFD */ 0123 H5F_CLOSE_WEAK = 1, /**< File closes only after all opened objects are closed */ 0124 H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is closed; otherwise, file close fails */ 0125 H5F_CLOSE_STRONG = 3 /**< If there are opened objects, close them first, then close file */ 0126 } H5F_close_degree_t; 0127 0128 /** 0129 * Current "global" information about file 0130 */ 0131 //! <!-- [H5F_info2_t_snip] --> 0132 typedef struct H5F_info2_t { 0133 struct { 0134 unsigned version; /**< Superblock version number */ 0135 hsize_t super_size; /**< Superblock size */ 0136 hsize_t super_ext_size; /**< Superblock extension size */ 0137 } super; 0138 struct { 0139 unsigned version; /**< Version number of file free space management */ 0140 hsize_t meta_size; /**< Free space manager metadata size */ 0141 hsize_t tot_space; /**< Amount of free space in the file */ 0142 } free; 0143 struct { 0144 unsigned version; /**< Version number of shared object header info */ 0145 hsize_t hdr_size; /**< Shared object header message header size */ 0146 H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */ 0147 } sohm; 0148 } H5F_info2_t; 0149 //! <!-- [H5F_info2_t_snip] --> 0150 0151 /** 0152 * Types of allocation requests. The values larger than #H5FD_MEM_DEFAULT 0153 * should not change other than adding new types to the end. These numbers 0154 * might appear in files. 0155 * 0156 * \internal Please change the log VFD flavors array if you change this 0157 * enumeration. 0158 */ 0159 typedef enum H5F_mem_t { 0160 H5FD_MEM_NOLIST = -1, /**< Data should not appear in the free list. 0161 * Must be negative. 0162 */ 0163 H5FD_MEM_DEFAULT = 0, /**< Value not yet set. Can also be the 0164 * datatype set in a larger allocation 0165 * that will be suballocated by the library. 0166 * Must be zero. 0167 */ 0168 H5FD_MEM_SUPER = 1, /**< Superblock data */ 0169 H5FD_MEM_BTREE = 2, /**< B-tree data */ 0170 H5FD_MEM_DRAW = 3, /**< Raw data (content of datasets, etc.) */ 0171 H5FD_MEM_GHEAP = 4, /**< Global heap data */ 0172 H5FD_MEM_LHEAP = 5, /**< Local heap data */ 0173 H5FD_MEM_OHDR = 6, /**< Object header data */ 0174 0175 H5FD_MEM_NTYPES /**< Sentinel value - must be last */ 0176 } H5F_mem_t; 0177 0178 /** 0179 * Free space section information 0180 */ 0181 //! <!-- [H5F_sect_info_t_snip] --> 0182 typedef struct H5F_sect_info_t { 0183 haddr_t addr; /**< Address of free space section */ 0184 hsize_t size; /**< Size of free space section */ 0185 } H5F_sect_info_t; 0186 //! <!-- [H5F_sect_info_t_snip] --> 0187 0188 /** 0189 * Library's format versions 0190 */ 0191 typedef enum H5F_libver_t { 0192 H5F_LIBVER_ERROR = -1, 0193 H5F_LIBVER_EARLIEST = 0, /**< Use the earliest possible file format for storing objects */ 0194 H5F_LIBVER_V18 = 1, /**< Use the 1.8 file format for storing objects */ 0195 H5F_LIBVER_V110 = 2, /**< Use the 1.10 file format for storing objects */ 0196 H5F_LIBVER_V112 = 3, /**< Use the 1.12 file format for storing objects */ 0197 H5F_LIBVER_V114 = 4, /**< Use the 1.14 file format for storing objects */ 0198 H5F_LIBVER_NBOUNDS /**< Sentinel */ 0199 } H5F_libver_t; 0200 0201 #define H5F_LIBVER_LATEST H5F_LIBVER_V114 0202 0203 /** 0204 * File space handling strategy 0205 */ 0206 //! <!-- [H5F_fspace_strategy_t_snip] --> 0207 typedef enum H5F_fspace_strategy_t { 0208 H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /**< Mechanisms: free-space managers, aggregators, and virtual file 0209 drivers This is the library default when not set */ 0210 H5F_FSPACE_STRATEGY_PAGE = 0211 1, /**< Mechanisms: free-space managers with embedded paged aggregation and virtual file drivers */ 0212 H5F_FSPACE_STRATEGY_AGGR = 2, /**< Mechanisms: aggregators and virtual file drivers */ 0213 H5F_FSPACE_STRATEGY_NONE = 3, /**< Mechanisms: virtual file drivers */ 0214 H5F_FSPACE_STRATEGY_NTYPES /**< Sentinel */ 0215 } H5F_fspace_strategy_t; 0216 //! <!-- [H5F_fspace_strategy_t_snip] --> 0217 0218 /** 0219 * File space handling strategy for release 1.10.0 0220 * 0221 * \deprecated 1.10.1 0222 */ 0223 typedef enum H5F_file_space_type_t { 0224 H5F_FILE_SPACE_DEFAULT = 0, /**< Default (or current) free space strategy setting */ 0225 H5F_FILE_SPACE_ALL_PERSIST = 1, /**< Persistent free space managers, aggregators, virtual file driver */ 0226 H5F_FILE_SPACE_ALL = 2, /**< Non-persistent free space managers, aggregators, virtual file driver 0227 This is the library default */ 0228 H5F_FILE_SPACE_AGGR_VFD = 3, /**< Aggregators, Virtual file driver */ 0229 H5F_FILE_SPACE_VFD = 4, /**< Virtual file driver */ 0230 H5F_FILE_SPACE_NTYPES /**< Sentinel */ 0231 } H5F_file_space_type_t; 0232 0233 //! <!-- [H5F_retry_info_t_snip] --> 0234 /** Total number of metadata read retry types \since 1.10.0 */ 0235 #define H5F_NUM_METADATA_READ_RETRY_TYPES 21 0236 0237 /** 0238 * Data structure to report the collection of read retries for metadata items with checksum as 0239 * used by H5Fget_metadata_read_retry_info() 0240 */ 0241 typedef struct H5F_retry_info_t { 0242 unsigned nbins; 0243 uint32_t *retries[H5F_NUM_METADATA_READ_RETRY_TYPES]; 0244 } H5F_retry_info_t; 0245 //! <!-- [H5F_retry_info_t_snip] --> 0246 0247 /** 0248 * Callback for H5Pset_object_flush_cb() in a file access property list 0249 */ 0250 typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata); 0251 0252 /* 0253 * These are the bits that can be passed to the `flags' argument of 0254 * H5Pset_relax_file_integrity_checks(). Use the bit-wise OR operator (|) to 0255 * combine them as needed. 0256 */ 0257 #define H5F_RFIC_UNUSUAL_NUM_UNUSED_NUMERIC_BITS \ 0258 (0x0001u) /**< Suppress errors for numeric datatypes with an unusually \ 0259 * high number of unused bits. See documentation for \ 0260 * H5Pset_relax_file_integrity_checks() for details. */ 0261 #define H5F_RFIC_ALL \ 0262 (H5F_RFIC_UNUSUAL_NUM_UNUSED_NUMERIC_BITS) /**< Suppress all format integrity check \ 0263 * errors. See documentation for \ 0264 * H5Pset_relax_file_integrity_checks() \ 0265 * for details. */ 0266 0267 /*********************/ 0268 /* Public Prototypes */ 0269 /*********************/ 0270 #ifdef __cplusplus 0271 extern "C" { 0272 #endif 0273 0274 /** 0275 * \ingroup H5F 0276 * 0277 * \brief Checks if a file can be opened with a given file access property 0278 * list 0279 * 0280 * \param[in] container_name Name of a file 0281 * \fapl_id 0282 * 0283 * \return \htri_t 0284 * 0285 * \details H5Fis_accessible() checks if the file specified by \p 0286 * container_name can be opened with the file access property list 0287 * \p fapl_id. 0288 * 0289 * \note The H5Fis_accessible() function enables files to be checked with a 0290 * given file access property list, unlike H5Fis_hdf5(), which only uses 0291 * the default file driver when opening a file. 0292 * 0293 * \since 1.12.0 0294 * 0295 */ 0296 H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); 0297 /** 0298 * \ingroup H5F 0299 * 0300 * \brief Creates an HDF5 file 0301 * 0302 * \param[in] filename Name of the file to create 0303 * \param[in] flags File access flags. Allowable values are: 0304 * - #H5F_ACC_TRUNC: Truncate file, if it already exists, 0305 * erasing all data previously stored in the file 0306 * - #H5F_ACC_EXCL: Fail if file already exists 0307 * \fcpl_id 0308 * \fapl_id 0309 * \return \hid_t{file} 0310 * 0311 * \details H5Fcreate() is the primary function for creating HDF5 files; it 0312 * creates a new HDF5 file with the specified name and property lists. 0313 * 0314 * The \p filename parameter specifies the name of the new file. 0315 * 0316 * The \p flags parameter specifies whether an existing file is to be 0317 * overwritten. It should be set to either #H5F_ACC_TRUNC to overwrite 0318 * an existing file or #H5F_ACC_EXCL, instructing the function to fail 0319 * if the file already exists. 0320 * 0321 * New files are always created in read-write mode, so the read-write 0322 * and read-only flags, #H5F_ACC_RDWR and #H5F_ACC_RDONLY, 0323 * respectively, are not relevant in this function. Further note that 0324 * a specification of #H5F_ACC_RDONLY will be ignored; the file will 0325 * be created in read-write mode, regardless. 0326 * 0327 * More complex behaviors of file creation and access are controlled 0328 * through the file creation and file access property lists, 0329 * \p fcpl_id and \p fapl_id, respectively. The value of #H5P_DEFAULT 0330 * for any property list value indicates that the library should use 0331 * the default values for that appropriate property list. 0332 * 0333 * The return value is a file identifier for the newly-created file; 0334 * this file identifier should be closed by calling H5Fclose() when 0335 * it is no longer needed. 0336 * 0337 * \par Example 0338 * \snippet H5F_examples.c minimal 0339 * 0340 * \note #H5F_ACC_TRUNC and #H5F_ACC_EXCL are mutually exclusive; use 0341 * exactly one. 0342 * 0343 * \note An additional flag, #H5F_ACC_DEBUG, prints debug information. This 0344 * flag can be combined with one of the above values using the bit-wise 0345 * OR operator (\c |), but it is used only by HDF5 library developers; 0346 * \Emph{it is neither tested nor supported for use in applications}. 0347 * 0348 * \attention \Bold{Special case — File creation in the case of an already-open file:} 0349 * If a file being created is already opened, by either a previous 0350 * H5Fopen() or H5Fcreate() call, the HDF5 library may or may not 0351 * detect that the open file and the new file are the same physical 0352 * file. (See H5Fopen() regarding the limitations in detecting the 0353 * re-opening of an already-open file.)\n 0354 * If the library detects that the file is already opened, 0355 * H5Fcreate() will return a failure, regardless of the use of 0356 * #H5F_ACC_TRUNC.\n 0357 * If the library does not detect that the file is already opened 0358 * and #H5F_ACC_TRUNC is not used, H5Fcreate() will return a failure 0359 * because the file already exists. Note that this is correct 0360 * behavior.\n 0361 * But if the library does not detect that the file is already 0362 * opened and #H5F_ACC_TRUNC is used, H5Fcreate() will truncate the 0363 * existing file and return a valid file identifier. Such a 0364 * truncation of a currently-opened file will almost certainly 0365 * result in errors. While unlikely, the HDF5 library may not be 0366 * able to detect, and thus report, such errors.\n 0367 * Applications should avoid calling H5Fcreate() with an already 0368 * opened file. 0369 * 0370 * \since 1.0.0 0371 * 0372 * \see H5Fopen(), H5Fclose() 0373 * 0374 */ 0375 H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); 0376 /** 0377 * -------------------------------------------------------------------------- 0378 * \ingroup ASYNC 0379 * \async_variant_of{H5Fcreate} 0380 * 0381 * \since 1.12.0 0382 * 0383 */ 0384 #ifndef H5_DOXYGEN 0385 H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, 0386 const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id); 0387 #else 0388 H5_DLL hid_t H5Fcreate_async(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id); 0389 #endif 0390 /** 0391 * \ingroup H5F 0392 * 0393 * \brief Opens an existing HDF5 file 0394 * 0395 * \param[in] filename Name of the file to be opened 0396 * \param[in] flags File access flags. Allowable values are: 0397 * - #H5F_ACC_RDWR: Allows read and write access to file 0398 * - #H5F_ACC_RDONLY: Allows read-only access to file 0399 * - #H5F_ACC_RDWR \c | #H5F_ACC_SWMR_WRITE: Indicates that 0400 * the file is open for writing in a 0401 * single-writer/multi-writer (SWMR) scenario. 0402 * - #H5F_ACC_RDONLY \c | #H5F_ACC_SWMR_READ: Indicates 0403 * that the file is open for reading in a 0404 * single-writer/multi-reader (SWMR) scenario. 0405 * - An additional flag, #H5F_ACC_DEBUG, prints debug 0406 * information. This flag can be combined with one of the 0407 * above values using the bit-wise OR operator (\c |), but 0408 * it is used only by HDF5 library developers; 0409 * \Emph{it is neither tested nor supported} for use in 0410 * applications. 0411 * \fapl_id 0412 * \return \hid_t{file} 0413 * 0414 * \details H5Fopen() is the primary function for accessing existing HDF5 files. 0415 * This function opens the named file in the specified access mode and 0416 * with the specified access property list. 0417 * 0418 * Note that H5Fopen() does not create a file if it does not already 0419 * exist; see H5Fcreate(). 0420 * 0421 * The \p filename parameter specifies the name of the file to be 0422 * opened. 0423 * 0424 * The \p fapl_id parameter specifies the file access property list. 0425 * The use of #H5P_DEFAULT specifies that default I/O access properties 0426 * are to be used. 0427 * 0428 * The \p flags parameter specifies whether the file will be opened in 0429 * read-write or read-only mode, #H5F_ACC_RDWR or #H5F_ACC_RDONLY, 0430 * respectively. More complex behaviors of file access are controlled 0431 * through the file-access property list. 0432 * 0433 * The return value is a file identifier for the open file; this file 0434 * identifier should be closed by calling H5Fclose() when it is no 0435 * longer needed. 0436 * 0437 * \par Example 0438 * \snippet H5F_examples.c open 0439 * 0440 * \note #H5F_ACC_RDWR and #H5F_ACC_RDONLY are mutually exclusive; use 0441 * exactly one. 0442 * 0443 * \attention \Bold{Special cases — Multiple opens:} A file can often be opened 0444 * with a new H5Fopen() call without closing an already-open 0445 * identifier established in a previous H5Fopen() or H5Fcreate() 0446 * call. Each such H5Fopen() call will return a unique identifier 0447 * and the file can be accessed through any of these identifiers as 0448 * long as the identifier remains valid. In such multiply-opened 0449 * cases, the open calls must use the same flags argument and the 0450 * file access property lists must use the same file close degree 0451 * property setting (see the external link discussion below and 0452 * H5Pset_fclose_degree()).\n 0453 * In some cases, such as files on a local Unix file system, the 0454 * HDF5 library can detect that a file is multiply opened and will 0455 * maintain coherent access among the file identifiers.\n 0456 * But in many other cases, such as parallel file systems or 0457 * networked file systems, it is not always possible to detect 0458 * multiple opens of the same physical file. In such cases, HDF5 0459 * will treat the file identifiers as though they are accessing 0460 * different files and will be unable to maintain coherent access. 0461 * Errors are likely to result in these cases. While unlikely, the 0462 * HDF5 library may not be able to detect, and thus report, 0463 * such errors.\n 0464 * It is generally recommended that applications avoid multiple 0465 * opens of the same file. 0466 * 0467 * \attention \Bold{Special restriction on multiple opens of a file first 0468 * opened by means of an external link:} When an external link is 0469 * followed, the external file is always opened with the weak file 0470 * close degree property setting, #H5F_CLOSE_WEAK (see 0471 * H5Lcreate_external() and H5Pset_fclose_degree()). If the file is 0472 * reopened with H5Fopen while it remains held open from such an 0473 * external link call, the file access property list used in the 0474 * open call must include the file close degree setting 0475 * #H5F_CLOSE_WEAK or the open will fail. 0476 * 0477 * \version 1.10.0 The #H5F_ACC_SWMR_WRITE and #H5F_ACC_SWMR_READ flags were added. 0478 * 0479 * \since 1.0.0 0480 * 0481 * \see H5Fclose() 0482 * 0483 * 0484 */ 0485 H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id); 0486 /** 0487 * -------------------------------------------------------------------------- 0488 * \ingroup ASYNC 0489 * \async_variant_of{H5Fopen} 0490 * 0491 * \since 1.12.0 0492 * 0493 */ 0494 #ifndef H5_DOXYGEN 0495 H5_DLL hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, 0496 const char *filename, unsigned flags, hid_t access_plist, hid_t es_id); 0497 #else 0498 H5_DLL hid_t H5Fopen_async(const char *filename, unsigned flags, hid_t access_plist, hid_t es_id); 0499 #endif 0500 /** 0501 * \ingroup H5F 0502 * 0503 * \brief Returns a new identifier for a previously-opened HDF5 file 0504 * 0505 * \param[in] file_id Identifier of a file for which an additional identifier 0506 * is required 0507 * 0508 * \return \hid_t{file} 0509 * 0510 * \details H5Freopen() returns a new file identifier for an already-open HDF5 0511 * file, as specified by \p file_id. Both identifiers share caches and 0512 * other information. The only difference between the identifiers is 0513 * that the new identifier is not mounted anywhere and no files are 0514 * mounted on it. 0515 * 0516 * The new file identifier should be closed by calling H5Fclose() when 0517 * it is no longer needed. 0518 * 0519 * \note Note that there is no circumstance under which H5Freopen() can 0520 * actually open a closed file; the file must already be open and have an 0521 * active \p file_id. E.g., one cannot close a file with H5Fclose() on 0522 * \p file_id then use H5Freopen() on \p file_id to reopen it. 0523 * 0524 * \since 1.0.0 0525 * 0526 */ 0527 H5_DLL hid_t H5Freopen(hid_t file_id); 0528 /** 0529 * -------------------------------------------------------------------------- 0530 * \ingroup ASYNC 0531 * \async_variant_of{H5Freopen} 0532 * 0533 * \since 1.12.0 0534 * 0535 */ 0536 #ifndef H5_DOXYGEN 0537 H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, 0538 hid_t es_id); 0539 #else 0540 H5_DLL hid_t H5Freopen_async(hid_t file_id, hid_t es_id); 0541 #endif 0542 /** 0543 * \ingroup H5F 0544 * 0545 * \brief Flushes all buffers associated with a file to storage 0546 * 0547 * \loc_id{object_id} 0548 * \param[in] scope The scope of the flush action 0549 * 0550 * \return \herr_t 0551 * 0552 * \details H5Fflush() causes all buffers associated with a file to be 0553 * immediately flushed to storage without removing the data from the 0554 * cache. 0555 * 0556 * \p object_id can be any object associated with the file, including 0557 * the file itself, a dataset, a group, an attribute, or a named 0558 * datatype. 0559 * 0560 * \p scope specifies whether the scope of the flush action is 0561 * global or local. Valid values are as follows: 0562 * \scopes 0563 * 0564 * \par Example 0565 * \snippet H5F_examples.c flush 0566 * 0567 * \attention HDF5 does not possess full control over buffering. H5Fflush() 0568 * flushes the internal HDF5 buffers and then asks the operating system 0569 * (the OS) to flush the system buffers for the open files. After 0570 * that, the OS is responsible for ensuring that the data is 0571 * actually flushed to disk. 0572 * 0573 * \since 1.0.0 0574 * 0575 */ 0576 H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); 0577 /** 0578 * -------------------------------------------------------------------------- 0579 * \ingroup ASYNC 0580 * \async_variant_of{H5Fflush} 0581 * 0582 * \since 1.12.0 0583 * 0584 */ 0585 #ifndef H5_DOXYGEN 0586 H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id, 0587 H5F_scope_t scope, hid_t es_id); 0588 #else 0589 H5_DLL herr_t H5Fflush_async(hid_t object_id, H5F_scope_t scope, hid_t es_id); 0590 #endif 0591 /** 0592 * \ingroup H5F 0593 * 0594 * \brief Terminates access to an HDF5 file 0595 * 0596 * \file_id 0597 * \return \herr_t 0598 * 0599 * \details H5Fclose() terminates access to an HDF5 file (specified by 0600 * \p file_id) by flushing all data to storage. 0601 * 0602 * If this is the last file identifier open for the file and no other 0603 * access identifier is open (e.g., a dataset identifier, group 0604 * identifier, or shared datatype identifier), the file will be fully 0605 * closed and access will end. 0606 * 0607 * \par Example 0608 * \snippet H5F_examples.c minimal 0609 * 0610 * \note \Bold{Delayed close:} Note the following deviation from the 0611 * above-described behavior. If H5Fclose() is called for a file, but one 0612 * or more objects within the file remain open, those objects will remain 0613 * accessible until they are individually closed. Thus, if the dataset 0614 * \c data_sample is open when H5Fclose() is called for the file 0615 * containing it, \c data_sample will remain open and accessible 0616 * (including writable) until it is explicitly closed. The file will be 0617 * automatically closed once all objects in the file have been closed.\n 0618 * Be warned, however, that there are circumstances where it is not 0619 * possible to delay closing a file. For example, an MPI-IO file close is 0620 * a collective call; all of the processes that open the file must 0621 * close it collectively. The file cannot be closed at some time in the 0622 * future by each process in an independent fashion. Another example is 0623 * that an application using an AFS token-based file access privilege may 0624 * destroy its AFS token after H5Fclose() has returned successfully. This 0625 * would make any future access to the file, or any object within it, 0626 * illegal.\n 0627 * In such situations, applications must close all open objects in a file 0628 * before calling H5Fclose. It is generally recommended to do so in all 0629 * cases. 0630 * 0631 * \since 1.0.0 0632 * 0633 * \see H5Fopen() 0634 * 0635 */ 0636 H5_DLL herr_t H5Fclose(hid_t file_id); 0637 /** 0638 * -------------------------------------------------------------------------- 0639 * \ingroup ASYNC 0640 * \async_variant_of{H5Fclose} 0641 * 0642 * \since 1.12.0 0643 * 0644 */ 0645 #ifndef H5_DOXYGEN 0646 H5_DLL herr_t H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, 0647 hid_t es_id); 0648 #else 0649 H5_DLL herr_t H5Fclose_async(hid_t file_id, hid_t es_id); 0650 #endif 0651 /** 0652 * \ingroup H5F 0653 * 0654 * \brief Deletes an HDF5 file 0655 * 0656 * \param[in] filename Name of the file to delete 0657 * \fapl_id 0658 * 0659 * \return \herr_t 0660 * 0661 * \details H5Fdelete() deletes an HDF5 file \p filename with a file access 0662 * property list \p fapl_id. The \p fapl_id should be configured with 0663 * the same VOL connector or VFD that was used to open the file. 0664 * 0665 * This API was introduced for use with the Virtual Object Layer 0666 * (VOL). With the VOL, HDF5 "files" can map to arbitrary storage 0667 * schemes such as object stores and relational database tables. The 0668 * data created by these implementations may be inconvenient for a 0669 * user to remove without a detailed knowledge of the storage scheme. 0670 * H5Fdelete() gives VOL connector authors the ability to add 0671 * connector-specific delete code to their connectors so that users 0672 * can remove these "files" without detailed knowledge of the storage 0673 * scheme. 0674 * 0675 * For a VOL connector, H5Fdelete() deletes the file in a way that 0676 * makes sense for the specified VOL connector. 0677 * 0678 * For the native HDF5 connector, HDF5 files will be deleted via the 0679 * VFDs, each of which will have to be modified to delete the files it 0680 * creates. 0681 * 0682 * For all implementations, H5Fdelete() will first check if the file 0683 * is an HDF5 file via H5Fis_accessible(). This is done to ensure that 0684 * H5Fdelete() cannot be used as an arbitrary file deletion call. 0685 * 0686 * \since 1.12.0 0687 * 0688 */ 0689 H5_DLL herr_t H5Fdelete(const char *filename, hid_t fapl_id); 0690 /** 0691 * \ingroup H5F 0692 * 0693 * \brief Returns a file creation property list identifier 0694 * 0695 * \file_id 0696 * \return \hid_t{file creation property list} 0697 * 0698 * \details H5Fget_create_plist() returns the file creation property list 0699 * identifier identifying the creation properties used to create this 0700 * file. This function is useful for duplicating properties when 0701 * creating another file. 0702 * 0703 * The creation property list identifier should be released with 0704 * H5Pclose(). 0705 * 0706 * \since 1.0.0 0707 * 0708 */ 0709 H5_DLL hid_t H5Fget_create_plist(hid_t file_id); 0710 /** 0711 * \ingroup H5F 0712 * 0713 * \brief Returns a file access property list identifier 0714 * 0715 * \file_id 0716 * \return \hid_t{file access property list} 0717 * 0718 * \details H5Fget_access_plist() returns the file access property list 0719 * identifier of the specified file. 0720 * 0721 * \since 1.0.0 0722 * 0723 */ 0724 H5_DLL hid_t H5Fget_access_plist(hid_t file_id); 0725 /** 0726 * \ingroup H5F 0727 * 0728 * \brief Determines the read/write or read-only status of a file 0729 * 0730 * \file_id 0731 * \param[out] intent Access mode flag as originally passed with H5Fopen() 0732 * 0733 * \return \herr_t 0734 * 0735 * \details Given the identifier of an open file, \p file_id, H5Fget_intent() 0736 * retrieves the intended access mode" flag passed with H5Fopen() when 0737 * the file was opened. 0738 * 0739 * The value of the flag is returned in \p intent. Valid values are as 0740 * follows: 0741 * \file_access 0742 * 0743 * \note The function will not return an error if intent is NULL; it will 0744 * simply do nothing. 0745 * 0746 * \version 1.10.0 Function enhanced to work with SWMR functionality. 0747 * 0748 * \since 1.8.0 0749 * 0750 */ 0751 H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent); 0752 /** 0753 * \ingroup H5F 0754 * 0755 * \brief Retrieves a file's file number that uniquely identifies an open file 0756 * 0757 * \file_id 0758 * \param[out] fileno A buffer to hold the file number 0759 * 0760 * \return \herr_t 0761 * 0762 * \details H5Fget_fileno() retrieves a file number for a file specified by the 0763 * file identifier \p file_id and the pointer \p fnumber to the file 0764 * number. 0765 * 0766 * This file number is the same for all open instances of the same 0767 * file, as long as 1. The active VFD implements the file comparison operator, 0768 * and 2. The current filesystem is able to determine if the same file is opened more 0769 * than once. If these conditions are not met, it is the application's 0770 * responsibility to avoid opening multiple handles into the same file, 0771 * which results in undefined behavior. 0772 * 0773 * \since 1.12.0 0774 * 0775 */ 0776 H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno); 0777 /** 0778 * \ingroup H5F 0779 * 0780 * \brief Returns the number of open object identifiers for an open file 0781 * 0782 * \file_id or #H5F_OBJ_ALL for all currently-open HDF5 files 0783 * \param[in] types Type of object for which identifiers are to be returned 0784 * 0785 * \return Returns the number of open objects if successful; otherwise returns 0786 * a negative value. 0787 * 0788 * \details Given the identifier of an open file, file_id, and the desired 0789 * object types, types, H5Fget_obj_count() returns the number of open 0790 * object identifiers for the file. 0791 * 0792 * To retrieve a count of open identifiers for open objects in all 0793 * HDF5 application files that are currently open, as well as transient 0794 * datatype objects that are not associated with any file, pass the value 0795 * #H5F_OBJ_ALL in \p file_id. 0796 * 0797 * The types of objects to be counted are specified in types as 0798 * follows: 0799 * \obj_types 0800 * 0801 * Multiple object types can be combined with the 0802 * logical \c OR operator (|). For example, the expression 0803 * \c (#H5F_OBJ_DATASET|#H5F_OBJ_GROUP) would call for datasets and 0804 * groups. 0805 * 0806 * \version 1.6.8, 1.8.2 Function return type changed to \c ssize_t. 0807 * \version 1.6.5 #H5F_OBJ_LOCAL has been added as a qualifier on the types 0808 * of objects to be counted. #H5F_OBJ_LOCAL restricts the 0809 * search to objects opened through current file identifier. 0810 * 0811 * \since 1.6.0 0812 * 0813 */ 0814 H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types); 0815 /** 0816 *------------------------------------------------------------------------- 0817 * \ingroup H5F 0818 * 0819 * \brief Returns a list of open object identifiers 0820 * 0821 * \file_id or #H5F_OBJ_ALL for all currently-open HDF5 files 0822 * \param[in] types Type of object for which identifiers are to be returned 0823 * \param[in] max_objs Maximum number of object identifiers to place into 0824 * \p obj_id_list 0825 * \param[out] obj_id_list Pointer to the returned buffer of open object 0826 * identifiers 0827 * 0828 * \return Returns number of objects placed into \p obj_id_list if successful; 0829 * otherwise returns a negative value. 0830 * 0831 * \details Given the file identifier \p file_id and the type of objects to be 0832 * identified, types, H5Fget_obj_ids() returns the list of identifiers 0833 * for all open HDF5 objects fitting the specified criteria. 0834 * 0835 * To retrieve identifiers for open objects in all HDF5 application 0836 * files that are currently open, pass the value #H5F_OBJ_ALL in 0837 * \p file_id. 0838 * 0839 * The types of object identifiers to be retrieved are specified in 0840 * types using the codes listed for the same parameter in 0841 * H5Fget_obj_count(). 0842 * 0843 * To retrieve a count of open objects, use the H5Fget_obj_count() 0844 * function. This count can be used to set the \p max_objs parameter. 0845 * 0846 * \version 1.8.2 Function return type changed to \c ssize_t and \p 0847 * max_objs parameter datatype changed to \c size_t. 0848 * \version 1.6.8 Function return type changed to \c ssize_t and \p 0849 * max_objs parameter datatype changed to \c size_t. 0850 * \since 1.6.0 0851 * 0852 */ 0853 H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list); 0854 /** 0855 * \ingroup H5F 0856 * 0857 * \brief Returns pointer to the file handle from the virtual file driver 0858 * 0859 * \file_id 0860 * \fapl_id{fapl} 0861 * \param[out] file_handle Pointer to the file handle being used by the 0862 * low-level virtual file driver 0863 * 0864 * \return \herr_t 0865 * 0866 * \details Given the file identifier \p file_id and the file access property 0867 * list \p fapl_id, H5Fget_vfd_handle() returns a pointer to the file 0868 * handle from the low-level file driver currently being used by the 0869 * HDF5 library for file I/O. 0870 * 0871 * \note For most drivers, the value of \p fapl_id will be #H5P_DEFAULT. For 0872 * the \c FAMILY or \c MULTI drivers, this value should be defined 0873 * through the property list functions: H5Pset_family_offset() for the 0874 * \c FAMILY driver and H5Pset_multi_type() for the \c MULTI driver 0875 * 0876 * \since 1.6.0 0877 * 0878 */ 0879 H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); 0880 /** 0881 * \ingroup H5F 0882 * 0883 * \brief Mounts an HDF5 file 0884 * 0885 * \fg_loc_id{loc_id} 0886 * \param[in] name Name of the group onto which the file specified by \p child 0887 * is to be mounted 0888 * \file_id{child} 0889 * \param[in] plist File mount property list identifier. Pass #H5P_DEFAULT! 0890 * 0891 * \return \herr_t 0892 * 0893 * \details H5Fmount() mounts the file specified by \p child onto the object 0894 * specified by \p loc and \p name using the mount properties \p plist 0895 * If the object specified by \p loc is a dataset, named datatype or 0896 * attribute, then the file will be mounted at the location where the 0897 * attribute, dataset, or named datatype is attached. 0898 * 0899 * \par Example 0900 * \snippet H5F_examples.c mount 0901 * 0902 * \note To date, no file mount properties have been defined in HDF5. The 0903 * proper value to pass for \p plist is #H5P_DEFAULT, indicating the 0904 * default file mount property list. 0905 * 0906 * \since 1.0.0 0907 * 0908 */ 0909 H5_DLL herr_t H5Fmount(hid_t loc_id, const char *name, hid_t child, hid_t plist); 0910 /** 0911 * \ingroup H5F 0912 * 0913 * \brief Un-mounts an HDF5 file 0914 * 0915 * \fg_loc_id{loc_id} 0916 * \param[in] name Name of the mount point 0917 * 0918 * \return \herr_t 0919 * 0920 * \details Given a mount point, H5Funmount() dissociates the mount point's 0921 * file from the file mounted there. This function does not close 0922 * either file. 0923 * 0924 * The mount point can be either the group in the parent or the root 0925 * group of the mounted file (both groups have the same name). If the 0926 * mount point was opened before the mount then it is the group in the 0927 * parent; if it was opened after the mount then it is the root group 0928 * of the child. 0929 * 0930 * \since 1.0.0 0931 * 0932 */ 0933 H5_DLL herr_t H5Funmount(hid_t loc_id, const char *name); 0934 /** 0935 * \ingroup H5F 0936 * 0937 * \brief Returns the amount of free space in a file (in bytes) 0938 * 0939 * \file_id 0940 * 0941 * \return Returns the amount of free space in the file if successful; 0942 * otherwise returns a negative value. 0943 * 0944 * \details Given the identifier of an open file, \p file_id, 0945 * H5Fget_freespace() returns the amount of space that is unused by 0946 * any objects in the file. 0947 * 0948 * The interpretation of this number depends on the configured free space 0949 * management strategy. For example, if the HDF5 library only tracks free 0950 * space in a file from a file open or create until that file is closed, 0951 * then this routine will report the free space that has been created 0952 * during that interval. 0953 * 0954 * \since 1.6.1 0955 * 0956 */ 0957 H5_DLL hssize_t H5Fget_freespace(hid_t file_id); 0958 /** 0959 * \ingroup H5F 0960 * 0961 * \brief Returns the size of an HDF5 file (in bytes) 0962 * 0963 * \file_id 0964 * \param[out] size Size of the file, in bytes 0965 * 0966 * \return \herr_t 0967 * 0968 * \details H5Fget_filesize() returns the size of the HDF5 file specified by 0969 * \p file_id. 0970 * 0971 * The returned size is that of the entire file, as opposed to only 0972 * the HDF5 portion of the file. I.e., size includes the user block, 0973 * if any, the HDF5 portion of the file, and any data that may have 0974 * been appended beyond the data written through the HDF5 library. 0975 * 0976 * \since 1.6.3 0977 * 0978 */ 0979 H5_DLL herr_t H5Fget_filesize(hid_t file_id, hsize_t *size); 0980 /** 0981 * \ingroup H5F 0982 * 0983 * \brief Retrieves the file's end-of-allocation (EOA) 0984 * 0985 * \file_id 0986 * \param[out] eoa The file's EOA 0987 * 0988 * \return \herr_t 0989 * 0990 * \details H5Fget_eoa() retrieves the file's EOA and returns it in the 0991 * parameter eoa. 0992 * 0993 * \since 1.10.2 0994 * 0995 */ 0996 H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); 0997 /** 0998 * \ingroup H5F 0999 * 1000 * \brief Sets the file' EOA to the maximum of (EOA, EOF) + increment 1001 * 1002 * \file_id 1003 * \param[in] increment The number of bytes to be added to the maximum of 1004 * (EOA, EOF) 1005 * 1006 * \return \herr_t 1007 * 1008 * \details H5Fincrement_filesize() sets the file's EOA to the maximum of (EOA, 1009 * EOF) + \p increment. The EOA is the end-of-file address stored in 1010 * the file's superblock while EOF is the file's actual end-of-file. 1011 * 1012 * \since 1.10.2 1013 * 1014 */ 1015 H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); 1016 /** 1017 * \ingroup H5F 1018 * 1019 * \brief Retrieves a copy of the image of an existing, open file 1020 * 1021 * \file_id 1022 * \param[out] buf_ptr Pointer to the buffer into which the image of the 1023 * HDF5 file is to be copied. If \p buf_ptr is NULL, 1024 * no data will be copied but the function's return value 1025 * will still indicate the buffer size required (or a 1026 * negative value on error). 1027 * \param[out] buf_len Size of the supplied buffer 1028 * 1029 * \return ssize_t 1030 * 1031 * \details H5Fget_file_image() retrieves a copy of the image of an existing, 1032 * open file. This routine can be used with files opened using the 1033 * SEC2 (or POSIX), STDIO, and Core (or Memory) virtual file drivers 1034 * (VFDs). 1035 * 1036 * If the return value of H5Fget_file_image() is a positive value, it 1037 * will be the length in bytes of the buffer required to store the 1038 * file image. So if the file size is unknown, it can be safely 1039 * determined with an initial H5Fget_file_image() call with buf_ptr 1040 * set to NULL. The file image can then be retrieved with a second 1041 * H5Fget_file_image() call with \p buf_len set to the initial call's 1042 * return value. 1043 * 1044 * While the current file size can also be retrieved with 1045 * H5Fget_filesize(), that call may produce a larger value than is 1046 * needed. The value returned by H5Fget_filesize() includes the user 1047 * block, if it exists, and any unallocated space at the end of the 1048 * file. It is safe in all situations to get the file size with 1049 * H5Fget_file_image() and it often produces a value that is more 1050 * appropriate for the size of a file image buffer. 1051 * 1052 * \note \Bold{Recommended Reading:} This function is part of the file image 1053 * operations feature set. It is highly recommended to study the guide 1054 * \ref H5FIM_UG before using this feature set. 1055 * 1056 * \attention H5Pget_file_image() will fail, returning a negative value, if the 1057 * file is too large for the supplied buffer. 1058 * 1059 * \see H5LTopen_file_image(), H5Pset_file_image(), H5Pget_file_image(), 1060 * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks() 1061 * 1062 * \since 1.8.0 1063 * 1064 */ 1065 H5_DLL ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len); 1066 /** 1067 * \ingroup MDC 1068 * 1069 * \brief Obtains current metadata cache configuration for target file 1070 * 1071 * \file_id 1072 * \param[in,out] config_ptr Pointer to the H5AC_cache_config_t instance in which 1073 * the current metadata cache configuration is to be 1074 * reported. The fields of this structure are discussed 1075 * \ref H5AC-cache-config-t "here". 1076 * \return \herr_t 1077 * 1078 * \note The \c in direction applies only to the H5AC_cache_config_t::version 1079 * field. All other fields are out parameters. 1080 * 1081 * \details H5Fget_mdc_config() loads the current metadata cache configuration 1082 * into the instance of H5AC_cache_config_t pointed to by the \p config_ptr 1083 * parameter.\n 1084 * The fields of the H5AC_cache_config_t structure are shown below: 1085 * \snippet H5ACpublic.h H5AC_cache_config_t_snip 1086 * \click4more 1087 * 1088 * \since 1.8.0 1089 * 1090 */ 1091 H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr); 1092 /** 1093 * \ingroup MDC 1094 * 1095 * \brief Attempts to configure metadata cache of target file 1096 * 1097 * \file_id 1098 * \param[in,out] config_ptr Pointer to the H5AC_cache_config_t instance 1099 * containing the desired configuration. 1100 * The fields of this structure are discussed 1101 * \ref H5AC-cache-config-t "here". 1102 * \return \herr_t 1103 * 1104 * \details H5Fset_mdc_config() attempts to configure the file's metadata cache 1105 * according configuration supplied in \p config_ptr. 1106 * \snippet H5ACpublic.h H5AC_cache_config_t_snip 1107 * \click4more 1108 * 1109 * \since 1.8.0 1110 * 1111 */ 1112 H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, const H5AC_cache_config_t *config_ptr); 1113 /** 1114 * \ingroup MDC 1115 * 1116 * \brief Obtains target file's metadata cache hit rate 1117 * 1118 * \file_id 1119 * \param[out] hit_rate_ptr Pointer to the double in which the hit rate is returned. Note that 1120 * \p hit_rate_ptr is undefined if the API call fails 1121 * \return \herr_t 1122 * 1123 * \details H5Fget_mdc_hit_rate() queries the metadata cache of the target file to obtain its hit rate 1124 * \TText{(cache hits / (cache hits + cache misses))} since the last time hit rate statistics 1125 * were reset. If the cache has not been accessed since the last time the hit rate stats were 1126 * reset, the hit rate is defined to be 0.0. 1127 * 1128 * The hit rate stats can be reset either manually (via H5Freset_mdc_hit_rate_stats()), or 1129 * automatically. If the cache's adaptive resize code is enabled, the hit rate stats will be 1130 * reset once per epoch. If they are reset manually as well, the cache may behave oddly. 1131 * 1132 * See the overview of the metadata cache in the special topics section of the user manual for 1133 * details on the metadata cache and its adaptive resize algorithms. 1134 * 1135 * \since 1.8.0 1136 * 1137 */ 1138 H5_DLL herr_t H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr); 1139 /** 1140 * \ingroup MDC 1141 * 1142 * \brief Obtains current metadata cache size data for specified file 1143 * 1144 * \file_id 1145 * \param[out] max_size_ptr Pointer to the location in which the current cache maximum size is to be 1146 * returned, or NULL if this datum is not desired 1147 * \param[out] min_clean_size_ptr Pointer to the location in which the current cache minimum clean 1148 * size is to be returned, or NULL if that datum is not desired 1149 * \param[out] cur_size_ptr Pointer to the location in which the current cache size is to be returned, 1150 * or NULL if that datum is not desired 1151 * \param[out] cur_num_entries_ptr Pointer to the location in which the current number of entries in 1152 * the cache is to be returned, or NULL if that datum is not desired 1153 * \return \herr_t 1154 * 1155 * \details H5Fget_mdc_size() queries the metadata cache of the target file for the desired size 1156 * information, and returns this information in the locations indicated by the pointer 1157 * parameters. If any pointer parameter is NULL, the associated data is not returned. 1158 * 1159 * If the API call fails, the values returned via the pointer parameters are undefined. 1160 * 1161 * If adaptive cache resizing is enabled, the cache maximum size and minimum clean size 1162 * may change at the end of each epoch. Current size and current number of entries can 1163 * change on each cache access. 1164 * 1165 * Current size can exceed maximum size under certain conditions. See the overview of the 1166 * metadata cache in the special topics section of the user manual for a discussion of this. 1167 * 1168 * \since 1.8.0 1169 * 1170 */ 1171 H5_DLL herr_t H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, 1172 size_t *cur_size_ptr, int *cur_num_entries_ptr); 1173 /** 1174 * \ingroup MDC 1175 * 1176 * \brief Resets hit rate statistics counters for the target file 1177 * 1178 * \file_id 1179 * \return \herr_t 1180 * 1181 * \details 1182 * \parblock 1183 * H5Freset_mdc_hit_rate_stats() resets the hit rate statistics counters in the metadata cache 1184 * associated with the specified file. 1185 * 1186 * If the adaptive cache resizing code is enabled, the hit rate statistics are reset at the beginning 1187 * of each epoch. This API call allows you to do the same thing from your program. 1188 * 1189 * The adaptive cache resizing code may behave oddly if you use this call when adaptive cache resizing 1190 * is enabled. However, the call should be useful if you choose to control metadata cache size from your 1191 * program. 1192 * 1193 * See \ref_mdc_in_hdf5 for details about the metadata cache and the adaptive cache resizing 1194 * algorithms. If you have not read, understood, and thought about the material covered in that 1195 * documentation, 1196 * you should not be using this API call. 1197 * \endparblock 1198 * 1199 * \since 1.8.0 1200 * 1201 */ 1202 H5_DLL herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id); 1203 /** 1204 * \ingroup H5F 1205 * 1206 * \brief Retrieves name of file to which object belongs 1207 * 1208 * \obj_id 1209 * \param[out] name Buffer for the file name 1210 * \param[in] size The size, in bytes, of the \p name buffer. Must be the 1211 * size of the file name in bytes plus 1 for a NULL 1212 * terminator 1213 * 1214 * \return Returns the length of the file name if successful; otherwise returns 1215 * a negative value. 1216 * 1217 * \details H5Fget_name() retrieves the name of the file to which the object \p 1218 * obj_id belongs. The object can be a file, group, dataset, 1219 * attribute, or named datatype. 1220 * 1221 * Up to \p size characters of the file name are returned in \p name; 1222 * additional characters, if any, are not returned to the user 1223 * application. 1224 * 1225 * \details_namelen{file,H5Fget_name} 1226 * 1227 * If an error occurs, the buffer pointed to by \p name is unchanged 1228 * and the function returns a negative value. 1229 * 1230 * \since 1.6.3 1231 * 1232 */ 1233 H5_DLL ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size); 1234 /** 1235 * \ingroup H5F 1236 * 1237 * \brief Retrieves global file information 1238 * 1239 * \fgdta_obj_id 1240 * \param[out] file_info Buffer for global file information 1241 * 1242 * \return \herr_t 1243 * 1244 * \details H5Fget_info2() returns global information for the file associated 1245 * with the object identifier \p obj_id in the H5F_info2_t \c struct 1246 * named \p file_info. 1247 * 1248 * \p obj_id is an identifier for any object in the file of interest. 1249 * 1250 * H5F_info2_t struct is defined in H5Fpublic.h as follows: 1251 * \snippet this H5F_info2_t_snip 1252 * 1253 * The \c super sub-struct contains the following information: 1254 * \li \c vers is the version number of the superblock. 1255 * \li \c super_size is the size of the superblock. 1256 * \li \c super_ext_size is the size of the superblock extension. 1257 * 1258 * The \c free sub-struct contains the following information: 1259 * \li vers is the version number of the free-space manager. 1260 * \li \c hdr_size is the size of the free-space manager header. 1261 * \li \c tot_space is the total amount of free space in the file. 1262 * 1263 * The \c sohm sub-struct contains shared object header message 1264 * information as follows: 1265 * \li \c vers is the version number of the shared object header information. 1266 * \li \c hdr_size is the size of the shared object header message. 1267 * \li \c msgs_info is an H5_ih_info_t struct defined in H5public.h as 1268 * follows: \snippet H5public.h H5_ih_info_t_snip 1269 * \li \p index_size is the summed size of all the shared object 1270 * header indexes. Each index might be either a B-tree or 1271 * a list. 1272 * \li \p heap_size is the size of the heap. 1273 * 1274 * 1275 * \since 1.10.0 1276 * 1277 */ 1278 H5_DLL herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *file_info); 1279 /** 1280 * \ingroup SWMR 1281 * 1282 * \brief Retrieves the collection of read retries for metadata entries with checksum 1283 * 1284 * \file_id 1285 * \param[out] info Struct containing the collection of read retries for metadata 1286 * entries with checksum 1287 * \return \herr_t\n 1288 * 1289 * \details \Bold{Failure Modes:} 1290 * \li When the input identifier is not a file identifier. 1291 * \li When the pointer to the output structure is NULL. 1292 * \li When the memory allocation for \p retries failed. 1293 * 1294 * \details H5Fget_metadata_read_retry_info() retrieves information regarding the number 1295 * of read retries for metadata entries with checksum for the file \p file_id. 1296 * This information is reported in the H5F_retry_info_t struct defined in 1297 * H5Fpublic.h as follows: 1298 * \snippet this H5F_retry_info_t_snip 1299 * \c nbins is the number of bins for each \c retries[i] of metadata entry \c i. 1300 * It is calculated based on the current number of read attempts used in the 1301 * library and logarithmic base 10. 1302 * 1303 * If read retries are incurred for a metadata entry \c i, the library will 1304 * allocate memory for \TText{retries[i] (nbins * sizeof(uint32_t)} and store 1305 * the collection of retries there. If there are no retries for a metadata entry 1306 * \c i, \TText{retries[i]} will be NULL. After a call to this routine, users should 1307 * free each \TText{retries[i]} that is non-NULL, otherwise resource leak will occur. 1308 * 1309 * For the library default read attempts of 100 for SWMR access, nbins will be 2 1310 * as depicted below: 1311 * \li \TText{retries[i][0]} is the number of 1 to 9 read retries. 1312 * \li \TText{retries[i][1]} is the number of 10 to 99 read retries. 1313 * For the library default read attempts of 1 for non-SWMR access, \c nbins will 1314 * be 0 and each \TText{retries[i]} will be NULL. 1315 * 1316 * The following table lists the 21 metadata entries of \TText{retries[]}: 1317 * <table> 1318 * <tr> 1319 * <th>Index for \TText{retries[]}</th> 1320 * <th>Metadata entries<sup>*</sup></th> 1321 * </tr> 1322 * <tr><td>0</td><td>Object header (version 2)</td></tr> 1323 * <tr><td>1</td><td>Object header chunk (version 2)</td></tr> 1324 * <tr><td>2</td><td>B-tree header (version 2)</td></tr> 1325 * <tr><td>3</td><td>B-tree internal node (version 2)</td></tr> 1326 * <tr><td>4</td><td>B-tree leaf node (version 2)</td></tr> 1327 * <tr><td>5</td><td>Fractal heap header</td></tr> 1328 * <tr><td>6</td><td>Fractal heap direct block (optional checksum)</td></tr> 1329 * <tr><td>7</td><td>Fractal heap indirect block</td></tr> 1330 * <tr><td>8</td><td>Free-space header</td></tr> 1331 * <tr><td>9</td><td>Free-space sections</td></tr> 1332 * <tr><td>10</td><td>Shared object header message table</td></tr> 1333 * <tr><td>11</td><td>Shared message record list</td></tr> 1334 * <tr><td>12</td><td>Extensive array header</td></tr> 1335 * <tr><td>13</td><td>Extensive array index block</td></tr> 1336 * <tr><td>14</td><td>Extensive array super block</td></tr> 1337 * <tr><td>15</td><td>Extensive array data block</td></tr> 1338 * <tr><td>16</td><td>Extensive array data block page</td></tr> 1339 * <tr><td>17</td><td>Fixed array super block</td></tr> 1340 * <tr><td>18</td><td>Fixed array data block</td></tr> 1341 * <tr><td>19</td><td>Fixed array data block page</td></tr> 1342 * <tr><td>20</td><td>File's superblock (version 2)</td></tr> 1343 * <tr><td colspan=2><sup>*</sup> All entries are of version 0 (zero) unless indicated 1344 * otherwise.</td></tr> 1345 * </table> 1346 * 1347 * \note On a system that is not atomic, the library might possibly read inconsistent 1348 * metadata with checksum when performing single-writer/multiple-reader (SWMR) 1349 * operations for an HDF5 file. Upon encountering such situations, the library 1350 * will try reading the metadata again for a set number of times to attempt to 1351 * obtain consistent data. The maximum number of read attempts used by the library 1352 * will be either the value set via H5Pset_metadata_read_attempts() or the library 1353 * default value when a value is not set.\n 1354 * When the current number of metadata read attempts used in the library is unable 1355 * to remedy the reading of inconsistent metadata on a system, the user can assess 1356 * the information obtained via this routine to derive a different maximum value. 1357 * The information can also be helpful for debugging purposes to identify potential 1358 * issues with metadata flush dependencies and SWMR implementation in general. 1359 * 1360 * \since 1.10.0 1361 * 1362 */ 1363 H5_DLL herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info); 1364 /** 1365 * \ingroup SWMR 1366 * 1367 * \brief Retrieves free-space section information for a file 1368 * 1369 * \file_id 1370 * 1371 * \return \herr_t 1372 * 1373 * \details H5Fstart_swmr_write() will activate SWMR writing mode for a file 1374 * associated with \p file_id. This routine will prepare and ensure 1375 * the file is safe for SWMR writing as follows: 1376 * \li Check that the file is opened with write access (#H5F_ACC_RDWR). 1377 * \li Check that the file is opened with the latest library format to 1378 * ensure data structures with check-summed metadata are used. 1379 * \li Check that the file is not already marked in SWMR writing mode. 1380 * \li Enable reading retries for check-summed metadata to remedy 1381 * possible checksum failures from reading inconsistent metadata 1382 * on a system that is not atomic. 1383 * \li Turn off usage of the library's accumulator to avoid possible 1384 * ordering problem on a system that is not atomic. 1385 * \li Perform a flush of the file's data buffers and metadata to set 1386 * a consistent state for starting SWMR write operations. 1387 * 1388 * Library objects are groups, datasets, and committed datatypes. For 1389 * the current implementation, groups and datasets can remain open when 1390 * activating SWMR writing mode, but not committed datatypes. Attributes 1391 * attached to objects cannot remain open either. 1392 * 1393 * \since 1.10.0 1394 * 1395 */ 1396 H5_DLL herr_t H5Fstart_swmr_write(hid_t file_id); 1397 /** 1398 * \ingroup H5F 1399 * 1400 * \brief Retrieves free-space section information for a file 1401 * 1402 * \file_id 1403 * \param[in] type The file memory allocation type 1404 * \param[in] nsects The number of free-space sections 1405 * \param[out] sect_info Array of instances of H5F_sect_info_t in which 1406 * the free-space section information is to be returned 1407 * 1408 * \return Returns the number of free-space sections for the specified 1409 * free-space manager in the file; otherwise returns a negative value. 1410 * 1411 * \details H5Fget_free_sections() retrieves free-space section information for 1412 * the free-space manager with type that is associated with file 1413 * \p file_id. If type is #H5FD_MEM_DEFAULT, this routine retrieves 1414 * free-space section information for all the free-space managers in 1415 * the file. 1416 * 1417 * Valid values for \p type are the following: 1418 * \mem_types 1419 * 1420 * H5F_sect_info_t is defined as follows (in H5Fpublic.h): 1421 * \snippet this H5F_sect_info_t_snip 1422 * 1423 * This routine retrieves free-space section information for \p nsects 1424 * sections or, at most, the maximum number of sections in the specified 1425 * free-space manager. If the number of sections is not known, a 1426 * preliminary H5Fget_free_sections() call can be made by setting \p 1427 * sect_info to NULL and the total number of free-space sections for 1428 * the specified free-space manager will be returned. Users can then 1429 * allocate space for entries in \p sect_info, each of which is 1430 * defined as an H5F_sect_info_t \c struct. 1431 * 1432 * \attention \Bold{Failure Modes:} This routine will fail when the following 1433 * is true: 1434 * \li The library fails to retrieve the file creation property list 1435 * associated with \p file_id. 1436 * \li If the parameter \p sect_info is non-null, but the parameter 1437 * \p nsects is equal to 0. 1438 * \li The library fails to retrieve free-space section information 1439 * for the file. 1440 * 1441 * \since 1.10.0 1442 * 1443 */ 1444 H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, 1445 H5F_sect_info_t *sect_info /*out*/); 1446 /** 1447 * \ingroup H5F 1448 * 1449 * \brief Clears the external link open file cache 1450 * 1451 * \file_id 1452 * \return \herr_t 1453 * 1454 * \details H5Fclear_elink_file_cache() evicts all the cached child files in 1455 * the specified file's external file cache, causing them to be closed 1456 * if there is nothing else holding them open. 1457 * 1458 * H5Fclear_elink_file_cache() does not close the cache itself; 1459 * subsequent external link traversals from the parent file will again 1460 * cache the target file. See H5Pset_elink_file_cache_size() for 1461 * information on closing the file cache. 1462 * 1463 * \see H5Pset_elink_file_cache_size(), H5Pget_elink_file_cache_size() 1464 * 1465 * \since 1.8.7 1466 * 1467 */ 1468 H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id); 1469 /** 1470 * \ingroup H5F 1471 * 1472 * \brief Enables the switch of version bounds setting for a file 1473 * 1474 * \file_id 1475 * \param[in] low The earliest version of the library that will be used for 1476 * writing objects 1477 * \param[in] high The latest version of the library that will be used for 1478 * writing objects 1479 * 1480 * \return \herr_t 1481 * 1482 * \details H5Fset_libver_bounds() enables the switch of version bounds setting 1483 * for an open file associated with \p file_id. 1484 * 1485 * For the parameters \p low and \p high, see the description for 1486 * H5Pset_libver_bounds(). 1487 * 1488 * \par Example 1489 * \snippet H5F_examples.c libver_bounds 1490 * 1491 * \since 1.10.2 1492 * 1493 */ 1494 H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high); 1495 /** 1496 * \ingroup MDC 1497 * 1498 * \brief Starts logging metadata cache events if logging was previously enabled 1499 * 1500 * \file_id 1501 * 1502 * \return \herr_t 1503 * 1504 * \details The metadata cache is a central part of the HDF5 library through 1505 * which all \Emph{file metadata} reads and writes take place. File 1506 * metadata is normally invisible to the user and is used by the 1507 * library for purposes such as locating and indexing data. File 1508 * metadata should not be confused with user metadata, which consists 1509 * of attributes created by users and attached to HDF5 objects such 1510 * as datasets via H5A API calls. 1511 * 1512 * Due to the complexity of the cache, a trace/logging feature has been 1513 * created that can be used by HDF5 developers for debugging and performance 1514 * analysis. The functions that control this functionality will normally be 1515 * of use to a very limited number of developers outside of The HDF Group. 1516 * The functions have been documented to help users create logs that can 1517 * be sent with bug reports. 1518 * 1519 * Control of the log functionality is straightforward. Logging is enabled 1520 * via the H5Pset_mdc_log_options() function, which will modify the file 1521 * access property list used to open or create a file. This function has 1522 * a flag that determines whether logging begins at file open or starts 1523 * in a paused state. Log messages can then be controlled via the 1524 * H5Fstart_mdc_logging() and H5Fstop_mdc_logging() functions. 1525 * H5Pget_mdc_log_options() can be used to examine a file access property 1526 * list, and H5Fget_mdc_logging_status() will return the current state of 1527 * the logging flags. 1528 * 1529 * The log format is described in the \ref_mdc_logging document. 1530 * 1531 * \note Logging can only be started or stopped if metadata cache logging was enabled 1532 * via H5Pset_mdc_log_options().\n 1533 * When enabled and currently logging, the overhead of the logging feature will 1534 * almost certainly be significant.\n 1535 * The log file is opened when the HDF5 file is opened or created and not when 1536 * this function is called for the first time.\n 1537 * This function opens the log file and starts logging metadata cache operations 1538 * for a particular file. Calling this function when logging has already been 1539 * enabled will be considered an error. 1540 * 1541 * \since 1.10.0 1542 * 1543 */ 1544 H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id); 1545 /** 1546 * \ingroup MDC 1547 * 1548 * \brief Stops logging metadata cache events if logging was previously enabled and is currently ongoing 1549 * 1550 * \file_id 1551 * 1552 * \return \herr_t 1553 * 1554 * \details The metadata cache is a central part of the HDF5 library through 1555 * which all \Emph{file metadata} reads and writes take place. File 1556 * metadata is normally invisible to the user and is used by the 1557 * library for purposes such as locating and indexing data. File 1558 * metadata should not be confused with user metadata, which consists 1559 * of attributes created by users and attached to HDF5 objects such 1560 * as datasets via H5A API calls. 1561 * 1562 * Due to the complexity of the cache, a trace/logging feature has been 1563 * created that can be used by HDF5 developers for debugging and performance 1564 * analysis. The functions that control this functionality will normally be 1565 * of use to a very limited number of developers outside of The HDF Group. 1566 * The functions have been documented to help users create logs that can 1567 * be sent with bug reports. 1568 * 1569 * Control of the log functionality is straightforward. Logging is enabled 1570 * via the H5Pset_mdc_log_options() function, which will modify the file 1571 * access property list used to open or create a file. This function has 1572 * a flag that determines whether logging begins at file open or starts 1573 * in a paused state. Log messages can then be controlled via the 1574 * H5Fstart_mdc_logging() and H5Fstop_mdc_logging() functions. 1575 * H5Pget_mdc_log_options() can be used to examine a file access property 1576 * list, and H5Fget_mdc_logging_status() will return the current state of 1577 * the logging flags. 1578 * 1579 * The log format is described in the \ref_mdc_logging document. 1580 * 1581 * \note Logging can only be started or stopped if metadata cache logging was enabled 1582 * via H5Pset_mdc_log_options().\n 1583 * This function only suspends the logging operations. The log file will remain 1584 * open and will not be closed until the HDF5 file is closed. 1585 * 1586 * \since 1.10.0 1587 * 1588 */ 1589 H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id); 1590 /** 1591 * \ingroup MDC 1592 * 1593 * \brief Gets the current metadata cache logging status 1594 * 1595 * \file_id 1596 * \param[out] is_enabled Whether logging is enabled 1597 * \param[out] is_currently_logging Whether events are currently being logged 1598 * \return \herr_t 1599 * 1600 * \details The metadata cache is a central part of the HDF5 library through 1601 * which all \Emph{file metadata} reads and writes take place. File 1602 * metadata is normally invisible to the user and is used by the 1603 * library for purposes such as locating and indexing data. File 1604 * metadata should not be confused with user metadata, which consists 1605 * of attributes created by users and attached to HDF5 objects such 1606 * as datasets via H5A API calls. 1607 * 1608 * Due to the complexity of the cache, a trace/logging feature has been 1609 * created that can be used by HDF5 developers for debugging and performance 1610 * analysis. The functions that control this functionality will normally be 1611 * of use to a very limited number of developers outside of The HDF Group. 1612 * The functions have been documented to help users create logs that can 1613 * be sent with bug reports. 1614 * 1615 * Control of the log functionality is straightforward. Logging is enabled 1616 * via the H5Pset_mdc_log_options() function, which will modify the file 1617 * access property list used to open or create a file. This function has 1618 * a flag that determines whether logging begins at file open or starts 1619 * in a paused state. Log messages can then be controlled via the 1620 * H5Fstart_mdc_logging() and H5Fstop_mdc_logging() functions. 1621 * H5Pget_mdc_log_options() can be used to examine a file access property 1622 * list, and H5Fget_mdc_logging_status() will return the current state of 1623 * the logging flags. 1624 * 1625 * The log format is described in the \ref_mdc_logging document. 1626 * 1627 * \note Unlike H5Fstart_mdc_logging() and H5Fstop_mdc_logging(), this function can 1628 * be called on any open file identifier. 1629 * 1630 * \since 1.10.0 1631 */ 1632 H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hbool_t *is_currently_logging); 1633 /** 1634 * \ingroup H5F 1635 * 1636 * \brief Resets the page buffer statistics 1637 * 1638 * \file_id 1639 * 1640 * \return \herr_t 1641 * 1642 * \details H5Freset_page_buffering_stats() resets the page buffer statistics 1643 * for a specified file identifier \p file_id. 1644 * 1645 * \since 1.10.1 1646 * 1647 */ 1648 H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id); 1649 /** 1650 * \ingroup H5F 1651 * 1652 * \brief Retrieves statistics about page access when it is enabled 1653 * 1654 * \file_id 1655 * \param[out] accesses Two integer array for the number of metadata and raw 1656 * data accesses to the page buffer 1657 * \param[out] hits Two integer array for the number of metadata and raw data 1658 * hits in the page buffer 1659 * \param[out] misses Two integer array for the number of metadata and raw data 1660 * misses in the page buffer 1661 * \param[out] evictions Two integer array for the number of metadata and raw 1662 * data evictions from the page buffer 1663 * \param[out] bypasses Two integer array for the number of metadata and raw 1664 * data accesses that bypass the page buffer 1665 * 1666 * \return \herr_t 1667 * 1668 * \details H5Fget_page_buffering_stats() retrieves page buffering statistics 1669 * such as the number of metadata and raw data accesses (\p accesses), 1670 * hits (\p hits), misses (\p misses), evictions (\p evictions), and 1671 * accesses that bypass the page buffer (\p bypasses). 1672 * 1673 * \since 1.10.1 1674 * 1675 */ 1676 H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2], 1677 unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]); 1678 /** 1679 * \ingroup MDC 1680 * 1681 * \brief Obtains information about a cache image if it exists 1682 * 1683 * \file_id 1684 * \param[out] image_addr Offset of the cache image if it exists, or #HADDR_UNDEF if it does not 1685 * \param[out] image_size Length of the cache image if it exists, or 0 if it does not 1686 * \return \herr_t 1687 * 1688 * \details 1689 * \parblock 1690 * H5Fget_mdc_image_info() returns information about a cache image if it exists. 1691 * 1692 * When an HDF5 file is opened in Read/Write mode, any metadata cache image will 1693 * be read and deleted from the file on the first metadata cache access (or, if 1694 * persistent free space managers are enabled, on the first file space 1695 * allocation / deallocation, or read of free space manager status, whichever 1696 * comes first). 1697 * 1698 * Thus, if the file is opened Read/Write, H5Fget_mdc_image_info() should be called 1699 * immediately after file open and before any other operation. If H5Fget_mdc_image_info() 1700 * is called after the cache image is loaded, it will correctly report that no cache image 1701 * exists, as the image will have already been read and deleted from the file. In the Read Only 1702 * case, the function may be called at any time, as any cache image will not be deleted 1703 * from the file. 1704 * \endparblock 1705 * 1706 * \since 1.10.1 1707 */ 1708 H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size); 1709 /** 1710 * \ingroup H5F 1711 * 1712 * \brief Retrieves the setting for whether or not a file will create minimized 1713 * dataset object headers 1714 * 1715 * \file_id 1716 * \param[out] minimize Flag indicating whether the library will or will not 1717 * create minimized dataset object headers 1718 * 1719 * \return \herr_t 1720 * 1721 * \details H5Fget_dset_no_attrs_hint() retrieves the no dataset attributes 1722 * hint setting for the file specified by the file identifier \p 1723 * file_id. This setting is used to inform the library to create 1724 * minimized dataset object headers when \c true. 1725 * 1726 * The setting's value is returned in the boolean pointer minimized. 1727 * 1728 * \since 1.10.5 1729 * 1730 */ 1731 H5_DLL herr_t H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize); 1732 /** 1733 * \ingroup H5F 1734 * 1735 * \brief Sets the flag to create minimized dataset object headers 1736 * 1737 * \file_id 1738 * \param[in] minimize Flag indicating whether the library will or will not 1739 * create minimized dataset object headers 1740 * 1741 * \return \herr_t 1742 * 1743 * \details H5Fset_dset_no_attrs_hint() sets the no dataset attributes hint 1744 * setting for the file specified by the file identifier \p file_id. 1745 * If the boolean flag \p minimize is set to \c true, then the library 1746 * will create minimized dataset object headers in the file. 1747 * \Bold{All} files that refer to the same file-on-disk will be 1748 * affected by the most recent setting, regardless of the file 1749 * identifier/handle (e.g., as returned by H5Fopen()). By setting the 1750 * \p minimize flag to \c true, the library expects that no attributes 1751 * will be added to the dataset - attributes can be added, but they 1752 * are appended with a continuation message, which can reduce 1753 * performance. 1754 * 1755 * \attention This setting interacts with H5Pset_dset_no_attrs_hint(): if 1756 * either is set to \c true, then the created dataset's object header 1757 * will be minimized. 1758 * 1759 * \since 1.10.5 1760 * 1761 */ 1762 H5_DLL herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize); 1763 1764 #ifdef H5_HAVE_PARALLEL 1765 /** 1766 * \ingroup PH5F 1767 * 1768 * \brief Sets the MPI atomicity mode 1769 * 1770 * \file_id 1771 * \param[in] flag Logical flag for atomicity setting. Valid values are: 1772 * \li \c 1 -- Sets MPI file access to atomic mode. 1773 * \li \c 0 -- Sets MPI file access to nonatomic mode. 1774 * \return \herr_t 1775 * 1776 * \par Motivation 1777 * H5Fset_mpi_atomicity() is applicable only in parallel environments using MPI I/O. 1778 * The function is one of the tools used to ensure sequential consistency. This means 1779 * that a set of operations will behave as though they were performed in a serial 1780 * order consistent with the program order. 1781 * 1782 * \details 1783 * \parblock 1784 * H5Fset_mpi_atomicity() sets MPI consistency semantics for data access to the file, 1785 * \p file_id. 1786 * 1787 * If \p flag is set to \c 1, all file access operations will appear atomic, guaranteeing 1788 * sequential consistency. If \p flag is set to \c 0, enforcement of atomic file access 1789 * will be turned off. 1790 * 1791 * H5Fset_mpi_atomicity() is a collective function and all participating processes must 1792 * pass the same values for \p file_id and \p flag. 1793 * 1794 * This function is available only when the HDF5 library is configured with parallel support 1795 * (\TText{--enable-parallel | HDF5_ENABLE_PARALLEL}). It is useful only when used with the #H5FD_MPIO driver 1796 * (see H5Pset_fapl_mpio()). 1797 * \endparblock 1798 * 1799 * \attention 1800 * \parblock 1801 * H5Fset_mpi_atomicity() calls \TText{MPI_File_set_atomicity} underneath and is not supported 1802 * if the execution platform does not support \TText{MPI_File_set_atomicity}. When it is 1803 * supported and used, the performance of data access operations may drop significantly. 1804 * 1805 * In certain scenarios, even when \TText{MPI_File_set_atomicity} is supported, setting 1806 * atomicity with H5Fset_mpi_atomicity() and \p flag set to 1 does not always yield 1807 * strictly atomic updates. For example, some H5Dwrite() calls translate to multiple 1808 * \TText{MPI_File_write_at} calls. This happens in all cases where the high-level file 1809 * access routine translates to multiple lower level file access routines. 1810 * The following scenarios will raise this issue: 1811 * \li Non-contiguous file access using independent I/O 1812 * \li Partial collective I/O using chunked access 1813 * \li Collective I/O using filters or when data conversion is required 1814 * 1815 * This issue arises because MPI atomicity is a matter of MPI file access operations rather 1816 * than HDF5 access operations. But the user is normally seeking atomicity at the HDF5 level. 1817 * To accomplish this, the application must set a barrier after a write, H5Dwrite(), but before 1818 * the next read, H5Dread(), in addition to calling H5Fset_mpi_atomicity().The barrier will 1819 * guarantee that all underlying write operations execute atomically before the read 1820 * operations starts. This ensures additional ordering semantics and will normally produce 1821 * the desired behavior. 1822 * \endparblock 1823 * 1824 * \see \ref_cons_semantics 1825 * 1826 * \since 1.8.9 1827 * 1828 */ 1829 H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); 1830 /** 1831 * \ingroup PH5F 1832 * 1833 * \brief Retrieves the atomicity mode in use 1834 * 1835 * \file_id 1836 * \param[out] flag Logical flag for atomicity setting. Valid values are: 1837 * \li 1 -- MPI file access is set to atomic mode. 1838 * \li 0 -- MPI file access is set to nonatomic mode. 1839 * \return \herr_t 1840 * 1841 * \details H5Fget_mpi_atomicity() retrieves the current consistency semantics mode for 1842 * data access for the file \p file_id. 1843 * 1844 * Upon successful return, \p flag will be set to \c 1 if file access is set 1845 * to atomic mode and \c 0 if file access is set to nonatomic mode. 1846 * 1847 * \see \ref_cons_semantics 1848 * 1849 * \since 1.8.9 1850 * 1851 */ 1852 H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); 1853 #endif /* H5_HAVE_PARALLEL */ 1854 1855 /// \cond DEV 1856 /* Internal API routines */ 1857 H5_DLL herr_t H5Fformat_convert(hid_t fid); 1858 /// \endcond 1859 1860 /// \cond DEV 1861 /* API Wrappers for async routines */ 1862 /* (Must be defined _after_ the function prototype) */ 1863 /* (And must only defined when included in application code, not the library) */ 1864 #ifndef H5F_MODULE 1865 #define H5Fcreate_async(...) H5Fcreate_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1866 #define H5Fopen_async(...) H5Fopen_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1867 #define H5Freopen_async(...) H5Freopen_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1868 #define H5Fflush_async(...) H5Fflush_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1869 #define H5Fclose_async(...) H5Fclose_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1870 1871 /* Define "wrapper" versions of function calls, to allow compile-time values to 1872 * be passed in by language wrapper or library layer on top of HDF5. 1873 */ 1874 #define H5Fcreate_async_wrap H5_NO_EXPAND(H5Fcreate_async) 1875 #define H5Fopen_async_wrap H5_NO_EXPAND(H5Fopen_async) 1876 #define H5Freopen_async_wrap H5_NO_EXPAND(H5Freopen_async) 1877 #define H5Fflush_async_wrap H5_NO_EXPAND(H5Fflush_async) 1878 #define H5Fclose_async_wrap H5_NO_EXPAND(H5Fclose_async) 1879 #endif /* H5F_MODULE */ 1880 /// \endcond 1881 1882 /* Symbols defined for compatibility with previous versions of the HDF5 API. 1883 * 1884 * Use of these symbols is deprecated. 1885 */ 1886 #ifndef H5_NO_DEPRECATED_SYMBOLS 1887 1888 /* Macros */ 1889 #define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /**< Print debug info \deprecated In which version? */ 1890 1891 /* Typedefs */ 1892 1893 /** 1894 * Current "global" information about file 1895 */ 1896 //! <!-- [H5F_info1_t_snip] --> 1897 typedef struct H5F_info1_t { 1898 hsize_t super_ext_size; /**< Superblock extension size */ 1899 struct { 1900 hsize_t hdr_size; /**< Shared object header message header size */ 1901 H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */ 1902 } sohm; 1903 } H5F_info1_t; 1904 //! <!-- [H5F_info1_t_snip] --> 1905 1906 /* Function prototypes */ 1907 /** 1908 * \ingroup H5F 1909 * 1910 * \brief Retrieves global file information 1911 * 1912 * \fgdta_obj_id 1913 * \param[out] file_info Buffer for global file information 1914 * 1915 * \return \herr_t 1916 * 1917 * \deprecated This function has been renamed from H5Fget_info() and is 1918 * deprecated in favor of the macro #H5Fget_info or the function 1919 * H5Fget_info2(). 1920 * 1921 * \details H5Fget_info1() returns global information for the file associated 1922 * with the object identifier \p obj_id in the H5F_info1_t \c struct 1923 * named \p file_info. 1924 * 1925 * \p obj_id is an identifier for any object in the file of interest. 1926 * 1927 * H5F_info1_t struct is defined in H5Fpublic.h as follows: 1928 * \snippet this H5F_info1_t_snip 1929 * 1930 * \c super_ext_size is the size of the superblock extension. 1931 * 1932 * The \c sohm sub-struct contains shared object header message 1933 * information as follows: 1934 * \li \c hdr_size is the size of the shared object header message. 1935 * \li \c msgs_info is an H5_ih_info_t struct defined in H5public.h as 1936 * follows: \snippet H5public.h H5_ih_info_t_snip 1937 * 1938 * \li \p index_size is the summed size of all the shared object 1939 * header indexes. Each index might be either a B-tree or 1940 * a list. 1941 * 1942 * \version 1.10.0 Function H5Fget_info() renamed to H5Fget_info1() and 1943 * deprecated in this release. 1944 * 1945 * \since 1.8.0 1946 * 1947 */ 1948 H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *file_info); 1949 /** 1950 * \ingroup H5F 1951 * 1952 * \brief Sets the latest version of the library to be used for writing objects 1953 * 1954 * \file_id 1955 * \param[in] latest_format Latest format flag 1956 * 1957 * \return \herr_t 1958 * 1959 * \since 1.10.1 1960 * \deprecated 1.10.2 Deprecated in favor of the function H5Fset_libver_bounds() 1961 * 1962 */ 1963 H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format); 1964 /** 1965 * \ingroup H5F 1966 * 1967 * \brief Determines whether a file is in the HDF5 format 1968 * 1969 * \param[in] file_name File name 1970 * 1971 * \return \htri_t 1972 * 1973 * \details H5Fis_hdf5() determines whether a file is in the HDF5 format. 1974 * 1975 * \since 1.0.0 1976 * \deprecated 1.12.0 Deprecated in favor of the function H5Fis_accessible() 1977 * 1978 */ 1979 H5_DLL htri_t H5Fis_hdf5(const char *file_name); 1980 1981 #endif /* H5_NO_DEPRECATED_SYMBOLS */ 1982 1983 #ifdef __cplusplus 1984 } 1985 #endif 1986 #endif /* H5Fpublic_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|