diff options
author | Xiao Guangrong | 2011-11-24 12:04:35 +0100 |
---|---|---|
committer | Avi Kivity | 2011-12-27 10:17:39 +0100 |
commit | 28a37544fb0223eb9805d2567b88f7360edec52a (patch) | |
tree | 83afb64f8448303f9486eb6c87980695611275ab /include/linux/kvm_host.h | |
parent | KVM: introduce kvm_for_each_memslot macro (diff) | |
download | kernel-qcow2-linux-28a37544fb0223eb9805d2567b88f7360edec52a.tar.gz kernel-qcow2-linux-28a37544fb0223eb9805d2567b88f7360edec52a.tar.xz kernel-qcow2-linux-28a37544fb0223eb9805d2567b88f7360edec52a.zip |
KVM: introduce id_to_memslot function
Introduce id_to_memslot to get memslot by slot id
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 392af47a4353..123925cd3ae8 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -333,6 +333,12 @@ static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) || lockdep_is_held(&kvm->slots_lock)); } +static inline struct kvm_memory_slot * +id_to_memslot(struct kvm_memslots *slots, int id) +{ + return &slots->memslots[id]; +} + #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } |