diff options
author | Avi Kivity <avi@qumranet.com> | 2008-02-10 11:19:56 +0200 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-02-10 11:19:56 +0200 |
commit | 9a9aa47816f090924c926f1d41b5aa41b22a90c0 (patch) | |
tree | 50377c12d730c77c93ace28e2bcd898de79e5d76 /virt | |
parent | f1ca151a368192b182a9f9e696e211e18927f040 (diff) | |
parent | 25f666300625d894ebe04bac2b4b3aadb907c861 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a499f50e6676..4da308ef8f9d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1193,38 +1193,38 @@ static struct notifier_block kvm_cpu_notifier = { .priority = 20, /* must be > scheduler priority */ }; -static u64 vm_stat_get(void *_offset) +static int vm_stat_get(void *_offset, u64 *val) { unsigned offset = (long)_offset; - u64 total = 0; struct kvm *kvm; + *val = 0; spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) - total += *(u32 *)((void *)kvm + offset); + *val += *(u32 *)((void *)kvm + offset); spin_unlock(&kvm_lock); - return total; + return 0; } DEFINE_SIMPLE_ATTRIBUTE(vm_stat_fops, vm_stat_get, NULL, "%llu\n"); -static u64 vcpu_stat_get(void *_offset) +static int vcpu_stat_get(void *_offset, u64 *val) { unsigned offset = (long)_offset; - u64 total = 0; struct kvm *kvm; struct kvm_vcpu *vcpu; int i; + *val = 0; spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) for (i = 0; i < KVM_MAX_VCPUS; ++i) { vcpu = kvm->vcpus[i]; if (vcpu) - total += *(u32 *)((void *)vcpu + offset); + *val += *(u32 *)((void *)vcpu + offset); } spin_unlock(&kvm_lock); - return total; + return 0; } DEFINE_SIMPLE_ATTRIBUTE(vcpu_stat_fops, vcpu_stat_get, NULL, "%llu\n"); |