diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2014-06-18 14:46:05 -0400 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-11-26 00:26:53 -0800 |
commit | c147c36a70505ff239cef48030422840abd3fbcd (patch) | |
tree | 710057d06f614c654b8636e8df312ebd73cd0fc5 | |
parent | 6c5b74c66cc0eb10edf5e4d3a726c7efddb5842c (diff) |
core: fix remaining *printf formation warnings on 32-bit
This fixes a few lingering size_t problems. Of particular note are
some uses of off_t for size params in function calls.
There is no correct, _portable_ way to correctly print an off_t. The
best you can do is use a scratch int64_t/PRId64 or uint64_t/PRIu64.
Change-Id: I86f3cf4678c7dbe5cad156ae8d540a66545f000d
BUG: 1110916
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/8105
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r-- | api/src/glfs.c | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 4 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 9 | ||||
-rw-r--r-- | xlators/storage/bd/src/bd-helper.c | 13 | ||||
-rw-r--r-- | xlators/storage/bd/src/bd.c | 5 | ||||
-rw-r--r-- | xlators/storage/bd/src/bd.h | 6 |
6 files changed, 22 insertions, 19 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c index e74329caf9d..12c4ea4aebb 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -872,13 +872,13 @@ pub_glfs_get_volfile (struct glfs *fs, void *buf, size_t len) glfs_lock(fs); if (len >= fs->oldvollen) { - gf_log ("glfs", GF_LOG_TRACE, "copying %lu to %p", len, buf); + gf_log ("glfs", GF_LOG_TRACE, "copying %zu to %p", len, buf); memcpy(buf,fs->oldvolfile,len); res = len; } else { res = len - fs->oldvollen; - gf_log ("glfs", GF_LOG_TRACE, "buffer is %ld too short", -res); + gf_log ("glfs", GF_LOG_TRACE, "buffer is %zd too short", -res); } glfs_unlock(fs); diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index dbe31610d19..f77beaf76d2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -6633,7 +6633,7 @@ glusterd_handle_snap_limit (dict_t *dict, dict_t *rsp_dict) glusterd_conf_t *priv = NULL; uint64_t effective_max_limit = 0; int64_t volcount = 0; - int64_t i = 0; + int i = 0; char *volname = NULL; char key[PATH_MAX] = {0, }; glusterd_volinfo_t *volinfo = NULL; @@ -6660,7 +6660,7 @@ glusterd_handle_snap_limit (dict_t *dict, dict_t *rsp_dict) } for (i = 1; i <= volcount; i++) { - snprintf (key, sizeof (key), "volname%ld", i); + snprintf (key, sizeof (key), "volname%d", i); ret = dict_get_str (dict, key, &volname); if (ret) { gf_log (this->name, GF_LOG_ERROR, "failed to get the " diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 97031e82733..1404b148bd5 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -289,7 +289,7 @@ fuse_invalidate_entry (xlator_t *this, uint64_t fuse_ino) dentry->name, uuid_utoa (dentry->parent->gfid)); } else { - fuse_log_eh (this, "Invalidated entry %s(nodeid: %ld)", + fuse_log_eh (this, "Invalidated entry %s(nodeid: %" PRIu64 ")", dentry->name, fnieo->parent); } } @@ -341,13 +341,14 @@ fuse_invalidate_inode(xlator_t *this, uint64_t fuse_ino) close(priv->fd); } - gf_log("glusterfs-fuse", GF_LOG_TRACE, "INVALIDATE inode: %lu", fuse_ino); + gf_log ("glusterfs-fuse", GF_LOG_TRACE, "INVALIDATE inode: %" PRIu64, + fuse_ino); if (inode) { - fuse_log_eh (this, "Invalidated inode %lu (gfid: %s)", + fuse_log_eh (this, "Invalidated inode %" PRIu64 " (gfid: %s)", fuse_ino, uuid_utoa (inode->gfid)); } else { - fuse_log_eh (this, "Invalidated inode %lu ", fuse_ino); + fuse_log_eh (this, "Invalidated inode %" PRIu64, fuse_ino); } if (inode) diff --git a/xlators/storage/bd/src/bd-helper.c b/xlators/storage/bd/src/bd-helper.c index d598e5755c6..1b1c35bad51 100644 --- a/xlators/storage/bd/src/bd-helper.c +++ b/xlators/storage/bd/src/bd-helper.c @@ -444,7 +444,7 @@ bd_create (uuid_t uuid, uint64_t size, char *type, bd_priv_t *priv) } int32_t -bd_resize (bd_priv_t *priv, uuid_t uuid, off_t size) +bd_resize (bd_priv_t *priv, uuid_t uuid, size_t size) { uint64_t new_size = 0; runner_t runner = {0, }; @@ -481,8 +481,9 @@ bd_resize (bd_priv_t *priv, uuid_t uuid, off_t size) new_size = lvm_lv_get_size (lv); if (new_size != size) { - gf_log (THIS->name, GF_LOG_WARNING, "resized LV size %ld does " - "not match requested size %ld", new_size, size); + gf_log (THIS->name, GF_LOG_WARNING, + "resized LV size %" PRIu64 " does " + "not match requested size %zd", new_size, size); ret = EIO; } @@ -515,7 +516,7 @@ bd_get_default_extent (bd_priv_t *priv) * Adjusts the user specified size to VG specific extent size */ uint64_t -bd_adjust_size (bd_priv_t *priv, uint64_t size) +bd_adjust_size (bd_priv_t *priv, size_t size) { uint64_t extent = 0; uint64_t nr_ex = 0; @@ -966,7 +967,7 @@ skip: int bd_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, off_t len, struct iatt *prebuf, + off_t offset, size_t len, struct iatt *prebuf, struct iatt *postbuf) { int ret = -1; @@ -996,7 +997,7 @@ bd_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, #endif if (ret) { gf_log(this->name, GF_LOG_ERROR, - "zerofill failed on fd %d length %ld %s", + "zerofill failed on fd %d length %zu %s", bd_fd->fd, len, strerror (ret)); goto out; } diff --git a/xlators/storage/bd/src/bd.c b/xlators/storage/bd/src/bd.c index 750b009430a..41fbab26972 100644 --- a/xlators/storage/bd/src/bd.c +++ b/xlators/storage/bd/src/bd.c @@ -1792,10 +1792,11 @@ __bd_pwritev (int fd, struct iovec *vector, int count, off_t offset, retval = pwritev (fd, vector, count, offset); if (retval == -1) { + int64_t off = offset; gf_log (THIS->name, GF_LOG_WARNING, - "base %p, length %ld, offset %ld, message %s", + "base %p, length %zd, offset %" PRId64 ", message %s", vector[index].iov_base, vector[index].iov_len, - internal_offset, strerror (errno)); + off, strerror (errno)); retval = -errno; goto err; } diff --git a/xlators/storage/bd/src/bd.h b/xlators/storage/bd/src/bd.h index 62add16cdf4..3491349f2e4 100644 --- a/xlators/storage/bd/src/bd.h +++ b/xlators/storage/bd/src/bd.h @@ -152,9 +152,9 @@ char *page_aligned_alloc (size_t size, char **aligned_buf); int bd_validate_bd_xattr (xlator_t *this, char *bd, char **type, uint64_t *lv_size, uuid_t uuid); uint64_t bd_get_default_extent (bd_priv_t *priv); -uint64_t bd_adjust_size (bd_priv_t *priv, uint64_t size); +uint64_t bd_adjust_size (bd_priv_t *priv, size_t size); int bd_create (uuid_t uuid, uint64_t size, char *type, bd_priv_t *priv); -int bd_resize (bd_priv_t *priv, uuid_t uuid, off_t size); +int bd_resize (bd_priv_t *priv, uuid_t uuid, size_t size); int bd_delete_lv (bd_priv_t *priv, const char *lv_name, int *op_errno); int bd_snapshot_create (bd_local_t *local, bd_priv_t *priv); int bd_clone (bd_local_t *local, bd_priv_t *priv); @@ -167,7 +167,7 @@ int bd_clone (bd_local_t *local, bd_priv_t *priv); int bd_merge (bd_priv_t *priv, uuid_t gfid); int bd_get_origin (bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict); int bd_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, off_t len, struct iatt *prebuf, + off_t offset, size_t len, struct iatt *prebuf, struct iatt *postbuf); #endif |