Skip to content

Commit 57a2805

Browse files
authored
Doxygen updates for functions that use printf expansion (#5816)
* Doxygen updates related to printf parsing in family, multi, and split drivers, and VDS. Update error message.
1 parent 54d34a2 commit 57a2805

File tree

4 files changed

+47
-15
lines changed

4 files changed

+47
-15
lines changed

src/H5FDfamily.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,9 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
738738
name = temp;
739739
}
740740
else
741-
HGOTO_ERROR(H5E_VFL, H5E_FILEEXISTS, NULL, "file names not unique");
741+
HGOTO_ERROR(H5E_VFL, H5E_FILEEXISTS, NULL,
742+
"differing member numbers do not produce unique member file names - try inserting "
743+
"\"%%06d\" into the file name string");
742744
}
743745

744746
/* Open all the family members */

src/H5FDfamily.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,25 @@ H5_DLLVAR hid_t H5FD_FAMILY_id_g;
6161
* \p memb_fapl_id is the identifier of the file access property list
6262
* to be used for each family member.
6363
*
64+
* The family file driver uses \TText{snprintf} to generate the member file
65+
* names, passing the member number as an unsigned int. The file name
66+
* used with the family file driver must therefore contain a single
67+
* \TText{printf} format specifier that indicates a variable of the correct
68+
* width and produces unique strings for each member number passed as a
69+
* parameter to snprintf. For example one might insert \TText{%06d}
70+
* into the file name string. There must be no other format specifiers
71+
* in the string.
72+
*
73+
* If this file driver is for the source file of a virtual dataset
74+
* (VDS) \TText{printf}-style mapping, special care must be taken. In this case
75+
* the VDS code expands the file name with \TText{snprintf} first, then the
76+
* family driver second. This means that, while the format specifier
77+
* for the VDS block number is inserted normally, the format specifier
78+
* for the family file driver member number must be escaped such that
79+
* it is only recognized as a format specifier the second time it is
80+
* run through \TText{snprintf}. As an example one may use \TText{%%06d} as
81+
* the member file number format specifier in the source file name.
82+
*
6483
* \version 1.8.0 Behavior of the \p memb_size parameter was changed.
6584
* \since 1.4.0
6685
*

src/H5FDmulti.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ H5_DLLVAR hid_t H5FD_MULTI_id_g;
7070
* usage type that will be associated with a file.
7171
*
7272
* The array \p memb_name should be a name generator (a
73-
* \TText{printf}-style format with a \TText{%s} which will be replaced
73+
* \TText{printf}-style format with a \TText{%%s} which will be replaced
7474
* with the name passed to H5FDopen(), usually from H5Fcreate() or
75-
* H5Fopen()).
75+
* H5Fopen()). There must be no other format specifiers in the string.
7676
*
7777
* The array \p memb_addr specifies the offsets within the virtual
7878
* address space, from 0 (zero) to #HADDR_MAX, at which each type of
@@ -102,7 +102,7 @@ H5_DLLVAR hid_t H5FD_MULTI_id_g;
102102
* \p memb_name
103103
* </td>
104104
* <td>
105-
* The default string is \TText{%s-X.h5} where \c X is one of the following letters:
105+
* The default string is \TText{%%s-X.h5} where \c X is one of the following letters:
106106
* - \c s for #H5FD_MEM_SUPER
107107
* - \c b for #H5FD_MEM_BTREE
108108
* - \c r for #H5FD_MEM_DRAW
@@ -209,7 +209,7 @@ H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid
209209
* \p meta_ext is the filename extension for the metadata file. The
210210
* extension is appended to the name passed to H5FDopen(), usually from
211211
* H5Fcreate() or H5Fopen(), to form the name of the metadata file. If
212-
* the string \TText{%s} is used in the extension, it works like the
212+
* the string \TText{%%s} is used in the extension, it works like the
213213
* name generator as in H5Pset_fapl_multi().
214214
*
215215
* \p meta_plist_id is the file access property list identifier for the
@@ -218,8 +218,9 @@ H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid
218218
* \p raw_ext is the filename extension for the raw data file. The
219219
* extension is appended to the name passed to H5FDopen(), usually from
220220
* H5Fcreate() or H5Fopen(), to form the name of the raw data file. If
221-
* the string \TText{%s} is used in the extension, it works like the
222-
* name generator as in H5Pset_fapl_multi().
221+
* the string \TText{%%s} is used in the extension, it works like the
222+
* name generator as in H5Pset_fapl_multi(). There must be no other
223+
* format specifiers in the string.
223224
*
224225
* \p raw_plist_id is the file access property list identifier for the
225226
* raw data file.

