Lines Matching full:out

18 int bch2_printbuf_make_room(struct printbuf *out, unsigned extra)  in bch2_printbuf_make_room()  argument
23 if (!out->heap_allocated) in bch2_printbuf_make_room()
29 if (out->pos + extra < out->size) in bch2_printbuf_make_room()
32 new_size = roundup_pow_of_two(out->size + extra); in bch2_printbuf_make_room()
38 buf = krealloc(out->buf, new_size, !out->atomic ? GFP_KERNEL : GFP_NOWAIT); in bch2_printbuf_make_room()
41 out->allocation_failure = true; in bch2_printbuf_make_room()
45 out->buf = buf; in bch2_printbuf_make_room()
46 out->size = new_size; in bch2_printbuf_make_room()
50 void bch2_prt_vprintf(struct printbuf *out, const char *fmt, va_list args) in bch2_prt_vprintf() argument
58 len = vsnprintf(out->buf + out->pos, printbuf_remaining(out), fmt, args2); in bch2_prt_vprintf()
60 } while (len + 1 >= printbuf_remaining(out) && in bch2_prt_vprintf()
61 !bch2_printbuf_make_room(out, len + 1)); in bch2_prt_vprintf()
64 printbuf_remaining(out) ? printbuf_remaining(out) - 1 : 0); in bch2_prt_vprintf()
65 out->pos += len; in bch2_prt_vprintf()
68 void bch2_prt_printf(struct printbuf *out, const char *fmt, ...) in bch2_prt_printf() argument
75 len = vsnprintf(out->buf + out->pos, printbuf_remaining(out), fmt, args); in bch2_prt_printf()
77 } while (len + 1 >= printbuf_remaining(out) && in bch2_prt_printf()
78 !bch2_printbuf_make_room(out, len + 1)); in bch2_prt_printf()
81 printbuf_remaining(out) ? printbuf_remaining(out) - 1 : 0); in bch2_prt_printf()
82 out->pos += len; in bch2_prt_printf()
224 static void __prt_tab(struct printbuf *out) in __prt_tab() argument
226 int spaces = max_t(int, 0, cur_tabstop(out) - printbuf_linelen(out)); in __prt_tab()
228 prt_chars(out, ' ', spaces); in __prt_tab()
230 out->last_field = out->pos; in __prt_tab()
231 out->cur_tabstop++; in __prt_tab()
236 * @out: printbuf to control
240 void bch2_prt_tab(struct printbuf *out) in bch2_prt_tab() argument
242 if (WARN_ON(!cur_tabstop(out))) in bch2_prt_tab()
245 __prt_tab(out); in bch2_prt_tab()
293 * @out: output printbuf
302 void bch2_prt_bytes_indented(struct printbuf *out, const char *str, unsigned count) in bch2_prt_bytes_indented() argument
307 if (!out->has_indent_or_tabstops || out->suppress_indent_tabstop_handling) { in bch2_prt_bytes_indented()
308 prt_bytes(out, str, count); in bch2_prt_bytes_indented()
315 prt_bytes(out, unprinted_start, str - unprinted_start); in bch2_prt_bytes_indented()
317 bch2_prt_newline(out); in bch2_prt_bytes_indented()
320 if (likely(cur_tabstop(out))) { in bch2_prt_bytes_indented()
321 prt_bytes(out, unprinted_start, str - unprinted_start); in bch2_prt_bytes_indented()
323 __prt_tab(out); in bch2_prt_bytes_indented()
327 if (likely(cur_tabstop(out))) { in bch2_prt_bytes_indented()
328 prt_bytes(out, unprinted_start, str - unprinted_start); in bch2_prt_bytes_indented()
330 __prt_tab_rjust(out); in bch2_prt_bytes_indented()
338 prt_bytes(out, unprinted_start, str - unprinted_start); in bch2_prt_bytes_indented()
342 * bch2_prt_human_readable_u64() - Print out a u64 in human readable units
343 * @out: output printbuf
346 * Units of 2^10 (default) or 10^3 are controlled via @out->si_units
348 void bch2_prt_human_readable_u64(struct printbuf *out, u64 v) in bch2_prt_human_readable_u64() argument
350 bch2_printbuf_make_room(out, 10); in bch2_prt_human_readable_u64()
351 out->pos += string_get_size(v, 1, !out->si_units, in bch2_prt_human_readable_u64()
352 out->buf + out->pos, in bch2_prt_human_readable_u64()
353 printbuf_remaining_size(out)); in bch2_prt_human_readable_u64()
357 * bch2_prt_human_readable_s64() - Print out a s64 in human readable units
358 * @out: output printbuf
361 * Units of 2^10 (default) or 10^3 are controlled via @out->si_units
363 void bch2_prt_human_readable_s64(struct printbuf *out, s64 v) in bch2_prt_human_readable_s64() argument
366 prt_char(out, '-'); in bch2_prt_human_readable_s64()
367 bch2_prt_human_readable_u64(out, abs(v)); in bch2_prt_human_readable_s64()
371 * bch2_prt_units_u64() - Print out a u64 according to printbuf unit options
372 * @out: output printbuf
378 void bch2_prt_units_u64(struct printbuf *out, u64 v) in bch2_prt_units_u64() argument
380 if (out->human_readable_units) in bch2_prt_units_u64()
381 bch2_prt_human_readable_u64(out, v); in bch2_prt_units_u64()
383 bch2_prt_printf(out, "%llu", v); in bch2_prt_units_u64()
387 * bch2_prt_units_s64() - Print out a s64 according to printbuf unit options
388 * @out: output printbuf
394 void bch2_prt_units_s64(struct printbuf *out, s64 v) in bch2_prt_units_s64() argument
397 prt_char(out, '-'); in bch2_prt_units_s64()
398 bch2_prt_units_u64(out, abs(v)); in bch2_prt_units_s64()
401 void bch2_prt_string_option(struct printbuf *out, in bch2_prt_string_option() argument
408 bch2_prt_printf(out, i == selected ? "[%s] " : "%s ", list[i]); in bch2_prt_string_option()
411 void bch2_prt_bitflags(struct printbuf *out, in bch2_prt_bitflags() argument
422 bch2_prt_printf(out, ","); in bch2_prt_bitflags()
424 bch2_prt_printf(out, "%s", list[bit]); in bch2_prt_bitflags()
429 void bch2_prt_bitflags_vector(struct printbuf *out, in bch2_prt_bitflags_vector() argument
444 bch2_prt_printf(out, ","); in bch2_prt_bitflags_vector()
446 bch2_prt_printf(out, "%s", list[i]); in bch2_prt_bitflags_vector()