2022-06-03 19:15:11 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2022-11-01 20:26:26 +00:00
|
|
|
* Copyright (C) 2017 Intel Corporation. All rights reserved.
|
2019-08-02 08:53:42 +00:00
|
|
|
* Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
|
2017-05-05 17:50:46 +00:00
|
|
|
*/
|
|
|
|
|
2017-07-13 04:08:53 +00:00
|
|
|
#ifndef SPDK_BDEV_NULL_H
|
|
|
|
#define SPDK_BDEV_NULL_H
|
2017-05-05 17:50:46 +00:00
|
|
|
|
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
|
2018-06-22 07:42:57 +00:00
|
|
|
typedef void (*spdk_delete_null_complete)(void *cb_arg, int bdeverrno);
|
|
|
|
|
2017-05-05 17:50:46 +00:00
|
|
|
struct spdk_bdev;
|
2018-03-08 21:39:21 +00:00
|
|
|
struct spdk_uuid;
|
2017-05-05 17:50:46 +00:00
|
|
|
|
2019-08-02 08:53:42 +00:00
|
|
|
struct spdk_null_bdev_opts {
|
|
|
|
const char *name;
|
|
|
|
const struct spdk_uuid *uuid;
|
|
|
|
uint64_t num_blocks;
|
|
|
|
uint32_t block_size;
|
2023-02-14 11:21:56 +00:00
|
|
|
uint32_t physical_block_size;
|
2019-07-31 08:55:54 +00:00
|
|
|
uint32_t md_size;
|
|
|
|
bool md_interleave;
|
2019-08-01 08:00:42 +00:00
|
|
|
enum spdk_dif_type dif_type;
|
|
|
|
bool dif_is_head_of_md;
|
2019-08-02 08:53:42 +00:00
|
|
|
};
|
|
|
|
|
2019-08-20 13:06:22 +00:00
|
|
|
int bdev_null_create(struct spdk_bdev **bdev, const struct spdk_null_bdev_opts *opts);
|
2017-05-05 17:50:46 +00:00
|
|
|
|
2018-06-22 07:42:57 +00:00
|
|
|
/**
|
|
|
|
* Delete null bdev.
|
|
|
|
*
|
2022-03-29 05:55:53 +00:00
|
|
|
* \param bdev_name Name of null bdev.
|
2018-06-22 07:42:57 +00:00
|
|
|
* \param cb_fn Function to call after deletion.
|
|
|
|
* \param cb_arg Argument to pass to cb_fn.
|
|
|
|
*/
|
2022-03-29 05:55:53 +00:00
|
|
|
void bdev_null_delete(const char *bdev_name, spdk_delete_null_complete cb_fn,
|
2018-06-22 07:42:57 +00:00
|
|
|
void *cb_arg);
|
2021-01-06 13:21:52 +00:00
|
|
|
/**
|
|
|
|
* Resize null bdev.
|
|
|
|
*
|
2022-03-29 07:44:58 +00:00
|
|
|
* \param bdev_name Name of null bdev.
|
2021-01-06 13:21:52 +00:00
|
|
|
* \param new_size_in_mb The new size in MiB for this bdev
|
|
|
|
*/
|
2022-03-29 07:44:58 +00:00
|
|
|
int bdev_null_resize(const char *bdev_name, const uint64_t new_size_in_mb);
|
2018-06-22 07:42:57 +00:00
|
|
|
|
2017-07-13 04:08:53 +00:00
|
|
|
#endif /* SPDK_BDEV_NULL_H */
|