src/H5Ppublic.h

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7078,7 +7078,7 @@ H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels
70787078
* \param[in] vspace_id The dataspace identifier with the selection within the
70797079
* virtual dataset applied, possibly an unlimited selection
70807080
* \param[in] src_file_name The name of the HDF5 file where the source dataset is
7081-
* located or a \TText{"."} (period) for a source dataset in the same
7081+
* located or a \TText{.} (period) for a source dataset in the same
70827082
* file. The file might not exist yet. The name can be specified using
70837083
* a C-style \c printf statement as described below.
70847084
* \param[in] src_dset_name The path to the HDF5 dataset in the file specified by
@@ -7101,14 +7101,14 @@ H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels
71017101
* treated as literals except for the following substitutions:
71027102
* <table>
71037103
* <tr>
7104-
* <td>\TText{"%%"}</td>
7105-
* <td>Replaced with a single \TText{"%"} (percent) character.</td>
7104+
* <td>\TText{%%}</td>
7105+
* <td>Replaced with a single \TText{%} (percent) character.</td>
71067106
* </tr>
71077107
* <tr>
7108-
* <td><code>"%<d>b"</code></td>
7109-
* <td>Where <code>"<d>"</code> is the virtual dataset dimension axis (0-based)
7110-
* and \TText{"b"} indicates that the block count of the selection in that
7111-
* dimension should be used. The full expression (for example, \TText{"%0b"})
7108+
* <td><code>%\<d\>b</code></td>
7109+
* <td>Where <code>\<d\></code> is the virtual dataset dimension axis (0-based)
7110+
* and \TText{b} indicates that the block count of the selection in that
7111+
* dimension should be used. The full expression (for example, \TText{%0b})
71127112
* is replaced with a single numeric value when the mapping is evaluated at
71137113
* VDS access time. Example code for many source and virtual dataset mappings
71147114
* is available in the "Examples of Source to Virtual Dataset Mapping"
@@ -7121,11 +7121,21 @@ H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels
71217121
* If the printf form is used for the source file or dataset names, the
71227122
* selection in the source dataset's dataspace must be fixed-size.
71237123
*
7124+
* If the family driver is used for the source files of a \c printf
7125+
* mapping, special care must be taken. In this case the VDS code expands
7126+
* the file name with \c snprintf first, then the family driver second. This
7127+
* means that, while the format specifier for the VDS block number is
7128+
* inserted normally, the format specifier for the family file driver
7129+
* member number must be escaped such that it is only recognized as a
7130+
* format specifier the second time it is run through \c snprintf. As an
7131+
* example one may use \TText{%%06d} as the member file number format
7132+
* specifier in the source file name.
7133+
*
71247134
* \par Source File Resolutions:
71257135
* When a source dataset residing in a different file is accessed, the
71267136
* library will search for the source file \p src_file_name as described
71277137
* below:
7128-
* \li If \p src_file_name is a \TText{"."} (period) then it refers to the
7138+
* \li If \p src_file_name is a \TText{.} (period) then it refers to the
71297139
* file containing the virtual dataset.
71307140
* \li If \p src_file_name is a relative pathname, the following steps are
71317141
* performed:

0 commit comments

Comments
 (0)