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/cluster/afr/src/afr-common.c | 31 +++++++------- xlators/cluster/afr/src/afr-self-heal-common.c | 25 +++++------ xlators/cluster/dht/src/dht-common.c | 2 +- xlators/cluster/dht/src/dht-helper.c | 32 +++++++------- xlators/cluster/dht/src/dht-rebalance.c | 11 +++-- xlators/cluster/dht/src/dht-selfheal.c | 5 ++- xlators/cluster/dht/src/tier.c | 6 ++- xlators/cluster/ec/src/ec-combine.c | 7 +++- xlators/cluster/ec/src/ec-common.c | 49 +++++++++++----------- xlators/cluster/ec/src/ec-common.h | 7 +++- xlators/cluster/ec/src/ec-dir-read.c | 5 ++- xlators/cluster/ec/src/ec-generic.c | 11 ++--- xlators/cluster/ec/src/ec-heal.c | 4 +- xlators/cluster/ec/src/ec-inode-read.c | 19 +++++---- xlators/cluster/ec/src/ec-inode-write.c | 36 ++++++++-------- xlators/cluster/ec/src/ec-method.c | 8 ++-- xlators/cluster/ec/src/ec-method.h | 4 +- xlators/cluster/ec/src/ec.c | 2 +- xlators/cluster/stripe/src/stripe-helpers.c | 2 +- xlators/cluster/stripe/src/stripe.c | 2 +- xlators/debug/trace/src/trace.c | 8 ++-- xlators/debug/trace/src/trace.h | 2 +- xlators/experimental/fdl/src/fdl-tmpl.c.in | 5 ++- xlators/experimental/fdl/src/gen_dumper.py | 6 +-- xlators/experimental/jbr-server/src/jbr.c | 2 +- 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 +- .../changelog/lib/src/gf-changelog-reborp.c | 4 +- xlators/features/changelog/src/changelog-helpers.c | 2 +- .../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 +++---- .../features/snapview-server/src/snapview-server.c | 2 +- xlators/meta/src/meta-helpers.c | 8 ++-- .../mgmt/glusterd/src/glusterd-snapshot-utils.c | 4 +- xlators/mgmt/glusterd/src/glusterd-store.c | 2 +- xlators/mgmt/glusterd/src/glusterd-volgen.c | 4 +- xlators/mount/fuse/src/fuse-bridge.c | 2 +- xlators/performance/io-cache/src/io-cache.c | 2 +- xlators/performance/open-behind/src/open-behind.c | 6 +-- .../performance/readdir-ahead/src/readdir-ahead.c | 10 ++--- xlators/protocol/server/src/server.c | 4 +- xlators/storage/bd/src/bd-helper.c | 2 +- xlators/storage/bd/src/bd.c | 6 +-- xlators/storage/posix/src/posix-helpers.c | 2 +- xlators/storage/posix/src/posix-inode-fd-ops.c | 6 +-- 52 files changed, 218 insertions(+), 198 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index a0ff6acd9dd..8d50144c046 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -148,7 +148,7 @@ __afr_inode_ctx_get(xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx) ret = __inode_ctx_get(inode, this, &ctx_int); if (ret == 0) { - *ctx = (afr_inode_ctx_t *)ctx_int; + *ctx = (afr_inode_ctx_t *)(uintptr_t)ctx_int; return 0; } @@ -174,7 +174,7 @@ __afr_inode_ctx_get(xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx) INIT_LIST_HEAD(&lock->owners); } - ctx_int = (uint64_t)ictx; + ctx_int = (uint64_t)(uintptr_t)ictx; ret = __inode_ctx_set(inode, this, &ctx_int); if (ret) { goto out; @@ -4842,7 +4842,7 @@ afr_forget(xlator_t *this, inode_t *inode) if (!ctx_int) return 0; - ctx = (afr_inode_ctx_t *)ctx_int; + ctx = (afr_inode_ctx_t *)(uintptr_t)ctx_int; afr_inode_ctx_destroy(ctx); return 0; } @@ -5042,8 +5042,7 @@ find_best_down_child(xlator_t *this) } if (best_child >= 0) { gf_msg_debug(this->name, 0, - "Found best down child (%d) " - "@ %ld ms latency", + "Found best down child (%d) @ %" PRId64 " ms latency", best_child, best_latency); } return best_child; @@ -5068,8 +5067,7 @@ find_worst_up_child(xlator_t *this) } if (worst_child >= 0) { gf_msg_debug(this->name, 0, - "Found worst up child (%d)" - " @ %ld ms latency", + "Found worst up child (%d) @ %" PRId64 " ms latency", worst_child, worst_latency); } return worst_child; @@ -5086,7 +5084,7 @@ __afr_handle_ping_event(xlator_t *this, xlator_t *child_xlator, const int idx, priv = this->private; priv->child_latency[idx] = child_latency_msec; - gf_msg_debug(child_xlator->name, 0, "Client ping @ %ld ms", + gf_msg_debug(child_xlator->name, 0, "Client ping @ %" PRId64 " ms", child_latency_msec); if (priv->shd.iamshd) return; @@ -5102,8 +5100,10 @@ __afr_handle_ping_event(xlator_t *this, xlator_t *child_xlator, const int idx, priv->halo_min_replicas); } else { gf_log(child_xlator->name, GF_LOG_INFO, - "Child latency (%ld ms) " - "exceeds halo threshold (%ld), " + "Child latency (%" PRId64 + " ms) " + "exceeds halo threshold (%" PRId64 + "), " "marking child down.", child_latency_msec, halo_max_latency_msec); *event = GF_EVENT_CHILD_DOWN; @@ -5112,8 +5112,10 @@ __afr_handle_ping_event(xlator_t *this, xlator_t *child_xlator, const int idx, priv->child_up[idx] == 0) { if (up_children < priv->halo_max_replicas) { gf_log(child_xlator->name, GF_LOG_INFO, - "Child latency (%ld ms) " - "below halo threshold (%ld), " + "Child latency (%" PRId64 + " ms) " + "below halo threshold (%" PRId64 + "), " "marking child up.", child_latency_msec, halo_max_latency_msec); *event = GF_EVENT_CHILD_UP; @@ -5141,7 +5143,7 @@ afr_get_halo_latency(xlator_t *this) } else { halo_max_latency_msec = priv->halo_max_latency_msec; } - gf_msg_debug(this->name, 0, "Using halo latency %ld", + gf_msg_debug(this->name, 0, "Using halo latency %" PRId64, halo_max_latency_msec); return halo_max_latency_msec; } @@ -5196,7 +5198,8 @@ __afr_handle_child_up_event(xlator_t *this, xlator_t *child_xlator, priv->child_latency[worst_up_child] > halo_max_latency_msec) { gf_msg_debug(this->name, 0, "Marking child %d down, " - "doesn't meet halo threshold (%ld), and > " + "doesn't meet halo threshold (%" PRId64 + "), and > " "halo_min_replicas (%d)", worst_up_child, halo_max_latency_msec, priv->halo_min_replicas); diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 402f5ea5888..8635b3e9e06 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -1040,8 +1040,8 @@ afr_sh_fav_by_majority(xlator_t *this, struct afr_reply *replies, for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug(this->name, 0, - "Child:%s " - "mtime_sec = %ld, size = %lu for gfid %s", + "Child:%s mtime_sec = %" PRId64 ", size = %" PRIu64 + " for gfid %s", priv->children[i]->name, replies[i].poststat.ia_mtime, replies[i].poststat.ia_size, uuid_utoa(inode->gfid)); vote_count = 0; @@ -1079,8 +1079,9 @@ afr_sh_fav_by_mtime(xlator_t *this, struct afr_reply *replies, inode_t *inode) for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug(this->name, 0, - "Child:%s " - "mtime = %ld, mtime_nsec = %d for gfid %s", + "Child:%s mtime = %" PRId64 + ", mtime_nsec = %d for " + "gfid %s", priv->children[i]->name, replies[i].poststat.ia_mtime, replies[i].poststat.ia_mtime_nsec, uuid_utoa(inode->gfid)); @@ -1116,8 +1117,9 @@ afr_sh_fav_by_ctime(xlator_t *this, struct afr_reply *replies, inode_t *inode) for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug(this->name, 0, - "Child:%s " - "ctime = %ld, ctime_nsec = %d for gfid %s", + "Child:%s ctime = %" PRId64 + ", ctime_nsec = %d for " + "gfid %s", priv->children[i]->name, replies[i].poststat.ia_ctime, replies[i].poststat.ia_ctime_nsec, uuid_utoa(inode->gfid)); @@ -1152,8 +1154,7 @@ afr_sh_fav_by_size(xlator_t *this, struct afr_reply *replies, inode_t *inode) for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug(this->name, 0, - "Child:%s " - "file size = %lu for gfid %s", + "Child:%s file size = %" PRIu64 " for gfid %s", priv->children[i]->name, replies[i].poststat.ia_size, uuid_utoa(inode->gfid)); if (replies[i].poststat.ia_size > cmp_sz) { @@ -1241,10 +1242,10 @@ afr_mark_split_brain_source_sinks_by_policy( strftime(ctime_str, sizeof(ctime_str), "%Y-%m-%d %H:%M:%S", tm_ptr); gf_msg(this->name, GF_LOG_WARNING, 0, AFR_MSG_SBRAIN_FAV_CHILD_POLICY, - "Source %s " - "selected as authentic to resolve conflicting " - "data in file (gfid:%s) by %s (%lu bytes @ %s mtime, " - "%s ctime).", + "Source %s selected as authentic to resolve conflicting data " + "in file (gfid:%s) by %s (%" PRIu64 + " bytes @ %s mtime, %s " + "ctime).", priv->children[fav_child]->name, uuid_utoa(inode->gfid), policy_str, replies[fav_child].poststat.ia_size, mtime_str, ctime_str); diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 0f668e67793..a94f904323c 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -440,7 +440,7 @@ dht_inode_ctx_mdsvol_set(inode_t *inode, xlator_t *this, xlator_t *mds_subvol) { ret = __inode_ctx_get(inode, this, &ctx_int); if (ctx_int) { - ctx = (dht_inode_ctx_t *)ctx_int; + ctx = (dht_inode_ctx_t *)(uintptr_t)ctx_int; ctx->mds_subvol = mds_subvol; } else { ctx = GF_CALLOC(1, sizeof(*ctx), gf_dht_mt_inode_ctx_t); diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index e463aad3a0c..4764ac5fdd3 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -34,7 +34,7 @@ dht_fd_ctx_destroy(xlator_t *this, fd_t *fd) goto out; } - fd_ctx = (dht_fd_ctx_t *)value; + fd_ctx = (dht_fd_ctx_t *)(uintptr_t)value; if (fd_ctx) { GF_REF_PUT(fd_ctx); } @@ -58,10 +58,10 @@ __dht_fd_ctx_set(xlator_t *this, fd_t *fd, xlator_t *dst) goto out; } - fd_ctx->opened_on_dst = (uint64_t)dst; + fd_ctx->opened_on_dst = (uint64_t)(uintptr_t)dst; GF_REF_INIT(fd_ctx, dht_free_fd_ctx); - value = (uint64_t)fd_ctx; + value = (uint64_t)(uintptr_t)fd_ctx; ret = __fd_ctx_set(fd, this, value); if (ret < 0) { @@ -87,8 +87,8 @@ dht_fd_ctx_set(xlator_t *this, fd_t *fd, xlator_t *dst) { ret = __fd_ctx_get(fd, this, &value); if (ret && value) { - fd_ctx = (dht_fd_ctx_t *)value; - if (fd_ctx->opened_on_dst == (uint64_t)dst) { + fd_ctx = (dht_fd_ctx_t *)(uintptr_t)value; + if (fd_ctx->opened_on_dst == (uint64_t)(uintptr_t)dst) { /* This could happen due to racing * check_progress tasks*/ goto unlock; @@ -98,7 +98,7 @@ dht_fd_ctx_set(xlator_t *this, fd_t *fd, xlator_t *dst) "Different dst found in the fd ctx"); /* Overwrite and hope for the best*/ - fd_ctx->opened_on_dst = (uint64_t)dst; + fd_ctx->opened_on_dst = (uint64_t)(uintptr_t)dst; goto unlock; } } @@ -128,7 +128,7 @@ dht_fd_ctx_get(xlator_t *this, fd_t *fd) goto out; } - fd_ctx = (dht_fd_ctx_t *)tmp_val; + fd_ctx = (dht_fd_ctx_t *)(uintptr_t)tmp_val; GF_REF_GET(fd_ctx); } UNLOCK(&fd->lock); @@ -146,7 +146,7 @@ dht_fd_open_on_dst(xlator_t *this, fd_t *fd, xlator_t *dst) fd_ctx = dht_fd_ctx_get(this, fd); if (fd_ctx) { - if (fd_ctx->opened_on_dst == (uint64_t)dst) { + if (fd_ctx->opened_on_dst == (uint64_t)(uintptr_t)dst) { opened = _gf_true; } GF_REF_PUT(fd_ctx); @@ -182,7 +182,7 @@ dht_inode_ctx_set_mig_info(xlator_t *this, inode_t *inode, xlator_t *src_subvol, miginfo->dst_subvol = dst_subvol; GF_REF_INIT(miginfo, dht_free_mig_info); - value = (uint64_t)miginfo; + value = (uint64_t)(uintptr_t)miginfo; ret = inode_ctx_set1(inode, this, &value); if (ret < 0) { @@ -209,7 +209,7 @@ dht_inode_ctx_get_mig_info(xlator_t *this, inode_t *inode, goto out; } - miginfo = (dht_migrate_info_t *)tmp_miginfo; + miginfo = (dht_migrate_info_t *)(uintptr_t)tmp_miginfo; GF_REF_GET(miginfo); } UNLOCK(&inode->lock); @@ -1310,7 +1310,7 @@ dht_migration_complete_check_task(void *data) "%s: Found miginfo in the inode ctx", tmp_loc.path ? tmp_loc.path : uuid_utoa(tmp_loc.gfid)); - miginfo = (void *)tmp_miginfo; + miginfo = (void *)(uintptr_t)tmp_miginfo; GF_REF_PUT(miginfo); } ret = 1; @@ -1371,7 +1371,7 @@ dht_migration_complete_check_task(void *data) done on all the fd of inode */ ret = inode_ctx_reset1(inode, this, &tmp_miginfo); if (tmp_miginfo) { - miginfo = (void *)tmp_miginfo; + miginfo = (void *)(uintptr_t)tmp_miginfo; GF_REF_PUT(miginfo); goto out; } @@ -1578,7 +1578,7 @@ dht_rebalance_inprogress_task(void *data) gf_msg(this->name, GF_LOG_WARNING, 0, DHT_MSG_HAS_MIGINFO, "%s: Found miginfo in the inode ctx", tmp_loc.path ? tmp_loc.path : uuid_utoa(tmp_loc.gfid)); - miginfo = (void *)tmp_miginfo; + miginfo = (void *)(uintptr_t)tmp_miginfo; GF_REF_PUT(miginfo); } ret = 1; @@ -1830,7 +1830,7 @@ dht_inode_ctx_get(inode_t *inode, xlator_t *this, dht_inode_ctx_t **ctx) return ret; if (ctx) - *ctx = (dht_inode_ctx_t *)ctx_int; + *ctx = (dht_inode_ctx_t *)(uintptr_t)ctx_int; out: return ret; } @@ -2072,7 +2072,7 @@ __dht_lock_subvol_set(inode_t *inode, xlator_t *this, xlator_t *lock_subvol) return -1; } - ctx = (dht_inode_ctx_t *)value; + ctx = (dht_inode_ctx_t *)(uintptr_t)value; ctx->lock_subvol = lock_subvol; out: return ret; @@ -2127,7 +2127,7 @@ dht_get_lock_subvolume(xlator_t *this, struct gf_flock *lock, LOCK(&inode->lock); ret = __inode_ctx_get0(inode, this, &value); if (!ret && value) { - ctx = (dht_inode_ctx_t *)value; + ctx = (dht_inode_ctx_t *)(uintptr_t)value; subvol = ctx->lock_subvol; } if (!subvol && lock->l_type != F_UNLCK && cached_subvol) { diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 7a2539dc5f5..c9f41442f15 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -941,8 +941,8 @@ __dht_check_free_space(xlator_t *this, xlator_t *to, xlator_t *from, loc_t *loc, } gf_msg_debug(this->name, 0, - "min_free_disk - %f , block available - " - "%lu , block size - %lu ", + "min_free_disk - %f , block available - %" PRId64 + ", block size - %lu", conf->min_free_disk, dst_statfs.f_bavail, dst_statfs.f_bsize); dst_statfs_blocks = dst_statfs.f_bavail * @@ -1018,7 +1018,7 @@ check_avail_space: gf_msg_debug(this->name, 0, "file : %s, post_availspacepercent" - " : %lf f_bavail : %lu min-free-disk: %lf", + " : %lf f_bavail : %" PRIu64 " min-free-disk: %lf", loc->path, dst_post_availspacepercent, dst_statfs.f_bavail, conf->min_free_disk); @@ -1039,9 +1039,8 @@ check_avail_space: if (conf->disk_unit != 'p') { if ((dst_statfs_blocks * GF_DISK_SECTOR_SIZE) < conf->min_free_disk) { gf_msg_debug(this->name, 0, - "file : %s, destination " - "frsize: %lu f_bavail : %lu " - "min-free-disk: %lf", + "file : %s, destination frsize: %lu " + "f_bavail : %" PRIu64 " min-free-disk: %lf", loc->path, dst_statfs.f_frsize, dst_statfs.f_bavail, conf->min_free_disk); diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index fab970be394..0e57eab5f7f 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -1899,8 +1899,9 @@ dht_selfheal_layout_new_directory(call_frame_t *frame, loc_t *loc, if (weight_by_size && total_size) { /* We know total_size is not zero. */ chunk = ((double)0xffffffff) / ((double)total_size); - gf_msg_debug(this->name, 0, "chunk size = 0xffffffff / %lu = %f", - total_size, chunk); + gf_msg_debug(this->name, 0, + "chunk size = 0xffffffff / %" PRIu64 " = %f", total_size, + chunk); } else { weight_by_size = _gf_false; chunk = ((unsigned long)0xffffffff) / bricks_to_use; diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index f7fd6ef22e2..584f1dd76ba 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -478,7 +478,8 @@ tier_can_promote_file(xlator_t *this, char const *file_name, if (defrag->tier_conf.tier_max_promote_size && (current->ia_size > defrag->tier_conf.tier_max_promote_size)) { gf_msg(this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_STATUS, - "File %s (gfid:%s) with size (%lu) exceeds maxsize " + "File %s (gfid:%s) with size (%" PRIu64 + ") exceeds maxsize " "(%d) for promotion. File will not be promoted.", file_name, uuid_utoa(current->ia_gfid), current->ia_size, defrag->tier_conf.tier_max_promote_size); @@ -505,7 +506,8 @@ tier_can_promote_file(xlator_t *this, char const *file_name, defrag->tier_conf.watermark_hi) { gf_msg(this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_STATUS, "Estimated block count consumption on " - "hot tier (%lu) exceeds hi watermark (%d%%). " + "hot tier (%" PRIu64 + ") exceeds hi watermark (%d%%). " "File will not be promoted.", estimated_usage, defrag->tier_conf.watermark_hi); goto err; diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c index 2e5111b38f8..454c2c72c95 100644 --- a/xlators/cluster/ec/src/ec-combine.c +++ b/xlators/cluster/ec/src/ec-combine.c @@ -174,8 +174,11 @@ ec_iatt_combine(ec_fop_data_t *fop, struct iatt *dst, struct iatt *src, } if (failed) { gf_msg(fop->xl->name, GF_LOG_WARNING, 0, EC_MSG_IATT_COMBINE_FAIL, - "Failed to combine iatt (inode: %lu-%lu, links: %u-%u, " - "uid: %u-%u, gid: %u-%u, rdev: %lu-%lu, size: %lu-%lu, " + "Failed to combine iatt (inode: %" PRIu64 "-%" PRIu64 + ", " + "links: %u-%u, uid: %u-%u, gid: %u-%u, " + "rdev: %" PRIu64 "-%" PRIu64 ", size: %" PRIu64 "-%" PRIu64 + ", " "mode: %o-%o)", dst[i].ia_ino, src[i].ia_ino, dst[i].ia_nlink, src[i].ia_nlink, dst[i].ia_uid, src[i].ia_uid, dst[i].ia_gid, diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 0eee0a3363f..737f7fda882 100644 --- a/xlators/cluster/ec/src/ec-common.c +++ b/xlators/cluster/ec/src/ec-common.c @@ -132,22 +132,23 @@ out: loc_wipe(&loc); } -off_t -ec_range_end_get(off_t fl_start, size_t fl_size) -{ - off_t fl_end = 0; - switch (fl_size) { - case 0: - return fl_start; - case LLONG_MAX: /*Infinity*/ - return LLONG_MAX; - default: - fl_end = fl_start + fl_size - 1; - if (fl_end < 0) /*over-flow*/ - return LLONG_MAX; - else - return fl_end; +static off_t +ec_range_end_get(off_t fl_start, uint64_t fl_size) +{ + if (fl_size > 0) { + if (fl_size >= EC_RANGE_FULL) { + /* Infinity */ + fl_start = LLONG_MAX; + } else { + fl_start += fl_size - 1; + if (fl_start < 0) { + /* Overflow */ + fl_start = LLONG_MAX; + } + } } + + return fl_start; } static gf_boolean_t @@ -648,7 +649,7 @@ ec_child_select(ec_fop_data_t *fop) if ((fop->mask & ~ec->xl_up) != 0) { gf_msg(fop->xl->name, GF_LOG_WARNING, 0, EC_MSG_OP_EXEC_UNAVAIL, "Executing operation with " - "some subvolumes unavailable. (%lX). %s ", + "some subvolumes unavailable. (%" PRIXPTR "). %s ", fop->mask & ~ec->xl_up, ec_msg_str(fop)); fop->mask &= ec->xl_up; } @@ -870,7 +871,7 @@ ec_lock_allocate(ec_fop_data_t *fop, loc_t *loc) lock = mem_get0(ec->lock_pool); if (lock != NULL) { - lock->good_mask = -1ULL; + lock->good_mask = UINTPTR_MAX; INIT_LIST_HEAD(&lock->owners); INIT_LIST_HEAD(&lock->waiting); INIT_LIST_HEAD(&lock->frozen); @@ -903,9 +904,9 @@ ec_lock_compare(ec_lock_t *lock1, ec_lock_t *lock2) return gf_uuid_compare(lock1->loc.gfid, lock2->loc.gfid); } -void +static void ec_lock_insert(ec_fop_data_t *fop, ec_lock_t *lock, uint32_t flags, loc_t *base, - off_t fl_start, size_t fl_size) + off_t fl_start, uint64_t fl_size) { ec_lock_link_t *link; @@ -945,9 +946,9 @@ ec_lock_insert(ec_fop_data_t *fop, ec_lock_t *lock, uint32_t flags, loc_t *base, lock->refs_pending++; } -void +static void ec_lock_prepare_inode_internal(ec_fop_data_t *fop, loc_t *loc, uint32_t flags, - loc_t *base, off_t fl_start, size_t fl_size) + loc_t *base, off_t fl_start, uint64_t fl_size) { ec_lock_t *lock = NULL; ec_inode_t *ctx; @@ -1019,7 +1020,7 @@ unlock: void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags, - off_t fl_start, size_t fl_size) + off_t fl_start, uint64_t fl_size) { ec_lock_prepare_inode_internal(fop, loc, flags, NULL, fl_start, fl_size); } @@ -1048,14 +1049,14 @@ ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base, base = NULL; } - ec_lock_prepare_inode_internal(fop, &tmp, flags, base, 0, LLONG_MAX); + ec_lock_prepare_inode_internal(fop, &tmp, flags, base, 0, EC_RANGE_FULL); loc_wipe(&tmp); } void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags, off_t fl_start, - size_t fl_size) + uint64_t fl_size) { loc_t loc; int32_t err; diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h index bea0c045a47..bf41c0086f8 100644 --- a/xlators/cluster/ec/src/ec-common.h +++ b/xlators/cluster/ec/src/ec-common.h @@ -95,6 +95,9 @@ enum _ec_xattrop_flags { #define EC_STATE_HEAL_POST_INODELK_UNLOCK 217 #define EC_STATE_HEAL_DISPATCH 218 +/* Value to cover the full range of a file */ +#define EC_RANGE_FULL ((uint64_t)LLONG_MAX + 1) + gf_boolean_t ec_dispatch_one_retry(ec_fop_data_t *fop, ec_cbk_data_t **cbk); void @@ -120,13 +123,13 @@ ec_cbk_set_error(ec_cbk_data_t *cbk, int32_t error, gf_boolean_t ro); void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags, - off_t fl_start, size_t fl_size); + off_t fl_start, uint64_t fl_size); void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base, uint32_t flags); void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags, off_t fl_start, - size_t fl_size); + uint64_t fl_size); void ec_lock(ec_fop_data_t *fop); void diff --git a/xlators/cluster/ec/src/ec-dir-read.c b/xlators/cluster/ec/src/ec-dir-read.c index 8db92b9d92d..ec4cefb1e78 100644 --- a/xlators/cluster/ec/src/ec-dir-read.c +++ b/xlators/cluster/ec/src/ec-dir-read.c @@ -142,7 +142,7 @@ ec_manager_opendir(ec_fop_data_t *fop, int32_t state) case EC_STATE_LOCK: ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO, 0, - LLONG_MAX); + EC_RANGE_FULL); ec_lock(fop); return EC_STATE_DISPATCH; @@ -427,7 +427,8 @@ ec_manager_readdir(ec_fop_data_t *fop, int32_t state) } fop->mask &= 1ULL << idx; } else { - ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, LLONG_MAX); + ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, + EC_RANGE_FULL); ec_lock(fop); } diff --git a/xlators/cluster/ec/src/ec-generic.c b/xlators/cluster/ec/src/ec-generic.c index d12481bdc18..89e72540916 100644 --- a/xlators/cluster/ec/src/ec-generic.c +++ b/xlators/cluster/ec/src/ec-generic.c @@ -83,7 +83,7 @@ ec_manager_flush(ec_fop_data_t *fop, int32_t state) switch (state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_prepare_fd(fop, fop->fd, 0, 0, LLONG_MAX); + ec_lock_prepare_fd(fop, fop->fd, 0, 0, EC_RANGE_FULL); ec_lock(fop); return EC_STATE_DISPATCH; @@ -289,7 +289,7 @@ ec_manager_fsync(ec_fop_data_t *fop, int32_t state) switch (state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, LLONG_MAX); + ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, EC_RANGE_FULL); ec_lock(fop); return EC_STATE_DISPATCH; @@ -484,7 +484,7 @@ ec_manager_fsyncdir(ec_fop_data_t *fop, int32_t state) switch (state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_prepare_fd(fop, fop->fd, 0, 0, LLONG_MAX); + ec_lock_prepare_fd(fop, fop->fd, 0, 0, EC_RANGE_FULL); ec_lock(fop); return EC_STATE_DISPATCH; @@ -1182,9 +1182,10 @@ ec_manager_xattrop(ec_fop_data_t *fop, int32_t state) case EC_STATE_LOCK: if (fop->fd == NULL) { ec_lock_prepare_inode(fop, &fop->loc[0], EC_UPDATE_META, 0, - LLONG_MAX); + EC_RANGE_FULL); } else { - ec_lock_prepare_fd(fop, fop->fd, EC_UPDATE_META, 0, LLONG_MAX); + ec_lock_prepare_fd(fop, fop->fd, EC_UPDATE_META, 0, + EC_RANGE_FULL); } ec_lock(fop); diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c index 229c0683d91..9eb5b856932 100644 --- a/xlators/cluster/ec/src/ec-heal.c +++ b/xlators/cluster/ec/src/ec-heal.c @@ -332,7 +332,7 @@ ec_fheal(call_frame_t *frame, xlator_t *this, uintptr_t target, int32_t minimum, ec_fd_t *ctx = ec_fd_get(fd, this); if (ctx != NULL) { - gf_msg_trace("ec", 0, "FHEAL ctx: flags=%X, open=%lX", ctx->flags, + gf_msg_trace("ec", 0, "FHEAL ctx: flags=%X, open=%" PRIXPTR, ctx->flags, ctx->open); ec_heal(frame, this, target, minimum, func, data, &ctx->loc, partial, xdata); @@ -2484,7 +2484,7 @@ ec_heal_do(xlator_t *this, void *data, loc_t *loc, int32_t partial) if (ret == 0) { gf_msg_debug(this->name, 0, "%s: name heal " - "successful on %lX", + "successful on %" PRIXPTR, loc->path, ec_char_array_to_mask(participants, ec->nodes)); } else { diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c index 7a8b174bbed..c02d5401439 100644 --- a/xlators/cluster/ec/src/ec-inode-read.c +++ b/xlators/cluster/ec/src/ec-inode-read.c @@ -74,7 +74,7 @@ ec_manager_access(ec_fop_data_t *fop, int32_t state) case EC_STATE_INIT: case EC_STATE_LOCK: ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO, 0, - LLONG_MAX); + EC_RANGE_FULL); ec_lock(fop); return EC_STATE_DISPATCH; @@ -301,10 +301,10 @@ ec_manager_getxattr(ec_fop_data_t *fop, int32_t state) SLEN(GF_XATTR_CLRLK_CMD)) != 0)) { if (fop->fd == NULL) { ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO, 0, - LLONG_MAX); + EC_RANGE_FULL); } else { ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, - LLONG_MAX); + EC_RANGE_FULL); } ec_lock(fop); } @@ -1008,7 +1008,7 @@ ec_manager_readlink(ec_fop_data_t *fop, int32_t state) case EC_STATE_INIT: case EC_STATE_LOCK: ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO, 0, - LLONG_MAX); + EC_RANGE_FULL); ec_lock(fop); return EC_STATE_DISPATCH; @@ -1131,7 +1131,7 @@ ec_readv_rebuild(ec_t *ec, ec_fop_data_t *fop, ec_cbk_data_t *cbk) ec_cbk_data_t *ans = NULL; struct iobref *iobref = NULL; void *ptr; - size_t fsize = 0, size = 0, max = 0; + uint64_t fsize = 0, size = 0, max = 0; int32_t pos, err = -ENOMEM; if (cbk->op_ret < 0) { @@ -1536,7 +1536,7 @@ int32_t ec_manager_seek(ec_fop_data_t *fop, int32_t state) { ec_cbk_data_t *cbk; - size_t size; + uint64_t size; switch (state) { case EC_STATE_INIT: @@ -1548,7 +1548,7 @@ ec_manager_seek(ec_fop_data_t *fop, int32_t state) case EC_STATE_LOCK: ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, fop->offset, - LLONG_MAX); + EC_RANGE_FULL); ec_lock(fop); return EC_STATE_DISPATCH; @@ -1764,9 +1764,10 @@ ec_manager_stat(ec_fop_data_t *fop, int32_t state) case EC_STATE_LOCK: if (fop->fd == NULL) { ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO, 0, - LLONG_MAX); + EC_RANGE_FULL); } else { - ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, LLONG_MAX); + ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, + EC_RANGE_FULL); } ec_lock(fop); diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c index ffdac632683..b915a992a00 100644 --- a/xlators/cluster/ec/src/ec-inode-write.c +++ b/xlators/cluster/ec/src/ec-inode-write.c @@ -68,8 +68,8 @@ out: return 0; } -int32_t -ec_update_write(ec_fop_data_t *fop, uintptr_t mask, off_t offset, size_t size) +static int32_t +ec_update_write(ec_fop_data_t *fop, uintptr_t mask, off_t offset, uint64_t size) { struct iobref *iobref = NULL; struct iobuf *iobuf = NULL; @@ -219,10 +219,10 @@ ec_manager_xattr(ec_fop_data_t *fop, int32_t state) if (fop->fd == NULL) { ec_lock_prepare_inode(fop, &fop->loc[0], EC_UPDATE_META | EC_QUERY_INFO, 0, - LLONG_MAX); + EC_RANGE_FULL); } else { ec_lock_prepare_fd(fop, fop->fd, EC_UPDATE_META | EC_QUERY_INFO, - 0, LLONG_MAX); + 0, EC_RANGE_FULL); } ec_lock(fop); @@ -455,10 +455,10 @@ ec_manager_setattr(ec_fop_data_t *fop, int32_t state) if (fop->fd == NULL) { ec_lock_prepare_inode(fop, &fop->loc[0], EC_UPDATE_META | EC_QUERY_INFO, 0, - LLONG_MAX); + EC_RANGE_FULL); } else { ec_lock_prepare_fd(fop, fop->fd, EC_UPDATE_META | EC_QUERY_INFO, - 0, LLONG_MAX); + 0, EC_RANGE_FULL); } ec_lock(fop); @@ -1101,8 +1101,8 @@ ec_update_discard_write(ec_fop_data_t *fop, uintptr_t mask) ec_t *ec = fop->xl->private; off_t off_head = 0; off_t off_tail = 0; - size_t size_head = 0; - size_t size_tail = 0; + uint64_t size_head = 0; + uint64_t size_tail = 0; int error = 0; off_head = fop->offset * ec->fragments - fop->int32; @@ -1172,7 +1172,7 @@ ec_manager_discard(ec_fop_data_t *fop, int32_t state) { ec_cbk_data_t *cbk = NULL; off_t fl_start = 0; - size_t fl_size = 0; + uint64_t fl_size = 0; switch (state) { case EC_STATE_INIT: @@ -1341,7 +1341,7 @@ int32_t ec_update_truncate_write(ec_fop_data_t *fop, uintptr_t mask) { ec_t *ec = fop->xl->private; - size_t size = fop->offset * ec->fragments - fop->user_size; + uint64_t size = fop->offset * ec->fragments - fop->user_size; return ec_update_write(fop, mask, fop->user_size, size); } @@ -1420,12 +1420,12 @@ ec_manager_truncate(ec_fop_data_t *fop, int32_t state) ec_lock_prepare_inode( fop, &fop->loc[0], EC_UPDATE_DATA | EC_UPDATE_META | EC_QUERY_INFO, - fop->offset, LLONG_MAX); + fop->offset, EC_RANGE_FULL); } else { ec_lock_prepare_fd( fop, fop->fd, EC_UPDATE_DATA | EC_UPDATE_META | EC_QUERY_INFO, - fop->offset, LLONG_MAX); + fop->offset, EC_RANGE_FULL); } ec_lock(fop); @@ -1739,7 +1739,7 @@ ec_writev_merge_tail(call_frame_t *frame, void *cookie, xlator_t *this, { ec_t *ec = this->private; ec_fop_data_t *fop = frame->local; - size_t size, base, tmp; + uint64_t size, base, tmp; if (op_ret >= 0) { tmp = 0; @@ -1772,7 +1772,7 @@ ec_writev_merge_head(call_frame_t *frame, void *cookie, xlator_t *this, { ec_t *ec = this->private; ec_fop_data_t *fop = frame->local; - size_t size, base; + uint64_t size, base; if (op_ret >= 0) { size = fop->head; @@ -1884,7 +1884,7 @@ out: static void ec_merge_stripe_head_locked(ec_t *ec, ec_fop_data_t *fop, ec_stripe_t *stripe) { - size_t head, size; + uint32_t head, size; head = fop->head; memcpy(fop->vector[0].iov_base, stripe->data, head); @@ -1900,7 +1900,7 @@ ec_merge_stripe_head_locked(ec_t *ec, ec_fop_data_t *fop, ec_stripe_t *stripe) static void ec_merge_stripe_tail_locked(ec_t *ec, ec_fop_data_t *fop, ec_stripe_t *stripe) { - size_t head, tail; + uint32_t head, tail; off_t offset; offset = fop->user_size + fop->head; @@ -2117,7 +2117,7 @@ ec_manager_writev(ec_fop_data_t *fop, int32_t state) ec_fd_t *ctx = NULL; ec_t *ec = fop->xl->private; off_t fl_start = 0; - size_t fl_size = LLONG_MAX; + uint64_t fl_size = LONG_MAX; switch (state) { case EC_STATE_INIT: @@ -2163,7 +2163,7 @@ ec_manager_writev(ec_fop_data_t *fop, int32_t state) cbk = ec_fop_prepare_answer(fop, _gf_false); if (cbk != NULL) { ec_t *ec = fop->xl->private; - size_t size; + uint64_t size; ec_iatt_rebuild(fop->xl->private, cbk->iatt, 2, cbk->count); diff --git a/xlators/cluster/ec/src/ec-method.c b/xlators/cluster/ec/src/ec-method.c index 3aff6b096bd..55faed0b193 100644 --- a/xlators/cluster/ec/src/ec-method.c +++ b/xlators/cluster/ec/src/ec-method.c @@ -391,10 +391,10 @@ ec_method_update(xlator_t *xl, ec_matrix_list_t *list, const char *gen) } void -ec_method_encode(ec_matrix_list_t *list, size_t size, void *in, void **out) +ec_method_encode(ec_matrix_list_t *list, uint64_t size, void *in, void **out) { ec_matrix_t *matrix; - size_t pos; + uint64_t pos; uint32_t i; matrix = list->encode; @@ -408,11 +408,11 @@ ec_method_encode(ec_matrix_list_t *list, size_t size, void *in, void **out) } int32_t -ec_method_decode(ec_matrix_list_t *list, size_t size, uintptr_t mask, +ec_method_decode(ec_matrix_list_t *list, uint64_t size, uintptr_t mask, uint32_t *rows, void **in, void *out) { ec_matrix_t *matrix; - size_t pos; + uint64_t pos; uint32_t i; matrix = ec_method_matrix_get(list, mask, rows); diff --git a/xlators/cluster/ec/src/ec-method.h b/xlators/cluster/ec/src/ec-method.h index 3d6393bed06..ca33f4ffdce 100644 --- a/xlators/cluster/ec/src/ec-method.h +++ b/xlators/cluster/ec/src/ec-method.h @@ -41,10 +41,10 @@ int32_t ec_method_update(xlator_t *xl, ec_matrix_list_t *list, const char *gen); void -ec_method_encode(ec_matrix_list_t *list, size_t size, void *in, void **out); +ec_method_encode(ec_matrix_list_t *list, uint64_t size, void *in, void **out); int32_t -ec_method_decode(ec_matrix_list_t *list, size_t size, uintptr_t mask, +ec_method_decode(ec_matrix_list_t *list, uint64_t size, uintptr_t mask, uint32_t *rows, void **in, void *out); #endif /* __EC_METHOD_H__ */ diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index 0350325d6fb..00c374e7ca3 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -74,7 +74,7 @@ ec_parse_options(xlator_t *this) gf_msg_debug("ec", 0, "Initialized with: nodes=%u, fragments=%u, " - "stripe_size=%u, node_mask=%lX", + "stripe_size=%u, node_mask=%" PRIxFAST32, ec->nodes, ec->fragments, ec->stripe_size, ec->node_mask); error = 0; diff --git a/xlators/cluster/stripe/src/stripe-helpers.c b/xlators/cluster/stripe/src/stripe-helpers.c index 7301494415d..c3743723d1d 100644 --- a/xlators/cluster/stripe/src/stripe-helpers.c +++ b/xlators/cluster/stripe/src/stripe-helpers.c @@ -252,7 +252,7 @@ stripe_fill_pathinfo_xattr(xlator_t *this, stripe_local_t *local, } len = snprintf(stripe_size_str, sizeof(stripe_size_str), "%" PRId64, - (long long)(local->fctx) ? local->fctx->stripe_size : 0); + local->fctx ? local->fctx->stripe_size : 0); if (len < 0 || len >= sizeof(stripe_size_str)) goto out; /* extra bytes for decorations (brackets and <>'s) */ diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index a6027d1f281..836bc680897 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -2118,7 +2118,7 @@ stripe_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this, stripe_copy_xl_array(local->fctx->xl_array, priv->xl_array, local->fctx->stripe_count); - inode_ctx_put(local->inode, this, (uint64_t)local->fctx); + inode_ctx_put(local->inode, this, (uint64_t)(uintptr_t)local->fctx); } /* Create itself has failed.. so return diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index 86fa9d4611d..ad8ca088777 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -3311,7 +3311,7 @@ init(xlator_t *this) char *forced_loglevel = NULL; eh_t *history = NULL; int ret = -1; - size_t history_size = TRACE_DEFAULT_HISTORY_SIZE; + uint64_t history_size = TRACE_DEFAULT_HISTORY_SIZE; trace_conf_t *conf = NULL; if (!this) @@ -3364,10 +3364,10 @@ init(xlator_t *this) if (excludes) process_call_list(excludes, 0); - GF_OPTION_INIT("history-size", conf->history_size, size, out); + GF_OPTION_INIT("history-size", history_size, size, out); + conf->history_size = history_size; - gf_log(this->name, GF_LOG_INFO, "history size %" GF_PRI_SIZET, - history_size); + gf_log(this->name, GF_LOG_INFO, "history size %" PRIu64, history_size); GF_OPTION_INIT("log-file", conf->log_file, bool, out); diff --git a/xlators/debug/trace/src/trace.h b/xlators/debug/trace/src/trace.h index 815647c05be..cd73e0f34ed 100644 --- a/xlators/debug/trace/src/trace.h +++ b/xlators/debug/trace/src/trace.h @@ -34,7 +34,7 @@ trace_fop_name_t trace_fop_names[GF_FOP_MAXVALUE]; typedef struct { gf_boolean_t log_file; gf_boolean_t log_history; - size_t history_size; + uint64_t history_size; int trace_log_level; } trace_conf_t; diff --git a/xlators/experimental/fdl/src/fdl-tmpl.c.in b/xlators/experimental/fdl/src/fdl-tmpl.c.in index 7388b83e0bc..c99157be957 100644 --- a/xlators/experimental/fdl/src/fdl-tmpl.c.in +++ b/xlators/experimental/fdl/src/fdl-tmpl.c.in @@ -92,7 +92,7 @@ fdl_open_term_log(xlator_t *this, log_obj_t *obj, int term) goto err; } - gf_log(this->name, GF_LOG_INFO, "opening %s (size %ld)", obj->path, + gf_log(this->name, GF_LOG_INFO, "opening %s (size %" PRId64 ")", obj->path, obj->size); obj->fd = open(obj->path, O_RDWR | O_CREAT | O_TRUNC, 0666); @@ -159,7 +159,8 @@ fdl_close_term_log(xlator_t *this, log_obj_t *obj) } if (obj->fd >= 0) { - gf_log(this->name, GF_LOG_INFO, "truncating term %d %s journal to %ld", + gf_log(this->name, GF_LOG_INFO, + "truncating term %d %s journal to %" PRId64, priv->term, obj->type, obj->max_offset); if (sys_ftruncate(obj->fd, obj->max_offset) < 0) { gf_log(this->name, GF_LOG_WARNING, diff --git a/xlators/experimental/fdl/src/gen_dumper.py b/xlators/experimental/fdl/src/gen_dumper.py index 15221544b1c..630b54492f7 100755 --- a/xlators/experimental/fdl/src/gen_dumper.py +++ b/xlators/experimental/fdl/src/gen_dumper.py @@ -48,12 +48,12 @@ from generator import ops, fop_subs, cbk_subs, generate typemap = { 'dict_t *': ( "DICT", ""), 'fd_t *': ( "GFID", ""), - 'dev_t': ( "DOUBLE", "%ld (0x%lx)"), + 'dev_t': ( "DOUBLE", "%\"PRId64\" (0x%\"PRIx64\")"), 'gf_xattrop_flags_t': ( "INTEGER", "%d (0x%x)"), 'int32_t': ( "INTEGER", "%d (0x%x)"), 'mode_t': ( "INTEGER", "%d (0x%x)"), - 'off_t': ( "DOUBLE", "%ld (0x%lx)"), - 'size_t': ( "DOUBLE", "%ld (0x%lx)"), + 'off_t': ( "DOUBLE", "%\"PRId64\" (0x%\"PRIx64\")"), + 'size_t': ( "DOUBLE", "%\"PRId64\" (0x%\"PRIx64\")"), 'uint32_t': ( "INTEGER", "%d (0x%x)"), 'loc_t *': ( "LOC", ""), 'const char *': ( "STRING", ""), diff --git a/xlators/experimental/jbr-server/src/jbr.c b/xlators/experimental/jbr-server/src/jbr.c index 49d7eb467f7..31df6ad5a1e 100644 --- a/xlators/experimental/jbr-server/src/jbr.c +++ b/xlators/experimental/jbr-server/src/jbr.c @@ -142,7 +142,7 @@ jbr_get_fd_ctx(xlator_t *this, fd_t *fd) } else { ctx_ptr = GF_CALLOC(1, sizeof(*ctx_ptr), gf_mt_jbr_fd_ctx_t); if (ctx_ptr) { - if (__fd_ctx_set(fd, this, (uint64_t)ctx_ptr) == 0) { + if (__fd_ctx_set(fd, this, (uint64_t)(uintptr_t)ctx_ptr) == 0) { INIT_LIST_HEAD(&ctx_ptr->dirty_list); INIT_LIST_HEAD(&ctx_ptr->fd_list); } else { 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; diff --git a/xlators/meta/src/meta-helpers.c b/xlators/meta/src/meta-helpers.c index 08a3016f640..d7d59c71296 100644 --- a/xlators/meta/src/meta-helpers.c +++ b/xlators/meta/src/meta-helpers.c @@ -31,7 +31,7 @@ meta_fd_get(fd_t *fd, xlator_t *this) __fd_ctx_set(fd, this, value); } } else { - meta_fd = (void *)value; + meta_fd = (void *)(uintptr_t)value; } } unlock: @@ -48,7 +48,7 @@ meta_fd_release(fd_t *fd, xlator_t *this) int i = 0; fd_ctx_get(fd, this, &value); - meta_fd = (void *)value; + meta_fd = (void *)(uintptr_t)value; if (meta_fd && meta_fd->dirents) { for (i = 0; i < meta_fd->size; i++) @@ -71,7 +71,7 @@ meta_ops_get(inode_t *inode, xlator_t *this) inode_ctx_get2(inode, this, NULL, &value); - ops = (void *)value; + ops = (void *)(uintptr_t)value; return ops; } @@ -111,7 +111,7 @@ meta_ctx_get(inode_t *inode, xlator_t *this) inode_ctx_get2(inode, this, &value, 0); - ctx = (void *)value; + ctx = (void *)(uintptr_t)value; return ctx; } diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index ec0d4c99b11..19ccefa7d2f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -1518,6 +1518,7 @@ glusterd_import_friend_snap(dict_t *peer_data, int32_t snap_count, int32_t volcount = -1; int32_t i = -1; xlator_t *this = NULL; + int64_t time_stamp; this = THIS; GF_ASSERT(this); @@ -1562,12 +1563,13 @@ glusterd_import_friend_snap(dict_t *peer_data, int32_t snap_count, } snprintf(buf, sizeof(buf), "%s.time_stamp", prefix); - ret = dict_get_int64(peer_data, buf, &snap->time_stamp); + ret = dict_get_int64(peer_data, buf, &time_stamp); if (ret) { gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_GET_FAILED, "Unable to get time_stamp for snap %s", peer_snap_name); goto out; } + snap->time_stamp = (time_t)time_stamp; snprintf(buf, sizeof(buf), "%s.snap_restored", prefix); ret = dict_get_int8(peer_data, buf, (int8_t *)&snap->snap_restored); diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index f2f7d54a726..a05fd6d0c98 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -363,7 +363,7 @@ gd_store_brick_snap_details_write(int fd, glusterd_brickinfo_t *brickinfo) if (ret) goto out; - snprintf(value, sizeof(value), "%lu", brickinfo->statfs_fsid); + snprintf(value, sizeof(value), "%" PRIu64, brickinfo->statfs_fsid); ret = gf_store_save_value(fd, GLUSTERD_STORE_KEY_BRICK_FSID, value); out: diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 3c32cf90577..3e291e046e3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -4061,7 +4061,7 @@ client_graph_set_rda_options(volgen_graph_t *graph, glusterd_volinfo_t *volinfo, else rda_req_size = new_cache_size; - snprintf(new_req_size_str, sizeof(new_req_size_str), "%ld%s", + snprintf(new_req_size_str, sizeof(new_req_size_str), "%" PRId64 "%s", rda_req_size, "B"); ret = dict_set_dynstr_with_alloc(set_dict, VKEY_RDA_REQUEST_SIZE, new_req_size_str); @@ -4069,7 +4069,7 @@ client_graph_set_rda_options(volgen_graph_t *graph, glusterd_volinfo_t *volinfo, goto out; } - snprintf(new_cache_size_str, sizeof(new_cache_size_str), "%ld%s", + snprintf(new_cache_size_str, sizeof(new_cache_size_str), "%" PRId64 "%s", new_cache_size, "B"); ret = dict_set_dynstr_with_alloc(set_dict, VKEY_RDA_CACHE_LIMIT, new_cache_size_str); diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index e4e64dd4a96..965f8ca8a71 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -959,7 +959,7 @@ fuse_getattr(xlator_t *this, fuse_in_header_t *finh, void *msg, #if FUSE_KERNEL_MINOR_VERSION >= 9 priv = this->private; if (priv->proto_minor >= 9 && fgi->getattr_flags & FUSE_GETATTR_FH) - state->fd = fd_ref((fd_t *)fgi->fh); + state->fd = fd_ref((fd_t *)(uintptr_t)fgi->fh); #endif if (finh->nodeid == 1) { state->gfid[15] = 1; diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 843fc36396a..e8e04c03434 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -332,7 +332,7 @@ ioc_invalidate(xlator_t *this, inode_t *inode) ioc_inode_t *ioc_inode = NULL; inode_ctx_get(inode, this, (uint64_t *)&ioc_addr); - ioc_inode = (void *)ioc_addr; + ioc_inode = (void *)(uintptr_t)ioc_addr; if (ioc_inode) ioc_inode_flush(ioc_inode); diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c index c8f818717ef..8021fd07a2e 100644 --- a/xlators/performance/open-behind/src/open-behind.c +++ b/xlators/performance/open-behind/src/open-behind.c @@ -105,14 +105,14 @@ ob_inode_get(xlator_t *this, inode_t *inode) if (ob_inode == NULL) goto unlock; - value = (uint64_t)((void *)ob_inode); + value = (uint64_t)(uintptr_t)ob_inode; ret = __inode_ctx_set(inode, this, &value); if (ret < 0) { ob_inode_free(ob_inode); ob_inode = NULL; } } else { - ob_inode = (ob_inode_t *)value; + ob_inode = (ob_inode_t *)(uintptr_t)value; } } unlock: @@ -1109,7 +1109,7 @@ ob_forget(xlator_t *this, inode_t *inode) inode_ctx_del(inode, this, &value); if (value) { - ob_inode = (ob_inode_t *)((void *)value); + ob_inode = (ob_inode_t *)(uintptr_t)value; ob_inode_free(ob_inode); } diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c index 7a5f989eb73..71d0e23c95c 100644 --- a/xlators/performance/readdir-ahead/src/readdir-ahead.c +++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c @@ -68,13 +68,13 @@ get_rda_fd_ctx(fd_t *fd, xlator_t *this) /* ctx offset values initialized to 0 */ ctx->xattrs = NULL; - if (__fd_ctx_set(fd, this, (uint64_t)ctx) < 0) { + if (__fd_ctx_set(fd, this, (uint64_t)(uintptr_t)ctx) < 0) { GF_FREE(ctx); ctx = NULL; goto out; } } else { - ctx = (struct rda_fd_ctx *)val; + ctx = (struct rda_fd_ctx *)(uintptr_t)val; } out: UNLOCK(&fd->lock); @@ -90,7 +90,7 @@ __rda_inode_ctx_get(inode_t *inode, xlator_t *this) ret = __inode_ctx_get1(inode, this, &ctx_uint); if (ret == 0) - return (rda_inode_ctx_t *)ctx_uint; + return (rda_inode_ctx_t *)(uintptr_t)ctx_uint; ctx_p = GF_CALLOC(1, sizeof(*ctx_p), gf_rda_mt_inode_ctx_t); if (!ctx_p) @@ -1064,7 +1064,7 @@ rda_releasedir(xlator_t *this, fd_t *fd) if (fd_ctx_del(fd, this, &val) < 0) return -1; - ctx = (struct rda_fd_ctx *)val; + ctx = (struct rda_fd_ctx *)(uintptr_t)val; if (!ctx) return 0; @@ -1092,7 +1092,7 @@ rda_forget(xlator_t *this, inode_t *inode) if (!ctx_uint) return 0; - ctx = (rda_inode_ctx_t *)ctx_uint; + ctx = (rda_inode_ctx_t *)(uintptr_t)ctx_uint; GF_FREE(ctx); diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index e1ec5512510..cf8e40eaad0 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -979,9 +979,9 @@ server_dump_metrics(xlator_t *this, int fd) if (!client) continue; - dprintf(fd, "%s.total.rpc.%s.bytes_read %lu\n", this->name, + dprintf(fd, "%s.total.rpc.%s.bytes_read %" PRIu64 "\n", this->name, client->client_uid, xprt->total_bytes_read); - dprintf(fd, "%s.total.rpc.%s.bytes_write %lu\n", this->name, + dprintf(fd, "%s.total.rpc.%s.bytes_write %" PRIu64 "\n", this->name, client->client_uid, xprt->total_bytes_write); dprintf(fd, "%s.total.rpc.%s.outstanding %d\n", this->name, client->client_uid, xprt->outstanding_rpc_count); diff --git a/xlators/storage/bd/src/bd-helper.c b/xlators/storage/bd/src/bd-helper.c index 895c6500acf..c6891749008 100644 --- a/xlators/storage/bd/src/bd-helper.c +++ b/xlators/storage/bd/src/bd-helper.c @@ -331,7 +331,7 @@ bd_validate_bd_xattr(xlator_t *this, char *bd, char **type, uint64_t *lv_size, if (bytes) { *bytes = '\0'; bytes++; - gf_string2bytesize(bytes, &size); + gf_string2bytesize_uint64(bytes, &size); } if (strcmp(bd, BD_LV) && strcmp(bd, BD_THIN)) { diff --git a/xlators/storage/bd/src/bd.c b/xlators/storage/bd/src/bd.c index 0b399157238..0a29a99181b 100644 --- a/xlators/storage/bd/src/bd.c +++ b/xlators/storage/bd/src/bd.c @@ -1025,7 +1025,7 @@ bd_setx_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, if (!s_size) size = bd_get_default_extent(priv); else - gf_string2bytesize(s_size, &size); + gf_string2bytesize_uint64(s_size, &size); gf_asprintf(&bd, "%s:%ld", type, size); BD_VALIDATE_MEM_ALLOC(bd, op_errno, out); @@ -1146,7 +1146,7 @@ bd_offload_getx_cbk(call_frame_t *frame, void *cookie, xlator_t *this, /* For clone size is taken from source LV */ if (!local->size) { p++; - gf_string2bytesize(p, &local->size); + gf_string2bytesize_uint64(p, &local->size); } gf_asprintf(&bd, "%s:%ld", type, local->size); local->bdatt->type = gf_strdup(type); @@ -1312,7 +1312,7 @@ bd_offload(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, gfid = strtok_r(param, ":", &p); size = strtok_r(NULL, ":", &p); if (size) - gf_string2bytesize(size, &local->size); + gf_string2bytesize_uint64(size, &local->size); else if (offload != BD_OF_CLONE) local->size = bd_get_default_extent(this->private); diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 99ee094c114..4c3f064f564 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -2582,7 +2582,7 @@ __posix_inode_ctx_get(inode_t *inode, xlator_t *this) ret = __inode_ctx_get(inode, this, &ctx_uint); if (ret == 0) { - return (posix_inode_ctx_t *)ctx_uint; + return (posix_inode_ctx_t *)(uintptr_t)ctx_uint; } ctx_p = GF_CALLOC(1, sizeof(*ctx_p), gf_posix_mt_inode_ctx_t); diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c index 4b6716fcd7f..4ce181d9c0e 100644 --- a/xlators/storage/posix/src/posix-inode-fd-ops.c +++ b/xlators/storage/posix/src/posix-inode-fd-ops.c @@ -2337,7 +2337,7 @@ posix_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, goto unlock; } - sprintf(stime, "%lu", tmp_stbuf.ia_mtime); + sprintf(stime, "%" PRId64, tmp_stbuf.ia_mtime); /*TODO: may be should consider nano-second also */ if (strncmp(stime, tdata->data, tdata->len) != 0) { @@ -2350,7 +2350,7 @@ posix_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, goto unlock; } - len = sprintf(sxattr, "%lu", tmp_stbuf.ia_size); + len = sprintf(sxattr, "%" PRIu64, tmp_stbuf.ia_size); ret = sys_lsetxattr(real_path, GF_CS_OBJECT_SIZE, sxattr, len, flags); @@ -5400,7 +5400,7 @@ posix_forget(xlator_t *this, inode_t *inode) if (!ctx_uint) return 0; - ctx = (posix_inode_ctx_t *)ctx_uint; + ctx = (posix_inode_ctx_t *)(uintptr_t)ctx_uint; if (ctx->unlink_flag == GF_UNLINK_TRUE) { POSIX_GET_FILE_UNLINK_PATH(priv_posix->base_path, inode->gfid, -- cgit