summaryrefslogtreecommitdiff
path: root/libbcachefs/printbuf.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-03-29 21:46:58 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-03-29 21:50:53 -0400
commit3e2d5b2b9a45fd185c847f432950f2530171d216 (patch)
tree9652bf8ca2bf389498af11472e718e60b2402898 /libbcachefs/printbuf.c
parent7c47145f6cdf9826f9dc24c935195b58268b1ec6 (diff)
Update bcachefs sources to 0a2abe7ce837 bcachefs: Don't use designated initializers for disk_accounting_pos
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/printbuf.c')
-rw-r--r--libbcachefs/printbuf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libbcachefs/printbuf.c b/libbcachefs/printbuf.c
index 4cf5a2af..3302bbc7 100644
--- a/libbcachefs/printbuf.c
+++ b/libbcachefs/printbuf.c
@@ -277,6 +277,25 @@ void bch2_printbuf_indent_add(struct printbuf *buf, unsigned spaces)
}
/**
+ * bch2_printbuf_indent_add_nextline() - add to the current indent level for
+ * subsequent lines
+ *
+ * @buf: printbuf to control
+ * @spaces: number of spaces to add to the current indent level
+ *
+ * Subsequent lines - not the current line - will be indented by @spaces more
+ * spaces.
+ */
+void bch2_printbuf_indent_add_nextline(struct printbuf *buf, unsigned spaces)
+{
+ if (WARN_ON_ONCE(buf->indent + spaces < buf->indent))
+ spaces = 0;
+
+ buf->indent += spaces;
+ buf->has_indent_or_tabstops = true;
+}
+
+/**
* bch2_printbuf_indent_sub() - subtract from the current indent level
*
* @buf: printbuf to control