[tip:tools/kvm] kvm tools: Add kvm__has_cap() to check whether a cap is available on the host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  42efb1abf4ebebeedd14af34c073e673923e2898
Gitweb:     http://git.kernel.org/tip/42efb1abf4ebebeedd14af34c073e673923e2898
Author:     Sasha Levin <levinsasha928@xxxxxxxxx>
AuthorDate: Wed, 14 Dec 2011 08:37:25 +0200
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Wed, 14 Dec 2011 21:29:50 +0200

kvm tools: Add kvm__has_cap() to check whether a cap is available on the host

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/include/kvm/kvm.h |    2 ++
 tools/kvm/kvm.c             |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h
index 0bec7a9..35bb400 100644
--- a/tools/kvm/include/kvm/kvm.h
+++ b/tools/kvm/include/kvm/kvm.h
@@ -81,4 +81,6 @@ static inline void *guest_flat_to_host(struct kvm *kvm, unsigned long offset)
 	return kvm->ram_start + offset;
 }
 
+bool kvm__has_cap(struct kvm *kvm, u32 cap);
+
 #endif /* KVM__KVM_H */
diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index 3fb46f6..9583ab2 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -520,3 +520,8 @@ void kvm__notify_paused(void)
 	mutex_lock(&pause_lock);
 	mutex_unlock(&pause_lock);
 }
+
+bool kvm__has_cap(struct kvm *kvm, u32 cap)
+{
+	return ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, cap) == 0;
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux