Coverage Report

Created: 2026-11-23 00:10

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hdf5/src/H5M.c
Line
Count
Source
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
 * Copyright by The HDF Group.                                               *
3
 * All rights reserved.                                                      *
4
 *                                                                           *
5
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
6
 * terms governing use, modification, and redistribution, is contained in    *
7
 * the LICENSE file, which can be found at the root of the source code       *
8
 * distribution tree, or in https://www.hdfgroup.org/licenses.               *
9
 * If you do not have access to either file, you may request a copy from     *
10
 * help@hdfgroup.org.                                                        *
11
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12
13
/****************/
14
/* Module Setup */
15
/****************/
16
17
#include "H5Mmodule.h" /* This source code file is part of the H5M module */
18
19
/***********/
20
/* Headers */
21
/***********/
22
#include "H5private.h"   /* Generic Functions                        */
23
#include "H5CXprivate.h" /* API Contexts                             */
24
#include "H5Mpkg.h"      /* Maps                                     */
25
#include "H5Eprivate.h"  /* Error handling                           */
26
#include "H5ESprivate.h" /* Event Sets                               */
27
#include "H5Iprivate.h"  /* IDs                                      */
28
#include "H5VLprivate.h" /* Virtual Object Layer                     */
29
30
/****************/
31
/* Local Macros */
32
/****************/
33
34
/******************/
35
/* Local Typedefs */
36
/******************/
37
38
/********************/
39
/* Local Prototypes */
40
/********************/
41
static herr_t H5M__close_cb(void *map_vol_obj, void **request);
42
43
#ifdef H5_HAVE_MAP_API
44
static hid_t  H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id,
45
                                     hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id, void **token_ptr,
46
                                     H5VL_object_t **_vol_obj_ptr);
47
static hid_t  H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token_ptr,
48
                                   H5VL_object_t **_vol_obj_ptr);
49
static herr_t H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id,
50
                                  const void *value, hid_t dxpl_id, void **token_ptr,
51
                                  H5VL_object_t **_vol_obj_ptr);
52
static herr_t H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id,
53
                                  void *value, hid_t dxpl_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr);
54
#endif /*  H5_HAVE_MAP_API */
55
56
/*********************/
57
/* Package Variables */
58
/*********************/
59
60
/* Package initialization variable */
61
bool H5_PKG_INIT_VAR = false;
62
63
/*****************************/
64
/* Library Private Variables */
65
/*****************************/
66
67
/*******************/
68
/* Local Variables */
69
/*******************/
70
71
/* Map ID class */
72
static const H5I_class_t H5I_MAP_CLS[1] = {{
73
    H5I_MAP,      /* ID class value */
74
    0,            /* Class flags */
75
    0,            /* # of reserved IDs for class */
76
    H5M__close_cb /* Callback routine for closing objects of this class */
77
}};
78
79
/* Flag indicating "top" of interface has been initialized */
80
static bool H5M_top_package_initialize_s = false;
81
82
/*-------------------------------------------------------------------------
83
 * Function: H5M_init
84
 *
85
 * Purpose:  Initialize the interface from some other layer.
86
 *
87
 * Return:   Success:    non-negative
88
 *
89
 *           Failure:    negative
90
 *-------------------------------------------------------------------------
91
 */
92
herr_t
93
H5M_init(void)
94
6
{
95
6
    herr_t ret_value = SUCCEED; /* Return value */
96
97
6
    FUNC_ENTER_NOAPI(FAIL)
98
    /* FUNC_ENTER() does all the work */
99
100
6
done:
101
6
    FUNC_LEAVE_NOAPI(ret_value)
102
6
} /* end H5M_init() */
103
104
/*-------------------------------------------------------------------------
105
NAME
106
    H5M__init_package -- Initialize interface-specific information
107
USAGE
108
    herr_t H5M__init_package()
109
RETURNS
110
    Non-negative on success/Negative on failure
111
DESCRIPTION
112
    Initializes any interface-specific data or routines.
113
---------------------------------------------------------------------------
114
*/
115
herr_t
116
H5M__init_package(void)
117
6
{
118
6
    herr_t ret_value = SUCCEED; /* Return value */
119
120
6
    FUNC_ENTER_PACKAGE
121
122
    /* Initialize the ID group for the map IDs */
123
6
    if (H5I_register_type(H5I_MAP_CLS) < 0)
124
0
        HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, FAIL, "unable to initialize interface");
125
126
    /* Mark "top" of interface as initialized, too */
127
6
    H5M_top_package_initialize_s = true;
128
129
6
done:
130
6
    FUNC_LEAVE_NOAPI(ret_value)
131
6
} /* end H5M__init_package() */
132
133
/*-------------------------------------------------------------------------
134
 * Function: H5M_top_term_package
135
 *
136
 * Purpose:  Close the "top" of the interface, releasing IDs, etc.
137
 *
138
 * Return:   Success:    Positive if anything was done that might
139
 *                affect other interfaces; zero otherwise.
140
 *           Failure:    Negative.
141
 *-------------------------------------------------------------------------
142
 */
143
int
144
H5M_top_term_package(void)
145
54
{
146
54
    int n = 0;
147
148
54
    FUNC_ENTER_NOAPI_NOINIT_NOERR
149
150
24
    if (H5M_top_package_initialize_s) {
151
6
        if (H5I_nmembers(H5I_MAP) > 0) {
152
0
            (void)H5I_clear_type(H5I_MAP, false, false);
153
0
            n++;
154
0
        }
155
156
        /* Mark closed */
157
6
        if (0 == n)
158
6
            H5M_top_package_initialize_s = false;
159
6
    } /* end if */
160
161
24
    FUNC_LEAVE_NOAPI(n)
162
54
} /* end H5M_top_term_package() */
163
164
/*-------------------------------------------------------------------------
165
 * Function: H5M_term_package
166
 *
167
 * Purpose:  Terminate this interface.
168
 *
169
 * Note:     Finishes shutting down the interface, after
170
 *           H5M_top_term_package() is called
171
 *
172
 * Return:   Success:    Positive if anything was done that might
173
 *                affect other interfaces; zero otherwise.
174
 *            Failure:    Negative.
175
 *-------------------------------------------------------------------------
176
 */
177
int
178
H5M_term_package(void)
179
36
{
180
36
    int n = 0;
181
182
36
    FUNC_ENTER_NOAPI_NOINIT_NOERR
183
184
6
    if (H5_PKG_INIT_VAR) {
185
        /* Sanity checks */
186
6
        assert(0 == H5I_nmembers(H5I_MAP));
187
6
        assert(false == H5M_top_package_initialize_s);
188
189
        /* Destroy the dataset object id group */
190
6
        n += (H5I_dec_type_ref(H5I_MAP) > 0);
191
192
        /* Mark closed */
193
6
        if (0 == n)
194
6
            H5_PKG_INIT_VAR = false;
195
6
    } /* end if */
196
197
6
    FUNC_LEAVE_NOAPI(n)
198
36
} /* end H5M_term_package() */
199
200
/*-------------------------------------------------------------------------
201
 * Function:    H5M__close_cb
202
 *
203
 * Purpose:     Called when the ref count reaches zero on the map's ID
204
 *
205
 * Return:      SUCCEED/FAIL
206
 *
207
 *-------------------------------------------------------------------------
208
 */
