Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-18 09:16:02

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  * Purpose: The public header file for the multi virtual file driver (VFD)
0015  */
0016 #ifndef H5FDmulti_H
0017 #define H5FDmulti_H
0018 
0019 /** Initializer for the multi VFD */
0020 #define H5FD_MULTI (H5FDperform_init(H5FD_multi_init))
0021 
0022 #ifdef __cplusplus
0023 extern "C" {
0024 #endif
0025 
0026 /** @private
0027  *
0028  * \brief Private initializer for the multi VFD
0029  */
0030 H5_DLL hid_t H5FD_multi_init(void);
0031 
0032 /**
0033  * \ingroup FAPL
0034  *
0035  * \brief Sets up use of the multi-file driver
0036  *
0037  * \fapl_id
0038  * \param[in] memb_map Maps memory usage types to other memory usage types
0039  * \param[in] memb_fapl Property list for each memory usage type
0040  * \param[in] memb_name Name generator for names of member files
0041  * \param[in] memb_addr The offsets within the virtual address space, from 0
0042  *           (zero) to #HADDR_MAX, at which each type of data storage begins
0043  * \param[in] relax Allows read-only access to incomplete file sets when \c true
0044  * \returns \herr_t
0045  *
0046  * \details H5Pset_fapl_multi() sets the file access property list \p fapl_id to
0047  *          use the multi-file driver.
0048  *
0049  *          The multi-file driver enables different types of HDF5 data and
0050  *          metadata to be written to separate files. These files are viewed by
0051  *          the HDF5 library and the application as a single virtual HDF5 file
0052  *          with a single HDF5 file address space. The types of data that can be
0053  *          broken out into separate files include raw data, the superblock,
0054  *          B-tree data, global heap data, local heap data, and object
0055  *          headers. At the programmer's discretion, two or more types of data
0056  *          can be written to the same file while other types of data are
0057  *          written to separate files.
0058  *
0059  *          The array \p memb_map maps memory usage types to other memory usage
0060  *          types and is the mechanism that allows the caller to specify how
0061  *          many files are created. The array contains #H5FD_MEM_NTYPES entries,
0062  *          which are either the value #H5FD_MEM_DEFAULT or a memory usage
0063  *          type. The number of unique values determines the number of files
0064  *          that are opened.
0065  *
0066  *          The array \p memb_fapl contains a property list for each memory
0067  *          usage type that will be associated with a file.
0068  *
0069  *          The array \p memb_name should be a name generator (a
0070  *          \TText{printf}-style format with a \TText{%s} which will be replaced
0071  *          with the name passed to H5FDopen(), usually from H5Fcreate() or
0072  *          H5Fopen()).
0073  *
0074  *          The array \p memb_addr specifies the offsets within the virtual
0075  *          address space, from 0 (zero) to #HADDR_MAX, at which each type of
0076  *          data storage begins.
0077  *
0078  *          If \p relax is set to 1 (true), then opening an existing file for
0079  *          read-only access will not fail if some file members are
0080  *          missing. This allows a file to be accessed in a limited sense if
0081  *          just the meta data is available.
0082  *
0083  *          Default values for each of the optional arguments are as follows:
0084  *          <table>
0085  *          <tr>
0086  *          <td>\p memb_map</td>
0087  *          <td>The default member map contains the value #H5FD_MEM_DEFAULT for each element.</td>
0088  *          </tr>
0089  *          <tr>
0090  *          <td>
0091  *          \p memb_fapl
0092  *          </td>
0093  *          <td>
0094  *          The default value is #H5P_DEFAULT for each element.
0095  *          </td>
0096  *          </tr>
0097  *          <tr>
0098  *          <td>
0099  *          \p memb_name
0100  *          </td>
0101  *          <td>
0102  *          The default string is \TText{%s-X.h5} where \c X is one of the following letters:
0103  *          - \c s for #H5FD_MEM_SUPER
0104  *          - \c b for #H5FD_MEM_BTREE
0105  *          - \c r for #H5FD_MEM_DRAW
0106  *          - \c g for #H5FD_MEM_GHEAP
0107  *          - \c l for #H5FD_MEM_LHEAP
0108  *          - \c o for #H5FD_MEM_OHDR
0109  *          </td>
0110  *          </tr>
0111  *          <tr>
0112  *          <td>
0113  *          \p memb_addr
0114  *          </td>
0115  *          <td>
0116  *          The default setting is that the address space is equally divided
0117  *          among all of the elements:
0118  *          - #H5FD_MEM_SUPER \TText{-> 0 * (HADDR_MAX/6)}
0119  *          - #H5FD_MEM_BTREE \TText{-> 1 * (HADDR_MAX/6)}
0120  *          - #H5FD_MEM_DRAW \TText{-> 2 * (HADDR_MAX/6)}
0121  *          - #H5FD_MEM_GHEAP \TText{-> 3 * (HADDR_MAX/6)}
0122  *          - #H5FD_MEM_LHEAP \TText{-> 4 * (HADDR_MAX/6)}
0123  *          - #H5FD_MEM_OHDR \TText{-> 5 * (HADDR_MAX/6)}
0124  *          </td>
0125  *          </tr>
0126  *          </table>
0127  *
0128  * \par Example:
0129  * The following code sample sets up a multi-file access property list that
0130  * partitions data into meta and raw files, each being one-half of the address:\n
0131  * \code
0132  * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
0133  * hid_t memb_fapl[H5FD_MEM_NTYPES];
0134  * const char *memb[H5FD_MEM_NTYPES];
0135  * haddr_t memb_addr[H5FD_MEM_NTYPES];
0136  *
0137  * // The mapping...
0138  * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) {
0139  *   memb_map[mt] = H5FD_MEM_SUPER;
0140  * }
0141  * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
0142  *
0143  * // Member information
0144  * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
0145  * memb_name[H5FD_MEM_SUPER] = "%s.meta";
0146  * memb_addr[H5FD_MEM_SUPER] = 0;
0147  *
0148  * memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
0149  * memb_name[H5FD_MEM_DRAW] = "%s.raw";
0150  * memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
0151  *
0152  * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
0153  * H5Pset_fapl_multi(fapl, memb_map, memb_fapl,
0154  *                   memb_name, memb_addr, true);
0155  * \endcode
0156  *
0157  * \version 1.6.3 \p memb_name parameter type changed to \TText{const char* const*}.
0158  * \since 1.4.0
0159  */
0160 H5_DLL herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_fapl,
0161                                 const char *const *memb_name, const haddr_t *memb_addr, hbool_t relax);
0162 
0163 /**
0164  * \ingroup FAPL
0165  *
0166  * \brief Returns information about the multi-file access property list
0167  *
0168  * \fapl_id
0169  * \param[out] memb_map Maps memory usage types to other memory usage types
0170  * \param[out] memb_fapl Property list for each memory usage type
0171  * \param[out] memb_name Name generator for names of member files
0172  * \param[out] memb_addr The offsets within the virtual address space, from 0
0173  *           (zero) to #HADDR_MAX, at which each type of data storage begins
0174  * \param[out] relax Allows read-only access to incomplete file sets when \c true
0175  * \returns \herr_t
0176  *
0177  * \details H5Pget_fapl_multi() returns information about the multi-file access
0178  *          property list.
0179  *
0180  * \since 1.4.0
0181  *
0182  */
0183 H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl /*out*/,
0184                                 char **memb_name /*out*/, haddr_t *memb_addr /*out*/, hbool_t *relax /*out*/);
0185 
0186 /**
0187  * \ingroup FAPL
0188  *
0189  * \brief Emulates the old split file driver
0190  *
0191  * \fapl_id{fapl}
0192  * \param[in] meta_ext Metadata filename extension
0193  * \param[in] meta_plist_id File access property list identifier for the metadata file
0194  * \param[in] raw_ext Raw data filename extension
0195  * \param[in] raw_plist_id
0196  * \returns \herr_t
0197  *
0198  * \details H5Pset_fapl_split() is a compatibility function that enables the
0199  *          multi-file driver to emulate the split driver from HDF5 Releases 1.0
0200  *          and 1.2. The split file driver stored metadata and raw data in
0201  *          separate files but provided no mechanism for separating types of
0202  *          metadata.
0203  *
0204  *          \p fapl is a file access property list identifier.
0205  *
0206  *          \p meta_ext is the filename extension for the metadata file. The
0207  *          extension is appended to the name passed to H5FDopen(), usually from
0208  *          H5Fcreate() or H5Fopen(), to form the name of the metadata file. If
0209  *          the string \TText{%s} is used in the extension, it works like the
0210  *          name generator as in H5Pset_fapl_multi().
0211  *
0212  *          \p meta_plist_id is the file access property list identifier for the
0213  *          metadata file.
0214  *
0215  *          \p raw_ext is the filename extension for the raw data file. The
0216  *          extension is appended to the name passed to H5FDopen(), usually from
0217  *          H5Fcreate() or H5Fopen(), to form the name of the raw data file. If
0218  *          the string \TText{%s} is used in the extension, it works like the
0219  *          name generator as in H5Pset_fapl_multi().
0220  *
0221  *          \p raw_plist_id is the file access property list identifier for the
0222  *          raw data file.
0223  *
0224  *          If a user wishes to check to see whether this driver is in use, the
0225  *          user must call H5Pget_driver() and compare the returned value to the
0226  *          string #H5FD_MULTI. A positive match will confirm that the multi
0227  *          driver is in use; HDF5 provides no mechanism to determine whether it
0228  *          was called as the special case invoked by H5Pset_fapl_split().
0229  *
0230  * \par Example:
0231  * \code
0232  * // Example 1: Both metadata and raw data files are in the same
0233  * //            directory. Use Station1-m.h5 and Station1-r.h5 as
0234  * //            the metadata and raw data files.
0235  * hid_t fapl, fid;
0236  * fapl = H5Pcreate(H5P_FILE_ACCESS);
0237  * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
0238  * fid=H5Fcreate("Station1",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
0239  *
0240  * // Example 2: metadata and raw data files are in different
0241  * //            directories.  Use PointA-m.h5 and /pfs/PointA-r.h5 as
0242  * //            the metadata and raw data files.
0243  * hid_t fapl, fid;
0244  * fapl = H5Pcreate(H5P_FILE_ACCESS);
0245  * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "/pfs/%s-r.h5", H5P_DEFAULT);
0246  * fid=H5Fcreate("PointA",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
0247  * \endcode
0248  *
0249  * \since 1.4.0
0250  *
0251  */
0252 H5_DLL herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const char *raw_ext,
0253                                 hid_t raw_plist_id);
0254 #ifdef __cplusplus
0255 }
0256 #endif
0257 
0258 #endif