1488570ebSJim Harris /* SPDX-License-Identifier: BSD-3-Clause 2a6dbe372Spaul luse * Copyright (C) 2017 Intel Corporation. All rights reserved. 307fe6a43SSeth Howell * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. 407fe6a43SSeth Howell */ 507fe6a43SSeth Howell 607fe6a43SSeth Howell #ifndef SPDK_BDEV_NULL_H 707fe6a43SSeth Howell #define SPDK_BDEV_NULL_H 807fe6a43SSeth Howell 907fe6a43SSeth Howell #include "spdk/stdinc.h" 1007fe6a43SSeth Howell 1107fe6a43SSeth Howell typedef void (*spdk_delete_null_complete)(void *cb_arg, int bdeverrno); 1207fe6a43SSeth Howell 1307fe6a43SSeth Howell struct spdk_bdev; 1407fe6a43SSeth Howell struct spdk_uuid; 1507fe6a43SSeth Howell 1636943038SShuhei Matsumoto struct null_bdev_opts { 1736943038SShuhei Matsumoto char *name; 1836943038SShuhei Matsumoto struct spdk_uuid uuid; 1907fe6a43SSeth Howell uint64_t num_blocks; 2007fe6a43SSeth Howell uint32_t block_size; 217f50da15SPanfil, Wojciech uint32_t physical_block_size; 22f1209426SEvgeniy Kochetov uint32_t md_size; 2365848d0cSEvgeniy Kochetov enum spdk_dif_type dif_type; 2465848d0cSEvgeniy Kochetov bool dif_is_head_of_md; 25*1521bf3bSShuhei Matsumoto enum spdk_dif_pi_format dif_pi_format; 2607fe6a43SSeth Howell }; 2707fe6a43SSeth Howell 2836943038SShuhei Matsumoto int bdev_null_create(struct spdk_bdev **bdev, const struct null_bdev_opts *opts); 2907fe6a43SSeth Howell 3007fe6a43SSeth Howell /** 3107fe6a43SSeth Howell * Delete null bdev. 3207fe6a43SSeth Howell * 334573e4ccSShuhei Matsumoto * \param bdev_name Name of null bdev. 3407fe6a43SSeth Howell * \param cb_fn Function to call after deletion. 3507fe6a43SSeth Howell * \param cb_arg Argument to pass to cb_fn. 3607fe6a43SSeth Howell */ 374573e4ccSShuhei Matsumoto void bdev_null_delete(const char *bdev_name, spdk_delete_null_complete cb_fn, 3807fe6a43SSeth Howell void *cb_arg); 39d0657f32SJin Yu /** 40d0657f32SJin Yu * Resize null bdev. 41d0657f32SJin Yu * 4202e3c62cSShuhei Matsumoto * \param bdev_name Name of null bdev. 43d0657f32SJin Yu * \param new_size_in_mb The new size in MiB for this bdev 44d0657f32SJin Yu */ 4502e3c62cSShuhei Matsumoto int bdev_null_resize(const char *bdev_name, const uint64_t new_size_in_mb); 4607fe6a43SSeth Howell 4707fe6a43SSeth Howell #endif /* SPDK_BDEV_NULL_H */ 48