209
static herr_t
210
H5M__close_cb(void *map_vol_obj, void **request)
211
0
{
212
0
    H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
213
0
    H5VL_object_t       *map_vol_obj_p = (H5VL_object_t *)map_vol_obj;
214
0
    herr_t               ret_value     = SUCCEED; /* Return value */
215
216
0
    FUNC_ENTER_PACKAGE
217
218
    /* Sanity check */
219
0
    assert(map_vol_obj_p);
220
221
    /* Set up VOL callback arguments */
222
0
    vol_cb_args.op_type = H5VL_MAP_CLOSE;
223
0
    vol_cb_args.args    = NULL;
224
225
    /* Close the map */
226
0
    if (H5VL_optional(map_vol_obj_p, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, request) < 0)
227
0
        HGOTO_ERROR(H5E_MAP, H5E_CLOSEERROR, FAIL, "unable to close map");
228
229
    /* Free the VOL object */
230
0
    if (H5VL_free_object(map_vol_obj_p) < 0)
231
0
        HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "unable to free VOL object");
232
233
0
done:
234
0
    FUNC_LEAVE_NOAPI(ret_value)
235
0
} /* end H5M__close_cb() */
236
237
#ifdef H5_HAVE_MAP_API
238
239
/*-------------------------------------------------------------------------
240
 * Function:    H5M__create_api_common
241
 *
242
 * Purpose:     This is the common function for creating the HDF5 map.
243
 *
244
 * Return:      Success:    The object ID of the new map.
245
 *
246
 *              Failure:    H5I_INVALID_HID
247
 *
248
 *-------------------------------------------------------------------------
249
 */
250
static hid_t
251
H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id,
252
                       hid_t mcpl_id, hid_t mapl_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr)
253
{
254
    void           *map         = NULL; /* New map's info */
255
    H5VL_object_t  *tmp_vol_obj = NULL; /* Object for loc_id */
256
    H5VL_object_t **vol_obj_ptr =
257
        (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
258
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
259
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
260
    hid_t                ret_value = H5I_INVALID_HID; /* Return value */
261
262
    FUNC_ENTER_PACKAGE
263
264
    /* Check arguments */
265
    if (!name)
266
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL");
267
    if (!*name)
268
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string");
269
270
    /* Get link creation property list */
271
    if (H5P_DEFAULT == lcpl_id)
272
        lcpl_id = H5P_LINK_CREATE_DEFAULT;
273
    else if (true != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))
274
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list");
275
276
    /* Get map creation property list */
277
    if (H5P_DEFAULT == mcpl_id)
278
        mcpl_id = H5P_MAP_CREATE_DEFAULT;
279
    else if (true != H5P_isa_class(mcpl_id, H5P_MAP_CREATE))
280
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "mcpl_id is not a map create property list ID");
281
282
    /* Set up VOL callback arguments */
283
    if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, true, &mapl_id, vol_obj_ptr, &map_args.create.loc_params) <
284
        0)
285
        HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments");
286
    map_args.create.name        = name;
287
    map_args.create.lcpl_id     = lcpl_id;
288
    map_args.create.key_type_id = key_type_id;
289
    map_args.create.val_type_id = val_type_id;
290
    map_args.create.mcpl_id     = mcpl_id;
291
    map_args.create.mapl_id     = mapl_id;
292
    map_args.create.map         = NULL;
293
    vol_cb_args.op_type         = H5VL_MAP_CREATE;
294
    vol_cb_args.args            = &map_args;
295
296
    /* Create the map */
297
    if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
298
        HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map");
299
    map = map_args.create.map;
300
301
    /* Get an ID for the map */
302
    if ((ret_value = H5VL_register(H5I_MAP, map, H5VL_OBJ_CONNECTOR(*vol_obj_ptr), true)) < 0)
303
        HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map handle");
304
305
done:
306
    /* Cleanup on failure */
307
    if (H5I_INVALID_HID == ret_value) {
308
        /* Set up VOL callback arguments */
309
        vol_cb_args.op_type = H5VL_MAP_CLOSE;
310
        vol_cb_args.args    = NULL;
311
312
        if (map && H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
313
            HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map");
314
    } /* end if */
315
316
    FUNC_LEAVE_NOAPI(ret_value)
317
} /* end H5M__create_api_common() */
318
319
/*-------------------------------------------------------------------------
320
 * Function:    H5Mcreate
321
 *
322
 * Purpose:     Creates a new map object for storing key-value pairs.  The
323
 *              in-file datatype for keys is defined by KEY_TYPE_ID and
324
 *              the in-file datatype for values is defined by VAL_TYPE_ID.
325
 *              LOC_ID specifies the location to create the map object and
326
 *              NAME specifies the name of the link to the object
327
 *              (relative to LOC_ID).  Other options can be specified
328
 *              through the property lists LCPL_ID, MCPL_ID, and MAPL_ID.
329
 *
330
 * Return:      Success:    The object ID of the new map.
331
 *
332
 *              Failure:    H5I_INVALID_HID
333
 *
334
 *-------------------------------------------------------------------------
335
 */
336
hid_t
337
H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id,
338
          hid_t mapl_id)
339
{
340
    hid_t ret_value = H5I_INVALID_HID; /* Return value */
341
342
    FUNC_ENTER_API(H5I_INVALID_HID)
343
344
    /* Create the map synchronously */
345
    if ((ret_value = H5M__create_api_common(loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id,
346
                                            NULL, NULL)) < 0)
347
        HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create map synchronously");
348
349
done:
350
    FUNC_LEAVE_API(ret_value)
351
} /* end H5Mcreate() */
352
353
/*-------------------------------------------------------------------------
354
 * Function:    H5Mcreate_async
355
 *
356
 * Purpose:     Asynchronous version of H5Mcreate
357
 *
358
 * Return:      Success:    The object ID of the new map.
359
 *
360
 *              Failure:    H5I_INVALID_HID
361
 *
362
 *-------------------------------------------------------------------------
363
 */
364
hid_t
365
H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name,
366
                hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id,
367
                hid_t es_id)
368
{
369
    H5VL_object_t *vol_obj   = NULL;            /* Object for loc_id */
370
    void          *token     = NULL;            /* Request token for async operation        */
371
    void         **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation        */
372
    hid_t          ret_value = H5I_INVALID_HID; /* Return value */
373
374
    FUNC_ENTER_API(H5I_INVALID_HID)
375
376
    /* Set up request token pointer for asynchronous operation */
377
    if (H5ES_NONE != es_id)
378
        token_ptr = &token;
379
380
    /* Create the map asynchronously */
381
    if ((ret_value = H5M__create_api_common(loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id,
382
                                            token_ptr, &vol_obj)) < 0)
383
        HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create map asynchronously");
384
385
    /* If a token was created, add the token to the event set */
386
    if (NULL != token)
387
        /* clang-format off */
388
        if (H5ES_insert(es_id, H5VL_OBJ_CONNECTOR(vol_obj), token,
389
                        H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, es_id)) < 0) {
390
            /* clang-format on */
391
            if (H5I_dec_app_ref_always_close(ret_value) < 0)
392
                HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID");
393
            HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set");
394
        } /* end if */
