Skip to contentSkip to conversation

Add libvdisk, and vdisk_tool

PATCH In review Ben Guthro 2 participants 2 messages Jun 19, 2007

lore
Share & tools
lore

Ben Guthro

author
#0 lore raw

PATCH 4/4 Add libvdisk, and vdisk_tool

[PATCH 4/4] Add libvdisk, and vdisk_tool vdisk-support.patch
provides libvdisk, and vdisk_tool, as described in [PATCH 0/4]

tools/Makefile +1 -0
diff -r 7cad1f06a7f6 tools/Makefile
@@ -17,6 +17,7 @@ SUBDIRS-$(VTPM_TOOLS) += vtpm
 SUBDIRS-$(VTPM_TOOLS) += vtpm
 SUBDIRS-y += xenstat
 SUBDIRS-y += libaio
+SUBDIRS-y += vdisk
 SUBDIRS-y += blktap
 SUBDIRS-y += libfsimage
 SUBDIRS-$(XENFB_TOOLS) += xenfb
tools/vdisk/Makefile new file +62 -0

62 lines not on this page · raw message

tools/vdisk/list.h new file +168 -0

168 lines not on this page · raw message

tools/vdisk/vdisk.h new file +214 -0

214 lines not on this page · raw message

tools/vdisk/vdisk_common.c new file +637 -0

637 lines not on this page · raw message

tools/vdisk/vdisk_tool.c new file +338 -0

338 lines not on this page · raw message

tools/vdisk/vdisk_utils.c new file +435 -0

435 lines not on this page · raw message

tools/vdisk/vdisk_utils.h new file +36 -0
diff -r 7cad1f06a7f6 tools/vdisk/vdisk_utils.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2003-2007, Virtual Iron Software, Inc.
+//
+// Portions have been modified by Virtual Iron Software, Inc.
+// (c) 2007. This file and the modifications can be redistributed and/or
+// modified under the terms and conditions of the GNU General Public
+// License, version 2.1 and not any later version of the GPL, as published
+// by the Free Software Foundation.
+
+#ifndef __VDISK_UTILS
+#define __VDISK_UTILS
+
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "vdisk.h"
+
+
+
+#define vdisk_open(cp, fl, mode) open((cp), (fl), (mode))
+#define vdisk_seek(fp, off, whence) lseek64((fp), (off), (whence))
+
+extern void *vdisk_malloc(size_t sz);
+extern void vdisk_free(void *ptr);
+extern int vdisk_close(int fp);
+extern size_t vdisk_size(int f, size_t *sz);
+extern size_t vdisk_syncio(int fp, char *buf, size_t sz, loff_t off, 
+			   int op, vdisk_syncio_t *syncio);
+extern size_t vdisk_asyncio(vdisk_dev_t *, uint64_t, int, char *, size_t, 
+			    loff_t, void *, void *, int);
+
+
+#endif /* __VDISK_UTILS */
tools/vdisk/vhd.c new file +925 -0

925 lines not on this page · raw message

tools/vdisk/vhd.h new file +107 -0

107 lines not on this page · raw message

tools/vdisk/vhd_footer.h new file +316 -0

71 lines not on this page · raw message

tools/vdisk/vhd_utils.c new file +964 -0

964 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.

#1 lore raw

Hi Ben,

Quoted 1 line · Ben Guthro

diff -r 7cad1f06a7f6 tools/vdisk/vdisk_common.c

...

Quoted 1 line

+ if (vdisk->use_aio) {

...

tools/vdisk/vdisk_common.c line 94

Quoted 8 lines
tools/vdisk/vdisk_common.c new file +8 -0
+               vdisk->ioctx = (io_context_t) REQUEST_ASYNC_FD;   
+               vdisk->aio_fd = io_setup(VDISK_HASH_SZ, &vdisk->ioctx);
+               if (vdisk->aio_fd < 0) {
+                       VIDDBG(0, "io_setup can't get async poll ID (%s). "
+                              " Async IO will not be available\n",
+                               strerror(errno));
+                       vdisk->use_aio = 0;             
+               }

Note that the aio and qcow blktap drivers now use the tapaio wrapper to
poll on aio events, so it'd be nice if this code did the same.

Since the aio code isn't used by qemu, perhaps it'd be better to move
it out of libvdisk and into blktap?

Cheers,
Mark.