mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-19 16:16:48 +00:00
Small improvements to fs::statvfs_cache
This commit is contained in:
committed by
trapexit
parent
ed0cbcf064
commit
9d1a4696e9
+10
-10
@@ -23,8 +23,8 @@
|
||||
|
||||
#include "mutex.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
#include <time.h>
|
||||
@@ -36,11 +36,11 @@ struct Element
|
||||
struct statvfs st;
|
||||
};
|
||||
|
||||
typedef std::map<std::string,Element> statvfs_cache;
|
||||
typedef std::unordered_map<std::string,Element> statvfs_cache;
|
||||
|
||||
static u64 g_timeout = 0;
|
||||
static statvfs_cache g_cache;
|
||||
static Mutex g_cache_lock;
|
||||
static u64 g_timeout = 0;
|
||||
static statvfs_cache g_cache;
|
||||
static Mutex g_cache_lock;
|
||||
|
||||
|
||||
static
|
||||
@@ -67,8 +67,8 @@ fs::statvfs_cache_timeout(cu64 timeout_)
|
||||
}
|
||||
|
||||
int
|
||||
fs::statvfs_cache(const char *path_,
|
||||
struct statvfs *st_)
|
||||
fs::statvfs_cache(const std::string &path_,
|
||||
struct statvfs *st_)
|
||||
{
|
||||
int rv;
|
||||
Element *e;
|
||||
@@ -104,7 +104,7 @@ fs::statvfs_cache_readonly(const std::string &path_,
|
||||
int rv;
|
||||
struct statvfs st;
|
||||
|
||||
rv = fs::statvfs_cache(path_.c_str(),&st);
|
||||
rv = fs::statvfs_cache(path_,&st);
|
||||
if(rv == 0)
|
||||
*readonly_ = StatVFS::readonly(st);
|
||||
|
||||
@@ -118,7 +118,7 @@ fs::statvfs_cache_spaceavail(const std::string &path_,
|
||||
int rv;
|
||||
struct statvfs st;
|
||||
|
||||
rv = fs::statvfs_cache(path_.c_str(),&st);
|
||||
rv = fs::statvfs_cache(path_,&st);
|
||||
if(rv == 0)
|
||||
*spaceavail_ = StatVFS::spaceavail(st);
|
||||
|
||||
@@ -132,7 +132,7 @@ fs::statvfs_cache_spaceused(const std::string &path_,
|
||||
int rv;
|
||||
struct statvfs st;
|
||||
|
||||
rv = fs::statvfs_cache(path_.c_str(),&st);
|
||||
rv = fs::statvfs_cache(path_,&st);
|
||||
if(rv == 0)
|
||||
*spaceused_ = StatVFS::spaceused(st);
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace fs
|
||||
statvfs_cache_timeout(cu64 timeout);
|
||||
|
||||
int
|
||||
statvfs_cache(const char *path,
|
||||
struct statvfs *st);
|
||||
statvfs_cache(const std::string &path,
|
||||
struct statvfs *st);
|
||||
|
||||
int
|
||||
statvfs_cache_readonly(const std::string &path,
|
||||
|
||||
Reference in New Issue
Block a user