mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
fix linux get_info
This commit is contained in:
@@ -6,7 +6,7 @@ use std::path::Path;
|
|||||||
use crate::{disk::Info, error::Result};
|
use crate::{disk::Info, error::Result};
|
||||||
|
|
||||||
/// returns total and free bytes available in a directory, e.g. `/`.
|
/// returns total and free bytes available in a directory, e.g. `/`.
|
||||||
pub fn get_info(p: impl AsRef<Path>, _first_time: bool) -> std::io::Result<Info> {
|
pub fn get_info(p: impl AsRef<Path>) -> std::io::Result<Info> {
|
||||||
let stat_fs = statfs(p.as_ref())?;
|
let stat_fs = statfs(p.as_ref())?;
|
||||||
|
|
||||||
let bsize = stat_fs.block_size() as u64;
|
let bsize = stat_fs.block_size() as u64;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ fn get_fs_type(ftype: FsType) -> String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_info(path: &str, first_time: bool) -> Result<Info> {
|
pub fn get_info(path: &str) -> Result<Info> {
|
||||||
let statfs = statfs(path)?;
|
let statfs = statfs(path)?;
|
||||||
let reserved_blocks = statfs.blocks_free() - statfs.blocks_available();
|
let reserved_blocks = statfs.blocks_free() - statfs.blocks_available();
|
||||||
let mut info = Info {
|
let mut info = Info {
|
||||||
@@ -69,10 +69,6 @@ pub fn get_info(path: &str, first_time: bool) -> Result<Info> {
|
|||||||
|
|
||||||
info.used = info.total - info.free;
|
info.used = info.total - info.free;
|
||||||
|
|
||||||
if first_time {
|
|
||||||
// todo
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(info)
|
Ok(info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user