summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/thread_with_file.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-02-10 20:23:01 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2024-03-14 02:22:13 +0100
commitab6752e24ef1eb4ef2cf35c4aa87eb1c9854e1a1 (patch)
treead262db6f0727826112c25358627f3bd88a225df /fs/bcachefs/thread_with_file.h
parentbcachefs: thread_with_file: fix various printf problems (diff)
downloadlinux-ab6752e24ef1eb4ef2cf35c4aa87eb1c9854e1a1.tar.xz
linux-ab6752e24ef1eb4ef2cf35c4aa87eb1c9854e1a1.zip
bcachefs: thread_with_file: create ops structure for thread_with_stdio
Create an ops structure so we can add more file-based functionality in the next few patches. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/thread_with_file.h')
-rw-r--r--fs/bcachefs/thread_with_file.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/bcachefs/thread_with_file.h b/fs/bcachefs/thread_with_file.h
index e20f2d17ee59..5361611edb4c 100644
--- a/fs/bcachefs/thread_with_file.h
+++ b/fs/bcachefs/thread_with_file.h
@@ -49,19 +49,23 @@ int bch2_run_thread_with_file(struct thread_with_file *,
const struct file_operations *,
int (*fn)(void *));
+struct thread_with_stdio;
+
+struct thread_with_stdio_ops {
+ void (*exit)(struct thread_with_stdio *);
+ void (*fn)(struct thread_with_stdio *);
+};
+
struct thread_with_stdio {
struct thread_with_file thr;
struct stdio_redirect stdio;
- void (*exit)(struct thread_with_stdio *);
- void (*fn)(struct thread_with_stdio *);
+ const struct thread_with_stdio_ops *ops;
};
int bch2_run_thread_with_stdio(struct thread_with_stdio *,
- void (*exit)(struct thread_with_stdio *),
- void (*fn)(struct thread_with_stdio *));
+ const struct thread_with_stdio_ops *);
int bch2_run_thread_with_stdout(struct thread_with_stdio *,
- void (*exit)(struct thread_with_stdio *),
- void (*fn)(struct thread_with_stdio *));
+ const struct thread_with_stdio_ops *);
int bch2_stdio_redirect_read(struct stdio_redirect *, char *, size_t);
int bch2_stdio_redirect_readline(struct stdio_redirect *, char *, size_t);