From: Matt Evans <matt@ozlabs.org>
To: David Evensky <evensky@dancer.ca.sandia.gov>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, penberg@kernel.org
Subject: Re: [PATCH V3 1/2] kvm tools: Add ability to map guest RAM from hugetlbfs
Date: Wed, 14 Dec 2011 12:45:52 +1100 [thread overview]
Message-ID: <4EE7FFD0.10809@ozlabs.org> (raw)
In-Reply-To: <20111214000316.GE7984@dancer.ca.sandia.gov>
On 14/12/11 11:03, David Evensky wrote:
>
>
> On an x86 32bit system (and using the 32bit CodeSourcery toolchain on a x86_64 system) I get:
>
> evensky@machine:~/.../linux-kvm/tools/kvm$ make
> CC util/util.o
> util/util.c: In function 'mmap_hugetlbfs':
> util/util.c:93:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
> util/util.c:99:7: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'int' [-Werror=format]
> cc1: all warnings being treated as errors
>
> make: *** [util/util.o] Error 1
Hi David,
Argh! I didn't catch this as it compiles fine on my x86_64 box (with 64bit
toolchain) >:( So, struct statfs's f_type and f_blocks are __SWORD_TYPE which is
either an int or a long (if on 64bit).... so identical to if it were simply a
long, nice.
Pekka, a re-jiggle fix attached.
Thanks,
Matt
---
From: Matt Evans <matt@ozlabs.org>
Date: Wed, 14 Dec 2011 12:10:03 +1100
Subject: [PATCH] kvm tools: Fix build of util.c on 32bit machines
commit 378ee7e6dd301347c6bf2c740cb1fb40174bcb8b broke the -Werror build
on 32bit targets due to some variable typing in struct statfs.
Fixes the build.
Signed-off-by: Matt Evans <matt@ozlabs.org>
---
tools/kvm/util/util.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/kvm/util/util.c b/tools/kvm/util/util.c
index ad5418e..00f7315 100644
--- a/tools/kvm/util/util.c
+++ b/tools/kvm/util/util.c
@@ -86,17 +86,19 @@ void *mmap_hugetlbfs(const char *htlbfs_path, u64 size)
int fd;
struct statfs sfs;
void *addr;
+ unsigned long blk_size;
if (statfs(htlbfs_path, &sfs) < 0)
die("Can't stat %s\n", htlbfs_path);
- if (sfs.f_type != HUGETLBFS_MAGIC) {
+ if ((unsigned int)sfs.f_type != HUGETLBFS_MAGIC) {
die("%s is not hugetlbfs!\n", htlbfs_path);
}
- if (sfs.f_bsize == 0 || (unsigned long)sfs.f_bsize > size) {
+ blk_size = (unsigned long)sfs.f_bsize;
+ if (sfs.f_bsize == 0 || blk_size > size) {
die("Can't use hugetlbfs pagesize %ld for mem size %lld\n",
- sfs.f_bsize, size);
+ blk_size, size);
}
snprintf(mpath, PATH_MAX, "%s/kvmtoolXXXXXX", htlbfs_path);
--
1.7.0.4
next prev parent reply other threads:[~2011-12-14 1:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 6:21 [PATCH V3 0/2] kvm tools: Prepare kvmtool for another architecture Matt Evans
2011-12-13 6:21 ` [PATCH V3 1/2] kvm tools: Add ability to map guest RAM from hugetlbfs Matt Evans
2011-12-14 0:03 ` David Evensky
2011-12-14 1:45 ` Matt Evans [this message]
2011-12-13 6:21 ` [PATCH V3 2/2] kvm tools: Create arch-specific kvm_cpu__emulate_{mm}io() Matt Evans
2011-12-23 12:58 ` Alexander Graf
2011-12-23 13:26 ` Matt Evans
2011-12-23 13:39 ` Alexander Graf
2012-01-06 5:32 ` Matt Evans
2012-01-09 13:41 ` Alexander Graf
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=4EE7FFD0.10809@ozlabs.org \
--to=matt@ozlabs.org \
--cc=evensky@dancer.ca.sandia.gov \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=penberg@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).