Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme-print-json: update JSON verbose output for nvm-id-ctrl #2524

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nvme-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,15 @@ static void json_nvme_id_ctrl_nvm(struct nvme_id_ctrl_nvm *ctrl_nvm)
obj_add_uint64(r, "dmsl", le64_to_cpu(ctrl_nvm->dmsl));
obj_add_uint(r, "aocs", le16_to_cpu(ctrl_nvm->aocs));

if (json_print_ops.flags & VERBOSE) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should always print everything. For me the verbose flag makes only sense for the stdout output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel it helps. And also maintains consistency with the JSON verbose outputs of other basic commands such as list -v -o json , list-subsys -v -o json, etc.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My point is that the json output could always print everything, no need make it short. Anyway, your change is fine, let's go with it, I ponder a bit if we should just kill the 'verbose' flag in the json output.

__u16 rsvd = (ctrl_nvm->aocs & 0xfffe) >> 1;
__u8 ralbas = ctrl_nvm->aocs & 0x1;

if (rsvd)
obj_add_uint(r, "[15:1]: Reserved", rsvd);
obj_add_uint(r, "[0:0]: Reporting Allocated LBA Supported", ralbas);
}

json_print(r);
}

Expand Down