@@ -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);