/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * This file contains public declarations for the H5F module. */ #ifndef _H5Fpublic_H #define _H5Fpublic_H /* Public header files needed by this file */ #include "H5public.h" #include "H5ACpublic.h" #include "H5Ipublic.h" /* When this header is included from a private header, don't make calls to H5check() */ #undef H5CHECK #ifndef _H5private_H #define H5CHECK H5check(), #else /* _H5private_H */ #define H5CHECK #endif /* _H5private_H */ /* When this header is included from a private HDF5 header, don't make calls to H5open() */ #undef H5OPEN #ifndef _H5private_H #define H5OPEN H5open(), #else /* _H5private_H */ #define H5OPEN #endif /* _H5private_H */ /* * These are the bits that can be passed to the `flags' argument of * H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine * them as needed. As a side effect, they call H5check_version() to make sure * that the application is compiled with a version of the hdf5 header files * which are compatible with the library to which the application is linked. * We're assuming that these constants are used rather early in the hdf5 * session. */ #define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< absence of rdwr => rd-only */ #define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< open for read and write */ #define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< overwrite existing files */ #define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ #define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< create non-existing files */ #define H5F_ACC_SWMR_WRITE \ (H5CHECK 0x0020u) /**< indicate that this file is open for writing in a \ single-writer/multi-reader (SWMR) scenario. \ Note that the process(es) opening the file for reading must \ open the file with RDONLY access, and use the special "SWMR_READ" \ access flag. */ #define H5F_ACC_SWMR_READ \ (H5CHECK 0x0040u) /**< indicate that this file is \ * open for reading in a \ * single-writer/multi-reader (SWMR) \ * scenario. Note that the \ * process(es) opening the file \ * for SWMR reading must also \ * open the file with the RDONLY \ * flag. */ /** * Default property list identifier * * \internal Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the parent file. * \internal ignore setting on lapl */ #define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */ #define H5F_OBJ_FILE (0x0001u) /**< File objects */ #define H5F_OBJ_DATASET (0x0002u) /**< Dataset objects */ #define H5F_OBJ_GROUP (0x0004u) /**< Group objects */ #define H5F_OBJ_DATATYPE (0x0008u) /**< Named datatype objects */ #define H5F_OBJ_ATTR (0x0010u) /**< Attribute objects */ #define H5F_OBJ_ALL (H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR) #define H5F_OBJ_LOCAL \ (0x0020u) /**< Restrict search to objects opened through current file ID \ (as opposed to objects opened through any file ID accessing this file) */ #define H5F_FAMILY_DEFAULT (hsize_t)0 #ifdef H5_HAVE_PARALLEL /* * Use this constant string as the MPI_Info key to set H5Fmpio debug flags. * To turn on H5Fmpio debug flags, set the MPI_Info value with this key to * have the value of a string consisting of the characters that turn on the * desired flags. */ #define H5F_MPIO_DEBUG_KEY "H5F_mpio_debug_key" #endif /* H5_HAVE_PARALLEL */ /** * The difference between a single file and a set of mounted files */ typedef enum H5F_scope_t { H5F_SCOPE_LOCAL = 0, /**< specified file handle only */ H5F_SCOPE_GLOBAL = 1 /**< entire virtual file */ } H5F_scope_t; /** * Unlimited file size for H5Pset_external() */ #define H5F_UNLIMITED ((hsize_t)(-1L)) /** * How does file close behave? */ typedef enum H5F_close_degree_t { H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlining VFL */ H5F_CLOSE_WEAK = 1, /**< File closes only after all opened objects are closed */ H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is close; otherwise, file close fails */ H5F_CLOSE_STRONG = 3 /**< If there are opened objects, close them first, then close file */ } H5F_close_degree_t; /** * Current "global" information about file */ //! [H5F_info2_t_snip] typedef struct H5F_info2_t { struct { unsigned version; /**< Superblock version # */ hsize_t super_size; /**< Superblock size */ hsize_t super_ext_size; /**< Superblock extension size */ } super; struct { unsigned version; /**< Version # of file free space management */ hsize_t meta_size; /**< Free space manager metadata size */ hsize_t tot_space; /**< Amount of free space in the file */ } free; struct { unsigned version; /**< Version # of shared object header info */ hsize_t hdr_size; /**< Shared object header message header size */ H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */ } sohm; } H5F_info2_t; //! [H5F_info2_t_snip] /** * Types of allocation requests. The values larger than #H5FD_MEM_DEFAULT * should not change other than adding new types to the end. These numbers * might appear in files. * * \internal Please change the log VFD flavors array if you change this * enumeration. */ typedef enum H5F_mem_t { H5FD_MEM_NOLIST = -1, /**< Data should not appear in the free list. * Must be negative. */ H5FD_MEM_DEFAULT = 0, /**< Value not yet set. Can also be the * datatype set in a larger allocation * that will be suballocated by the library. * Must be zero. */ H5FD_MEM_SUPER = 1, /**< Superblock data */ H5FD_MEM_BTREE = 2, /**< B-tree data */ H5FD_MEM_DRAW = 3, /**< Raw data (content of datasets, etc.) */ H5FD_MEM_GHEAP = 4, /**< Global heap data */ H5FD_MEM_LHEAP = 5, /**< Local heap data */ H5FD_MEM_OHDR = 6, /**< Object header data */ H5FD_MEM_NTYPES /**< Sentinel value - must be last */ } H5F_mem_t; /** * Free space section information */ //! [H5F_sect_info_t_snip] typedef struct H5F_sect_info_t { haddr_t addr; /**< Address of free space section */ hsize_t size; /**< Size of free space section */ } H5F_sect_info_t; //! [H5F_sect_info_t_snip] /** * Library's format versions */ typedef enum H5F_libver_t { H5F_LIBVER_ERROR = -1, H5F_LIBVER_EARLIEST = 0, /**< Use the earliest possible format for storing objects */ H5F_LIBVER_V18 = 1, /**< Use the latest v18 format for storing objects */ H5F_LIBVER_V110 = 2, /**< Use the latest v110 format for storing objects */ H5F_LIBVER_V112 = 3, /**< Use the latest v112 format for storing objects */ H5F_LIBVER_V114 = 4, /**< Use the latest v114 format for storing objects */ H5F_LIBVER_NBOUNDS } H5F_libver_t; #define H5F_LIBVER_LATEST H5F_LIBVER_V114 /** * File space handling strategy */ //! [H5F_fspace_strategy_t_snip] typedef enum H5F_fspace_strategy_t { H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /**< Mechanisms: free-space managers, aggregators, and virtual file drivers This is the library default when not set */ H5F_FSPACE_STRATEGY_PAGE = 1, /**< Mechanisms: free-space managers with embedded paged aggregation and virtual file drivers */ H5F_FSPACE_STRATEGY_AGGR = 2, /**< Mechanisms: aggregators and virtual file drivers */ H5F_FSPACE_STRATEGY_NONE = 3, /**< Mechanisms: virtual file drivers */ H5F_FSPACE_STRATEGY_NTYPES /**< Sentinel */ } H5F_fspace_strategy_t; //! [H5F_fspace_strategy_t_snip] /** * File space handling strategy for release 1.10.0 * * \deprecated 1.10.1 */ typedef enum H5F_file_space_type_t { H5F_FILE_SPACE_DEFAULT = 0, /**< Default (or current) free space strategy setting */ H5F_FILE_SPACE_ALL_PERSIST = 1, /**< Persistent free space managers, aggregators, virtual file driver */ H5F_FILE_SPACE_ALL = 2, /**< Non-persistent free space managers, aggregators, virtual file driver This is the library default */ H5F_FILE_SPACE_AGGR_VFD = 3, /**< Aggregators, Virtual file driver */ H5F_FILE_SPACE_VFD = 4, /**< Virtual file driver */ H5F_FILE_SPACE_NTYPES /**< Sentinel */ } H5F_file_space_type_t; //! [H5F_retry_info_t_snip] #define H5F_NUM_METADATA_READ_RETRY_TYPES 21 /** * Data structure to report the collection of read retries for metadata items with checksum as * used by H5Fget_metadata_read_retry_info() */ typedef struct H5F_retry_info_t { unsigned nbins; uint32_t *retries[H5F_NUM_METADATA_READ_RETRY_TYPES]; } H5F_retry_info_t; //! [H5F_retry_info_t_snip] /** * Callback for H5Pset_object_flush_cb() in a file access property list */ typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata); /*********************/ /* Public Prototypes */ /*********************/ #ifdef __cplusplus extern "C" { #endif /** * \ingroup H5F * * \brief Checks if a file can be opened with a given file access property * list * * \param[in] container_name Name of a file * \fapl_id * * \return \htri_t * * \details H5Fis_accessible() checks if the file specified by \p * container_name can be opened with the file access property list * \p fapl_id. * * \note The H5Fis_accessible() function enables files to be checked with a * given file access property list, unlike H5Fis_hdf5(), which only uses * the default file driver when opening a file. * * \since 1.12.0 * */ H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); /** * \example H5Fcreate.c * After creating an HDF5 file with H5Fcreate(), we close it with * H5Fclose(). */ /** * \ingroup H5F * * \brief Creates an HDF5 file * * \param[in] filename Name of the file to create * \param[in] flags File access flags. Allowable values are: * - #H5F_ACC_TRUNC: Truncate file, if it already exists, * erasing all data previously stored in the file * - #H5F_ACC_EXCL: Fail if file already exists * \fcpl_id * \fapl_id * \return \hid_t{file} * * \details H5Fcreate() is the primary function for creating HDF5 files; it * creates a new HDF5 file with the specified name and property lists. * * The \p filename parameter specifies the name of the new file. * * The \p flags parameter specifies whether an existing file is to be * overwritten. It should be set to either #H5F_ACC_TRUNC to overwrite * an existing file or #H5F_ACC_EXCL, instructing the function to fail * if the file already exists. * * New files are always created in read-write mode, so the read-write * and read-only flags, #H5F_ACC_RDWR and #H5F_ACC_RDONLY, * respectively, are not relevant in this function. Further note that * a specification of #H5F_ACC_RDONLY will be ignored; the file will * be created in read-write mode, regardless. * * More complex behaviors of file creation and access are controlled * through the file creation and file access property lists, * \p fcpl_id and \p fapl_id, respectively. The value of #H5P_DEFAULT * for any property list value indicates that the library should use * the default values for that appropriate property list. * * The return value is a file identifier for the newly-created file; * this file identifier should be closed by calling H5Fclose() when * it is no longer needed. * * \include H5Fcreate.c * * \note #H5F_ACC_TRUNC and #H5F_ACC_EXCL are mutually exclusive; use * exactly one. * * \note An additional flag, #H5F_ACC_DEBUG, prints debug information. This * flag can be combined with one of the above values using the bit-wise * OR operator (\c |), but it is used only by HDF5 library developers; * \Emph{it is neither tested nor supported for use in applications}. * * \attention \Bold{Special case — File creation in the case of an already-open file:} * If a file being created is already opened, by either a previous * H5Fopen() or H5Fcreate() call, the HDF5 library may or may not * detect that the open file and the new file are the same physical * file. (See H5Fopen() regarding the limitations in detecting the * re-opening of an already-open file.)\n * If the library detects that the file is already opened, * H5Fcreate() will return a failure, regardless of the use of * #H5F_ACC_TRUNC.\n * If the library does not detect that the file is already opened * and #H5F_ACC_TRUNC is not used, H5Fcreate() will return a failure * because the file already exists. Note that this is correct * behavior.\n * But if the library does not detect that the file is already * opened and #H5F_ACC_TRUNC is used, H5Fcreate() will truncate the * existing file and return a valid file identifier. Such a * truncation of a currently-opened file will almost certainly * result in errors. While unlikely, the HDF5 library may not be * able to detect, and thus report, such errors.\n * Applications should avoid calling H5Fcreate() with an already * opened file. * * \since 1.0.0 * * \see H5Fopen(), H5Fclose() * */ H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id); /** * \ingroup H5F * * \brief Opens an existing HDF5 file * * \param[in] filename Name of the file to be opened * \param[in] flags File access flags. Allowable values are: * - #H5F_ACC_RDWR: Allows read and write access to file * - #H5F_ACC_RDONLY: Allows read-only access to file * - #H5F_ACC_RDWR \c | #H5F_ACC_SWMR_WRITE: Indicates that * the file is open for writing in a * single-writer/multi-writer (SWMR) scenario. * - #H5F_ACC_RDONLY \c | #H5F_ACC_SWMR_READ: Indicates * that the file is open for reading in a * single-writer/multi-reader (SWMR) scenario. * - An additional flag, #H5F_ACC_DEBUG, prints debug * information. This flag can be combined with one of the * above values using the bit-wise OR operator (\c |), but * it is used only by HDF5 library developers; * \Emph{it is neither tested nor supported} for use in * applications. * \fapl_id * \return \hid_t{file} * * \details H5Fopen() is the primary function for accessing existing HDF5 files. * This function opens the named file in the specified access mode and * with the specified access property list. * * Note that H5Fopen() does not create a file if it does not already * exist; see H5Fcreate(). * * The \p filename parameter specifies the name of the file to be * opened. * * The \p fapl_id parameter specifies the file access property list. * Use of #H5P_DEFAULT specifies that default I/O access properties * are to be used. * * The \p flags parameter specifies whether the file will be opened in * read-write or read-only mode, #H5F_ACC_RDWR or #H5F_ACC_RDONLY, * respectively. More complex behaviors of file access are controlled * through the file-access property list. * * The return value is a file identifier for the open file; this file * identifier should be closed by calling H5Fclose() when it is no * longer needed. * * \note #H5F_ACC_RDWR and #H5F_ACC_RDONLY are mutually exclusive; use * exactly one. * * \attention \Bold{Special cases — Multiple opens:} A file can often be opened * with a new H5Fopen() call without closing an already-open * identifier established in a previous H5Fopen() or H5Fcreate() * call. Each such H5Fopen() call will return a unique identifier * and the file can be accessed through any of these identifiers as * long as the identifier remains valid. In such multiply-opened * cases, the open calls must use the same flags argument and the * file access property lists must use the same file close degree * property setting (see the external link discussion below and * H5Pset_fclose_degree()).\n * In some cases, such as files on a local Unix file system, the * HDF5 library can detect that a file is multiply opened and will * maintain coherent access among the file identifiers.\n * But in many other cases, such as parallel file systems or * networked file systems, it is not always possible to detect * multiple opens of the same physical file. In such cases, HDF5 * will treat the file identifiers as though they are accessing * different files and will be unable to maintain coherent access. * Errors are likely to result in these cases. While unlikely, the * HDF5 library may not be able to detect, and thus report, * such errors.\n * It is generally recommended that applications avoid multiple * opens of the same file. * * \attention \Bold{Special restriction on multiple opens of a file first * opened by means of an external link:} When an external link is * followed, the external file is always opened with the weak file * close degree property setting, #H5F_CLOSE_WEAK (see * H5Lcreate_external() and H5Pset_fclose_degree()). If the file is * reopened with H5Fopen while it remains held open from such an * external link call, the file access property list used in the * open call must include the file close degree setting * #H5F_CLOSE_WEAK or the open will fail. * * \version 1.10.0 The #H5F_ACC_SWMR_WRITE and #H5F_ACC_SWMR_READ flags were added. * * \see H5Fclose() * */ H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id); H5_DLL hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t access_plist, hid_t es_id); /** * \ingroup H5F * * \brief Returns a new identifier for a previously-opened HDF5 file * * \param[in] file_id Identifier of a file for which an additional identifier * is required * * \return \hid_t{file} * * \details H5Freopen() returns a new file identifier for an already-open HDF5 * file, as specified by \p file_id. Both identifiers share caches and * other information. The only difference between the identifiers is * that the new identifier is not mounted anywhere and no files are * mounted on it. * * The new file identifier should be closed by calling H5Fclose() when * it is no longer needed. * * \note Note that there is no circumstance under which H5Freopen() can * actually open a closed file; the file must already be open and have an * active \p file_id. E.g., one cannot close a file with H5Fclose() on * \p file_id then use H5Freopen() on \p file_id to reopen it. * */ H5_DLL hid_t H5Freopen(hid_t file_id); H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, hid_t es_id); /** * \ingroup H5F * * \brief Flushes all buffers associated with a file to storage * * \loc_id{object_id} * \param[in] scope The scope of the flush action * * \return \herr_t * * \details H5Fflush() causes all buffers associated with a file to be * immediately flushed to storage without removing the data from the * cache. * * \p object_id can be any object associated with the file, including * the file itself, a dataset, a group, an attribute, or a named * datatype. * * \p scope specifies whether the scope of the flush action is * global or local. Valid values are as follows: * \scopes * * \attention HDF5 does not possess full control over buffering. H5Fflush() * flushes the internal HDF5 buffers then asks the operating system * (the OS) to flush the system buffers for the open files. After * that, the OS is responsible for ensuring that the data is * actually flushed to disk. * */ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id, H5F_scope_t scope, hid_t es_id); /** * \example H5Fclose.c * After creating an HDF5 file with H5Fcreate(), we close it with * H5Fclose(). */ /** * \ingroup H5F * * \brief Terminates access to an HDF5 file * * \file_id * \return \herr_t * * \details H5Fclose() terminates access to an HDF5 file (specified by * \p file_id) by flushing all data to storage. * * If this is the last file identifier open for the file and no other * access identifier is open (e.g., a dataset identifier, group * identifier, or shared datatype identifier), the file will be fully * closed and access will end. * * Use H5Fclose() as shown in the following example: * \include H5Fclose.c * * \note \Bold{Delayed close:} Note the following deviation from the * above-described behavior. If H5Fclose() is called for a file but one * or more objects within the file remain open, those objects will remain * accessible until they are individually closed. Thus, if the dataset * \c data_sample is open when H5Fclose() is called for the file * containing it, \c data_sample will remain open and accessible * (including writable) until it is explicitly closed. The file will be * automatically closed once all objects in the file have been closed.\n * Be warned, however, that there are circumstances where it is not * possible to delay closing a file. For example, an MPI-IO file close is * a collective call; all of the processes that opened the file must * close it collectively. The file cannot be closed at some time in the * future by each process in an independent fashion. Another example is * that an application using an AFS token-based file access privilege may * destroy its AFS token after H5Fclose() has returned successfully. This * would make any future access to the file, or any object within it, * illegal.\n * In such situations, applications must close all open objects in a file * before calling H5Fclose. It is generally recommended to do so in all * cases. * * \see H5Fopen() * */ H5_DLL herr_t H5Fclose(hid_t file_id); H5_DLL herr_t H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, hid_t es_id); /** * \ingroup H5F * * \brief Deletes an HDF5 file * * \param[in] filename Name of the file to delete * \fapl_id * * \return \herr_t * * \details H5Fdelete() deletes an HDF5 file \p filename with a file access * property list \p fapl_id. The \p fapl_id should be configured with * the same VOL connector or VFD that was used to open the file. * * This API was introduced for use with the Virtual Object Layer * (VOL). With the VOL, HDF5 "files" can map to arbitrary storage * schemes such as object stores and relational database tables. The * data created by these implementations may be inconvenient for a * user to remove without a detailed knowledge of the storage scheme. * H5Fdelete() gives VOL connector authors the ability to add * connector-specific delete code to their connectors so that users * can remove these "files" without detailed knowledge of the storage * scheme. * * For a VOL connector, H5Fdelete() deletes the file in a way that * makes sense for the specified VOL connector. * * For the native HDF5 connector, HDF5 files will be deleted via the * VFDs, each of which will have to be modified to delete the files it * creates. * * For all implementations, H5Fdelete() will first check if the file * is an HDF5 file via H5Fis_accessible(). This is done to ensure that * H5Fdelete() cannot be used as an arbitrary file deletion call. * * \since 1.12.0 * */ H5_DLL herr_t H5Fdelete(const char *filename, hid_t fapl_id); /** * \ingroup H5F * * \brief Returns a file creation property list identifier * * \file_id * \return \hid_t{file creation property list} * * \details H5Fget_create_plist() returns the file creation property list * identifier identifying the creation properties used to create this * file. This function is useful for duplicating properties when * creating another file. * * The creation property list identifier should be released with * H5Pclose(). * */ H5_DLL hid_t H5Fget_create_plist(hid_t file_id); /** * \ingroup H5F * * \brief Returns a file access property list identifier * * \file_id * \return \hid_t{file access property list} * * \details H5Fget_access_plist() returns the file access property list * identifier of the specified file. * */ H5_DLL hid_t H5Fget_access_plist(hid_t file_id); /** * \ingroup H5F * * \brief Determines the read/write or read-only status of a file * * \file_id * \param[out] intent Access mode flag as originally passed with H5Fopen() * * \return \herr_t * * \details Given the identifier of an open file, \p file_id, H5Fget_intent() * retrieves the intended access mode" flag passed with H5Fopen() when * the file was opened. * * The value of the flag is returned in \p intent. Valid values are as * follows: * \file_access * * \note The function will not return an error if intent is NULL; it will * simply do nothing. * * \version 1.10.0 C function enhanced to work with SWMR functionality. * * \since 1.8.0 * */ H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent); /** * \ingroup H5F * * \brief Retrieves a file's file number that uniquely identifies an open file * * \file_id * \param[out] fileno A buffer to hold the file number * * \return \herr_t * * \details H5Fget_fileno() retrieves a file number for a file specified by the * file identifier \p file_id and the pointer \p fnumber to the file * number. * * \since 1.12.0 * */ H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno); /** * \ingroup H5F * * \brief Returns the number of open object identifiers for an open file * * \file_id or #H5F_OBJ_ALL for all currently-open HDF5 files * \param[in] types Type of object for which identifiers are to be returned * * \return Returns the number of open objects if successful; otherwise returns * a negative value. * * \details Given the identifier of an open file, file_id, and the desired * object types, types, H5Fget_obj_count() returns the number of open * object identifiers for the file. * * To retrieve a count of open identifiers for open objects in all * HDF5 application files that are currently open, pass the value * #H5F_OBJ_ALL in \p file_id. * * The types of objects to be counted are specified in types as * follows: * \obj_types * * Multiple object types can be combined with the * logical \c OR operator (|). For example, the expression * \c (#H5F_OBJ_DATASET|#H5F_OBJ_GROUP) would call for datasets and * groups. * * \version 1.6.8, 1.8.2 C function return type changed to \c ssize_t. * \version 1.6.5 #H5F_OBJ_LOCAL has been added as a qualifier on the types * of objects to be counted. #H5F_OBJ_LOCAL restricts the * search to objects opened through current file identifier. * */ H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types); /** *------------------------------------------------------------------------- * \ingroup H5F * * \brief Returns a list of open object identifiers * * \file_id or #H5F_OBJ_ALL for all currently-open HDF5 files * \param[in] types Type of object for which identifiers are to be returned * \param[in] max_objs Maximum number of object identifiers to place into * \p obj_id_list * \param[out] obj_id_list Pointer to the returned buffer of open object * identifiers * * \return Returns number of objects placed into \p obj_id_list if successful; * otherwise returns a negative value. * * \details Given the file identifier \p file_id and the type of objects to be * identified, types, H5Fget_obj_ids() returns the list of identifiers * for all open HDF5 objects fitting the specified criteria. * * To retrieve identifiers for open objects in all HDF5 application * files that are currently open, pass the value #H5F_OBJ_ALL in * \p file_id. * * The types of object identifiers to be retrieved are specified in * types using the codes listed for the same parameter in * H5Fget_obj_count(). * * To retrieve a count of open objects, use the H5Fget_obj_count() * function. This count can be used to set the \p max_objs parameter. * * \version 1.8.2 C function return type changed to \c ssize_t and \p * max_objs parameter datatype changed to \c size_t. * \version 1.6.8 C function return type changed to \c ssize_t and \p * max_objs parameter datatype changed to \c size_t. * \since 1.6.0 * */ H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list); /** * \ingroup H5F * * \brief Returns pointer to the file handle from the virtual file driver * * \file_id * \fapl_id{fapl} * \param[out] file_handle Pointer to the file handle being used by the * low-level virtual file driver * * \return \herr_t * * \details Given the file identifier \p file_id and the file access property * list \p fapl_id, H5Fget_vfd_handle() returns a pointer to the file * handle from the low-level file driver currently being used by the * HDF5 library for file I/O. * * \note For most drivers, the value of \p fapl_id will be #H5P_DEFAULT. For * the \c FAMILY or \c MULTI drivers, this value should be defined * through the property list functions: H5Pset_family_offset() for the * \c FAMILY driver and H5Pset_multi_type() for the \c MULTI driver * * \since 1.6.0 * */ H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); /** * \ingroup H5F * * \brief Mounts an HDF5 file * * \loc_id{loc} * \param[in] name Name of the group onto which the file specified by \p child * is to be mounted * \file_id{child} * \param[in] plist File mount property list identifier. Pass #H5P_DEFAULT! * * \return \herr_t * * \details H5Fmount() mounts the file specified by \p child onto the object * specified by \p loc and \p name using the mount properties \p plist * If the object specified by \p loc is a dataset, named datatype or * attribute, then the file will be mounted at the location where the * attribute, dataset, or named datatype is attached. * * \note To date, no file mount properties have been defined in HDF5. The * proper value to pass for \p plist is #H5P_DEFAULT, indicating the * default file mount property list. * */ H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist); /** * \ingroup H5F * * \brief Unounts an HDF5 file * * \loc_id{loc} * \param[in] name Name of the mount point * * \return \herr_t * * \details Given a mount point, H5Funmount() dissociates the mount point's * file from the file mounted there. This function does not close * either file. * * The mount point can be either the group in the parent or the root * group of the mounted file (both groups have the same name). If the * mount point was opened before the mount then it is the group in the * parent; if it was opened after the mount then it is the root group * of the child. * */ H5_DLL herr_t H5Funmount(hid_t loc, const char *name); /** * \ingroup H5F * * \brief Returns the amount of free space in a file (in bytes) * * \file_id * * \return Returns the amount of free space in the file if successful; * otherwise returns a negative value. * * \details Given the identifier of an open file, \p file_id, * H5Fget_freespace() returns the amount of space that is unused by * any objects in the file. * * The interpretation of this number depends on the configured free space * management strategy. For example, if the HDF5 library only tracks free * space in a file from a file open or create until that file is closed, * then this routine will report the free space that has been created * during that interval. * * \since 1.6.1 * */ H5_DLL hssize_t H5Fget_freespace(hid_t file_id); /** * \ingroup H5F * * \brief Returns the size of an HDF5 file (in bytes) * * \file_id * \param[out] size Size of the file, in bytes * * \return \herr_t * * \details H5Fget_filesize() returns the size of the HDF5 file specified by * \p file_id. * * The returned size is that of the entire file, as opposed to only * the HDF5 portion of the file. I.e., size includes the user block, * if any, the HDF5 portion of the file, and any data that may have * been appended beyond the data written through the HDF5 library. * * \version 1.6.3 Fortran subroutine introduced in this release. * * \since 1.6.3 * */ H5_DLL herr_t H5Fget_filesize(hid_t file_id, hsize_t *size); /** * \ingroup H5F * * \brief Retrieves the file's end-of-allocation (EOA) * * \file_id * \param[out] eoa The file's EOA * * \return \herr_t * * \details H5Fget_eoa() retrieves the file's EOA and returns it in the * parameter eoa. * * \since 1.10.2 * */ H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); /** * \ingroup H5F * * \brief Sets the file' EOA to the maximum of (EOA, EOF) + increment * * \file_id * \param[in] increment The number of bytes to be added to the maximum of * (EOA, EOF) * * \return \herr_t * * \details H5Fincrement_filesize() sets the file's EOA to the maximum of (EOA, * EOF) + \p increment. The EOA is the end-of-file address stored in * the file's superblock while EOF is the file's actual end-of-file. * * \since 1.10.2 * */ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); /** * \ingroup H5F * * \brief Retrieves a copy of the image of an existing, open file * * \file_id * \param[out] buf_ptr Pointer to the buffer into which the image of the * HDF5 file is to be copied. If \p buf_ptr is NULL, * no data will be copied but the function’s return value * will still indicate the buffer size required (or a * negative value on error). * \param[out] buf_len Size of the supplied buffer * * \return ssize_t * * \details H5Fget_file_image() retrieves a copy of the image of an existing, * open file. This routine can be used with files opened using the * SEC2 (or POSIX), STDIO, and Core (or Memory) virtual file drivers * (VFDs). * * If the return value of H5Fget_file_image() is a positive value, it * will be the length in bytes of the buffer required to store the * file image. So if the file size is unknown, it can be safely * determined with an initial H5Fget_file_image() call with buf_ptr * set to NULL. The file image can then be retrieved with a second * H5Fget_file_image() call with \p buf_len set to the initial call’s * return value. * * While the current file size can also be retrieved with * H5Fget_filesize(), that call may produce a larger value than is * needed. The value returned by H5Fget_filesize() includes the user * block, if it exists, and any unallocated space at the end of the * file. It is safe in all situations to get the file size with * H5Fget_file_image() and it often produces a value that is more * appropriate for the size of a file image buffer. * * \note \Bold{Recommended Reading:} This function is part of the file image * operations feature set. It is highly recommended to study the guide * "HDF5 File Image Operations" before using this feature set.\n See the * "See Also" section below for links to other elements of HDF5 file * image operations. \todo Fix the references. * * \attention H5Pget_file_image() will fail, returning a negative value, if the * file is too large for the supplied buffer. * * \see H5LTopen_file_image(), H5Pset_file_image(), H5Pget_file_image(), * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks() * * \version 1.8.13 Fortran subroutine added in this release. * * \since 1.8.0 * */ H5_DLL ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len); /** * \ingroup MDC * * \brief Obtains current metadata cache configuration for target file * * \file_id * \param[in,out] config_ptr Pointer to the H5AC_cache_config_t instance in which * the current metadata cache configuration is to be * reported. The fields of this structure are discussed * \ref H5AC-cache-config-t "here". * \return \herr_t * * \details H5Fget_mdc_config() loads the current metadata cache configuration * into the instance of H5AC_cache_config_t pointed to by the \p config_ptr * parameter. * * Note that the \c version field of \p config_ptr must be initialized * --this allows the library to support old versions of the H5AC_cache_config_t * structure. * * \par General configuration section *
int version |
* IN: Integer field indicating the the version of the H5AC_cache_config_t in use. This field should * be set to #H5AC__CURR_CACHE_CONFIG_VERSION (defined in H5ACpublic.h). | *
hbool_t rpt_fcn_enabled |
* OUT: Boolean flag indicating whether the adaptive cache resize report function is enabled. This
* field should almost always be set to disabled ( The * report function is not supported code, and can be expected to change between versions of the * library. Use it at your own risk. |
*
hbool_t open_trace_file |
* OUT: Boolean field indicating whether the trace_file_name field should be used to
* open a trace file for the cache. This field will always be set to 0 in this context. |
*
hbool_t close_trace_file |
* OUT: Boolean field indicating whether the current trace file (if any) should be closed. This field
* will always be set to 0 in this context. |
char*trace_file_name |
* OUT: Full path name of the trace file to be opened if the open_trace_file field is
* set to 1 . This field will always be set to the empty string in this context. |
hbool_t evictions_enabled |
* OUT: Boolean flag indicating whether metadata cache entry evictions are * enabled. | *
hbool_t set_initial_size |
* OUT: Boolean flag indicating whether the cache should be created with a user specified initial
* maximum size. If the configuration is loaded from the cache, this flag will always be set
* to |
*
size_t initial_size |
* OUT: Initial maximum size of the cache in bytes, if applicable. If the configuration is loaded * from the cache, this field will contain the cache maximum size as of the time of the * call. |
*
double min_clean_fraction |
* OUT: Float value specifying the minimum fraction of the cache that must be kept either clean or * empty when possible. | *
size_t max_size |
* OUT: Upper bound (in bytes) on the range of values that the adaptive cache resize code can select * as the maximum cache size. | *
size_t min_size |
* OUT: Lower bound (in bytes) on the range of values that the adaptive cache resize code can select * as the maximum cache size. | *
long int epoch_length |
* OUT: Number of cache accesses between runs of the adaptive cache resize * code. | *
enum H5C_cache_incr_mode incr_mode |
* OUT: Enumerated value indicating the operational mode of the automatic cache size increase code.
* At present, only the following values are legal: \c H5C_incr__off: Automatic cache size increase is * disabled. \c H5C_incr__threshold: Automatic cache size increase is enabled using the hit rate * threshold algorithm. |
*
double lower_hr_threshold |
* OUT: Hit rate threshold used in the hit rate threshold cache size increase algorithm. | *
double increment |
* OUT: The factor by which the current maximum cache size is multiplied to obtain an initial new * maximum cache size if a size increase is triggered in the hit rate threshold cache size increase * algorithm. | *
hbool_t apply_max_increment |
* OUT: Boolean flag indicating whether an upper limit will be applied to the size of cache size * increases. | *
size_t max_increment |
* OUT: The maximum number of bytes by which the maximum cache size can be increased in a single step * -- if applicable. | *
enum H5C_cache_flash_incr_mode flash_incr_mode |
* OUT: Enumerated value indicating the operational mode of the flash cache size increase code. At
* present, only the following values are legal: \c H5C_flash_incr__off: Flash cache size increase is * disabled. \c H5C_flash_incr__add_space: Flash cache size increase is enabled using the add * space algorithm. |
*
double flash_threshold |
* OUT: The factor by which the current maximum cache size is multiplied to obtain the minimum size * entry / entry size increase which may trigger a flash cache size * increase. | *
double flash_multiple |
* OUT: The factor by which the size of the triggering entry / entry size increase is multiplied to
* obtain the initial cache size increment. This increment may be reduced to reflect existing free
* space in the cache and the max_size field above. |
*
Decrement configuration * section: | *|
enum H5C_cache_decr_mode decr_mode |
* OUT: Enumerated value indicating the operational mode of the automatic cache size decrease code.
* At present, the following values are legal: H5C_decr__off: Automatic cache size decrease is disabled, and * the remaining decrement fields are ignored. H5C_decr__threshold: Automatic cache size decrease is * enabled using the hit rate threshold algorithm. H5C_decr__age_out: Automatic cache size decrease is * enabled using the ageout algorithm. H5C_decr__age_out_with_threshold: Automatic cache size decrease * is enabled using the ageout with hit rate threshold algorithm |
*
double upper_hr_threshold |
* OUT: Upper hit rate threshold. This value is only used if the decr_mode is either * H5C_decr__threshold or H5C_decr__age_out_with_threshold. | *
double decrement |
* OUT: Factor by which the current max cache size is multiplied to obtain an initial value for the * new cache size when cache size reduction is triggered in the hit rate threshold cache size reduction * algorithm. | *
hbool_t apply_max_decrement |
* OUT: Boolean flag indicating whether an upper limit should be applied to the size of cache size * decreases. | *
size_t max_decrement |
* OUT: The maximum number of bytes by which cache size can be decreased if any single step, if * applicable. | *
int epochs_before_eviction |
* OUT: The minimum number of epochs that an entry must reside unaccessed in cache before being * evicted under either of the ageout cache size reduction algorithms. | *
hbool_t apply_empty_reserve |
* OUT: Boolean flag indicating whether an empty reserve should be maintained under either of the * ageout cache size reduction algorithms. | *
double empty_reserve |
* OUT: Empty reserve for use with the ageout cache size reduction algorithms, if applicable. | *
int dirty_bytes_threshold |
* OUT: Threshold number of bytes of dirty metadata generation for triggering synchronizations of the
* metadata caches serving the target file in the parallel case. Synchronization occurs whenever the * number of bytes of dirty metadata created since the last synchronization exceeds this * limit. |
*
int version |
* IN: Integer field indicating the the version of the H5AC_cache_config_t in use. This * field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION (defined * in H5ACpublic.h). | *
hbool_t rpt_fcn_enabled |
* IN: Boolean flag indicating whether the adaptive cache resize report function is enabled. This
* field should almost always be set to disabled (0 ). Since resize algorithm activity is
* reported via stdout, it MUST be set to disabled (0 ) on Windows machines.The report function * is not supported code, and can be expected to change between versions of the library. Use it at your own * risk. |
*
hbool_t open_trace_File |
* IN: Boolean field indicating whether the trace_file_name field should be used to open
* a trace file for the cache.The trace file is a debuging feature that allows the capture of top
* level metadata cache requests for purposes of debugging and/or optimization. This field should normally be
* set to This field should only
* be set to The trace file feature is unsupported unless used at the direction of * The HDF Group. It is intended to allow The HDF Group to collect a trace of cache activity in cases of * occult failures and/or poor performance seen in the field, so as to aid in reproduction in the lab. If you * use it absent the direction of The HDF Group, you are on your own. |
*
hbool_t close_trace_file |
* IN: Boolean field indicating whether the current trace file (if any) should be closed. See the
* above comments on the The trace file * feature is unsupported unless used at the direction of The HDF Group. It is intended to allow The HDF Group * to collect a trace of cache activity in cases of occult failures and/or poor performance seen in the field, * so as to aid in reproduction in the lab. If you use it absent the direction of The HDF Group, you are on * your own. |
*
char trace_file_name[] |
* IN: Full path of the trace file to be opened if the open_trace_file field is set
* to 1 .In the parallel case, an ascii representation of the mpi rank of the process * will be appended to the file name to yield a unique trace file name for each process. The length of * the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN characters. The trace file feature is * unsupported unless used at the direction of The HDF Group. It is intended to allow The HDF Group * to collect a trace of cache activity in cases of occult failures and/or poor performance seen in the field, * so as to aid in reproduction in the lab. If you use it absent the direction of The HDF Group, you are on * your own. |
*
hbool_t evictions_enabled |
* IN: A boolean flag indicating whether evictions from the metadata cache are enabled. This flag is
* initially set to enabled (1 ).In rare circumstances, the raw data throughput
* requirements may be so high that the user wishes to postpone metadata writes so as to reserve I/O
* throughput for raw data. The The When this
* flag is set to disabled ( Evictions will be re-enabled when
* this field is set back to |
*
hbool_t set_initial_size |
* IN: Boolean flag indicating whether the cache should be forced to the user specified initial * size. | *
size_t initial_size |
* IN: If set_initial_size is set to 1 , then initial_size must
* contain the desired initial size in bytes. This value must lie in the closed interval
* [min_size, max_size] . (see below) |
*
double min_clean_fraction |
* IN: This field specifies the minimum fraction of the cache that must be kept either clean or
* empty. The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to start in the serial * case. In the parallel case, a larger value is needed -- see Metadata Caching in HDF5 in the collection "Advanced * Topics in HDF5." |
*
size_t max_size |
* IN: Upper bound (in bytes) on the range of values that the adaptive cache resize code can select * as the maximum cache size. | *
size_t min_size |
* IN: Lower bound (in bytes) on the range of values that the adaptive cache resize code can select * as the maximum cache size. | *
long int epoch_length |
* IN: Number of cache accesses between runs of the adaptive cache resize code. 50,000 is a good * starting number. | *
enum H5C_cache_incr_mode incr_mode |
* IN: Enumerated value indicating the operational mode of the automatic cache size increase code. At
* present, only two values are legal: \c H5C_incr__off: Automatic cache size increase is disabled, * and the remaining increment fields are ignored. \c H5C_incr__threshold: Automatic cache size increase * is enabled using the hit rate threshold algorithm. |
*
double lower_hr_threshold |
* IN: Hit rate threshold used by the hit rate threshold cache size increment algorithm. When the * hit rate over an epoch is below this threshold and the cache is full, the maximum size of the * cache is multiplied by increment (below), and then clipped as necessary to stay within max_size, and * possibly max_increment. This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good starting * point. |
*
double increment |
* IN: Factor by which the hit rate threshold cache size increment algorithm multiplies the current
* maximum cache size to obtain a tentative new cache size. The actual cache size increase will be * clipped to satisfy the max_size specified in the general configuration, and possibly max_increment * below. The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable value. If you * set it to 1.0, you will effectively disable cache size increases. |
*
hbool_t apply_max_increment |
* IN: Boolean flag indicating whether an upper limit should be applied to the size of cache size * increases. | *
size_t max_increment |
* IN: Maximum number of bytes by which cache size can be increased in a single step -- if * applicable. | *
enum H5C_cache_flash_incr_mode flash_incr_mode |
* IN: Enumerated value indicating the operational mode of the flash cache size increase code. At
* present, only the following values are legal: \c H5C_flash_incr__off: Flash cache size increase is * disabled. \c H5C_flash_incr__add_space: Flash cache size increase is enabled using the add * space algorithm. |
*
double flash_threshold |
* IN: The factor by which the current maximum cache size is multiplied to obtain the minimum size
* entry / entry size increase which may trigger a flash cache size increase. At present, this value * must lie in the range [0.1, 1.0]. |
*
double flash_multiple |
* IN: The factor by which the size of the triggering entry / entry size increase is multiplied to
* obtain the initial cache size increment. This increment may be reduced to reflect existing free
* space in the cache and the max_size field above.At present, this field must lie in the * range [0.1, 10.0]. |
*
enum H5C_cache_decr_mode decr_mode |
* IN: Enumerated value indicating the operational mode of the automatic cache size decrease code. At
* present, the following values are legal: \c H5C_decr__off: Automatic cache size decrease is * disabled. \c H5C_decr__threshold: Automatic cache size decrease is enabled using the hit * rate threshold algorithm. \c H5C_decr__age_out: Automatic cache size decrease is enabled using the * ageout algorithm. \c H5C_decr__age_out_with_threshold: Automatic cache size decrease is enabled using * the ageout with hit rate threshold algorithm |
*
double upper_hr_threshold |
* IN: Hit rate threshold for the hit rate threshold and ageout with hit rate threshold cache size
* decrement algorithms. When \c decr_mode is \c H5C_decr__threshold, and the hit rate over a given * epoch exceeds the supplied threshold, the current maximum cache size is multiplied by decrement to obtain a * tentative new (and smaller) maximum cache size. When \c decr_mode is \c * H5C_decr__age_out_with_threshold, there is no attempt to find and evict aged out entries unless the hit * rate in the previous epoch exceeded the supplied threshold. This field must lie in the interval * [0.0, 1.0]. For \c H5C_incr__threshold, .9995 or .99995 is a good place to start. For \c * H5C_decr__age_out_with_threshold, .999 might be more useful. |
*
double decrement |
* IN: In the hit rate threshold cache size decrease algorithm, this parameter contains the factor by
* which the current max cache size is multiplied to produce a tentative new cache size. The actual * cache size decrease will be clipped to satisfy the min_size specified in the general configuration, and * possibly max_decrement below. The parameter must be be in the interval [0.0, 1.0]. If you set * it to 1.0, you will effectively disable cache size decreases. 0.9 is a reasonable starting point. |
*
hbool_t apply_max_decrement |
* IN: Boolean flag indicating whether an upper limit should be applied to the size of cache size * decreases. | *
size_t max_decrement |
* IN: Maximum number of bytes by which the maximum cache size can be decreased in any single step -- * if applicable. | *
int epochs_before_eviction |
* IN: In the ageout based cache size reduction algorithms, this field contains the minimum number of * epochs an entry must remain unaccessed in cache before the cache size reduction algorithm tries to * evict it. 3 is a reasonable value. | *
hbool_t apply_empty_reserve |
* IN: Boolean flag indicating whether the ageout based decrement algorithms will maintain a empty * reserve when decreasing cache size. | *
double empty_reserve |
* IN: Empty reserve as a fraction of maximum cache size if applicable. When so directed, the * ageout based algorithms will not decrease the maximum cache size unless the empty reserve can be * met. The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to * start. |
*
int dirty_bytes_threshold |
* IN: Threshold number of bytes of dirty metadata generation for triggering synchronizations of the
* metadata caches serving the target file in the parallel case. Synchronization occurs whenever the * number of bytes of dirty metadata created since the last synchronization exceeds this limit. This * field only applies to the parallel case. While it is ignored elsewhere, it can still draw a value out of * bounds error. It must be consistant across all caches on any given file. By default, this field * is set to 256 KB. It shouldn't be more than half the current maximum cache size times the minimum clean * fraction. |
*
Index for \Code{retries[]} | *Metadata entries* | *
---|---|
0 | Object header (version 2) |
1 | Object header chunk (version 2) |
2 | B-tree header (version 2) |
3 | B-tree internal node (version 2) |
4 | B-tree leaf node (version 2) |
5 | Fractal heap header |
6 | Fractal heap direct block (optional checksum) |
7 | Fractal heap indirect block |
8 | Free-space header |
9 | Free-space sections |
10 | Shared object header message table |
11 | Shared message record list |
12 | Extensive array header |
13 | Extensive array index block |
14 | Extensive array super block |
15 | Extensive array data block |
16 | Extensive array data block page |
17 | Fixed array super block |
18 | Fixed array data block |
19 | Fixed array data block page |
20 | File's superblock (version 2) |
* All entries are of version 0 (zero) unless indicated * otherwise. |