From: Jack Lange Date: Wed, 27 May 2009 22:47:25 +0000 (-0500) Subject: added missing nbd files X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=2693dbc32a15e21af5e648f6a3d98ecd962ac029 added missing nbd files --- diff --git a/misc/network_servers/v3_nbd/iso.cc b/misc/network_servers/v3_nbd/iso.cc new file mode 100644 index 0000000..2ca53fa --- /dev/null +++ b/misc/network_servers/v3_nbd/iso.cc @@ -0,0 +1,62 @@ +/* + * This file is part of the Palacios Virtual Machine Monitor developed + * by the V3VEE Project with funding from the United States National + * Science Foundation and the Department of Energy. + * + * The V3VEE Project is a joint project between Northwestern University + * and the University of New Mexico. You can find out more at + * http://www.v3vee.org + * + * Copyright (c) 2008, Jack Lange + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Author: Jack Lange + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "V3VEE_LICENSE". + */ + +#include "v3_disk.h" +#include "iso.h" + +#include +#include +#include + + +iso_image::iso_image(string & filename) : v3_disk(filename){ + this->f = fopen(filename.c_str(), "w+"); +} + +iso_image::~iso_image() { +} + +off_t iso_image::get_capacity() { + struct stat f_stats; + + stat(this->filename.c_str(), &f_stats); + + return f_stats.st_size; +} + + + +int iso_image::read(unsigned char * buf, unsigned long long offset, int length) { + + return -1; +} + + + +int iso_image::write(unsigned char * buf, unsigned long long offset, int length) { + + return -1; +} + +void iso_image::attach() { +} + + +void iso_image::detach() { +} diff --git a/misc/network_servers/v3_nbd/iso.h b/misc/network_servers/v3_nbd/iso.h new file mode 100644 index 0000000..14d6cd6 --- /dev/null +++ b/misc/network_servers/v3_nbd/iso.h @@ -0,0 +1,44 @@ +/* + * This file is part of the Palacios Virtual Machine Monitor developed + * by the V3VEE Project with funding from the United States National + * Science Foundation and the Department of Energy. + * + * The V3VEE Project is a joint project between Northwestern University + * and the University of New Mexico. You can find out more at + * http://www.v3vee.org + * + * Copyright (c) 2008, Jack Lange + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Author: Jack Lange + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "V3VEE_LICENSE". + */ + +#ifndef __ISO_H__ +#define __ISO_H__ + +#include "v3_disk.h" +#include + +class iso_image : public v3_disk { + + + public: + iso_image(string & filename); + ~iso_image(); + + off_t get_capacity(); + int read(unsigned char * buf, unsigned long long offset, int length); + int write(unsigned char * buf, unsigned long long offset, int length); + + void attach(); + void detach(); + + private: + FILE * f; +}; + +#endif diff --git a/misc/network_servers/v3_nbd/nbd.ini b/misc/network_servers/v3_nbd/nbd.ini new file mode 100644 index 0000000..0eec74c --- /dev/null +++ b/misc/network_servers/v3_nbd/nbd.ini @@ -0,0 +1,8 @@ +logfile: ./nbd.log + +port : 9502 + +disks : puppy-hd puppy-iso + +puppy-iso.file : /opt/vmm-tools/isos/puppy.iso +puppy-iso.type : ISO diff --git a/misc/network_servers/v3_nbd/v3_disk.cc b/misc/network_servers/v3_nbd/v3_disk.cc new file mode 100644 index 0000000..f45fc66 --- /dev/null +++ b/misc/network_servers/v3_nbd/v3_disk.cc @@ -0,0 +1,30 @@ +/* + * This file is part of the Palacios Virtual Machine Monitor developed + * by the V3VEE Project with funding from the United States National + * Science Foundation and the Department of Energy. + * + * The V3VEE Project is a joint project between Northwestern University + * and the University of New Mexico. You can find out more at + * http://www.v3vee.org + * + * Copyright (c) 2008, Jack Lange + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Author: Jack Lange + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "V3VEE_LICENSE". + */ + +#include "v3_disk.h" + +v3_disk::v3_disk(string & filename) { + this->filename = filename; + this->locked = 0; +} + + +v3_disk::~v3_disk() { + +}