Since ublk_start_disk internally runs ublk_ctrl_cmd asynchorously, the result should be returned after the whole process of ublk_start_disk is completed. Add a callback into ublk_start_disk parameter, and change rpc_ublk_start_disk to send response in callback. Change-Id: Icc0d9e8cb81f2b67bf99fdead423bfe8159714bc Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16500 Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (C) 2022 Intel Corporation.
|
|
* All rights reserved.
|
|
*/
|
|
/** \file
|
|
* Userspace block device layer
|
|
*/
|
|
#ifndef SPDK_UBLK_INTERNAL_H
|
|
#define SPDK_UBLK_INTERNAL_H
|
|
|
|
#include "spdk/ublk.h"
|
|
|
|
#define UBLK_DEV_QUEUE_DEPTH 128
|
|
#define UBLK_DEV_NUM_QUEUE 1
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef void (*ublk_start_cb)(void *cb_arg, int result);
|
|
typedef void (*ublk_del_cb)(void *cb_arg);
|
|
|
|
int ublk_create_target(const char *cpumask_str);
|
|
int ublk_destroy_target(spdk_ublk_fini_cb cb_fn, void *cb_arg);
|
|
int ublk_start_disk(const char *bdev_name, uint32_t ublk_id,
|
|
uint32_t num_queues, uint32_t queue_depth,
|
|
ublk_start_cb start_cb, void *cb_arg);
|
|
int ublk_stop_disk(uint32_t ublk_id, ublk_del_cb del_cb, void *cb_arg);
|
|
struct spdk_ublk_dev *ublk_dev_find_by_id(uint32_t ublk_id);
|
|
uint32_t ublk_dev_get_id(struct spdk_ublk_dev *ublk);
|
|
const char *ublk_dev_get_bdev_name(struct spdk_ublk_dev *ublk);
|
|
struct spdk_ublk_dev *ublk_dev_first(void);
|
|
struct spdk_ublk_dev *ublk_dev_next(struct spdk_ublk_dev *prev);
|
|
uint32_t ublk_dev_get_queue_depth(struct spdk_ublk_dev *ublk);
|
|
uint32_t ublk_dev_get_num_queues(struct spdk_ublk_dev *ublk);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SPDK_UBLK_INTERNAL_H */
|