395
396
done:
397
    FUNC_LEAVE_API(ret_value)
398
} /* end H5Mcreate_async() */
399
400
/*-------------------------------------------------------------------------
401
 * Function:    H5Mcreate_anon
402
 *
403
 * Purpose:     Creates a new map object for storing key-value pairs.  The
404
 *              in-file datatype for keys is defined by KEY_TYPE_ID and
405
 *              the in-file datatype for values is defined by VAL_TYPE_ID.
406
 *              LOC_ID specifies the file to create the map object, but no
407
 *              link to the object is created.  Other options can be
408
 *              specified through the property lists MCPL_ID and MAPL_ID.
409
 *
410
 *              The resulting ID should be linked into the file with
411
 *              H5Olink or it will be deleted when closed.
412
 *
413
 * Return:      Success:    The object ID of the new map. The map should
414
 *                          be linked into the group hierarchy before being closed or
415
 *                          it will be deleted. The dataset should be
416
 *                          closed when the caller is no longer interested
417
 *                          in it.
418
 *
419
 *              Failure:    H5I_INVALID_HID
420
 *
421
 *-------------------------------------------------------------------------
422
 */
423
hid_t
424
H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id, hid_t mapl_id)
425
{
426
    void                *map     = NULL;              /* map object from VOL connector */
427
    H5VL_object_t       *vol_obj = NULL;              /* object of loc_id */
428
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
429
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
430
    hid_t                ret_value = H5I_INVALID_HID; /* Return value */
431
432
    FUNC_ENTER_API(H5I_INVALID_HID)
433
434
    /* Check arguments */
435
    if (H5P_DEFAULT == mcpl_id)
436
        mcpl_id = H5P_MAP_CREATE_DEFAULT;
437
    else if (true != H5P_isa_class(mcpl_id, H5P_MAP_CREATE))
438
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not map create property list ID");
439
440
    /* Verify access property list and set up collective metadata if appropriate */
441
    if (H5CX_set_apl(&mapl_id, H5P_CLS_MACC, loc_id, true) < 0)
442
        HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info");
443
444
    /* get the location object */
445
    if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
446
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier");
447
448
    /* Set location parameters */
449
450
    /* Set up VOL callback arguments */
451
    map_args.create.loc_params.type     = H5VL_OBJECT_BY_SELF;
452
    map_args.create.loc_params.obj_type = H5I_get_type(loc_id);
453
    map_args.create.name                = NULL;
454
    map_args.create.lcpl_id             = H5P_LINK_CREATE_DEFAULT;
455
    map_args.create.key_type_id         = key_type_id;
456
    map_args.create.val_type_id         = val_type_id;
457
    map_args.create.mcpl_id             = mcpl_id;
458
    map_args.create.mapl_id             = mapl_id;
459
    map_args.create.map                 = NULL;
460
    vol_cb_args.op_type                 = H5VL_MAP_CREATE;
461
    vol_cb_args.args                    = &map_args;
462
463
    /* Create the map */
464
    if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
465
        HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map");
466
    map = map_args.create.map;
467
468
    /* Get an ID for the map */
469
    if ((ret_value = H5VL_register(H5I_MAP, map, H5VL_OBJ_CONNECTOR(vol_obj), true)) < 0)
470
        HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map");
471
472
done:
473
    /* Cleanup on failure */
474
    if (H5I_INVALID_HID == ret_value) {
475
        /* Set up VOL callback arguments */
476
        vol_cb_args.op_type = H5VL_MAP_CLOSE;
477
        vol_cb_args.args    = NULL;
478
479
        if (map && H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
480
            HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map");
481
    } /* end if */
482
483
    FUNC_LEAVE_API(ret_value)
484
} /* end H5Mcreate_anon() */
485
486
/*------------------------------------------------------------------------
487
 * Function:    H5M__open_api_common
488
 *
489
 * Purpose:     This is the common function for opening the HDF5 map.
490
 *
491
 * Return:      Success:    Object ID of the map
492
 *
493
 *              Failure:    H5I_INVALID_HID
494
 *
495
 *-------------------------------------------------------------------------
496
 */
497
static hid_t
498
H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token_ptr,
499
                     H5VL_object_t **_vol_obj_ptr)
500
{
501
    void           *map         = NULL; /* map object from VOL connector */
502
    H5VL_object_t  *tmp_vol_obj = NULL; /* Object for loc_id */
503
    H5VL_object_t **vol_obj_ptr =
504
        (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
505
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
506
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
507
    hid_t                ret_value = H5I_INVALID_HID; /* Return value */
508
509
    FUNC_ENTER_PACKAGE
510
511
    /* Check args */
512
    if (!name)
513
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL");
514
    if (!*name)
515
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string");
516
517
    /* Set up VOL callback arguments */
518
    if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, false, &mapl_id, vol_obj_ptr, &map_args.open.loc_params) <
519
        0)
520
        HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments");
521
    map_args.open.name    = name;
522
    map_args.open.mapl_id = mapl_id;
523
    map_args.open.map     = NULL;
524
    vol_cb_args.op_type   = H5VL_MAP_OPEN;
525
    vol_cb_args.args      = &map_args;
526
527
    /* Open the map */
528
    if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
529
        HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map");
530
    map = map_args.open.map;
531
532
    /* Register an ID for the map */
533
    if ((ret_value = H5VL_register(H5I_MAP, map, H5VL_OBJ_CONNECTOR(*vol_obj_ptr), true)) < 0)
534
        HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register map ID");
535
536
done:
537
    /* Cleanup on failure */
538
    if (H5I_INVALID_HID == ret_value) {
539
        /* Set up VOL callback arguments */
540
        vol_cb_args.op_type = H5VL_MAP_CLOSE;
541
        vol_cb_args.args    = NULL;
542
543
        if (map && H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
544
            HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map");
545
    } /* end if */
546
547
    FUNC_LEAVE_NOAPI(ret_value)
548
} /* end H5M__open_api_common() */
549
550
/*------------------------------------------------------------------------
551
 * Function:    H5Mopen
552
 *
553
 * Purpose:     Finds a map named NAME at LOC_ID, opens it, and returns
554
 *              its ID. The map should be close when the caller is no
555
 *              longer interested in it.
556
 *
557
 *              Takes a map access property list
558
 *
559
 * Return:      Success:    Object ID of the map
560
 *
561
 *              Failure:    H5I_INVALID_HID
562
 *
563
 *-------------------------------------------------------------------------
564
 */
565
hid_t
566
H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
567
{
568
    hid_t ret_value = H5I_INVALID_HID; /* Return value */
569
570
    FUNC_ENTER_API(H5I_INVALID_HID)
571
572
    /* Open the map synchronously */
573
    if ((ret_value = H5M__open_api_common(loc_id, name, mapl_id, NULL, NULL)) < 0)
574
        HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to open map synchronously");
575
576
done:
577
    FUNC_LEAVE_API(ret_value)
578
} /* end H5Mopen() */
579
580
/*------------------------------------------------------------------------
581
 * Function:    H5Mopen_async
582
 *
583
 * Purpose:     Asynchronous version of H5Mopen
584
 *
585
 * Return:      Success:    Object ID of the map
586
 *
587
 *              Failure:    H5I_INVALID_HID
588
 *
589
 *-------------------------------------------------------------------------
590
 */
