Commit 69f9c9ac authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

lib, module: use spdk_json_write_named_uuid



Use spdk_json_write_named_uuid everywhere possible, instead of the older
spdk_uuid_fmt_lower+spdk_json_write_named_string approach.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: I75f97efb6e88fdb032f7ae94f11039457ba70f2a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20562


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent c5d5b92c
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -539,7 +539,6 @@ nvmf_write_subsystem_config_json(struct spdk_json_write_ctx *w,
	struct spdk_nvmf_ns *ns;
	struct spdk_nvmf_ns_opts ns_opts;
	uint32_t max_namespaces;
	char uuid_str[SPDK_UUID_STRING_LEN];
	struct spdk_nvmf_transport *transport;

	if (spdk_nvmf_subsystem_get_type(subsystem) != SPDK_NVMF_SUBTYPE_NVME) {
@@ -627,8 +626,7 @@ nvmf_write_subsystem_config_json(struct spdk_json_write_ctx *w,
		}

		if (!spdk_uuid_is_null(&ns_opts.uuid)) {
			spdk_uuid_fmt_lower(uuid_str, sizeof(uuid_str), &ns_opts.uuid);
			spdk_json_write_named_string(w, "uuid",  uuid_str);
			spdk_json_write_named_uuid(w, "uuid",  &ns_opts.uuid);
		}

		if (nvmf_subsystem_get_ana_reporting(subsystem)) {
+1 −3
Original line number Diff line number Diff line
@@ -557,7 +557,6 @@ bdev_daos_get_io_channel(void *ctx)
static void
bdev_daos_write_json_config(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
{
	char uuid_str[SPDK_UUID_STRING_LEN];
	struct bdev_daos *daos = bdev->ctxt;

	spdk_json_write_object_begin(w);
@@ -570,8 +569,7 @@ bdev_daos_write_json_config(struct spdk_bdev *bdev, struct spdk_json_write_ctx *
	spdk_json_write_named_string(w, "cont", daos->cont_name);
	spdk_json_write_named_uint64(w, "num_blocks", bdev->blockcnt);
	spdk_json_write_named_uint32(w, "block_size", bdev->blocklen);
	spdk_uuid_fmt_lower(uuid_str, sizeof(uuid_str), &bdev->uuid);
	spdk_json_write_named_string(w, "uuid", uuid_str);
	spdk_json_write_named_uuid(w, "uuid", &bdev->uuid);

	spdk_json_write_object_end(w);

+1 −3
Original line number Diff line number Diff line
@@ -506,13 +506,11 @@ static void
_delay_write_conf_values(struct vbdev_delay *delay_node, struct spdk_json_write_ctx *w)
{
	struct spdk_uuid *uuid = &delay_node->delay_bdev.uuid;
	char uuid_str[SPDK_UUID_STRING_LEN];

	spdk_json_write_named_string(w, "name", spdk_bdev_get_name(&delay_node->delay_bdev));
	spdk_json_write_named_string(w, "base_bdev_name", spdk_bdev_get_name(delay_node->base_bdev));
	if (!spdk_uuid_is_null(uuid)) {
		spdk_uuid_fmt_lower(uuid_str, sizeof(uuid_str), uuid);
		spdk_json_write_named_string(w, "uuid", uuid_str);
		spdk_json_write_named_uuid(w, "uuid", uuid);
	}
	spdk_json_write_named_int64(w, "avg_read_latency",
				    delay_node->average_read_latency_ticks * SPDK_SEC_TO_USEC / spdk_get_ticks_hz());
+1 −3
Original line number Diff line number Diff line
@@ -533,7 +533,6 @@ static int
vbdev_error_config_json(struct spdk_json_write_ctx *w)
{
	struct spdk_vbdev_error_config *cfg;
	char uuid_str[SPDK_UUID_STRING_LEN];

	TAILQ_FOREACH(cfg, &g_error_config, tailq) {
		spdk_json_write_object_begin(w);
@@ -542,8 +541,7 @@ vbdev_error_config_json(struct spdk_json_write_ctx *w)
		spdk_json_write_named_object_begin(w, "params");
		spdk_json_write_named_string(w, "base_name", cfg->base_bdev);
		if (!spdk_uuid_is_null(&cfg->uuid)) {
			spdk_uuid_fmt_lower(uuid_str, sizeof(uuid_str), &cfg->uuid);
			spdk_json_write_named_string(w, "uuid", uuid_str);
			spdk_json_write_named_uuid(w, "uuid", &cfg->uuid);
		}
		spdk_json_write_object_end(w);

+1 −3
Original line number Diff line number Diff line
@@ -213,7 +213,6 @@ bdev_ftl_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w
{
	struct ftl_bdev *ftl_bdev = bdev->ctxt;
	struct spdk_ftl_conf conf;
	char uuid[SPDK_UUID_STRING_LEN];

	spdk_ftl_dev_get_conf(ftl_bdev->dev, &conf, sizeof(conf));

@@ -231,8 +230,7 @@ bdev_ftl_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w
		spdk_json_write_named_string(w, "core_mask", conf.core_mask);
	}

	spdk_uuid_fmt_lower(uuid, sizeof(uuid), &conf.uuid);
	spdk_json_write_named_string(w, "uuid", uuid);
	spdk_json_write_named_uuid(w, "uuid", &conf.uuid);

	spdk_json_write_named_bool(w, "fast_shutdown", conf.fast_shutdown);

Loading