linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* btrfs-progs compile warnings on x86
@ 2012-01-17 19:17 Kyle Gates
  2012-01-18 10:00 ` [PATCH] Btrfs progs: fix compiler cast warnings Jan Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Gates @ 2012-01-17 19:17 UTC (permalink / raw)
  To: linux-btrfs


When compiling btrfs-progs (2011-12-01) from git://git.kernel.org/pub/s=
cm/linux/kernel/git/mason/btrfs-progs.git on 3.2.1-030201-generic #2012=
01121644 SMP Thu Jan 12 21:53:24 UTC 2012 i686 athlon i386 GNU/Linux
I get the following warnings:

ls btrfs_cmds.c
btrfs_cmds.c
gcc -Wp,-MMD,./.btrfs_cmds.o.d,-MT,btrfs_cmds.o -Wall -D_FILE_OFFSET_BI=
TS=3D64 -D_FORTIFY_SOURCE=3D2 -g -O0 -c btrfs_cmds.c
btrfs_cmds.c: In function =E2__ino_to_path_fd=E2:
btrfs_cmds.c:1138:15: warning: cast from pointer to integer of differen=
t size [-Wpointer-to-int-cast]
btrfs_cmds.c: In function =E2do_logical_to_ino=E2:
btrfs_cmds.c:1242:15: warning: cast from pointer to integer of differen=
t size [-Wpointer-to-int-cast]

Thanks,
Kyle
 		 	   		  --
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Btrfs progs: fix compiler cast warnings
  2012-01-17 19:17 btrfs-progs compile warnings on x86 Kyle Gates
@ 2012-01-18 10:00 ` Jan Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Schmidt @ 2012-01-18 10:00 UTC (permalink / raw)
  To: chris.mason, linux-btrfs; +Cc: kylegates

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-18 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17 19:17 btrfs-progs compile warnings on x86 Kyle Gates
2012-01-18 10:00 ` [PATCH] Btrfs progs: fix compiler cast warnings Jan Schmidt

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).