From b10dac2c7887192fb0b64fab46153ffff5a2b012 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 13 Oct 2017 16:11:17 -0700 Subject: [PATCH] bdev/lvol: add module name to driver_specific JSON This allows the caller to know which bdev module is exporting the bdev and therefore how to interpret the driver_specific fields. Change-Id: I09641645875827eabc0a831fff5b0b5bed6b03d0 Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/382519 Tested-by: SPDK Automated Test System Reviewed-by: Dariusz Stojaczyk Reviewed-by: Jim Harris --- lib/bdev/lvol/vbdev_lvol.c | 5 +++++ test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/bdev/lvol/vbdev_lvol.c b/lib/bdev/lvol/vbdev_lvol.c index e0697d3ec8..6112e278fd 100644 --- a/lib/bdev/lvol/vbdev_lvol.c +++ b/lib/bdev/lvol/vbdev_lvol.c @@ -300,12 +300,17 @@ vbdev_lvol_dump_config_json(void *ctx, struct spdk_json_write_ctx *w) struct lvol_store_bdev *lvs_bdev; struct spdk_bdev *bdev; + spdk_json_write_name(w, "lvol"); + spdk_json_write_object_begin(w); + lvs_bdev = vbdev_get_lvs_bdev_by_lvs(lvol->lvol_store); bdev = lvs_bdev->bdev; spdk_json_write_name(w, "base_bdev"); spdk_json_write_string(w, spdk_bdev_get_name(bdev)); + spdk_json_write_object_end(w); + return 0; } diff --git a/test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c b/test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c index ebe40d56cc..4205166e08 100644 --- a/test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c +++ b/test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c @@ -262,6 +262,18 @@ spdk_json_write_string(struct spdk_json_write_ctx *w, const char *val) return 0; } +int +spdk_json_write_object_begin(struct spdk_json_write_ctx *w) +{ + return 0; +} + +int +spdk_json_write_object_end(struct spdk_json_write_ctx *w) +{ + return 0; +} + const char * spdk_bdev_get_name(const struct spdk_bdev *bdev) {