Coverage Report

Created: 2026-05-30 06:07

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hdf5/src/H5VLpassthru.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
 * Purpose:     This is a "pass through" VOL connector, which forwards each
15
 *              VOL callback to an underlying connector.
16
 *
17
 *              It is designed as an example VOL connector for developers to
18
 *              use when creating new connectors, especially connectors that
19
 *              are outside of the HDF5 library.  As such, it should _NOT_
20
 *              include _any_ private HDF5 header files.  This connector should
21
 *              therefore only make public HDF5 API calls and use standard C /
22
 *              POSIX calls.
23
 *
24
 *              Note that the HDF5 error stack must be preserved on code paths
25
 *              that could be invoked when the underlying VOL connector's
26
 *              callback can fail.
27
 *
28
 */
29
30
/* Header files needed */
31
/* Do NOT include private HDF5 files here! */
32
#include <assert.h>
33
#include <stdarg.h>
34
#include <stdio.h>
35
#include <stdlib.h>
36
#include <string.h>
37
38
/* Public HDF5 file */
39
#include "hdf5.h"
40
41
/* This connector's header */
42
#include "H5VLpassthru.h"
43
44
/**********/
45
/* Macros */
46
/**********/
47
48
/* Whether to display log message when callback is invoked */
49
/* (Uncomment to enable) */
50
/* #define ENABLE_PASSTHRU_LOGGING */
51
52
/************/
53
/* Typedefs */
54
/************/
55
56
/* The pass through VOL info object */
57
typedef struct H5VL_pass_through_t {
58
    hid_t under_vol_id; /* ID for underlying VOL connector */
59
    void *under_object; /* Info object for underlying VOL connector */
60
} H5VL_pass_through_t;
61
62
/* The pass through VOL wrapper context */
63
typedef struct H5VL_pass_through_wrap_ctx_t {
64
    hid_t under_vol_id;   /* VOL ID for under VOL */
65
    void *under_wrap_ctx; /* Object wrapping context for under VOL */
66
} H5VL_pass_through_wrap_ctx_t;
67
68
/********************* */
69
/* Function prototypes */
70
/********************* */
71
72
/* Helper routines */
73
static H5VL_pass_through_t *H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id);
74
static herr_t               H5VL_pass_through_free_obj(H5VL_pass_through_t *obj);
75
76
/* "Management" callbacks */
77
static herr_t H5VL_pass_through_init(hid_t vipl_id);
78
static herr_t H5VL_pass_through_term(void);
79
80
/* VOL info callbacks */
81
static void  *H5VL_pass_through_info_copy(const void *info);
82
static herr_t H5VL_pass_through_info_cmp(int *cmp_value, const void *info1, const void *info2);
83
static herr_t H5VL_pass_through_info_free(void *info);
84
static herr_t H5VL_pass_through_info_to_str(const void *info, char **str);
85
static herr_t H5VL_pass_through_str_to_info(const char *str, void **info);
86
87
/* VOL object wrap / retrieval callbacks */
88
static void  *H5VL_pass_through_get_object(const void *obj);
89
static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx);
90
static void  *H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *wrap_ctx);
91
static void  *H5VL_pass_through_unwrap_object(void *obj);
92
static herr_t H5VL_pass_through_free_wrap_ctx(void *obj);
93
94
/* Attribute callbacks */
95
static void  *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
96
                                            hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id,
97
                                            hid_t dxpl_id, void **req);
98
static void  *H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
99
                                          hid_t aapl_id, hid_t dxpl_id, void **req);
100
static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id,
101
                                          void **req);
102
static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id,
103
                                           void **req);
104
static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req);
105
static herr_t H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
106
                                              H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
107
static herr_t H5VL_pass_through_attr_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
108
                                              void **req);
109
static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req);
110
111
/* Dataset callbacks */
112
static void  *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
113
                                               const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
114
                                               hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
115
static void  *H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
116
                                             hid_t dapl_id, hid_t dxpl_id, void **req);
117
static herr_t H5VL_pass_through_dataset_read(size_t count, void *dset[], hid_t mem_type_id[],
118
                                             hid_t mem_space_id[], hid_t file_space_id[], hid_t plist_id,
119
                                             void *buf[], void **req);
120
static herr_t H5VL_pass_through_dataset_write(size_t count, void *dset[], hid_t mem_type_id[],
121
                                              hid_t mem_space_id[], hid_t file_space_id[], hid_t plist_id,
122
                                              const void *buf[], void **req);
123
static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
124
                                            void **req);
125
static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
126
                                                 void **req);
127
static herr_t H5VL_pass_through_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
128
                                                 void **req);
129
static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req);
130
131
/* Datatype callbacks */
132
static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params,
133
                                               const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id,
134
                                               hid_t tapl_id, hid_t dxpl_id, void **req);
135
static void *H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
136
                                             hid_t tapl_id, hid_t dxpl_id, void **req);
137
static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
138
                                             void **req);
139
static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args,
140
                                                  hid_t dxpl_id, void **req);
141
static herr_t H5VL_pass_through_datatype_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
142
                                                  void **req);
143
static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req);
144
145
/* File callbacks */
146
static void  *H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
147
                                            hid_t dxpl_id, void **req);
148
static void  *H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id,
149
                                          void **req);
150
static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req);
151
static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id,
152
                                              void **req);
153
static herr_t H5VL_pass_through_file_optional(void *file, H5VL_optional_args_t *args, hid_t dxpl_id,
154
                                              void **req);
155
static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req);
156
157
/* Group callbacks */
158
static void  *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
159
                                             hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id,
160
                                             void **req);
161
static void  *H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
162
                                           hid_t gapl_id, hid_t dxpl_id, void **req);
163
static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req);
164
static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id,
165
                                               void **req);
166
static herr_t H5VL_pass_through_group_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
167
                                               void **req);
168
static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req);
169
170
/* Link callbacks */
171
static herr_t H5VL_pass_through_link_create(H5VL_link_create_args_t *args, void *obj,
172
                                            const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
173
                                            hid_t dxpl_id, void **req);
174
static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
175
                                          const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
176
                                          hid_t dxpl_id, void **req);
177
static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
178
                                          const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
179
                                          hid_t dxpl_id, void **req);
180
static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params,
181
                                         H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
182
static herr_t H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
183
                                              H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
184
static herr_t H5VL_pass_through_link_optional(void *obj, const H5VL_loc_params_t *loc_params,
185
                                              H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
186
187
/* Object callbacks */
188
static void  *H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
189
                                            H5I_type_t *opened_type, hid_t dxpl_id, void **req);
190
static herr_t H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params,
191
                                            const char *src_name, void *dst_obj,
192
                                            const H5VL_loc_params_t *dst_loc_params, const char *dst_name,
193
                                            hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
194
static herr_t H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params,
195
                                           H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
196
static herr_t H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
197
                                                H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
198
static herr_t H5VL_pass_through_object_optional(void *obj, const H5VL_loc_params_t *loc_params,
199
                                                H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
200
201
/* Container/connector introspection callbacks */
202
static herr_t H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl,
203
                                                        const H5VL_class_t **conn_cls);
204
static herr_t H5VL_pass_through_introspect_get_cap_flags(const void *info, uint64_t *cap_flags);
205
static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type,
206
                                                     uint64_t *flags);
207
208
/* Async request callbacks */
209
static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5VL_request_status_t *status);
210
static herr_t H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx);
211
static herr_t H5VL_pass_through_request_cancel(void *req, H5VL_request_status_t *status);
212
static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_args_t *args);
213
static herr_t H5VL_pass_through_request_optional(void *req, H5VL_optional_args_t *args);
214
static herr_t H5VL_pass_through_request_free(void *req);
215
216
/* Blob callbacks */
217
static herr_t H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
218
static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
219
static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args);
220
static herr_t H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_optional_args_t *args);
221
222
/* Token callbacks */
223
static herr_t H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2,
224
                                          int *cmp_value);
225
static herr_t H5VL_pass_through_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token,
226
                                             char **token_str);
227
static herr_t H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, const char *token_str,
228
                                               H5O_token_t *token);
229
230
/* Generic optional callback */
231
static herr_t H5VL_pass_through_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
232
233
/*******************/
234
/* Local variables */
235
/*******************/
236
237
/* Pass through VOL connector class struct */
238
const H5VL_class_t H5VL_pass_through_g = {
239
    H5VL_VERSION,                            /* VOL class struct version */
240
    (H5VL_class_value_t)H5VL_PASSTHRU_VALUE, /* value        */
241
    H5VL_PASSTHRU_NAME,                      /* name         */
242
    H5VL_PASSTHRU_VERSION,                   /* connector version */
243
    0,                                       /* capability flags */
244
    H5VL_pass_through_init,                  /* initialize   */
245
    H5VL_pass_through_term,                  /* terminate    */
246
    {
247
        /* info_cls */
248
        sizeof(H5VL_pass_through_info_t), /* size    */
249
        H5VL_pass_through_info_copy,      /* copy    */
250
        H5VL_pass_through_info_cmp,       /* compare */
251
        H5VL_pass_through_info_free,      /* free    */
252
        H5VL_pass_through_info_to_str,    /* to_str  */
253
        H5VL_pass_through_str_to_info     /* from_str */
254
    },
255
    {
256
        /* wrap_cls */
257
        H5VL_pass_through_get_object,    /* get_object   */
258
        H5VL_pass_through_get_wrap_ctx,  /* get_wrap_ctx */
259
        H5VL_pass_through_wrap_object,   /* wrap_object  */
260
        H5VL_pass_through_unwrap_object, /* unwrap_object */
261
        H5VL_pass_through_free_wrap_ctx  /* free_wrap_ctx */
262
    },
263
    {
264
        /* attribute_cls */
265
        H5VL_pass_through_attr_create,   /* create */
266
        H5VL_pass_through_attr_open,     /* open */
267
        H5VL_pass_through_attr_read,     /* read */
268
        H5VL_pass_through_attr_write,    /* write */
269
        H5VL_pass_through_attr_get,      /* get */
270
        H5VL_pass_through_attr_specific, /* specific */
271
        H5VL_pass_through_attr_optional, /* optional */
272
        H5VL_pass_through_attr_close     /* close */
273
    },
274
    {
275
        /* dataset_cls */
276
        H5VL_pass_through_dataset_create,   /* create */
277
        H5VL_pass_through_dataset_open,     /* open */
278
        H5VL_pass_through_dataset_read,     /* read */
279
        H5VL_pass_through_dataset_write,    /* write */
280
        H5VL_pass_through_dataset_get,      /* get */
281
        H5VL_pass_through_dataset_specific, /* specific */
282
        H5VL_pass_through_dataset_optional, /* optional */
283
        H5VL_pass_through_dataset_close     /* close */
284
    },
285
    {
286
        /* datatype_cls */
287
        H5VL_pass_through_datatype_commit,   /* commit */
288
        H5VL_pass_through_datatype_open,     /* open */
289
        H5VL_pass_through_datatype_get,      /* get_size */
290
        H5VL_pass_through_datatype_specific, /* specific */
291
        H5VL_pass_through_datatype_optional, /* optional */
292
        H5VL_pass_through_datatype_close     /* close */
293
    },
294
    {
295
        /* file_cls */
296
        H5VL_pass_through_file_create,   /* create */
297
        H5VL_pass_through_file_open,     /* open */
298
        H5VL_pass_through_file_get,      /* get */
299
        H5VL_pass_through_file_specific, /* specific */
300
        H5VL_pass_through_file_optional, /* optional */
301
        H5VL_pass_through_file_close     /* close */
302
    },
303
    {
304
        /* group_cls */
305
        H5VL_pass_through_group_create,   /* create */
306
        H5VL_pass_through_group_open,     /* open */
307
        H5VL_pass_through_group_get,      /* get */
308
        H5VL_pass_through_group_specific, /* specific */
309
        H5VL_pass_through_group_optional, /* optional */
310
        H5VL_pass_through_group_close     /* close */
311
    },
312
    {
313
        /* link_cls */
314
        H5VL_pass_through_link_create,   /* create */
315
        H5VL_pass_through_link_copy,     /* copy */
316
        H5VL_pass_through_link_move,     /* move */
317
        H5VL_pass_through_link_get,      /* get */
318
        H5VL_pass_through_link_specific, /* specific */
319
        H5VL_pass_through_link_optional  /* optional */
320
    },
321
    {
322
        /* object_cls */
323
        H5VL_pass_through_object_open,     /* open */
324
        H5VL_pass_through_object_copy,     /* copy */
325
        H5VL_pass_through_object_get,      /* get */
326
        H5VL_pass_through_object_specific, /* specific */
327
        H5VL_pass_through_object_optional  /* optional */
328
    },
329
    {
330
        /* introspect_cls */
331
        H5VL_pass_through_introspect_get_conn_cls,  /* get_conn_cls */
332
        H5VL_pass_through_introspect_get_cap_flags, /* get_cap_flags */
333
        H5VL_pass_through_introspect_opt_query,     /* opt_query */
334
    },
335
    {
336
        /* request_cls */
337
        H5VL_pass_through_request_wait,     /* wait */
338
        H5VL_pass_through_request_notify,   /* notify */
339
        H5VL_pass_through_request_cancel,   /* cancel */
340
        H5VL_pass_through_request_specific, /* specific */
341
        H5VL_pass_through_request_optional, /* optional */
342
        H5VL_pass_through_request_free      /* free */
343
    },
344
    {
345
        /* blob_cls */
346
        H5VL_pass_through_blob_put,      /* put */
347
        H5VL_pass_through_blob_get,      /* get */
348
        H5VL_pass_through_blob_specific, /* specific */
349
        H5VL_pass_through_blob_optional  /* optional */
350
    },
351
    {
352
        /* token_cls */
353
        H5VL_pass_through_token_cmp,     /* cmp */
354
        H5VL_pass_through_token_to_str,  /* to_str */
355
        H5VL_pass_through_token_from_str /* from_str */
356
    },
357
    H5VL_pass_through_optional /* optional */
358
};
359
360
/*-------------------------------------------------------------------------
361
 * Function:    H5VL__pass_through_new_obj
362
 *
363
 * Purpose:     Create a new pass through object for an underlying object
364
 *
365
 * Return:      Success:    Pointer to the new pass through object
366
 *              Failure:    NULL
367
 *
368
 *-------------------------------------------------------------------------
369
 */
