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/ublk.h" 8 : : #include "spdk_internal/init.h" 9 : : 10 : : static void 11 : 428 : ublk_subsystem_init(void) 12 : : { 13 : 428 : spdk_ublk_init(); 14 : 428 : spdk_subsystem_init_next(0); 15 : 428 : } 16 : : 17 : : static void 18 : 428 : ublk_subsystem_fini_done(void *arg) 19 : : { 20 : 428 : spdk_subsystem_fini_next(); 21 : 428 : } 22 : : 23 : : static void 24 : 428 : ublk_subsystem_fini(void) 25 : : { 26 : : int rc; 27 : : 28 : 428 : rc = spdk_ublk_fini(ublk_subsystem_fini_done, NULL); 29 [ - + ]: 428 : if (rc != 0) { 30 : 0 : ublk_subsystem_fini_done(NULL); 31 : : } 32 : 428 : } 33 : : 34 : : static void 35 : 76 : ublk_subsystem_write_config_json(struct spdk_json_write_ctx *w) 36 : : { 37 : 76 : spdk_ublk_write_config_json(w); 38 : 76 : } 39 : : 40 : : static struct spdk_subsystem g_spdk_subsystem_ublk = { 41 : : .name = "ublk", 42 : : .init = ublk_subsystem_init, 43 : : .fini = ublk_subsystem_fini, 44 : : .write_config_json = ublk_subsystem_write_config_json, 45 : : }; 46 : : 47 : 486 : SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_ublk); 48 : 486 : SPDK_SUBSYSTEM_DEPEND(ublk, bdev)