Lines Matching refs:out

18 int bch2_printbuf_make_room(struct printbuf *out, unsigned extra)
23 if (!out->heap_allocated)
29 if (out->pos + extra < out->size)
32 new_size = roundup_pow_of_two(out->size + extra);
38 buf = krealloc(out->buf, new_size, !out->atomic ? GFP_KERNEL : GFP_NOWAIT);
41 out->allocation_failure = true;
45 out->buf = buf;
46 out->size = new_size;
50 void bch2_prt_vprintf(struct printbuf *out, const char *fmt, va_list args)
58 len = vsnprintf(out->buf + out->pos, printbuf_remaining(out), fmt, args2);
60 } while (len + 1 >= printbuf_remaining(out) &&
61 !bch2_printbuf_make_room(out, len + 1));
64 printbuf_remaining(out) ? printbuf_remaining(out) - 1 : 0);
65 out->pos += len;
68 void bch2_prt_printf(struct printbuf *out, const char *fmt, ...)
75 len = vsnprintf(out->buf + out->pos, printbuf_remaining(out), fmt, args);
77 } while (len + 1 >= printbuf_remaining(out) &&
78 !bch2_printbuf_make_room(out, len + 1));
81 printbuf_remaining(out) ? printbuf_remaining(out) - 1 : 0);
82 out->pos += len;
224 static void __prt_tab(struct printbuf *out)
226 int spaces = max_t(int, 0, cur_tabstop(out) - printbuf_linelen(out));
228 prt_chars(out, ' ', spaces);
230 out->last_field = out->pos;
231 out->cur_tabstop++;
236 * @out: printbuf to control
240 void bch2_prt_tab(struct printbuf *out)
242 if (WARN_ON(!cur_tabstop(out)))
245 __prt_tab(out);
293 * @out: output printbuf
302 void bch2_prt_bytes_indented(struct printbuf *out, const char *str, unsigned count)
307 if (!out->has_indent_or_tabstops || out->suppress_indent_tabstop_handling) {
308 prt_bytes(out, str, count);
315 prt_bytes(out, unprinted_start, str - unprinted_start);
317 bch2_prt_newline(out);
320 if (likely(cur_tabstop(out))) {
321 prt_bytes(out, unprinted_start, str - unprinted_start);
323 __prt_tab(out);
327 if (likely(cur_tabstop(out))) {
328 prt_bytes(out, unprinted_start, str - unprinted_start);
330 __prt_tab_rjust(out);
338 prt_bytes(out, unprinted_start, str - unprinted_start);
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)
350 bch2_printbuf_make_room(out, 10);
351 out->pos += string_get_size(v, 1, !out->si_units,
352 out->buf + out->pos,
353 printbuf_remaining_size(out));
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)
366 prt_char(out, '-');
367 bch2_prt_human_readable_u64(out, abs(v));
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)
380 if (out->human_readable_units)
381 bch2_prt_human_readable_u64(out, v);
383 bch2_prt_printf(out, "%llu", v);
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)
397 prt_char(out, '-');
398 bch2_prt_units_u64(out, abs(v));
401 void bch2_prt_string_option(struct printbuf *out,
408 bch2_prt_printf(out, i == selected ? "[%s] " : "%s ", list[i]);
411 void bch2_prt_bitflags(struct printbuf *out,
422 bch2_prt_printf(out, ",");
424 bch2_prt_printf(out, "%s", list[bit]);
429 void bch2_prt_bitflags_vector(struct printbuf *out,
444 bch2_prt_printf(out, ",");
446 bch2_prt_printf(out, "%s", list[i]);