summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2014-09-06 06:20:41 +0200
committerVijay Bellur <vbellur@redhat.com>2014-09-18 11:06:53 -0700
commit474251b1e6a827982f42c986c00a4a8a186ee1dc (patch)
treef55d12315bbc70c90917d8da7b8f58f2ee36bb89 /xlators
parentacc0b3f93e74e914ee345e9e89619c8411596bdf (diff)
Do not assume sizeof(size_t)
This fixes an assumption that sizeof(size_t) == sizeof(uint64_t), which is not guaranteed. At least on NetBSD/i386, size_t is 32 bit long. Caught by tests/basics/file-snapshot.t This is a backport of Ib7620a2ffe8758521886af37bc280101a040d860 BUG: 1138897 Change-Id: Ie0b80ee9ddbcccaf9fd4f5d28d80fcd080b0ed40 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/8631 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/qemu-block/src/qemu-block.c2
-rw-r--r--xlators/features/qemu-block/src/qemu-block.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/xlators/features/qemu-block/src/qemu-block.c b/xlators/features/qemu-block/src/qemu-block.c
index 48bbf314048..768866f6429 100644
--- a/xlators/features/qemu-block/src/qemu-block.c
+++ b/xlators/features/qemu-block/src/qemu-block.c
@@ -316,7 +316,7 @@ qb_setxattr_format (call_frame_t *frame, xlator_t *this, call_stub_t *stub,
qb_local->stub = stub;
qb_local->inode = inode_ref (inode);
- snprintf(qb_local->fmt, QB_XATTR_VAL_MAX, "%s:%lu", qb_inode->fmt,
+ snprintf(qb_local->fmt, QB_XATTR_VAL_MAX, "%s:%" PRId64, qb_inode->fmt,
qb_inode->size);
qb_coroutine (frame, qb_format_and_resume);
diff --git a/xlators/features/qemu-block/src/qemu-block.h b/xlators/features/qemu-block/src/qemu-block.h
index c95f2799ac6..21cdcec2613 100644
--- a/xlators/features/qemu-block/src/qemu-block.h
+++ b/xlators/features/qemu-block/src/qemu-block.h
@@ -40,7 +40,7 @@
typedef struct qb_inode {
char fmt[QB_XATTR_VAL_MAX]; /* this is only the format, not "format:size" */
- size_t size; /* virtual size in bytes */
+ uint64_t size; /* virtual size in bytes */
BlockDriverState *bs;
int refcnt;
uuid_t backing_gfid;