diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-02-22 10:53:48 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:24 +0200 |
commit | 702a4ef07774fbc565f3e567073d2f83f9602667 (patch) | |
tree | 2a3075cca3b847265a4c5d345b40e53cf9f684e8 /fs/bcachefs/util.c | |
parent | bcachefs: Fix a use after free (diff) | |
download | linux-702a4ef07774fbc565f3e567073d2f83f9602667.tar.xz linux-702a4ef07774fbc565f3e567073d2f83f9602667.zip |
bcachefs: Add tabstops to printbufs
Now, when outputting to printbufs, we can set tabstops and left or right
justify text to them - this is to be used by the userspace 'bcachefs fs
usage' command.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/util.c')
-rw-r--r-- | fs/bcachefs/util.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c index f170cf9d5052..a330fa30cd79 100644 --- a/fs/bcachefs/util.c +++ b/fs/bcachefs/util.c @@ -117,17 +117,11 @@ void bch2_hprint(struct printbuf *buf, s64 v) if (u && t && v < 100 && v > -100) pr_buf(buf, ".%i", t / 103); if (u) - pr_buf(buf, "%c", si_units[u]); + pr_char(buf, si_units[u]); } void bch2_pr_units(struct printbuf *out, s64 raw, s64 bytes) { - if (raw < 0) { - pr_buf(out, "-"); - raw = -raw; - bytes = -bytes; - } - switch (out->units) { case PRINTBUF_UNITS_RAW: pr_buf(out, "%llu", raw); |