From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.ics.ntt-tx.co.jp (mail05.ics.ntt-tx.co.jp [210.232.35.69]) by dpdk.org (Postfix) with ESMTP id 247181322C for ; Thu, 28 Dec 2017 05:56:16 +0100 (CET) Received: from gwchk03.silk.ntt-tx.co.jp (gwchk03.silk.ntt-tx.co.jp [10.107.0.111]) by mail04.ics.ntt-tx.co.jp (unknown) with ESMTP id vBS4uFT7025345 for unknown; Thu, 28 Dec 2017 13:56:15 +0900 Received: (from root@localhost) by gwchk03.silk.ntt-tx.co.jp (unknown) id vBS4uADV027496 for unknown; Thu, 28 Dec 2017 13:56:10 +0900 Received: from gwchk.silk.ntt-tx.co.jp [10.107.0.110] by gwchk03.silk.ntt-tx.co.jp with ESMTP id PAA27493; Thu, 28 Dec 2017 13:56:10 +0900 Received: from imss03.silk.ntt-tx.co.jp (localhost [127.0.0.1]) by imss03.silk.ntt-tx.co.jp (unknown) with ESMTP id vBS4u9Yd011242 for unknown; Thu, 28 Dec 2017 13:56:10 +0900 Received: from mgate01.silk.ntt-tx.co.jp (smtp02.silk.ntt-tx.co.jp [10.107.0.37]) by imss03.silk.ntt-tx.co.jp (unknown) with ESMTP id vBS4u9oJ011231 for unknown; Thu, 28 Dec 2017 13:56:09 +0900 Message-Id: <201712280456.vBS4u9oJ011231@imss03.silk.ntt-tx.co.jp> Received: from localhost by mgate01.silk.ntt-tx.co.jp (unknown) id vBS4u4b4025622 ; Thu, 28 Dec 2017 13:56:06 +0900 From: x-fn-spp@sl.ntt-tx.co.jp To: spp@dpdk.org Date: Thu, 28 Dec 2017 13:55:37 +0900 X-Mailer: git-send-email 1.9.1 In-Reply-To: <4aae78ff-3b6c-cdfe-a8b7-24ec08b73935@lab.ntt.co.jp> References: <4aae78ff-3b6c-cdfe-a8b7-24ec08b73935@lab.ntt.co.jp> X-TM-AS-MML: No Subject: [spp] [PATCH 30/57] spp_vf: change order of command result in json object X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Dec 2017 04:56:18 -0000 From: Hiroyuki Nakamura * Change order of command result in json object (bug fix). Signed-off-by: Daiki Yamashita Signed-off-by: Yasufum Ogawa --- src/vf/command_proc.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c index 81bb625..291e3da 100644 --- a/src/vf/command_proc.c +++ b/src/vf/command_proc.c @@ -244,6 +244,10 @@ send_decode_error_response(int *sock, const struct spp_command_request *request, return; } + /* ** + * output order of object in string is inverse to addition order + * **/ + /* create & append result array */ ret = append_response_decode_results_object(top_obj, request, decode_error); if (unlikely(ret != 0)) { @@ -284,13 +288,9 @@ send_command_result_response(int *sock, const struct spp_command_request *reques return; } - /* create & append result array */ - ret = append_response_command_results_object(top_obj, request, command_results); - if (unlikely(ret != 0)) { - RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to make command result response."); - json_decref(top_obj); - return; - } + /* ** + * output order of object in string is inverse to addition order + * **/ /* append process information value */ if (request->is_requested_process) { @@ -302,6 +302,14 @@ send_command_result_response(int *sock, const struct spp_command_request *reques } } + /* create & append result array */ + ret = append_response_command_results_object(top_obj, request, command_results); + if (unlikely(ret != 0)) { + RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to make command result response."); + json_decref(top_obj); + return; + } + /* serialize */ msg = json_dumps(top_obj, JSON_INDENT(2)); json_decref(top_obj); -- 1.9.1