diff --git a/app/vhost/Makefile b/app/vhost/Makefile index 1dac68052..455ca76cc 100644 --- a/app/vhost/Makefile +++ b/app/vhost/Makefile @@ -42,7 +42,7 @@ CFLAGS += $(ENV_CFLAGS) C_SRCS := vhost.c -SPDK_LIB_LIST = event_bdev event_copy event_net event_rpc event_scsi +SPDK_LIB_LIST = event_bdev event_copy event_net event_rpc event_scsi event_vhost SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev scsi net copy trace conf SPDK_LIB_LIST += util log log_rpc event app_rpc SPDK_LIB_LIST += vhost rte_vhost diff --git a/include/spdk/vhost.h b/include/spdk/vhost.h index 426763e3b..cb2507e14 100644 --- a/include/spdk/vhost.h +++ b/include/spdk/vhost.h @@ -43,6 +43,9 @@ #include "spdk/event.h" +void spdk_vhost_subsystem_init(void); +int spdk_vhost_subsystem_fini(void); + /** * \param event event object. event arg1 is optional path to vhost socket. */ diff --git a/lib/event/subsystems/Makefile b/lib/event/subsystems/Makefile index 3a1c42d2d..964723adc 100644 --- a/lib/event/subsystems/Makefile +++ b/lib/event/subsystems/Makefile @@ -34,7 +34,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk -DIRS-y += bdev copy iscsi net rpc scsi +DIRS-y += bdev copy iscsi net rpc scsi vhost .PHONY: all clean $(DIRS-y) diff --git a/lib/event/subsystems/vhost/Makefile b/lib/event/subsystems/vhost/Makefile new file mode 100644 index 000000000..e3f655020 --- /dev/null +++ b/lib/event/subsystems/vhost/Makefile @@ -0,0 +1,41 @@ +# +# BSD LICENSE +# +# Copyright (c) Intel Corporation. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..) +include $(SPDK_ROOT_DIR)/mk/spdk.common.mk + +CFLAGS += $(ENV_CFLAGS) -I. +C_SRCS = vhost.c +LIBNAME = event_vhost + +include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk diff --git a/lib/event/subsystems/vhost/vhost.c b/lib/event/subsystems/vhost/vhost.c new file mode 100644 index 000000000..aede5904d --- /dev/null +++ b/lib/event/subsystems/vhost/vhost.c @@ -0,0 +1,41 @@ +/*- + * BSD LICENSE + * + * Copyright (c) Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "spdk/stdinc.h" + +#include "spdk/vhost.h" + +#include "spdk_internal/event.h" + +SPDK_SUBSYSTEM_REGISTER(vhost, spdk_vhost_subsystem_init, spdk_vhost_subsystem_fini, NULL) +SPDK_SUBSYSTEM_DEPEND(vhost, scsi) diff --git a/lib/vhost/task.c b/lib/vhost/task.c index a2a4038b3..c601b0d5f 100644 --- a/lib/vhost/task.c +++ b/lib/vhost/task.c @@ -40,6 +40,7 @@ #include "spdk_internal/event.h" #include "spdk/env.h" #include "spdk/queue.h" +#include "spdk/vhost.h" #include "task.h" #undef container_of @@ -84,7 +85,7 @@ spdk_vhost_task_get(struct spdk_vhost_scsi_dev *vdev) return task; } -static void +void spdk_vhost_subsystem_init(void) { int rc = 0; @@ -99,11 +100,8 @@ spdk_vhost_subsystem_init(void) spdk_subsystem_init_next(rc); } -static int +int spdk_vhost_subsystem_fini(void) { return 0; } - -SPDK_SUBSYSTEM_REGISTER(vhost, spdk_vhost_subsystem_init, spdk_vhost_subsystem_fini, NULL) -SPDK_SUBSYSTEM_DEPEND(vhost, scsi)