Coverage Report

Created: 2026-11-23 00:10

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hdf5/src/H5Oshared.h
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 file contains inline definitions for "generic" routines
15
 *          supporting a "shared message interface" (ala Java) for object
16
 *          header messages that can be shared.  This interface is
17
 *          dependent on a bunch of macros being defined which define
18
 *          the name of the interface and "real" methods which need to
19
 *          be implemented for each message class that supports the
20
 *          shared message interface.
21
 */
22
23
#ifndef H5Oshared_H
24
#define H5Oshared_H
25
26
/*-------------------------------------------------------------------------
27
 * Function:    H5O_SHARED_DECODE
28
 *
29
 * Purpose:     Decode an object header message that may be shared.
30
 *
31
 * Note:      The actual name of this routine can be different in each source
32
 *              file that this header file is included in, and must be defined
33
 *              prior to including this header file.
34
 *
35
 * Return:      Success:    Pointer to the new message in native form
36
 *              Failure:    NULL
37
 *-------------------------------------------------------------------------
38
 */
39
static inline void *
40
H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size,
41
                  const uint8_t *p)
42
47.4k
{
43
47.4k
    void *ret_value = NULL; /* Return value */
44
45
    /* H5O_SHARED_DECODE will be defined as a package function */
46
47.4k
    FUNC_ENTER_PACKAGE
47
48
#ifndef H5O_SHARED_TYPE
49
#error "Need to define H5O_SHARED_TYPE macro!"
50
#endif /* H5O_SHARED_TYPE */
51
#ifndef H5O_SHARED_DECODE
52
#error "Need to define H5O_SHARED_DECODE macro!"
53
#endif /* H5O_SHARED_DECODE */
54
#ifndef H5O_SHARED_DECODE_REAL
55
#error "Need to define H5O_SHARED_DECODE_REAL macro!"
56
#endif /* H5O_SHARED_DECODE_REAL */
57
58
    /* Check for shared message */
59
47.4k
    if (mesg_flags & H5O_MSG_FLAG_SHARED) {
60
        /* Retrieve native message info indirectly through shared message */
61
40
        if (NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p_size, p, H5O_SHARED_TYPE)))
62
40
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message");
63
64
            /* We currently do not support automatically fixing shared messages */
65
#ifdef H5_STRICT_FORMAT_CHECKS
66
        if (*ioflags & H5O_DECODEIO_DIRTY)
67
            HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to mark shared message dirty");
68
#else  /* H5_STRICT_FORMAT_CHECKS */
69
0
        *ioflags &= ~H5O_DECODEIO_DIRTY;
70
0
#endif /* H5_STRICT_FORMAT_CHECKS */
71
0
    }  /* end if */
72
47.4k
    else {
73
        /* Decode native message directly */
74
47.4k
        if (NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, open_oh, mesg_flags, ioflags, p_size, p)))
75
308
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message");
76
47.4k
    } /* end else */
77
78
47.4k
done:
79
47.4k
    FUNC_LEAVE_NOAPI(ret_value)
80
47.4k
} /* end H5O_SHARED_DECODE() */
H5Oattr.c:H5O__attr_shared_decode
Line
Count
Source
42
10.4k
{
43
10.4k
    void *ret_value = NULL; /* Return value */
44
45
    /* H5O_SHARED_DECODE will be defined as a package function */
46
10.4k
    FUNC_ENTER_PACKAGE
47
48
#ifndef H5O_SHARED_TYPE
49
#error "Need to define H5O_SHARED_TYPE macro!"
50
#endif /* H5O_SHARED_TYPE */
51
#ifndef H5O_SHARED_DECODE
52
#error "Need to define H5O_SHARED_DECODE macro!"
53
#endif /* H5O_SHARED_DECODE */
54
#ifndef H5O_SHARED_DECODE_REAL
55
#error "Need to define H5O_SHARED_DECODE_REAL macro!"
56
#endif /* H5O_SHARED_DECODE_REAL */
57
58
    /* Check for shared message */
59
10.4k
    if (mesg_flags & H5O_MSG_FLAG_SHARED) {
60
        /* Retrieve native message info indirectly through shared message */
61
0
        if (NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p_size, p, H5O_SHARED_TYPE)))
62
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message");
63
64
            /* We currently do not support automatically fixing shared messages */
65
#ifdef H5_STRICT_FORMAT_CHECKS
66
        if (*ioflags & H5O_DECODEIO_DIRTY)
67
            HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to mark shared message dirty");
68
#else  /* H5_STRICT_FORMAT_CHECKS */
69
0
        *ioflags &= ~H5O_DECODEIO_DIRTY;
