From 511bf47af9a786d7ede5af0f54783c6d8d7d0efd Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Sun, 1 Mar 2026 13:58:06 -0600 Subject: [PATCH] Convert stdint to short ints --- src/config.hpp | 19 ++++++++-------- src/config_pagesize.cpp | 6 ++--- src/config_pagesize.hpp | 11 +++++----- src/dirinfo.hpp | 2 +- src/endian.hpp | 4 +++- src/from_string.cpp | 24 ++++++++++---------- src/from_string.hpp | 6 ++--- src/fs_file_size.cpp | 6 ++--- src/fs_file_size.hpp | 4 ++-- src/fs_has_space.cpp | 3 +-- src/fs_has_space.hpp | 5 +++-- src/fs_info_t.hpp | 8 +++---- src/fs_inode.cpp | 46 +++++++++++++++++++-------------------- src/fs_inode.hpp | 10 ++++----- src/fs_readahead.cpp | 23 ++++++++++---------- src/fs_readahead.hpp | 17 ++++++++------- src/fs_statvfs_cache.cpp | 19 ++++++++-------- src/fs_statvfs_cache.hpp | 10 ++++----- src/fuse_bmap.cpp | 2 +- src/fuse_bmap.hpp | 4 ++-- src/fuse_create.cpp | 6 ++--- src/fuse_fallocate.cpp | 10 ++++----- src/fuse_fallocate.hpp | 9 ++++---- src/fuse_fchmod.cpp | 6 ++--- src/fuse_fchmod.hpp | 5 +++-- src/fuse_fchown.cpp | 8 +++---- src/fuse_fchown.hpp | 7 +++--- src/fuse_fgetattr.cpp | 8 +++---- src/fuse_fgetattr.hpp | 7 +++--- src/fuse_flock.cpp | 2 +- src/fuse_fsync.cpp | 4 ++-- src/fuse_fsync.hpp | 5 +++-- src/fuse_ftruncate.cpp | 6 ++--- src/fuse_ftruncate.hpp | 5 +++-- src/fuse_futimens.cpp | 6 ++--- src/fuse_futimens.hpp | 5 +++-- src/fuse_init.cpp | 20 ++++++++--------- src/fuse_ioctl.cpp | 18 +++++++-------- src/fuse_ioctl.hpp | 5 ++--- src/fuse_open.cpp | 6 ++--- src/fuse_setupmapping.cpp | 12 +++++----- src/fuse_setupmapping.hpp | 11 +++++----- src/fuse_statx.hpp | 12 +++++----- src/hashset.hpp | 5 +++-- src/mergerfs.cpp | 4 ++-- src/num.cpp | 5 ++--- src/num.hpp | 5 +++-- src/policy_eplfs.cpp | 14 ++++++------ src/policy_eplus.cpp | 12 +++++----- src/policy_epmfs.cpp | 12 +++++----- src/policy_eppfrd.cpp | 20 ++++++++--------- src/policy_lfs.cpp | 4 ++-- src/policy_lus.cpp | 4 ++-- src/policy_msplfs.cpp | 4 ++-- src/policy_msplus.cpp | 4 ++-- src/policy_mspmfs.cpp | 4 ++-- src/policy_msppfrd.cpp | 12 +++++----- src/policy_pfrd.cpp | 14 ++++++------ src/rnd.cpp | 20 ++++++++--------- src/rnd.hpp | 11 +++++----- src/statvfs_util.hpp | 7 +++--- src/to_string.cpp | 5 ++--- src/to_string.hpp | 6 ++--- 63 files changed, 294 insertions(+), 290 deletions(-) diff --git a/src/config.hpp b/src/config.hpp index bf09fd8c..50b2d096 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -54,7 +54,8 @@ #include "fuse.h" -#include +#include "base_types.h" + #include #include #include @@ -63,8 +64,8 @@ #include typedef ToFromWrapper ConfigBOOL; -typedef ToFromWrapper ConfigUINT64; -typedef ToFromWrapper ConfigS64; +typedef ToFromWrapper ConfigU64; +typedef ToFromWrapper ConfigS64; typedef ToFromWrapper ConfigINT; typedef ToFromWrapper ConfigSTR; typedef ToFromWrapper 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 process_thread_queue_depth; ProxyIOPrio proxy_ioprio; TFSRef read_thread_count; - ConfigUINT64 readahead; + ConfigU64 readahead; FUSE::ReadDir readdir; RenameEXDEV rename_exdev; ConfigINT scheduling_priority; diff --git a/src/config_pagesize.cpp b/src/config_pagesize.cpp index b07ca36b..5083a7ef 100644 --- a/src/config_pagesize.cpp +++ b/src/config_pagesize.cpp @@ -26,7 +26,7 @@ #include -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); diff --git a/src/config_pagesize.hpp b/src/config_pagesize.hpp index b2893d71..e64518be 100644 --- a/src/config_pagesize.hpp +++ b/src/config_pagesize.hpp @@ -18,17 +18,16 @@ #pragma once +#include "base_types.h" #include "tofrom_string.hpp" -#include - 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; } diff --git a/src/dirinfo.hpp b/src/dirinfo.hpp index b48e7414..972e07c8 100644 --- a/src/dirinfo.hpp +++ b/src/dirinfo.hpp @@ -40,7 +40,7 @@ public: }; inline -uint64_t +u64 DirInfo::to_fh() const { ASSERT_NOT_NULL(this); diff --git a/src/endian.hpp b/src/endian.hpp index 0ec0f9fd..ee7430e0 100644 --- a/src/endian.hpp +++ b/src/endian.hpp @@ -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]; } diff --git a/src/from_string.cpp b/src/from_string.cpp index bdb1e606..bab0d4d6 100644 --- a/src/from_string.cpp +++ b/src/from_string.cpp @@ -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(), diff --git a/src/from_string.hpp b/src/from_string.hpp index 0cbb8e3e..fc39db98 100644 --- a/src/from_string.hpp +++ b/src/from_string.hpp @@ -18,9 +18,9 @@ #pragma once +#include "base_types.h" #include "fs_path.hpp" -#include #include #include @@ -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 *); diff --git a/src/fs_file_size.cpp b/src/fs_file_size.cpp index ca6a08b5..36c9f8bf 100644 --- a/src/fs_file_size.cpp +++ b/src/fs_file_size.cpp @@ -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 +#include "fs_fstat.hpp" namespace fs { - int64_t + s64 file_size(const int fd_) { int rv; diff --git a/src/fs_file_size.hpp b/src/fs_file_size.hpp index 2a91c9ce..5a1e8116 100644 --- a/src/fs_file_size.hpp +++ b/src/fs_file_size.hpp @@ -18,11 +18,11 @@ #pragma once -#include +#include "base_types.h" namespace fs { - int64_t + s64 file_size(const int fd); } diff --git a/src/fs_has_space.cpp b/src/fs_has_space.cpp index b7fadfe4..eb50e61d 100644 --- a/src/fs_has_space.cpp +++ b/src/fs_has_space.cpp @@ -21,13 +21,12 @@ #include "fs_statvfs.hpp" #include "statvfs_util.hpp" -#include #include bool fs::has_space(const std::string &str_, - const int64_t size_) + cs64 size_) { int rv; struct statvfs st; diff --git a/src/fs_has_space.hpp b/src/fs_has_space.hpp index 97af0d18..ce00d15a 100644 --- a/src/fs_has_space.hpp +++ b/src/fs_has_space.hpp @@ -18,7 +18,8 @@ #pragma once -#include +#include "base_types.h" + #include @@ -26,5 +27,5 @@ namespace fs { bool has_space(const std::string &str, - const int64_t size); + cs64 size); } diff --git a/src/fs_info_t.hpp b/src/fs_info_t.hpp index 08f62bf1..b08fcfe5 100644 --- a/src/fs_info_t.hpp +++ b/src/fs_info_t.hpp @@ -18,15 +18,15 @@ #pragma once -#include +#include "base_types.h" namespace fs { struct info_t { - bool readonly; - uint64_t spaceavail; - uint64_t spaceused; + bool readonly; + u64 spaceavail; + u64 spaceused; }; } diff --git a/src/fs_inode.cpp b/src/fs_inode.cpp index c60225df..e1d9bba5 100644 --- a/src/fs_inode.cpp +++ b/src/fs_inode.cpp @@ -21,29 +21,27 @@ #include "ef.hpp" #include "rapidhash/rapidhash.h" -#include - #include #include #include -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 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_, diff --git a/src/fs_inode.hpp b/src/fs_inode.hpp index 968d5872..877807a9 100644 --- a/src/fs_inode.hpp +++ b/src/fs_inode.hpp @@ -18,9 +18,9 @@ #pragma once +#include "base_types.h" #include "fuse_kernel.h" -#include #include #include @@ -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, diff --git a/src/fs_readahead.cpp b/src/fs_readahead.cpp index 42f1bdb0..b9de9513 100644 --- a/src/fs_readahead.cpp +++ b/src/fs_readahead.cpp @@ -21,7 +21,6 @@ #include "fmt/core.h" #include "fs_lstat.hpp" -#include #include #include @@ -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; diff --git a/src/fs_readahead.hpp b/src/fs_readahead.hpp index da38c0a4..c6dd4933 100644 --- a/src/fs_readahead.hpp +++ b/src/fs_readahead.hpp @@ -18,22 +18,23 @@ #pragma once -#include +#include "base_types.h" + #include 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); } diff --git a/src/fs_statvfs_cache.cpp b/src/fs_statvfs_cache.cpp index 6db2c58e..f8abe513 100644 --- a/src/fs_statvfs_cache.cpp +++ b/src/fs_statvfs_cache.cpp @@ -23,7 +23,6 @@ #include "mutex.hpp" -#include #include #include @@ -33,36 +32,36 @@ struct Element { - uint64_t time; + u64 time; struct statvfs st; }; typedef std::map 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; diff --git a/src/fs_statvfs_cache.hpp b/src/fs_statvfs_cache.hpp index 3b6c6bbe..3e42ec58 100644 --- a/src/fs_statvfs_cache.hpp +++ b/src/fs_statvfs_cache.hpp @@ -18,7 +18,7 @@ #pragma once -#include +#include "base_types.h" #include @@ -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); } diff --git a/src/fuse_bmap.cpp b/src/fuse_bmap.cpp index a078e7e5..b381106f 100644 --- a/src/fuse_bmap.cpp +++ b/src/fuse_bmap.cpp @@ -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_; diff --git a/src/fuse_bmap.hpp b/src/fuse_bmap.hpp index a73035e1..a8027bcd 100644 --- a/src/fuse_bmap.hpp +++ b/src/fuse_bmap.hpp @@ -18,10 +18,10 @@ #pragma once +#include "base_types.h" #include "fuse_req_ctx.h" #include -#include 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); } diff --git a/src/fuse_create.cpp b/src/fuse_create.cpp index 8fb2c063..6ebcbd3c 100644 --- a/src/fuse_create.cpp +++ b/src/fuse_create.cpp @@ -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 diff --git a/src/fuse_fallocate.cpp b/src/fuse_fallocate.cpp index 2f77296b..9ad52739 100644 --- a/src/fuse_fallocate.cpp +++ b/src/fuse_fallocate.cpp @@ -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) diff --git a/src/fuse_fallocate.hpp b/src/fuse_fallocate.hpp index 0201e226..f4c08575 100644 --- a/src/fuse_fallocate.hpp +++ b/src/fuse_fallocate.hpp @@ -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); } diff --git a/src/fuse_fchmod.cpp b/src/fuse_fchmod.cpp index 1b9899ef..5b6bb522 100644 --- a/src/fuse_fchmod.cpp +++ b/src/fuse_fchmod.cpp @@ -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) diff --git a/src/fuse_fchmod.hpp b/src/fuse_fchmod.hpp index d68f187a..fefd8307 100644 --- a/src/fuse_fchmod.hpp +++ b/src/fuse_fchmod.hpp @@ -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); } diff --git a/src/fuse_fchown.cpp b/src/fuse_fchown.cpp index bda7d390..97403e73 100644 --- a/src/fuse_fchown.cpp +++ b/src/fuse_fchown.cpp @@ -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) diff --git a/src/fuse_fchown.hpp b/src/fuse_fchown.hpp index eced6556..6d06f23e 100644 --- a/src/fuse_fchown.hpp +++ b/src/fuse_fchown.hpp @@ -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); } diff --git a/src/fuse_fgetattr.cpp b/src/fuse_fgetattr.cpp index efb9b58b..1636383f 100644 --- a/src/fuse_fgetattr.cpp +++ b/src/fuse_fgetattr.cpp @@ -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) diff --git a/src/fuse_fgetattr.hpp b/src/fuse_fgetattr.hpp index 31640d2a..621965fa 100644 --- a/src/fuse_fgetattr.hpp +++ b/src/fuse_fgetattr.hpp @@ -18,6 +18,7 @@ #pragma once +#include "base_types.h" #include "fuse.h" #include @@ -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); } diff --git a/src/fuse_flock.cpp b/src/fuse_flock.cpp index 6e441b88..47b22f78 100644 --- a/src/fuse_flock.cpp +++ b/src/fuse_flock.cpp @@ -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) diff --git a/src/fuse_fsync.cpp b/src/fuse_fsync.cpp index f071ea51..9dc18ddd 100644 --- a/src/fuse_fsync.cpp +++ b/src/fuse_fsync.cpp @@ -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_); diff --git a/src/fuse_fsync.hpp b/src/fuse_fsync.hpp index cbe87d89..47d81758 100644 --- a/src/fuse_fsync.hpp +++ b/src/fuse_fsync.hpp @@ -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); } diff --git a/src/fuse_ftruncate.cpp b/src/fuse_ftruncate.cpp index 677656fc..9e8e6fc2 100644 --- a/src/fuse_ftruncate.cpp +++ b/src/fuse_ftruncate.cpp @@ -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) diff --git a/src/fuse_ftruncate.hpp b/src/fuse_ftruncate.hpp index 69ede883..5826fae4 100644 --- a/src/fuse_ftruncate.hpp +++ b/src/fuse_ftruncate.hpp @@ -18,6 +18,7 @@ #pragma once +#include "base_types.h" #include "fuse.h" #include @@ -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); } diff --git a/src/fuse_futimens.cpp b/src/fuse_futimens.cpp index 40387dd6..9f381e1f 100644 --- a/src/fuse_futimens.cpp +++ b/src/fuse_futimens.cpp @@ -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) diff --git a/src/fuse_futimens.hpp b/src/fuse_futimens.hpp index fe1a3cd9..958a8ca8 100644 --- a/src/fuse_futimens.hpp +++ b/src/fuse_futimens.hpp @@ -18,6 +18,7 @@ #pragma once +#include "base_types.h" #include "fuse.h" #include @@ -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]); } diff --git a/src/fuse_init.cpp b/src/fuse_init.cpp index 18d5a63a..ecf58bf2 100644 --- a/src/fuse_init.cpp +++ b/src/fuse_init.cpp @@ -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); diff --git a/src/fuse_ioctl.cpp b/src/fuse_ioctl.cpp index 701d3e7a..51ce85a6 100644 --- a/src/fuse_ioctl.cpp +++ b/src/fuse_ioctl.cpp @@ -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; diff --git a/src/fuse_ioctl.hpp b/src/fuse_ioctl.hpp index e1278564..28122ce3 100644 --- a/src/fuse_ioctl.hpp +++ b/src/fuse_ioctl.hpp @@ -18,8 +18,7 @@ #pragma once -#include - +#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); } diff --git a/src/fuse_open.cpp b/src/fuse_open.cpp index 0bfb9842..086c24fa 100644 --- a/src/fuse_open.cpp +++ b/src/fuse_open.cpp @@ -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 diff --git a/src/fuse_setupmapping.cpp b/src/fuse_setupmapping.cpp index 41913021..46879ffe 100644 --- a/src/fuse_setupmapping.cpp +++ b/src/fuse_setupmapping.cpp @@ -21,16 +21,14 @@ #include #include -#include - 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; } diff --git a/src/fuse_setupmapping.hpp b/src/fuse_setupmapping.hpp index 4e02cbd9..a6057a15 100644 --- a/src/fuse_setupmapping.hpp +++ b/src/fuse_setupmapping.hpp @@ -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_); } diff --git a/src/fuse_statx.hpp b/src/fuse_statx.hpp index 091d716c..ca3d920f 100644 --- a/src/fuse_statx.hpp +++ b/src/fuse_statx.hpp @@ -18,23 +18,23 @@ #pragma once +#include "base_types.h" #include "fuse.h" #include "fuse_kernel.h" -#include 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); } diff --git a/src/hashset.hpp b/src/hashset.hpp index 420e7752..b739ce5f 100644 --- a/src/hashset.hpp +++ b/src/hashset.hpp @@ -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_); diff --git a/src/mergerfs.cpp b/src/mergerfs.cpp index dd2ff26b..12385a11 100644 --- a/src/mergerfs.cpp +++ b/src/mergerfs.cpp @@ -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; } diff --git a/src/num.cpp b/src/num.cpp index 3426c802..8d0a815c 100644 --- a/src/num.cpp +++ b/src/num.cpp @@ -17,6 +17,7 @@ */ #include "ef.hpp" +#include "num.hpp" #include "fmt/core.h" @@ -25,8 +26,6 @@ #include #include -#include - #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_); diff --git a/src/num.hpp b/src/num.hpp index bf52f719..51c98cf3 100644 --- a/src/num.hpp +++ b/src/num.hpp @@ -18,11 +18,12 @@ #pragma once -#include +#include "base_types.h" + #include namespace num { - std::string humanize(const uint64_t bytes); + std::string humanize(cu64 bytes); } diff --git a/src/policy_eplfs.cpp b/src/policy_eplfs.cpp index f3054182..f6855f10 100644 --- a/src/policy_eplfs.cpp +++ b/src/policy_eplfs.cpp @@ -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::max(); + eplfs = std::numeric_limits::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::max(); + eplfs = std::numeric_limits::max(); for(auto &branch : *branches_) { if(branch.ro()) @@ -126,12 +126,12 @@ _search(const Branches::Ptr &branches_, std::vector &paths_) { int rv; - uint64_t eplfs; - uint64_t spaceavail; + u64 eplfs; + u64 spaceavail; Branch *obranch; obranch = nullptr; - eplfs = std::numeric_limits::max(); + eplfs = std::numeric_limits::max(); for(auto &branch : *branches_) { if(!fs::exists(branch.path,fusepath_)) diff --git a/src/policy_eplus.cpp b/src/policy_eplus.cpp index 98f489f8..3086c44b 100644 --- a/src/policy_eplus.cpp +++ b/src/policy_eplus.cpp @@ -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::max(); + eplus = std::numeric_limits::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::max(); + eplus = std::numeric_limits::max(); for(auto &branch : *branches_) { if(branch.ro()) @@ -124,8 +124,8 @@ _search(const Branches::Ptr &branches_, std::vector &paths_) { int rv; - uint64_t eplus; - uint64_t spaceused; + u64 eplus; + u64 spaceused; Branch *obranch; obranch = nullptr; diff --git a/src/policy_epmfs.cpp b/src/policy_epmfs.cpp index 635c801c..5957ae89 100644 --- a/src/policy_epmfs.cpp +++ b/src/policy_epmfs.cpp @@ -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::min(); + epmfs = std::numeric_limits::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::min(); + epmfs = std::numeric_limits::min(); for(auto &branch : *branches_) { if(branch.ro()) @@ -122,8 +122,8 @@ _search(const Branches::Ptr &branches_, std::vector &paths_) { int rv; - uint64_t epmfs; - uint64_t spaceavail; + u64 epmfs; + u64 spaceavail; Branch *obranch; obranch = nullptr; diff --git a/src/policy_eppfrd.cpp b/src/policy_eppfrd.cpp index d0a9eb13..98da3daf 100644 --- a/src/policy_eppfrd.cpp +++ b/src/policy_eppfrd.cpp @@ -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 &paths_) { int err; - uint64_t sum; + u64 sum; Branch *branch; BranchInfoVec branchinfo; @@ -190,7 +190,7 @@ _action(const Branches::Ptr &branches_, std::vector &paths_) { int err; - uint64_t sum; + u64 sum; Branch *branch; BranchInfoVec branchinfo; @@ -211,7 +211,7 @@ _search(const Branches::Ptr &branches_, std::vector &paths_) { int err; - uint64_t sum; + u64 sum; Branch *branch; BranchInfoVec branchinfo; diff --git a/src/policy_lfs.cpp b/src/policy_lfs.cpp index bf36d560..6e8e0803 100644 --- a/src/policy_lfs.cpp +++ b/src/policy_lfs.cpp @@ -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::max(); + lfs = std::numeric_limits::max(); for(auto &branch : *branches_) { if(branch.ro_or_nc()) diff --git a/src/policy_lus.cpp b/src/policy_lus.cpp index 01bb06a2..b69359df 100644 --- a/src/policy_lus.cpp +++ b/src/policy_lus.cpp @@ -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::max(); + lus = std::numeric_limits::max(); for(auto &branch : *branches_) { if(branch.ro_or_nc()) diff --git a/src/policy_msplfs.cpp b/src/policy_msplfs.cpp index 8d147627..dc7cef30 100644 --- a/src/policy_msplfs.cpp +++ b/src/policy_msplfs.cpp @@ -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::max(); + lfs = std::numeric_limits::max(); for(auto &branch : *branches_) { if(branch.ro_or_nc()) diff --git a/src/policy_msplus.cpp b/src/policy_msplus.cpp index 2389a29c..55869467 100644 --- a/src/policy_msplus.cpp +++ b/src/policy_msplus.cpp @@ -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::max(); + lus = std::numeric_limits::max(); for(auto &branch : *branches_) { if(branch.ro_or_nc()) diff --git a/src/policy_mspmfs.cpp b/src/policy_mspmfs.cpp index 7facfbd5..0a090213 100644 --- a/src/policy_mspmfs.cpp +++ b/src/policy_mspmfs.cpp @@ -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::min(); + mfs = std::numeric_limits::min(); for(auto &branch : *branches_) { if(branch.ro_or_nc()) diff --git a/src/policy_msppfrd.cpp b/src/policy_msppfrd.cpp index 17c0f578..a5c349f2 100644 --- a/src/policy_msppfrd.cpp +++ b/src/policy_msppfrd.cpp @@ -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 &paths_) { int rv; - uint64_t sum; + u64 sum; Branch *branch; BranchInfoVec branchinfo; diff --git a/src/policy_pfrd.cpp b/src/policy_pfrd.cpp index ee1b33f2..f3b12960 100644 --- a/src/policy_pfrd.cpp +++ b/src/policy_pfrd.cpp @@ -34,8 +34,8 @@ struct BranchInfo { - uint64_t spaceavail; - Branch *branch; + u64 spaceavail; + Branch *branch; }; typedef std::vector 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 &paths_) { int err; - uint64_t sum; + u64 sum; Branch *branch; BranchInfoVec branchinfo; diff --git a/src/rnd.cpp b/src/rnd.cpp index 1afd0682..9cee4098 100644 --- a/src/rnd.cpp +++ b/src/rnd.cpp @@ -20,12 +20,10 @@ #include "rapidhash/rapidhash.h" -#include - #include -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_))); } diff --git a/src/rnd.hpp b/src/rnd.hpp index f17006da..0cedbfc0 100644 --- a/src/rnd.hpp +++ b/src/rnd.hpp @@ -18,7 +18,8 @@ #pragma once -#include +#include "base_types.h" + #include 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 static diff --git a/src/statvfs_util.hpp b/src/statvfs_util.hpp index 9ed10fb8..cda50acd 100644 --- a/src/statvfs_util.hpp +++ b/src/statvfs_util.hpp @@ -18,7 +18,8 @@ #pragma once -#include +#include "base_types.h" + #include #include @@ -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)); diff --git a/src/to_string.cpp b/src/to_string.cpp index 207ba061..9a59828b 100644 --- a/src/to_string.cpp +++ b/src/to_string.cpp @@ -20,7 +20,6 @@ #include "fmt/core.h" -#include #include @@ -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_); } diff --git a/src/to_string.hpp b/src/to_string.hpp index 64b6662e..53ec2e56 100644 --- a/src/to_string.hpp +++ b/src/to_string.hpp @@ -18,9 +18,9 @@ #pragma once +#include "base_types.h" #include "fs_path.hpp" -#include #include #include @@ -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&); }