static int v3_major_num = 0;
static struct v3_guest * guest_map[MAX_VMS] = {[0 ... MAX_VMS - 1] = 0};
-static struct proc_dir_entry *dir;
+static struct proc_dir_entry *dir = 0;
struct class * v3_class = NULL;
static struct cdev ctrl_dev;
case V3_CREATE_GUEST:{
int vm_minor = 0;
struct v3_guest_img user_image;
- struct v3_guest * guest = kmalloc(sizeof(struct v3_guest), GFP_KERNEL);
+ struct v3_guest * guest = palacios_alloc(sizeof(struct v3_guest));
if (IS_ERR(guest)) {
ERROR("Palacios: Error allocating Kernel guest_image\n");
if (vm_minor == -1) {
ERROR("Palacios Error: Too many VMs are currently running\n");
+ palacios_free(guest);
return -EFAULT;
}
if (copy_from_user(&user_image, argp, sizeof(struct v3_guest_img))) {
ERROR("Palacios Error: copy from user error getting guest image...\n");
+ palacios_free(guest);
return -EFAULT;
}
if (IS_ERR(guest->img)) {
ERROR("Palacios Error: Could not allocate space for guest image\n");
+ palacios_free(guest);
return -EFAULT;
}
if (copy_from_user(guest->img, user_image.guest_data, guest->img_size)) {
ERROR("Palacios: Error loading guest data\n");
+ palacios_free(guest);
return -EFAULT;
}
if (create_palacios_vm(guest) == -1) {
ERROR("Palacios: Error creating guest\n");
+ vfree(guest->img);
+ palacios_free(guest);
return -EFAULT;
}
+struct proc_dir_entry *palacios_get_procdir(void)
+{
+ return dir;
+}
+
static int read_guests(char * buf, char ** start, off_t off, int count,
int * eof, void * data)
{