summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorXavi Hernandez <xhernandez@redhat.com>2018-09-25 13:22:47 +0200
committerAmar Tumballi <amarts@redhat.com>2018-10-10 05:50:29 +0000
commit2d96ce8faa277809c0c94aca54320483889f577d (patch)
tree999ef8b148b186e6bf74bb22c3ff670fc6e34d38 /libglusterfs/src
parent0cda00f08d3d620be89830bad9d0e252648388e9 (diff)
all: fix warnings on non 64-bits architectures
When compiling in other architectures there appear many warnings. Some of them are actual problems that prevent gluster to work correctly on those architectures. Change-Id: Icdc7107a2bc2da662903c51910beddb84bdf03c0 fixes: bz#1632717 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/common-utils.c16
-rw-r--r--libglusterfs/src/common-utils.h4
-rw-r--r--libglusterfs/src/libglusterfs.sym3
-rw-r--r--libglusterfs/src/monitoring.c31
-rw-r--r--libglusterfs/src/options.c23
-rw-r--r--libglusterfs/src/options.h4
6 files changed, 31 insertions, 50 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index aae9858fe22..bd2cf35a52a 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -1800,22 +1800,6 @@ gf_string2bytesize_range(const char *str, uint64_t *n, uint64_t umax)
}
int
-gf_string2bytesize_size(const char *str, size_t *n)
-{
- uint64_t u64;
- size_t max = (size_t)-1;
- int val = gf_string2bytesize_range(str, &u64, max);
- *n = (size_t)u64;
- return val;
-}
-
-int
-gf_string2bytesize(const char *str, uint64_t *n)
-{
- return gf_string2bytesize_range(str, n, UINT64_MAX);
-}
-
-int
gf_string2bytesize_uint64(const char *str, uint64_t *n)
{
return gf_string2bytesize_range(str, n, UINT64_MAX);
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 84733dffa85..15ca1ef6a50 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -806,10 +806,6 @@ gf_string2uint32_base10(const char *str, uint32_t *n);
int
gf_string2uint64_base10(const char *str, uint64_t *n);
int
-gf_string2bytesize(const char *str, uint64_t *n);
-int
-gf_string2bytesize_size(const char *str, size_t *n);
-int
gf_string2bytesize_uint64(const char *str, uint64_t *n);
int
gf_string2bytesize_int64(const char *str, int64_t *n);
diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym
index c5b322a9bdf..63022d6d92e 100644
--- a/libglusterfs/src/libglusterfs.sym
+++ b/libglusterfs/src/libglusterfs.sym
@@ -686,7 +686,6 @@ gf_store_save_value
gf_store_unlink_tmppath
gf_store_unlock
gf_string2boolean
-gf_string2bytesize
gf_string2bytesize_int64
gf_string2bytesize_uint64
gf_string2double
@@ -1133,4 +1132,4 @@ gf_replace_old_iatt_in_dict
gf_replace_new_iatt_in_dict
gf_changelog_init
gf_changelog_register_generic
-gf_gfid_generate_from_xxh64 \ No newline at end of file
+gf_gfid_generate_from_xxh64
diff --git a/libglusterfs/src/monitoring.c b/libglusterfs/src/monitoring.c
index 245f1baf799..b0d0766599a 100644
--- a/libglusterfs/src/monitoring.c
+++ b/libglusterfs/src/monitoring.c
@@ -84,34 +84,36 @@ dump_latency_and_count(xlator_t *xl, int fd)
uint64_t cbk;
uint64_t count;
- if (xl->winds)
- dprintf(fd, "%s.total.pending-winds.count %lu\n", xl->name, xl->winds);
+ if (xl->winds) {
+ dprintf(fd, "%s.total.pending-winds.count %" PRIu64 "\n", xl->name,
+ xl->winds);
+ }
/* Need 'fuse' data, and don't need all the old graph info */
if ((xl != xl->ctx->master) && (xl->ctx->active != xl->graph))
return;
count = GF_ATOMIC_GET(xl->stats.total.count);
- dprintf(fd, "%s.total.fop-count %lu\n", xl->name, count);
+ dprintf(fd, "%s.total.fop-count %" PRIu64 "\n", xl->name, count);
count = GF_ATOMIC_GET(xl->stats.interval.count);
- dprintf(fd, "%s.interval.fop-count %lu\n", xl->name, count);
+ dprintf(fd, "%s.interval.fop-count %" PRIu64 "\n", xl->name, count);
GF_ATOMIC_INIT(xl->stats.interval.count, 0);
for (index = 0; index < GF_FOP_MAXVALUE; index++) {
fop = GF_ATOMIC_GET(xl->stats.total.metrics[index].fop);
if (fop) {
- dprintf(fd, "%s.total.%s.count %lu\n", xl->name, gf_fop_list[index],
- fop);
+ dprintf(fd, "%s.total.%s.count %" PRIu64 "\n", xl->name,
+ gf_fop_list[index], fop);
}
fop = GF_ATOMIC_GET(xl->stats.interval.metrics[index].fop);
if (fop) {
- dprintf(fd, "%s.interval.%s.count %lu\n", xl->name,
+ dprintf(fd, "%s.interval.%s.count %" PRIu64 "\n", xl->name,
gf_fop_list[index], fop);
}
cbk = GF_ATOMIC_GET(xl->stats.interval.metrics[index].cbk);
if (cbk) {
- dprintf(fd, "%s.interval.%s.fail_count %lu\n", xl->name,
+ dprintf(fd, "%s.interval.%s.fail_count %" PRIu64 "\n", xl->name,
gf_fop_list[index], cbk);
}
if (xl->stats.interval.latencies[index].count != 0.0) {
@@ -136,9 +138,9 @@ dump_latency_and_count(xlator_t *xl, int fd)
static inline void
dump_call_stack_details(glusterfs_ctx_t *ctx, int fd)
{
- dprintf(fd, "total.stack.count %lu\n",
+ dprintf(fd, "total.stack.count %" PRIu64 "\n",
GF_ATOMIC_GET(ctx->pool->total_count));
- dprintf(fd, "total.stack.in-flight %lu\n", ctx->pool->cnt);
+ dprintf(fd, "total.stack.in-flight %" PRIu64 "\n", ctx->pool->cnt);
}
static inline void
@@ -150,11 +152,12 @@ dump_dict_details(glusterfs_ctx_t *ctx, int fd)
total_dicts = GF_ATOMIC_GET(ctx->stats.total_dicts_used);
total_pairs = GF_ATOMIC_GET(ctx->stats.total_pairs_used);
- dprintf(fd, "total.dict.max-pairs-per %lu\n",
+ dprintf(fd, "total.dict.max-pairs-per %" PRIu64 "\n",
GF_ATOMIC_GET(ctx->stats.max_dict_pairs));
- dprintf(fd, "total.dict.pairs-used %lu\n", total_pairs);
- dprintf(fd, "total.dict.used %lu\n", total_dicts);
- dprintf(fd, "total.dict.average-pairs %lu\n", (total_pairs / total_dicts));
+ dprintf(fd, "total.dict.pairs-used %" PRIu64 "\n", total_pairs);
+ dprintf(fd, "total.dict.used %" PRIu64 "\n", total_dicts);
+ dprintf(fd, "total.dict.average-pairs %" PRIu64 "\n",
+ (total_pairs / total_dicts));
}
static void
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index 30607d2e390..c95808bcb28 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -121,12 +121,12 @@ static int
xlator_option_validate_sizet(xlator_t *xl, const char *key, const char *value,
volume_option_t *opt, char **op_errstr)
{
- size_t size = 0;
+ uint64_t size = 0;
int ret = 0;
char errstr[256];
/* Check the range */
- if (gf_string2bytesize_size(value, &size) != 0) {
+ if (gf_string2bytesize_uint64(value, &size) != 0) {
snprintf(errstr, 256, "invalid number format \"%s\" in option \"%s\"",
value, key);
gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
@@ -144,9 +144,8 @@ xlator_option_validate_sizet(xlator_t *xl, const char *key, const char *value,
if ((size < opt->min) || (size > opt->max)) {
snprintf(errstr, 256,
- "'%" GF_PRI_SIZET
- "' in 'option %s %s' "
- "is out of range [%.0f - %.0f]",
+ "'%" PRIu64
+ "' in 'option %s %s' is out of range [%.0f - %.0f]",
size, key, value, opt->min, opt->max);
gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", errstr);
ret = -1;
@@ -706,12 +705,12 @@ out:
static int
gf_validate_size(const char *sizestr, volume_option_t *opt)
{
- size_t value = 0;
+ uint64_t value = 0;
int ret = 0;
GF_ASSERT(opt);
- if (gf_string2bytesize_size(sizestr, &value) != 0 || value < opt->min ||
+ if (gf_string2bytesize_uint64(sizestr, &value) != 0 || value < opt->min ||
value % 512) {
ret = -1;
goto out;
@@ -1200,18 +1199,18 @@ pc_or_size(char *in, double *out)
{
double pc = 0;
int ret = 0;
- size_t size = 0;
+ uint64_t size = 0;
if (gf_string2percent(in, &pc) == 0) {
if (pc > 100.0) {
- ret = gf_string2bytesize_size(in, &size);
+ ret = gf_string2bytesize_uint64(in, &size);
if (!ret)
*out = size;
} else {
*out = pc;
}
} else {
- ret = gf_string2bytesize_size(in, &size);
+ ret = gf_string2bytesize_uint64(in, &size);
if (!ret)
*out = size;
}
@@ -1223,7 +1222,7 @@ DEFINE_INIT_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_INIT_OPT(int64_t, int64, gf_string2int64);
DEFINE_INIT_OPT(uint32_t, uint32, gf_string2uint32);
DEFINE_INIT_OPT(int32_t, int32, gf_string2int32);
-DEFINE_INIT_OPT(size_t, size, gf_string2bytesize_size);
+DEFINE_INIT_OPT(uint64_t, size, gf_string2bytesize_uint64);
DEFINE_INIT_OPT(uint64_t, size_uint64, gf_string2bytesize_uint64);
DEFINE_INIT_OPT(double, percent, gf_string2percent);
DEFINE_INIT_OPT(double, percent_or_size, pc_or_size);
@@ -1238,7 +1237,7 @@ DEFINE_RECONF_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_RECONF_OPT(int64_t, int64, gf_string2int64);
DEFINE_RECONF_OPT(uint32_t, uint32, gf_string2uint32);
DEFINE_RECONF_OPT(int32_t, int32, gf_string2int32);
-DEFINE_RECONF_OPT(size_t, size, gf_string2bytesize_size);
+DEFINE_RECONF_OPT(uint64_t, size, gf_string2bytesize_uint64);
DEFINE_RECONF_OPT(uint64_t, size_uint64, gf_string2bytesize_uint64);
DEFINE_RECONF_OPT(double, percent, gf_string2percent);
DEFINE_RECONF_OPT(double, percent_or_size, pc_or_size);
diff --git a/libglusterfs/src/options.h b/libglusterfs/src/options.h
index b0f76d5639c..e8600f14f56 100644
--- a/libglusterfs/src/options.h
+++ b/libglusterfs/src/options.h
@@ -190,7 +190,7 @@ DECLARE_INIT_OPT(uint64_t, uint64);
DECLARE_INIT_OPT(int64_t, int64);
DECLARE_INIT_OPT(uint32_t, uint32);
DECLARE_INIT_OPT(int32_t, int32);
-DECLARE_INIT_OPT(size_t, size);
+DECLARE_INIT_OPT(uint64_t, size);
DECLARE_INIT_OPT(uint64_t, size_uint64);
DECLARE_INIT_OPT(double, percent);
DECLARE_INIT_OPT(double, percent_or_size);
@@ -271,7 +271,7 @@ DECLARE_RECONF_OPT(uint64_t, uint64);
DECLARE_RECONF_OPT(int64_t, int64);
DECLARE_RECONF_OPT(uint32_t, uint32);
DECLARE_RECONF_OPT(int32_t, int32);
-DECLARE_RECONF_OPT(size_t, size);
+DECLARE_RECONF_OPT(uint64_t, size);
DECLARE_RECONF_OPT(uint64_t, size_uint64);
DECLARE_RECONF_OPT(double, percent);
DECLARE_RECONF_OPT(double, percent_or_size);