Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: fix for building in userspace

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+16 -16
+16 -16
fs/bcachefs/super.c
··· 87 87 NULL 88 88 }; 89 89 90 + static void bch2_print_maybe_redirect(struct stdio_redirect *stdio, const char *fmt, va_list args) 91 + { 92 + #ifdef __KERNEL__ 93 + if (unlikely(stdio)) { 94 + if (fmt[0] == KERN_SOH[0]) 95 + fmt += 2; 96 + 97 + bch2_stdio_redirect_vprintf(stdio, true, fmt, args); 98 + return; 99 + } 100 + #endif 101 + vprintk(fmt, args); 102 + } 103 + 90 104 void bch2_print_opts(struct bch_opts *opts, const char *fmt, ...) 91 105 { 92 106 struct stdio_redirect *stdio = (void *)(unsigned long)opts->stdio; 93 107 94 108 va_list args; 95 109 va_start(args, fmt); 96 - if (likely(!stdio)) { 97 - vprintk(fmt, args); 98 - } else { 99 - if (fmt[0] == KERN_SOH[0]) 100 - fmt += 2; 101 - 102 - bch2_stdio_redirect_vprintf(stdio, true, fmt, args); 103 - } 110 + bch2_print_maybe_redirect(stdio, fmt, args); 104 111 va_end(args); 105 112 } 106 113 ··· 117 110 118 111 va_list args; 119 112 va_start(args, fmt); 120 - if (likely(!stdio)) { 121 - vprintk(fmt, args); 122 - } else { 123 - if (fmt[0] == KERN_SOH[0]) 124 - fmt += 2; 125 - 126 - bch2_stdio_redirect_vprintf(stdio, true, fmt, args); 127 - } 113 + bch2_print_maybe_redirect(stdio, fmt, args); 128 114 va_end(args); 129 115 } 130 116