Skip to contentSkip to conversation

bcache: improve bch_hprint() output

PATCH In review [email protected] 1 participant 2 messages Oct 8, 2022 – Jan 9, 2023 bcache (block layer cache)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcache: improve bch_hprint() output

From: mingzhe <[email protected]>

The current suffix of bch_hprint() uses the SI (The International System of Units) standard. In the SI brochure, the symbol for the kilo prefix is k instead of K. Because K is the symbol for the thermodynamic temperature unit kelvin.

In fact, SI is based on decimal not binary. However, bch_hprint() is binary based, so it should conform to the IEC 60027-2 (Letter symbols to be used in electrical technology - Part 2: Telecommunications and electronics) standard.

---
 drivers/md/bcache/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/util.c +1 -1
index ae380bc3992e..91ab36ec2deb 100644
@@ -91,7 +91,7 @@ STRTO_H(strtoull, unsigned long long)
  */
 ssize_t bch_hprint(char *buf, int64_t v)
 {
-	static const char units[] = "?kMGTPEZY";
+	static const char units[] = "?KMGTPEZY";
 	int u = 0, t;
 
 	uint64_t q;
Signature · 1 line
2.17.1
author
#1 lore raw

Hi Coly

This is a simple fix. And when use numfmt, we will get error.

mingzhe

From: [email protected]
Date: 2022-10-08 16:56:30
To: [email protected],[email protected]
Cc: [email protected]
Subject: [PATCH] bcache: improve bch_hprint() output>From: mingzhe <[email protected]>

Quoted 30 lines

The current suffix of bch_hprint() uses the SI (The International System of Units) standard. In the SI brochure, the symbol for the kilo prefix is k instead of K. Because K is the symbol for the thermodynamic temperature unit kelvin.

In fact, SI is based on decimal not binary. However, bch_hprint() is binary based, so it should conform to the IEC 60027-2 (Letter symbols to be used in electrical technology - Part 2: Telecommunications and electronics) standard.

---
drivers/md/bcache/util.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/util.c +1 -1
index ae380bc3992e..91ab36ec2deb 100644
@@ -91,7 +91,7 @@ STRTO_H(strtoull, unsigned long long)
 */
 ssize_t bch_hprint(char *buf, int64_t v)
 {
-	static const char units[] = "?kMGTPEZY";
+	static const char units[] = "?KMGTPEZY";
 	int u = 0, t;
 
 	uint64_t q;
Signature · 1 line
2.17.1