summaryrefslogtreecommitdiff
path: root/nbd.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2008-07-03 11:47:46 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2008-07-03 11:47:46 +0000
commit1d0fa83ebfd6ce93dda1ae3092f3686482756a68 (patch)
tree0f24cf44bf12b90bda404fb42cde3ab0a58acd19 /nbd.c
parentbb32d988039dd66190afb41d97be002030403f8c (diff)
downloadqemu-1d0fa83ebfd6ce93dda1ae3092f3686482756a68.tar.gz
qemu-1d0fa83ebfd6ce93dda1ae3092f3686482756a68.tar.bz2
qemu-1d0fa83ebfd6ce93dda1ae3092f3686482756a68.zip
Add a parameter to disable host cache, by Laurent Vivier.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4836 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'nbd.c')
-rw-r--r--nbd.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/nbd.c b/nbd.c
index 9f8fda9247..49ee7dfad6 100644
--- a/nbd.c
+++ b/nbd.c
@@ -404,13 +404,9 @@ int nbd_client(int fd, int csock)
return ret;
}
-int nbd_trip(BlockDriverState *bs, int csock, off_t size, uint64_t dev_offset, off_t *offset, bool readonly)
+int nbd_trip(BlockDriverState *bs, int csock, off_t size, uint64_t dev_offset,
+ off_t *offset, bool readonly, uint8_t *data, int data_size)
{
-#ifndef _REENTRANT
- static uint8_t data[1024 * 1024]; // keep this off of the stack
-#else
- uint8_t data[1024 * 1024];
-#endif
uint8_t buf[4 + 4 + 8 + 8 + 4];
uint32_t magic;
uint32_t type;
@@ -449,9 +445,9 @@ int nbd_trip(BlockDriverState *bs, int csock, off_t size, uint64_t dev_offset, o
return -1;
}
- if (len > sizeof(data)) {
- LOG("len (%u) is larger than max len (%lu)",
- len, (unsigned long)sizeof(data));
+ if (len > data_size) {
+ LOG("len (%u) is larger than max len (%u)",
+ len, data_size);
errno = EINVAL;
return -1;
}