From 2d96ce8faa277809c0c94aca54320483889f577d Mon Sep 17 00:00:00 2001 From: Xavi Hernandez Date: Tue, 25 Sep 2018 13:22:47 +0200 Subject: 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 --- xlators/features/arbiter/src/arbiter.c | 2 +- xlators/features/bit-rot/src/bitd/bit-rot.c | 3 +-- xlators/features/bit-rot/src/stub/bit-rot-stub.c | 6 +++--- xlators/features/bit-rot/src/stub/bit-rot-stub.h | 2 +- xlators/features/changelog/lib/src/gf-changelog-reborp.c | 4 +++- xlators/features/changelog/src/changelog-helpers.c | 2 +- xlators/features/changetimerecorder/src/ctr-xlator-ctx.c | 2 +- xlators/features/gfid-access/src/gfid-access.c | 16 ++++++++-------- xlators/features/index/src/index.c | 2 +- xlators/features/leases/src/leases.c | 2 +- xlators/features/locks/src/posix.c | 2 +- xlators/features/namespace/src/namespace.c | 6 +++--- xlators/features/shard/src/shard.c | 16 ++++++++-------- xlators/features/snapview-server/src/snapview-server.c | 2 +- 14 files changed, 34 insertions(+), 33 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/arbiter/src/arbiter.c b/xlators/features/arbiter/src/arbiter.c index 436f228a566..4af68f9ba52 100644 --- a/xlators/features/arbiter/src/arbiter.c +++ b/xlators/features/arbiter/src/arbiter.c @@ -31,7 +31,7 @@ __arbiter_inode_ctx_get(inode_t *inode, xlator_t *this) if (!ctx) goto out; - ret = __inode_ctx_put(inode, this, (uint64_t)ctx); + ret = __inode_ctx_put(inode, this, (uint64_t)(uintptr_t)ctx); if (ret) { GF_FREE(ctx); ctx = NULL; diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c index 75fa0490c90..8ea89257836 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot.c @@ -351,8 +351,7 @@ br_calculate_obj_checksum(unsigned char *md, br_child_t *child, fd_t *fd, &sha256); if (ret < 0) { gf_msg(this->name, GF_LOG_ERROR, 0, BRB_MSG_BLOCK_READ_FAILED, - "reading block with " - "offset %lu of object %s failed", + "reading block with offset %" PRIu64 " of object %s failed", offset, uuid_utoa(fd->inode->gfid)); break; } diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c index c6c9b6aafce..0fc2b651b2d 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c @@ -410,7 +410,7 @@ br_stub_init_inode_versions(xlator_t *this, fd_t *fd, inode_t *inode, goto free_ctx; if (ctx_addr) - *ctx_addr = (uint64_t)ctx; + *ctx_addr = (uint64_t)(uintptr_t)ctx; return 0; free_ctx: @@ -3411,14 +3411,14 @@ br_stub_ictxmerge(xlator_t *this, fd_t *fd, inode_t *inode, ret = br_stub_get_inode_ctx(this, inode, &ctxaddr); if (ret < 0) goto done; - ctx = (br_stub_inode_ctx_t *)ctxaddr; + ctx = (br_stub_inode_ctx_t *)(uintptr_t)ctxaddr; LOCK(&linked_inode->lock); { ret = __br_stub_get_inode_ctx(this, linked_inode, &lctxaddr); if (ret < 0) goto unblock; - lctx = (br_stub_inode_ctx_t *)lctxaddr; + lctx = (br_stub_inode_ctx_t *)(uintptr_t)lctxaddr; GF_ASSERT(list_is_singular(&ctx->fd_list)); br_stub_fd = list_first_entry(&ctx->fd_list, br_stub_fd_t, list); diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.h b/xlators/features/bit-rot/src/stub/bit-rot-stub.h index a15667e323a..9e6492ebdd7 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub.h +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.h @@ -255,7 +255,7 @@ br_stub_get_inode_ctx(xlator_t *this, inode_t *inode, uint64_t *ctx) static inline int br_stub_set_inode_ctx(xlator_t *this, inode_t *inode, br_stub_inode_ctx_t *ctx) { - uint64_t ctx_addr = (uint64_t)ctx; + uint64_t ctx_addr = (uint64_t)(uintptr_t)ctx; return inode_ctx_set(inode, this, &ctx_addr); } diff --git a/xlators/features/changelog/lib/src/gf-changelog-reborp.c b/xlators/features/changelog/lib/src/gf-changelog-reborp.c index 8dfda4c79c5..132e8511be4 100644 --- a/xlators/features/changelog/lib/src/gf-changelog-reborp.c +++ b/xlators/features/changelog/lib/src/gf-changelog-reborp.c @@ -353,7 +353,9 @@ gf_changelog_event_handler(rpcsvc_request_t *req, xlator_t *this, } gf_msg_debug(this->name, 0, - "seq: %lu [%s] (time: %lu.%lu), (vec: %d, len: %zd)", + "seq: %" PRIu64 " [%s] (time: %" PRIu64 ".%" PRIu64 + "), " + "(vec: %d, len: %zd)", rpc_req.seq, entry->brick, rpc_req.tv_sec, rpc_req.tv_usec, payloadcnt, payloadlen); diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c index 53219bf2d78..9ff9115c40d 100644 --- a/xlators/features/changelog/src/changelog-helpers.c +++ b/xlators/features/changelog/src/changelog-helpers.c @@ -1466,7 +1466,7 @@ static int __changelog_inode_ctx_set(xlator_t *this, inode_t *inode, changelog_inode_ctx_t *ctx) { - uint64_t ctx_addr = (uint64_t)ctx; + uint64_t ctx_addr = (uint64_t)(uintptr_t)ctx; return __inode_ctx_set(inode, this, &ctx_addr); } diff --git a/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c b/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c index b4afe74a31b..b6b66d56731 100644 --- a/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c +++ b/xlators/features/changetimerecorder/src/ctr-xlator-ctx.c @@ -295,7 +295,7 @@ init_ctr_xlator_ctx(xlator_t *this, inode_t *inode) "Failed init lock %s", strerror(ret)); goto out; } - _addr = (uint64_t)ctr_xlator_ctx; + _addr = (uint64_t)(uintptr_t)ctr_xlator_ctx; ret = __inode_ctx_set(inode, this, &_addr); if (ret) { diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c index 3d5008666f6..68768eebf4e 100644 --- a/xlators/features/gfid-access/src/gfid-access.c +++ b/xlators/features/gfid-access/src/gfid-access.c @@ -35,7 +35,7 @@ ga_valid_inode_loc_copy(loc_t *dst, loc_t *src, xlator_t *this) goto out; } inode_unref(dst->parent); - dst->parent = inode_ref((inode_t *)value); + dst->parent = inode_ref((inode_t *)(uintptr_t)value); gf_uuid_copy(dst->pargfid, dst->parent->gfid); } @@ -46,7 +46,7 @@ ga_valid_inode_loc_copy(loc_t *dst, loc_t *src, xlator_t *this) goto out; } inode_unref(dst->inode); - dst->inode = inode_ref((inode_t *)value); + dst->inode = inode_ref((inode_t *)(uintptr_t)value); gf_uuid_copy(dst->gfid, dst->inode->gfid); } out: @@ -284,7 +284,7 @@ ga_fill_tmp_loc(loc_t *loc, xlator_t *this, uuid_t gfid, char *bname, parent = loc->inode; ret = inode_ctx_get(loc->inode, this, &value); if (!ret) { - parent = (void *)value; + parent = (void *)(uintptr_t)value; if (gf_uuid_is_null(parent->gfid)) parent = loc->inode; } @@ -349,7 +349,7 @@ ga_forget(xlator_t *this, inode_t *inode) if (ret) goto out; - tmp_inode = (void *)value; + tmp_inode = (void *)(uintptr_t)value; inode_unref(tmp_inode); out: @@ -685,7 +685,7 @@ ga_virtual_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this, inode = true_inode; } - ret = inode_ctx_put(cbk_inode, this, (uint64_t)inode); + ret = inode_ctx_put(cbk_inode, this, (uint64_t)(uintptr_t)inode); if (ret) { gf_log(this->name, GF_LOG_WARNING, "failed to set the inode ctx with" @@ -830,7 +830,7 @@ ga_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) if (ret) goto wind; - inode = (inode_t *)value; + inode = (inode_t *)(uintptr_t)value; ret = loc_copy_overload_parent(&tmp_loc, loc, inode); if (ret) @@ -859,7 +859,7 @@ ga_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) if (ret) goto err; - inode = (void *)value; + inode = (void *)(uintptr_t)value; /* valid inode, already looked up, work on that */ if (inode->ia_type) @@ -1363,7 +1363,7 @@ ga_dump_inodectx(xlator_t *this, inode_t *inode) ret = inode_ctx_get(inode, this, &value); if (ret == 0) { - tmp_inode = (void *)value; + tmp_inode = (void *)(uintptr_t)value; gf_proc_dump_build_key(key_prefix, this->name, "inode"); gf_proc_dump_add_section(key_prefix); gf_proc_dump_write("real-gfid", "%s", uuid_utoa(tmp_inode->gfid)); diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index fb295488789..98dba95abad 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -77,7 +77,7 @@ __index_inode_ctx_get(inode_t *inode, xlator_t *this, index_inode_ctx_t **ctx) } INIT_LIST_HEAD(&ictx->callstubs); - ret = __inode_ctx_put(inode, this, (uint64_t)ictx); + ret = __inode_ctx_put(inode, this, (uint64_t)(uintptr_t)ictx); if (ret) { GF_FREE(ictx); ictx = NULL; diff --git a/xlators/features/leases/src/leases.c b/xlators/features/leases/src/leases.c index be0f48fd2a2..baeb8c7361c 100644 --- a/xlators/features/leases/src/leases.c +++ b/xlators/features/leases/src/leases.c @@ -55,7 +55,7 @@ leases_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, else memset(fd_ctx->lease_id, 0, LEASE_ID_SIZE); - ret = fd_ctx_set(fd, this, (uint64_t)fd_ctx); + ret = fd_ctx_set(fd, this, (uint64_t)(uintptr_t)fd_ctx); if (ret) { op_errno = ENOMEM; goto err; diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index de8b7109338..49ff36f0135 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -1522,7 +1522,7 @@ pl_fsetxattr_handle_lockinfo(call_frame_t *frame, fd_t *fd, char *lockinfo_buf, gf_log(frame->this->name, GF_LOG_WARNING, "migration of locks from oldfd (ptr:%p) to newfd " "(ptr:%p) (inode-gfid:%s)", - (void *)oldfd_num, fd, uuid_utoa(fd->inode->gfid)); + (void *)(uintptr_t)oldfd_num, fd, uuid_utoa(fd->inode->gfid)); goto out; } diff --git a/xlators/features/namespace/src/namespace.c b/xlators/features/namespace/src/namespace.c index 581b470381d..25169709026 100644 --- a/xlators/features/namespace/src/namespace.c +++ b/xlators/features/namespace/src/namespace.c @@ -147,7 +147,7 @@ ns_inode_ctx_put(inode_t *inode, xlator_t *this, ns_info_t *info) } *cached_ns_info = *info; - ns_as_64 = (uint64_t)cached_ns_info; + ns_as_64 = (uint64_t)(uintptr_t)cached_ns_info; ret = inode_ctx_put(inode, this, ns_as_64); @@ -181,7 +181,7 @@ ns_inode_ctx_get(inode_t *inode, xlator_t *this, ns_info_t *info) ret = inode_ctx_get(inode, this, &ns_as_64); if (!ret) { - cached_ns_info = (ns_info_t *)ns_as_64; + cached_ns_info = (ns_info_t *)(uintptr_t)ns_as_64; *info = *cached_ns_info; } @@ -1190,7 +1190,7 @@ ns_forget(xlator_t *this, inode_t *inode) return 0; } - info = (ns_info_t *)ns_as_64; + info = (ns_info_t *)(uintptr_t)ns_as_64; GF_FREE(info); return 0; diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index c2fde028f08..182678c9a64 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -69,7 +69,7 @@ __shard_inode_ctx_get(inode_t *inode, xlator_t *this, shard_inode_ctx_t **ctx) ret = __inode_ctx_get(inode, this, &ctx_uint); if (ret == 0) { - *ctx = (shard_inode_ctx_t *)ctx_uint; + *ctx = (shard_inode_ctx_t *)(uintptr_t)ctx_uint; return ret; } @@ -363,7 +363,7 @@ __shard_inode_ctx_get_block_size(inode_t *inode, xlator_t *this, if (ret < 0) return ret; - ctx = (shard_inode_ctx_t *)ctx_uint; + ctx = (shard_inode_ctx_t *)(uintptr_t)ctx_uint; *block_size = ctx->block_size; @@ -397,7 +397,7 @@ __shard_inode_ctx_get_fsync_count(inode_t *inode, xlator_t *this, if (ret < 0) return ret; - ctx = (shard_inode_ctx_t *)ctx_uint; + ctx = (shard_inode_ctx_t *)(uintptr_t)ctx_uint; *fsync_count = ctx->fsync_needed; @@ -430,7 +430,7 @@ __shard_inode_ctx_get_all(inode_t *inode, xlator_t *this, if (ret < 0) return ret; - ctx = (shard_inode_ctx_t *)ctx_uint; + ctx = (shard_inode_ctx_t *)(uintptr_t)ctx_uint; memcpy(ctx_out, ctx, sizeof(shard_inode_ctx_t)); return 0; @@ -464,7 +464,7 @@ __shard_inode_ctx_fill_iatt_from_cache(inode_t *inode, xlator_t *this, if (ret < 0) return ret; - ctx = (shard_inode_ctx_t *)ctx_uint; + ctx = (shard_inode_ctx_t *)(uintptr_t)ctx_uint; if (ctx->refresh == _gf_false) *buf = ctx->stat; @@ -5145,7 +5145,7 @@ __shard_get_delta_size_from_inode_ctx(shard_local_t *local, inode_t *inode, if (ret < 0) return ret; - ctx = (shard_inode_ctx_t *)ctx_uint; + ctx = (shard_inode_ctx_t *)(uintptr_t)ctx_uint; if (shard_is_appending_write(local)) { local->delta_size = local->total_size; @@ -5668,7 +5668,7 @@ __shard_get_timestamps_from_inode_ctx(shard_local_t *local, inode_t *inode, if (ret < 0) return ret; - ctx = (shard_inode_ctx_t *)ctx_uint; + ctx = (shard_inode_ctx_t *)(uintptr_t)ctx_uint; local->postbuf.ia_ctime = ctx->stat.ia_ctime; local->postbuf.ia_ctime_nsec = ctx->stat.ia_ctime_nsec; @@ -6693,7 +6693,7 @@ shard_forget(xlator_t *this, inode_t *inode) if (!ctx_uint) return 0; - ctx = (shard_inode_ctx_t *)ctx_uint; + ctx = (shard_inode_ctx_t *)(uintptr_t)ctx_uint; /* When LRU limit reaches inode will be forcefully removed from the * table, inode needs to be removed from LRU of shard as well. diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c index b00a1222026..6611af8de5e 100644 --- a/xlators/features/snapview-server/src/snapview-server.c +++ b/xlators/features/snapview-server/src/snapview-server.c @@ -1329,7 +1329,7 @@ svs_forget(xlator_t *this, inode_t *inode) goto out; } - inode_ctx = (svs_inode_t *)value; + inode_ctx = (svs_inode_t *)(uintptr_t)value; if (!inode_ctx) goto out; -- cgit