summaryrefslogtreecommitdiffstats
path: root/test/null_vfd_plugin.c
blob: 8031484d3d500b362646dc30dd88c4a850187819 (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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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:     A simple Virtual File Driver (VFD) with almost no functionality
 *              that is used for testing basic VFD plugin handling (registration, etc.).
 */

/* Public HDF5 headers */
#include "hdf5.h"

/* For HDF5 plugin functionality */
#include "H5PLextern.h"

/* This driver's header */
#include "null_vfd_plugin.h"

/* Prototypes */
static H5FD_t *H5FD_null_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
static herr_t  H5FD_null_close(H5FD_t *_file);
static herr_t  H5FD_null_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
                              void *buf);
static herr_t  H5FD_null_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
                               const void *buf);
static haddr_t H5FD_null_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t  H5FD_null_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
static haddr_t H5FD_null_get_eof(const H5FD_t *_file, H5FD_mem_t type);

static const H5FD_class_t H5FD_null_g = {
    NULL_VFD_VALUE,      /* value        */
    NULL_VFD_NAME,       /* name         */
    1,                   /* maxaddr      */
    H5F_CLOSE_WEAK,      /* fc_degree    */
    NULL,                /* terminate    */
    NULL,                /* sb_size      */
    NULL,                /* sb_encode    */
    NULL,                /* sb_decode    */
    0,                   /* fapl_size    */
    NULL,                /* fapl_get     */
    NULL,                /* fapl_copy    */
    NULL,                /* fapl_free    */
    0,                   /* dxpl_size    */
    NULL,                /* dxpl_copy    */
    NULL,                /* dxpl_free    */
    H5FD_null_open,      /* open         */
    H5FD_null_close,     /* close        */
    NULL,                /* cmp          */
    NULL,                /* query        */
    NULL,                /* get_type_map */
    NULL,                /* alloc        */
    NULL,                /* free         */
    H5FD_null_get_eoa,   /* get_eoa      */
    H5FD_null_set_eoa,   /* set_eoa      */
    H5FD_null_get_eof,   /* get_eof      */
    NULL,                /* get_handle   */
    H5FD_null_read,      /* read         */
    H5FD_null_write,     /* write        */
    NULL,                /* flush        */
    NULL,                /* truncate     */
    NULL,                /* lock         */
    NULL,                /* unlock       */
    NULL,                /* del          */
    NULL,                /* ctl          */
    H5FD_FLMAP_DICHOTOMY /* fl_map       */
};

static H5FD_t *
H5FD_null_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
    return NULL;
}

static herr_t
H5FD_null_close(H5FD_t *_file)
{
    return 0;
}

static herr_t
H5FD_null_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf)
{
    return 0;
}

static herr_t
H5FD_null_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf)
{
    return 0;
}

static haddr_t
H5FD_null_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
{
    return HADDR_UNDEF;
}

static herr_t
H5FD_null_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
{
    return 0;
}

static haddr_t
H5FD_null_get_eof(const H5FD_t *_file, H5FD_mem_t type)
{
    return HADDR_UNDEF;
}

/* These two functions are necessary to load this plugin using
 * the HDF5 library.
 */

H5PL_type_t
H5PLget_plugin_type(void)
{
    return H5PL_TYPE_VFD;
}

const void *
H5PLget_plugin_info(void)
{
    return &H5FD_null_g;
}