370
static H5VL_pass_through_t *
371
H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id)
372
0
{
373
0
    H5VL_pass_through_t *new_obj;
374
375
0
    new_obj               = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t));
376
0
    new_obj->under_object = under_obj;
377
0
    new_obj->under_vol_id = under_vol_id;
378
379
0
    H5Iinc_ref(new_obj->under_vol_id);
380
381
0
    return new_obj;
382
0
} /* end H5VL__pass_through_new_obj() */
383
384
/*-------------------------------------------------------------------------
385
 * Function:    H5VL__pass_through_free_obj
386
 *
387
 * Purpose:     Release a pass through object
388
 *
389
 * Note:  Take care to preserve the current HDF5 error stack
390
 *    when calling HDF5 API calls.
391
 *
392
 * Return:      Success:    0
393
 *              Failure:    -1
394
 *
395
 *-------------------------------------------------------------------------
396
 */
397
static herr_t
398
H5VL_pass_through_free_obj(H5VL_pass_through_t *obj)
399
0
{
400
0
    hid_t err_id;
401
402
0
    err_id = H5Eget_current_stack();
403
404
0
    H5Idec_ref(obj->under_vol_id);
405
406
0
    H5Eset_current_stack(err_id);
407
408
0
    free(obj);
409
410
0
    return 0;
411
0
} /* end H5VL__pass_through_free_obj() */
412
413
/*-------------------------------------------------------------------------
414
 * Function:    H5VL_pass_through_init
415
 *
416
 * Purpose:     Initialize this VOL connector, performing any necessary
417
 *              operations for the connector that will apply to all containers
418
 *              accessed with the connector.
419
 *
420
 * Return:      Success:    0
421
 *              Failure:    -1
422
 *
423
 *-------------------------------------------------------------------------
424
 */
425
static herr_t
426
H5VL_pass_through_init(hid_t vipl_id)
427
1
{
428
#ifdef ENABLE_PASSTHRU_LOGGING
429
    printf("------- PASS THROUGH VOL INIT\n");
430
#endif
431
432
    /* Shut compiler up about unused parameter */
433
1
    (void)vipl_id;
434
435
1
    return 0;
436
1
} /* end H5VL_pass_through_init() */
437
438
/*---------------------------------------------------------------------------
439
 * Function:    H5VL_pass_through_term
440
 *
441
 * Purpose:     Terminate this VOL connector, performing any necessary
442
 *              operations for the connector that release connector-wide
443
 *              resources (usually created / initialized with the 'init'
444
 *              callback).
445
 *
446
 * Return:      Success:    0
447
 *              Failure:    (Can't fail)
448
 *
449
 *---------------------------------------------------------------------------
450
 */
451
static herr_t
452
H5VL_pass_through_term(void)
453
1
{
454
#ifdef ENABLE_PASSTHRU_LOGGING
455
    printf("------- PASS THROUGH VOL TERM\n");
456
#endif
457
458
1
    return 0;
459
1
} /* end H5VL_pass_through_term() */
460
461
/*---------------------------------------------------------------------------
462
 * Function:    H5VL_pass_through_info_copy
463
 *
464
 * Purpose:     Duplicate the connector's info object.
465
 *
466
 * Returns:     Success:    New connector info object
467
 *              Failure:    NULL
468
 *
469
 *---------------------------------------------------------------------------
470
 */
471
static void *
472
H5VL_pass_through_info_copy(const void *_info)
473
0
{
474
0
    const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info;
475
0
    H5VL_pass_through_info_t       *new_info;
476
477
#ifdef ENABLE_PASSTHRU_LOGGING
478
    printf("------- PASS THROUGH VOL INFO Copy\n");
479
#endif
480
481
    /* Make sure the underneath VOL of this pass-through VOL is specified */
482
0
    if (!info) {
483
0
        printf("\nH5VLpassthru.c line %d in %s: info for pass-through VOL can't be null\n", __LINE__,
484
0
               __func__);
485
0
        return NULL;
486
0
    }
487
488
0
    if (H5Iis_valid(info->under_vol_id) <= 0) {
489
0
        printf("\nH5VLpassthru.c line %d in %s: not a valid underneath VOL ID for pass-through VOL\n",
490
0
               __LINE__, __func__);
491
0
        return NULL;
492
0
    }
493
494
    /* Allocate new VOL info struct for the pass through connector */
495
0
    new_info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t));
496
497
    /* Increment reference count on underlying VOL ID, and copy the VOL info */
498
0
    new_info->under_vol_id = info->under_vol_id;
499
500
0
    H5Iinc_ref(new_info->under_vol_id);
501
502
0
    if (info->under_vol_info)
503
0
        H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info);
504
505
0
    return new_info;
506
0
} /* end H5VL_pass_through_info_copy() */
507
508
/*---------------------------------------------------------------------------
509
 * Function:    H5VL_pass_through_info_cmp
510
 *
511
 * Purpose:     Compare two of the connector's info objects, setting *cmp_value,
512
 *              following the same rules as strcmp().
513
 *
514
 * Return:      Success:    0
515
 *              Failure:    -1
516
 *
517
 *---------------------------------------------------------------------------
518
 */
519
static herr_t
520
H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info2)
521
0
{
522
0
    const H5VL_pass_through_info_t *info1 = (const H5VL_pass_through_info_t *)_info1;
523
0
    const H5VL_pass_through_info_t *info2 = (const H5VL_pass_through_info_t *)_info2;
524
525
#ifdef ENABLE_PASSTHRU_LOGGING
526
    printf("------- PASS THROUGH VOL INFO Compare\n");
527
#endif
528
529
    /* Sanity checks */
530
0
    assert(info1);
531
0
    assert(info2);
532
533
    /* Initialize comparison value */
534
0
    *cmp_value = 0;
535
536
    /* Compare under VOL connector classes */
537
0
    H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id);
538
0
    if (*cmp_value != 0)
539
0
        return 0;
540
541
    /* Compare under VOL connector info objects */
542
0
    H5VLcmp_connector_info(cmp_value, info1->under_vol_id, info1->under_vol_info, info2->under_vol_info);
543
0
    if (*cmp_value != 0)
544
0
        return 0;
545
546
0
    return 0;
547
0
} /* end H5VL_pass_through_info_cmp() */
548
549
/*---------------------------------------------------------------------------
550
 * Function:    H5VL_pass_through_info_free
551
 *
552
 * Purpose:     Release an info object for the connector.
553
 *
554
 * Note:  Take care to preserve the current HDF5 error stack
555
 *    when calling HDF5 API calls.
556
 *
557
 * Return:      Success:    0
558
 *              Failure:    -1
559
 *
560
 *---------------------------------------------------------------------------
561
 */
562
static herr_t
563
H5VL_pass_through_info_free(void *_info)
564
0
{
565
0
    H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info;
566
0
    hid_t                     err_id;
567
568
#ifdef ENABLE_PASSTHRU_LOGGING
569
    printf("------- PASS THROUGH VOL INFO Free\n");
570
#endif
571
572
0
    err_id = H5Eget_current_stack();
573
574
    /* Release underlying VOL ID and info */
575
0
    if (info->under_vol_info)
576
0
        H5VLfree_connector_info(info->under_vol_id, info->under_vol_info);
577
0
    H5Idec_ref(info->under_vol_id);
578
579
0
    H5Eset_current_stack(err_id);
580
581
    /* Free pass through info object itself */
582
0
    free(info);
583
584
0
    return 0;
585
0
} /* end H5VL_pass_through_info_free() */
586
587
/*---------------------------------------------------------------------------
588
 * Function:    H5VL_pass_through_info_to_str
589
 *
590
 * Purpose:     Serialize an info object for this connector into a string
591
 *
592
 * Return:      Success:    0
593
 *              Failure:    -1
594
 *
595
 *---------------------------------------------------------------------------
596
 */
597
static herr_t
598
H5VL_pass_through_info_to_str(const void *_info, char **str)
599
0
{
600
0
    const H5VL_pass_through_info_t *info              = (const H5VL_pass_through_info_t *)_info;
601
0
    H5VL_class_value_t              under_value       = (H5VL_class_value_t)-1;
602
0
    char                           *under_vol_string  = NULL;
603
0
    size_t                          under_vol_str_len = 0;
604
605
#ifdef ENABLE_PASSTHRU_LOGGING
606
    printf("------- PASS THROUGH VOL INFO To String\n");
607
#endif
608
609
    /* Get value and string for underlying VOL connector */
610
0
    H5VLget_value(info->under_vol_id, &under_value);
611
0
    H5VLconnector_info_to_str(info->under_vol_info, info->under_vol_id, &under_vol_string);
612
613
    /* Determine length of underlying VOL info string */
614
0
    if (under_vol_string)
615
0
        under_vol_str_len = strlen(under_vol_string);
616
617
    /* Allocate space for our info */
618
0
    size_t strSize = 32 + under_vol_str_len;
619
0
    *str           = (char *)H5allocate_memory(strSize, (bool)0);
620
0
    assert(*str);
621
622
    /* Encode our info */
623
0
    snprintf(*str, strSize, "under_vol=%u;under_info={%s}", (unsigned)under_value,
624
0
             (under_vol_string ? under_vol_string : ""));
625
626
0
    return 0;
627
0
} /* end H5VL_pass_through_info_to_str() */
628
629
/*---------------------------------------------------------------------------
630
 * Function:    H5VL_pass_through_str_to_info
631
 *
632
 * Purpose:     Deserialize a string into an info object for this connector.
633
 *
634
 * Return:      Success:    0
635
 *              Failure:    -1
636
 *
637
 *---------------------------------------------------------------------------
638
 */
639
static herr_t
640
H5VL_pass_through_str_to_info(const char *str, void **_info)
641
0
{
642
0
    H5VL_pass_through_info_t *info;
643
0
    unsigned                  under_vol_value;
644
0
    const char               *under_vol_info_start, *under_vol_info_end;
645
0
    hid_t                     under_vol_id;
646
0
    void                     *under_vol_info = NULL;
647
648
#ifdef ENABLE_PASSTHRU_LOGGING
649
    printf("------- PASS THROUGH VOL INFO String To Info\n");
650
#endif
651
652
    /* Retrieve the underlying VOL connector value and info */
653
0
    if (sscanf(str, "under_vol=%u;", &under_vol_value) != 1)
654
0
        return -1;
655
0
    under_vol_id         = H5VLregister_connector_by_value((H5VL_class_value_t)under_vol_value, H5P_DEFAULT);
656
0
    under_vol_info_start = strchr(str, '{');
657
0
    under_vol_info_end   = strrchr(str, '}');
658
0
    assert(under_vol_info_end > under_vol_info_start);
659
0
    if (under_vol_info_end != (under_vol_info_start + 1)) {
660
0
        char *under_vol_info_str;
661
662
0
        under_vol_info_str = (char *)malloc((size_t)(under_vol_info_end - under_vol_info_start));
663
0
        memcpy(under_vol_info_str, under_vol_info_start + 1,
664
0
               (size_t)((under_vol_info_end - under_vol_info_start) - 1));
665
0
        *(under_vol_info_str + (under_vol_info_end - under_vol_info_start)) = '\0';
666
667
0
        H5VLconnector_str_to_info(under_vol_info_str, under_vol_id, &under_vol_info);
668
669
0
        free(under_vol_info_str);
670
0
    } /* end else */
671
672
    /* Allocate new pass-through VOL connector info and set its fields */
673
0
    info                 = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t));
674
0
    info->under_vol_id   = under_vol_id;
675
0
    info->under_vol_info = under_vol_info;
676
677
    /* Set return value */
678
0
    *_info = info;
679
680
0
    return 0;
681
0
} /* end H5VL_pass_through_str_to_info() */
682
683
/*---------------------------------------------------------------------------
684
 * Function:    H5VL_pass_through_get_object
685
 *
686
 * Purpose:     Retrieve the 'data' for a VOL object.
687
 *
688
 * Return:      Success:    0
689
 *              Failure:    -1
690
 *
691
 *---------------------------------------------------------------------------
692
 */
693
static void *
694
H5VL_pass_through_get_object(const void *obj)
695
0
{
696
0
    const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj;
697
698
#ifdef ENABLE_PASSTHRU_LOGGING
699
    printf("------- PASS THROUGH VOL Get object\n");
700
#endif
701
702
0
    return H5VLget_object(o->under_object, o->under_vol_id);
703
0
} /* end H5VL_pass_through_get_object() */
704
705
/*---------------------------------------------------------------------------
706
 * Function:    H5VL_pass_through_get_wrap_ctx
707
 *
708
 * Purpose:     Retrieve a "wrapper context" for an object
709
 *
710
 * Return:      Success:    0
711
 *              Failure:    -1
712
 *
713
 *---------------------------------------------------------------------------
714
 */
