Define a options structure, malloc_bdev_opts, and use it directly for the bdev_malloc_create RPC. To do this, bdev_malloc.h includes bdev_module.h instead of bdev.h to have the definition of the struct spdk_uuid, and the struct malloc_bdev_opts has a instance of struct spdk_uuid. Clean up file inclusion together. Furthermore, use spdk_uuid_copy() to copy uuid from the malloc_bdev_opts to the malloc disk rather than the = operator, and remove a duplicated size check. These are helpful to add more parameters for creation. Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: Ief25f12586c21b1666180ce10cfc6256ede8eba9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14982 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
29 lines
731 B
C
29 lines
731 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (c) Intel Corporation.
|
|
* All rights reserved.
|
|
* Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
*/
|
|
|
|
#ifndef SPDK_BDEV_MALLOC_H
|
|
#define SPDK_BDEV_MALLOC_H
|
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
#include "spdk/bdev_module.h"
|
|
|
|
typedef void (*spdk_delete_malloc_complete)(void *cb_arg, int bdeverrno);
|
|
|
|
struct malloc_bdev_opts {
|
|
char *name;
|
|
struct spdk_uuid uuid;
|
|
uint64_t num_blocks;
|
|
uint32_t block_size;
|
|
uint32_t optimal_io_boundary;
|
|
};
|
|
|
|
int create_malloc_disk(struct spdk_bdev **bdev, const struct malloc_bdev_opts *opts);
|
|
|
|
void delete_malloc_disk(const char *name, spdk_delete_malloc_complete cb_fn, void *cb_arg);
|
|
|
|
#endif /* SPDK_BDEV_MALLOC_H */
|