echo ""
echo "NOTE: The object files are built at the place where configure is
launched"
exit 1
@@ -2349,6 +2356,28 @@ EOF
fi
fi
+##########################################
+# libqblock probe
+if test "$libqblock" == "yes" ; then
+ # if it is set to yes by user, check whether libtool exist
+ if ! has $libtool; then
+ echo
+ echo "ERROR: Libqblock needs libtool, but libtool was not found."
+ echo "Make sure libtool was installed, or disable libqblock."
+ echo
+ exit 1
+ fi
+fi
+
+if test "$libqblock" == "" ; then
+ # libqblock depends on libtool, default to yes if libtool exist
+ if ! has $libtool; then
+ libqblock="no"
+ else
+ libqblock="yes"
+ fi
+fi
+
#
# Check for xxxat() functions when we are building linux-user
# emulator. This is done because older glibc versions don't
@@ -3101,6 +3130,9 @@ if test "$want_tools" = "yes" ; then
if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
tools="qemu-nbd\$(EXESUF) $tools"
fi
+ if test "$libqblock" = "yes" ; then
+ tools="subdir-libqblock $tools"
+ fi
fi
if test "$softmmu" = yes ; then
if test "$virtfs" != no ; then
@@ -3235,6 +3267,7 @@ echo "build guest agent $guest_agent"
echo "seccomp support $seccomp"
echo "coroutine backend $coroutine_backend"
echo "GlusterFS support $glusterfs"
+echo "libqblock support $libqblock"
if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -3581,6 +3614,10 @@ if test "$glusterfs" = "yes" ; then
echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
fi
+if test "$libqblock" = "yes" ; then
+ echo "CONFIG_LIBQBLOCK=y" >> $config_host_mak
+fi
+
# USB host support
case "$usb" in
linux)
@@ -4166,12 +4203,14 @@ DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
DIRS="$DIRS roms/seabios roms/vgabios"
DIRS="$DIRS qapi-generated"
DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace"
+DIRS="$DIRS libqblock"
FILES="Makefile tests/Makefile tests/tcg/Makefile qdict-test-data.txt"
FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile"
FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
FILES="$FILES pc-bios/spapr-rtas/Makefile"
FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
+FILES="$FILES libqblock/Makefile"
for bios_file in \
$source_path/pc-bios/*.bin \
$source_path/pc-bios/*.rom \
diff --git a/libqblock/Makefile b/libqblock/Makefile
new file mode 100644
index 0000000..13f9522
--- /dev/null
+++ b/libqblock/Makefile
@@ -0,0 +1,69 @@
+###########################################################################
+# libqblock Makefile
+##########################################################################
+-include ../config-host.mak
+-include $(SRC_PATH)/rules.mak
+-include $(SRC_PATH)/Makefile.objs
+
+#############################################################################
+# Library settings
+#############################################################################
+# src files are in orignial path
+$(call set-vpath, $(SRC_PATH))
+# generated files are in ../
+$(call set-vpath, ../)
+
+#library objects
+libqblock-obj-y= libqblock/libqblock.o libqblock/libqblock-error.o
libqblock/libqblock-aio.o
+
+extra-obj-y= qemu-timer.o qemu-tool.o
+
+QEMU_OBJS= $(libqblock-obj-y) $(block-obj-y) $(oslib-obj-y) $(stub-obj-y) \
+ $(extra-obj-y)
+QEMU_OBJS_LIB= $(patsubst %.o, %.lo, $(QEMU_OBJS))
+
+QEMU_CFLAGS+= -I$(SRC_PATH) -I$(SRC_PATH)/include -I../
+#adding magic macro define for symbol hiding and exposing
+QEMU_CFLAGS+= -fvisibility=hidden -D LIBQB_BUILD
+
+#dependency libraries
+LIBS+= -lz $(LIBS_TOOLS)
+
+#header files to be installed
+libqblock_includedir= $(includedir)/qblock
+libqblock_srcpath= $(SRC_PATH)/libqblock
+libqblock-pub-headers= $(libqblock_srcpath)/libqblock.h \
+ $(libqblock_srcpath)/libqblock-types.h \
+ $(libqblock_srcpath)/libqblock-error.h
+
+#################################################################
+# Runtime rules
+#################################################################
+.PHONY: clean all libqblock.la libqblock.pc install-libqblock
+
+clean:
+ rm -f *.lo *.o *.d *.la *.pc
+ rm -rf .libs block trace audio fsdev hw net qapi qga qom slirp ui
libqblock stubs backends
+
+all: libqblock.la libqblock.pc
+# Dummy command so that make thinks it has done something
+ @true
+
+libqblock.la: $(QEMU_OBJS_LIB)
+ $(call quiet-command,$(LIBTOOL) --mode=link --quiet --tag=CC $(CC) -rpath
$(libdir) -o $@ $^ $(LIBS)," lt LINK $@")
+
+libqblock.pc: $(libqblock_srcpath)/libqblock.pc.in
+ $(call quiet-command,sed -e 's|@LIBDIR@|$(libdir)|' \
+ -e 's|@INCLUDEDIR@|$(libqblock_includedir)|' \
+ -e 's|@VERSION@|$(shell cat $(SRC_PATH)/VERSION)|' \
+ -e 's|@PREFIX@|$(prefix)|' \
+ < $(libqblock_srcpath)/libqblock.pc.in > libqblock.pc,\
+ " GEN $@")
+
+install-libqblock: libqblock.la libqblock.pc
+ $(INSTALL_DIR) "$(DESTDIR)$(libdir)"
+ $(INSTALL_DIR) "$(DESTDIR)$(libdir)/pkgconfig"
+ $(INSTALL_DIR) "$(DESTDIR)$(libqblock_includedir)"
+ $(LIBTOOL) --mode=install $(INSTALL_DATA) libqblock.la
"$(DESTDIR)$(libdir)"
+ $(LIBTOOL) --mode=install $(INSTALL_DATA) libqblock.pc
"$(DESTDIR)$(libdir)/pkgconfig"
+ $(LIBTOOL) --mode=install $(INSTALL_DATA) $(libqblock-pub-headers)
"$(DESTDIR)$(libqblock_includedir)"
diff --git a/libqblock/libqblock-aio.c b/libqblock/libqblock-aio.c
new file mode 100644
index 0000000..935fb7f
--- /dev/null
+++ b/libqblock/libqblock-aio.c
@@ -0,0 +1,62 @@
+/*
+ * QEMU block layer library
+ *
+ * Copyright IBM, Corp. 2012
+ *
+ * Authors:
+ * Wenchao Xia <address@hidden>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include <sys/syscall.h>
+
+#include "qemu-common.h"
+#include "qemu-aio.h"
+#include "main-loop.h"
+#include "compatfd.h"
+
+void qemu_notify_event(void)
+{
+ return;
+}
+
+QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
+{
+ return NULL;
+}
+
+void qemu_aio_flush(void)
+{
+ return;
+}
+
+bool qemu_aio_wait(void)
+{
+ return false;
+}
+
+#ifdef CONFIG_POSIX
+void qemu_aio_set_fd_handler(int fd,
+ IOHandler *io_read,
+ IOHandler *io_write,
+ AioFlushHandler *io_flush,
+ void *opaque)
+{
+ return;
+}
+#endif
+
+void qemu_aio_set_event_notifier(EventNotifier *notifier,
+ EventNotifierHandler *io_read,
+ AioFlushEventNotifierHandler *io_flush)
+{
+ return;
+}
+
+bool qemu_signalfd_available(void)
+{
+ return false;
+}
diff --git a/libqblock/libqblock-error.c b/libqblock/libqblock-error.c
new file mode 100644
index 0000000..e69de29
diff --git a/libqblock/libqblock-error.h b/libqblock/libqblock-error.h
new file mode 100644
index 0000000..e69de29
diff --git a/libqblock/libqblock-types.h b/libqblock/libqblock-types.h
new file mode 100644
index 0000000..e69de29
diff --git a/libqblock/libqblock.c b/libqblock/libqblock.c
new file mode 100644
index 0000000..4c18c41
--- /dev/null
+++ b/libqblock/libqblock.c
@@ -0,0 +1,6 @@
+#include "libqblock.h"
+
+int libqb_test(void)
+{
+ return 0;
+}
diff --git a/libqblock/libqblock.h b/libqblock/libqblock.h
new file mode 100644
index 0000000..b0f9daf
--- /dev/null
+++ b/libqblock/libqblock.h
@@ -0,0 +1 @@
+__attribute__((visibility("default"))) int libqb_test(void);
diff --git a/libqblock/libqblock.pc.in b/libqblock/libqblock.pc.in
new file mode 100644
index 0000000..d2a7d06
--- /dev/null
+++ b/libqblock/libqblock.pc.in
@@ -0,0 +1,13 @@
address@hidden@
+exec_prefix=${prefix}
address@hidden@
address@hidden@
+
+Name: qblock
+Description: QEMU block layer library
+Version: @VERSION@
+
+Requires: rt gthread-2.0 glib-2.0 z curl cap-ng uuid