715
static herr_t
716
H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx)
717
0
{
718
0
    const H5VL_pass_through_t    *o = (const H5VL_pass_through_t *)obj;
719
0
    H5VL_pass_through_wrap_ctx_t *new_wrap_ctx;
720
721
#ifdef ENABLE_PASSTHRU_LOGGING
722
    printf("------- PASS THROUGH VOL WRAP CTX Get\n");
723
#endif
724
725
    /* Allocate new VOL object wrapping context for the pass through connector */
726
0
    new_wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)calloc(1, sizeof(H5VL_pass_through_wrap_ctx_t));
727
728
    /* Increment reference count on underlying VOL ID, and copy the VOL info */
729
0
    new_wrap_ctx->under_vol_id = o->under_vol_id;
730
731
0
    H5Iinc_ref(new_wrap_ctx->under_vol_id);
732
733
0
    H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx);
734
735
    /* Set wrap context to return */
736
0
    *wrap_ctx = new_wrap_ctx;
737
738
0
    return 0;
739
0
} /* end H5VL_pass_through_get_wrap_ctx() */
740
741
/*---------------------------------------------------------------------------
742
 * Function:    H5VL_pass_through_wrap_object
743
 *
744
 * Purpose:     Use a "wrapper context" to wrap a data object
745
 *
746
 * Return:      Success:    Pointer to wrapped object
747
 *              Failure:    NULL
748
 *
749
 *---------------------------------------------------------------------------
750
 */
751
static void *
752
H5VL_pass_through_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx)
753
0
{
754
0
    H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx;
755
0
    H5VL_pass_through_t          *new_obj;
756
0
    void                         *under;
757
758
#ifdef ENABLE_PASSTHRU_LOGGING
759
    printf("------- PASS THROUGH VOL WRAP Object\n");
760
#endif
761
762
    /* Wrap the object with the underlying VOL */
763
0
    under = H5VLwrap_object(obj, obj_type, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx);
764
0
    if (under)
765
0
        new_obj = H5VL_pass_through_new_obj(under, wrap_ctx->under_vol_id);
766
0
    else
767
0
        new_obj = NULL;
768
769
0
    return new_obj;
770
0
} /* end H5VL_pass_through_wrap_object() */
771
772
/*---------------------------------------------------------------------------
773
 * Function:    H5VL_pass_through_unwrap_object
774
 *
775
 * Purpose:     Unwrap a wrapped object, discarding the wrapper, but returning
776
 *    underlying object.
777
 *
778
 * Return:      Success:    Pointer to unwrapped object
779
 *              Failure:    NULL
780
 *
781
 *---------------------------------------------------------------------------
782
 */
783
static void *
784
H5VL_pass_through_unwrap_object(void *obj)
785
0
{
786
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
787
0
    void                *under;
788
789
#ifdef ENABLE_PASSTHRU_LOGGING
790
    printf("------- PASS THROUGH VOL UNWRAP Object\n");
791
#endif
792
793
    /* Unrap the object with the underlying VOL */
794
0
    under = H5VLunwrap_object(o->under_object, o->under_vol_id);
795
796
0
    if (under)
797
0
        H5VL_pass_through_free_obj(o);
798
799
0
    return under;
800
0
} /* end H5VL_pass_through_unwrap_object() */
801
802
/*---------------------------------------------------------------------------
803
 * Function:    H5VL_pass_through_free_wrap_ctx
804
 *
805
 * Purpose:     Release a "wrapper context" for an object
806
 *
807
 * Note:  Take care to preserve the current HDF5 error stack
808
 *    when calling HDF5 API calls.
809
 *
810
 * Return:      Success:    0
811
 *              Failure:    -1
812
 *
813
 *---------------------------------------------------------------------------
814
 */
815
static herr_t
816
H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx)
817
0
{
818
0
    H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx;
819
0
    hid_t                         err_id;
820
821
#ifdef ENABLE_PASSTHRU_LOGGING
822
    printf("------- PASS THROUGH VOL WRAP CTX Free\n");
823
#endif
824
825
0
    err_id = H5Eget_current_stack();
826
827
    /* Release underlying VOL ID and wrap context */
828
0
    if (wrap_ctx->under_wrap_ctx)
829
0
        H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id);
830
0
    H5Idec_ref(wrap_ctx->under_vol_id);
831
832
0
    H5Eset_current_stack(err_id);
833
834
    /* Free pass through wrap context object itself */
835
0
    free(wrap_ctx);
836
837
0
    return 0;
838
0
} /* end H5VL_pass_through_free_wrap_ctx() */
839
840
/*-------------------------------------------------------------------------
841
 * Function:    H5VL_pass_through_attr_create
842
 *
843
 * Purpose:     Creates an attribute on an object.
844
 *
845
 * Return:      Success:    Pointer to attribute object
846
 *              Failure:    NULL
847
 *
848
 *-------------------------------------------------------------------------
849
 */
850
static void *
851
H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id,
852
                              hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req)
853
0
{
854
0
    H5VL_pass_through_t *attr;
855
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
856
0
    void                *under;
857
858
#ifdef ENABLE_PASSTHRU_LOGGING
859
    printf("------- PASS THROUGH VOL ATTRIBUTE Create\n");
860
#endif
861
862
0
    under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, type_id, space_id, acpl_id,
863
0
                            aapl_id, dxpl_id, req);
864
0
    if (under) {
865
0
        attr = H5VL_pass_through_new_obj(under, o->under_vol_id);
866
867
        /* Check for async request */
868
0
        if (req && *req)
869
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
870
0
    } /* end if */
871
0
    else
872
0
        attr = NULL;
873
874
0
    return (void *)attr;
875
0
} /* end H5VL_pass_through_attr_create() */
876
877
/*-------------------------------------------------------------------------
878
 * Function:    H5VL_pass_through_attr_open
879
 *
880
 * Purpose:     Opens an attribute on an object.
881
 *
882
 * Return:      Success:    Pointer to attribute object
883
 *              Failure:    NULL
884
 *
885
 *-------------------------------------------------------------------------
886
 */
887
static void *
888
H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id,
889
                            hid_t dxpl_id, void **req)
890
0
{
891
0
    H5VL_pass_through_t *attr;
892
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
893
0
    void                *under;
894
895
#ifdef ENABLE_PASSTHRU_LOGGING
896
    printf("------- PASS THROUGH VOL ATTRIBUTE Open\n");
897
#endif
898
899
0
    under = H5VLattr_open(o->under_object, loc_params, o->under_vol_id, name, aapl_id, dxpl_id, req);
900
0
    if (under) {
901
0
        attr = H5VL_pass_through_new_obj(under, o->under_vol_id);
902
903
        /* Check for async request */
904
0
        if (req && *req)
905
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
906
0
    } /* end if */
907
0
    else
908
0
        attr = NULL;
909
910
0
    return (void *)attr;
911
0
} /* end H5VL_pass_through_attr_open() */
912
913
/*-------------------------------------------------------------------------
914
 * Function:    H5VL_pass_through_attr_read
915
 *
916
 * Purpose:     Reads data from attribute.
917
 *
918
 * Return:      Success:    0
919
 *              Failure:    -1
920
 *
921
 *-------------------------------------------------------------------------
922
 */
923
static herr_t
924
H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req)
925
0
{
926
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
927
0
    herr_t               ret_value;
928
929
#ifdef ENABLE_PASSTHRU_LOGGING
930
    printf("------- PASS THROUGH VOL ATTRIBUTE Read\n");
931
#endif
932
933
0
    ret_value = H5VLattr_read(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req);
934
935
    /* Check for async request */
936
0
    if (req && *req)
937
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
938
939
0
    return ret_value;
940
0
} /* end H5VL_pass_through_attr_read() */
941
942
/*-------------------------------------------------------------------------
943
 * Function:    H5VL_pass_through_attr_write
944
 *
945
 * Purpose:     Writes data to attribute.
946
 *
947
 * Return:      Success:    0
948
 *              Failure:    -1
949
 *
950
 *-------------------------------------------------------------------------
951
 */
952
static herr_t
953
H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req)
954
0
{
955
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
956
0
    herr_t               ret_value;
957
958
#ifdef ENABLE_PASSTHRU_LOGGING
959
    printf("------- PASS THROUGH VOL ATTRIBUTE Write\n");
960
#endif
961
962
0
    ret_value = H5VLattr_write(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req);
963
964
    /* Check for async request */
965
0
    if (req && *req)
966
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
967
968
0
    return ret_value;
969
0
} /* end H5VL_pass_through_attr_write() */
970
971
/*-------------------------------------------------------------------------
972
 * Function:    H5VL_pass_through_attr_get
973
 *
974
 * Purpose:     Gets information about an attribute
975
 *
976
 * Return:      Success:    0
977
 *              Failure:    -1
978
 *
979
 *-------------------------------------------------------------------------
980
 */
981
static herr_t
982
H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req)
983
0
{
984
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
985
0
    herr_t               ret_value;
986
987
#ifdef ENABLE_PASSTHRU_LOGGING
988
    printf("------- PASS THROUGH VOL ATTRIBUTE Get\n");
989
#endif
990
991
0
    ret_value = H5VLattr_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
992
993
    /* Check for async request */
994
0
    if (req && *req)
995
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
996
997
0
    return ret_value;
998
0
} /* end H5VL_pass_through_attr_get() */
999
1000
/*-------------------------------------------------------------------------
1001
 * Function:    H5VL_pass_through_attr_specific
1002
 *
1003
 * Purpose:     Specific operation on attribute
1004
 *
1005
 * Return:      Success:    0
1006
 *              Failure:    -1
1007
 *
1008
 *-------------------------------------------------------------------------
1009
 */
1010
static herr_t
1011
H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
1012
                                H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req)
1013
0
{
1014
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1015
0
    herr_t               ret_value;
1016
1017
#ifdef ENABLE_PASSTHRU_LOGGING
1018
    printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n");
1019
#endif
1020
1021
0
    ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
1022
1023
    /* Check for async request */
1024
0
    if (req && *req)
1025
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1026
1027
0
    return ret_value;
1028
0
} /* end H5VL_pass_through_attr_specific() */
1029
1030
/*-------------------------------------------------------------------------
1031
 * Function:    H5VL_pass_through_attr_optional
1032
 *
1033
 * Purpose:     Perform a connector-specific operation on an attribute
1034
 *
1035
 * Return:      Success:    0
1036
 *              Failure:    -1
1037
 *
1038
 *-------------------------------------------------------------------------
1039
 */
1040
static herr_t
1041
H5VL_pass_through_attr_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
1042
0
{
1043
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1044
0
    herr_t               ret_value;
1045
1046
#ifdef ENABLE_PASSTHRU_LOGGING
1047
    printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n");
1048
#endif
1049
1050
0
    ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
1051
1052
    /* Check for async request */
1053
0
    if (req && *req)
1054
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1055
1056
0
    return ret_value;
1057
0
} /* end H5VL_pass_through_attr_optional() */
1058
1059
/*-------------------------------------------------------------------------
1060
 * Function:    H5VL_pass_through_attr_close
1061
 *
1062
 * Purpose:     Closes an attribute.
1063
 *
1064
 * Return:      Success:    0
1065
 *              Failure:    -1, attr not closed.
1066
 *
1067
 *-------------------------------------------------------------------------
1068
 */
1069
static herr_t
1070
H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req)
1071
0
{
1072
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr;
1073
0
    herr_t               ret_value;
1074
1075
#ifdef ENABLE_PASSTHRU_LOGGING
1076
    printf("------- PASS THROUGH VOL ATTRIBUTE Close\n");
1077
#endif
1078
1079
0
    ret_value = H5VLattr_close(o->under_object, o->under_vol_id, dxpl_id, req);
1080
1081
    /* Check for async request */
1082
0
    if (req && *req)
1083
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1084
1085
    /* Release our wrapper, if underlying attribute was closed */
1086
0
    if (ret_value >= 0)
1087
0
        H5VL_pass_through_free_obj(o);
1088
1089
0
    return ret_value;
1090
0
} /* end H5VL_pass_through_attr_close() */
1091
1092
/*-------------------------------------------------------------------------
1093
 * Function:    H5VL_pass_through_dataset_create
1094
 *
1095
 * Purpose:     Creates a dataset in a container
1096
 *
1097
 * Return:      Success:    Pointer to a dataset object
1098
 *              Failure:    NULL
1099
 *
1100
 *-------------------------------------------------------------------------
1101
 */
1102
static void *
1103
H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
1104
                                 hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id,
1105
                                 hid_t dxpl_id, void **req)
1106
0
{
1107
0
    H5VL_pass_through_t *dset;
1108
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1109
0
    void                *under;
1110
1111
#ifdef ENABLE_PASSTHRU_LOGGING
1112
    printf("------- PASS THROUGH VOL DATASET Create\n");
1113
#endif
1114
1115
0
    under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, lcpl_id, type_id, space_id,
1116
0
                               dcpl_id, dapl_id, dxpl_id, req);
1117
0
    if (under) {
1118
0
        dset = H5VL_pass_through_new_obj(under, o->under_vol_id);
1119
1120
        /* Check for async request */
1121
0
        if (req && *req)
1122
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1123
0
    } /* end if */
1124
0
    else
1125
0
        dset = NULL;
1126
1127
0
    return (void *)dset;
1128
0
} /* end H5VL_pass_through_dataset_create() */
1129
1130
/*-------------------------------------------------------------------------
1131
 * Function:    H5VL_pass_through_dataset_open
1132
 *
1133
 * Purpose:     Opens a dataset in a container
1134
 *
1135
 * Return:      Success:    Pointer to a dataset object
1136
 *              Failure:    NULL
1137
 *
1138
 *-------------------------------------------------------------------------
1139
 */