70
0
#endif /* H5_STRICT_FORMAT_CHECKS */
71
0
    }  /* end if */
72
10.4k
    else {
73
        /* Decode native message directly */
74
10.4k
        if (NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, open_oh, mesg_flags, ioflags, p_size, p)))
75
143
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message");
76
10.4k
    } /* end else */
77
78
10.4k
done:
79
10.4k
    FUNC_LEAVE_NOAPI(ret_value)
80
10.4k
} /* end H5O_SHARED_DECODE() */
H5Odtype.c:H5O__dtype_shared_decode
Line
Count
Source
42
15.9k
{
43
15.9k
    void *ret_value = NULL; /* Return value */
44
45
    /* H5O_SHARED_DECODE will be defined as a package function */
46
15.9k
    FUNC_ENTER_PACKAGE
47
48
#ifndef H5O_SHARED_TYPE
49
#error "Need to define H5O_SHARED_TYPE macro!"
50
#endif /* H5O_SHARED_TYPE */
51
#ifndef H5O_SHARED_DECODE
52
#error "Need to define H5O_SHARED_DECODE macro!"
53
#endif /* H5O_SHARED_DECODE */
54
#ifndef H5O_SHARED_DECODE_REAL
55
#error "Need to define H5O_SHARED_DECODE_REAL macro!"
56
#endif /* H5O_SHARED_DECODE_REAL */
57
58
    /* Check for shared message */
59
15.9k
    if (mesg_flags & H5O_MSG_FLAG_SHARED) {
60
        /* Retrieve native message info indirectly through shared message */
61
1
        if (NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p_size, p, H5O_SHARED_TYPE)))
62
1
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message");
63
64
            /* We currently do not support automatically fixing shared messages */
65
#ifdef H5_STRICT_FORMAT_CHECKS
66
        if (*ioflags & H5O_DECODEIO_DIRTY)
67
            HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to mark shared message dirty");
68
#else  /* H5_STRICT_FORMAT_CHECKS */
69
0
        *ioflags &= ~H5O_DECODEIO_DIRTY;
70
0
#endif /* H5_STRICT_FORMAT_CHECKS */
71
0
    }  /* end if */
72
15.9k
    else {
73
        /* Decode native message directly */
74
15.9k
        if (NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, open_oh, mesg_flags, ioflags, p_size, p)))
75
119
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message");
76
15.9k
    } /* end else */
77
78
15.9k
done:
79
15.9k
    FUNC_LEAVE_NOAPI(ret_value)
80
15.9k
} /* end H5O_SHARED_DECODE() */
Unexecuted instantiation: H5Ofill.c:H5O__fill_shared_decode
H5Ofill.c:H5O__fill_new_shared_decode
Line
Count
Source
42
5.31k
{
43
5.31k
    void *ret_value = NULL; /* Return value */
44
45
    /* H5O_SHARED_DECODE will be defined as a package function */
46
5.31k
    FUNC_ENTER_PACKAGE
47
48
#ifndef H5O_SHARED_TYPE
49
#error "Need to define H5O_SHARED_TYPE macro!"
50
#endif /* H5O_SHARED_TYPE */
51
#ifndef H5O_SHARED_DECODE
52
#error "Need to define H5O_SHARED_DECODE macro!"
53
#endif /* H5O_SHARED_DECODE */
54
#ifndef H5O_SHARED_DECODE_REAL
55
#error "Need to define H5O_SHARED_DECODE_REAL macro!"
56
#endif /* H5O_SHARED_DECODE_REAL */
57
58
    /* Check for shared message */
59
5.31k
    if (mesg_flags & H5O_MSG_FLAG_SHARED) {
60
        /* Retrieve native message info indirectly through shared message */
61
28
        if (NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p_size, p, H5O_SHARED_TYPE)))
62
28
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message");
63
64
            /* We currently do not support automatically fixing shared messages */
65
#ifdef H5_STRICT_FORMAT_CHECKS
66
        if (*ioflags & H5O_DECODEIO_DIRTY)
67
            HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to mark shared message dirty");
68
#else  /* H5_STRICT_FORMAT_CHECKS */
69
0
        *ioflags &= ~H5O_DECODEIO_DIRTY;
70
0
#endif /* H5_STRICT_FORMAT_CHECKS */
71
0
    }  /* end if */
72
5.29k
    else {
73
        /* Decode native message directly */
74
5.29k
        if (NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, open_oh, mesg_flags, ioflags, p_size, p)))
75
6
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message");
76
5.29k
    } /* end else */
