summaryrefslogtreecommitdiff
path: root/misc-utils/lsblk.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r--misc-utils/lsblk.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 6c5a205d..745a3e61 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -235,52 +235,6 @@ static struct dirent *xreaddir(DIR *dp)
return d;
}
-/*
- * returns exponent (2^x=n) in range KiB..PiB
- */
-static int get_exp(uint64_t n)
-{
- int shft;
-
- for (shft = 10; shft <= 60; shft += 10) {
- if (n < (1ULL << shft))
- break;
- }
- return shft - 10;
-}
-
-static char *size_to_human_string(uint64_t bytes)
-{
- char buf[32];
- int dec, frac, exp;
- const char *letters = "BKMGTP";
- char c;
-
- exp = get_exp(bytes);
- c = *(letters + (exp ? exp / 10 : 0));
- dec = exp ? bytes / (1ULL << exp) : bytes;
- frac = exp ? bytes % (1ULL << exp) : 0;
-
- if (frac) {
- /* round */
- frac = (frac / (1ULL << (exp - 10)) + 50) / 100;
- if (frac == 10)
- dec++, frac = 0;
- }
-
- if (frac) {
- struct lconv const *l = localeconv();
- char *dp = l ? l->decimal_point : NULL;
-
- if (!dp || !*dp)
- dp = ".";
- snprintf(buf, sizeof(buf), "%d%s%d%c", dec, dp, frac, c);
- } else
- snprintf(buf, sizeof(buf), "%d%c", dec, c);
-
- return xstrdup(buf);
-}
-
static int is_partition_dirent(DIR *dir, struct dirent *d, const char *parent_name)
{