[PATCH] KVM: API versioning
authorAvi Kivity <avi@qumranet.com>
Fri, 22 Dec 2006 09:06:02 +0000 (01:06 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 22 Dec 2006 16:55:46 +0000 (08:55 -0800)
Add compile-time and run-time API versioning.

Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/kvm/kvm_main.c
include/linux/kvm.h

index bc2e6c19f85521a9459c1f3c12cdbbe8dc79c1e1..9f24f22e4cb2f734caeb6aa51974a755b61cd0d6 100644 (file)
@@ -1603,6 +1603,9 @@ static long kvm_dev_ioctl(struct file *filp,
        int r = -EINVAL;
 
        switch (ioctl) {
+       case KVM_GET_API_VERSION:
+               r = KVM_API_VERSION;
+               break;
        case KVM_CREATE_VCPU: {
                r = kvm_dev_ioctl_create_vcpu(kvm, arg);
                if (r)
index 5bb2c3c585c1fbd3b878ca44da7f7138c8cd5059..28fdce1ac1db3e6c4d3db845989ec5f502ad25a3 100644 (file)
@@ -11,6 +11,8 @@
 #include <asm/types.h>
 #include <linux/ioctl.h>
 
+#define KVM_API_VERSION 1
+
 /*
  * Architectural interrupt line count, and the size of the bitmap needed
  * to hold them.
@@ -209,6 +211,7 @@ struct kvm_dirty_log {
 
 #define KVMIO 0xAE
 
+#define KVM_GET_API_VERSION       _IO(KVMIO, 1)
 #define KVM_RUN                   _IOWR(KVMIO, 2, struct kvm_run)
 #define KVM_GET_REGS              _IOWR(KVMIO, 3, struct kvm_regs)
 #define KVM_SET_REGS              _IOW(KVMIO, 4, struct kvm_regs)