From ab562bd46c7041d82523322dde38d42494fb37ca Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 17 Dec 2009 06:27:56 +0000 Subject: 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 --- tools/blktap/drivers/Makefile | 4 +++- tools/blktap/drivers/blktapctrl.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'tools/blktap') 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 #include #include +#include #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(); -- cgit v1.2.3