summaryrefslogtreecommitdiffstats
path: root/test/gen_new_super.c
blob: 7f27ce3922dbefa1e0b3316d30d165152de699ea (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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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:	Create a file which will have the newer superblock format.
 *		This program is used to create the test file `tsupern.h5' which
 *      has the new format for superblock information.
 *		To build the test file, this program MUST be compiled and linked with
 *      the hdf5-1.6+ series of libraries and the generated test file must be
 *      put into the 'test' directory in the 1.4+ branch of the library.
 */

#include "h5test.h"

#define TESTFILE  "tsupern.h5"
#define ISTORE_IK 64

/*-------------------------------------------------------------------------
 * Function:    main
 *
 * Purpose:     Create a file with a new version (>0) of the superblock
 *
 * Return:      EXIT_SUCCESS
 *
 *-------------------------------------------------------------------------
 */
int
main(void)
{
    hid_t                        file; /* File IDs for old & new files */
    hid_t                        fcpl; /* File creation property list */
    herr_t H5_ATTR_NDEBUG_UNUSED ret;

    /* Create a file creation property list */
    fcpl = H5Pcreate(H5P_FILE_CREATE);
    assert(fcpl >= 0);

    ret = H5Pset_istore_k(fcpl, ISTORE_IK);
    assert(ret >= 0);

    /* Creating a file with the non-default file creation property list should
     * create a version 1 superblock
     */

    /* Create file with custom file creation property list */
    file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
    assert(file >= 0);

    /* Close FCPL */
    ret = H5Pclose(fcpl);
    assert(ret >= 0);

    /* Close file */
    ret = H5Fclose(file);
    assert(ret >= 0);

    return EXIT_SUCCESS;
}