aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libaio/harness/cases/6.t
diff options
context:
space:
mode:
authorjchesterfield@dhcp92.uk.xensource.com <jchesterfield@dhcp92.uk.xensource.com>2006-07-13 10:13:26 +0100
committerjchesterfield@dhcp92.uk.xensource.com <jchesterfield@dhcp92.uk.xensource.com>2006-07-13 10:13:26 +0100
commit0da81aa1d4a70baefa42b4e5ff1bbf670abc2711 (patch)
treebb0c9f29e962352c1e9949f5e10699847fb2d652 /tools/libaio/harness/cases/6.t
parent0929bd9fc08ffc28978dad3208422948adb46811 (diff)
downloadxen-0da81aa1d4a70baefa42b4e5ff1bbf670abc2711.tar.gz
xen-0da81aa1d4a70baefa42b4e5ff1bbf670abc2711.tar.bz2
xen-0da81aa1d4a70baefa42b4e5ff1bbf670abc2711.zip
Added blktap support. Includes kernel driver (enabled as CONFIG_XEN_BLKDEV_TAP=y) and userspace tools. The userspace deamon (blktapctrl) is enabled by default when xend is activated. For further information on using and configuring blktap see tools/blktap/README.
Diffstat (limited to 'tools/libaio/harness/cases/6.t')
-rw-r--r--tools/libaio/harness/cases/6.t57
1 files changed, 57 insertions, 0 deletions
diff --git a/tools/libaio/harness/cases/6.t b/tools/libaio/harness/cases/6.t
new file mode 100644
index 0000000000..cea4b01c96
--- /dev/null
+++ b/tools/libaio/harness/cases/6.t
@@ -0,0 +1,57 @@
+/* 6.t
+- huge reads (pinned pages) (6.t)
+- huge writes (6.t)
+*/
+#include "aio_setup.h"
+#include <sys/mman.h>
+
+long getmemsize(void)
+{
+ FILE *f = fopen("/proc/meminfo", "r");
+ long size;
+ int gotit = 0;
+ char str[256];
+
+ assert(f != NULL);
+ while (NULL != fgets(str, 255, f)) {
+ str[255] = 0;
+ if (0 == memcmp(str, "MemTotal:", 9)) {
+ if (1 == sscanf(str + 9, "%ld", &size)) {
+ gotit = 1;
+ break;
+ }
+ }
+ }
+ fclose(f);
+
+ assert(gotit != 0);
+ return size;
+}
+
+int test_main(void)
+{
+ char *buf;
+ int rwfd;
+ int status = 0, res;
+ long size;
+
+ size = getmemsize();
+ printf("size = %ld\n", size);
+ assert(size >= (16 * 1024));
+ if (size > (768 * 1024))
+ size = 768 * 1024;
+ size *= 1024;
+
+ rwfd = open("testdir/rwfile", O_RDWR); assert(rwfd != -1);
+ res = ftruncate(rwfd, 0); assert(res == 0);
+ buf = malloc(size); assert(buf != NULL);
+
+ //memset(buf, 0, size);
+ status |= attempt_rw(rwfd, buf, size, 0, WRITE, size);
+ status |= attempt_rw(rwfd, buf, size, 0, READ, size);
+
+ //res = ftruncate(rwfd, 0); assert(res == 0);
+
+ return status;
+}
+