diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-11-09 01:24:07 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:11 -0400 |
commit | 319f9ac38eaba628d69b6ddbf402b35487315fc1 (patch) | |
tree | 01daddd4881b1f09bb4d50087e8b8803e59fea35 /fs/bcachefs/dirent.c | |
parent | 75369d4ec3d2dfc52af18a2d20cd0af14c935ac9 (diff) | |
download | lwn-319f9ac38eaba628d69b6ddbf402b35487315fc1.tar.gz lwn-319f9ac38eaba628d69b6ddbf402b35487315fc1.zip |
bcachefs: revamp to_text methods
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/dirent.c')
-rw-r--r-- | fs/bcachefs/dirent.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c index 0651f5575131..c1a611b4d9ec 100644 --- a/fs/bcachefs/dirent.c +++ b/fs/bcachefs/dirent.c @@ -110,26 +110,23 @@ const char *bch2_dirent_invalid(const struct bch_fs *c, struct bkey_s_c k) } } -int bch2_dirent_to_text(struct bch_fs *c, char *buf, - size_t size, struct bkey_s_c k) +void bch2_dirent_to_text(struct printbuf *out, struct bch_fs *c, + struct bkey_s_c k) { - char *out = buf, *end = buf + size; struct bkey_s_c_dirent d; switch (k.k->type) { case BCH_DIRENT: d = bkey_s_c_to_dirent(k); - out += bch_scnmemcpy(out, end - out, d.v->d_name, - bch2_dirent_name_bytes(d)); - out += scnprintf(out, end - out, " -> %llu", d.v->d_inum); + bch_scnmemcpy(out, d.v->d_name, + bch2_dirent_name_bytes(d)); + pr_buf(out, " -> %llu", d.v->d_inum); break; case BCH_DIRENT_WHITEOUT: - out += scnprintf(out, end - out, "whiteout"); + pr_buf(out, "whiteout"); break; } - - return out - buf; } static struct bkey_i_dirent *dirent_create_key(struct btree_trans *trans, |