591
hid_t
592
H5Mopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name,
593
              hid_t mapl_id, hid_t es_id)
594
{
595
    H5VL_object_t *vol_obj   = NULL;            /* Object for loc_id */
596
    void          *token     = NULL;            /* Request token for async operation        */
597
    void         **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation        */
598
    hid_t          ret_value = H5I_INVALID_HID; /* Return value */
599
600
    FUNC_ENTER_API(H5I_INVALID_HID)
601
602
    /* Set up request token pointer for asynchronous operation */
603
    if (H5ES_NONE != es_id)
604
        token_ptr = &token;
605
606
    /* Open the map asynchronously */
607
    if ((ret_value = H5M__open_api_common(loc_id, name, mapl_id, token_ptr, &vol_obj)) < 0)
608
        HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to open map asynchronously");
609
610
    /* If a token was created, add the token to the event set */
611
    if (NULL != token)
612
        /* clang-format off */
613
        if (H5ES_insert(es_id, H5VL_OBJ_CONNECTOR(vol_obj), token,
614
                        H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, mapl_id, es_id)) < 0) {
615
            /* clang-format on */
616
            if (H5I_dec_app_ref_always_close(ret_value) < 0)
617
                HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID");
618
            HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set");
619
        } /* end if */
620
621
done:
622
    FUNC_LEAVE_API(ret_value)
623
} /* end H5Mopen_async() */
624
625
/*-------------------------------------------------------------------------
626
 * Function:    H5Mclose
627
 *
628
 * Purpose:     Closes access to a map and releases resources used by it.
629
 *              It is illegal to subsequently use that same map ID in
630
 *              calls to other map functions.
631
 *
632
 * Return:      SUCCEED/FAIL
633
 *
634
 *-------------------------------------------------------------------------
635
 */
636
herr_t
637
H5Mclose(hid_t map_id)
638
{
639
    herr_t ret_value = SUCCEED; /* Return value                     */
640
641
    FUNC_ENTER_API(FAIL)
642
643
    /* Check args */
644
    if (H5I_MAP != H5I_get_type(map_id))
645
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a map ID");
646
647
    /* Decrement the counter on the map.  It will be freed if the count
648
     * reaches zero.
649
     */
650
    if (H5I_dec_app_ref_always_close(map_id) < 0)
651
        HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement count on map ID");
652
653
done:
654
    FUNC_LEAVE_API(ret_value)
655
} /* end H5Mclose() */
656
657
/*-------------------------------------------------------------------------
658
 * Function:    H5Mclose_async
659
 *
660
 * Purpose:     Asynchronous version of H5Mclose
661
 *
662
 * Return:      SUCCEED/FAIL
663
 *
664
 *-------------------------------------------------------------------------
665
 */
666
herr_t
667
H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id, hid_t es_id)
668
{
669
    void             *token     = NULL;            /* Request token for async operation            */
670
    void            **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
671
    H5VL_object_t    *vol_obj   = NULL;            /* VOL object of dset_id */
672
    H5VL_connector_t *connector = NULL;            /* VOL connector */
673
    herr_t            ret_value = SUCCEED;         /* Return value */
674
675
    FUNC_ENTER_API(FAIL)
676
677
    /* Check args */
678
    if (H5I_MAP != H5I_get_type(map_id))
679
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a map ID");
680
681
    /* Get map object's connector */
682
    if (NULL == (vol_obj = H5VL_vol_object(map_id)))
683
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "can't get VOL object for map");
684
685
    /* Prepare for possible asynchronous operation */
686
    if (H5ES_NONE != es_id) {
687
        /* Increase connector's refcount, so it doesn't get closed if closing
688
         * the dataset closes the file */
689
        connector = H5VL_OBJ_CONNECTOR(vol_obj);
690
        H5VL_conn_inc_rc(connector);
691
692
        /* Point at token for operation to set up */
693
        token_ptr = &token;
694
    } /* end if */
695
696
    /* Decrement the counter on the map.  It will be freed if the count
697
     * reaches zero.
698
     */
699
    if (H5I_dec_app_ref_always_close_async(map_id, token_ptr) < 0)
700
        HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID");
701
702
    /* If a token was created, add the token to the event set */
703
    if (NULL != token)
704
        /* clang-format off */
705
        if (H5ES_insert(es_id, H5VL_OBJ_CONNECTOR(vol_obj), token,
706
                        H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, map_id, es_id)) < 0)
707
            /* clang-format on */
708
            HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set");
709
710
done:
711
    if (connector && H5VL_conn_dec_rc(connector) < 0)
712
        HDONE_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement ref count on connector");
713
714
    FUNC_LEAVE_API(ret_value)
715
} /* end H5Mclose_async() */
716
717
/*-------------------------------------------------------------------------
718
 * Function:    H5Mget_key_type
719
 *
720
 * Purpose:     Returns a copy of the key datatype for a map.
721
 *
722
 * Return:      Success:    ID for a copy of the datatype. The data
723
 *                          type should be released by calling
724
 *                          H5Tclose().
725
 *
726
 *              Failure:    H5I_INVALID_HID
727
 *
728
 *-------------------------------------------------------------------------
729
 */
730
hid_t
731
H5Mget_key_type(hid_t map_id)
732
{
733
    H5VL_object_t       *vol_obj;                     /* Map structure    */
734
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
735
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
736
    hid_t                ret_value = H5I_INVALID_HID; /* Return value         */
737
738
    FUNC_ENTER_API(H5I_INVALID_HID)
739
740
    /* Check args */
741
    if (NULL == (vol_obj = H5VL_vol_object_verify(map_id, H5I_MAP)))
742
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier");
743
744
    /* Set up VOL callback arguments */
745
    map_args.get.get_type                  = H5VL_MAP_GET_KEY_TYPE;
746
    map_args.get.args.get_key_type.type_id = H5I_INVALID_HID;
747
    vol_cb_args.op_type                    = H5VL_MAP_GET;
748
    vol_cb_args.args                       = &map_args;
749
750
    /* Get the key datatype */
751
    if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
752
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get key datatype");
753
754
    /* Set return value */
755
    ret_value = map_args.get.args.get_key_type.type_id;
756
757
done:
758
    FUNC_LEAVE_API(ret_value)
759
} /* end H5Mget_key_type() */
760
761
/*-------------------------------------------------------------------------
762
 * Function:    H5Mget_val_type
763
 *
764
 * Purpose:     Returns a copy of the value datatype for a map.
765
 *
766
 * Return:      Success:    ID for a copy of the datatype. The data
767
 *                          type should be released by calling
768
 *                          H5Tclose().
769
 *
770
 *              Failure:    H5I_INVALID_HID
771
 *
772
 *-------------------------------------------------------------------------
773
 */