1140
static void *
1141
H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
1142
                               hid_t dapl_id, hid_t dxpl_id, void **req)
1143
0
{
1144
0
    H5VL_pass_through_t *dset;
1145
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1146
0
    void                *under;
1147
1148
#ifdef ENABLE_PASSTHRU_LOGGING
1149
    printf("------- PASS THROUGH VOL DATASET Open\n");
1150
#endif
1151
1152
0
    under = H5VLdataset_open(o->under_object, loc_params, o->under_vol_id, name, dapl_id, dxpl_id, req);
1153
0
    if (under) {
1154
0
        dset = H5VL_pass_through_new_obj(under, o->under_vol_id);
1155
1156
        /* Check for async request */
1157
0
        if (req && *req)
1158
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1159
0
    } /* end if */
1160
0
    else
1161
0
        dset = NULL;
1162
1163
0
    return (void *)dset;
1164
0
} /* end H5VL_pass_through_dataset_open() */
1165
1166
/*-------------------------------------------------------------------------
1167
 * Function:    H5VL_pass_through_dataset_read
1168
 *
1169
 * Purpose:     Reads data elements from a dataset into a buffer.
1170
 *
1171
 * Return:      Success:    0
1172
 *              Failure:    -1
1173
 *
1174
 *-------------------------------------------------------------------------
1175
 */
1176
static herr_t
1177
H5VL_pass_through_dataset_read(size_t count, void *dset[], hid_t mem_type_id[], hid_t mem_space_id[],
1178
                               hid_t file_space_id[], hid_t plist_id, void *buf[], void **req)
1179
0
{
1180
0
    void  *obj_local;        /* Local buffer for obj */
1181
0
    void **obj = &obj_local; /* Array of object pointers */
1182
0
    size_t i;                /* Local index variable */
1183
0
    herr_t ret_value;
1184
1185
#ifdef ENABLE_PASSTHRU_LOGGING
1186
    printf("------- PASS THROUGH VOL DATASET Read\n");
1187
#endif
1188
1189
    /* Allocate obj array if necessary */
1190
0
    if (count > 1)
1191
0
        if (NULL == (obj = (void **)malloc(count * sizeof(void *))))
1192
0
            return -1;
1193
1194
    /* Build obj array */
1195
0
    for (i = 0; i < count; i++) {
1196
        /* Get the object */
1197
0
        obj[i] = ((H5VL_pass_through_t *)dset[i])->under_object;
1198
1199
        /* Make sure the class matches */
1200
0
        if (((H5VL_pass_through_t *)dset[i])->under_vol_id != ((H5VL_pass_through_t *)dset[0])->under_vol_id)
1201
0
            return -1;
1202
0
    }
1203
1204
0
    ret_value = H5VLdataset_read(count, obj, ((H5VL_pass_through_t *)dset[0])->under_vol_id, mem_type_id,
1205
0
                                 mem_space_id, file_space_id, plist_id, buf, req);
1206
1207
    /* Check for async request */
1208
0
    if (req && *req)
1209
0
        *req = H5VL_pass_through_new_obj(*req, ((H5VL_pass_through_t *)dset[0])->under_vol_id);
1210
1211
    /* Free memory */
1212
0
    if (obj != &obj_local)
1213
0
        free(obj);
1214
1215
0
    return ret_value;
1216
0
} /* end H5VL_pass_through_dataset_read() */
1217
1218
/*-------------------------------------------------------------------------
1219
 * Function:    H5VL_pass_through_dataset_write
1220
 *
1221
 * Purpose:     Writes data elements from a buffer into a dataset.
1222
 *
1223
 * Return:      Success:    0
1224
 *              Failure:    -1
1225
 *
1226
 *-------------------------------------------------------------------------
1227
 */
1228
static herr_t
1229
H5VL_pass_through_dataset_write(size_t count, void *dset[], hid_t mem_type_id[], hid_t mem_space_id[],
1230
                                hid_t file_space_id[], hid_t plist_id, const void *buf[], void **req)
1231
0
{
1232
0
    void  *obj_local;        /* Local buffer for obj */
1233
0
    void **obj = &obj_local; /* Array of object pointers */
1234
0
    size_t i;                /* Local index variable */
1235
0
    herr_t ret_value;
1236
1237
#ifdef ENABLE_PASSTHRU_LOGGING
1238
    printf("------- PASS THROUGH VOL DATASET Write\n");
1239
#endif
1240
1241
    /* Allocate obj array if necessary */
1242
0
    if (count > 1)
1243
0
        if (NULL == (obj = (void **)malloc(count * sizeof(void *))))
1244
0
            return -1;
1245
1246
    /* Build obj array */
1247
0
    for (i = 0; i < count; i++) {
1248
        /* Get the object */
1249
0
        obj[i] = ((H5VL_pass_through_t *)dset[i])->under_object;
1250
1251
        /* Make sure the class matches */
1252
0
        if (((H5VL_pass_through_t *)dset[i])->under_vol_id != ((H5VL_pass_through_t *)dset[0])->under_vol_id)
1253
0
            return -1;
1254
0
    }
1255
1256
0
    ret_value = H5VLdataset_write(count, obj, ((H5VL_pass_through_t *)dset[0])->under_vol_id, mem_type_id,
1257
0
                                  mem_space_id, file_space_id, plist_id, buf, req);
1258
1259
    /* Check for async request */
1260
0
    if (req && *req)
1261
0
        *req = H5VL_pass_through_new_obj(*req, ((H5VL_pass_through_t *)dset[0])->under_vol_id);
1262
1263
    /* Free memory */
1264
0
    if (obj != &obj_local)
1265
0
        free(obj);
1266
1267
0
    return ret_value;
1268
0
} /* end H5VL_pass_through_dataset_write() */
1269
1270
/*-------------------------------------------------------------------------
1271
 * Function:    H5VL_pass_through_dataset_get
1272
 *
1273
 * Purpose:     Gets information about a dataset
1274
 *
1275
 * Return:      Success:    0
1276
 *              Failure:    -1
1277
 *
1278
 *-------------------------------------------------------------------------
1279
 */
1280
static herr_t
1281
H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req)
1282
0
{
1283
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
1284
0
    herr_t               ret_value;
1285
1286
#ifdef ENABLE_PASSTHRU_LOGGING
1287
    printf("------- PASS THROUGH VOL DATASET Get\n");
1288
#endif
1289
1290
0
    ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
1291
1292
    /* Check for async request */
1293
0
    if (req && *req)
1294
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1295
1296
0
    return ret_value;
1297
0
} /* end H5VL_pass_through_dataset_get() */
1298
1299
/*-------------------------------------------------------------------------
1300
 * Function:    H5VL_pass_through_dataset_specific
1301
 *
1302
 * Purpose:     Specific operation on a dataset
1303
 *
1304
 * Return:      Success:    0
1305
 *              Failure:    -1
1306
 *
1307
 *-------------------------------------------------------------------------
1308
 */
1309
static herr_t
1310
H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req)
1311
0
{
1312
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1313
0
    hid_t                under_vol_id;
1314
0
    herr_t               ret_value;
1315
1316
#ifdef ENABLE_PASSTHRU_LOGGING
1317
    printf("------- PASS THROUGH VOL H5Dspecific\n");
1318
#endif
1319
1320
    /* Save copy of underlying VOL connector ID, in case of
1321
     * 'refresh' operation destroying the current object
1322
     */
1323
0
    under_vol_id = o->under_vol_id;
1324
1325
0
    ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, args, dxpl_id, req);
1326
1327
    /* Check for async request */
1328
0
    if (req && *req)
1329
0
        *req = H5VL_pass_through_new_obj(*req, under_vol_id);
1330
1331
0
    return ret_value;
1332
0
} /* end H5VL_pass_through_dataset_specific() */
1333
1334
/*-------------------------------------------------------------------------
1335
 * Function:    H5VL_pass_through_dataset_optional
1336
 *
1337
 * Purpose:     Perform a connector-specific operation on a dataset
1338
 *
1339
 * Return:      Success:    0
1340
 *              Failure:    -1
1341
 *
1342
 *-------------------------------------------------------------------------
1343
 */
1344
static herr_t
1345
H5VL_pass_through_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
1346
0
{
1347
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1348
0
    herr_t               ret_value;
1349
1350
#ifdef ENABLE_PASSTHRU_LOGGING
1351
    printf("------- PASS THROUGH VOL DATASET Optional\n");
1352
#endif
1353
1354
0
    ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
1355
1356
    /* Check for async request */
1357
0
    if (req && *req)
1358
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1359
1360
0
    return ret_value;
1361
0
} /* end H5VL_pass_through_dataset_optional() */
1362
1363
/*-------------------------------------------------------------------------
1364
 * Function:    H5VL_pass_through_dataset_close
1365
 *
1366
 * Purpose:     Closes a dataset.
1367
 *
1368
 * Return:      Success:    0
1369
 *              Failure:    -1, dataset not closed.
1370
 *
1371
 *-------------------------------------------------------------------------
1372
 */
1373
static herr_t
1374
H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req)
1375
0
{
1376
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
1377
0
    herr_t               ret_value;
1378
1379
#ifdef ENABLE_PASSTHRU_LOGGING
1380
    printf("------- PASS THROUGH VOL DATASET Close\n");
1381
#endif
1382
1383
0
    ret_value = H5VLdataset_close(o->under_object, o->under_vol_id, dxpl_id, req);
1384
1385
    /* Check for async request */
1386
0
    if (req && *req)
1387
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1388
1389
    /* Release our wrapper, if underlying dataset was closed */
1390
0
    if (ret_value >= 0)
1391
0
        H5VL_pass_through_free_obj(o);
1392
1393
0
    return ret_value;
1394
0
} /* end H5VL_pass_through_dataset_close() */
1395
1396
/*-------------------------------------------------------------------------
1397
 * Function:    H5VL_pass_through_datatype_commit
1398
 *
1399
 * Purpose:     Commits a datatype inside a container.
1400
 *
1401
 * Return:      Success:    Pointer to datatype object
1402
 *              Failure:    NULL
1403
 *
1404
 *-------------------------------------------------------------------------
1405
 */
1406
static void *
1407
H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
1408
                                  hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id,
1409
                                  void **req)
1410
0
{
1411
0
    H5VL_pass_through_t *dt;
1412
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1413
0
    void                *under;
1414
1415
#ifdef ENABLE_PASSTHRU_LOGGING
1416
    printf("------- PASS THROUGH VOL DATATYPE Commit\n");
1417
#endif
1418
1419
0
    under = H5VLdatatype_commit(o->under_object, loc_params, o->under_vol_id, name, type_id, lcpl_id, tcpl_id,
1420
0
                                tapl_id, dxpl_id, req);
1421
0
    if (under) {
1422
0
        dt = H5VL_pass_through_new_obj(under, o->under_vol_id);
1423
1424
        /* Check for async request */
1425
0
        if (req && *req)
1426
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1427
0
    } /* end if */
1428
0
    else
1429
0
        dt = NULL;
1430
1431
0
    return (void *)dt;
1432
0
} /* end H5VL_pass_through_datatype_commit() */
1433
1434
/*-------------------------------------------------------------------------
1435
 * Function:    H5VL_pass_through_datatype_open
1436
 *
1437
 * Purpose:     Opens a named datatype inside a container.
1438
 *
1439
 * Return:      Success:    Pointer to datatype object
1440
 *              Failure:    NULL
1441
 *
1442
 *-------------------------------------------------------------------------
1443
 */
1444
static void *
1445
H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
1446
                                hid_t tapl_id, hid_t dxpl_id, void **req)
1447
0
{
1448
0
    H5VL_pass_through_t *dt;
1449
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1450
0
    void                *under;
1451
1452
#ifdef ENABLE_PASSTHRU_LOGGING
1453
    printf("------- PASS THROUGH VOL DATATYPE Open\n");
1454
#endif
1455
1456
0
    under = H5VLdatatype_open(o->under_object, loc_params, o->under_vol_id, name, tapl_id, dxpl_id, req);
1457
0
    if (under) {
1458
0
        dt = H5VL_pass_through_new_obj(under, o->under_vol_id);
1459
1460
        /* Check for async request */
1461
0
        if (req && *req)
1462
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1463
0
    } /* end if */
1464
0
    else
1465
0
        dt = NULL;
1466
1467
0
    return (void *)dt;
1468
0
} /* end H5VL_pass_through_datatype_open() */
1469
1470
/*-------------------------------------------------------------------------
1471
 * Function:    H5VL_pass_through_datatype_get
1472
 *
1473
 * Purpose:     Get information about a datatype
1474
 *
1475
 * Return:      Success:    0
1476
 *              Failure:    -1
1477
 *
1478
 *-------------------------------------------------------------------------
1479
 */
1480
static herr_t
1481
H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req)
1482
0
{
1483
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt;
1484
0
    herr_t               ret_value;
1485
1486
#ifdef ENABLE_PASSTHRU_LOGGING
1487
    printf("------- PASS THROUGH VOL DATATYPE Get\n");
1488
#endif
1489
1490
0
    ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
1491
1492
    /* Check for async request */
1493
0
    if (req && *req)
1494
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1495
1496
0
    return ret_value;
1497
0
} /* end H5VL_pass_through_datatype_get() */
1498
1499
/*-------------------------------------------------------------------------
1500
 * Function:    H5VL_pass_through_datatype_specific
1501
 *
1502
 * Purpose:     Specific operations for datatypes
1503
 *
1504
 * Return:      Success:    0
1505
 *              Failure:    -1
1506
 *
1507
 *-------------------------------------------------------------------------
1508
 */
