diff options
author | uqs <uqs@FreeBSD.org> | 2011-01-23 11:08:28 +0000 |
---|---|---|
committer | uqs <uqs@FreeBSD.org> | 2011-01-23 11:08:28 +0000 |
commit | 7fdf187c116172ba5c8238926c41445a02f3a4ad (patch) | |
tree | affb155452e52759603cd28ea92e941e8e5ab8a0 /lib/libkvm/kvm_amd64.c | |
parent | 72b8fc74b4eb02687ea1cfa8837baa1fe5f697ec (diff) | |
download | FreeBSD-src-7fdf187c116172ba5c8238926c41445a02f3a4ad.zip FreeBSD-src-7fdf187c116172ba5c8238926c41445a02f3a4ad.tar.gz |
libkvm code janitoring
- make WARNS=6 clean for archs w/o strict alignment requirments
- add const, ANSIfy, remove unused vars, cast types for comparison
- thanks to differing definitions of VM_MIN_ADDRESS across our archs, we
need to trick the compiler to not complain about signedness. We could
either fix VM_MIN_ADDRESS to always be a simple integer or make the
check conditional on $ARCH.
Closes PRs: kern/42386, kern/83364
Reviewed by: bde
Diffstat (limited to 'lib/libkvm/kvm_amd64.c')
-rw-r--r-- | lib/libkvm/kvm_amd64.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c index 36b353b..65d697c 100644 --- a/lib/libkvm/kvm_amd64.c +++ b/lib/libkvm/kvm_amd64.c @@ -147,7 +147,7 @@ _kvm_freevtop(kvm_t *kd) int _kvm_initvtop(kvm_t *kd) { - struct nlist nlist[2]; + struct nlist nl[2]; u_long pa; u_long kernbase; pml4_entry_t *PML4; @@ -176,23 +176,23 @@ _kvm_initvtop(kvm_t *kd) return (-1); } - nlist[0].n_name = "kernbase"; - nlist[1].n_name = 0; + nl[0].n_name = "kernbase"; + nl[1].n_name = 0; - if (kvm_nlist(kd, nlist) != 0) { + if (kvm_nlist(kd, nl) != 0) { _kvm_err(kd, kd->program, "bad namelist - no kernbase"); return (-1); } - kernbase = nlist[0].n_value; + kernbase = nl[0].n_value; - nlist[0].n_name = "KPML4phys"; - nlist[1].n_name = 0; + nl[0].n_name = "KPML4phys"; + nl[1].n_name = 0; - if (kvm_nlist(kd, nlist) != 0) { + if (kvm_nlist(kd, nl) != 0) { _kvm_err(kd, kd->program, "bad namelist - no KPML4phys"); return (-1); } - if (kvm_read(kd, (nlist[0].n_value - kernbase), &pa, sizeof(pa)) != + if (kvm_read(kd, (nl[0].n_value - kernbase), &pa, sizeof(pa)) != sizeof(pa)) { _kvm_err(kd, kd->program, "cannot read KPML4phys"); return (-1); @@ -222,7 +222,6 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa) u_long pdpeindex; u_long pdeindex; u_long pteindex; - int i; u_long a; off_t ofs; size_t s; |