774
hid_t
775
H5Mget_val_type(hid_t map_id)
776
{
777
    H5VL_object_t       *vol_obj;                     /* Map structure    */
778
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
779
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
780
    hid_t                ret_value = H5I_INVALID_HID; /* Return value         */
781
782
    FUNC_ENTER_API(H5I_INVALID_HID)
783
784
    /* Check args */
785
    if (NULL == (vol_obj = H5VL_vol_object_verify(map_id, H5I_MAP)))
786
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier");
787
788
    /* Set up VOL callback arguments */
789
    map_args.get.get_type                  = H5VL_MAP_GET_VAL_TYPE;
790
    map_args.get.args.get_val_type.type_id = H5I_INVALID_HID;
791
    vol_cb_args.op_type                    = H5VL_MAP_GET;
792
    vol_cb_args.args                       = &map_args;
793
794
    /* Get the value datatype */
795
    if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
796
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get value datatype");
797
798
    /* Set return value */
799
    ret_value = map_args.get.args.get_val_type.type_id;
800
801
done:
802
    FUNC_LEAVE_API(ret_value)
803
} /* end H5Mget_val_type() */
804
805
/*-------------------------------------------------------------------------
806
 * Function:    H5Mget_create_plist
807
 *
808
 * Purpose:     Returns a copy of the map creation property list.
809
 *
810
 * Return:      Success:    ID for a copy of the map creation
811
 *                          property list.  The template should be
812
 *                          released by calling H5P_close().
813
 *
814
 *              Failure:    H5I_INVALID_HID
815
 *
816
 *-------------------------------------------------------------------------
817
 */
818
hid_t
819
H5Mget_create_plist(hid_t map_id)
820
{
821
    H5VL_object_t       *vol_obj;                     /* Map structure    */
822
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
823
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
824
    hid_t                ret_value = H5I_INVALID_HID; /* Return value         */
825
826
    FUNC_ENTER_API(H5I_INVALID_HID)
827
828
    /* Check args */
829
    if (NULL == (vol_obj = H5VL_vol_object_verify(map_id, H5I_MAP)))
830
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier");
831
832
    /* Set up VOL callback arguments */
833
    map_args.get.get_type              = H5VL_MAP_GET_MCPL;
834
    map_args.get.args.get_mcpl.mcpl_id = H5I_INVALID_HID;
835
    vol_cb_args.op_type                = H5VL_MAP_GET;
836
    vol_cb_args.args                   = &map_args;
837
838
    /* Get the map creation property list */
839
    if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
840
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties");
841
842
    /* Set return value */
843
    ret_value = map_args.get.args.get_mcpl.mcpl_id;
844
845
done:
846
    FUNC_LEAVE_API(ret_value)
847
} /* end H5Mget_create_plist() */
848
849
/*-------------------------------------------------------------------------
850
 * Function:    H5Mget_access_plist
851
 *
852
 * Purpose:     Returns a copy of the map access property list.
853
 *
854
 * Description: H5Mget_access_plist returns the map access property
855
 *              list identifier of the specified map.
856
 *
857
 * Return:      Success:    ID for a copy of the map access
858
 *                          property list.  The template should be
859
 *                          released by calling H5Pclose().
860
 *
861
 *              Failure:    H5I_INVALID_HID
862
 *
863
 *-------------------------------------------------------------------------
864
 */
865
hid_t
866
H5Mget_access_plist(hid_t map_id)
867
{
868
    H5VL_object_t       *vol_obj;                     /* Map structure    */
869
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
870
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
871
    hid_t                ret_value = H5I_INVALID_HID; /* Return value         */
872
873
    FUNC_ENTER_API(H5I_INVALID_HID)
874
875
    /* Check args */
876
    if (NULL == (vol_obj = H5VL_vol_object_verify(map_id, H5I_MAP)))
877
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier");
878
879
    /* Set up VOL callback arguments */
880
    map_args.get.get_type              = H5VL_MAP_GET_MAPL;
881
    map_args.get.args.get_mapl.mapl_id = H5I_INVALID_HID;
882
    vol_cb_args.op_type                = H5VL_MAP_GET;
883
    vol_cb_args.args                   = &map_args;
884
885
    /* Get the map access property list */
886
    if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
887
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties");
888
889
    /* Set return value */
890
    ret_value = map_args.get.args.get_mapl.mapl_id;
891
892
done:
893
    FUNC_LEAVE_API(ret_value)
894
} /* end H5Mget_access_plist() */
895
896
/*-------------------------------------------------------------------------
897
 * Function:    H5Mget_count
898
 *
899
 * Purpose:     Returns the number of key-value pairs stored in the map.
900
 *
901
 * Description: H5Mget_count returns the number of key-value pairs stored
902
 *              in the specified map.
903
 *
904
 * Return:      SUCCEED/FAIL
905
 *
906
 *-------------------------------------------------------------------------
907
 */
908
herr_t
909
H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id)
910
{
911
    H5VL_object_t       *vol_obj;             /* Map structure    */
912
    H5VL_optional_args_t vol_cb_args;         /* Arguments to VOL callback */
913
    H5VL_map_args_t      map_args;            /* Arguments for map operations */
914
    herr_t               ret_value = SUCCEED; /* Return value         */
915
916
    FUNC_ENTER_API(H5I_INVALID_HID)
917
918
    /* Check args */
919
    if (NULL == (vol_obj = H5VL_vol_object_verify(map_id, H5I_MAP)))
920
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier");
921
922
    /* Get the default dataset transfer property list if the user didn't provide one */
923
    if (H5P_DEFAULT == dxpl_id)
924
        dxpl_id = H5P_DATASET_XFER_DEFAULT;
925
    else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
926
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
927
928
    /* Set up VOL callback arguments */
929
    map_args.get.get_type             = H5VL_MAP_GET_COUNT;
930
    map_args.get.args.get_count.count = 0;
931
    vol_cb_args.op_type               = H5VL_MAP_GET;
932
    vol_cb_args.args                  = &map_args;
933
934
    /* Get the number of key-value pairs stored in the map */
935
    if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
936
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get KV pair count for map");
937
938
    /* Set value to return */
939
    if (count)
940
        *count = map_args.get.args.get_count.count;
941
942
done:
943
    FUNC_LEAVE_API(ret_value)
944
} /* end H5Mget_count() */
945
946
/*-------------------------------------------------------------------------
947
 * Function:    H5M__put_api_common
948
 *
949
 * Purpose:     This is the common function for putting value to map.
950
 *
951
 * Return:      SUCCEED/FAIL
952
 *
953
 *-------------------------------------------------------------------------
954
 */
955
static herr_t
956
H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id,
957
                    const void *value, hid_t dxpl_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr)
958
{
959
    H5VL_object_t  *tmp_vol_obj = NULL; /* Object for loc_id */
960
    H5VL_object_t **vol_obj_ptr =
961
        (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
962
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
963
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
964
    herr_t               ret_value = SUCCEED;         /* Return value */
965
966
    FUNC_ENTER_PACKAGE
967
968
    /* Check arguments */
969
    if (key_mem_type_id < 0)
970
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID");
971
    if (val_mem_type_id < 0)
972
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID");
973
974
    /* Get map pointer */
975
    if (NULL == (*vol_obj_ptr = H5VL_vol_object_verify(map_id, H5I_MAP)))
976
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID");
977
978
    /* Get the default dataset transfer property list if the user didn't provide one */
979
    if (H5P_DEFAULT == dxpl_id)
980
        dxpl_id = H5P_DATASET_XFER_DEFAULT;
981
    else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
982
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
983
984
    /* Set up VOL callback arguments */
985
    map_args.put.key_mem_type_id   = key_mem_type_id;
986
    map_args.put.key               = key;
987
    map_args.put.value_mem_type_id = val_mem_type_id;
988
    map_args.put.value             = value;
989
    vol_cb_args.op_type            = H5VL_MAP_PUT;
990
    vol_cb_args.args               = &map_args;
991
992
    /* Set the key/value pair */
993
    if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, dxpl_id, token_ptr) < 0)
