summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-12 17:15:29 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-03-13 21:22:24 -0400
commitb63570f74733851579f489f092b6c28077f57c4a (patch)
tree1d5646d417c6b1b767ad0228eac995fd75900a62 /fs/bcachefs/super.c
parent130d229ff56ccce4588448bdd45867f7497760c8 (diff)
bcachefs: bch2_print_opts()
Make sure early error messages get redirected, for kernel-fsck-from-userland. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 6c0d5dcbc7a3..961b25860c3b 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -87,6 +87,23 @@ const char * const bch2_fs_flag_strs[] = {
NULL
};
+void bch2_print_opts(struct bch_opts *opts, const char *fmt, ...)
+{
+ struct stdio_redirect *stdio = (void *)(unsigned long)opts->stdio;
+
+ va_list args;
+ va_start(args, fmt);
+ if (likely(!stdio)) {
+ vprintk(fmt, args);
+ } else {
+ if (fmt[0] == KERN_SOH[0])
+ fmt += 2;
+
+ bch2_stdio_redirect_vprintf(stdio, true, fmt, args);
+ }
+ va_end(args);
+}
+
void __bch2_print(struct bch_fs *c, const char *fmt, ...)
{
struct stdio_redirect *stdio = bch2_fs_stdio_redirect(c);