77
78
5.31k
done:
79
5.31k
    FUNC_LEAVE_NOAPI(ret_value)
80
5.31k
} /* end H5O_SHARED_DECODE() */
H5Opline.c:H5O__pline_shared_decode
Line
Count
Source
42
4
{
43
4
    void *ret_value = NULL; /* Return value */
44
45
    /* H5O_SHARED_DECODE will be defined as a package function */
46
4
    FUNC_ENTER_PACKAGE
47
48
#ifndef H5O_SHARED_TYPE
49
#error "Need to define H5O_SHARED_TYPE macro!"
50
#endif /* H5O_SHARED_TYPE */
51
#ifndef H5O_SHARED_DECODE
52
#error "Need to define H5O_SHARED_DECODE macro!"
53
#endif /* H5O_SHARED_DECODE */
54
#ifndef H5O_SHARED_DECODE_REAL
55
#error "Need to define H5O_SHARED_DECODE_REAL macro!"
56
#endif /* H5O_SHARED_DECODE_REAL */
57
58
    /* Check for shared message */
59
4
    if (mesg_flags & H5O_MSG_FLAG_SHARED) {
60
        /* Retrieve native message info indirectly through shared message */
61
0
        if (NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p_size, p, H5O_SHARED_TYPE)))
62
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message");
63
64
            /* We currently do not support automatically fixing shared messages */
65
#ifdef H5_STRICT_FORMAT_CHECKS
66
        if (*ioflags & H5O_DECODEIO_DIRTY)
67
            HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to mark shared message dirty");
68
#else  /* H5_STRICT_FORMAT_CHECKS */
69
0
        *ioflags &= ~H5O_DECODEIO_DIRTY;
70
0
#endif /* H5_STRICT_FORMAT_CHECKS */
71
0
    }  /* end if */
72
4
    else {
73
        /* Decode native message directly */
74
4
        if (NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, open_oh, mesg_flags, ioflags, p_size, p)))
75
4
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message");
76
4
    } /* end else */
77
78
4
done:
79
4
    FUNC_LEAVE_NOAPI(ret_value)
80
4
} /* end H5O_SHARED_DECODE() */
H5Osdspace.c:H5O__sdspace_shared_decode
Line
Count
Source
42
15.7k
{
43
15.7k
    void *ret_value = NULL; /* Return value */
44
45
    /* H5O_SHARED_DECODE will be defined as a package function */
46
15.7k
    FUNC_ENTER_PACKAGE
47
48
#ifndef H5O_SHARED_TYPE
49
#error "Need to define H5O_SHARED_TYPE macro!"
50
#endif /* H5O_SHARED_TYPE */
51
#ifndef H5O_SHARED_DECODE
52
#error "Need to define H5O_SHARED_DECODE macro!"
53
#endif /* H5O_SHARED_DECODE */
54
#ifndef H5O_SHARED_DECODE_REAL
55
#error "Need to define H5O_SHARED_DECODE_REAL macro!"
56
#endif /* H5O_SHARED_DECODE_REAL */
57
58
    /* Check for shared message */
59
15.7k
    if (mesg_flags & H5O_MSG_FLAG_SHARED) {
60
        /* Retrieve native message info indirectly through shared message */
61
11
        if (NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p_size, p, H5O_SHARED_TYPE)))
62
11
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message");
63
64
            /* We currently do not support automatically fixing shared messages */
65
#ifdef H5_STRICT_FORMAT_CHECKS
66
        if (*ioflags & H5O_DECODEIO_DIRTY)
67
            HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to mark shared message dirty");
68
#else  /* H5_STRICT_FORMAT_CHECKS */
69
0
        *ioflags &= ~H5O_DECODEIO_DIRTY;
70
0
#endif /* H5_STRICT_FORMAT_CHECKS */
71
0
    }  /* end if */
72
15.7k
    else {
73
        /* Decode native message directly */
74
15.7k
        if (NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, open_oh, mesg_flags, ioflags, p_size, p)))
75
36
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message");
76
15.7k
    } /* end else */
77
78
15.7k
done:
79
15.7k
    FUNC_LEAVE_NOAPI(ret_value)
80
15.7k
} /* end H5O_SHARED_DECODE() */
81
82
/*-------------------------------------------------------------------------
83
 * Function:    H5O_SHARED_ENCODE
84
 *
85
 * Purpose:     Encode an object header message that may be shared.
86
 *
87
 * Note:        The actual name of this routine can be different in each source
88
 *              file that this header file is included in, and must be defined
89
 *              prior to including this header file.
90
 *
91
 * Return:      SUCCEED/FAIL
92
 *-------------------------------------------------------------------------
93
 */
