Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153825036
D32957.id98396.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
943 B
Referenced Files
None
Subscribers
None
D32957.id98396.diff
View Options
Index: sbin/nvmecontrol/devlist.c
===================================================================
--- sbin/nvmecontrol/devlist.c
+++ sbin/nvmecontrol/devlist.c
@@ -81,8 +81,10 @@
struct nvme_namespace_data nsdata;
char name[64];
uint8_t mn[64];
- uint32_t i;
+ uint32_t i, j;
+ uint64_t size;
int ctrlr, fd, found, ret;
+ const char *unit = "YZEPTGMK";
if (arg_parse(argc, argv, f))
return;
@@ -115,11 +117,14 @@
continue;
sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr,
NVME_NS_PREFIX, i + 1);
- printf(" %10s (%lldMB)\n",
- name,
- nsdata.nsze *
- (long long)ns_get_sector_size(&nsdata) /
- 1024 / 1024);
+ size = nsdata.nsze * (uint64_t)ns_get_sector_size(&nsdata);
+ for (j = strlen(unit); j >= 0; j--) {
+ if (j == 0 || size < 10240) {
+ printf(" %10s (%lu%cB)\n", name, size, unit[j]);
+ break;
+ }
+ size /= 1024;
+ }
}
close(fd);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 25, 1:22 AM (20 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32102674
Default Alt Text
D32957.id98396.diff (943 B)
Attached To
Mode
D32957: nvmecontrol: improve namespace size unit of devlist command output
Attached
Detach File
Event Timeline
Log In to Comment