aboutsummaryrefslogtreecommitdiffstats
path: root/tools/blktap
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-12-17 06:27:56 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-12-17 06:27:56 +0000
commitab562bd46c7041d82523322dde38d42494fb37ca (patch)
treed249f5ba799f603f43370f9eccac5b98821762b3 /tools/blktap
parent7e31226c7a62a1b88727b9e718eb11b745de16ab (diff)
downloadxen-ab562bd46c7041d82523322dde38d42494fb37ca.tar.gz
xen-ab562bd46c7041d82523322dde38d42494fb37ca.tar.bz2
xen-ab562bd46c7041d82523322dde38d42494fb37ca.zip
Generic bi-directional map, and related initialisation functions. At the moment
a single map is used to store mappings between sharing handles and disk blocks. This is used to share pages which store data read of the same blocks on (virtual) disk. Note that the map is stored in a shared memory region, as it needs to be accessed by multiple tapdisk processes. This complicates memory allocation (malloc cannot be used), prevents poniters to be stored directly (as the shared memory region might and is mapped at different base address) and finally pthread locks need to be multi-process aware. Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
Diffstat (limited to 'tools/blktap')
-rw-r--r--tools/blktap/drivers/Makefile4
-rw-r--r--tools/blktap/drivers/blktapctrl.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/tools/blktap/drivers/Makefile b/tools/blktap/drivers/Makefile
index 469c3147e6..b7e392b3d8 100644
--- a/tools/blktap/drivers/Makefile
+++ b/tools/blktap/drivers/Makefile
@@ -4,6 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
IBIN = blktapctrl tapdisk
QCOW_UTIL = img2qcow qcow2raw qcow-create
LIBAIO_DIR = ../../libaio/src
+MEMSHR_DIR = ../../memshr
CFLAGS += -Werror
CFLAGS += -Wno-unused
@@ -11,6 +12,7 @@ CFLAGS += -I../lib
CFLAGS += $(CFLAGS_libxenctrl)
CFLAGS += $(CFLAGS_libxenstore)
CFLAGS += -I $(LIBAIO_DIR)
+CFLAGS += -I $(MEMSHR_DIR)
CFLAGS += -D_GNU_SOURCE
ifeq ($(shell . ./check_gcrypt $(CC)),yes)
@@ -21,7 +23,7 @@ CRYPT_LIB := -lcrypto
$(warning === libgcrypt not installed: falling back to libcrypto ===)
endif
-LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) -L../lib -lblktap
+LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) $(MEMSHR_DIR)/libmemshr.a -L../lib -lblktap -lrt -lm
LDFLAGS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz
BLK-OBJS-y := block-aio.o
diff --git a/tools/blktap/drivers/blktapctrl.c b/tools/blktap/drivers/blktapctrl.c
index 21cdfe5239..b5ebfee62e 100644
--- a/tools/blktap/drivers/blktapctrl.c
+++ b/tools/blktap/drivers/blktapctrl.c
@@ -50,6 +50,7 @@
#include <xs.h>
#include <sys/time.h>
#include <syslog.h>
+#include <memshr.h>
#include "blktaplib.h"
#include "blktapctrl.h"
@@ -858,6 +859,8 @@ int main(int argc, char *argv[])
goto open_failed;
}
+ memshr_daemon_initialize();
+
retry:
/* Set up store connection and watch. */
h = xs_daemon_open();