1509
static herr_t
1510
H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, void **req)
1511
0
{
1512
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1513
0
    hid_t                under_vol_id;
1514
0
    herr_t               ret_value;
1515
1516
#ifdef ENABLE_PASSTHRU_LOGGING
1517
    printf("------- PASS THROUGH VOL DATATYPE Specific\n");
1518
#endif
1519
1520
    /* Save copy of underlying VOL connector ID, in case of
1521
     * 'refresh' operation destroying the current object
1522
     */
1523
0
    under_vol_id = o->under_vol_id;
1524
1525
0
    ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, args, dxpl_id, req);
1526
1527
    /* Check for async request */
1528
0
    if (req && *req)
1529
0
        *req = H5VL_pass_through_new_obj(*req, under_vol_id);
1530
1531
0
    return ret_value;
1532
0
} /* end H5VL_pass_through_datatype_specific() */
1533
1534
/*-------------------------------------------------------------------------
1535
 * Function:    H5VL_pass_through_datatype_optional
1536
 *
1537
 * Purpose:     Perform a connector-specific operation on a datatype
1538
 *
1539
 * Return:      Success:    0
1540
 *              Failure:    -1
1541
 *
1542
 *-------------------------------------------------------------------------
1543
 */
1544
static herr_t
1545
H5VL_pass_through_datatype_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
1546
0
{
1547
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1548
0
    herr_t               ret_value;
1549
1550
#ifdef ENABLE_PASSTHRU_LOGGING
1551
    printf("------- PASS THROUGH VOL DATATYPE Optional\n");
1552
#endif
1553
1554
0
    ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
1555
1556
    /* Check for async request */
1557
0
    if (req && *req)
1558
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1559
1560
0
    return ret_value;
1561
0
} /* end H5VL_pass_through_datatype_optional() */
1562
1563
/*-------------------------------------------------------------------------
1564
 * Function:    H5VL_pass_through_datatype_close
1565
 *
1566
 * Purpose:     Closes a datatype.
1567
 *
1568
 * Return:      Success:    0
1569
 *              Failure:    -1, datatype not closed.
1570
 *
1571
 *-------------------------------------------------------------------------
1572
 */
1573
static herr_t
1574
H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req)
1575
0
{
1576
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt;
1577
0
    herr_t               ret_value;
1578
1579
#ifdef ENABLE_PASSTHRU_LOGGING
1580
    printf("------- PASS THROUGH VOL DATATYPE Close\n");
1581
#endif
1582
1583
0
    assert(o->under_object);
1584
1585
0
    ret_value = H5VLdatatype_close(o->under_object, o->under_vol_id, dxpl_id, req);
1586
1587
    /* Check for async request */
1588
0
    if (req && *req)
1589
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1590
1591
    /* Release our wrapper, if underlying datatype was closed */
1592
0
    if (ret_value >= 0)
1593
0
        H5VL_pass_through_free_obj(o);
1594
1595
0
    return ret_value;
1596
0
} /* end H5VL_pass_through_datatype_close() */
1597
1598
/*-------------------------------------------------------------------------
1599
 * Function:    H5VL_pass_through_file_create
1600
 *
1601
 * Purpose:     Creates a container using this connector
1602
 *
1603
 * Return:      Success:    Pointer to a file object
1604
 *              Failure:    NULL
1605
 *
1606
 *-------------------------------------------------------------------------
1607
 */
1608
static void *
1609
H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id,
1610
                              void **req)
1611
0
{
1612
0
    H5VL_pass_through_info_t *info;
1613
0
    H5VL_pass_through_t      *file;
1614
0
    hid_t                     under_fapl_id;
1615
0
    void                     *under;
1616
1617
#ifdef ENABLE_PASSTHRU_LOGGING
1618
    printf("------- PASS THROUGH VOL FILE Create\n");
1619
#endif
1620
1621
    /* Get copy of our VOL info from FAPL */
1622
0
    H5Pget_vol_info(fapl_id, (void **)&info);
1623
1624
    /* Make sure we have info about the underlying VOL to be used */
1625
0
    if (!info)
1626
0
        return NULL;
1627
1628
    /* Copy the FAPL */
1629
0
    under_fapl_id = H5Pcopy(fapl_id);
1630
1631
    /* Set the VOL ID and info for the underlying FAPL */
1632
0
    H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
1633
1634
    /* Open the file with the underlying VOL connector */
1635
0
    under = H5VLfile_create(name, flags, fcpl_id, under_fapl_id, dxpl_id, req);
1636
0
    if (under) {
1637
0
        file = H5VL_pass_through_new_obj(under, info->under_vol_id);
1638
1639
        /* Check for async request */
1640
0
        if (req && *req)
1641
0
            *req = H5VL_pass_through_new_obj(*req, info->under_vol_id);
1642
0
    } /* end if */
1643
0
    else
1644
0
        file = NULL;
1645
1646
    /* Close underlying FAPL */
1647
0
    H5Pclose(under_fapl_id);
1648
1649
    /* Release copy of our VOL info */
1650
0
    H5VL_pass_through_info_free(info);
1651
1652
0
    return (void *)file;
1653
0
} /* end H5VL_pass_through_file_create() */
1654
1655
/*-------------------------------------------------------------------------
1656
 * Function:    H5VL_pass_through_file_open
1657
 *
1658
 * Purpose:     Opens a container created with this connector
1659
 *
1660
 * Return:      Success:    Pointer to a file object
1661
 *              Failure:    NULL
1662
 *
1663
 *-------------------------------------------------------------------------
1664
 */
1665
static void *
1666
H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req)
1667
0
{
1668
0
    H5VL_pass_through_info_t *info;
1669
0
    H5VL_pass_through_t      *file;
1670
0
    hid_t                     under_fapl_id;
1671
0
    void                     *under;
1672
1673
#ifdef ENABLE_PASSTHRU_LOGGING
1674
    printf("------- PASS THROUGH VOL FILE Open\n");
1675
#endif
1676
1677
    /* Get copy of our VOL info from FAPL */
1678
0
    H5Pget_vol_info(fapl_id, (void **)&info);
1679
1680
    /* Make sure we have info about the underlying VOL to be used */
1681
0
    if (!info)
1682
0
        return NULL;
1683
1684
    /* Copy the FAPL */
1685
0
    under_fapl_id = H5Pcopy(fapl_id);
1686
1687
    /* Set the VOL ID and info for the underlying FAPL */
1688
0
    H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
1689
1690
    /* Open the file with the underlying VOL connector */
1691
0
    under = H5VLfile_open(name, flags, under_fapl_id, dxpl_id, req);
1692
0
    if (under) {
1693
0
        file = H5VL_pass_through_new_obj(under, info->under_vol_id);
1694
1695
        /* Check for async request */
1696
0
        if (req && *req)
1697
0
            *req = H5VL_pass_through_new_obj(*req, info->under_vol_id);
1698
0
    } /* end if */
1699
0
    else
1700
0
        file = NULL;
1701
1702
    /* Close underlying FAPL */
1703
0
    H5Pclose(under_fapl_id);
1704
1705
    /* Release copy of our VOL info */
1706
0
    H5VL_pass_through_info_free(info);
1707
1708
0
    return (void *)file;
1709
0
} /* end H5VL_pass_through_file_open() */
1710
1711
/*-------------------------------------------------------------------------
1712
 * Function:    H5VL_pass_through_file_get
1713
 *
1714
 * Purpose:     Get info about a file
1715
 *
1716
 * Return:      Success:    0
1717
 *              Failure:    -1
1718
 *
1719
 *-------------------------------------------------------------------------
1720
 */
1721
static herr_t
1722
H5VL_pass_through_file_get(void *file, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req)
1723
0
{
1724
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
1725
0
    herr_t               ret_value;
1726
1727
#ifdef ENABLE_PASSTHRU_LOGGING
1728
    printf("------- PASS THROUGH VOL FILE Get\n");
1729
#endif
1730
1731
0
    ret_value = H5VLfile_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
1732
1733
    /* Check for async request */
1734
0
    if (req && *req)
1735
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1736
1737
0
    return ret_value;
1738
0
} /* end H5VL_pass_through_file_get() */
1739
1740
/*-------------------------------------------------------------------------
1741
 * Function:    H5VL_pass_through_file_specific
1742
 *
1743
 * Purpose:     Specific operation on file
1744
 *
1745
 * Return:      Success:    0
1746
 *              Failure:    -1
1747
 *
1748
 *-------------------------------------------------------------------------
1749
 */
1750
static herr_t
1751
H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req)
1752
0
{
1753
0
    H5VL_pass_through_t       *o = (H5VL_pass_through_t *)file;
1754
0
    H5VL_pass_through_t       *new_o;
1755
0
    H5VL_file_specific_args_t  my_args;
1756
0
    H5VL_file_specific_args_t *new_args;
1757
0
    H5VL_pass_through_info_t  *info         = NULL;
1758
0
    hid_t                      under_vol_id = -1;
1759
0
    herr_t                     ret_value;
1760
1761
#ifdef ENABLE_PASSTHRU_LOGGING
1762
    printf("------- PASS THROUGH VOL FILE Specific\n");
1763
#endif
1764
1765
0
    if (args->op_type == H5VL_FILE_IS_ACCESSIBLE) {
1766
        /* Shallow copy the args */
1767
0
        memcpy(&my_args, args, sizeof(my_args));
1768
1769
        /* Get copy of our VOL info from FAPL */
1770
0
        H5Pget_vol_info(args->args.is_accessible.fapl_id, (void **)&info);
1771
1772
        /* Make sure we have info about the underlying VOL to be used */
1773
0
        if (!info)
1774
0
            return (-1);
1775
1776
        /* Keep the correct underlying VOL ID for later */
1777
0
        under_vol_id = info->under_vol_id;
1778
1779
        /* Copy the FAPL */
1780
0
        my_args.args.is_accessible.fapl_id = H5Pcopy(args->args.is_accessible.fapl_id);
1781
1782
        /* Set the VOL ID and info for the underlying FAPL */
1783
0
        H5Pset_vol(my_args.args.is_accessible.fapl_id, info->under_vol_id, info->under_vol_info);
1784
1785
        /* Set argument pointer to new arguments */
1786
0
        new_args = &my_args;
1787
1788
        /* Set object pointer for operation */
1789
0
        new_o = NULL;
1790
0
    } /* end else-if */
1791
0
    else if (args->op_type == H5VL_FILE_DELETE) {
1792
        /* Shallow copy the args */
1793
0
        memcpy(&my_args, args, sizeof(my_args));
1794
1795
        /* Get copy of our VOL info from FAPL */
1796
0
        H5Pget_vol_info(args->args.del.fapl_id, (void **)&info);
1797
1798
        /* Make sure we have info about the underlying VOL to be used */
1799
0
        if (!info)
1800
0
            return (-1);
1801
1802
        /* Keep the correct underlying VOL ID for later */
1803
0
        under_vol_id = info->under_vol_id;
1804
1805
        /* Copy the FAPL */
1806
0
        my_args.args.del.fapl_id = H5Pcopy(args->args.del.fapl_id);
1807
1808
        /* Set the VOL ID and info for the underlying FAPL */
1809
0
        H5Pset_vol(my_args.args.del.fapl_id, info->under_vol_id, info->under_vol_info);
1810
1811
        /* Set argument pointer to new arguments */
1812
0
        new_args = &my_args;
1813
1814
        /* Set object pointer for operation */
1815
0
        new_o = NULL;
1816
0
    } /* end else-if */
1817
0
    else {
1818
        /* Keep the correct underlying VOL ID for later */
1819
0
        under_vol_id = o->under_vol_id;
1820
1821
        /* Set argument pointer to current arguments */
1822
0
        new_args = args;
1823
1824
        /* Set object pointer for operation */
1825
0
        new_o = o->under_object;
1826
0
    } /* end else */
1827
1828
0
    ret_value = H5VLfile_specific(new_o, under_vol_id, new_args, dxpl_id, req);
1829
1830
    /* Check for async request */
1831
0
    if (req && *req)
1832
0
        *req = H5VL_pass_through_new_obj(*req, under_vol_id);
1833
1834
0
    if (args->op_type == H5VL_FILE_IS_ACCESSIBLE) {
1835
        /* Close underlying FAPL */
1836
0
        H5Pclose(my_args.args.is_accessible.fapl_id);
1837
1838
        /* Release copy of our VOL info */
1839
0
        H5VL_pass_through_info_free(info);
1840
0
    } /* end else-if */
1841
0
    else if (args->op_type == H5VL_FILE_DELETE) {
1842
        /* Close underlying FAPL */
1843
0
        H5Pclose(my_args.args.del.fapl_id);
1844
1845
        /* Release copy of our VOL info */
1846
0
        H5VL_pass_through_info_free(info);
1847
0
    } /* end else-if */
1848
0
    else if (args->op_type == H5VL_FILE_REOPEN) {
1849
        /* Wrap file struct pointer for 'reopen' operation, if we reopened one */
1850
0
        if (ret_value >= 0 && *args->args.reopen.file)
1851
0
            *args->args.reopen.file = H5VL_pass_through_new_obj(*args->args.reopen.file, under_vol_id);
1852
0
    } /* end else */
1853
1854
0
    return ret_value;
1855
0
} /* end H5VL_pass_through_file_specific() */
1856
1857
/*-------------------------------------------------------------------------
1858
 * Function:    H5VL_pass_through_file_optional
1859
 *
1860
 * Purpose:     Perform a connector-specific operation on a file
1861
 *
1862
 * Return:      Success:    0
1863
 *              Failure:    -1
1864
 *
1865
 *-------------------------------------------------------------------------
1866
 */
