Commit d78e3bbf authored by Pawel Wodkowski's avatar Pawel Wodkowski Committed by Jim Harris
Browse files

bdev/error: add JSON config dump



Change-Id: Iaaf2c3438d28e03977f031b8d3b999086a73bfe5
Signed-off-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/401221


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 74f0dfd9
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -80,12 +80,14 @@ static int vbdev_error_init(void);
static void vbdev_error_fini(void);

static void vbdev_error_examine(struct spdk_bdev *bdev);
static int vbdev_error_config_json(struct spdk_json_write_ctx *w);

static struct spdk_bdev_module error_if = {
	.name = "error",
	.module_init = vbdev_error_init,
	.module_fini = vbdev_error_fini,
	.examine = vbdev_error_examine,
	.config_json = vbdev_error_config_json,

};

@@ -228,10 +230,18 @@ vbdev_error_dump_info_json(void *ctx, struct spdk_json_write_ctx *w)
	return 0;
}

static void
vbdev_error_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
{
	/* No config per bdev. */
}


static struct spdk_bdev_fn_table vbdev_error_fn_table = {
	.destruct		= vbdev_error_destruct,
	.submit_request		= vbdev_error_submit_request,
	.dump_info_json		= vbdev_error_dump_info_json,
	.write_config_json	= vbdev_error_write_config_json
};

static void
@@ -383,3 +393,22 @@ vbdev_error_examine(struct spdk_bdev *bdev)

	spdk_bdev_module_examine_done(&error_if);
}

static int
vbdev_error_config_json(struct spdk_json_write_ctx *w)
{
	struct spdk_vbdev_error_config *cfg;

	TAILQ_FOREACH(cfg, &g_error_config, tailq) {
		spdk_json_write_object_begin(w);

		spdk_json_write_named_string(w, "method", "construct_error_bdev");
		spdk_json_write_named_object_begin(w, "params");
		spdk_json_write_named_string(w, "base_name", cfg->base_bdev);
		spdk_json_write_object_end(w);

		spdk_json_write_object_end(w);
	}

	return 0;
}