From: Jan Schmidt <list.btrfs@jan-o-sch.net>
To: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Cc: kylegates@hotmail.com
Subject: [PATCH] Btrfs progs: fix compiler cast warnings
Date: Wed, 18 Jan 2012 11:00:03 +0100 [thread overview]
Message-ID: <1326880803-15464-1-git-send-email-list.btrfs@jan-o-sch.net> (raw)
In-Reply-To: <COL113-W26B06C5519CFEB29075D36B0800@phx.gbl>
With -m32, we need two casts to get from a pointer to u64. This fixes:
- btrfs_cmds.c:1138: error: cast from pointer to integer of different size
- btrfs_cmds.c:1242: error: cast from pointer to integer of different size
With -m64, sizeof gives unsigned long, so we need a cast as well to fix:
- extent-tree.c:1071: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
---
btrfs_cmds.c | 4 ++--
extent-tree.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index b59e9cb..d6ae5f0 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -1135,7 +1135,7 @@ static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend)
ipa.inum = inum;
ipa.size = 4096;
- ipa.fspath = (u64)fspath;
+ ipa.fspath = (u64)(long int)fspath;
ret = ioctl(fd, BTRFS_IOC_INO_PATHS, &ipa);
if (ret) {
@@ -1239,7 +1239,7 @@ int do_logical_to_ino(int nargs, char **argv)
loi.logical = atoll(argv[optind]);
loi.size = 4096;
- loi.inodes = (u64)inodes;
+ loi.inodes = (u64)(long int)inodes;
fd = open_file_or_dir(argv[optind+1]);
if (fd < 0) {
diff --git a/extent-tree.c b/extent-tree.c
index 5bed3c2..8cabcc5 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -1067,8 +1067,8 @@ static int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
}
#endif
if (item_size < sizeof(*ei)) {
- printf("Size is %u, needs to be %u, slot %d\n", item_size,
- sizeof(*ei), path->slots[0]);
+ printf("Size is %u, needs to be %lu, slot %d\n", item_size,
+ (unsigned long)sizeof(*ei), path->slots[0]);
btrfs_print_leaf(root, leaf);
return -EINVAL;
}
--
1.7.3.4
prev parent reply other threads:[~2012-01-18 10:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-17 19:17 btrfs-progs compile warnings on x86 Kyle Gates
2012-01-18 10:00 ` Jan Schmidt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326880803-15464-1-git-send-email-list.btrfs@jan-o-sch.net \
--to=list.btrfs@jan-o-sch.net \
--cc=chris.mason@oracle.com \
--cc=kylegates@hotmail.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).