diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-02-20 10:52:44 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:24 +0200 |
commit | d4b691522c4b60220087a01c276f3fa9781405b0 (patch) | |
tree | 9d0f71f559183ce1f2f3c025d365152020b5856d /fs/bcachefs/disk_groups.c | |
parent | bcachefs: Don't issue discards when in nochanges mode (diff) | |
download | linux-d4b691522c4b60220087a01c276f3fa9781405b0.tar.xz linux-d4b691522c4b60220087a01c276f3fa9781405b0.zip |
bcachefs: Kill bch_scnmemcpy()
bch_scnmemcpy was for printing length-limited strings that might not
have a terminating null - turns out sprintf & pr_buf can do this with
%.*s.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/disk_groups.c')
-rw-r--r-- | fs/bcachefs/disk_groups.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/bcachefs/disk_groups.c b/fs/bcachefs/disk_groups.c index a27fc4fb60d5..e411606fd38d 100644 --- a/fs/bcachefs/disk_groups.c +++ b/fs/bcachefs/disk_groups.c @@ -76,8 +76,9 @@ static int bch2_sb_disk_groups_validate(struct bch_sb *sb, for (g = sorted; g + 1 < sorted + nr_groups; g++) if (!BCH_GROUP_DELETED(g) && !group_cmp(&g[0], &g[1])) { - pr_buf(err, "duplicate label %llu.", BCH_GROUP_PARENT(g)); - bch_scnmemcpy(err, g->label, strnlen(g->label, sizeof(g->label))); + pr_buf(err, "duplicate label %llu.%.*s", + BCH_GROUP_PARENT(g), + (int) sizeof(g->label), g->label); goto err; } @@ -376,9 +377,7 @@ void bch2_disk_path_to_text(struct printbuf *out, v = path[--nr]; g = groups->entries + v; - bch_scnmemcpy(out, g->label, - strnlen(g->label, sizeof(g->label))); - + pr_buf(out, "%.*s", (int) sizeof(g->label), g->label); if (nr) pr_buf(out, "."); } |