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
F103976567: D32957.diff
Sun, Dec 1, 11:10 PM
Unknown Object (File)
Fri, Nov 29, 9:41 PM
Unknown Object (File)
Oct 16 2024, 11:09 AM
Unknown Object (File)
Oct 16 2024, 9:13 AM
Unknown Object (File)
Oct 9 2024, 12:05 PM
Unknown Object (File)
Oct 6 2024, 7:13 AM
Unknown Object (File)
Oct 3 2024, 5:47 AM
Unknown Object (File)
Sep 30 2024, 1:37 PM

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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42978
Build 39866: arc lint + arc unit

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.