rpc: Add a separate subsystem library

This separates the RPC library from the event framework.

Change-Id: I26a9cb318b56d44ec9337f8a4db98967eb87ad95
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365283
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2017-06-13 10:18:50 -07:00
parent 5cf5dbff24
commit 674de77551
12 changed files with 96 additions and 13 deletions

View File

@ -46,7 +46,7 @@ CFLAGS += -I$(SPDK_ROOT_DIR)/lib
C_SRCS := iscsi_tgt.c
SPDK_LIB_LIST = event_bdev event_copy event_net
SPDK_LIB_LIST = event_bdev event_copy event_net event_rpc
SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev iscsi scsi net copy trace conf
SPDK_LIB_LIST += util log log_rpc event app_rpc

View File

@ -42,7 +42,7 @@ CFLAGS += $(ENV_CFLAGS)
C_SRCS := conf.c nvmf_main.c nvmf_tgt.c nvmf_rpc.c
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST = event_bdev event_copy event_rpc
SPDK_LIB_LIST += nvmf event log trace conf util bdev copy rpc jsonrpc json
SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc

View File

@ -42,7 +42,7 @@ CFLAGS += $(ENV_CFLAGS)
C_SRCS := vhost.c
SPDK_LIB_LIST = event_bdev event_copy event_net
SPDK_LIB_LIST = event_bdev event_copy event_net event_rpc
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

View File

@ -38,6 +38,10 @@
#include "spdk/jsonrpc.h"
void spdk_rpc_initialize(void);
int spdk_rpc_finish(void);
void spdk_rpc_config_text(FILE *fp);
typedef void (*spdk_rpc_method_handler)(struct spdk_jsonrpc_server_conn *conn,
const struct spdk_json_val *params,
const struct spdk_json_val *id);

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += bdev copy net
DIRS-y += bdev copy net rpc
.PHONY: all clean $(DIRS-y)

View File

@ -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 = rpc.c
LIBNAME = event_rpc
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -0,0 +1,40 @@
/*-
* 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/rpc.h"
#include "spdk_internal/event.h"
SPDK_SUBSYSTEM_REGISTER(spdk_rpc, spdk_rpc_initialize, spdk_rpc_finish, spdk_rpc_config_text)

View File

@ -49,7 +49,7 @@ CXXFLAGS += -fno-profile-arcs -fno-test-coverage
CXXFLAGS += -fno-sanitize=undefined
CXXFLAGS += -fno-sanitize=address
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST = event_bdev event_copy event_rpc
SPDK_LIB_LIST += blobfs blob bdev blob_bdev copy event util conf trace \
log jsonrpc json rpc

View File

@ -225,7 +225,7 @@ spdk_rpc_setup(void *arg)
RPC_SELECT_INTERVAL);
}
static void
void
spdk_rpc_initialize(void)
{
/*
@ -239,7 +239,7 @@ spdk_rpc_initialize(void)
spdk_subsystem_init_next(0);
}
static int
int
spdk_rpc_finish(void)
{
if (g_rpc_listen_addr_unix.sun_path[0]) {
@ -256,7 +256,7 @@ spdk_rpc_finish(void)
return 0;
}
static void
void
spdk_rpc_config_text(FILE *fp)
{
fprintf(fp,
@ -272,5 +272,3 @@ spdk_rpc_config_text(FILE *fp)
" Listen %s\n",
enable_rpc() ? "Yes" : "No", rpc_get_listen_addr());
}
SPDK_SUBSYSTEM_REGISTER(spdk_rpc, spdk_rpc_initialize, spdk_rpc_finish, spdk_rpc_config_text)

View File

@ -42,7 +42,7 @@ C_SRCS := bdevio.c
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST = event_bdev event_copy event_rpc
SPDK_LIB_LIST += bdev copy event trace log conf util rpc jsonrpc json
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \

View File

@ -42,7 +42,7 @@ C_SRCS := bdevperf.c
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST = event_bdev event_copy event_rpc
SPDK_LIB_LIST += bdev copy event trace log conf util rpc jsonrpc json
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \

View File

@ -41,7 +41,7 @@ APP = mkfs
C_SRCS := mkfs.c
CFLAGS += $(DPDK_INC)
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST = event_bdev event_copy event_rpc
SPDK_LIB_LIST += blobfs blob bdev blob_bdev copy event util conf trace \
log jsonrpc json rpc