bdev/null: add JSON config dump
Change-Id: I491df77bd451e8dc60bdaee3b72ad20c1b852e86 Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/401218 Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
856a96a7a9
commit
010af134ec
@ -37,6 +37,7 @@
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/io_channel.h"
|
||||
#include "spdk/json.h"
|
||||
|
||||
#include "spdk_internal/bdev.h"
|
||||
#include "spdk_internal/log.h"
|
||||
@ -130,11 +131,28 @@ bdev_null_get_io_channel(void *ctx)
|
||||
return spdk_get_io_channel(&g_null_bdev_head);
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_null_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
|
||||
{
|
||||
spdk_json_write_object_begin(w);
|
||||
|
||||
spdk_json_write_named_string(w, "method", "construct_null_bdev");
|
||||
|
||||
spdk_json_write_named_object_begin(w, "params");
|
||||
spdk_json_write_named_string(w, "name", bdev->name);
|
||||
spdk_json_write_named_uint64(w, "num_blocks", bdev->blockcnt);
|
||||
spdk_json_write_named_uint32(w, "block_size", bdev->blocklen);
|
||||
spdk_json_write_object_end(w);
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
|
||||
static const struct spdk_bdev_fn_table null_fn_table = {
|
||||
.destruct = bdev_null_destruct,
|
||||
.submit_request = bdev_null_submit_request,
|
||||
.io_type_supported = bdev_null_io_type_supported,
|
||||
.get_io_channel = bdev_null_get_io_channel,
|
||||
.write_config_json = bdev_null_write_config_json,
|
||||
};
|
||||
|
||||
struct spdk_bdev *
|
||||
|
Loading…
Reference in New Issue
Block a user