From 5f5b7d4d7a76575673b57e685c13ba2c52c4183e Mon Sep 17 00:00:00 2001 From: Vincent Dagonneau Date: Thu, 19 Mar 2020 11:40:53 +0100 Subject: feature-gate most Nix functions Using features reduces build time and size for consumer crates. By default all features are enabled. --- src/mount/bsd.rs | 15 +++++++++++++++ src/mount/mod.rs | 2 ++ 2 files changed, 17 insertions(+) (limited to 'src/mount') diff --git a/src/mount/bsd.rs b/src/mount/bsd.rs index 627bfa5e..ba0c1a28 100644 --- a/src/mount/bsd.rs +++ b/src/mount/bsd.rs @@ -20,29 +20,36 @@ libc_bitflags!( pub struct MntFlags: c_int { /// ACL support enabled. #[cfg(any(target_os = "netbsd", target_os = "freebsd"))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_ACLS; /// All I/O to the file system should be done asynchronously. MNT_ASYNC; /// dir should instead be a file system ID encoded as “FSID:val0:val1”. #[cfg(target_os = "freebsd")] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_BYFSID; /// Force a read-write mount even if the file system appears to be /// unclean. MNT_FORCE; /// GEOM journal support enabled. #[cfg(target_os = "freebsd")] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_GJOURNAL; /// MAC support for objects. #[cfg(any(target_os = "macos", target_os = "freebsd"))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_MULTILABEL; /// Disable read clustering. #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_NOCLUSTERR; /// Disable write clustering. #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_NOCLUSTERW; /// Enable NFS version 4 ACLs. #[cfg(target_os = "freebsd")] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_NFS4ACLS; /// Do not update access times. MNT_NOATIME; @@ -52,6 +59,7 @@ libc_bitflags!( MNT_NOSUID; /// Do not follow symlinks. #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_NOSYMFOLLOW; /// Mount read-only. MNT_RDONLY; @@ -62,6 +70,7 @@ libc_bitflags!( /// /// See [mksnap_ffs(8)](https://www.freebsd.org/cgi/man.cgi?query=mksnap_ffs) #[cfg(any(target_os = "macos", target_os = "freebsd"))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_SNAPSHOT; /// Using soft updates. #[cfg(any( @@ -70,10 +79,12 @@ libc_bitflags!( target_os = "netbsd", target_os = "openbsd" ))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_SOFTDEP; /// Directories with the SUID bit set chown new files to their own /// owner. #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_SUIDDIR; /// All I/O to the file system should be done synchronously. MNT_SYNCHRONOUS; @@ -83,12 +94,14 @@ libc_bitflags!( target_os = "freebsd", target_os = "netbsd" ))] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_UNION; /// Indicates that the mount command is being applied to an already /// mounted file system. MNT_UPDATE; /// Check vnode use counts. #[cfg(target_os = "freebsd")] + #[cfg_attr(docsrs, doc(cfg(all())))] MNT_NONBUSY; } ); @@ -182,6 +195,7 @@ pub type NmountResult = std::result::Result<(), NmountError>; /// * [`nmount(2)`](https://www.freebsd.org/cgi/man.cgi?query=nmount) /// * [`nullfs(5)`](https://www.freebsd.org/cgi/man.cgi?query=nullfs) #[cfg(target_os = "freebsd")] +#[cfg_attr(docsrs, doc(cfg(all())))] #[derive(Debug, Default)] pub struct Nmount<'a>{ iov: Vec>, @@ -189,6 +203,7 @@ pub struct Nmount<'a>{ } #[cfg(target_os = "freebsd")] +#[cfg_attr(docsrs, doc(cfg(all())))] impl<'a> Nmount<'a> { /// Add an opaque mount option. /// diff --git a/src/mount/mod.rs b/src/mount/mod.rs index 14bf2a96..e89c1a07 100644 --- a/src/mount/mod.rs +++ b/src/mount/mod.rs @@ -1,5 +1,6 @@ //! Mount file systems #[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg_attr(docsrs, doc(cfg(all())))] mod linux; #[cfg(any(target_os = "android", target_os = "linux"))] @@ -10,6 +11,7 @@ pub use self::linux::*; target_os = "macos", target_os = "netbsd", target_os = "openbsd"))] +#[cfg_attr(docsrs, doc(cfg(all())))] mod bsd; #[cfg(any(target_os = "dragonfly", -- cgit v1.2.3