94
static inline herr_t
95
H5O_SHARED_ENCODE(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, uint8_t *p, const void *_mesg)
96
22
{
97
22
    const H5O_shared_t *sh_mesg =
98
22
        (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
99
22
    herr_t ret_value = SUCCEED;      /* Return value */
100
101
    /* H5O_SHARED_ENCODE will be defined as a package function */
102
22
    FUNC_ENTER_PACKAGE
103
104
#ifndef H5O_SHARED_TYPE
105
#error "Need to define H5O_SHARED_TYPE macro!"
106
#endif /* H5O_SHARED_TYPE */
107
#ifndef H5O_SHARED_ENCODE
108
#error "Need to define H5O_SHARED_ENCODE macro!"
109
#endif /* H5O_SHARED_ENCODE */
110
#ifndef H5O_SHARED_ENCODE_REAL
111
#error "Need to define H5O_SHARED_ENCODE_REAL macro!"
112
#endif /* H5O_SHARED_ENCODE_REAL */
113
114
    /* Sanity check */
115
22
    assert(sh_mesg->type == H5O_SHARE_TYPE_UNSHARED || sh_mesg->msg_type_id == H5O_SHARED_TYPE->id);
116
117
    /* Check for message stored elsewhere */
118
22
    if (H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
119
        /* Encode shared message into buffer */
120
0
        if (H5O__shared_encode(f, p, sh_mesg) < 0)
121
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message");
122
0
    } /* end if */
123
22
    else {
124
        /* Encode native message directly */
125
22
        if (H5O_SHARED_ENCODE_REAL(f, p, _mesg) < 0)
126
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message");
127
22
    } /* end else */
128
129
22
done:
130
22
    FUNC_LEAVE_NOAPI(ret_value)
131
22
} /* end H5O_SHARED_ENCODE() */
Unexecuted instantiation: H5Oattr.c:H5O__attr_shared_encode
H5Odtype.c:H5O__dtype_shared_encode
Line
Count
Source
96
22
{
97
22
    const H5O_shared_t *sh_mesg =
98
22
        (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
99
22
    herr_t ret_value = SUCCEED;      /* Return value */
100
101
    /* H5O_SHARED_ENCODE will be defined as a package function */
102
22
    FUNC_ENTER_PACKAGE
103
104
#ifndef H5O_SHARED_TYPE
105
#error "Need to define H5O_SHARED_TYPE macro!"
106
#endif /* H5O_SHARED_TYPE */
107
#ifndef H5O_SHARED_ENCODE
108
#error "Need to define H5O_SHARED_ENCODE macro!"
109
#endif /* H5O_SHARED_ENCODE */
110
#ifndef H5O_SHARED_ENCODE_REAL
111
#error "Need to define H5O_SHARED_ENCODE_REAL macro!"
112
#endif /* H5O_SHARED_ENCODE_REAL */
113
114
    /* Sanity check */
115
22
    assert(sh_mesg->type == H5O_SHARE_TYPE_UNSHARED || sh_mesg->msg_type_id == H5O_SHARED_TYPE->id);
116
117
    /* Check for message stored elsewhere */
118
22
    if (H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
119
        /* Encode shared message into buffer */
120
0
        if (H5O__shared_encode(f, p, sh_mesg) < 0)
121
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message");
122
0
    } /* end if */
123
22
    else {
124
        /* Encode native message directly */
125
22
        if (H5O_SHARED_ENCODE_REAL(f, p, _mesg) < 0)
126
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message");
127
22
    } /* end else */
128
129
22
done:
130
22
    FUNC_LEAVE_NOAPI(ret_value)
131
22
} /* end H5O_SHARED_ENCODE() */
Unexecuted instantiation: H5Ofill.c:H5O__fill_shared_encode
Unexecuted instantiation: H5Ofill.c:H5O__fill_new_shared_encode
Unexecuted instantiation: H5Opline.c:H5O__pline_shared_encode
Unexecuted instantiation: H5Osdspace.c:H5O__sdspace_shared_encode
132
133
/*-------------------------------------------------------------------------
134
 * Function:    H5O_SHARED_SIZE
135
 *
136
 * Purpose:     Returns the length of an encoded message.
137
 *
138
 * Note:        The actual name of this routine can be different in each source
139
 *              file that this header file is included in, and must be defined
140
 *              prior to including this header file.
141
 *
142
 * Return:      Success:    Length
143
 *              Failure:  0
144
 *-------------------------------------------------------------------------
145
 */
146
static inline size_t
147
H5O_SHARED_SIZE(const H5F_t *f, bool disable_shared, const void *_mesg)
148
44
{
149
44
    const H5O_shared_t *sh_mesg =
150
44
        (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
151
44
    size_t ret_value = 0;            /* Return value */
152
153
    /* H5O_SHARED_SIZE will be defined as a package function */
154
44
    FUNC_ENTER_PACKAGE
155
156
#ifndef H5O_SHARED_TYPE
157
#error "Need to define H5O_SHARED_TYPE macro!"
158
#endif /* H5O_SHARED_TYPE */
159
#ifndef H5O_SHARED_SIZE
160
#error "Need to define H5O_SHARED_SIZE macro!"
161
#endif /* H5O_SHARED_SIZE */
162
#ifndef H5O_SHARED_SIZE_REAL
163
#error "Need to define H5O_SHARED_SIZE_REAL macro!"
164
#endif /* H5O_SHARED_SIZE_REAL */
165
166
    /* Check for message stored elsewhere */
167
44
    if (H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
168
        /* Retrieve encoded size of shared message */
169
0
        if (0 == (ret_value = H5O__shared_size(f, sh_mesg)))
170
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message");
171
0
    } /* end if */
172
44
    else {
173
        /* Retrieve size of native message directly */
174
44
        if (0 == (ret_value = H5O_SHARED_SIZE_REAL(f, _mesg)))
175
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message");
176
44
    } /* end else */
177
178
44
done:
179
44
    FUNC_LEAVE_NOAPI(ret_value)
180
44
} /* end H5O_SHARED_SIZE() */
Unexecuted instantiation: H5Oattr.c:H5O__attr_shared_size
H5Odtype.c:H5O__dtype_shared_size
Line
Count
Source
148
44
{
149
44
    const H5O_shared_t *sh_mesg =
150
44
        (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
151
44
    size_t ret_value = 0;            /* Return value */
152
153
    /* H5O_SHARED_SIZE will be defined as a package function */
154
44
    FUNC_ENTER_PACKAGE
155
156
#ifndef H5O_SHARED_TYPE
157
#error "Need to define H5O_SHARED_TYPE macro!"
158
#endif /* H5O_SHARED_TYPE */
159
#ifndef H5O_SHARED_SIZE
160
#error "Need to define H5O_SHARED_SIZE macro!"
161
#endif /* H5O_SHARED_SIZE */
162
#ifndef H5O_SHARED_SIZE_REAL
163
#error "Need to define H5O_SHARED_SIZE_REAL macro!"
164
#endif /* H5O_SHARED_SIZE_REAL */
165
166
    /* Check for message stored elsewhere */
167
44
    if (H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
168
        /* Retrieve encoded size of shared message */
169
0
        if (0 == (ret_value = H5O__shared_size(f, sh_mesg)))
170
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message");
171
0
    } /* end if */
172
44
    else {
173
        /* Retrieve size of native message directly */
174
44
        if (0 == (ret_value = H5O_SHARED_SIZE_REAL(f, _mesg)))
175
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message");
176
44
    } /* end else */
177
178
44
done:
179
44
    FUNC_LEAVE_NOAPI(ret_value)
180
44
} /* end H5O_SHARED_SIZE() */
Unexecuted instantiation: H5Ofill.c:H5O__fill_shared_size
Unexecuted instantiation: H5Ofill.c:H5O__fill_new_shared_size
Unexecuted instantiation: H5Opline.c:H5O__pline_shared_size
Unexecuted instantiation: H5Osdspace.c:H5O__sdspace_shared_size
181
182
/*-------------------------------------------------------------------------
183
 * Function:    H5O_SHARED_DELETE
184
 *
185
 * Purpose:     Decrement reference count on any objects referenced by
186
 *              message
187
 *
188
 * Note:        The actual name of this routine can be different in each source
189
 *              file that this header file is included in, and must be defined
190
 *              prior to including this header file.
191
 *
192
 * Return:      SUCCEED/FAIL
193
 *-------------------------------------------------------------------------
194
 */
195
static inline herr_t
196
H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg)
197
0
{
198
0
    H5O_shared_t *sh_mesg   = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
199
0
    herr_t        ret_value = SUCCEED;               /* Return value */
200
201
    /* H5O_SHARED_DELETE will be defined as a package function */
202
0
    FUNC_ENTER_PACKAGE
203
204
#ifndef H5O_SHARED_TYPE
205
#error "Need to define H5O_SHARED_TYPE macro!"
206
#endif /* H5O_SHARED_TYPE */
207
#ifndef H5O_SHARED_DELETE
208
#error "Need to define H5O_SHARED_DELETE macro!"
209
#endif /* H5O_SHARED_DELETE */
210
211
    /* Check for message tracked elsewhere */
212
0
    if (H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
213
        /* Decrement the reference count on the shared message/object */
214
0
        if (H5O__shared_delete(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
215
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message");
216
0
    } /* end if */
217
#ifdef H5O_SHARED_DELETE_REAL
218
0
    else {
219
        /* Decrement the reference count on the native message directly */
220
0
        if (H5O_SHARED_DELETE_REAL(f, open_oh, _mesg) < 0)
221
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message");
222
0
    }  /* end else */
223
0
#endif /* H5O_SHARED_DELETE_REAL */
224
225
0
done:
226
0
    FUNC_LEAVE_NOAPI(ret_value)
227
0
} /* end H5O_SHARED_DELETE() */
Unexecuted instantiation: H5Oattr.c:H5O__attr_shared_delete
Unexecuted instantiation: H5Odtype.c:H5O__dtype_shared_delete
Unexecuted instantiation: H5Ofill.c:H5O__fill_shared_delete
Unexecuted instantiation: H5Ofill.c:H5O__fill_new_shared_delete
Unexecuted instantiation: H5Opline.c:H5O__pline_shared_delete
Unexecuted instantiation: H5Osdspace.c:H5O__sdspace_shared_delete
228
229
/*-------------------------------------------------------------------------
230
 * Function:    H5O_SHARED_LINK
231
 *
232
 * Purpose:     Increment reference count on any objects referenced by
233
 *              message
234
 *
235
 * Note:        The actual name of this routine can be different in each source
236
 *              file that this header file is included in, and must be defined
237
 *              prior to including this header file.
238
 *
239
 * Return:      SUCCEED/FAIL
240
 *-------------------------------------------------------------------------
241
 */
242
static inline herr_t
243
H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg)
244
0
{
245
0
    H5O_shared_t *sh_mesg   = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
246
0
    herr_t        ret_value = SUCCEED;               /* Return value */
247
248
    /* H5O_SHARED_LINK will be defined as a package function */
249
0
    FUNC_ENTER_PACKAGE
250
251
#ifndef H5O_SHARED_TYPE
252
#error "Need to define H5O_SHARED_TYPE macro!"
253
#endif /* H5O_SHARED_TYPE */
254
#ifndef H5O_SHARED_LINK
255
#error "Need to define H5O_SHARED_LINK macro!"
256
#endif /* H5O_SHARED_LINK */
257
258
    /* Check for message tracked elsewhere */
259
0
    if (H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
260
        /* Increment the reference count on the shared message/object */
261
0
        if (H5O__shared_link(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
262
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message");
263
0
    } /* end if */
264
#ifdef H5O_SHARED_LINK_REAL
265
0
    else {
266
        /* Increment the reference count on the native message directly */
267
0
        if (H5O_SHARED_LINK_REAL(f, open_oh, _mesg) < 0)
268
0
            HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message");
269
0
    }  /* end else */
270
0
#endif /* H5O_SHARED_LINK_REAL */
271
272
0
done:
273
0
    FUNC_LEAVE_NOAPI(ret_value)
274
0
} /* end H5O_SHARED_LINK() */
Unexecuted instantiation: H5Oattr.c:H5O__attr_shared_link
Unexecuted instantiation: H5Odtype.c:H5O__dtype_shared_link
Unexecuted instantiation: H5Ofill.c:H5O__fill_shared_link
Unexecuted instantiation: H5Ofill.c:H5O__fill_new_shared_link
Unexecuted instantiation: H5Opline.c:H5O__pline_shared_link
Unexecuted instantiation: H5Osdspace.c:H5O__sdspace_shared_link
275
276
/*-------------------------------------------------------------------------
277
 * Function:    H5O_SHARED_COPY_FILE
278
 *
279
 * Purpose:     Copies a message from _SRC to _DEST in file
280
 *
281
 * Note:        The actual name of this routine can be different in each source
282
 *              file that this header file is included in, and must be defined
283
 *              prior to including this header file.
284
 *
285
 * Return:      SUCCEED/FAIL
286
 *-------------------------------------------------------------------------
287
 */
288
static inline void *
289
H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, bool *recompute_size,
290
                     unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata)
291
0
{
292
0
    void *dst_mesg  = NULL; /* Destination message */
293
0
    void *ret_value = NULL; /* Return value */
294
295
    /* H5O_SHARED_COPY_FILE will be defined as a package function */
296
0
    FUNC_ENTER_PACKAGE
297
298
#ifndef H5O_SHARED_TYPE
299
#error "Need to define H5O_SHARED_TYPE macro!"
300
#endif /* H5O_SHARED_TYPE */
301
#ifndef H5O_SHARED_COPY_FILE
302
#error "Need to define H5O_SHARED_COPY_FILE macro!"
303
#endif /* H5O_SHARED_COPY_FILE */
304
305
#ifdef H5O_SHARED_COPY_FILE_REAL
306
    /* Call native message's copy file callback to copy the message */
307
0
    if (NULL == (dst_mesg = H5O_SHARED_COPY_FILE_REAL(file_src, H5O_SHARED_TYPE, _native_src, file_dst,
308
0
                                                      recompute_size, cpy_info, udata)))
309
0
        HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message to another file");
310
#else  /* H5O_SHARED_COPY_FILE_REAL */
311
    /* No copy file callback defined, just copy the message itself */
312
0
    if (NULL == (dst_mesg = (H5O_SHARED_TYPE->copy)(_native_src, NULL)))
313
0
        HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message");
314
0
#endif /* H5O_SHARED_COPY_FILE_REAL */
315
316
    /* Reset shared message info for new message */
317
0
    memset(dst_mesg, 0, sizeof(H5O_shared_t));
318
319
    /* Handle sharing destination message */
320
0
    if (H5O__shared_copy_file(file_src, file_dst, H5O_SHARED_TYPE, _native_src, dst_mesg, recompute_size,
321
0
                              mesg_flags, cpy_info, udata) < 0)
322
0
        HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "unable to determine if message should be shared");
323
324
    /* Set return value */
325
0
    ret_value = dst_mesg;
326
327
0
done:
328
0
    if (!ret_value)
329
0
        if (dst_mesg)
330
0
            H5O_msg_free(H5O_SHARED_TYPE->id, dst_mesg);
331
332
0
    FUNC_LEAVE_NOAPI(ret_value)
333
0
} /* end H5O_SHARED_COPY_FILE() */
Unexecuted instantiation: H5Oattr.c:H5O__attr_shared_copy_file
Unexecuted instantiation: H5Odtype.c:H5O__dtype_shared_copy_file
Unexecuted instantiation: H5Ofill.c:H5O__fill_shared_copy_file
Unexecuted instantiation: H5Ofill.c:H5O__fill_new_shared_copy_file
Unexecuted instantiation: H5Opline.c:H5O__pline_shared_copy_file
Unexecuted instantiation: H5Osdspace.c:H5O__sdspace_shared_copy_file
334
335
/*-------------------------------------------------------------------------
336
 * Function:    H5O_SHARED_POST_COPY_FILE
337
 *
338
 * Purpose:     Copies a message from _SRC to _DEST in file
339
 *
340
 * Note:        The actual name of this routine can be different in each source
341
 *              file that this header file is included in, and must be defined
342
 *              prior to including this header file.
343
 *
344
 * Return:      SUCCEED/FAIL
345
 *-------------------------------------------------------------------------
346
 */
347
static inline herr_t
348
H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const void *mesg_src,
349
                          H5O_loc_t *oloc_dst, void *mesg_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info)
350
0
{
351
0
    const H5O_shared_t *shared_src =
352
0
        (const H5O_shared_t *)mesg_src;                  /* Alias to shared info in native source */
353
0
    H5O_shared_t *shared_dst = (H5O_shared_t *)mesg_dst; /* Alias to shared info in native destination */
354
0
    herr_t        ret_value  = SUCCEED;                  /* Return value */
355
356
    /* H5O_SHARED_POST_COPY_FILE will be defined as a package function */
357
0
    FUNC_ENTER_PACKAGE
358
359
0
    assert(oloc_src->file);
360
0
    assert(oloc_dst->file);
361
0
    assert(mesg_src);
362
0
    assert(mesg_dst);
363
0
    assert(cpy_info);
364
365
#ifndef H5O_SHARED_TYPE
366
#error "Need to define H5O_SHARED_TYPE macro!"
367
#endif /* H5O_SHARED_TYPE */
368
#ifndef H5O_SHARED_POST_COPY_FILE
369
#error "Need to define H5O_SHARED_POST_COPY_FILE macro!"
370
#endif /* H5O_SHARED_POST_COPY_FILE */
371
372
#ifdef H5O_SHARED_POST_COPY_FILE_REAL
373
    /* Call native message's post copy file callback to copy the message */
374
0
    if (H5O_SHARED_POST_COPY_FILE_REAL(oloc_src, mesg_src, oloc_dst, mesg_dst, cpy_info) < 0)
375
0
        HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy native message to another file");
376
0
#endif /* H5O_SHARED_POST_COPY_FILE_REAL */
377
378
    /* Update shared message after the post copy - will short circuit in
379
     * production if the DEFER pass determined it will not be shared; debug mode
380
     * verifies that it is indeed the case */
381
0
    if (H5O__shared_post_copy_file(oloc_dst->file, H5O_SHARED_TYPE, shared_src, shared_dst, mesg_flags,
382
0
                                   cpy_info) < 0)
383
0
        HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to fix shared message in post copy");
384
385
#ifdef H5O_SHARED_POST_COPY_FILE_UPD
386
    /* Call native message's post copy file update callback to update the
387
     * message */
388
0
    if (H5O_SHARED_POST_COPY_FILE_UPD(oloc_src, mesg_src, oloc_dst, mesg_dst, cpy_info) < 0)
389
0
        HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to update native message");
390
0
#endif /* H5O_SHARED_POST_COPY_FILE_UPD */
391
392
    /* Make sure that if the source or destination is committed, both are
393
     * committed */
394
0
    assert((shared_src->type == H5O_SHARE_TYPE_COMMITTED) == (shared_dst->type == H5O_SHARE_TYPE_COMMITTED));
395
396
0
done:
397
0
    FUNC_LEAVE_NOAPI(ret_value)
398
0
} /* end H5O_SHARED_POST_COPY_FILE() */
Unexecuted instantiation: H5Oattr.c:H5O__attr_shared_post_copy_file
Unexecuted instantiation: H5Odtype.c:H5O__dtype_shared_post_copy_file
Unexecuted instantiation: H5Ofill.c:H5O__fill_shared_post_copy_file
Unexecuted instantiation: H5Ofill.c:H5O__fill_new_shared_post_copy_file
Unexecuted instantiation: H5Opline.c:H5O__pline_shared_post_copy_file
Unexecuted instantiation: H5Osdspace.c:H5O__sdspace_shared_post_copy_file
399
400
/*-------------------------------------------------------------------------
401
 * Function:    H5O_SHARED_DEBUG
402
 *
403
 * Purpose:     Prints debugging info for a potentially shared message.
404
 *
405
 * Note:        The actual name of this routine can be different in each source
406
 *              file that this header file is included in, and must be defined
407
 *              prior to including this header file.
408
 *
409
 * Return:      SUCCEED/FAIL
410
 *-------------------------------------------------------------------------
411
 */
412
static inline herr_t
413
H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth)
414
0
{
415
0
    const H5O_shared_t *sh_mesg =
416
0
        (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
417
0
    herr_t ret_value = SUCCEED;      /* Return value */
418
419
    /* H5O_SHARED_DEBUG will be defined as a package function */
420
0
    FUNC_ENTER_PACKAGE
421
422
#ifndef H5O_SHARED_TYPE
423
#error "Need to define H5O_SHARED_TYPE macro!"
424
#endif /* H5O_SHARED_TYPE */
425
#ifndef H5O_SHARED_DEBUG
426
#error "Need to define H5O_SHARED_DEBUG macro!"
427
#endif /* H5O_SHARED_DEBUG */
428
#ifndef H5O_SHARED_DEBUG_REAL
429
#error "Need to define H5O_SHARED_DEBUG_REAL macro!"
430
#endif /* H5O_SHARED_DEBUG_REAL */
431
432
    /* Check for message stored elsewhere */
433
0
    if (H5O_IS_STORED_SHARED(sh_mesg->type)) {
434
        /* Print shared message information */
435
0
        if (H5O__shared_debug(sh_mesg, stream, indent, fwidth) < 0)
436
0
            HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info");
437
0
    } /* end if */
438
439
    /* Call native message's debug callback */
440
0
    if (H5O_SHARED_DEBUG_REAL(f, _mesg, stream, indent, fwidth) < 0)
441
0
        HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display native message info");
442
443
0
done:
444
0
    FUNC_LEAVE_NOAPI(ret_value)
445
0
} /* end H5O_SHARED_DEBUG() */
Unexecuted instantiation: H5Oattr.c:H5O__attr_shared_debug
Unexecuted instantiation: H5Odtype.c:H5O__dtype_shared_debug
Unexecuted instantiation: H5Ofill.c:H5O__fill_shared_debug
Unexecuted instantiation: H5Ofill.c:H5O__fill_new_shared_debug
Unexecuted instantiation: H5Opline.c:H5O__pline_shared_debug
Unexecuted instantiation: H5Osdspace.c:H5O__sdspace_shared_debug
446
447
#endif /* H5Oshared_H */