[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 20 of 21] blktap3/drivers: Introduce tapdisk makefile



This patch copies from blktap2.5 the makefile that builds tapdisk. Any object
that doesn't seem to be necessary for the basic operation of tapdisk has been
left out. Also, we use a distinct binary name for the blktap3 tapdisk process
(tapdisk3) so that blktap2 and blktap3 can co-exist.

Signed-off-by: Thanos Makatos <thanos.makatos@xxxxxxxxxx>

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -377,3 +377,4 @@
 
 # blktap3
 ^tools/blktap3/tapback/tapback$
+^tools/blktap3/drivers/tapdisk3$
diff --git a/tools/blktap2/drivers/Makefile b/tools/blktap3/drivers/Makefile
copy from tools/blktap2/drivers/Makefile
copy to tools/blktap3/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile
+++ b/tools/blktap3/drivers/Makefile
@@ -1,43 +1,65 @@
 XEN_ROOT=$(CURDIR)/../../..
-BLKTAP_ROOT= ..
 include $(XEN_ROOT)/tools/Rules.mk
 
+BLKTAP_ROOT = ..
+
+SUBDIRS-y :=
+SUBDIRS-y += sring
+
 LIBVHDDIR  = $(BLKTAP_ROOT)/vhd/lib
 
-IBIN       = tapdisk2 td-util tapdisk-client tapdisk-stream tapdisk-diff
-QCOW_UTIL  = img2qcow qcow-create qcow2raw
+# FIXME tapdisk-client tapdisk-stream tapdisk-diff not in blktap2.5
+IBIN = tapdisk3
 LOCK_UTIL  = lock-util
 INST_DIR   = $(SBINDIR)
 
-CFLAGS    += -Werror -g
-CFLAGS    += -Wno-unused
-CFLAGS    += -fno-strict-aliasing
-CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
-CFLAGS    += $(CFLAGS_libxenctrl)
-CFLAGS    += -D_GNU_SOURCE
-CFLAGS    += -DUSE_NFS_LOCKS
+override CFLAGS += \
+       -fno-strict-aliasing \
+       -I$(BLKTAP_ROOT)/include \
+       -I$(BLKTAP_ROOT)/drivers \
+       -I$(BLKTAP_ROOT)/vhd/lib \
+       $(CFLAGS_libxenctrl) \
+       -D_GNU_SOURCE \
+       -DUSE_NFS_LOCKS \
+    -Werror \
+    -Wall \
+    -Wextra
 
+# FIXME cause trouble
+override CFLAGS += \
+    -Wno-override-init \
+    -Wno-sign-compare \
+    -Wno-type-limits
+
+# TODO Why only in 64-bit?
 ifeq ($(CONFIG_X86_64),y)
 CFLAGS            += -fPIC
 endif
 
+override LDFLAGS += \
+    -L$(XEN_ROOT)/tools/libxc \
+    -lxenctrl \
+    -luuid
+
 VHDLIBS    := -L$(LIBVHDDIR) -lvhd
 
-REMUS-OBJS  := block-remus.o
-REMUS-OBJS  += hashtable.o
-REMUS-OBJS  += hashtable_itr.o
-REMUS-OBJS  += hashtable_utility.o
+# FIXME The following exist in blktap2 but not in blktap2.5.
+# REMUS-OBJS := block-remus.o
+# REMUS-OBJS += hashtable.o
+# REMUS-OBJS += hashtable_itr.o
+# REMUS-OBJS += hashtable_utility.o
 
 ifneq ($(CONFIG_SYSTEM_LIBAIO),y)
 CFLAGS    += -I $(LIBAIO_DIR)
 LIBAIO_DIR = $(XEN_ROOT)/tools/libaio/src
-tapdisk2 tapdisk-stream tapdisk-diff $(QCOW_UTIL): AIOLIBS := 
$(LIBAIO_DIR)/libaio.a 
-tapdisk-client tapdisk-stream tapdisk-diff $(QCOW_UTIL): CFLAGS  += 
-I$(LIBAIO_DIR)
+tapdisk3 tapdisk-stream tapdisk-diff: AIOLIBS := $(LIBAIO_DIR)/libaio.a 
+tapdisk-client tapdisk-stream tapdisk-diff: CFLAGS += -I$(LIBAIO_DIR)
 else
-tapdisk2 tapdisk-stream tapdisk-diff $(QCOW_UTIL): AIOLIBS := -laio
+tapdisk3 tapdisk-stream tapdisk-diff: AIOLIBS := -laio
 endif
 
 MEMSHRLIBS :=
+# FIXME __fixme__?
 ifeq ($(CONFIG_Linux), __fixme__)
 MEMSHR_DIR = $(XEN_ROOT)/tools/memshr
 CFLAGS += -DMEMSHR
