summaryrefslogtreecommitdiffstats
path: root/src/H5VLnative_introspect.c
blob: 4c1cb53c0db66a744f87829b46e1dfba288b2a85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the COPYING file, which can be found at the root of the source code       *
 * distribution tree, or in https://www.hdfgroup.org/licenses.               *
 * If you do not have access to either file, you may request a copy from     *
 * help@hdfgroup.org.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
 * Purpose:     Connector/container introspection callbacks for the native VOL connector
 *
 */

/****************/
/* Module Setup */
/****************/

/***********/
/* Headers */
/***********/
#include "H5private.h"   /* Generic Functions                        */
#include "H5Eprivate.h"  /* Error handling                           */
#include "H5VLprivate.h" /* Virtual Object Layer                     */

#include "H5VLnative_private.h" /* Native VOL connector                     */

/****************/
/* Local Macros */
/****************/

/******************/
/* Local Typedefs */
/******************/

/********************/
/* Local Prototypes */
/********************/

/*********************/
/* Package Variables */
/*********************/

/*****************************/
/* Library Private Variables */
/*****************************/

/*******************/
/* Local Variables */
/*******************/

/* Note: H5VL__native_introspect_get_conn_cls and H5VL__native_introspect_get_cap_flags
 *      are in src/H5VLnative.c so that they can work with the statically declared
 *      class struct.
 */

/*---------------------------------------------------------------------------
 * Function:    H5VL__native_introspect_opt_query
 *
 * Purpose:     Query if an optional operation is supported by this connector
 *
 * Returns:     SUCCEED (Can't fail)
 *
 *---------------------------------------------------------------------------
 */
herr_t
H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subcls, int opt_type,
                                  uint64_t *flags)
{
    herr_t ret_value = SUCCEED; /* Return value */

    FUNC_ENTER_PACKAGE

    /* Sanity check */
    assert(flags);

    /* The native VOL connector supports all optional operations */
    *flags = H5VL_OPT_QUERY_SUPPORTED;

    /* Set appropriate flags for each operation in each subclass */
    switch (subcls) {
        case H5VL_SUBCLS_NONE:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional 'none' operation");

        case H5VL_SUBCLS_INFO:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional info operation");

        case H5VL_SUBCLS_WRAP:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional wrapper operation");

        case H5VL_SUBCLS_ATTR:
            switch (opt_type) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
                case H5VL_NATIVE_ATTR_ITERATE_OLD:
                    /* Don't allow asynchronous execution, due to iterator callbacks */
                    *flags |= H5VL_OPT_QUERY_NO_ASYNC;
                    break;
#endif /* H5_NO_DEPRECATED_SYMBOLS */

                default:
                    HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional attribute operation");
                    break;
            } /* end switch */
            break;

        case H5VL_SUBCLS_DATASET:
            switch (opt_type) {
                case H5VL_NATIVE_DATASET_FORMAT_CONVERT:
                    *flags |= H5VL_OPT_QUERY_MODIFY_METADATA;
                    break;

                case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE:
                case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE:
                case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS:
                case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX:
                case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD:
                case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE:
                case H5VL_NATIVE_DATASET_GET_OFFSET:
                    *flags |= H5VL_OPT_QUERY_QUERY_METADATA;
                    break;

                case H5VL_NATIVE_DATASET_CHUNK_READ:
                    *flags |= H5VL_OPT_QUERY_READ_DATA;
                    break;

                case H5VL_NATIVE_DATASET_CHUNK_WRITE:
                    *flags |= H5VL_OPT_QUERY_WRITE_DATA;
                    break;

                default:
                    HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional dataset operation");
                    break;
            } /* end switch */
            break;

        case H5VL_SUBCLS_DATATYPE:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional datatype operation");

        case H5VL_SUBCLS_FILE:
            switch (opt_type) {
                case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE:
                case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE:
                case H5VL_NATIVE_FILE_SET_MDC_CONFIG:
                    *flags |= H5VL_OPT_QUERY_MODIFY_METADATA;
                    break;

                case H5VL_NATIVE_FILE_GET_FILE_IMAGE:
                    *flags |= H5VL_OPT_QUERY_QUERY_METADATA;
                    *flags |= H5VL_OPT_QUERY_READ_DATA;
                    break;

                case H5VL_NATIVE_FILE_GET_FREE_SECTIONS:
                case H5VL_NATIVE_FILE_GET_FREE_SPACE:
                case H5VL_NATIVE_FILE_GET_INFO:
                case H5VL_NATIVE_FILE_GET_MDC_CONF:
                case H5VL_NATIVE_FILE_GET_MDC_HR:
                case H5VL_NATIVE_FILE_GET_MDC_SIZE:
                case H5VL_NATIVE_FILE_GET_SIZE:
                case H5VL_NATIVE_FILE_GET_VFD_HANDLE:
                case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO:
                    *flags |= H5VL_OPT_QUERY_QUERY_METADATA;
                    break;

                case H5VL_NATIVE_FILE_START_SWMR_WRITE:
                    *flags |= H5VL_OPT_QUERY_MODIFY_METADATA;
                    *flags |= H5VL_OPT_QUERY_WRITE_DATA;
                    *flags |= H5VL_OPT_QUERY_NO_ASYNC;
                    break;

                case H5VL_NATIVE_FILE_START_MDC_LOGGING:
                case H5VL_NATIVE_FILE_STOP_MDC_LOGGING:
                case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS:
                case H5VL_NATIVE_FILE_FORMAT_CONVERT:
                case H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS:
                case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS:
                case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO:
                case H5VL_NATIVE_FILE_GET_EOA:
                case H5VL_NATIVE_FILE_INCR_FILESIZE:
                case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS:
                case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG:
                case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG:
#ifdef H5_HAVE_PARALLEL
                case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY:
                case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY:
#endif /* H5_HAVE_PARALLEL */
                case H5VL_NATIVE_FILE_POST_OPEN:
                    break;

                default:
                    HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional file operation");
                    break;
            } /* end switch */
            break;

        case H5VL_SUBCLS_GROUP:
            switch (opt_type) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
                case H5VL_NATIVE_GROUP_ITERATE_OLD:
                    /* Don't allow asynchronous execution, due to iterator callbacks */
                    *flags |= H5VL_OPT_QUERY_NO_ASYNC;
                    break;

                case H5VL_NATIVE_GROUP_GET_OBJINFO:
                    *flags |= H5VL_OPT_QUERY_QUERY_METADATA;
                    break;
#endif /* H5_NO_DEPRECATED_SYMBOLS */

                default:
                    HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional group operation");
                    break;
            } /* end switch */
            break;

        case H5VL_SUBCLS_LINK:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional link operation");

        case H5VL_SUBCLS_OBJECT:
            switch (opt_type) {
                case H5VL_NATIVE_OBJECT_GET_COMMENT:
                    *flags |= H5VL_OPT_QUERY_QUERY_METADATA;
                    break;

                case H5VL_NATIVE_OBJECT_SET_COMMENT:
                    *flags |= H5VL_OPT_QUERY_MODIFY_METADATA;
                    break;

                case H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES:
                case H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES:
                case H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED:
                    break;

                case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO:
                    *flags |= H5VL_OPT_QUERY_QUERY_METADATA;
                    break;

                default:
                    HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional object operation");
                    break;
            } /* end switch */
            break;

        case H5VL_SUBCLS_REQUEST:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional request operation");

        case H5VL_SUBCLS_BLOB:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional blob operation");

        case H5VL_SUBCLS_TOKEN:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional token operation");

        default:
            HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown H5VL subclass");
    } /* end switch */

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__native_introspect_opt_query() */