Commit 33e94154 authored by Yaowei Bai's avatar Yaowei Bai Committed by Paolo Bonzini

KVM: kvm_is_visible_gfn can be boolean

This patch makes kvm_is_visible_gfn return bool due to this particular
function only using either one or zero as its return value.

No functional change.
Signed-off-by: default avatarYaowei Bai <baiyaowei@cmss.chinamobile.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 4f52696a
...@@ -641,7 +641,7 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, ...@@ -641,7 +641,7 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn); unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn);
void mark_page_dirty(struct kvm *kvm, gfn_t gfn); void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
......
...@@ -1164,15 +1164,15 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn ...@@ -1164,15 +1164,15 @@ struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn
return __gfn_to_memslot(kvm_vcpu_memslots(vcpu), gfn); return __gfn_to_memslot(kvm_vcpu_memslots(vcpu), gfn);
} }
int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn)
{ {
struct kvm_memory_slot *memslot = gfn_to_memslot(kvm, gfn); struct kvm_memory_slot *memslot = gfn_to_memslot(kvm, gfn);
if (!memslot || memslot->id >= KVM_USER_MEM_SLOTS || if (!memslot || memslot->id >= KVM_USER_MEM_SLOTS ||
memslot->flags & KVM_MEMSLOT_INVALID) memslot->flags & KVM_MEMSLOT_INVALID)
return 0; return false;
return 1; return true;
} }
EXPORT_SYMBOL_GPL(kvm_is_visible_gfn); EXPORT_SYMBOL_GPL(kvm_is_visible_gfn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment