diff options
author | Avi Kivity <avi@redhat.com> | 2008-10-10 20:30:15 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-10-10 22:21:22 +0200 |
commit | 5b1d1abc65667e6fc57fac06f8e3b75c398e28dc (patch) | |
tree | 2ac6834233571d966537e2b6eeb0acc39bf9a086 | |
parent | 8ff212e562e1d50a0c3aef18719166ddaeeea0c4 (diff) |
kvm: libkvm: change full memory logging to use the per-slot refcounting api
this allows full memory logging (for migration) and partial memory logging
(for vga tracking) to coexist.
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | libkvm/libkvm.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c index a7cb2a91..444b97f0 100644 --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -202,15 +202,15 @@ static int kvm_dirty_pages_log_change(kvm_context_t kvm, } static int kvm_dirty_pages_log_change_all(kvm_context_t kvm, - unsigned flags, - unsigned mask) + int (*change)(kvm_context_t kvm, + uint64_t start, + uint64_t len)) { int i, r; for (i=r=0; i<KVM_MAX_NUM_MEM_REGIONS && r==0; i++) { if (slots[i].len) - r = kvm_dirty_pages_log_change(kvm, slots[i].phys_addr, - flags, mask); + r = change(kvm, slots[i].phys_addr, slots[i].len); } return r; } @@ -262,8 +262,8 @@ int kvm_dirty_pages_log_enable_all(kvm_context_t kvm) if (kvm->dirty_pages_log_all) return 0; kvm->dirty_pages_log_all = 1; - return kvm_dirty_pages_log_change_all(kvm, KVM_MEM_LOG_DIRTY_PAGES, - KVM_MEM_LOG_DIRTY_PAGES); + return kvm_dirty_pages_log_change_all(kvm, + kvm_dirty_pages_log_enable_slot); } /** @@ -275,7 +275,8 @@ int kvm_dirty_pages_log_reset(kvm_context_t kvm) if (!kvm->dirty_pages_log_all) return 0; kvm->dirty_pages_log_all = 0; - return kvm_dirty_pages_log_change_all(kvm, 0, KVM_MEM_LOG_DIRTY_PAGES); + return kvm_dirty_pages_log_change_all(kvm, + kvm_dirty_pages_log_disable_slot); } |