From ed1b78529d5bff9e94beb513d4619b5e5033bd5a Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Tue, 22 Sep 2020 14:27:53 -0700 Subject: [PATCH] iscsi_top: Convert to C99 This is already valid C, so compile it using the C compiler. Change-Id: I5e7a7b0dfcbbe6402a1774fc2fcf53778355d3a4 Signed-off-by: Ben Walker Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4345 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk --- app/iscsi_top/Makefile | 6 +++--- app/iscsi_top/{iscsi_top.cpp => iscsi_top.c} | 9 ++------- 2 files changed, 5 insertions(+), 10 deletions(-) rename app/iscsi_top/{iscsi_top.cpp => iscsi_top.c} (98%) diff --git a/app/iscsi_top/Makefile b/app/iscsi_top/Makefile index 62771944f..079a7f13a 100644 --- a/app/iscsi_top/Makefile +++ b/app/iscsi_top/Makefile @@ -39,8 +39,8 @@ APP = iscsi_top SPDK_LIB_LIST = jsonrpc json rpc log util -CXXFLAGS += -I$(SPDK_ROOT_DIR)/lib +CFLAGS += -I$(SPDK_ROOT_DIR)/lib -CXX_SRCS := iscsi_top.cpp +C_SRCS := iscsi_top.c -include $(SPDK_ROOT_DIR)/mk/spdk.app_cxx.mk +include $(SPDK_ROOT_DIR)/mk/spdk.app.mk diff --git a/app/iscsi_top/iscsi_top.cpp b/app/iscsi_top/iscsi_top.c similarity index 98% rename from app/iscsi_top/iscsi_top.cpp rename to app/iscsi_top/iscsi_top.c index 190ba4fbf..c49160928 100644 --- a/app/iscsi_top/iscsi_top.cpp +++ b/app/iscsi_top/iscsi_top.c @@ -33,19 +33,14 @@ #include "spdk/stdinc.h" -#include -#include -#include - -extern "C" { #include "spdk/event.h" #include "spdk/jsonrpc.h" #include "spdk/rpc.h" +#include "spdk/string.h" #include "spdk/trace.h" #include "spdk/util.h" #include "iscsi/conn.h" -} static char *exe_name; static int g_shm_id = 0; @@ -162,7 +157,7 @@ int main(int argc, char **argv) while ((op = getopt(argc, argv, "i:r:")) != -1) { switch (op) { case 'i': - g_shm_id = atoi(optarg); + g_shm_id = spdk_strtol(optarg, 10); break; case 'r': rpc_socket_path = optarg;