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 : 1905 : sock_subsystem_init(void) 14 : : { 15 [ - + ]: 1905 : const char *sock_impl_override = getenv("SPDK_SOCK_IMPL_DEFAULT"); 16 : 1905 : int rc = 0; 17 : : 18 [ + + ]: 1905 : if (sock_impl_override) { 19 : 321 : rc = spdk_sock_set_default_impl(sock_impl_override); 20 [ - + ]: 321 : 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 : 321 : SPDK_NOTICELOG("Default socket implementaion override: %s\n", 26 : : sock_impl_override); 27 : : } 28 : : } 29 : : 30 : 1905 : spdk_subsystem_init_next(rc); 31 : 1905 : } 32 : : 33 : : static void 34 : 1905 : sock_subsystem_fini(void) 35 : : { 36 : 1905 : spdk_subsystem_fini_next(); 37 : 1905 : } 38 : : 39 : : static void 40 : 107 : sock_subsystem_write_config_json(struct spdk_json_write_ctx *w) 41 : : { 42 : 107 : spdk_sock_write_config_json(w); 43 : 107 : } 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 : 2021 : SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_sock);