1867
static herr_t
1868
H5VL_pass_through_file_optional(void *file, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
1869
0
{
1870
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
1871
0
    herr_t               ret_value;
1872
1873
#ifdef ENABLE_PASSTHRU_LOGGING
1874
    printf("------- PASS THROUGH VOL File Optional\n");
1875
#endif
1876
1877
0
    ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
1878
1879
    /* Check for async request */
1880
0
    if (req && *req)
1881
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1882
1883
0
    return ret_value;
1884
0
} /* end H5VL_pass_through_file_optional() */
1885
1886
/*-------------------------------------------------------------------------
1887
 * Function:    H5VL_pass_through_file_close
1888
 *
1889
 * Purpose:     Closes a file.
1890
 *
1891
 * Return:      Success:    0
1892
 *              Failure:    -1, file not closed.
1893
 *
1894
 *-------------------------------------------------------------------------
1895
 */
1896
static herr_t
1897
H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req)
1898
0
{
1899
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
1900
0
    herr_t               ret_value;
1901
1902
#ifdef ENABLE_PASSTHRU_LOGGING
1903
    printf("------- PASS THROUGH VOL FILE Close\n");
1904
#endif
1905
1906
0
    ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req);
1907
1908
    /* Check for async request */
1909
0
    if (req && *req)
1910
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1911
1912
    /* Release our wrapper, if underlying file was closed */
1913
0
    if (ret_value >= 0)
1914
0
        H5VL_pass_through_free_obj(o);
1915
1916
0
    return ret_value;
1917
0
} /* end H5VL_pass_through_file_close() */
1918
1919
/*-------------------------------------------------------------------------
1920
 * Function:    H5VL_pass_through_group_create
1921
 *
1922
 * Purpose:     Creates a group inside a container
1923
 *
1924
 * Return:      Success:    Pointer to a group object
1925
 *              Failure:    NULL
1926
 *
1927
 *-------------------------------------------------------------------------
1928
 */
1929
static void *
1930
H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
1931
                               hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req)
1932
0
{
1933
0
    H5VL_pass_through_t *group;
1934
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1935
0
    void                *under;
1936
1937
#ifdef ENABLE_PASSTHRU_LOGGING
1938
    printf("------- PASS THROUGH VOL GROUP Create\n");
1939
#endif
1940
1941
0
    under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, lcpl_id, gcpl_id, gapl_id,
1942
0
                             dxpl_id, req);
1943
0
    if (under) {
1944
0
        group = H5VL_pass_through_new_obj(under, o->under_vol_id);
1945
1946
        /* Check for async request */
1947
0
        if (req && *req)
1948
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1949
0
    } /* end if */
1950
0
    else
1951
0
        group = NULL;
1952
1953
0
    return (void *)group;
1954
0
} /* end H5VL_pass_through_group_create() */
1955
1956
/*-------------------------------------------------------------------------
1957
 * Function:    H5VL_pass_through_group_open
1958
 *
1959
 * Purpose:     Opens a group inside a container
1960
 *
1961
 * Return:      Success:    Pointer to a group object
1962
 *              Failure:    NULL
1963
 *
1964
 *-------------------------------------------------------------------------
1965
 */
1966
static void *
1967
H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id,
1968
                             hid_t dxpl_id, void **req)
1969
0
{
1970
0
    H5VL_pass_through_t *group;
1971
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
1972
0
    void                *under;
1973
1974
#ifdef ENABLE_PASSTHRU_LOGGING
1975
    printf("------- PASS THROUGH VOL GROUP Open\n");
1976
#endif
1977
1978
0
    under = H5VLgroup_open(o->under_object, loc_params, o->under_vol_id, name, gapl_id, dxpl_id, req);
1979
0
    if (under) {
1980
0
        group = H5VL_pass_through_new_obj(under, o->under_vol_id);
1981
1982
        /* Check for async request */
1983
0
        if (req && *req)
1984
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
1985
0
    } /* end if */
1986
0
    else
1987
0
        group = NULL;
1988
1989
0
    return (void *)group;
1990
0
} /* end H5VL_pass_through_group_open() */
1991
1992
/*-------------------------------------------------------------------------
1993
 * Function:    H5VL_pass_through_group_get
1994
 *
1995
 * Purpose:     Get info about a group
1996
 *
1997
 * Return:      Success:    0
1998
 *              Failure:    -1
1999
 *
2000
 *-------------------------------------------------------------------------
2001
 */
2002
static herr_t
2003
H5VL_pass_through_group_get(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req)
2004
0
{
2005
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2006
0
    herr_t               ret_value;
2007
2008
#ifdef ENABLE_PASSTHRU_LOGGING
2009
    printf("------- PASS THROUGH VOL GROUP Get\n");
2010
#endif
2011
2012
0
    ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
2013
2014
    /* Check for async request */
2015
0
    if (req && *req)
2016
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2017
2018
0
    return ret_value;
2019
0
} /* end H5VL_pass_through_group_get() */
2020
2021
/*-------------------------------------------------------------------------
2022
 * Function:    H5VL_pass_through_group_specific
2023
 *
2024
 * Purpose:     Specific operation on a group
2025
 *
2026
 * Return:      Success:    0
2027
 *              Failure:    -1
2028
 *
2029
 *-------------------------------------------------------------------------
2030
 */
2031
static herr_t
2032
H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req)
2033
0
{
2034
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2035
0
    hid_t                under_vol_id;
2036
0
    herr_t               ret_value;
2037
2038
#ifdef ENABLE_PASSTHRU_LOGGING
2039
    printf("------- PASS THROUGH VOL GROUP Specific\n");
2040
#endif
2041
2042
    /* Save copy of underlying VOL connector ID, in case of
2043
     * 'refresh' operation destroying the current object
2044
     */
2045
0
    under_vol_id = o->under_vol_id;
2046
2047
    /* Unpack arguments to get at the child file pointer when mounting a file */
2048
0
    if (args->op_type == H5VL_GROUP_MOUNT) {
2049
0
        H5VL_group_specific_args_t vol_cb_args; /* New group specific arg struct */
2050
2051
        /* Set up new VOL callback arguments */
2052
0
        vol_cb_args.op_type         = H5VL_GROUP_MOUNT;
2053
0
        vol_cb_args.args.mount.name = args->args.mount.name;
2054
0
        vol_cb_args.args.mount.child_file =
2055
0
            ((H5VL_pass_through_t *)args->args.mount.child_file)->under_object;
2056
0
        vol_cb_args.args.mount.fmpl_id = args->args.mount.fmpl_id;
2057
2058
        /* Re-issue 'group specific' call, using the unwrapped pieces */
2059
0
        ret_value = H5VLgroup_specific(o->under_object, under_vol_id, &vol_cb_args, dxpl_id, req);
2060
0
    } /* end if */
2061
0
    else
2062
0
        ret_value = H5VLgroup_specific(o->under_object, under_vol_id, args, dxpl_id, req);
2063
2064
    /* Check for async request */
2065
0
    if (req && *req)
2066
0
        *req = H5VL_pass_through_new_obj(*req, under_vol_id);
2067
2068
0
    return ret_value;
2069
0
} /* end H5VL_pass_through_group_specific() */
2070
2071
/*-------------------------------------------------------------------------
2072
 * Function:    H5VL_pass_through_group_optional
2073
 *
2074
 * Purpose:     Perform a connector-specific operation on a group
2075
 *
2076
 * Return:      Success:    0
2077
 *              Failure:    -1
2078
 *
2079
 *-------------------------------------------------------------------------
2080
 */
2081
static herr_t
2082
H5VL_pass_through_group_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
2083
0
{
2084
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2085
0
    herr_t               ret_value;
2086
2087
#ifdef ENABLE_PASSTHRU_LOGGING
2088
    printf("------- PASS THROUGH VOL GROUP Optional\n");
2089
#endif
2090
2091
0
    ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
2092
2093
    /* Check for async request */
2094
0
    if (req && *req)
2095
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2096
2097
0
    return ret_value;
2098
0
} /* end H5VL_pass_through_group_optional() */
2099
2100
/*-------------------------------------------------------------------------
2101
 * Function:    H5VL_pass_through_group_close
2102
 *
2103
 * Purpose:     Closes a group.
2104
 *
2105
 * Return:      Success:    0
2106
 *              Failure:    -1, group not closed.
2107
 *
2108
 *-------------------------------------------------------------------------
2109
 */
2110
static herr_t
2111
H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
2112
0
{
2113
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)grp;
2114
0
    herr_t               ret_value;
2115
2116
#ifdef ENABLE_PASSTHRU_LOGGING
2117
    printf("------- PASS THROUGH VOL H5Gclose\n");
2118
#endif
2119
2120
0
    ret_value = H5VLgroup_close(o->under_object, o->under_vol_id, dxpl_id, req);
2121
2122
    /* Check for async request */
2123
0
    if (req && *req)
2124
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2125
2126
    /* Release our wrapper, if underlying file was closed */
2127
0
    if (ret_value >= 0)
2128
0
        H5VL_pass_through_free_obj(o);
2129
2130
0
    return ret_value;
2131
0
} /* end H5VL_pass_through_group_close() */
2132
2133
/*-------------------------------------------------------------------------
2134
 * Function:    H5VL_pass_through_link_create
2135
 *
2136
 * Purpose:     Creates a hard / soft / UD / external link.
2137
 *
2138
 * Return:      Success:    0
2139
 *              Failure:    -1
2140
 *
2141
 *-------------------------------------------------------------------------
2142
 */
2143
static herr_t
2144
H5VL_pass_through_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
2145
                              hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
2146
0
{
2147
0
    H5VL_pass_through_t *o            = (H5VL_pass_through_t *)obj;
2148
0
    hid_t                under_vol_id = -1;
2149
0
    herr_t               ret_value;
2150
2151
#ifdef ENABLE_PASSTHRU_LOGGING
2152
    printf("------- PASS THROUGH VOL LINK Create\n");
2153
#endif
2154
2155
    /* Try to retrieve the "under" VOL id */
2156
0
    if (o)
2157
0
        under_vol_id = o->under_vol_id;
2158
2159
    /* Fix up the link target object for hard link creation */
2160
0
    if (H5VL_LINK_CREATE_HARD == args->op_type) {
2161
0
        void *cur_obj = args->args.hard.curr_obj;
2162
2163
        /* If cur_obj is a non-NULL pointer, find its 'under object' and update the pointer */
2164
0
        if (cur_obj) {
2165
            /* Check if we still haven't set the "under" VOL ID */
2166
0
            if (under_vol_id < 0)
2167
0
                under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id;
2168
2169
            /* Update the object for the link target */
2170
0
            args->args.hard.curr_obj = ((H5VL_pass_through_t *)cur_obj)->under_object;
2171
0
        } /* end if */
2172
0
    }     /* end if */
2173
2174
0
    ret_value = H5VLlink_create(args, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id,
2175
0
                                lapl_id, dxpl_id, req);
2176
2177
    /* Check for async request */
2178
0
    if (req && *req)
2179
0
        *req = H5VL_pass_through_new_obj(*req, under_vol_id);
2180
2181
0
    return ret_value;
2182
0
} /* end H5VL_pass_through_link_create() */
2183
2184
/*-------------------------------------------------------------------------
2185
 * Function:    H5VL_pass_through_link_copy
2186
 *
2187
 * Purpose:     Renames an object within an HDF5 container and copies it to a new
2188
 *              group.  The original name SRC is unlinked from the group graph
2189
 *              and then inserted with the new name DST (which can specify a
2190
 *              new path for the object) as an atomic operation. The names
2191
 *              are interpreted relative to SRC_LOC_ID and
2192
 *              DST_LOC_ID, which are either file IDs or group ID.
2193
 *
2194
 * Return:      Success:    0
2195
 *              Failure:    -1
2196
 *
2197
 *-------------------------------------------------------------------------
2198
 */
2199
static herr_t
2200
H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
2201
                            const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
2202
                            void **req)
2203
0
{
2204
0
    H5VL_pass_through_t *o_src        = (H5VL_pass_through_t *)src_obj;
2205
0
    H5VL_pass_through_t *o_dst        = (H5VL_pass_through_t *)dst_obj;
2206
0
    hid_t                under_vol_id = -1;
2207
0
    herr_t               ret_value;
2208
2209
#ifdef ENABLE_PASSTHRU_LOGGING
2210
    printf("------- PASS THROUGH VOL LINK Copy\n");
2211
#endif
2212
2213
    /* Retrieve the "under" VOL id */
2214
0
    if (o_src)
2215
0
        under_vol_id = o_src->under_vol_id;
2216
0
    else if (o_dst)
2217
0
        under_vol_id = o_dst->under_vol_id;
2218
0
    assert(under_vol_id > 0);
2219
2220
0
    ret_value =
2221
0
        H5VLlink_copy((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL),
2222
0
                      loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
2223
2224
    /* Check for async request */
2225
0
    if (req && *req)
2226
0
        *req = H5VL_pass_through_new_obj(*req, under_vol_id);
2227
2228
0
    return ret_value;
2229
0
} /* end H5VL_pass_through_link_copy() */
2230
2231
/*-------------------------------------------------------------------------
2232
 * Function:    H5VL_pass_through_link_move
2233
 *
2234
 * Purpose:     Moves a link within an HDF5 file to a new group.  The original
2235
 *              name SRC is unlinked from the group graph
2236
 *              and then inserted with the new name DST (which can specify a
2237
 *              new path for the object) as an atomic operation. The names
2238
 *              are interpreted relative to SRC_LOC_ID and
2239
 *              DST_LOC_ID, which are either file IDs or group ID.
2240
 *
2241
 * Return:      Success:    0
2242
 *              Failure:    -1
2243
 *
2244
 *-------------------------------------------------------------------------
2245
 */
2246
static herr_t
2247
H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
2248
                            const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
2249
                            void **req)
