1use std::mem;
3
4pub use self::H5F_close_degree_t::*;
5pub use self::H5F_libver_t::*;
6pub use self::H5F_mem_t::*;
7pub use self::H5F_scope_t::*;
8#[cfg(not(feature = "1.10.0"))]
9pub use {
10 H5F_info1_t as H5F_info_t, H5F_info1_t__sohm as H5F_info_t__sohm, H5Fget_info1 as H5Fget_info,
11};
12#[cfg(feature = "1.10.0")]
13pub use {
14 H5F_info2_t as H5F_info_t, H5F_info2_t__free as H5F_info_t__free,
15 H5F_info2_t__sohm as H5F_info_t__sohm, H5F_info2_t__super as H5F_info_t__super,
16 H5Fget_info2 as H5Fget_info,
17};
18
19use crate::internal_prelude::*;
20
21use crate::h5ac::H5AC_cache_config_t;
22
23#[cfg_attr(feature = "1.10.0", deprecated(note = "deprecated in HDF5 1.10.0"))]
24pub const H5F_ACC_DEBUG: c_uint = 0x0000;
25
26pub const H5F_ACC_RDONLY: c_uint = 0x0000;
28pub const H5F_ACC_RDWR: c_uint = 0x0001;
29pub const H5F_ACC_TRUNC: c_uint = 0x0002;
30pub const H5F_ACC_EXCL: c_uint = 0x0004;
31pub const H5F_ACC_CREAT: c_uint = 0x0010;
32pub const H5F_ACC_DEFAULT: c_uint = 0xffff;
33
34pub const H5F_OBJ_FILE: c_uint = 0x0001;
35pub const H5F_OBJ_DATASET: c_uint = 0x0002;
36pub const H5F_OBJ_GROUP: c_uint = 0x0004;
37pub const H5F_OBJ_DATATYPE: c_uint = 0x0008;
38pub const H5F_OBJ_ATTR: c_uint = 0x0010;
39pub const H5F_OBJ_ALL: c_uint =
40 H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR;
41pub const H5F_OBJ_LOCAL: c_uint = 0x0020;
42
43pub const H5F_FAMILY_DEFAULT: hsize_t = 0;
44
45pub const H5F_MPIO_DEBUG_KEY: &str = "H5F_mpio_debug_key";
46
47pub const H5F_UNLIMITED: hsize_t = !0;
48
49#[repr(C)]
50#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
51pub enum H5F_scope_t {
52 H5F_SCOPE_LOCAL = 0,
53 H5F_SCOPE_GLOBAL = 1,
54}
55
56#[repr(C)]
57#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
58pub enum H5F_close_degree_t {
59 H5F_CLOSE_DEFAULT = 0,
60 H5F_CLOSE_WEAK = 1,
61 H5F_CLOSE_SEMI = 2,
62 H5F_CLOSE_STRONG = 3,
63}
64
65impl Default for H5F_close_degree_t {
66 fn default() -> Self {
67 H5F_close_degree_t::H5F_CLOSE_DEFAULT
68 }
69}
70
71#[cfg_attr(feature = "1.10.0", deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
72#[repr(C)]
73#[derive(Debug, Copy, Clone)]
74pub struct H5F_info1_t {
75 pub super_ext_size: hsize_t,
76 pub sohm: H5F_info1_t__sohm,
77}
78
79impl Default for H5F_info1_t {
80 fn default() -> Self {
81 unsafe { mem::zeroed() }
82 }
83}
84
85#[cfg_attr(feature = "1.10.0", deprecated(note = "deprecated in HDF5 1.10.0, use H5F_info2_t"))]
86#[repr(C)]
87#[derive(Debug, Copy, Clone)]
88pub struct H5F_info1_t__sohm {
89 pub hdr_size: hsize_t,
90 pub msgs_info: H5_ih_info_t,
91}
92
93impl Default for H5F_info1_t__sohm {
94 fn default() -> Self {
95 unsafe { mem::zeroed() }
96 }
97}
98
99#[repr(C)]
100#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
101pub enum H5F_mem_t {
102 H5FD_MEM_NOLIST = -1,
103 H5FD_MEM_DEFAULT = 0,
104 H5FD_MEM_SUPER = 1,
105 H5FD_MEM_BTREE = 2,
106 H5FD_MEM_DRAW = 3,
107 H5FD_MEM_GHEAP = 4,
108 H5FD_MEM_LHEAP = 5,
109 H5FD_MEM_OHDR = 6,
110 H5FD_MEM_NTYPES = 7,
111}
112
113#[cfg(not(feature = "1.10.2"))]
114#[repr(C)]
115#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
116pub enum H5F_libver_t {
117 H5F_LIBVER_EARLIEST = 0,
118 H5F_LIBVER_LATEST = 1,
119}
120
121#[cfg(feature = "1.10.2")]
122#[repr(C)]
123#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
124pub enum H5F_libver_t {
125 H5F_LIBVER_ERROR = -1,
126 H5F_LIBVER_EARLIEST = 0,
127 H5F_LIBVER_V18 = 1,
128 H5F_LIBVER_V110 = 2,
129 H5F_LIBVER_NBOUNDS = 3,
130}
131
132#[cfg(feature = "1.10.2")]
133pub const H5F_LIBVER_LATEST: H5F_libver_t = H5F_LIBVER_V110;
134
135impl Default for H5F_libver_t {
136 fn default() -> Self {
137 H5F_LIBVER_LATEST
138 }
139}
140
141extern "C" {
142 #[cfg_attr(
143 hdf5_1_10_2,
144 deprecated(note = "deprecated in HDF5 1.10.2, use H5Fset_libver_bounds()")
145 )]
146 pub fn H5Fset_latest_format(file_id: hid_t, latest_format: hbool_t) -> herr_t;
147 pub fn H5Fis_hdf5(filename: *const c_char) -> htri_t;
148 #[cfg(feature = "1.12.0")]
149 pub fn H5Fis_accessible(container_name: *const c_char, fapl_id: hid_t) -> htri_t;
150 pub fn H5Fcreate(
151 filename: *const c_char, flags: c_uint, create_plist: hid_t, access_plist: hid_t,
152 ) -> hid_t;
153 pub fn H5Fopen(filename: *const c_char, flags: c_uint, access_plist: hid_t) -> hid_t;
154 pub fn H5Freopen(file_id: hid_t) -> hid_t;
155 pub fn H5Fflush(object_id: hid_t, scope: H5F_scope_t) -> herr_t;
156 pub fn H5Fclose(file_id: hid_t) -> herr_t;
157 #[cfg(feature = "1.12.0")]
158 pub fn H5Fdelete(filename: *const c_char, fapl_id: hid_t) -> herr_t;
159 pub fn H5Fget_create_plist(file_id: hid_t) -> hid_t;
160 pub fn H5Fget_access_plist(file_id: hid_t) -> hid_t;
161 pub fn H5Fget_intent(file_id: hid_t, intent: *mut c_uint) -> herr_t;
162 #[cfg(feature = "1.12.0")]
163 pub fn H5Fget_fileno(file_id: hid_t, fileno: *mut c_ulong) -> herr_t;
164 pub fn H5Fget_obj_count(file_id: hid_t, types: c_uint) -> ssize_t;
165 pub fn H5Fget_obj_ids(
166 file_id: hid_t, types: c_uint, max_objs: size_t, obj_id_list: *mut hid_t,
167 ) -> ssize_t;
168 pub fn H5Fget_vfd_handle(file_id: hid_t, fapl: hid_t, file_handle: *mut *mut c_void) -> herr_t;
169 pub fn H5Fmount(loc: hid_t, name: *const c_char, child: hid_t, plist: hid_t) -> herr_t;
170 pub fn H5Funmount(loc: hid_t, name: *const c_char) -> herr_t;
171 pub fn H5Fget_freespace(file_id: hid_t) -> hssize_t;
172 pub fn H5Fget_filesize(file_id: hid_t, size: *mut hsize_t) -> herr_t;
173 pub fn H5Fget_mdc_config(file_id: hid_t, config_ptr: *mut H5AC_cache_config_t) -> herr_t;
174 pub fn H5Fset_mdc_config(file_id: hid_t, config_ptr: *mut H5AC_cache_config_t) -> herr_t;
175 pub fn H5Fget_mdc_hit_rate(file_id: hid_t, hit_rate_ptr: *mut c_double) -> herr_t;
176 pub fn H5Fget_mdc_size(
177 file_id: hid_t, max_size_ptr: *mut size_t, min_clean_size_ptr: *mut size_t,
178 cur_size_ptr: *mut size_t, cur_num_entries_ptr: *mut c_int,
179 ) -> herr_t;
180 pub fn H5Freset_mdc_hit_rate_stats(file_id: hid_t) -> herr_t;
181 pub fn H5Fget_name(obj_id: hid_t, name: *mut c_char, size: size_t) -> ssize_t;
182}
183
184#[cfg(feature = "1.8.7")]
185extern "C" {
186 pub fn H5Fclear_elink_file_cache(file_id: hid_t) -> herr_t;
187}
188
189#[cfg(feature = "1.8.9")]
190extern "C" {
191 pub fn H5Fget_file_image(file_id: hid_t, buf_ptr: *mut c_void, buf_len: size_t) -> ssize_t;
192}
193
194#[cfg(all(feature = "1.8.9", feature = "have-parallel"))]
195extern "C" {
196 pub fn H5Fset_mpi_atomicity(file_id: hid_t, flag: hbool_t) -> herr_t;
197 pub fn H5Fget_mpi_atomicity(file_id: hid_t, flag: *mut hbool_t) -> herr_t;
198}
199
200#[cfg(feature = "1.10.0")]
201mod hdf5_1_10_0 {
202 use super::*;
203
204 pub const H5F_ACC_SWMR_WRITE: c_uint = 0x0020;
205 pub const H5F_ACC_SWMR_READ: c_uint = 0x0040;
206
207 #[repr(C)]
208 #[derive(Debug, Copy, Clone)]
209 pub struct H5F_retry_info_t {
210 pub nbins: c_uint,
211 pub retries: [*mut u32; 21usize],
212 }
213
214 impl Default for H5F_retry_info_t {
215 fn default() -> Self {
216 unsafe { mem::zeroed() }
217 }
218 }
219
220 #[repr(C)]
221 #[derive(Debug, Copy, Clone)]
222 pub struct H5F_sect_info_t {
223 pub addr: haddr_t,
224 pub size: hsize_t,
225 }
226
227 impl Default for H5F_sect_info_t {
228 fn default() -> Self {
229 unsafe { mem::zeroed() }
230 }
231 }
232
233 #[repr(C)]
234 #[derive(Debug, Copy, Clone)]
235 pub struct H5F_info2_t {
236 pub super_: H5F_info2_t__super,
237 pub free: H5F_info2_t__free,
238 pub sohm: H5F_info2_t__sohm,
239 }
240
241 impl Default for H5F_info2_t {
242 fn default() -> Self {
243 unsafe { mem::zeroed() }
244 }
245 }
246
247 #[repr(C)]
248 #[derive(Debug, Copy, Clone)]
249 pub struct H5F_info2_t__super {
250 pub version: c_uint,
251 pub super_size: hsize_t,
252 pub super_ext_size: hsize_t,
253 }
254
255 impl Default for H5F_info2_t__super {
256 fn default() -> Self {
257 unsafe { mem::zeroed() }
258 }
259 }
260
261 #[repr(C)]
262 #[derive(Debug, Copy, Clone)]
263 pub struct H5F_info2_t__free {
264 pub version: c_uint,
265 pub meta_size: hsize_t,
266 pub tot_space: hsize_t,
267 }
268
269 impl Default for H5F_info2_t__free {
270 fn default() -> Self {
271 unsafe { mem::zeroed() }
272 }
273 }
274
275 #[repr(C)]
276 #[derive(Debug, Copy, Clone)]
277 pub struct H5F_info2_t__sohm {
278 pub version: c_uint,
279 pub hdr_size: hsize_t,
280 pub msgs_info: H5_ih_info_t,
281 }
282
283 impl Default for H5F_info2_t__sohm {
284 fn default() -> Self {
285 unsafe { mem::zeroed() }
286 }
287 }
288
289 pub type H5F_flush_cb_t =
290 Option<unsafe extern "C" fn(object_id: hid_t, udata: *mut c_void) -> herr_t>;
291
292 #[repr(C)]
293 #[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
294 pub enum H5F_file_space_type_t {
295 H5F_FILE_SPACE_DEFAULT = 0,
296 H5F_FILE_SPACE_ALL_PERSIST = 1,
297 H5F_FILE_SPACE_ALL = 2,
298 H5F_FILE_SPACE_AGGR_VFD = 3,
299 H5F_FILE_SPACE_VFD = 4,
300 H5F_FILE_SPACE_NTYPES = 5,
301 }
302
303 pub use self::H5F_file_space_type_t::*;
304
305 extern "C" {
306 pub fn H5Fstart_swmr_write(file_id: hid_t) -> herr_t;
307 pub fn H5Fget_metadata_read_retry_info(
308 file_id: hid_t, info: *mut H5F_retry_info_t,
309 ) -> herr_t;
310 pub fn H5Fstart_mdc_logging(file_id: hid_t) -> herr_t;
311 pub fn H5Fstop_mdc_logging(file_id: hid_t) -> herr_t;
312 pub fn H5Fget_free_sections(
313 file_id: hid_t, type_: H5F_mem_t, nsects: size_t, sect_info: *mut H5F_sect_info_t,
314 ) -> ssize_t;
315 pub fn H5Fformat_convert(fid: hid_t) -> herr_t;
316 pub fn H5Fget_info2(obj_id: hid_t, finfo: *mut H5F_info2_t) -> herr_t;
317 }
318}
319
320extern "C" {
321 #[cfg_attr(
322 feature = "1.10.0",
323 deprecated(note = "deprecated in HDF5 1.10.0, use H5Fget_info2")
324 )]
325 #[cfg_attr(not(feature = "1.10.0"), link_name = "H5Fget_info")]
326 pub fn H5Fget_info1(obj_id: hid_t, finfo: *mut H5F_info1_t) -> herr_t;
327}
328
329#[cfg(feature = "1.10.0")]
330pub use self::hdf5_1_10_0::*;
331
332#[cfg(feature = "1.10.1")]
333mod hdf5_1_10_1 {
334 use super::*;
335
336 #[repr(C)]
337 #[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
338 pub enum H5F_fspace_strategy_t {
339 H5F_FSPACE_STRATEGY_FSM_AGGR = 0,
340 H5F_FSPACE_STRATEGY_PAGE = 1,
341 H5F_FSPACE_STRATEGY_AGGR = 2,
342 H5F_FSPACE_STRATEGY_NONE = 3,
343 H5F_FSPACE_STRATEGY_NTYPES = 4,
344 }
345
346 impl Default for H5F_fspace_strategy_t {
347 fn default() -> Self {
348 H5F_FSPACE_STRATEGY_FSM_AGGR
349 }
350 }
351
352 pub use self::H5F_fspace_strategy_t::*;
353
354 extern "C" {
355 pub fn H5Fget_mdc_image_info(
356 file_id: hid_t, image_addr: *mut haddr_t, image_size: *mut hsize_t,
357 ) -> herr_t;
358 pub fn H5Freset_page_buffering_stats(file_id: hid_t) -> herr_t;
359 pub fn H5Fget_page_buffering_stats(
360 file_id: hid_t, accesses: *mut c_uint, hits: *mut c_uint, misses: *mut c_uint,
361 evictions: *mut c_uint, bypasses: *mut c_uint,
362 ) -> herr_t;
363 }
364}
365
366#[cfg(feature = "1.10.1")]
367pub use self::hdf5_1_10_1::*;
368
369#[cfg(feature = "1.10.5")]
370extern "C" {
371 pub fn H5Fget_dset_no_attrs_hint(file_id: hid_t, minimize: *mut hbool_t) -> herr_t;
372 pub fn H5Fset_dset_no_attrs_hint(file_id: hid_t, minimize: hbool_t) -> herr_t;
373}