LCOV - code coverage report
Current view: top level - spdk/module/event/subsystems/sock - sock.c (source / functions) Hit Total Coverage
Test: Combined Lines: 16 17 94.1 %
Date: 2024-07-15 18:04:22 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 6 66.7 %

           Branch data     Line data    Source code
       1                 :            : /*   SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  *   Copyright (C) 2021 Intel Corporation.
       3                 :            :  *   Copyright (c) 2020 Mellanox Technologies LTD. All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include "spdk/stdinc.h"
       7                 :            : #include "spdk/sock.h"
       8                 :            : #include "spdk_internal/init.h"
       9                 :            : #include "spdk_internal/sock.h"
      10                 :            : #include "spdk/log.h"
      11                 :            : 
      12                 :            : static void
      13                 :       2049 : sock_subsystem_init(void)
      14                 :            : {
      15         [ -  + ]:       2049 :         const char *sock_impl_override = getenv("SPDK_SOCK_IMPL_DEFAULT");
      16                 :       2049 :         int rc = 0;
      17                 :            : 
      18         [ +  + ]:       2049 :         if (sock_impl_override) {
      19                 :        320 :                 rc = spdk_sock_set_default_impl(sock_impl_override);
      20         [ -  + ]:        320 :                 if (rc) {
      21                 :          0 :                         SPDK_ERRLOG("Could not override socket implementation with: %s,"
      22                 :            :                                     " set by SPDK_SOCK_IMPL_DEFAULT environment variable\n",
      23                 :            :                                     sock_impl_override);
      24                 :            :                 } else {
      25                 :        320 :                         SPDK_NOTICELOG("Default socket implementaion override: %s\n",
      26                 :            :                                        sock_impl_override);
      27                 :            :                 }
      28                 :            :         }
      29                 :            : 
      30                 :       2049 :         spdk_subsystem_init_next(rc);
      31                 :       2049 : }
      32                 :            : 
      33                 :            : static void
      34                 :       2049 : sock_subsystem_fini(void)
      35                 :            : {
      36                 :       2049 :         spdk_subsystem_fini_next();
      37                 :       2049 : }
      38                 :            : 
      39                 :            : static void
      40                 :        118 : sock_subsystem_write_config_json(struct spdk_json_write_ctx *w)
      41                 :            : {
      42                 :        118 :         spdk_sock_write_config_json(w);
      43                 :        118 : }
      44                 :            : 
      45                 :            : static struct spdk_subsystem g_spdk_subsystem_sock = {
      46                 :            :         .name = "sock",
      47                 :            :         .init = sock_subsystem_init,
      48                 :            :         .fini = sock_subsystem_fini,
      49                 :            :         .write_config_json = sock_subsystem_write_config_json,
      50                 :            : };
      51                 :            : 
      52                 :       2166 : SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_sock);

Generated by: LCOV version 1.14