diff --git a/dev/source-files.js b/dev/source-files.js index bd30af08e..41a10f7c3 100644 --- a/dev/source-files.js +++ b/dev/source-files.js @@ -115,7 +115,7 @@ sourcesIndex["uu_csplit"] = {"name":"","files":["csplit.rs","csplit_error.rs","p sourcesIndex["uu_cut"] = {"name":"","files":["cut.rs","searcher.rs"]}; sourcesIndex["uu_date"] = {"name":"","files":["date.rs"]}; sourcesIndex["uu_dd"] = {"name":"","files":["blocks.rs","conversion_tables.rs","datastructures.rs","dd.rs","parseargs.rs","progress.rs"]}; -sourcesIndex["uu_df"] = {"name":"","files":["blocks.rs","columns.rs","df.rs","table.rs"]}; +sourcesIndex["uu_df"] = {"name":"","files":["blocks.rs","columns.rs","df.rs","filesystem.rs","table.rs"]}; sourcesIndex["uu_dircolors"] = {"name":"","files":["colors.rs","dircolors.rs"]}; sourcesIndex["uu_dirname"] = {"name":"","files":["dirname.rs"]}; sourcesIndex["uu_du"] = {"name":"","files":["du.rs"]}; diff --git a/dev/src/uu_df/df.rs.html b/dev/src/uu_df/df.rs.html index 8037005f3..7650601be 100644 --- a/dev/src/uu_df/df.rs.html +++ b/dev/src/uu_df/df.rs.html @@ -685,36 +685,6 @@ 683 684 685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715
// This file is part of the uutils coreutils package.
 //
 // (c) Fangxu Hu <framlog@gmail.com>
@@ -725,13 +695,12 @@
 // spell-checker:ignore itotal iused iavail ipcent pcent tmpfs squashfs lofs
 mod blocks;
 mod columns;
+mod filesystem;
 mod table;
 
 use uucore::error::{UResult, USimpleError};
 use uucore::format_usage;
-#[cfg(unix)]
-use uucore::fsext::statfs;
-use uucore::fsext::{read_fs_list, FsUsage, MountInfo};
+use uucore::fsext::{read_fs_list, MountInfo};
 
 use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
 
@@ -740,6 +709,7 @@
 
 use crate::blocks::{block_size_from_matches, BlockSize};
 use crate::columns::Column;
+use crate::filesystem::Filesystem;
 use crate::table::{DisplayRow, Header, Row};
 
 static ABOUT: &str = "Show information about the file system on which each FILE resides,\n\
@@ -853,36 +823,6 @@
     }
 }
 
