X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fpalacios-vm.c;h=2d1237499256e462efccca4d1e6a75123e8f176c;hb=84ff69d67d79aa9641135b2d120fe800c91797b4;hp=d19e7053d22e81e8b0c2587ba422c7878e2325e1;hpb=5e16adcc49f8c77319004ada0276ccd301c67dd1;p=palacios-OLD.git diff --git a/linux_module/palacios-vm.c b/linux_module/palacios-vm.c index d19e705..2d12374 100644 --- a/linux_module/palacios-vm.c +++ b/linux_module/palacios-vm.c @@ -22,6 +22,7 @@ #include "palacios.h" #include "palacios-vm.h" +#include "linux-exts.h" struct vm_ctrl { @@ -111,17 +112,7 @@ static struct vm_ctrl * get_ctrl(struct v3_guest * guest, unsigned int cmd) { } -#ifdef V3_CONFIG_STREAM -#include "palacios-stream.h" -#endif -#ifdef V3_CONFIG_CONSOLE -#include "palacios-console.h" -#endif - -#ifdef V3_CONFIG_EXT_INSPECTOR -#include "palacios-inspector.h" -#endif #ifdef V3_CONFIG_GRAPHICS_CONSOLE #include "palacios-graphics-console.h" @@ -133,7 +124,7 @@ static struct vm_ctrl * get_ctrl(struct v3_guest * guest, unsigned int cmd) { #endif extern struct class * v3_class; -#define STREAM_NAME_LEN 128 + static long v3_vm_ioctl(struct file * filp, unsigned int ioctl, unsigned long arg) { @@ -150,33 +141,7 @@ static long v3_vm_ioctl(struct file * filp, break; } - case V3_VM_CONSOLE_CONNECT: { -#ifdef V3_CONFIG_CONSOLE - return connect_console(guest); -#else - printk("Console support not available\n"); - return -EFAULT; -#endif - break; - } - case V3_VM_STREAM_CONNECT: { -#ifdef V3_CONFIG_STREAM - void __user * argp = (void __user *)arg; - char path_name[STREAM_NAME_LEN]; - - if (copy_from_user(path_name, argp, STREAM_NAME_LEN)) { - printk("%s(%d): copy from user error...\n", __FILE__, __LINE__); - return -EFAULT; - } - - return open_stream(path_name); -#else - printk("Stream support Not available\n"); - return -EFAULT; -#endif - break; - } case V3_VM_HOST_DEV_CONNECT: { #ifdef V3_CONFIG_HOST_DEVICE @@ -274,6 +239,7 @@ int start_palacios_vm(void * arg) { // allow_signal(SIGKILL); unlock_kernel(); + init_vm_extensions(guest); guest->v3_ctx = v3_create_vm(guest->img, (void *)guest, guest->name); @@ -284,9 +250,8 @@ int start_palacios_vm(void * arg) { } // init linux extensions -#ifdef V3_CONFIG_EXT_INSPECTOR - inspect_vm(guest); -#endif + + printk("Creating VM device: Major %d, Minor %d\n", MAJOR(guest->vm_dev), MINOR(guest->vm_dev)); @@ -301,6 +266,7 @@ int start_palacios_vm(void * arg) { if (err) { printk("Fails to add cdev\n"); + v3_free_vm(guest->v3_ctx); complete(&(guest->start_done)); return -1; } @@ -308,15 +274,7 @@ int start_palacios_vm(void * arg) { if (device_create(v3_class, NULL, guest->vm_dev, guest, "v3-vm%d", MINOR(guest->vm_dev)) == NULL){ printk("Fails to create device\n"); cdev_del(&(guest->cdev)); - complete(&(guest->start_done)); - return -1; - } - - guest->v3_ctx = v3_create_vm(guest->img, (void *)guest, guest->name); - - if (guest->v3_ctx == NULL) { - printk("palacios: failed to create vm\n"); - cdev_del(&(guest->cdev)); + v3_free_vm(guest->v3_ctx); complete(&(guest->start_done)); return -1; } @@ -325,10 +283,6 @@ int start_palacios_vm(void * arg) { printk("palacios: launching vm\n"); - - - - if (v3_start_vm(guest->v3_ctx, 0xffffffff) < 0) { printk("palacios: launch of vm failed\n"); device_destroy(v3_class, guest->vm_dev);