LCOV - code coverage report
Current view: top level - spdk/lib/keyring - keyring_rpc.c (source / functions) Hit Total Coverage
Test: Combined Lines: 14 14 100.0 %
Date: 2024-07-12 19:12:53 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright (c) 2024 Intel Corporation. All rights reserved.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include "keyring_internal.h"
       6                 :            : #include "spdk/keyring.h"
       7                 :            : #include "spdk/rpc.h"
       8                 :            : #include "spdk/string.h"
       9                 :            : #include "spdk/util.h"
      10                 :            : 
      11                 :            : static void
      12                 :         96 : rpc_keyring_for_each_key_cb(void *ctx, struct spdk_key *key)
      13                 :            : {
      14                 :         96 :         struct spdk_json_write_ctx *w = ctx;
      15                 :            : 
      16                 :         96 :         spdk_json_write_object_begin(w);
      17                 :         96 :         keyring_dump_key_info(key, w);
      18                 :         96 :         spdk_json_write_object_end(w);
      19                 :         96 : }
      20                 :            : 
      21                 :            : static void
      22                 :         66 : rpc_keyring_get_keys(struct spdk_jsonrpc_request *request,
      23                 :            :                      const struct spdk_json_val *params)
      24                 :            : {
      25                 :            :         struct spdk_json_write_ctx *w;
      26                 :            : 
      27                 :         66 :         w = spdk_jsonrpc_begin_result(request);
      28                 :         66 :         spdk_json_write_array_begin(w);
      29                 :         66 :         spdk_keyring_for_each_key(NULL, w, rpc_keyring_for_each_key_cb, SPDK_KEYRING_FOR_EACH_ALL);
      30                 :         66 :         spdk_json_write_array_end(w);
      31                 :            : 
      32                 :         66 :         spdk_jsonrpc_end_result(request, w);
      33                 :            : 
      34                 :         66 : }
      35                 :       2833 : SPDK_RPC_REGISTER("keyring_get_keys", rpc_keyring_get_keys, SPDK_RPC_RUNTIME)

Generated by: LCOV version 1.14