/src/hdf5/src/H5FDstdio_int.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: Private routines for the stdio VFD. |
15 | | * |
16 | | * Necessary for using internal library routines, which are |
17 | | * disallowed within the actual stdio VFD code. |
18 | | * |
19 | | */ |
20 | | |
21 | | /****************/ |
22 | | /* Module Setup */ |
23 | | /****************/ |
24 | | |
25 | | #define H5FD_FRIEND /* Suppress error about including H5FDpkg */ |
26 | | |
27 | | /***********/ |
28 | | /* Headers */ |
29 | | /***********/ |
30 | | |
31 | | #include "H5private.h" /* Generic Functions */ |
32 | | #include "H5Eprivate.h" /* Error handling */ |
33 | | #include "H5Iprivate.h" /* IDs */ |
34 | | #include "H5FDpkg.h" /* File drivers */ |
35 | | |
36 | | #include "H5FDstdio_private.h" /* stdio VFD */ |
37 | | |
38 | | /* The driver identification number, initialized at runtime */ |
39 | | hid_t H5FD_STDIO_id_g = H5I_INVALID_HID; |
40 | | |
41 | | /*------------------------------------------------------------------------- |
42 | | * Function: H5FD__stdio_register |
43 | | * |
44 | | * Purpose: Register the driver with the library. |
45 | | * |
46 | | * Return: SUCCEED/FAIL |
47 | | * |
48 | | *------------------------------------------------------------------------- |
49 | | */ |
50 | | herr_t |
51 | | H5FD__stdio_register(void) |
52 | 1 | { |
53 | 1 | herr_t ret_value = SUCCEED; /* Return value */ |
54 | | |
55 | 1 | FUNC_ENTER_PACKAGE |
56 | | |
57 | 1 | if (H5I_VFL != H5I_get_type(H5FD_STDIO_id_g)) |
58 | 1 | if ((H5FD_STDIO_id_g = H5FD_register(&H5FD_stdio_g, sizeof(H5FD_class_t), false)) < 0) |
59 | 0 | HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register stdio driver"); |
60 | | |
61 | 1 | done: |
62 | 1 | FUNC_LEAVE_NOAPI(ret_value) |
63 | 1 | } /* end H5FD__stdio_register() */ |
64 | | |
65 | | /*--------------------------------------------------------------------------- |
66 | | * Function: H5FD_stdio_unregister |
67 | | * |
68 | | * Purpose: Reset library driver info. |
69 | | * |
70 | | * Returns: SUCCEED (Can't fail) |
71 | | * |
72 | | *--------------------------------------------------------------------------- |
73 | | */ |
74 | | herr_t |
75 | | H5FD__stdio_unregister(void) |
76 | 1 | { |
77 | 1 | FUNC_ENTER_PACKAGE_NOERR |
78 | | |
79 | | /* Reset VFL ID */ |
80 | 1 | H5FD_STDIO_id_g = H5I_INVALID_HID; |
81 | | |
82 | 1 | FUNC_LEAVE_NOAPI(SUCCEED) |
83 | 1 | } /* end H5FD_stdio_unregister() */ |