Page MenuHomeFreeBSD

nvmecontrol: improve namespace size unit of devlist command output
ClosedPublic

Authored by wanpengqian_gmail.com on Nov 12 2021, 5:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
May 23 2024, 7:37 PM
Unknown Object (File)
May 23 2024, 7:37 PM
Unknown Object (File)
May 23 2024, 7:37 PM
Unknown Object (File)
May 23 2024, 7:37 PM
Unknown Object (File)
May 23 2024, 7:37 PM
Unknown Object (File)
May 20 2024, 2:21 PM
Unknown Object (File)
May 1 2024, 5:25 AM
Unknown Object (File)
Apr 27 2024, 4:40 AM

Details

Summary

Add an option of -h --human to output human readable size unit instead of the fixed unit (MB).

Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>

Test Plan

For vary disk sizes, check the command output.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sbin/nvmecontrol/devlist.c
140

When j == strlen(unit), which %c is \0, printf will not output the char. I search the web, people say it will teminate the output here. but the test seems OK.

use humanize_number() instead of new wheel.

pauamma_gundo.com added inline comments.
sbin/nvmecontrol/nvmecontrol.8
219

Maybe also s/shows in/uses/ for consistency with the previous sentence, but that's a matter of taste. The typo itself is the important thing.

fix typo and modify words as comment suggested.

Add a B suffix to match the default one.

Looks good to me.
For me to commit it, I need either a 'Signed-off-by:' line or email imp@bsdimp.com a git-format-patch bundle with your preferred author name.

sbin/nvmecontrol/devlist.c
103

why 7?

This revision is now accepted and ready to land.Dec 3 2021, 4:18 PM

I have added the 'Signed-off-by:' line.

sbin/nvmecontrol/devlist.c
103

The /bin/df uses 6, since we have an extra suffix "B", I use 7 to match the result of df. The output contains 4 digits. it is readable yet enough to get more information.

bcr added a subscriber: bcr.

Man page also looks good now.

I'll use an author name of 'Wanpeng Qian <wanpengqian@gmail.com>' to commit this.
Please confirm.

oh, I'm committing now, missed the signed-off-by line.