kvm tools: Fix print format warnings

This should fix following warnings

 builtin-stat.c:93:3: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type '__u64' [-Wformat]
 builtin-run.c:188:4: warning: format '%Lu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' [-Wformat]
 builtin-run.c:554:3: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'u64' [-Wformat]
 builtin-run.c:554:3: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'u64' [-Wformat]
 builtin-run.c:645:3: warning: format '%Lu' expects argument of type 'long long unsigned int', but argument 4 has type 'u64' [-Wformat]
 disk/core.c:330:4: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type '__dev_t' [-Wformat]
 disk/core.c:330:4: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__dev_t' [-Wformat]
 disk/core.c:330:4: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__ino64_t' [-Wformat]
 mmio.c:134:5: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'u64' [-Wformat]
 util/util.c:101:7: warning: format '%lld' expects argument of type 'long long int', but argument 3 has type 'u64' [-Wformat]
 util/util.c:113:7: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'u64' [-Wformat]
 hw/pci-shmem.c:339:3: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'u64' [-Wformat]
 hw/pci-shmem.c:340:3: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'u64' [-Wformat]

as observed when compiling on mips64.

Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Andreas Herrmann
2014-05-28 22:08:45 +02:00
committed by Will Deacon
parent 81404cdb95
commit 69f50425bd
6 changed files with 20 additions and 12 deletions

View File

@@ -184,8 +184,8 @@ panic_kvm:
current_kvm_cpu->kvm_run->exit_reason,
kvm_exit_reasons[current_kvm_cpu->kvm_run->exit_reason]);
if (current_kvm_cpu->kvm_run->exit_reason == KVM_EXIT_UNKNOWN)
fprintf(stderr, "KVM exit code: 0x%Lu\n",
current_kvm_cpu->kvm_run->hw.hardware_exit_reason);
fprintf(stderr, "KVM exit code: 0x%llu\n",
(unsigned long long)current_kvm_cpu->kvm_run->hw.hardware_exit_reason);
kvm_cpu__set_debug_fd(STDOUT_FILENO);
kvm_cpu__show_registers(current_kvm_cpu);
@@ -551,7 +551,9 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
kvm->cfg.ram_size = get_ram_size(kvm->cfg.nrcpus);
if (kvm->cfg.ram_size > host_ram_size())
pr_warning("Guest memory size %lluMB exceeds host physical RAM size %lluMB", kvm->cfg.ram_size, host_ram_size());
pr_warning("Guest memory size %lluMB exceeds host physical RAM size %lluMB",
(unsigned long long)kvm->cfg.ram_size,
(unsigned long long)host_ram_size());
kvm->cfg.ram_size <<= MB_SHIFT;
@@ -639,7 +641,9 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
kvm->cfg.real_cmdline = real_cmdline;
printf(" # %s run -k %s -m %Lu -c %d --name %s\n", KVM_BINARY_NAME,
kvm->cfg.kernel_filename, kvm->cfg.ram_size / 1024 / 1024, kvm->cfg.nrcpus, kvm->cfg.guest_name);
kvm->cfg.kernel_filename,
(unsigned long long)kvm->cfg.ram_size / 1024 / 1024,
kvm->cfg.nrcpus, kvm->cfg.guest_name);
if (init_list__init(kvm) < 0)
die ("Initialisation failed");

View File

@@ -90,7 +90,7 @@ static int do_memstat(const char *name, int sock)
printf("The total amount of memory available (in bytes):");
break;
}
printf("%llu\n", stats[i].val);
printf("%llu\n", (unsigned long long)stats[i].val);
}
printf("\n");

View File

@@ -327,7 +327,9 @@ ssize_t disk_image__get_serial(struct disk_image *disk, void *buffer, ssize_t *l
return r;
*len = snprintf(buffer, *len, "%llu%llu%llu",
(u64)st.st_dev, (u64)st.st_rdev, (u64)st.st_ino);
(unsigned long long)st.st_dev,
(unsigned long long)st.st_rdev,
(unsigned long long)st.st_ino);
return *len;
}

View File

@@ -336,8 +336,9 @@ int shmem_parser(const struct option *opt, const char *arg, int unset)
strcpy(handle, default_handle);
}
if (verbose) {
pr_info("shmem: phys_addr = %llx", phys_addr);
pr_info("shmem: size = %llx", size);
pr_info("shmem: phys_addr = %llx",
(unsigned long long)phys_addr);
pr_info("shmem: size = %llx", (unsigned long long)size);
pr_info("shmem: handle = %s", handle);
pr_info("shmem: create = %d", create);
}

5
mmio.c
View File

@@ -131,8 +131,9 @@ bool kvm__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data, u32 len, u
mmio->mmio_fn(vcpu, phys_addr, data, len, is_write, mmio->ptr);
else {
if (vcpu->kvm->cfg.mmio_debug)
fprintf(stderr, "Warning: Ignoring MMIO %s at %016llx (length %u)\n",
to_direction(is_write), phys_addr, len);
fprintf(stderr, "Warning: Ignoring MMIO %s at %016llx (length %u)\n",
to_direction(is_write),
(unsigned long long)phys_addr, len);
}
br_read_unlock();

View File

@@ -98,7 +98,7 @@ void *mmap_hugetlbfs(struct kvm *kvm, const char *htlbfs_path, u64 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",
blk_size, size);
blk_size, (unsigned long long)size);
}
kvm->ram_pagesize = blk_size;
@@ -110,7 +110,7 @@ void *mmap_hugetlbfs(struct kvm *kvm, const char *htlbfs_path, u64 size)
unlink(mpath);
if (ftruncate(fd, size) < 0)
die("Can't ftruncate for mem mapping size %lld\n",
size);
(unsigned long long)size);
addr = mmap(NULL, size, PROT_RW, MAP_PRIVATE, fd, 0);
close(fd);