Skip to content

Commit 34fdc70

Browse files
committed
Remove h5_ prefix on internal features
1 parent e6b966c commit 34fdc70

File tree

6 files changed

+52
-52
lines changed

6 files changed

+52
-52
lines changed

build.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use std::env;
33
fn main() {
44
for (key, _) in env::vars() {
55
let key = match key.as_str() {
6-
"DEP_HDF5_HAVE_DIRECT" => "h5_have_direct".into(),
7-
"DEP_HDF5_HAVE_STDBOOL" => "h5_have_stdbool".into(),
8-
"DEP_HDF5_HAVE_PARALLEL" => "h5_have_parallel".into(),
9-
"DEP_HDF5_HAVE_THREADSAFE" => "h5_have_threadsafe".into(),
10-
"DEP_HDF5_MSVC_DLL_INDIRECTION" => "h5_dll_indirection".into(),
6+
"DEP_HDF5_HAVE_DIRECT" => "have_direct".into(),
7+
"DEP_HDF5_HAVE_STDBOOL" => "have_stdbool".into(),
8+
"DEP_HDF5_HAVE_PARALLEL" => "have_parallel".into(),
9+
"DEP_HDF5_HAVE_THREADSAFE" => "have_threadsafe".into(),
10+
"DEP_HDF5_MSVC_DLL_INDIRECTION" => "dll_indirection".into(),
1111
key if key.starts_with("DEP_HDF5_VERSION_") => {
1212
let version = key.trim_start_matches("DEP_HDF5_VERSION_");
1313
format!("feature=\"{}\"", version.replace("_", "."))

src/globals.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::mem;
44

55
use lazy_static::lazy_static;
66

7-
#[cfg(h5_have_direct)]
7+
#[cfg(have_direct)]
88
use hdf5_sys::h5fd::H5FD_direct_init;
9-
#[cfg(h5_have_parallel)]
9+
#[cfg(have_parallel)]
1010
use hdf5_sys::h5fd::H5FD_mpio_init;
1111
use hdf5_sys::h5fd::{
1212
H5FD_core_init, H5FD_family_init, H5FD_log_init, H5FD_multi_init, H5FD_sec2_init,
@@ -16,17 +16,17 @@ use hdf5_sys::{h5e, h5p, h5t};
1616

1717
use crate::internal_prelude::*;
1818

19-
#[cfg(h5_dll_indirection)]
19+
#[cfg(dll_indirection)]
2020
pub struct H5GlobalConstant(&'static usize);
21-
#[cfg(not(h5_dll_indirection))]
21+
#[cfg(not(dll_indirection))]
2222
pub struct H5GlobalConstant(&'static hdf5_sys::h5i::hid_t);
2323

2424
impl std::ops::Deref for H5GlobalConstant {
2525
type Target = hdf5_sys::h5i::hid_t;
2626
fn deref(&self) -> &Self::Target {
2727
lazy_static::initialize(&crate::sync::LIBRARY_INIT);
2828
cfg_if::cfg_if! {
29-
if #[cfg(h5_dll_indirection)] {
29+
if #[cfg(dll_indirection)] {
3030
let dll_ptr = self.0 as *const usize;
3131
let ptr: *const *const hdf5_sys::h5i::hid_t = dll_ptr.cast();
3232
unsafe {
@@ -336,21 +336,21 @@ lazy_static! {
336336
}
337337

338338
// MPI-IO file driver
339-
#[cfg(h5_have_parallel)]
339+
#[cfg(have_parallel)]
340340
lazy_static! {
341341
pub static ref H5FD_MPIO: hid_t = unsafe { h5lock!(H5FD_mpio_init()) };
342342
}
343-
#[cfg(not(h5_have_parallel))]
343+
#[cfg(not(have_parallel))]
344344
lazy_static! {
345345
pub static ref H5FD_MPIO: hid_t = H5I_INVALID_HID;
346346
}
347347

348348
// Direct VFD
349-
#[cfg(h5_have_direct)]
349+
#[cfg(have_direct)]
350350
lazy_static! {
351351
pub static ref H5FD_DIRECT: hid_t = unsafe { h5lock!(H5FD_direct_init()) };
352352
}
353-
#[cfg(not(h5_have_direct))]
353+
#[cfg(not(have_direct))]
354354
lazy_static! {
355355
pub static ref H5FD_DIRECT: hid_t = H5I_INVALID_HID;
356356
}

src/hl/dataset.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ impl DatasetBuilderInner {
611611
self.with_dapl(|pl| pl.virtual_printf_gap(gap_size));
612612
}
613613

614-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
614+
#[cfg(all(feature = "1.10.0", have_parallel))]
615615
pub fn all_coll_metadata_ops(&mut self, is_collective: bool) {
616616
self.with_dapl(|pl| pl.all_coll_metadata_ops(is_collective));
617617
}
@@ -944,7 +944,7 @@ macro_rules! impl_builder_methods {
944944
impl_builder!(DatasetAccess: virtual_view(view: VirtualView));
945945
#[cfg(feature = "1.10.0")]
946946
impl_builder!(DatasetAccess: virtual_printf_gap(gap_size: usize));
947-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
947+
#[cfg(all(feature = "1.10.0", have_parallel))]
948948
impl_builder!(DatasetAccess: all_coll_metadata_ops(is_collective: bool));
949949

950950
impl_builder!(DatasetCreate: create/dcpl);

src/hl/plist/dataset_access.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::fmt::{self, Debug};
99
use std::ops::Deref;
1010

1111
use hdf5_sys::h5p::{H5Pcreate, H5Pget_chunk_cache, H5Pset_chunk_cache};
12-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
12+
#[cfg(all(feature = "1.10.0", have_parallel))]
1313
use hdf5_sys::h5p::{H5Pget_all_coll_metadata_ops, H5Pset_all_coll_metadata_ops};
1414
#[cfg(feature = "1.8.17")]
1515
use hdf5_sys::h5p::{H5Pget_efile_prefix, H5Pset_efile_prefix};
@@ -62,7 +62,7 @@ impl Debug for DatasetAccess {
6262
formatter.field("virtual_view", &self.virtual_view());
6363
formatter.field("virtual_printf_gap", &self.virtual_printf_gap());
6464
}
65-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
65+
#[cfg(all(feature = "1.10.0", have_parallel))]
6666
formatter.field("all_coll_metadata_ops", &self.all_coll_metadata_ops());
6767
formatter.finish()
6868
}
@@ -134,7 +134,7 @@ pub struct DatasetAccessBuilder {
134134
virtual_view: Option<VirtualView>,
135135
#[cfg(feature = "1.10.0")]
136136
virtual_printf_gap: Option<usize>,
137-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
137+
#[cfg(all(feature = "1.10.0", have_parallel))]
138138
all_coll_metadata_ops: Option<bool>,
139139
}
140140

@@ -159,7 +159,7 @@ impl DatasetAccessBuilder {
159159
builder.virtual_view(plist.get_virtual_view()?);
160160
builder.virtual_printf_gap(plist.get_virtual_printf_gap()?);
161161
}
162-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
162+
#[cfg(all(feature = "1.10.0", have_parallel))]
163163
builder.all_coll_metadata_ops(plist.get_all_coll_metadata_ops()?);
164164
Ok(builder)
165165
}
@@ -187,7 +187,7 @@ impl DatasetAccessBuilder {
187187
self
188188
}
189189

190-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
190+
#[cfg(all(feature = "1.10.0", have_parallel))]
191191
pub fn all_coll_metadata_ops(&mut self, is_collective: bool) -> &mut Self {
192192
self.all_coll_metadata_ops = Some(is_collective);
193193
self
@@ -213,7 +213,7 @@ impl DatasetAccessBuilder {
213213
h5try!(H5Pset_virtual_printf_gap(id, v as _));
214214
}
215215
}
216-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
216+
#[cfg(all(feature = "1.10.0", have_parallel))]
217217
{
218218
if let Some(v) = self.all_coll_metadata_ops {
219219
h5try!(H5Pset_all_coll_metadata_ops(id, v as _));
@@ -296,13 +296,13 @@ impl DatasetAccess {
296296
self.get_virtual_printf_gap().unwrap_or(0)
297297
}
298298

299-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
299+
#[cfg(all(feature = "1.10.0", have_parallel))]
300300
#[doc(hidden)]
301301
pub fn get_all_coll_metadata_ops(&self) -> Result<bool> {
302302
h5get!(H5Pget_all_coll_metadata_ops(self.id()): hbool_t).map(|x| x > 0)
303303
}
304304

305-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
305+
#[cfg(all(feature = "1.10.0", have_parallel))]
306306
pub fn all_coll_metadata_ops(&self) -> bool {
307307
self.get_all_coll_metadata_ops().unwrap_or(false)
308308
}

src/hl/plist/file_access.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use hdf5_sys::h5p::{
4242
H5Pset_gc_references, H5Pset_mdc_config, H5Pset_meta_block_size, H5Pset_sieve_buf_size,
4343
H5Pset_small_data_block_size,
4444
};
45-
#[cfg(h5_have_direct)]
45+
#[cfg(have_direct)]
4646
use hdf5_sys::h5p::{H5Pget_fapl_direct, H5Pset_fapl_direct};
4747
#[cfg(feature = "mpio")]
4848
use hdf5_sys::h5p::{H5Pget_fapl_mpio, H5Pset_fapl_mpio};
@@ -51,7 +51,7 @@ use hdf5_sys::h5p::{H5Pget_fapl_mpio, H5Pset_fapl_mpio};
5151
use hdf5_sys::h5ac::{H5AC_cache_image_config_t, H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
5252
#[cfg(feature = "1.10.2")]
5353
use hdf5_sys::h5f::H5F_libver_t;
54-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
54+
#[cfg(all(feature = "1.10.0", have_parallel))]
5555
use hdf5_sys::h5p::{
5656
H5Pget_all_coll_metadata_ops, H5Pget_coll_metadata_write, H5Pset_all_coll_metadata_ops,
5757
H5Pset_coll_metadata_write,
@@ -73,7 +73,7 @@ use hdf5_sys::h5p::{
7373
H5Pset_metadata_read_attempts,
7474
};
7575

76-
#[cfg(h5_have_direct)]
76+
#[cfg(have_direct)]
7777
use crate::globals::H5FD_DIRECT;
7878
#[cfg(feature = "mpio")]
7979
use crate::globals::H5FD_MPIO;
@@ -131,9 +131,9 @@ impl Debug for FileAccess {
131131
formatter.field("metadata_read_attempts", &self.metadata_read_attempts());
132132
#[cfg(feature = "1.10.0")]
133133
formatter.field("mdc_log_options", &self.mdc_log_options());
134-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
134+
#[cfg(all(feature = "1.10.0", have_parallel))]
135135
formatter.field("all_coll_metadata_ops", &self.all_coll_metadata_ops());
136-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
136+
#[cfg(all(feature = "1.10.0", have_parallel))]
137137
formatter.field("coll_metadata_write", &self.coll_metadata_write());
138138
formatter.field("mdc_config", &self.mdc_config());
139139
formatter.field("driver", &self.driver());
@@ -451,15 +451,15 @@ mod mpio {
451451
#[cfg(feature = "mpio")]
452452
pub use self::mpio::*;
453453

454-
#[cfg(h5_have_direct)]
454+
#[cfg(have_direct)]
455455
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
456456
pub struct DirectDriver {
457457
pub alignment: usize,
458458
pub block_size: usize,
459459
pub cbuf_size: usize,
460460
}
461461

462-
#[cfg(h5_have_direct)]
462+
#[cfg(have_direct)]
463463
impl Default for DirectDriver {
464464
fn default() -> Self {
465465
Self { alignment: 4096, block_size: 4096, cbuf_size: 16 * 1024 * 1024 }
@@ -477,7 +477,7 @@ pub enum FileDriver {
477477
Split(SplitDriver),
478478
#[cfg(feature = "mpio")]
479479
Mpio(MpioDriver),
480-
#[cfg(h5_have_direct)]
480+
#[cfg(have_direct)]
481481
Direct(DirectDriver),
482482
}
483483

@@ -702,8 +702,8 @@ impl Eq for MetadataCacheConfig {}
702702

703703
impl Default for MetadataCacheConfig {
704704
fn default() -> Self {
705-
let min_clean_fraction = if cfg!(h5_have_parallel) { 0.3_f32 } else { 0.01_f32 };
706-
let flash_multiple = if cfg!(h5_have_parallel) { 1.0_f32 } else { 1.4_f32 };
705+
let min_clean_fraction = if cfg!(have_parallel) { 0.3_f32 } else { 0.01_f32 };
706+
let flash_multiple = if cfg!(have_parallel) { 1.0_f32 } else { 1.4_f32 };
707707
Self {
708708
rpt_fcn_enabled: false,
709709
open_trace_file: false,
@@ -971,9 +971,9 @@ pub struct FileAccessBuilder {
971971
mdc_image_config: Option<CacheImageConfig>,
972972
#[cfg(feature = "1.10.0")]
973973
mdc_log_options: Option<CacheLogOptions>,
974-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
974+
#[cfg(all(feature = "1.10.0", have_parallel))]
975975
all_coll_metadata_ops: Option<bool>,
976-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
976+
#[cfg(all(feature = "1.10.0", have_parallel))]
977977
coll_metadata_write: Option<bool>,
978978
gc_references: Option<bool>,
979979
small_data_block_size: Option<u64>,
@@ -1023,7 +1023,7 @@ impl FileAccessBuilder {
10231023
let v = plist.get_mdc_log_options()?;
10241024
builder.mdc_log_options(v.is_enabled, &v.location, v.start_on_access);
10251025
}
1026-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
1026+
#[cfg(all(feature = "1.10.0", have_parallel))]
10271027
{
10281028
builder.all_coll_metadata_ops(plist.get_all_coll_metadata_ops()?);
10291029
builder.coll_metadata_write(plist.get_coll_metadata_write()?);
@@ -1118,13 +1118,13 @@ impl FileAccessBuilder {
11181118
self
11191119
}
11201120

1121-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
1121+
#[cfg(all(feature = "1.10.0", have_parallel))]
11221122
pub fn all_coll_metadata_ops(&mut self, is_collective: bool) -> &mut Self {
11231123
self.all_coll_metadata_ops = Some(is_collective);
11241124
self
11251125
}
11261126

1127-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
1127+
#[cfg(all(feature = "1.10.0", have_parallel))]
11281128
pub fn coll_metadata_write(&mut self, is_collective: bool) -> &mut Self {
11291129
self.coll_metadata_write = Some(is_collective);
11301130
self
@@ -1251,14 +1251,14 @@ impl FileAccessBuilder {
12511251
self.driver(&FileDriver::Mpio(MpioDriver::try_new(comm, info).unwrap()))
12521252
}
12531253

1254-
#[cfg(h5_have_direct)]
1254+
#[cfg(have_direct)]
12551255
pub fn direct_options(
12561256
&mut self, alignment: usize, block_size: usize, cbuf_size: usize,
12571257
) -> &mut Self {
12581258
self.driver(&FileDriver::Direct(DirectDriver { alignment, block_size, cbuf_size }))
12591259
}
12601260

1261-
#[cfg(h5_have_direct)]
1261+
#[cfg(have_direct)]
12621262
pub fn direct(&mut self) -> &mut Self {
12631263
self.driver(&FileDriver::Direct(DirectDriver::default()))
12641264
}
@@ -1360,7 +1360,7 @@ impl FileAccessBuilder {
13601360
Ok(())
13611361
}
13621362

1363-
#[cfg(h5_have_direct)]
1363+
#[cfg(have_direct)]
13641364
fn set_direct(id: hid_t, drv: &DirectDriver) -> Result<()> {
13651365
h5try!(H5Pset_fapl_direct(id, drv.alignment as _, drv.block_size as _, drv.cbuf_size as _));
13661366
Ok(())
@@ -1393,7 +1393,7 @@ impl FileAccessBuilder {
13931393
FileDriver::Mpio(drv) => {
13941394
Self::set_mpio(id, drv)?;
13951395
}
1396-
#[cfg(h5_have_direct)]
1396+
#[cfg(have_direct)]
13971397
FileDriver::Direct(drv) => {
13981398
Self::set_direct(id, drv)?;
13991399
}
@@ -1472,7 +1472,7 @@ impl FileAccessBuilder {
14721472
));
14731473
}
14741474
}
1475-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
1475+
#[cfg(all(feature = "1.10.0", have_parallel))]
14761476
{
14771477
if let Some(v) = self.all_coll_metadata_ops {
14781478
h5try!(H5Pset_all_coll_metadata_ops(id, v as _));
@@ -1593,7 +1593,7 @@ impl FileAccess {
15931593
}
15941594

15951595
#[doc(hidden)]
1596-
#[cfg(h5_have_direct)]
1596+
#[cfg(have_direct)]
15971597
fn get_direct(&self) -> Result<DirectDriver> {
15981598
let res = h5get!(H5Pget_fapl_direct(self.id()): size_t, size_t, size_t)?;
15991599
Ok(DirectDriver { alignment: res.0 as _, block_size: res.1 as _, cbuf_size: res.2 as _ })
@@ -1608,7 +1608,7 @@ impl FileAccess {
16081608
return self.get_mpio().map(FileDriver::Mpio);
16091609
}
16101610
}
1611-
#[cfg(h5_have_direct)]
1611+
#[cfg(have_direct)]
16121612
{
16131613
if drv_id == *H5FD_DIRECT {
16141614
return self.get_direct().map(FileDriver::Direct);
@@ -1797,24 +1797,24 @@ impl FileAccess {
17971797
self.get_mdc_log_options().ok().unwrap_or_default()
17981798
}
17991799

1800-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
1800+
#[cfg(all(feature = "1.10.0", have_parallel))]
18011801
#[doc(hidden)]
18021802
pub fn get_all_coll_metadata_ops(&self) -> Result<bool> {
18031803
h5get!(H5Pget_all_coll_metadata_ops(self.id()): hbool_t).map(|x| x > 0)
18041804
}
18051805

1806-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
1806+
#[cfg(all(feature = "1.10.0", have_parallel))]
18071807
pub fn all_coll_metadata_ops(&self) -> bool {
18081808
self.get_all_coll_metadata_ops().unwrap_or(false)
18091809
}
18101810

1811-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
1811+
#[cfg(all(feature = "1.10.0", have_parallel))]
18121812
#[doc(hidden)]
18131813
pub fn get_coll_metadata_write(&self) -> Result<bool> {
18141814
h5get!(H5Pget_coll_metadata_write(self.id()): hbool_t).map(|x| x > 0)
18151815
}
18161816

1817-
#[cfg(all(feature = "1.10.0", h5_have_parallel))]
1817+
#[cfg(all(feature = "1.10.0", have_parallel))]
18181818
pub fn coll_metadata_write(&self) -> bool {
18191819
self.get_coll_metadata_write().unwrap_or(false)
18201820
}

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features blosc,lzf
2828
#![cfg_attr(docsrs, feature(doc_cfg))]
2929

30-
#[cfg(all(feature = "mpio", not(h5_have_parallel)))]
30+
#[cfg(all(feature = "mpio", not(have_parallel)))]
3131
compile_error!("Enabling \"mpio\" feature requires HDF5 library built with MPI support");
3232

3333
mod export {
@@ -175,7 +175,7 @@ pub fn is_library_threadsafe() -> bool {
175175
}
176176
#[cfg(not(feature = "1.8.16"))]
177177
{
178-
cfg!(h5_have_threadsafe)
178+
cfg!(have_threadsafe)
179179
}
180180
}
181181

0 commit comments

Comments
 (0)