提交 0b76e20b 编写于 作者: A Avi Kivity 提交者: Linus Torvalds

[PATCH] KVM: API versioning

Add compile-time and run-time API versioning.
Signed-off-by: NAvi Kivity <avi@qumranet.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 0f8e3d36
...@@ -1603,6 +1603,9 @@ static long kvm_dev_ioctl(struct file *filp, ...@@ -1603,6 +1603,9 @@ static long kvm_dev_ioctl(struct file *filp,
int r = -EINVAL; int r = -EINVAL;
switch (ioctl) { switch (ioctl) {
case KVM_GET_API_VERSION:
r = KVM_API_VERSION;
break;
case KVM_CREATE_VCPU: { case KVM_CREATE_VCPU: {
r = kvm_dev_ioctl_create_vcpu(kvm, arg); r = kvm_dev_ioctl_create_vcpu(kvm, arg);
if (r) if (r)
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <asm/types.h> #include <asm/types.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
#define KVM_API_VERSION 1
/* /*
* Architectural interrupt line count, and the size of the bitmap needed * Architectural interrupt line count, and the size of the bitmap needed
* to hold them. * to hold them.
...@@ -209,6 +211,7 @@ struct kvm_dirty_log { ...@@ -209,6 +211,7 @@ struct kvm_dirty_log {
#define KVMIO 0xAE #define KVMIO 0xAE
#define KVM_GET_API_VERSION _IO(KVMIO, 1)
#define KVM_RUN _IOWR(KVMIO, 2, struct kvm_run) #define KVM_RUN _IOWR(KVMIO, 2, struct kvm_run)
#define KVM_GET_REGS _IOWR(KVMIO, 3, struct kvm_regs) #define KVM_GET_REGS _IOWR(KVMIO, 3, struct kvm_regs)
#define KVM_SET_REGS _IOW(KVMIO, 4, struct kvm_regs) #define KVM_SET_REGS _IOW(KVMIO, 4, struct kvm_regs)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册