Browse Source

Fix printf for 32bit systems

pull/1107/head 2.34.0
Antonio SJ Musumeci 1 year ago
parent
commit
a6ca96fa08
  1. 45
      libfuse/lib/fuse.c
  2. 27
      src/num.cpp
  3. 1
      src/policy_lfs.cpp

45
libfuse/lib/fuse.c

@ -28,6 +28,7 @@
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <poll.h>
#include <signal.h>
@ -3853,32 +3854,32 @@ metrics_log_nodes_info(struct fuse *f_,
lfmp_lock(&f_->node_fmp);
snprintf(buf,sizeof(buf),
"time: %zu\n"
"sizeof(node): %zu\n"
"node id_table size: %zu\n"
"node id_table usage: %zu\n"
"node id_table total allocated memory: %zu\n"
"node name_table size: %zu\n"
"node name_table usage: %zu\n"
"node name_table total allocated memory: %zu\n"
"node memory pool slab count: %zu\n"
"time: %"PRIu64"\n"
"sizeof(node): %"PRIu64"\n"
"node id_table size: %"PRIu64"\n"
"node id_table usage: %"PRIu64"\n"
"node id_table total allocated memory: %"PRIu64"\n"
"node name_table size: %"PRIu64"\n"
"node name_table usage: %"PRIu64"\n"
"node name_table total allocated memory: %"PRIu64"\n"
"node memory pool slab count: %"PRIu64"\n"
"node memory pool usage ratio: %f\n"
"node memory pool avail objs: %zu\n"
"node memory pool total allocated memory: %zu\n"
"node memory pool avail objs: %"PRIu64"\n"
"node memory pool total allocated memory: %"PRIu64"\n"
"\n"
,
time(NULL),
sizeof(struct node),
f_->id_table.size,
f_->id_table.use,
(f_->id_table.size * sizeof(struct node*)),
f_->name_table.size,
f_->name_table.use,
(f_->name_table.size * sizeof(struct node*)),
fmp_slab_count(&f_->node_fmp.fmp),
(uint64_t)time(NULL),
(uint64_t)sizeof(struct node),
(uint64_t)f_->id_table.size,
(uint64_t)f_->id_table.use,
(uint64_t)(f_->id_table.size * sizeof(struct node*)),
(uint64_t)f_->name_table.size,
(uint64_t)f_->name_table.use,
(uint64_t)(f_->name_table.size * sizeof(struct node*)),
(uint64_t)fmp_slab_count(&f_->node_fmp.fmp),
fmp_slab_usage_ratio(&f_->node_fmp.fmp),
fmp_avail_objs(&f_->node_fmp.fmp),
fmp_total_allocated_memory(&f_->node_fmp.fmp)
(uint64_t)fmp_avail_objs(&f_->node_fmp.fmp),
(uint64_t)fmp_total_allocated_memory(&f_->node_fmp.fmp)
);
lfmp_unlock(&f_->node_fmp);

27
src/num.cpp

@ -16,17 +16,18 @@
#include "ef.hpp"
#include <cstdint>
#include <string>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define KB (1024UL)
#define MB (KB * 1024UL)
#define GB (MB * 1024UL)
#define TB (GB * 1024UL)
#include <cstdint>
#include <string>
#define KB (1024ULL)
#define MB (KB * 1024ULL)
#define GB (MB * 1024ULL)
#define TB (GB * 1024ULL)
namespace num
@ -116,17 +117,17 @@ namespace num
char buf[64];
if(bytes_ < KB)
sprintf(buf,"%lu",bytes_);
sprintf(buf,"%" PRIu64 "",bytes_);
ef(((bytes_ / TB) * TB) == bytes_)
sprintf(buf,"%luT",bytes_ / TB);
sprintf(buf,"%" PRIu64 "T",bytes_ / TB);
ef(((bytes_ / GB) * GB) == bytes_)
sprintf(buf,"%luG",bytes_ / GB);
sprintf(buf,"%" PRIu64 "G",bytes_ / GB);
ef(((bytes_ / MB) * MB) == bytes_)
sprintf(buf,"%luM",bytes_ / MB);
sprintf(buf,"%" PRIu64 "M",bytes_ / MB);
ef(((bytes_ / KB) * KB) == bytes_)
sprintf(buf,"%luK",bytes_ / KB);
sprintf(buf,"%" PRIu64 "K",bytes_ / KB);
else
sprintf(buf,"%lu",bytes_);
sprintf(buf,"%" PRIu64 "",bytes_);
return std::string(buf);
}

1
src/policy_lfs.cpp

@ -40,7 +40,6 @@ namespace lfs
int error;
uint64_t lfs;
fs::info_t info;
const Branch *branch;
const string *basepath;
error = ENOENT;

Loading…
Cancel
Save