@@ -45,14 +67,6 @@ CFLAGS += -I $(MEMSHR_DIR)
 MEMSHRLIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl $(MEMSHR_DIR)/libmemshr.a
 endif
 
-ifeq ($(VHD_STATIC),y)
-td-util: CFLAGS += -static
-endif
-
-PORTABLE-OBJS-y :=
-PORTABLE-OBJS-$(CONFIG_Linux)  += blk_linux.o
-PORTABLE-OBJS-$(CONFIG_NetBSD) += blk_netbsd.o
-
 TAP-OBJS-y  := scheduler.o
 TAP-OBJS-y  += tapdisk-vbd.o
 TAP-OBJS-y  += tapdisk-control.o
@@ -63,54 +77,57 @@ TAP-OBJS-y  += tapdisk-interface.o
 TAP-OBJS-y  += tapdisk-server.o
 TAP-OBJS-y  += tapdisk-queue.o
 TAP-OBJS-y  += tapdisk-filter.o
-TAP-OBJS-y  += tapdisk-log.o
 TAP-OBJS-y  += tapdisk-utils.o
+TAP-OBJS-y += tapdisk-log.o
 TAP-OBJS-y  += io-optimize.o
-TAP-OBJS-y  += lock.o
-TAP-OBJS-y  += $(PORTABLE-OBJS-y)
+#TAP-OBJS-y += lock.o
+#TAP-OBJS-y += tapdisk-blktap.o
+TAP-OBJS-y += tapdisk-stats.o
+TAP-OBJS-y += tapdisk-storage.o
+TAP-OBJS-y += tapdisk-loglimit.o
+TAP-OBJS-y += tapdisk-logfile.o
+TAP-OBJS-y += tapdisk-syslog.o
+#TAP-OBJS-y += $(PORTABLE-OBJS-y)
 
-MISC-OBJS-y := atomicio.o
+LIBSRING := sring/libsring.a
+$(LIBSRING): subdirs-all
+
+#MISC-OBJS-y := atomicio.o
 
 BLK-OBJS-y  := block-aio.o
-BLK-OBJS-y  += block-ram.o
-BLK-OBJS-y  += block-cache.o
-BLK-OBJS-y  += block-vhd.o
-BLK-OBJS-y  += block-log.o
-BLK-OBJS-y  += block-qcow.o
-BLK-OBJS-y  += aes.o
-BLK-OBJS-y  += md5.o
+# FIXME The following exist in blktap2 but not in blktap2.5.
+#BLK-OBJS-y += aes.o
+#BLK-OBJS-y += md5.o
 BLK-OBJS-y  += $(PORTABLE-OBJS-y)
 BLK-OBJS-y  += $(REMUS-OBJS)
 
-all: $(IBIN) lock-util qcow-util
+# FIXME qcow-util not in blktap2.5
+all: $(IBIN)
 
+$(BLKTAP_ROOT)/vhd/lib/libvhd.a:
+       make -C $(BLKTAP_ROOT)/vhd/lib libvhd.a
 
-tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.o
+tapdisk3: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk.o \
+       $(BLKTAP_ROOT)/vhd/lib/libvhd.a $(LIBSRING)
        $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) 
-lm 
 
 tapdisk-client: tapdisk-client.o
        $(CC) -o $@ $^ $(LDFLAGS) -lrt
 
-tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
-       $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) 
-lm
-
-td-util: td.o tapdisk-utils.o tapdisk-log.o $(PORTABLE-OBJS-y)
-       $(CC) -o $@ $^ $(LDFLAGS) $(VHDLIBS)
+# FIXME what's tapdisk-stream?
+#tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
+#      $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) 
-lm
 
 lock-util: lock.c
        $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS)
 
-.PHONY: qcow-util
-qcow-util: img2qcow qcow2raw qcow-create
-
-img2qcow qcow2raw qcow-create: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y)
-       $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) 
-lm
-
+# FIXME img2qcow, qcow-create, qcow2raw not built so not installed
+# FIXME lock-util should be installed
 install: all
        $(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
-       $(INSTALL_PROG) $(IBIN) $(LOCK_UTIL) $(QCOW_UTIL) $(DESTDIR)$(INST_DIR)
+       $(INSTALL_PROG) $(IBIN) $(DESTDIR)$(INST_DIR)
 
-clean:
-       rm -rf .*.d *.o *~ xen TAGS $(IBIN) $(LIB) $(LOCK_UTIL) $(QCOW_UTIL)
+clean: subdirs-clean
+       rm -rf .*.d *.o *~ xen TAGS $(IBIN) $(LIB) $(LOCK_UTIL)
 
 .PHONY: clean install

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.