libnvme/fabrics, json: replace fprintf to nvme_msg and dprintf#3099
libnvme/fabrics, json: replace fprintf to nvme_msg and dprintf#3099ikegami-t wants to merge 1 commit intolinux-nvme:masterfrom
Conversation
Since the struct nvme_global_ctx is available. Signed-off-by: Tokunori Ikegami <[email protected]>
27151a2 to
60fa630
Compare
| printf("\n"); | ||
| } else | ||
| dprintf(ctx->log.fd, "\n"); | ||
| } else { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
but this should be a dfifferent patch.
There was a problem hiding this comment.
Okay will update the API. Thank you.
There was a problem hiding this comment.
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.
Since the struct nvme_global_ctx is available.