994
        HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair");
995
996
done:
997
    FUNC_LEAVE_NOAPI(ret_value)
998
} /* end H5M__put_api_common() */
999
1000
/*-------------------------------------------------------------------------
1001
 * Function:    H5Mput
1002
 *
1003
 * Purpose:     H5Mput adds a key-value pair to the Map specified by
1004
 *              MAP_ID, or updates the value for the specified key if one
1005
 *              was set previously. KEY_MEM_TYPE_ID and VAL_MEM_TYPE_ID
1006
 *              specify the datatypes for the provided KEY and VALUE
1007
 *              buffers, and if different from those used to create the
1008
 *              map object, the key and value will be internally converted
1009
 *              to the datatypes for the map object. Any further options
1010
 *              can be specified through the property list DXPL_ID.
1011
 *
1012
 * Return:      SUCCEED/FAIL
1013
 *
1014
 *-------------------------------------------------------------------------
1015
 */
1016
herr_t
1017
H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, const void *value,
1018
       hid_t dxpl_id)
1019
{
1020
    herr_t ret_value = SUCCEED; /* Return value */
1021
1022
    FUNC_ENTER_API(FAIL)
1023
1024
    /* Add key-value pair to the map synchronously */
1025
    if ((ret_value = H5M__put_api_common(map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, NULL,
1026
                                         NULL)) < 0)
1027
        HGOTO_ERROR(H5E_MAP, H5E_CANTPUT, FAIL, "unable to put value to map synchronously");
1028
1029
done:
1030
    FUNC_LEAVE_API(ret_value)
1031
} /* end H5Mput() */
1032
1033
/*-------------------------------------------------------------------------
1034
 * Function:    H5Mput_async
1035
 *
1036
 * Purpose:     Asynchronous version of H5Mput
1037
 *
1038
 * Return:      SUCCEED/FAIL
1039
 *
1040
 *-------------------------------------------------------------------------
1041
 */
1042
herr_t
1043
H5Mput_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id,
1044
             hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, const void *value, hid_t dxpl_id,
1045
             hid_t es_id)
1046
{
1047
    H5VL_object_t *vol_obj   = NULL;            /* Object for loc_id */
1048
    void          *token     = NULL;            /* Request token for async operation        */
1049
    void         **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation        */
1050
    herr_t         ret_value = SUCCEED;         /* Return value */
1051
1052
    FUNC_ENTER_API(FAIL)
1053
1054
    /* Set up request token pointer for asynchronous operation */
1055
    if (H5ES_NONE != es_id)
1056
        token_ptr = &token;
1057
1058
    /* Add key-value pair to the map asynchronously */
1059
    if ((ret_value = H5M__put_api_common(map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id,
1060
                                         token_ptr, &vol_obj)) < 0)
1061
        HGOTO_ERROR(H5E_MAP, H5E_CANTPUT, FAIL, "unable to put value to map asynchronously");
1062
1063
    /* If a token was created, add the token to the event set */
1064
    if (NULL != token)
1065
        /* clang-format off */
1066
        if (H5ES_insert(es_id, H5VL_OBJ_CONNECTOR(vol_obj), token,
1067
                        H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0)
1068
            /* clang-format on */
1069
            HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set");
1070
1071
done:
1072
    FUNC_LEAVE_API(ret_value)
1073
} /* end H5Mput_async() */
1074
1075
/*-------------------------------------------------------------------------
1076
 * Function:    H5M__get_api_common
1077
 *
1078
 * Purpose:     This is common function for getting value from the map.
1079
 *
1080
 * Return:      SUCCEED/FAIL
1081
 *
1082
 *-------------------------------------------------------------------------
1083
 */
1084
static herr_t
1085
H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value,
1086
                    hid_t dxpl_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr)
1087
{
1088
    H5VL_object_t  *tmp_vol_obj = NULL; /* Object for loc_id */
1089
    H5VL_object_t **vol_obj_ptr =
1090
        (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
1091
    H5VL_optional_args_t vol_cb_args;                 /* Arguments to VOL callback */
1092
    H5VL_map_args_t      map_args;                    /* Arguments for map operations */
1093
    herr_t               ret_value = SUCCEED;         /* Return value */
1094
1095
    FUNC_ENTER_PACKAGE
1096
1097
    /* Check arguments */
1098
    if (key_mem_type_id < 0)
1099
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID");
1100
    if (val_mem_type_id < 0)
1101
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID");
1102
1103
    /* Get map pointer */
1104
    if (NULL == (*vol_obj_ptr = H5VL_vol_object_verify(map_id, H5I_MAP)))
1105
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID");
1106
1107
    /* Get the default dataset transfer property list if the user didn't provide one */
1108
    if (H5P_DEFAULT == dxpl_id)
1109
        dxpl_id = H5P_DATASET_XFER_DEFAULT;
1110
    else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
1111
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
1112
1113
    /* Set up VOL callback arguments */
1114
    map_args.get_val.key_mem_type_id   = key_mem_type_id;
1115
    map_args.get_val.key               = key;
1116
    map_args.get_val.value_mem_type_id = val_mem_type_id;
1117
    map_args.get_val.value             = value;
1118
    vol_cb_args.op_type                = H5VL_MAP_GET_VAL;
1119
    vol_cb_args.args                   = &map_args;
1120
1121
    /* Get the value for the key */
1122
    if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, dxpl_id, token_ptr) < 0)
1123
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map");
1124
1125
done:
1126
    FUNC_LEAVE_NOAPI(ret_value)
1127
} /* end H5M__get_api_common() */
1128
1129
/*-------------------------------------------------------------------------
1130
 * Function:    H5Mget
1131
 *
1132
 * Purpose:     H5Mget retrieves, from the Map specified by MAP_ID, the
1133
 *              value associated with the provided key.  KEY_MEM_TYPE_ID
1134
 *              and VAL_MEM_TYPE_ID specify the datatypes for the provided
1135
 *              KEY and VALUE buffers. If KEY_MEM_TYPE_ID is different
1136
 *              from that used to create the map object, the key will be
1137
 *              internally converted to the datatype for the map object
1138
 *              for the query, and if VAL_MEM_TYPE_ID is different from
1139
 *              that used to create the map object, the returned value
1140
 *              will be converted to VAL_MEM_TYPE_ID before the function
1141
 *              returns. Any further options can be specified through the
1142
 *              property list DXPL_ID.
1143
 *
1144
 * Return:      SUCCEED/FAIL
1145
 *
1146
 *-------------------------------------------------------------------------
1147
 */
1148
herr_t
1149
H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value,
1150
       hid_t dxpl_id)
1151
{
1152
    herr_t ret_value = SUCCEED; /* Return value */
1153
1154
    FUNC_ENTER_API(FAIL)
1155
1156
    /* Get key-value pair from the map synchronously */
1157
    if ((ret_value = H5M__get_api_common(map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, NULL,
1158
                                         NULL)) < 0)
1159
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map synchronously");
1160
1161
done:
1162
    FUNC_LEAVE_API(ret_value)
1163
} /* end H5Mget() */
1164
1165
/*-------------------------------------------------------------------------
1166
 * Function:    H5Mget_async
1167
 *
1168
 * Purpose:     Asynchronous version of H5Mget
1169
 *
1170
 * Return:      SUCCEED/FAIL
1171
 *
1172
 *-------------------------------------------------------------------------
1173
 */
1174
herr_t
1175
H5Mget_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id,
1176
             hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value, hid_t dxpl_id,
1177
             hid_t es_id)
1178
{
1179
    H5VL_object_t *vol_obj   = NULL;            /* Object for loc_id */
1180
    void          *token     = NULL;            /* Request token for async operation        */
1181
    void         **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation        */
1182
    herr_t         ret_value = SUCCEED;         /* Return value */
1183
1184
    FUNC_ENTER_API(FAIL)
1185
1186
    /* Set up request token pointer for asynchronous operation */
1187
    if (H5ES_NONE != es_id)
1188
        token_ptr = &token;
1189
1190
    /* Get key-value pair from the map asynchronously */
1191
    if ((ret_value = H5M__get_api_common(map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id,
1192
                                         token_ptr, &vol_obj)) < 0)
1193
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map asynchronously");
1194
1195
    /* If a token was created, add the token to the event set */
1196
    if (NULL != token)
1197
        /* clang-format off */
1198
        if (H5ES_insert(es_id, H5VL_OBJ_CONNECTOR(vol_obj), token,
1199
                        H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0)
1200
            /* clang-format on */
1201
            HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set");
1202
1203
done:
1204
    FUNC_LEAVE_API(ret_value)
1205
} /* end H5Mget_async() */
1206
1207
/*-------------------------------------------------------------------------
1208
 * Function:    H5Mexists
1209
 *
1210
 * Purpose:     H5Mexists checks if the provided key is stored in the map
1211
 *              specified by MAP_ID. If KEY_MEM_TYPE_ID is different from
1212
 *              that used to create the map object the key will be
1213
 *              internally converted to the datatype for the map object
1214
 *              for the query.
1215
 *
1216
 * Return:      SUCCEED/FAIL
1217
 *
1218
 *-------------------------------------------------------------------------
1219
 */
1220
herr_t
1221
H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, bool *exists, hid_t dxpl_id)
1222
{
1223
    H5VL_object_t       *vol_obj = NULL;
1224
    H5VL_optional_args_t vol_cb_args;         /* Arguments to VOL callback */
1225
    H5VL_map_args_t      map_args;            /* Arguments for map operations */
1226
    herr_t               ret_value = SUCCEED; /* Return value */
1227
1228
    FUNC_ENTER_API(FAIL)
1229
1230
    /* Check arguments */
1231
    if (key_mem_type_id < 0)
1232
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID");
1233
1234
    /* Get map pointer */
1235
    if (NULL == (vol_obj = H5VL_vol_object_verify(map_id, H5I_MAP)))
1236
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID");
1237
1238
    /* Get the default dataset transfer property list if the user didn't provide one */
1239
    if (H5P_DEFAULT == dxpl_id)
1240
        dxpl_id = H5P_DATASET_XFER_DEFAULT;
1241
    else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
1242
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
1243
1244
    /* Set up VOL callback arguments */
1245
    map_args.exists.key_mem_type_id = key_mem_type_id;
1246
    map_args.exists.key             = key;
1247
    map_args.exists.exists          = false;
1248
    vol_cb_args.op_type             = H5VL_MAP_EXISTS;
1249
    vol_cb_args.args                = &map_args;
1250
1251
    /* Check if key exists */
1252
    if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
1253
        HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists");
1254
1255
    /* Set value to return */
1256
    if (exists)
1257
        *exists = map_args.exists.exists;
1258
1259
done:
1260
    FUNC_LEAVE_API(ret_value)
1261
} /* end H5Mexists() */
1262
1263
/*-------------------------------------------------------------------------
1264
 * Function:    H5Miterate
1265
 *
1266
 * Purpose:     H5Miterate iterates over all key-value pairs stored in the
1267
 *              map specified by MAP_ID, making the callback specified by
1268
 *              OP for each. The IDX parameter is an in/out parameter that
1269
 *              may be used to restart a previously interrupted iteration.
1270
 *              At the start of iteration IDX should be set to 0, and to
1271
 *              restart iteration at the same location on a subsequent
1272
 *              call to H5Miterate, IDX should be the same value as
1273
 *              returned by the previous call.
1274
 *
1275
 *              H5M_iterate_t is defined as:
1276
 *              herr_t (*H5M_iterate_t)(hid_t map_id, const void *key,
1277
 *                      void *ctx)
1278
 *
1279
 *              The KEY parameter is the buffer for the key for this
1280
 *              iteration, converted to the datatype specified by
1281
 *              KEY_MEM_TYPE_ID. The OP_DATA parameter is a simple pass
1282
 *              through of the value passed to H5Miterate, which can be
1283
 *              used to store application-defined data for iteration. A
1284
 *              negative return value from this function will cause
1285
 *              H5Miterate to issue an error, while a positive return
1286
 *              value will cause H5Miterate to stop iterating and return
1287
 *              this value without issuing an error. A return value of
1288
 *              zero allows iteration to continue.
1289
 *
1290
 * Return:      Last value returned by op
1291
 *
1292
 *-------------------------------------------------------------------------
1293
 */
