LCOV - code coverage report
Current view: top level - spdk/module/event/subsystems/iobuf - iobuf.c (source / functions) Hit Total Coverage
Test: Combined Lines: 27 28 96.4 %
Date: 2024-07-15 13:37:12 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2022 Intel Corporation.
       3                 :            :  *   All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include "spdk/stdinc.h"
       7                 :            : #include "spdk/bdev.h"
       8                 :            : #include "spdk/log.h"
       9                 :            : #include "spdk/thread.h"
      10                 :            : #include "spdk_internal/init.h"
      11                 :            : 
      12                 :            : static void
      13                 :       2658 : iobuf_subsystem_initialize(void)
      14                 :            : {
      15                 :            :         int rc;
      16                 :            : 
      17                 :       2658 :         rc = spdk_iobuf_initialize();
      18         [ -  + ]:       2658 :         if (rc != 0) {
      19                 :          0 :                 SPDK_ERRLOG("Failed to initialize iobuf\n");
      20                 :            :         }
      21                 :            : 
      22                 :       2658 :         spdk_subsystem_init_next(rc);
      23                 :       2658 : }
      24                 :            : 
      25                 :            : static void
      26                 :       2658 : iobuf_finish_cb(void *ctx)
      27                 :            : {
      28                 :       2658 :         spdk_subsystem_fini_next();
      29                 :       2658 : }
      30                 :            : 
      31                 :            : static void
      32                 :       2658 : iobuf_subsystem_finish(void)
      33                 :            : {
      34                 :       2658 :         spdk_iobuf_finish(iobuf_finish_cb, NULL);
      35                 :       2658 : }
      36                 :            : 
      37                 :            : static void
      38                 :        148 : iobuf_write_config_json(struct spdk_json_write_ctx *w)
      39                 :            : {
      40                 :         59 :         struct spdk_iobuf_opts opts;
      41                 :            : 
      42                 :        148 :         spdk_iobuf_get_opts(&opts, sizeof(opts));
      43                 :            : 
      44                 :        148 :         spdk_json_write_array_begin(w);
      45                 :            : 
      46                 :        148 :         spdk_json_write_object_begin(w);
      47                 :        148 :         spdk_json_write_named_string(w, "method", "iobuf_set_options");
      48                 :            : 
      49                 :        148 :         spdk_json_write_named_object_begin(w, "params");
      50                 :        148 :         spdk_json_write_named_uint64(w, "small_pool_count", opts.small_pool_count);
      51                 :        148 :         spdk_json_write_named_uint64(w, "large_pool_count", opts.large_pool_count);
      52                 :        148 :         spdk_json_write_named_uint32(w, "small_bufsize", opts.small_bufsize);
      53                 :        148 :         spdk_json_write_named_uint32(w, "large_bufsize", opts.large_bufsize);
      54                 :        148 :         spdk_json_write_object_end(w);
      55                 :        148 :         spdk_json_write_object_end(w);
      56                 :            : 
      57                 :        148 :         spdk_json_write_array_end(w);
      58                 :        148 : }
      59                 :            : 
      60                 :            : static struct spdk_subsystem g_subsystem_iobuf = {
      61                 :            :         .name = "iobuf",
      62                 :            :         .init = iobuf_subsystem_initialize,
      63                 :            :         .fini = iobuf_subsystem_finish,
      64                 :            :         .write_config_json = iobuf_write_config_json,
      65                 :            : };
      66                 :            : 
      67                 :       2851 : SPDK_SUBSYSTEM_REGISTER(g_subsystem_iobuf);

Generated by: LCOV version 1.14