bcachefs: Ensure sysfs show fns print a newline
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 15 Apr 2022 00:30:30 +0000 (20:30 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:31 +0000 (17:09 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/sysfs.c

index c0cc6e9a3e0550193a91c85cefcb9e08a9177e3d..24180d98fe81a46de17731b671c8671a5f3df175 100644 (file)
@@ -55,6 +55,9 @@ static ssize_t fn ## _show(struct kobject *kobj, struct attribute *attr,\
        struct printbuf out = PRINTBUF;                                 \
        ssize_t ret = fn ## _to_text(&out, kobj, attr);                 \
                                                                        \
+       if (out.pos && out.buf[out.pos - 1] != '\n')                    \
+               pr_newline(&out);                                       \
+                                                                       \
        if (!ret && out.allocation_failure)                             \
                ret = -ENOMEM;                                          \
                                                                        \