diff --git a/src/header/bits_sys_statvfs/cbindgen.toml b/src/header/bits_sys_statvfs/cbindgen.toml new file mode 100644 index 0000000000..4fbcd97f3b --- /dev/null +++ b/src/header/bits_sys_statvfs/cbindgen.toml @@ -0,0 +1,20 @@ +# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html +# +# These types are split out to prevent importing all of sys/types.h into sys/statvfs.h. +# +# POSIX headers that require fsblkcnt_t and fsfilcnt_t: +# - sys/statvfs.h +# - sys/types.h (where they should be defined) +sys_includes = [] +include_guard = "_RELIBC_BITS_SYS_STATVFS_H" +language = "C" +style = "type" +no_includes = true +cpp_compat = true +[export] +include = [ + "fsblkcnt_t", + "fsfilcnt_t" +] +[enum] +prefix_with_name = true diff --git a/src/header/bits_sys_statvfs/mod.rs b/src/header/bits_sys_statvfs/mod.rs new file mode 100644 index 0000000000..68f3e30439 --- /dev/null +++ b/src/header/bits_sys_statvfs/mod.rs @@ -0,0 +1,8 @@ +use crate::platform::types::c_ulong; + +/// Used for file system block counts. +#[allow(non_camel_case_types)] +pub type fsblkcnt_t = c_ulong; +/// Used for file system file counts. +#[allow(non_camel_case_types)] +pub type fsfilcnt_t = c_ulong; diff --git a/src/header/mod.rs b/src/header/mod.rs index 05d18ba711..1329b98377 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -35,6 +35,7 @@ pub mod bits_socklen_t; pub mod bits_ssize_t; #[path = "bits_suseconds-t/mod.rs"] pub mod bits_suseconds_t; +pub mod bits_sys_statvfs; #[path = "bits_time-t/mod.rs"] pub mod bits_time_t; pub mod bits_timespec; diff --git a/src/header/sys_statvfs/cbindgen.toml b/src/header/sys_statvfs/cbindgen.toml index fa324209cd..5adeac207e 100644 --- a/src/header/sys_statvfs/cbindgen.toml +++ b/src/header/sys_statvfs/cbindgen.toml @@ -2,7 +2,10 @@ # # Spec quotations relating to includes: # - "The header shall define the fsblkcnt_t and fsfilcnt_t types as described in ." -sys_includes = ["sys/types.h"] +sys_includes = [] +after_includes = """ +#include // for fsblkcnt_t and fsfilcnt_t from sys/types.h +""" include_guard = "_RELIBC_SYS_STATVFS_H" language = "C" style = "Tag" diff --git a/src/header/sys_types_internal/cbindgen.toml b/src/header/sys_types_internal/cbindgen.toml index f9ee2bffa4..77cfd197e1 100644 --- a/src/header/sys_types_internal/cbindgen.toml +++ b/src/header/sys_types_internal/cbindgen.toml @@ -11,6 +11,7 @@ after_includes = """ #include #include #include +#include // for fsblkcnt_t and fsfilcnt_t #include #include @@ -30,8 +31,6 @@ include = [ "nlink_t", "useconds_t", "blkcnt_t", - "fsblkcnt_t", - "fsfilcnt_t", "u_char", "uchar", "u_short", diff --git a/src/header/sys_types_internal/mod.rs b/src/header/sys_types_internal/mod.rs index 89dacc4f87..9be3572cde 100644 --- a/src/header/sys_types_internal/mod.rs +++ b/src/header/sys_types_internal/mod.rs @@ -8,9 +8,18 @@ //! for the old specification. pub use crate::header::{ - bits_clock_t::clock_t, bits_clockid_t::clockid_t, bits_gid_t::gid_t, bits_id_t::id_t, - bits_mode_t::mode_t, bits_off_t::off_t, bits_pid_t::pid_t, bits_ssize_t::ssize_t, - bits_suseconds_t::suseconds_t, bits_time_t::time_t, bits_uid_t::uid_t, + bits_clock_t::clock_t, + bits_clockid_t::clockid_t, + bits_gid_t::gid_t, + bits_id_t::id_t, + bits_mode_t::mode_t, + bits_off_t::off_t, + bits_pid_t::pid_t, + bits_ssize_t::ssize_t, + bits_suseconds_t::suseconds_t, + bits_sys_statvfs::{fsblkcnt_t, fsfilcnt_t}, + bits_time_t::time_t, + bits_uid_t::uid_t, }; use crate::platform::types::{ c_char, c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort, @@ -33,11 +42,6 @@ pub type useconds_t = c_uint; /// Used for file block counts. pub type blkcnt_t = c_longlong; -/// Used for file system block counts. -pub type fsblkcnt_t = c_ulong; -/// Used for file system file counts. -pub type fsfilcnt_t = c_ulong; - pub type u_char = c_uchar; pub type uchar = c_uchar; pub type u_short = c_ushort;