1294
herr_t
1295
H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, hid_t dxpl_id)
1296
{
1297
    H5VL_object_t       *vol_obj = NULL;
1298
    H5VL_optional_args_t vol_cb_args;         /* Arguments to VOL callback */
1299
    H5VL_map_args_t      map_args;            /* Arguments for map operations */
1300
    herr_t               ret_value = SUCCEED; /* Return value */
1301
1302
    FUNC_ENTER_API(FAIL)
1303
1304
    /* Check arguments */
1305
    if (key_mem_type_id < 0)
1306
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID");
1307
    if (!op)
1308
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified");
1309
1310
    /* Get map pointer */
1311
    if (NULL == (vol_obj = H5VL_vol_object_verify(map_id, H5I_MAP)))
1312
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID");
1313
1314
    /* Get the default dataset transfer property list if the user didn't provide one */
1315
    if (H5P_DEFAULT == dxpl_id)
1316
        dxpl_id = H5P_DATASET_XFER_DEFAULT;
1317
    else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
1318
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
1319
1320
    /* Set up VOL callback arguments */
1321
    map_args.specific.specific_type                    = H5VL_MAP_ITER;
1322
    map_args.specific.args.iterate.loc_params.type     = H5VL_OBJECT_BY_SELF;
1323
    map_args.specific.args.iterate.loc_params.obj_type = H5I_get_type(map_id);
1324
    map_args.specific.args.iterate.idx                 = (idx ? *idx : 0);
1325
    map_args.specific.args.iterate.key_mem_type_id     = key_mem_type_id;
1326
    map_args.specific.args.iterate.op                  = op;
1327
    map_args.specific.args.iterate.op_data             = op_data;
1328
    vol_cb_args.op_type                                = H5VL_MAP_SPECIFIC;
1329
    vol_cb_args.args                                   = &map_args;
1330
1331
    /* Iterate over keys */
1332
    if ((ret_value = H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0)
1333
        HERROR(H5E_MAP, H5E_BADITER, "unable to iterate over keys");
1334
1335
    /* Set value to return */
1336
    if (idx)
1337
        *idx = map_args.specific.args.iterate.idx;
1338
1339
done:
1340
    FUNC_LEAVE_API(ret_value)
1341
} /* end H5Miterate() */
1342
1343
/*-------------------------------------------------------------------------
1344
 * Function:    H5Miterate_by_name
1345
 *
1346
 * Purpose:     H5Miterate_by_name iterates over all key-value pairs
1347
 *              stored in the map specified by MAP_ID, making the callback
1348
 *              specified by OP for each. The IDX parameter is an in/out
1349
 *              parameter that may be used to restart a previously
1350
 *              interrupted iteration.  At the start of iteration IDX
1351
 *              should be set to 0, and to restart iteration at the same
1352
 *              location on a subsequent call to H5Miterate, IDX should be
1353
 *              the same value as returned by the previous call.
1354
 *
1355
 *              H5M_iterate_t is defined as:
1356
 *              herr_t (*H5M_iterate_t)(hid_t map_id, const void *key,
1357
 *                      void *ctx)
1358
 *
1359
 *              The KEY parameter is the buffer for the key for this
1360
 *              iteration, converted to the datatype specified by
1361
 *              KEY_MEM_TYPE_ID. The OP_DATA parameter is a simple pass
1362
 *              through of the value passed to H5Miterate, which can be
1363
 *              used to store application-defined data for iteration. A
1364
 *              negative return value from this function will cause
1365
 *              H5Miterate to issue an error, while a positive return
1366
 *              value will cause H5Miterate to stop iterating and return
1367
 *              this value without issuing an error. A return value of
1368
 *              zero allows iteration to continue.
1369
 *
1370
 * Return:      Last value returned by op
1371
 *
1372
 *-------------------------------------------------------------------------
1373
 */
1374
herr_t
1375
H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
1376
                   void *op_data, hid_t dxpl_id, hid_t lapl_id)
1377
{
1378
    H5VL_object_t       *vol_obj = NULL;
1379
    H5VL_optional_args_t vol_cb_args;         /* Arguments to VOL callback */
1380
    H5VL_map_args_t      map_args;            /* Arguments for map operations */
1381
    herr_t               ret_value = SUCCEED; /* Return value */
1382
1383
    FUNC_ENTER_API(FAIL)
1384
1385
    /* Check arguments */
1386
    if (!map_name)
1387
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be NULL");
1388
    if (!*map_name)
1389
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be an empty string");
1390
    if (key_mem_type_id < 0)
1391
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID");
1392
    if (!op)
1393
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified");
1394
1395
    /* Get the location object */
1396
    if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
1397
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
1398
1399
    /* Get the default dataset transfer property list if the user didn't provide one */
1400
    if (H5P_DEFAULT == dxpl_id)
1401
        dxpl_id = H5P_DATASET_XFER_DEFAULT;
1402
    else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
1403
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
1404
1405
    /* Set up VOL callback arguments */
1406
    map_args.specific.specific_type                                        = H5VL_MAP_ITER;
1407
    map_args.specific.args.iterate.loc_params.type                         = H5VL_OBJECT_BY_NAME;
1408
    map_args.specific.args.iterate.loc_params.obj_type                     = H5I_get_type(loc_id);
1409
    map_args.specific.args.iterate.loc_params.loc_data.loc_by_name.name    = map_name;
1410
    map_args.specific.args.iterate.loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
1411
    map_args.specific.args.iterate.idx                                     = (idx ? *idx : 0);
1412
    map_args.specific.args.iterate.key_mem_type_id                         = key_mem_type_id;
1413
    map_args.specific.args.iterate.op                                      = op;
1414
    map_args.specific.args.iterate.op_data                                 = op_data;
1415
    vol_cb_args.op_type                                                    = H5VL_MAP_SPECIFIC;
1416
    vol_cb_args.args                                                       = &map_args;
1417
1418
    /* Iterate over keys */
1419
    if ((ret_value = H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0)
1420
        HERROR(H5E_MAP, H5E_BADITER, "unable to ierate over keys");
1421
1422
    /* Set value to return */
1423
    if (idx)
1424
        *idx = map_args.specific.args.iterate.idx;
1425
1426
done:
1427
    FUNC_LEAVE_API(ret_value)
1428
} /* end H5Miterate_by_name() */
1429
1430
/*-------------------------------------------------------------------------
1431
 * Function:    H5Mdelete
1432
 *
1433
 * Purpose:     H5Mdelete deletes a key-value pair from the Map
1434
 *              specified by MAP_ID. KEY_MEM_TYPE_ID specifies the
1435
 *              datatype for the provided key buffers, and if different
1436
 *              from that used to create the Map object, the key will be
1437
 *              internally converted to the datatype for the map object.
1438
 *              Any further options can be specified through the property
1439
 *              list DXPL_ID.
1440
 *
1441
 * Return:      SUCCEED/FAIL
1442
 *
1443
 *-------------------------------------------------------------------------
1444
 */
1445
herr_t
1446
H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id)
1447
{
1448
    H5VL_object_t       *vol_obj = NULL;
1449
    H5VL_optional_args_t vol_cb_args;         /* Arguments to VOL callback */
1450
    H5VL_map_args_t      map_args;            /* Arguments for map operations */
1451
    herr_t               ret_value = SUCCEED; /* Return value */
1452
1453
    FUNC_ENTER_API(FAIL)
1454
1455
    /* Check arguments */
1456
    if (key_mem_type_id < 0)
1457
        HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID");
1458
1459
    /* Get map pointer */
1460
    if (NULL == (vol_obj = H5VL_vol_object_verify(map_id, H5I_MAP)))
1461
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID");
1462
1463
    /* Get the default dataset transfer property list if the user didn't provide one */
1464
    if (H5P_DEFAULT == dxpl_id)
1465
        dxpl_id = H5P_DATASET_XFER_DEFAULT;
1466
    else if (true != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
1467
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
1468
1469
    /* Set up VOL callback arguments */
1470
    map_args.specific.specific_type                = H5VL_MAP_DELETE;
1471
    map_args.specific.args.del.loc_params.type     = H5VL_OBJECT_BY_SELF;
1472
    map_args.specific.args.del.loc_params.obj_type = H5I_get_type(map_id);
1473
    map_args.specific.args.del.key_mem_type_id     = key_mem_type_id;
1474
    map_args.specific.args.del.key                 = key;
1475
    vol_cb_args.op_type                            = H5VL_MAP_SPECIFIC;
1476
    vol_cb_args.args                               = &map_args;
1477
1478
    /* Delete the key/value pair */
1479
    if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
1480
        HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair");
1481
1482
done:
1483
    FUNC_LEAVE_API(ret_value)
1484
} /* end H5Mdelete() */
1485
1486
#endif /*  H5_HAVE_MAP_API */