aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kunit/string-stream.h
diff options
context:
space:
mode:
authorRichard Fitzgerald <[email protected]>2023-08-28 10:41:07 +0000
committerShuah Khan <[email protected]>2023-09-18 16:45:35 +0000
commit20631e154c78f4140fffe111f5c79464fae3c38c (patch)
treefc8e4ffead49f1e3585cb102682c86fe86aee0ee /lib/kunit/string-stream.h
parentkunit: Don't use a managed alloc in is_literal() (diff)
downloadkernel-20631e154c78f4140fffe111f5c79464fae3c38c.tar.gz
kernel-20631e154c78f4140fffe111f5c79464fae3c38c.zip
kunit: string-stream: Add kunit_alloc_string_stream()
Add function kunit_alloc_string_stream() to do a resource-managed allocation of a string stream, and corresponding kunit_free_string_stream() to free the resource-managed stream. This is preparing for decoupling the string_stream implementation from struct kunit, to reduce the amount of code churn when that happens. Currently: - kunit_alloc_string_stream() only calls alloc_string_stream(). - kunit_free_string_stream() takes a struct kunit* which isn't used yet. Callers of the old alloc_string_stream() and string_stream_destroy() are all requesting a managed allocation so have been changed to use the new functions. alloc_string_stream() has been temporarily made static because its current behavior has been replaced with kunit_alloc_string_stream(). Signed-off-by: Richard Fitzgerald <[email protected]> Reviewed-by: David Gow <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
Diffstat (limited to 'lib/kunit/string-stream.h')
-rw-r--r--lib/kunit/string-stream.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/kunit/string-stream.h b/lib/kunit/string-stream.h
index 048930bf97f0..3e70ee9d66e9 100644
--- a/lib/kunit/string-stream.h
+++ b/lib/kunit/string-stream.h
@@ -30,7 +30,8 @@ struct string_stream {
struct kunit;
-struct string_stream *alloc_string_stream(struct kunit *test, gfp_t gfp);
+struct string_stream *kunit_alloc_string_stream(struct kunit *test, gfp_t gfp);
+void kunit_free_string_stream(struct kunit *test, struct string_stream *stream);
int __printf(2, 3) string_stream_add(struct string_stream *stream,
const char *fmt, ...);