mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-19 16:16:48 +00:00
Convert stdint to short ints
This commit is contained in:
committed by
trapexit
parent
53c5a2cf1e
commit
511bf47af9
+10
-9
@@ -54,7 +54,8 @@
|
||||
|
||||
#include "fuse.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -63,8 +64,8 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
typedef ToFromWrapper<bool> ConfigBOOL;
|
||||
typedef ToFromWrapper<uint64_t> ConfigUINT64;
|
||||
typedef ToFromWrapper<int64_t> ConfigS64;
|
||||
typedef ToFromWrapper<u64> ConfigU64;
|
||||
typedef ToFromWrapper<s64> ConfigS64;
|
||||
typedef ToFromWrapper<int> ConfigINT;
|
||||
typedef ToFromWrapper<std::string> ConfigSTR;
|
||||
typedef ToFromWrapper<fs::path> ConfigPath;
|
||||
@@ -114,15 +115,15 @@ public:
|
||||
ConfigBOOL allow_idmap;
|
||||
ConfigBOOL async_read;
|
||||
Branches branches;
|
||||
ConfigUINT64 branches_mount_timeout;
|
||||
ConfigU64 branches_mount_timeout;
|
||||
ConfigBOOL branches_mount_timeout_fail;
|
||||
ConfigUINT64 cache_attr;
|
||||
ConfigUINT64 cache_entry;
|
||||
ConfigU64 cache_attr;
|
||||
ConfigU64 cache_entry;
|
||||
CacheFiles cache_files;
|
||||
ConfigSet cache_files_process_names;
|
||||
ConfigUINT64 cache_negative_entry;
|
||||
ConfigU64 cache_negative_entry;
|
||||
ConfigBOOL cache_readdir;
|
||||
ConfigUINT64 cache_statfs;
|
||||
ConfigU64 cache_statfs;
|
||||
ConfigBOOL cache_symlinks;
|
||||
ConfigBOOL cache_writeback;
|
||||
Categories category;
|
||||
@@ -159,7 +160,7 @@ public:
|
||||
TFSRef<int> process_thread_queue_depth;
|
||||
ProxyIOPrio proxy_ioprio;
|
||||
TFSRef<int> read_thread_count;
|
||||
ConfigUINT64 readahead;
|
||||
ConfigU64 readahead;
|
||||
FUSE::ReadDir readdir;
|
||||
RenameEXDEV rename_exdev;
|
||||
ConfigINT scheduling_priority;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
ConfigPageSize::ConfigPageSize(const uint64_t v_)
|
||||
ConfigPageSize::ConfigPageSize(cu64 v_)
|
||||
: _v(v_)
|
||||
{
|
||||
|
||||
@@ -46,8 +46,8 @@ ConfigPageSize::to_string(void) const
|
||||
int
|
||||
ConfigPageSize::from_string(const std::string_view s_)
|
||||
{
|
||||
uint64_t v;
|
||||
uint64_t pagesize;
|
||||
u64 v;
|
||||
u64 pagesize;
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
|
||||
@@ -18,17 +18,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "tofrom_string.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class ConfigPageSize : public ToFromString
|
||||
{
|
||||
private:
|
||||
uint64_t _v;
|
||||
u64 _v;
|
||||
|
||||
public:
|
||||
ConfigPageSize(const uint64_t);
|
||||
ConfigPageSize(cu64);
|
||||
ConfigPageSize(const std::string &);
|
||||
|
||||
public:
|
||||
@@ -37,14 +36,14 @@ public:
|
||||
|
||||
public:
|
||||
ConfigPageSize&
|
||||
operator=(const uint64_t v_)
|
||||
operator=(cu64 v_)
|
||||
{
|
||||
_v = v_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator uint64_t() const
|
||||
operator u64() const
|
||||
{
|
||||
return _v;
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public:
|
||||
};
|
||||
|
||||
inline
|
||||
uint64_t
|
||||
u64
|
||||
DirInfo::to_fh() const
|
||||
{
|
||||
ASSERT_NOT_NULL(this);
|
||||
|
||||
+3
-1
@@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
|
||||
|
||||
namespace endian
|
||||
{
|
||||
@@ -26,7 +28,7 @@ namespace endian
|
||||
bool
|
||||
is_big(void)
|
||||
{
|
||||
const union { uint32_t i; char c[4]; } u = { 0x01000000 };
|
||||
const union { u32 i; char c[4]; } u = { 0x01000000 };
|
||||
|
||||
return u.c[0];
|
||||
}
|
||||
|
||||
+12
-12
@@ -69,14 +69,14 @@ str::from(const std::string_view val_,
|
||||
|
||||
int
|
||||
str::from(const std::string_view val_,
|
||||
int64_t *rv_)
|
||||
s64 *rv_)
|
||||
{
|
||||
int64_t tmp;
|
||||
s64 tmp;
|
||||
const int base = 10;
|
||||
constexpr int64_t K = 1024LL;
|
||||
constexpr int64_t M = K * 1024LL;
|
||||
constexpr int64_t G = M * 1024LL;
|
||||
constexpr int64_t T = G * 1024LL;
|
||||
constexpr s64 K = 1024LL;
|
||||
constexpr s64 M = K * 1024LL;
|
||||
constexpr s64 G = M * 1024LL;
|
||||
constexpr s64 T = G * 1024LL;
|
||||
|
||||
auto [ptr,ec] = std::from_chars(val_.begin(),
|
||||
val_.end(),
|
||||
@@ -131,14 +131,14 @@ str::from(const std::string_view val_,
|
||||
|
||||
int
|
||||
str::from(const std::string_view val_,
|
||||
uint64_t *rv_)
|
||||
u64 *rv_)
|
||||
{
|
||||
uint64_t tmp;
|
||||
u64 tmp;
|
||||
const int base = 10;
|
||||
constexpr uint64_t K = 1024ULL;
|
||||
constexpr uint64_t M = K * 1024ULL;
|
||||
constexpr uint64_t G = M * 1024ULL;
|
||||
constexpr uint64_t T = G * 1024ULL;
|
||||
constexpr u64 K = 1024ULL;
|
||||
constexpr u64 M = K * 1024ULL;
|
||||
constexpr u64 G = M * 1024ULL;
|
||||
constexpr u64 T = G * 1024ULL;
|
||||
|
||||
auto [ptr,ec] = std::from_chars(val_.begin(),
|
||||
val_.end(),
|
||||
|
||||
+3
-3
@@ -18,9 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace str
|
||||
{
|
||||
int from(const std::string_view, bool *);
|
||||
int from(const std::string_view, int *);
|
||||
int from(const std::string_view, uint64_t *);
|
||||
int from(const std::string_view, int64_t *);
|
||||
int from(const std::string_view, u64 *);
|
||||
int from(const std::string_view, s64 *);
|
||||
int from(const std::string_view, std::string *);
|
||||
int from(const std::string_view, const std::string *);
|
||||
int from(const std::string_view, fs::path *);
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "fs_fstat.hpp"
|
||||
#include "fs_file_size.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include "fs_fstat.hpp"
|
||||
|
||||
|
||||
namespace fs
|
||||
{
|
||||
int64_t
|
||||
s64
|
||||
file_size(const int fd_)
|
||||
{
|
||||
int rv;
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
|
||||
namespace fs
|
||||
{
|
||||
int64_t
|
||||
s64
|
||||
file_size(const int fd);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
#include "fs_statvfs.hpp"
|
||||
#include "statvfs_util.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
bool
|
||||
fs::has_space(const std::string &str_,
|
||||
const int64_t size_)
|
||||
cs64 size_)
|
||||
{
|
||||
int rv;
|
||||
struct statvfs st;
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -26,5 +27,5 @@ namespace fs
|
||||
{
|
||||
bool
|
||||
has_space(const std::string &str,
|
||||
const int64_t size);
|
||||
cs64 size);
|
||||
}
|
||||
|
||||
+4
-4
@@ -18,15 +18,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
|
||||
namespace fs
|
||||
{
|
||||
struct info_t
|
||||
{
|
||||
bool readonly;
|
||||
uint64_t spaceavail;
|
||||
uint64_t spaceused;
|
||||
bool readonly;
|
||||
u64 spaceavail;
|
||||
u64 spaceused;
|
||||
};
|
||||
}
|
||||
|
||||
+22
-24
@@ -21,29 +21,27 @@
|
||||
#include "ef.hpp"
|
||||
#include "rapidhash/rapidhash.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <atomic>
|
||||
#include <pthread.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
typedef uint64_t (*inodefunc_t)(const std::string &,
|
||||
const std::string &,
|
||||
const mode_t,
|
||||
const ino_t);
|
||||
typedef u64 (*inodefunc_t)(const std::string &,
|
||||
const std::string &,
|
||||
const mode_t,
|
||||
const ino_t);
|
||||
|
||||
static uint64_t _hybrid_hash(const std::string &,
|
||||
const std::string &,
|
||||
const mode_t,
|
||||
const ino_t);
|
||||
static u64 _hybrid_hash(const std::string &,
|
||||
const std::string &,
|
||||
const mode_t,
|
||||
const ino_t);
|
||||
|
||||
|
||||
static std::atomic<inodefunc_t> g_func{::_hybrid_hash};
|
||||
|
||||
|
||||
static
|
||||
uint32_t
|
||||
_h64_to_h32(uint64_t h_)
|
||||
u32
|
||||
_h64_to_h32(u64 h_)
|
||||
{
|
||||
h_ ^= (h_ >> 32);
|
||||
h_ *= 0x9E3779B9;
|
||||
@@ -51,7 +49,7 @@ _h64_to_h32(uint64_t h_)
|
||||
}
|
||||
|
||||
static
|
||||
uint64_t
|
||||
u64
|
||||
_passthrough(const std::string &branch_path_,
|
||||
const std::string &fusepath_,
|
||||
const mode_t mode_,
|
||||
@@ -61,13 +59,13 @@ _passthrough(const std::string &branch_path_,
|
||||
}
|
||||
|
||||
static
|
||||
uint64_t
|
||||
u64
|
||||
_path_hash(const std::string &branch_path_,
|
||||
const std::string &fusepath_,
|
||||
const mode_t mode_,
|
||||
const ino_t ino_)
|
||||
{
|
||||
uint64_t seed;
|
||||
u64 seed;
|
||||
|
||||
seed = rapidhash(&fusepath_[0],fusepath_.size());
|
||||
|
||||
@@ -75,13 +73,13 @@ _path_hash(const std::string &branch_path_,
|
||||
}
|
||||
|
||||
static
|
||||
uint64_t
|
||||
u64
|
||||
_path_hash32(const std::string &branch_path_,
|
||||
const std::string &fusepath_,
|
||||
const mode_t mode_,
|
||||
const ino_t ino_)
|
||||
{
|
||||
uint64_t h;
|
||||
u64 h;
|
||||
|
||||
h = ::_path_hash(branch_path_,
|
||||
fusepath_,
|
||||
@@ -92,13 +90,13 @@ _path_hash32(const std::string &branch_path_,
|
||||
}
|
||||
|
||||
static
|
||||
uint64_t
|
||||
u64
|
||||
_devino_hash(const std::string &branch_path_,
|
||||
const std::string &fusepath_,
|
||||
const mode_t mode_,
|
||||
const ino_t ino_)
|
||||
{
|
||||
uint64_t seed;
|
||||
u64 seed;
|
||||
|
||||
seed = rapidhash(&branch_path_[0],branch_path_.size());
|
||||
seed = rapidhash_withSeed(&ino_,sizeof(ino_),seed);
|
||||
@@ -107,13 +105,13 @@ _devino_hash(const std::string &branch_path_,
|
||||
}
|
||||
|
||||
static
|
||||
uint64_t
|
||||
u64
|
||||
_devino_hash32(const std::string &branch_path_,
|
||||
const std::string &fusepath_,
|
||||
const mode_t mode_,
|
||||
const ino_t ino_)
|
||||
{
|
||||
uint64_t h;
|
||||
u64 h;
|
||||
|
||||
h = ::_devino_hash(branch_path_,
|
||||
fusepath_,
|
||||
@@ -124,7 +122,7 @@ _devino_hash32(const std::string &branch_path_,
|
||||
}
|
||||
|
||||
static
|
||||
uint64_t
|
||||
u64
|
||||
_hybrid_hash(const std::string &branch_path_,
|
||||
const std::string &fusepath_,
|
||||
const mode_t mode_,
|
||||
@@ -136,7 +134,7 @@ _hybrid_hash(const std::string &branch_path_,
|
||||
}
|
||||
|
||||
static
|
||||
uint64_t
|
||||
u64
|
||||
_hybrid_hash32(const std::string &branch_path_,
|
||||
const std::string &fusepath_,
|
||||
const mode_t mode_,
|
||||
@@ -192,7 +190,7 @@ fs::inode::get_algo(void)
|
||||
return {};
|
||||
}
|
||||
|
||||
uint64_t
|
||||
u64
|
||||
fs::inode::calc(const std::string &branch_path_,
|
||||
const std::string &fusepath_,
|
||||
const mode_t mode_,
|
||||
|
||||
+5
-5
@@ -18,9 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse_kernel.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <sys/stat.h>
|
||||
@@ -33,10 +33,10 @@ namespace fs
|
||||
int set_algo(const std::string &s);
|
||||
std::string get_algo(void);
|
||||
|
||||
uint64_t calc(const std::string &basepath,
|
||||
const std::string &fusepath,
|
||||
const mode_t mode,
|
||||
const ino_t ino);
|
||||
u64 calc(const std::string &basepath,
|
||||
const std::string &fusepath,
|
||||
const mode_t mode,
|
||||
const ino_t ino);
|
||||
|
||||
void calc(const std::string &basepath,
|
||||
const std::string &fusepath,
|
||||
|
||||
+11
-12
@@ -21,7 +21,6 @@
|
||||
#include "fmt/core.h"
|
||||
#include "fs_lstat.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
@@ -34,16 +33,16 @@
|
||||
|
||||
static
|
||||
std::string
|
||||
_generate_readahead_sys_path(const std::uint64_t major_,
|
||||
const std::uint64_t minor_)
|
||||
_generate_readahead_sys_path(cu64 major_,
|
||||
cu64 minor_)
|
||||
{
|
||||
return fmt::format("/sys/class/bdi/{}:{}/read_ahead_kb",major_,minor_);
|
||||
}
|
||||
|
||||
int
|
||||
fs::readahead(const std::uint64_t major_dev_,
|
||||
const std::uint64_t minor_dev_,
|
||||
const std::uint64_t size_in_kb_)
|
||||
fs::readahead(cu64 major_dev_,
|
||||
cu64 minor_dev_,
|
||||
cu64 size_in_kb_)
|
||||
{
|
||||
std::string syspath;
|
||||
std::ofstream ofs;
|
||||
@@ -61,11 +60,11 @@ fs::readahead(const std::uint64_t major_dev_,
|
||||
}
|
||||
|
||||
int
|
||||
fs::readahead(const std::uint64_t dev_,
|
||||
const std::uint64_t size_in_kb_)
|
||||
fs::readahead(cu64 dev_,
|
||||
cu64 size_in_kb_)
|
||||
{
|
||||
std::uint32_t major_dev;
|
||||
std::uint32_t minor_dev;
|
||||
u32 major_dev;
|
||||
u32 minor_dev;
|
||||
|
||||
major_dev = major(dev_);
|
||||
minor_dev = minor(dev_);
|
||||
@@ -74,8 +73,8 @@ fs::readahead(const std::uint64_t dev_,
|
||||
}
|
||||
|
||||
int
|
||||
fs::readahead(const std::string path_,
|
||||
const std::uint64_t size_in_kb_)
|
||||
fs::readahead(const std::string path_,
|
||||
cu64 size_in_kb_)
|
||||
{
|
||||
int rv;
|
||||
struct stat st;
|
||||
|
||||
@@ -18,22 +18,23 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace fs
|
||||
{
|
||||
int
|
||||
readahead(const std::uint64_t major_dev,
|
||||
const std::uint64_t minor_dev,
|
||||
const std::uint64_t size_in_kb);
|
||||
readahead(cu64 major_dev,
|
||||
cu64 minor_dev,
|
||||
cu64 size_in_kb);
|
||||
|
||||
int
|
||||
readahead(const std::uint64_t dev,
|
||||
const std::uint64_t size_in_kb);
|
||||
readahead(cu64 dev,
|
||||
cu64 size_in_kb);
|
||||
|
||||
int
|
||||
readahead(const std::string path,
|
||||
const std::uint64_t size_in_kb);
|
||||
readahead(const std::string path,
|
||||
cu64 size_in_kb);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "mutex.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
@@ -33,36 +32,36 @@
|
||||
|
||||
struct Element
|
||||
{
|
||||
uint64_t time;
|
||||
u64 time;
|
||||
struct statvfs st;
|
||||
};
|
||||
|
||||
typedef std::map<std::string,Element> statvfs_cache;
|
||||
|
||||
static uint64_t g_timeout = 0;
|
||||
static u64 g_timeout = 0;
|
||||
static statvfs_cache g_cache;
|
||||
static Mutex g_cache_lock;
|
||||
|
||||
|
||||
static
|
||||
uint64_t
|
||||
u64
|
||||
_get_time(void)
|
||||
{
|
||||
uint64_t rv;
|
||||
u64 rv;
|
||||
|
||||
rv = ::time(NULL);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
u64
|
||||
fs::statvfs_cache_timeout(void)
|
||||
{
|
||||
return g_timeout;
|
||||
}
|
||||
|
||||
void
|
||||
fs::statvfs_cache_timeout(const uint64_t timeout_)
|
||||
fs::statvfs_cache_timeout(cu64 timeout_)
|
||||
{
|
||||
g_timeout = timeout_;
|
||||
}
|
||||
@@ -73,7 +72,7 @@ fs::statvfs_cache(const char *path_,
|
||||
{
|
||||
int rv;
|
||||
Element *e;
|
||||
uint64_t now;
|
||||
u64 now;
|
||||
|
||||
if(g_timeout == 0)
|
||||
return fs::statvfs(path_,st_);
|
||||
@@ -114,7 +113,7 @@ fs::statvfs_cache_readonly(const std::string &path_,
|
||||
|
||||
int
|
||||
fs::statvfs_cache_spaceavail(const std::string &path_,
|
||||
uint64_t *spaceavail_)
|
||||
u64 *spaceavail_)
|
||||
{
|
||||
int rv;
|
||||
struct statvfs st;
|
||||
@@ -128,7 +127,7 @@ fs::statvfs_cache_spaceavail(const std::string &path_,
|
||||
|
||||
int
|
||||
fs::statvfs_cache_spaceused(const std::string &path_,
|
||||
uint64_t *spaceused_)
|
||||
u64 *spaceused_)
|
||||
{
|
||||
int rv;
|
||||
struct statvfs st;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
|
||||
namespace fs
|
||||
{
|
||||
uint64_t
|
||||
u64
|
||||
statvfs_cache_timeout(void);
|
||||
void
|
||||
statvfs_cache_timeout(const uint64_t timeout);
|
||||
statvfs_cache_timeout(cu64 timeout);
|
||||
|
||||
int
|
||||
statvfs_cache(const char *path,
|
||||
@@ -42,9 +42,9 @@ namespace fs
|
||||
|
||||
int
|
||||
statvfs_cache_spaceavail(const std::string &path,
|
||||
uint64_t *spaceavail);
|
||||
u64 *spaceavail);
|
||||
|
||||
int
|
||||
statvfs_cache_spaceused(const std::string &path,
|
||||
uint64_t *spaceused);
|
||||
u64 *spaceused);
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ int
|
||||
FUSE::bmap(const fuse_req_ctx_t *ctx_,
|
||||
const char *fusepath_,
|
||||
size_t blocksize_,
|
||||
uint64_t *idx_)
|
||||
u64 *idx_)
|
||||
{
|
||||
(void)ctx_;
|
||||
(void)fusepath_;
|
||||
|
||||
+2
-2
@@ -18,10 +18,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse_req_ctx.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace FUSE
|
||||
@@ -30,5 +30,5 @@ namespace FUSE
|
||||
bmap(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
size_t blocksize,
|
||||
uint64_t *idx);
|
||||
u64 *idx);
|
||||
}
|
||||
|
||||
+3
-3
@@ -218,11 +218,11 @@ _create(const ugid_t ugid_,
|
||||
}
|
||||
|
||||
constexpr
|
||||
uint64_t
|
||||
u64
|
||||
_(const PassthroughIOEnum e_,
|
||||
const uint64_t m_)
|
||||
cu64 m_)
|
||||
{
|
||||
return ((((uint64_t)e_) << 32) | (m_ & O_ACCMODE));
|
||||
return ((((u64)e_) << 32) | (m_ & O_ACCMODE));
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
@@ -43,12 +43,12 @@ _fallocate(const int fd_,
|
||||
|
||||
int
|
||||
FUSE::fallocate(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
int mode_,
|
||||
off_t offset_,
|
||||
off_t len_)
|
||||
cu64 fh_,
|
||||
int mode_,
|
||||
off_t offset_,
|
||||
off_t len_)
|
||||
{
|
||||
uint64_t fh;
|
||||
u64 fh;
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
|
||||
@@ -25,8 +26,8 @@ namespace FUSE
|
||||
{
|
||||
int
|
||||
fallocate(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
int mode,
|
||||
off_t offset,
|
||||
off_t len);
|
||||
cu64 fh,
|
||||
int mode,
|
||||
off_t offset,
|
||||
off_t len);
|
||||
}
|
||||
|
||||
+3
-3
@@ -40,10 +40,10 @@ _fchmod(const int fd_,
|
||||
|
||||
int
|
||||
FUSE::fchmod(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
const mode_t mode_)
|
||||
cu64 fh_,
|
||||
const mode_t mode_)
|
||||
{
|
||||
uint64_t fh;
|
||||
u64 fh;
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
#include "fuse_req_ctx.h"
|
||||
@@ -29,6 +30,6 @@ namespace FUSE
|
||||
{
|
||||
int
|
||||
fchmod(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
const mode_t mode);
|
||||
cu64 fh,
|
||||
const mode_t mode);
|
||||
}
|
||||
|
||||
+4
-4
@@ -43,11 +43,11 @@ _fchown(const int fd_,
|
||||
|
||||
int
|
||||
FUSE::fchown(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
const uid_t uid_,
|
||||
const gid_t gid_)
|
||||
cu64 fh_,
|
||||
const uid_t uid_,
|
||||
const gid_t gid_)
|
||||
{
|
||||
uint64_t fh;
|
||||
u64 fh;
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
|
||||
+4
-3
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace FUSE
|
||||
{
|
||||
int
|
||||
fchown(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
uid_t uid,
|
||||
gid_t gid);
|
||||
cu64 fh,
|
||||
uid_t uid,
|
||||
gid_t gid);
|
||||
}
|
||||
|
||||
@@ -49,12 +49,12 @@ _fgetattr(const FileInfo *fi_,
|
||||
|
||||
int
|
||||
FUSE::fgetattr(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
cu64 fh_,
|
||||
struct stat *st_,
|
||||
fuse_timeouts_t *timeout_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t fh;
|
||||
u64 fh;
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
@@ -29,7 +30,7 @@ namespace FUSE
|
||||
{
|
||||
int
|
||||
fgetattr(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
struct stat *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
cu64 fh,
|
||||
struct stat *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
}
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ FUSE::flock(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
int op_)
|
||||
{
|
||||
uint64_t fh;
|
||||
u64 fh;
|
||||
|
||||
fh = ffi_->fh;
|
||||
if(fh == 0)
|
||||
|
||||
+2
-2
@@ -46,8 +46,8 @@ _fsync(const int fd_,
|
||||
|
||||
int
|
||||
FUSE::fsync(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
int isdatasync_)
|
||||
cu64 fh_,
|
||||
int isdatasync_)
|
||||
{
|
||||
FileInfo *fi = FileInfo::from_fh(fh_);
|
||||
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace FUSE
|
||||
{
|
||||
int
|
||||
fsync(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
int isdatasync);
|
||||
cu64 fh,
|
||||
int isdatasync);
|
||||
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ _ftruncate(const int fd_,
|
||||
|
||||
int
|
||||
FUSE::ftruncate(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
off_t size_)
|
||||
cu64 fh_,
|
||||
off_t size_)
|
||||
{
|
||||
uint64_t fh;
|
||||
u64 fh;
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -28,6 +29,6 @@ namespace FUSE
|
||||
{
|
||||
int
|
||||
ftruncate(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
off_t size);
|
||||
cu64 fh,
|
||||
off_t size);
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ _futimens(const int fd_,
|
||||
|
||||
int
|
||||
FUSE::futimens(const fuse_req_ctx_t *ctx_,
|
||||
const uint64_t fh_,
|
||||
const struct timespec ts_[2])
|
||||
cu64 fh_,
|
||||
const struct timespec ts_[2])
|
||||
{
|
||||
uint64_t fh;
|
||||
u64 fh;
|
||||
|
||||
fh = fh_;
|
||||
if(fh == 0)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
@@ -27,6 +28,6 @@ namespace FUSE
|
||||
{
|
||||
int
|
||||
futimens(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
const timespec ts[2]);
|
||||
cu64 fh,
|
||||
const timespec ts[2]);
|
||||
}
|
||||
|
||||
+10
-10
@@ -83,7 +83,7 @@ _want_if_capable_max_pages(fuse_conn_info_t *conn_,
|
||||
Config &cfg_)
|
||||
{
|
||||
std::fstream f;
|
||||
uint64_t max_pages_limit;
|
||||
u64 max_pages_limit;
|
||||
|
||||
if(fs::exists(MAX_PAGES_LIMIT_FILEPATH))
|
||||
{
|
||||
@@ -91,8 +91,8 @@ _want_if_capable_max_pages(fuse_conn_info_t *conn_,
|
||||
SysLog::info("fuse_msg_size > {}: setting it to {}",
|
||||
MAX_FUSE_MSG_SIZE,
|
||||
MAX_FUSE_MSG_SIZE);
|
||||
cfg_.fuse_msg_size = std::min((uint64_t)cfg_.fuse_msg_size,
|
||||
(uint64_t)MAX_FUSE_MSG_SIZE);
|
||||
cfg_.fuse_msg_size = std::min((u64)cfg_.fuse_msg_size,
|
||||
(u64)MAX_FUSE_MSG_SIZE);
|
||||
|
||||
f.open(MAX_PAGES_LIMIT_FILEPATH,f.in|f.out);
|
||||
if(f.is_open())
|
||||
@@ -104,11 +104,11 @@ _want_if_capable_max_pages(fuse_conn_info_t *conn_,
|
||||
if(cfg_.fuse_msg_size > max_pages_limit)
|
||||
{
|
||||
f.seekp(0);
|
||||
f << (uint64_t)cfg_.fuse_msg_size;
|
||||
f << (u64)cfg_.fuse_msg_size;
|
||||
f.flush();
|
||||
SysLog::info("{} changed to {}",
|
||||
MAX_PAGES_LIMIT_FILEPATH,
|
||||
(uint64_t)cfg_.fuse_msg_size);
|
||||
(u64)cfg_.fuse_msg_size);
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
@@ -122,11 +122,11 @@ _want_if_capable_max_pages(fuse_conn_info_t *conn_,
|
||||
{
|
||||
if(cfg_.fuse_msg_size > FUSE_DEFAULT_MAX_MAX_PAGES)
|
||||
SysLog::info("fuse_msg_size request {} > {}: setting it to {}",
|
||||
(uint64_t)cfg_.fuse_msg_size,
|
||||
(u64)cfg_.fuse_msg_size,
|
||||
FUSE_DEFAULT_MAX_MAX_PAGES,
|
||||
FUSE_DEFAULT_MAX_MAX_PAGES);
|
||||
cfg_.fuse_msg_size = std::min((uint64_t)cfg_.fuse_msg_size,
|
||||
(uint64_t)FUSE_DEFAULT_MAX_MAX_PAGES);
|
||||
cfg_.fuse_msg_size = std::min((u64)cfg_.fuse_msg_size,
|
||||
(u64)FUSE_DEFAULT_MAX_MAX_PAGES);
|
||||
}
|
||||
|
||||
if(::_capable(conn_,FUSE_CAP_MAX_PAGES))
|
||||
@@ -134,7 +134,7 @@ _want_if_capable_max_pages(fuse_conn_info_t *conn_,
|
||||
::_want(conn_,FUSE_CAP_MAX_PAGES);
|
||||
fuse_cfg.max_pages = cfg_.fuse_msg_size;
|
||||
SysLog::info("requesting max pages size of {}",
|
||||
(uint64_t)cfg_.fuse_msg_size);
|
||||
(u64)cfg_.fuse_msg_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -162,7 +162,7 @@ _set_readahead_on_mount_and_branches()
|
||||
{
|
||||
Branches::Ptr branches;
|
||||
|
||||
if((uint64_t)cfg.readahead == 0)
|
||||
if((u64)cfg.readahead == 0)
|
||||
return;
|
||||
|
||||
::_readahead(cfg.mountpoint,cfg.readahead);
|
||||
|
||||
+9
-9
@@ -81,9 +81,9 @@
|
||||
static
|
||||
int
|
||||
_ioctl(const int fd_,
|
||||
const uint32_t cmd_,
|
||||
const u32 cmd_,
|
||||
void *data_,
|
||||
uint32_t *out_bufsz_)
|
||||
u32 *out_bufsz_)
|
||||
{
|
||||
int rv;
|
||||
|
||||
@@ -109,9 +109,9 @@ static
|
||||
int
|
||||
_ioctl_file(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
const uint32_t cmd_,
|
||||
const u32 cmd_,
|
||||
void *data_,
|
||||
uint32_t *out_bufsz_)
|
||||
u32 *out_bufsz_)
|
||||
{
|
||||
FileInfo *fi = FileInfo::from_fh(ffi_->fh);
|
||||
|
||||
@@ -127,9 +127,9 @@ int
|
||||
_ioctl_dir_base(const Policy::Search &searchFunc_,
|
||||
const Branches &branches_,
|
||||
const fs::path &fusepath_,
|
||||
const uint32_t cmd_,
|
||||
const u32 cmd_,
|
||||
void *data_,
|
||||
uint32_t *out_bufsz_)
|
||||
u32 *out_bufsz_)
|
||||
{
|
||||
int fd;
|
||||
int rv;
|
||||
@@ -157,9 +157,9 @@ static
|
||||
int
|
||||
_ioctl_dir(const fuse_req_ctx_t *ctx_,
|
||||
const fuse_file_info_t *ffi_,
|
||||
const uint32_t cmd_,
|
||||
const u32 cmd_,
|
||||
void *data_,
|
||||
uint32_t *out_bufsz_)
|
||||
u32 *out_bufsz_)
|
||||
{
|
||||
DirInfo *di = DirInfo::from_fh(ffi_->fh);
|
||||
|
||||
@@ -185,7 +185,7 @@ FUSE::ioctl(const fuse_req_ctx_t *ctx_,
|
||||
void *arg_,
|
||||
unsigned int flags_,
|
||||
void *data_,
|
||||
uint32_t *out_bufsz_)
|
||||
u32 *out_bufsz_)
|
||||
{
|
||||
if(::_is_btrfs_ioctl_cmd(cmd_))
|
||||
return -ENOTTY;
|
||||
|
||||
+2
-3
@@ -18,8 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
|
||||
@@ -32,5 +31,5 @@ namespace FUSE
|
||||
void *arg,
|
||||
unsigned int flags,
|
||||
void *data,
|
||||
uint32_t *out_bufsz);
|
||||
u32 *out_bufsz);
|
||||
}
|
||||
|
||||
+3
-3
@@ -266,11 +266,11 @@ _open(const Policy::Search &searchFunc_,
|
||||
}
|
||||
|
||||
constexpr
|
||||
uint64_t
|
||||
u64
|
||||
_(const PassthroughIOEnum e_,
|
||||
const uint64_t m_)
|
||||
const u64 m_)
|
||||
{
|
||||
return ((((uint64_t)e_) << 32) | (m_ & O_ACCMODE));
|
||||
return ((((u64)e_) << 32) | (m_ & O_ACCMODE));
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
@@ -21,16 +21,14 @@
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
ssize_t
|
||||
FUSE::setupmapping(const fuse_req_ctx_t *ctx_,
|
||||
uint64_t *fh_,
|
||||
uint64_t foffset_,
|
||||
uint64_t len_,
|
||||
uint64_t flags_,
|
||||
uint64_t moffset_)
|
||||
u64 *fh_,
|
||||
cu64 foffset_,
|
||||
cu64 len_,
|
||||
cu64 flags_,
|
||||
cu64 moffset_)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
@@ -18,15 +18,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
ssize_t setupmapping(const fuse_req_ctx_t *ctx,
|
||||
uint64_t *fh_,
|
||||
uint64_t foffset_,
|
||||
uint64_t len_,
|
||||
uint64_t flags_,
|
||||
uint64_t moffset_);
|
||||
u64 *fh_,
|
||||
cu64 foffset_,
|
||||
cu64 len_,
|
||||
cu64 flags_,
|
||||
cu64 moffset_);
|
||||
}
|
||||
|
||||
+6
-6
@@ -18,23 +18,23 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fuse.h"
|
||||
#include "fuse_kernel.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int statx(const fuse_req_ctx_t *ctx,
|
||||
const char *fusepath,
|
||||
const uint32_t flags,
|
||||
const uint32_t mask,
|
||||
cu32 flags,
|
||||
cu32 mask,
|
||||
struct fuse_statx *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
int statx_fh(const fuse_req_ctx_t *ctx,
|
||||
const uint64_t fh,
|
||||
const uint32_t flags,
|
||||
const uint32_t mask,
|
||||
cu64 fh,
|
||||
cu32 flags,
|
||||
cu32 mask,
|
||||
struct fuse_statx *st,
|
||||
fuse_timeouts_t *timeout);
|
||||
}
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "khash/khash.h"
|
||||
#include "rapidhash/rapidhash.h"
|
||||
|
||||
@@ -39,10 +40,10 @@ public:
|
||||
inline
|
||||
int
|
||||
put(const char *str_,
|
||||
const uint64_t len_)
|
||||
cu64 len_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t h;
|
||||
u64 h;
|
||||
khint_t key;
|
||||
|
||||
h = rapidhash(str_,len_);
|
||||
|
||||
+2
-2
@@ -199,7 +199,7 @@ _wait_for_mount()
|
||||
paths = cfg.branches->to_paths();
|
||||
|
||||
SysLog::info("Waiting {} seconds for {} branches to mount",
|
||||
(uint64_t)cfg.branches_mount_timeout,
|
||||
(u64)cfg.branches_mount_timeout,
|
||||
paths.size());
|
||||
|
||||
timeout = std::chrono::milliseconds(cfg.branches_mount_timeout * 1000);
|
||||
@@ -214,7 +214,7 @@ _wait_for_mount()
|
||||
" within the timeout of {}s. Exiting",
|
||||
failures,
|
||||
paths.size(),
|
||||
(uint64_t)cfg.branches_mount_timeout);
|
||||
(u64)cfg.branches_mount_timeout);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "ef.hpp"
|
||||
#include "num.hpp"
|
||||
|
||||
#include "fmt/core.h"
|
||||
|
||||
@@ -25,8 +26,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#define KB (1024ULL)
|
||||
#define MB (KB * 1024ULL)
|
||||
@@ -37,7 +36,7 @@
|
||||
namespace num
|
||||
{
|
||||
std::string
|
||||
humanize(const uint64_t bytes_)
|
||||
humanize(cu64 bytes_)
|
||||
{
|
||||
if(bytes_ < KB)
|
||||
return fmt::format("{}",bytes_);
|
||||
|
||||
+3
-2
@@ -18,11 +18,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace num
|
||||
{
|
||||
std::string humanize(const uint64_t bytes);
|
||||
std::string humanize(cu64 bytes);
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ _create(const Branches::Ptr &branches_,
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t eplfs;
|
||||
u64 eplfs;
|
||||
Branch *obranch;
|
||||
fs::info_t info;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
eplfs = std::numeric_limits<uint64_t>::max();
|
||||
eplfs = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
@@ -86,13 +86,13 @@ _action(const Branches::Ptr &branches_,
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t eplfs;
|
||||
u64 eplfs;
|
||||
Branch *obranch;
|
||||
fs::info_t info;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
eplfs = std::numeric_limits<uint64_t>::max();
|
||||
eplfs = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro())
|
||||
@@ -126,12 +126,12 @@ _search(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t eplfs;
|
||||
uint64_t spaceavail;
|
||||
u64 eplfs;
|
||||
u64 spaceavail;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
eplfs = std::numeric_limits<uint64_t>::max();
|
||||
eplfs = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(!fs::exists(branch.path,fusepath_))
|
||||
|
||||
@@ -41,13 +41,13 @@ _create(const Branches::Ptr &branches_,
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t eplus;
|
||||
u64 eplus;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
eplus = std::numeric_limits<uint64_t>::max();
|
||||
eplus = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
@@ -84,13 +84,13 @@ _action(const Branches::Ptr &branches_,
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t eplus;
|
||||
u64 eplus;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
eplus = std::numeric_limits<uint64_t>::max();
|
||||
eplus = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro())
|
||||
@@ -124,8 +124,8 @@ _search(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t eplus;
|
||||
uint64_t spaceused;
|
||||
u64 eplus;
|
||||
u64 spaceused;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
|
||||
@@ -39,13 +39,13 @@ _create(const Branches::Ptr &branches_,
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t epmfs;
|
||||
u64 epmfs;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
epmfs = std::numeric_limits<uint64_t>::min();
|
||||
epmfs = std::numeric_limits<u64>::min();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
@@ -82,13 +82,13 @@ _action(const Branches::Ptr &branches_,
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t epmfs;
|
||||
u64 epmfs;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
epmfs = std::numeric_limits<uint64_t>::min();
|
||||
epmfs = std::numeric_limits<u64>::min();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro())
|
||||
@@ -122,8 +122,8 @@ _search(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t epmfs;
|
||||
uint64_t spaceavail;
|
||||
u64 epmfs;
|
||||
u64 spaceavail;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
|
||||
+10
-10
@@ -46,7 +46,7 @@ int
|
||||
_get_branchinfo_create(const Branches::Ptr &branches_,
|
||||
const fs::path &fusepath_,
|
||||
BranchInfoVec *branchinfo_,
|
||||
uint64_t *sum_)
|
||||
u64 *sum_)
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
@@ -81,7 +81,7 @@ int
|
||||
_get_branchinfo_action(const Branches::Ptr &branches_,
|
||||
const fs::path &fusepath_,
|
||||
BranchInfoVec *branchinfo_,
|
||||
uint64_t *sum_)
|
||||
u64 *sum_)
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
@@ -114,10 +114,10 @@ int
|
||||
_get_branchinfo_search(const Branches::Ptr &branches_,
|
||||
const fs::path &fusepath_,
|
||||
BranchInfoVec *branchinfo_,
|
||||
uint64_t *sum_)
|
||||
u64 *sum_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t spaceavail;
|
||||
u64 spaceavail;
|
||||
|
||||
*sum_ = 0;
|
||||
for(auto &branch : *branches_)
|
||||
@@ -139,10 +139,10 @@ _get_branchinfo_search(const Branches::Ptr &branches_,
|
||||
static
|
||||
Branch*
|
||||
_get_branch(const BranchInfoVec &branchinfo_,
|
||||
const uint64_t sum_)
|
||||
cu64 sum_)
|
||||
{
|
||||
uint64_t idx;
|
||||
uint64_t threshold;
|
||||
u64 idx;
|
||||
u64 threshold;
|
||||
|
||||
if(sum_ == 0)
|
||||
return NULL;
|
||||
@@ -169,7 +169,7 @@ _create(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int err;
|
||||
uint64_t sum;
|
||||
u64 sum;
|
||||
Branch *branch;
|
||||
BranchInfoVec branchinfo;
|
||||
|
||||
@@ -190,7 +190,7 @@ _action(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int err;
|
||||
uint64_t sum;
|
||||
u64 sum;
|
||||
Branch *branch;
|
||||
BranchInfoVec branchinfo;
|
||||
|
||||
@@ -211,7 +211,7 @@ _search(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int err;
|
||||
uint64_t sum;
|
||||
u64 sum;
|
||||
Branch *branch;
|
||||
BranchInfoVec branchinfo;
|
||||
|
||||
|
||||
+2
-2
@@ -39,13 +39,13 @@ _create(const Branches::Ptr &branches_,
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t lfs;
|
||||
u64 lfs;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
lfs = std::numeric_limits<uint64_t>::max();
|
||||
lfs = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
|
||||
+2
-2
@@ -42,13 +42,13 @@ _create(const Branches::Ptr &branches_,
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t lus;
|
||||
u64 lus;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
lus = std::numeric_limits<uint64_t>::max();
|
||||
lus = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
|
||||
@@ -41,12 +41,12 @@ _create_1(const Branches::Ptr &branches_,
|
||||
int *err_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t lfs;
|
||||
u64 lfs;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
lfs = std::numeric_limits<uint64_t>::max();
|
||||
lfs = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
|
||||
@@ -38,12 +38,12 @@ _create_1(const Branches::Ptr &branches_,
|
||||
int *err_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t lus;
|
||||
u64 lus;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
lus = std::numeric_limits<uint64_t>::max();
|
||||
lus = std::numeric_limits<u64>::max();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
|
||||
@@ -40,12 +40,12 @@ _create_1(const Branches::Ptr &branches_,
|
||||
int *err_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t mfs;
|
||||
u64 mfs;
|
||||
fs::info_t info;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
mfs = std::numeric_limits<uint64_t>::min();
|
||||
mfs = std::numeric_limits<u64>::min();
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
|
||||
@@ -45,7 +45,7 @@ int
|
||||
_create_1(const Branches::Ptr &branches_,
|
||||
const fs::path &fusepath_,
|
||||
BranchInfoVec *branchinfo_,
|
||||
uint64_t *sum_)
|
||||
u64 *sum_)
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
@@ -80,7 +80,7 @@ int
|
||||
_get_branchinfo(const Branches::Ptr &branches_,
|
||||
const fs::path &fusepath_,
|
||||
BranchInfoVec *branchinfo_,
|
||||
uint64_t *sum_)
|
||||
u64 *sum_)
|
||||
{
|
||||
int rv;
|
||||
fs::path fusepath;
|
||||
@@ -102,10 +102,10 @@ _get_branchinfo(const Branches::Ptr &branches_,
|
||||
static
|
||||
Branch*
|
||||
_get_branch(const BranchInfoVec &branchinfo_,
|
||||
const uint64_t sum_)
|
||||
cu64 sum_)
|
||||
{
|
||||
uint64_t idx;
|
||||
uint64_t threshold;
|
||||
u64 idx;
|
||||
u64 threshold;
|
||||
|
||||
if(sum_ == 0)
|
||||
return nullptr;
|
||||
@@ -132,7 +132,7 @@ _create(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int rv;
|
||||
uint64_t sum;
|
||||
u64 sum;
|
||||
Branch *branch;
|
||||
BranchInfoVec branchinfo;
|
||||
|
||||
|
||||
+7
-7
@@ -34,8 +34,8 @@
|
||||
|
||||
struct BranchInfo
|
||||
{
|
||||
uint64_t spaceavail;
|
||||
Branch *branch;
|
||||
u64 spaceavail;
|
||||
Branch *branch;
|
||||
};
|
||||
|
||||
typedef std::vector<BranchInfo> BranchInfoVec;
|
||||
@@ -44,7 +44,7 @@ static
|
||||
int
|
||||
_get_branchinfo(const Branches::Ptr &branches_,
|
||||
BranchInfoVec *branchinfo_,
|
||||
uint64_t *sum_)
|
||||
u64 *sum_)
|
||||
{
|
||||
int rv;
|
||||
int err;
|
||||
@@ -75,10 +75,10 @@ _get_branchinfo(const Branches::Ptr &branches_,
|
||||
static
|
||||
Branch*
|
||||
_get_branch(const BranchInfoVec &branchinfo_,
|
||||
const uint64_t sum_)
|
||||
cu64 sum_)
|
||||
{
|
||||
uint64_t idx;
|
||||
uint64_t threshold;
|
||||
u64 idx;
|
||||
u64 threshold;
|
||||
|
||||
if(sum_ == 0)
|
||||
return nullptr;
|
||||
@@ -105,7 +105,7 @@ _create(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int err;
|
||||
uint64_t sum;
|
||||
u64 sum;
|
||||
Branch *branch;
|
||||
BranchInfoVec branchinfo;
|
||||
|
||||
|
||||
+9
-11
@@ -20,12 +20,10 @@
|
||||
|
||||
#include "rapidhash/rapidhash.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
static uint64_t G_SEED;
|
||||
static u64 G_SEED;
|
||||
|
||||
__attribute__((constructor))
|
||||
static
|
||||
@@ -43,28 +41,28 @@ _constructor()
|
||||
|
||||
// Lifted from wyhash.h's wyrand()
|
||||
static
|
||||
uint64_t
|
||||
_rapidhash_rand(uint64_t *seed_)
|
||||
u64
|
||||
_rapidhash_rand(u64 *seed_)
|
||||
{
|
||||
*seed_ += 0x2d358dccaa6c78a5ull;
|
||||
return rapid_mix(*seed_,*seed_ ^ 0x8bb84b93962eacc9ull);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
u64
|
||||
RND::rand64(void)
|
||||
{
|
||||
return _rapidhash_rand(&G_SEED);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
RND::rand64(const uint64_t max_)
|
||||
u64
|
||||
RND::rand64(cu64 max_)
|
||||
{
|
||||
return (RND::rand64() % max_);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
RND::rand64(const uint64_t min_,
|
||||
const uint64_t max_)
|
||||
u64
|
||||
RND::rand64(cu64 min_,
|
||||
cu64 max_)
|
||||
{
|
||||
return (min_ + (RND::rand64() % (max_ - min_)));
|
||||
}
|
||||
|
||||
+6
-5
@@ -18,7 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
#include <random>
|
||||
|
||||
class RND
|
||||
@@ -27,10 +28,10 @@ public:
|
||||
RND();
|
||||
|
||||
public:
|
||||
static uint64_t rand64(void);
|
||||
static uint64_t rand64(const uint64_t max_);
|
||||
static uint64_t rand64(const uint64_t min_,
|
||||
const uint64_t max_);
|
||||
static u64 rand64(void);
|
||||
static u64 rand64(cu64 max_);
|
||||
static u64 rand64(cu64 min_,
|
||||
cu64 max_);
|
||||
|
||||
template<typename T>
|
||||
static
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "base_types.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
@@ -36,7 +37,7 @@ namespace StatVFS
|
||||
|
||||
static
|
||||
inline
|
||||
int64_t
|
||||
s64
|
||||
spaceavail(const struct statvfs &st_)
|
||||
{
|
||||
return (st_.f_frsize * st_.f_bavail);
|
||||
@@ -44,7 +45,7 @@ namespace StatVFS
|
||||
|
||||
static
|
||||
inline
|
||||
int64_t
|
||||
s64
|
||||
spaceused(const struct statvfs &st_)
|
||||
{
|
||||
return (st_.f_frsize * (st_.f_blocks - st_.f_bavail));
|
||||
|
||||
+2
-3
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "fmt/core.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -37,13 +36,13 @@ str::to(const int int_)
|
||||
}
|
||||
|
||||
std::string
|
||||
str::to(const uint64_t uint64_)
|
||||
str::to(cu64 uint64_)
|
||||
{
|
||||
return fmt::format("{}",uint64_);
|
||||
}
|
||||
|
||||
std::string
|
||||
str::to(const int64_t int64_)
|
||||
str::to(cs64 int64_)
|
||||
{
|
||||
return fmt::format("{}",int64_);
|
||||
}
|
||||
|
||||
+3
-3
@@ -18,9 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base_types.h"
|
||||
#include "fs_path.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace str
|
||||
{
|
||||
std::string to(const bool);
|
||||
std::string to(const int);
|
||||
std::string to(const uint64_t);
|
||||
std::string to(const int64_t);
|
||||
std::string to(cu64);
|
||||
std::string to(cs64);
|
||||
std::string to(const std::string&);
|
||||
std::string to(const fs::path&);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user