aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--Makefile.objs7
-rw-r--r--block/Makefile.objs2
-rw-r--r--qemu-storage-daemon.c31
4 files changed, 43 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 2bf59d4f42..7c75440182 100644
--- a/Makefile
+++ b/Makefile
@@ -450,6 +450,8 @@ dummy := $(call unnest-vars,, \
qga-vss-dll-obj-y \
block-obj-y \
block-obj-m \
+ storage-daemon-obj-y \
+ storage-daemon-obj-m \
crypto-obj-y \
qom-obj-y \
io-obj-y \
@@ -482,6 +484,7 @@ TARGET_DIRS_RULES := $(foreach t, all fuzz clean install, $(addsuffix /$(t), $(T
SOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
$(SOFTMMU_ALL_RULES): $(authz-obj-y)
$(SOFTMMU_ALL_RULES): $(block-obj-y)
+$(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y)
$(SOFTMMU_ALL_RULES): $(chardev-obj-y)
$(SOFTMMU_ALL_RULES): $(crypto-obj-y)
$(SOFTMMU_ALL_RULES): $(io-obj-y)
@@ -586,7 +589,7 @@ qemu-img.o: qemu-img-cmds.h
qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
-qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
+qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(storage-daemon-obj-y) $(COMMON_LDADDS)
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
diff --git a/Makefile.objs b/Makefile.objs
index 8a1cbe8000..3db3a7db6e 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -27,6 +27,13 @@ io-obj-y = io/
endif # CONFIG_SOFTMMU or CONFIG_TOOLS
+#######################################################################
+# storage-daemon-obj-y is code used by qemu-storage-daemon (these objects are
+# used for system emulation, too, but specified separately there)
+
+storage-daemon-obj-y = block/
+storage-daemon-obj-y += blockdev.o iothread.o
+
######################################################################
# Target independent part of system emulation. The long term path is to
# suppress *all* target specific code in case of system emulation, i.e. a
diff --git a/block/Makefile.objs b/block/Makefile.objs
index e06cf0b284..cb36ae2503 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -46,7 +46,7 @@ block-obj-y += aio_task.o
block-obj-y += backup-top.o
block-obj-y += filter-compress.o
-common-obj-y += stream.o
+block-obj-y += stream.o
common-obj-y += qapi-sysemu.o
diff --git a/qemu-storage-daemon.c b/qemu-storage-daemon.c
index fc4aef572b..c30caaf59e 100644
--- a/qemu-storage-daemon.c
+++ b/qemu-storage-daemon.c
@@ -31,6 +31,10 @@
#include "crypto/init.h"
#include "qapi/error.h"
+#include "qapi/qapi-visit-block-core.h"
+#include "qapi/qapi-commands-block-core.h"
+#include "qapi/qobject-input-visitor.h"
+
#include "qemu-common.h"
#include "qemu-version.h"
#include "qemu/config-file.h"
@@ -52,15 +56,27 @@ static void help(void)
" specify tracing options\n"
" -V, --version output version information and exit\n"
"\n"
+" --blockdev [driver=]<driver>[,node-name=<N>][,discard=ignore|unmap]\n"
+" [,cache.direct=on|off][,cache.no-flush=on|off]\n"
+" [,read-only=on|off][,auto-read-only=on|off]\n"
+" [,force-share=on|off][,detect-zeroes=on|off|unmap]\n"
+" [,driver specific parameters...]\n"
+" configure a block backend\n"
+"\n"
QEMU_HELP_BOTTOM "\n",
error_get_progname());
}
+enum {
+ OPTION_BLOCKDEV = 256,
+};
+
static void process_options(int argc, char *argv[])
{
int c;
static const struct option long_options[] = {
+ {"blockdev", required_argument, NULL, OPTION_BLOCKDEV},
{"help", no_argument, NULL, 'h'},
{"trace", required_argument, NULL, 'T'},
{"version", no_argument, NULL, 'V'},
@@ -90,6 +106,21 @@ static void process_options(int argc, char *argv[])
printf("qemu-storage-daemon version "
QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n");
exit(EXIT_SUCCESS);
+ case OPTION_BLOCKDEV:
+ {
+ Visitor *v;
+ BlockdevOptions *options;
+
+ v = qobject_input_visitor_new_str(optarg, "driver",
+ &error_fatal);
+
+ visit_type_BlockdevOptions(v, NULL, &options, &error_fatal);
+ visit_free(v);
+
+ qmp_blockdev_add(options, &error_fatal);
+ qapi_free_BlockdevOptions(options);
+ break;
+ }
default:
g_assert_not_reached();
}