2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #include <palacios/vmm.h>
22 #include <devices/sym_swap.h>
23 #include <devices/lnx_virtio.h>
29 struct vm_device * blk_dev;
34 static int swap_init(struct vm_device * dev) {
39 static int swap_deinit(struct vm_device * dev) {
45 static struct vm_device_ops dev_ops = {
47 .deinit = swap_deinit,
55 struct vm_device * v3_create_swap(struct vm_device * virtio_blk) {
56 struct swap_state * swap = NULL;
58 PrintDebug("Creating Swap Device\n");
60 if (virtio_blk == NULL) {
61 PrintError("Swap device requires a virtio block device\n");
65 swap = (struct swap_state *)V3_Malloc(sizeof(struct swap_state));
67 swap->blk_dev = virtio_blk;
69 return v3_create_device("SYM_SWAP", &dev_ops, swap);