2250
0
{
2251
0
    H5VL_pass_through_t *o_src        = (H5VL_pass_through_t *)src_obj;
2252
0
    H5VL_pass_through_t *o_dst        = (H5VL_pass_through_t *)dst_obj;
2253
0
    hid_t                under_vol_id = -1;
2254
0
    herr_t               ret_value;
2255
2256
#ifdef ENABLE_PASSTHRU_LOGGING
2257
    printf("------- PASS THROUGH VOL LINK Move\n");
2258
#endif
2259
2260
    /* Retrieve the "under" VOL id */
2261
0
    if (o_src)
2262
0
        under_vol_id = o_src->under_vol_id;
2263
0
    else if (o_dst)
2264
0
        under_vol_id = o_dst->under_vol_id;
2265
0
    assert(under_vol_id > 0);
2266
2267
0
    ret_value =
2268
0
        H5VLlink_move((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL),
2269
0
                      loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
2270
2271
    /* Check for async request */
2272
0
    if (req && *req)
2273
0
        *req = H5VL_pass_through_new_obj(*req, under_vol_id);
2274
2275
0
    return ret_value;
2276
0
} /* end H5VL_pass_through_link_move() */
2277
2278
/*-------------------------------------------------------------------------
2279
 * Function:    H5VL_pass_through_link_get
2280
 *
2281
 * Purpose:     Get info about a link
2282
 *
2283
 * Return:      Success:    0
2284
 *              Failure:    -1
2285
 *
2286
 *-------------------------------------------------------------------------
2287
 */
2288
static herr_t
2289
H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args,
2290
                           hid_t dxpl_id, void **req)
2291
0
{
2292
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2293
0
    herr_t               ret_value;
2294
2295
#ifdef ENABLE_PASSTHRU_LOGGING
2296
    printf("------- PASS THROUGH VOL LINK Get\n");
2297
#endif
2298
2299
0
    ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
2300
2301
    /* Check for async request */
2302
0
    if (req && *req)
2303
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2304
2305
0
    return ret_value;
2306
0
} /* end H5VL_pass_through_link_get() */
2307
2308
/*-------------------------------------------------------------------------
2309
 * Function:    H5VL_pass_through_link_specific
2310
 *
2311
 * Purpose:     Specific operation on a link
2312
 *
2313
 * Return:      Success:    0
2314
 *              Failure:    -1
2315
 *
2316
 *-------------------------------------------------------------------------
2317
 */
2318
static herr_t
2319
H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
2320
                                H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req)
2321
0
{
2322
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2323
0
    herr_t               ret_value;
2324
2325
#ifdef ENABLE_PASSTHRU_LOGGING
2326
    printf("------- PASS THROUGH VOL LINK Specific\n");
2327
#endif
2328
2329
0
    ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
2330
2331
    /* Check for async request */
2332
0
    if (req && *req)
2333
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2334
2335
0
    return ret_value;
2336
0
} /* end H5VL_pass_through_link_specific() */
2337
2338
/*-------------------------------------------------------------------------
2339
 * Function:    H5VL_pass_through_link_optional
2340
 *
2341
 * Purpose:     Perform a connector-specific operation on a link
2342
 *
2343
 * Return:      Success:    0
2344
 *              Failure:    -1
2345
 *
2346
 *-------------------------------------------------------------------------
2347
 */
2348
static herr_t
2349
H5VL_pass_through_link_optional(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
2350
                                hid_t dxpl_id, void **req)
2351
0
{
2352
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2353
0
    herr_t               ret_value;
2354
2355
#ifdef ENABLE_PASSTHRU_LOGGING
2356
    printf("------- PASS THROUGH VOL LINK Optional\n");
2357
#endif
2358
2359
0
    ret_value = H5VLlink_optional(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
2360
2361
    /* Check for async request */
2362
0
    if (req && *req)
2363
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2364
2365
0
    return ret_value;
2366
0
} /* end H5VL_pass_through_link_optional() */
2367
2368
/*-------------------------------------------------------------------------
2369
 * Function:    H5VL_pass_through_object_open
2370
 *
2371
 * Purpose:     Opens an object inside a container.
2372
 *
2373
 * Return:      Success:    Pointer to object
2374
 *              Failure:    NULL
2375
 *
2376
 *-------------------------------------------------------------------------
2377
 */
2378
static void *
2379
H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
2380
                              hid_t dxpl_id, void **req)
2381
0
{
2382
0
    H5VL_pass_through_t *new_obj;
2383
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2384
0
    void                *under;
2385
2386
#ifdef ENABLE_PASSTHRU_LOGGING
2387
    printf("------- PASS THROUGH VOL OBJECT Open\n");
2388
#endif
2389
2390
0
    under = H5VLobject_open(o->under_object, loc_params, o->under_vol_id, opened_type, dxpl_id, req);
2391
0
    if (under) {
2392
0
        new_obj = H5VL_pass_through_new_obj(under, o->under_vol_id);
2393
2394
        /* Check for async request */
2395
0
        if (req && *req)
2396
0
            *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2397
0
    } /* end if */
2398
0
    else
2399
0
        new_obj = NULL;
2400
2401
0
    return (void *)new_obj;
2402
0
} /* end H5VL_pass_through_object_open() */
2403
2404
/*-------------------------------------------------------------------------
2405
 * Function:    H5VL_pass_through_object_copy
2406
 *
2407
 * Purpose:     Copies an object inside a container.
2408
 *
2409
 * Return:      Success:    0
2410
 *              Failure:    -1
2411
 *
2412
 *-------------------------------------------------------------------------
2413
 */
2414
static herr_t
2415
H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name,
2416
                              void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name,
2417
                              hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req)
2418
0
{
2419
0
    H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj;
2420
0
    H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj;
2421
0
    herr_t               ret_value;
2422
2423
#ifdef ENABLE_PASSTHRU_LOGGING
2424
    printf("------- PASS THROUGH VOL OBJECT Copy\n");
2425
#endif
2426
2427
0
    ret_value =
2428
0
        H5VLobject_copy(o_src->under_object, src_loc_params, src_name, o_dst->under_object, dst_loc_params,
2429
0
                        dst_name, o_src->under_vol_id, ocpypl_id, lcpl_id, dxpl_id, req);
2430
2431
    /* Check for async request */
2432
0
    if (req && *req)
2433
0
        *req = H5VL_pass_through_new_obj(*req, o_src->under_vol_id);
2434
2435
0
    return ret_value;
2436
0
} /* end H5VL_pass_through_object_copy() */
2437
2438
/*-------------------------------------------------------------------------
2439
 * Function:    H5VL_pass_through_object_get
2440
 *
2441
 * Purpose:     Get info about an object
2442
 *
2443
 * Return:      Success:    0
2444
 *              Failure:    -1
2445
 *
2446
 *-------------------------------------------------------------------------
2447
 */
2448
static herr_t
2449
H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_args_t *args,
2450
                             hid_t dxpl_id, void **req)
2451
0
{
2452
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2453
0
    herr_t               ret_value;
2454
2455
#ifdef ENABLE_PASSTHRU_LOGGING
2456
    printf("------- PASS THROUGH VOL OBJECT Get\n");
2457
#endif
2458
2459
0
    ret_value = H5VLobject_get(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
2460
2461
    /* Check for async request */
2462
0
    if (req && *req)
2463
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2464
2465
0
    return ret_value;
2466
0
} /* end H5VL_pass_through_object_get() */
2467
2468
/*-------------------------------------------------------------------------
2469
 * Function:    H5VL_pass_through_object_specific
2470
 *
2471
 * Purpose:     Specific operation on an object
2472
 *
2473
 * Return:      Success:    0
2474
 *              Failure:    -1
2475
 *
2476
 *-------------------------------------------------------------------------
2477
 */
2478
static herr_t
2479
H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
2480
                                  H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req)
2481
0
{
2482
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2483
0
    hid_t                under_vol_id;
2484
0
    herr_t               ret_value;
2485
2486
#ifdef ENABLE_PASSTHRU_LOGGING
2487
    printf("------- PASS THROUGH VOL OBJECT Specific\n");
2488
#endif
2489
2490
    /* Save copy of underlying VOL connector ID, in case of
2491
     * 'refresh' operation destroying the current object
2492
     */
2493
0
    under_vol_id = o->under_vol_id;
2494
2495
0
    ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
2496
2497
    /* Check for async request */
2498
0
    if (req && *req)
2499
0
        *req = H5VL_pass_through_new_obj(*req, under_vol_id);
2500
2501
0
    return ret_value;
2502
0
} /* end H5VL_pass_through_object_specific() */
2503
2504
/*-------------------------------------------------------------------------
2505
 * Function:    H5VL_pass_through_object_optional
2506
 *
2507
 * Purpose:     Perform a connector-specific operation for an object
2508
 *
2509
 * Return:      Success:    0
2510
 *              Failure:    -1
2511
 *
2512
 *-------------------------------------------------------------------------
2513
 */
2514
static herr_t
2515
H5VL_pass_through_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
2516
                                  hid_t dxpl_id, void **req)
2517
0
{
2518
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2519
0
    herr_t               ret_value;
2520
2521
#ifdef ENABLE_PASSTHRU_LOGGING
2522
    printf("------- PASS THROUGH VOL OBJECT Optional\n");
2523
#endif
2524
2525
0
    ret_value = H5VLobject_optional(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
2526
2527
    /* Check for async request */
2528
0
    if (req && *req)
2529
0
        *req = H5VL_pass_through_new_obj(*req, o->under_vol_id);
2530
2531
0
    return ret_value;
2532
0
} /* end H5VL_pass_through_object_optional() */
2533
2534
/*-------------------------------------------------------------------------
2535
 * Function:    H5VL_pass_through_introspect_get_conn_cls
2536
 *
2537
 * Purpose:     Query the connector class.
2538
 *
2539
 * Return:      SUCCEED / FAIL
2540
 *
2541
 *-------------------------------------------------------------------------
2542
 */
2543
herr_t
2544
H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls)
2545
0
{
2546
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2547
0
    herr_t               ret_value;
2548
2549
#ifdef ENABLE_PASSTHRU_LOGGING
2550
    printf("------- PASS THROUGH VOL INTROSPECT GetConnCls\n");
2551
#endif
2552
2553
    /* Check for querying this connector's class */
2554
0
    if (H5VL_GET_CONN_LVL_CURR == lvl) {
2555
0
        *conn_cls = &H5VL_pass_through_g;
2556
0
        ret_value = 0;
2557
0
    } /* end if */
2558
0
    else
2559
0
        ret_value = H5VLintrospect_get_conn_cls(o->under_object, o->under_vol_id, lvl, conn_cls);
2560
2561
0
    return ret_value;
2562
0
} /* end H5VL_pass_through_introspect_get_conn_cls() */
2563
2564
/*-------------------------------------------------------------------------
2565
 * Function:    H5VL_pass_through_introspect_get_cap_flags
2566
 *
2567
 * Purpose:     Query the capability flags for this connector and any
2568
 *              underlying connector(s).
2569
 *
2570
 * Return:      SUCCEED / FAIL
2571
 *
2572
 *-------------------------------------------------------------------------
2573
 */
2574
herr_t
2575
H5VL_pass_through_introspect_get_cap_flags(const void *_info, uint64_t *cap_flags)
2576
0
{
2577
0
    const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info;
2578
0
    herr_t                          ret_value;
2579
2580
#ifdef ENABLE_PASSTHRU_LOGGING
2581
    printf("------- PASS THROUGH VOL INTROSPECT GetCapFlags\n");
2582
#endif
2583
2584
    /* Make sure the underneath VOL of this pass-through VOL is specified */
2585
0
    if (!info) {
2586
0
        printf("\nH5VLpassthru.c line %d in %s: info for pass-through VOL can't be null\n", __LINE__,
2587
0
               __func__);
2588
0
        return -1;
2589
0
    }
2590
2591
0
    if (H5Iis_valid(info->under_vol_id) <= 0) {
2592
0
        printf("\nH5VLpassthru.c line %d in %s: not a valid underneath VOL ID for pass-through VOL\n",
2593
0
               __LINE__, __func__);
2594
0
        return -1;
2595
0
    }
2596
2597
    /* Invoke the query on the underlying VOL connector */
2598
0
    ret_value = H5VLintrospect_get_cap_flags(info->under_vol_info, info->under_vol_id, cap_flags);
2599
2600
    /* Bitwise OR our capability flags in */
2601
0
    if (ret_value >= 0)
2602
0
        *cap_flags |= H5VL_pass_through_g.cap_flags;
2603
2604
0
    return ret_value;
2605
0
} /* end H5VL_pass_through_introspect_get_cap_flags() */
2606
2607
/*-------------------------------------------------------------------------
2608
 * Function:    H5VL_pass_through_introspect_opt_query
2609
 *
2610
 * Purpose:     Query if an optional operation is supported by this connector
2611
 *
2612
 * Return:      SUCCEED / FAIL
2613
 *
2614
 *-------------------------------------------------------------------------
2615
 */
