1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_THREAD_WITH_FILE_H
3 #define _BCACHEFS_THREAD_WITH_FILE_H
5 #include "thread_with_file_types.h"
9 struct thread_with_file {
10 struct task_struct *task;
15 void bch2_thread_with_file_exit(struct thread_with_file *);
16 int bch2_run_thread_with_file(struct thread_with_file *,
17 const struct file_operations *,
20 struct thread_with_stdio {
21 struct thread_with_file thr;
22 struct stdio_redirect stdio;
24 void (*exit)(struct thread_with_stdio *);
27 static inline void thread_with_stdio_done(struct thread_with_stdio *thr)
30 thr->stdio.done = true;
31 wake_up(&thr->stdio.input_wait);
32 wake_up(&thr->stdio.output_wait);
35 int bch2_run_thread_with_stdio(struct thread_with_stdio *,
36 void (*exit)(struct thread_with_stdio *),
38 int bch2_stdio_redirect_read(struct stdio_redirect *, char *, size_t);
39 int bch2_stdio_redirect_readline(struct stdio_redirect *, char *, size_t);
41 #endif /* _BCACHEFS_THREAD_WITH_FILE_H */