-#[derive(Debug, Clone)]
-struct Filesystem {
-    mount_info: MountInfo,
-    usage: FsUsage,
-}
-
-impl Filesystem {
-    // TODO: resolve uuid in `mount_info.dev_name` if exists
-    fn new(mount_info: MountInfo) -> Option<Self> {
-        let _stat_path = if !mount_info.mount_dir.is_empty() {
-            mount_info.mount_dir.clone()
-        } else {
-            #[cfg(unix)]
-            {
-                mount_info.dev_name.clone()
-            }
-            #[cfg(windows)]
-            {
-                // On windows, we expect the volume id
-                mount_info.dev_id.clone()
-            }
-        };
-        #[cfg(unix)]
-        let usage = FsUsage::new(statfs(_stat_path).ok()?);
-        #[cfg(windows)]
-        let usage = FsUsage::new(Path::new(&_stat_path));
-        Some(Self { mount_info, usage })
-    }
-}
-
 /// Whether to display the mount info given the inclusion settings.
 fn is_included(mi: &MountInfo, opt: &Options) -> bool {
     // Don't show remote filesystems if `--local` has been given.
diff --git a/dev/src/uu_df/filesystem.rs.html b/dev/src/uu_df/filesystem.rs.html
new file mode 100644
index 000000000..bf927f072
--- /dev/null
+++ b/dev/src/uu_df/filesystem.rs.html
@@ -0,0 +1,115 @@
+filesystem.rs - source
+    
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+//! Provides a summary representation of a filesystem.
+//!
+//! A [`Filesystem`] struct represents a device containing a
+//! filesystem mounted at a particular directory. It also includes
+//! information on amount of space available and amount of space used.
+#[cfg(windows)]
+use std::path::Path;
+
+#[cfg(unix)]
+use uucore::fsext::statfs;
+use uucore::fsext::{FsUsage, MountInfo};
+
+/// Summary representation of a filesystem.
+///
+/// A [`Filesystem`] struct represents a device containing a
+/// filesystem mounted at a particular directory. The
+/// [`Filesystem::mount_info`] field exposes that information. The
+/// [`Filesystem::usage`] field provides information on the amount of
+/// space available on the filesystem and the amount of space used.
+#[derive(Debug, Clone)]
+pub(crate) struct Filesystem {
+    /// Information about the mounted device, mount directory, and related options.
+    pub mount_info: MountInfo,
+
+    /// Information about the amount of space used on the filesystem.
+    pub usage: FsUsage,
+}
+
+impl Filesystem {
+    // TODO: resolve uuid in `mount_info.dev_name` if exists
+    pub(crate) fn new(mount_info: MountInfo) -> Option<Self> {
+        let _stat_path = if !mount_info.mount_dir.is_empty() {
+            mount_info.mount_dir.clone()
+        } else {
+            #[cfg(unix)]
+            {
+                mount_info.dev_name.clone()
+            }
+            #[cfg(windows)]
+            {
+                // On windows, we expect the volume id
+                mount_info.dev_id.clone()
+            }
+        };
+        #[cfg(unix)]
+        let usage = FsUsage::new(statfs(_stat_path).ok()?);
+        #[cfg(windows)]
+        let usage = FsUsage::new(Path::new(&_stat_path));
+        Some(Self { mount_info, usage })
+    }
+}
+
+
+ \ No newline at end of file diff --git a/dev/src/uu_df/table.rs.html b/dev/src/uu_df/table.rs.html index 40828131f..fa7890db2 100644 --- a/dev/src/uu_df/table.rs.html +++ b/dev/src/uu_df/table.rs.html @@ -585,6 +585,7 @@ 583 584 585 +586
//  * This file is part of the uutils coreutils package.
 //  *
 //  * For the full copyright and license information, please view the LICENSE
@@ -599,7 +600,8 @@
 use number_prefix::NumberPrefix;
 
 use crate::columns::Column;
-use crate::{BlockSize, Filesystem, Options};
+use crate::filesystem::Filesystem;
+use crate::{BlockSize, Options};
 use uucore::fsext::{FsUsage, MountInfo};
 
 use std::fmt;
diff --git a/dev/src/uu_nproc/nproc.rs.html b/dev/src/uu_nproc/nproc.rs.html
index 07a2ee5c4..cf7bd8a22 100644
--- a/dev/src/uu_nproc/nproc.rs.html
+++ b/dev/src/uu_nproc/nproc.rs.html
@@ -152,8 +152,8 @@
 pub fn uumain(args: impl uucore::Args) -> UResult<()> {
     let matches = uu_app().get_matches_from(args);
 
-    let mut ignore = match matches.value_of(OPT_IGNORE) {
-        Some(numstr) => match numstr.parse() {
+    let ignore = match matches.value_of(OPT_IGNORE) {
+        Some(numstr) => match numstr.trim().parse() {
             Ok(num) => num,
             Err(e) => {
                 return Err(USimpleError::new(
@@ -165,18 +165,18 @@
         None => 0,
     };
 
-    if !matches.is_present(OPT_ALL) {
-        // OMP_NUM_THREADS doesn't have an impact on --all
-        ignore += match env::var("OMP_NUM_THREADS") {
-            Ok(threadstr) => threadstr.parse().unwrap_or(0),
-            Err(_) => 0,
-        };
-    }
-
     let mut cores = if matches.is_present(OPT_ALL) {
         num_cpus_all()
     } else {
-        num_cpus::get()
+        // OMP_NUM_THREADS doesn't have an impact on --all
+        match env::var("OMP_NUM_THREADS") {
+            // Uses the OpenMP variable to force the number of threads
+            // If the parsing fails, returns the number of CPU
+            Ok(threadstr) => threadstr.parse().unwrap_or_else(|_| num_cpus::get()),
+            // the variable 'OMP_NUM_THREADS' doesn't exit
+            // fallback to the regular CPU detection
+            Err(_) => num_cpus::get(),
+        }
     };
 
     if cores <= ignore {
diff --git a/dev/uu_df/fn.uu_app.html b/dev/uu_df/fn.uu_app.html
index b24fd3442..120536b1a 100644
--- a/dev/uu_df/fn.uu_app.html
+++ b/dev/uu_df/fn.uu_app.html
@@ -1,4 +1,4 @@
 uu_app in uu_df - Rust
     

Function uu_df::uu_app[][src]

pub fn uu_app<'a>() -> App<'a>
+

Function uu_df::uu_app[][src]

pub fn uu_app<'a>() -> App<'a>
\ No newline at end of file diff --git a/dev/uu_df/fn.uumain.html b/dev/uu_df/fn.uumain.html index 7dd2e345c..a7ccdeceb 100644 --- a/dev/uu_df/fn.uumain.html +++ b/dev/uu_df/fn.uumain.html @@ -1,4 +1,4 @@ uumain in uu_df - Rust

Function uu_df::uumain[][src]

pub fn uumain(args: impl Args) -> i32
+

Function uu_df::uumain[][src]

pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_df/index.html b/dev/uu_df/index.html index 3f6002772..35370422e 100644 --- a/dev/uu_df/index.html +++ b/dev/uu_df/index.html @@ -1,5 +1,5 @@ uu_df - Rust

Crate uu_df[][src]

Functions

+

Crate uu_df

Version 0.0.12

\ No newline at end of file