2616
herr_t
2617
H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, uint64_t *flags)
2618
0
{
2619
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2620
0
    herr_t               ret_value;
2621
2622
#ifdef ENABLE_PASSTHRU_LOGGING
2623
    printf("------- PASS THROUGH VOL INTROSPECT OptQuery\n");
2624
#endif
2625
2626
0
    ret_value = H5VLintrospect_opt_query(o->under_object, o->under_vol_id, cls, opt_type, flags);
2627
2628
0
    return ret_value;
2629
0
} /* end H5VL_pass_through_introspect_opt_query() */
2630
2631
/*-------------------------------------------------------------------------
2632
 * Function:    H5VL_pass_through_request_wait
2633
 *
2634
 * Purpose:     Wait (with a timeout) for an async operation to complete
2635
 *
2636
 * Note:        Releases the request if the operation has completed and the
2637
 *              connector callback succeeds
2638
 *
2639
 * Return:      Success:    0
2640
 *              Failure:    -1
2641
 *
2642
 *-------------------------------------------------------------------------
2643
 */
2644
static herr_t
2645
H5VL_pass_through_request_wait(void *obj, uint64_t timeout, H5VL_request_status_t *status)
2646
0
{
2647
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2648
0
    herr_t               ret_value;
2649
2650
#ifdef ENABLE_PASSTHRU_LOGGING
2651
    printf("------- PASS THROUGH VOL REQUEST Wait\n");
2652
#endif
2653
2654
0
    ret_value = H5VLrequest_wait(o->under_object, o->under_vol_id, timeout, status);
2655
2656
0
    if (ret_value >= 0 && *status != H5VL_REQUEST_STATUS_IN_PROGRESS)
2657
0
        H5VL_pass_through_free_obj(o);
2658
2659
0
    return ret_value;
2660
0
} /* end H5VL_pass_through_request_wait() */
2661
2662
/*-------------------------------------------------------------------------
2663
 * Function:    H5VL_pass_through_request_notify
2664
 *
2665
 * Purpose:     Registers a user callback to be invoked when an asynchronous
2666
 *              operation completes
2667
 *
2668
 * Note:        Releases the request, if connector callback succeeds
2669
 *
2670
 * Return:      Success:    0
2671
 *              Failure:    -1
2672
 *
2673
 *-------------------------------------------------------------------------
2674
 */
2675
static herr_t
2676
H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx)
2677
0
{
2678
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2679
0
    herr_t               ret_value;
2680
2681
#ifdef ENABLE_PASSTHRU_LOGGING
2682
    printf("------- PASS THROUGH VOL REQUEST Notify\n");
2683
#endif
2684
2685
0
    ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx);
2686
2687
0
    if (ret_value >= 0)
2688
0
        H5VL_pass_through_free_obj(o);
2689
2690
0
    return ret_value;
2691
0
} /* end H5VL_pass_through_request_notify() */
2692
2693
/*-------------------------------------------------------------------------
2694
 * Function:    H5VL_pass_through_request_cancel
2695
 *
2696
 * Purpose:     Cancels an asynchronous operation
2697
 *
2698
 * Note:        Releases the request, if connector callback succeeds
2699
 *
2700
 * Return:      Success:    0
2701
 *              Failure:    -1
2702
 *
2703
 *-------------------------------------------------------------------------
2704
 */
2705
static herr_t
2706
H5VL_pass_through_request_cancel(void *obj, H5VL_request_status_t *status)
2707
0
{
2708
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2709
0
    herr_t               ret_value;
2710
2711
#ifdef ENABLE_PASSTHRU_LOGGING
2712
    printf("------- PASS THROUGH VOL REQUEST Cancel\n");
2713
#endif
2714
2715
0
    ret_value = H5VLrequest_cancel(o->under_object, o->under_vol_id, status);
2716
2717
0
    if (ret_value >= 0)
2718
0
        H5VL_pass_through_free_obj(o);
2719
2720
0
    return ret_value;
2721
0
} /* end H5VL_pass_through_request_cancel() */
2722
2723
/*-------------------------------------------------------------------------
2724
 * Function:    H5VL_pass_through_request_specific
2725
 *
2726
 * Purpose:     Specific operation on a request
2727
 *
2728
 * Return:      Success:    0
2729
 *              Failure:    -1
2730
 *
2731
 *-------------------------------------------------------------------------
2732
 */
2733
static herr_t
2734
H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_args_t *args)
2735
0
{
2736
0
    H5VL_pass_through_t *o         = (H5VL_pass_through_t *)obj;
2737
0
    herr_t               ret_value = -1;
2738
2739
#ifdef ENABLE_PASSTHRU_LOGGING
2740
    printf("------- PASS THROUGH VOL REQUEST Specific\n");
2741
#endif
2742
2743
0
    ret_value = H5VLrequest_specific(o->under_object, o->under_vol_id, args);
2744
2745
0
    return ret_value;
2746
0
} /* end H5VL_pass_through_request_specific() */
2747
2748
/*-------------------------------------------------------------------------
2749
 * Function:    H5VL_pass_through_request_optional
2750
 *
2751
 * Purpose:     Perform a connector-specific operation for a request
2752
 *
2753
 * Return:      Success:    0
2754
 *              Failure:    -1
2755
 *
2756
 *-------------------------------------------------------------------------
2757
 */
2758
static herr_t
2759
H5VL_pass_through_request_optional(void *obj, H5VL_optional_args_t *args)
2760
0
{
2761
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2762
0
    herr_t               ret_value;
2763
2764
#ifdef ENABLE_PASSTHRU_LOGGING
2765
    printf("------- PASS THROUGH VOL REQUEST Optional\n");
2766
#endif
2767
2768
0
    ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, args);
2769
2770
0
    return ret_value;
2771
0
} /* end H5VL_pass_through_request_optional() */
2772
2773
/*-------------------------------------------------------------------------
2774
 * Function:    H5VL_pass_through_request_free
2775
 *
2776
 * Purpose:     Releases a request, allowing the operation to complete without
2777
 *              application tracking
2778
 *
2779
 * Return:      Success:    0
2780
 *              Failure:    -1
2781
 *
2782
 *-------------------------------------------------------------------------
2783
 */
2784
static herr_t
2785
H5VL_pass_through_request_free(void *obj)
2786
0
{
2787
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2788
0
    herr_t               ret_value;
2789
2790
#ifdef ENABLE_PASSTHRU_LOGGING
2791
    printf("------- PASS THROUGH VOL REQUEST Free\n");
2792
#endif
2793
2794
0
    ret_value = H5VLrequest_free(o->under_object, o->under_vol_id);
2795
2796
0
    if (ret_value >= 0)
2797
0
        H5VL_pass_through_free_obj(o);
2798
2799
0
    return ret_value;
2800
0
} /* end H5VL_pass_through_request_free() */
2801
2802
/*-------------------------------------------------------------------------
2803
 * Function:    H5VL_pass_through_blob_put
2804
 *
2805
 * Purpose:     Handles the blob 'put' callback
2806
 *
2807
 * Return:      SUCCEED / FAIL
2808
 *
2809
 *-------------------------------------------------------------------------
2810
 */
2811
herr_t
2812
H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx)
2813
0
{
2814
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2815
0
    herr_t               ret_value;
2816
2817
#ifdef ENABLE_PASSTHRU_LOGGING
2818
    printf("------- PASS THROUGH VOL BLOB Put\n");
2819
#endif
2820
2821
0
    ret_value = H5VLblob_put(o->under_object, o->under_vol_id, buf, size, blob_id, ctx);
2822
2823
0
    return ret_value;
2824
0
} /* end H5VL_pass_through_blob_put() */
2825
2826
/*-------------------------------------------------------------------------
2827
 * Function:    H5VL_pass_through_blob_get
2828
 *
2829
 * Purpose:     Handles the blob 'get' callback
2830
 *
2831
 * Return:      SUCCEED / FAIL
2832
 *
2833
 *-------------------------------------------------------------------------
2834
 */
2835
herr_t
2836
H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx)
2837
0
{
2838
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2839
0
    herr_t               ret_value;
2840
2841
#ifdef ENABLE_PASSTHRU_LOGGING
2842
    printf("------- PASS THROUGH VOL BLOB Get\n");
2843
#endif
2844
2845
0
    ret_value = H5VLblob_get(o->under_object, o->under_vol_id, blob_id, buf, size, ctx);
2846
2847
0
    return ret_value;
2848
0
} /* end H5VL_pass_through_blob_get() */
2849
2850
/*-------------------------------------------------------------------------
2851
 * Function:    H5VL_pass_through_blob_specific
2852
 *
2853
 * Purpose:     Handles the blob 'specific' callback
2854
 *
2855
 * Return:      SUCCEED / FAIL
2856
 *
2857
 *-------------------------------------------------------------------------
2858
 */
2859
herr_t
2860
H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args)
2861
0
{
2862
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2863
0
    herr_t               ret_value;
2864
2865
#ifdef ENABLE_PASSTHRU_LOGGING
2866
    printf("------- PASS THROUGH VOL BLOB Specific\n");
2867
#endif
2868
2869
0
    ret_value = H5VLblob_specific(o->under_object, o->under_vol_id, blob_id, args);
2870
2871
0
    return ret_value;
2872
0
} /* end H5VL_pass_through_blob_specific() */
2873
2874
/*-------------------------------------------------------------------------
2875
 * Function:    H5VL_pass_through_blob_optional
2876
 *
2877
 * Purpose:     Handles the blob 'optional' callback
2878
 *
2879
 * Return:      SUCCEED / FAIL
2880
 *
2881
 *-------------------------------------------------------------------------
2882
 */
2883
herr_t
2884
H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_optional_args_t *args)
2885
0
{
2886
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2887
0
    herr_t               ret_value;
2888
2889
#ifdef ENABLE_PASSTHRU_LOGGING
2890
    printf("------- PASS THROUGH VOL BLOB Optional\n");
2891
#endif
2892
2893
0
    ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id, args);
2894
2895
0
    return ret_value;
2896
0
} /* end H5VL_pass_through_blob_optional() */
2897
2898
/*---------------------------------------------------------------------------
2899
 * Function:    H5VL_pass_through_token_cmp
2900
 *
2901
 * Purpose:     Compare two of the connector's object tokens, setting
2902
 *              *cmp_value, following the same rules as strcmp().
2903
 *
2904
 * Return:      Success:    0
2905
 *              Failure:    -1
2906
 *
2907
 *---------------------------------------------------------------------------
2908
 */
2909
static herr_t
2910
H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value)
2911
0
{
2912
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2913
0
    herr_t               ret_value;
2914
2915
#ifdef ENABLE_PASSTHRU_LOGGING
2916
    printf("------- PASS THROUGH VOL TOKEN Compare\n");
2917
#endif
2918
2919
    /* Sanity checks */
2920
0
    assert(obj);
2921
0
    assert(token1);
2922
0
    assert(token2);
2923
0
    assert(cmp_value);
2924
2925
0
    ret_value = H5VLtoken_cmp(o->under_object, o->under_vol_id, token1, token2, cmp_value);
2926
2927
0
    return ret_value;
2928
0
} /* end H5VL_pass_through_token_cmp() */
2929
2930
/*---------------------------------------------------------------------------
2931
 * Function:    H5VL_pass_through_token_to_str
2932
 *
2933
 * Purpose:     Serialize the connector's object token into a string.
2934
 *
2935
 * Return:      Success:    0
2936
 *              Failure:    -1
2937
 *
2938
 *---------------------------------------------------------------------------
2939
 */
2940
static herr_t
2941
H5VL_pass_through_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str)
2942
0
{
2943
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2944
0
    herr_t               ret_value;
2945
2946
#ifdef ENABLE_PASSTHRU_LOGGING
2947
    printf("------- PASS THROUGH VOL TOKEN To string\n");
2948
#endif
2949
2950
    /* Sanity checks */
2951
0
    assert(obj);
2952
0
    assert(token);
2953
0
    assert(token_str);
2954
2955
0
    ret_value = H5VLtoken_to_str(o->under_object, obj_type, o->under_vol_id, token, token_str);
2956
2957
0
    return ret_value;
2958
0
} /* end H5VL_pass_through_token_to_str() */
2959
2960
/*---------------------------------------------------------------------------
2961
 * Function:    H5VL_pass_through_token_from_str
2962
 *
2963
 * Purpose:     Deserialize the connector's object token from a string.
2964
 *
2965
 * Return:      Success:    0
2966
 *              Failure:    -1
2967
 *
2968
 *---------------------------------------------------------------------------
2969
 */
2970
static herr_t
2971
H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token)
2972
0
{
2973
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
2974
0
    herr_t               ret_value;
2975
2976
#ifdef ENABLE_PASSTHRU_LOGGING
2977
    printf("------- PASS THROUGH VOL TOKEN From string\n");
2978
#endif
2979
2980
    /* Sanity checks */
2981
0
    assert(obj);
2982
0
    assert(token);
2983
0
    assert(token_str);
2984
2985
0
    ret_value = H5VLtoken_from_str(o->under_object, obj_type, o->under_vol_id, token_str, token);
2986
2987
0
    return ret_value;
2988
0
} /* end H5VL_pass_through_token_from_str() */
2989
2990
/*-------------------------------------------------------------------------
2991
 * Function:    H5VL_pass_through_optional
2992
 *
2993
 * Purpose:     Handles the generic 'optional' callback
2994
 *
2995
 * Return:      SUCCEED / FAIL
2996
 *
2997
 *-------------------------------------------------------------------------
2998
 */
2999
herr_t
3000
H5VL_pass_through_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
3001
0
{
3002
0
    H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
3003
0
    herr_t               ret_value;
3004
3005
#ifdef ENABLE_PASSTHRU_LOGGING
3006
    printf("------- PASS THROUGH VOL generic Optional\n");
3007
#endif
3008
3009
0
    ret_value = H5VLoptional(o->under_object, o->under_vol_id, args, dxpl_id, req);
3010
3011
0
    return ret_value;
3012
0
} /* end H5VL_pass_through_optional() */