Skip to content

libnvme/fabrics, json: replace fprintf to nvme_msg and dprintf#3099

Open
ikegami-t wants to merge 1 commit intolinux-nvme:masterfrom
ikegami-t:libnvme-nvme-msg-2
Open

libnvme/fabrics, json: replace fprintf to nvme_msg and dprintf#3099
ikegami-t wants to merge 1 commit intolinux-nvme:masterfrom
ikegami-t:libnvme-nvme-msg-2

Conversation

@ikegami-t
Copy link
Contributor

Since the struct nvme_global_ctx is available.

Since the struct nvme_global_ctx is available.

Signed-off-by: Tokunori Ikegami <[email protected]>
printf("\n");
} else
dprintf(ctx->log.fd, "\n");
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait. I got this wrong. When config_file is NULL, the function is supposed to write it to stdout. The previous line json_object_to_fd opens stdout.

I think we should update this API by asking for a file descriptor instead of a file name, so that the caller decides where the json output goes.

int json_update_config(struct nvme_global_ctx *ctx, int fd)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this should be a dfifferent patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay will update the API. Thank you.

Copy link
Contributor Author

@ikegami-t ikegami-t Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this should be a dfifferent patch.

Sorry I missed this comment. So can we remain the API for now since just pushed the fix as below then currently the PR changes works work correctly?

- 		dprintf(ctx->log.fd, "\n");
+ 		dprintf(1, "\n");

By the way seems also the current API is convinient for the caller to remain the config_file parameter and if NULL is set then used stdout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants