#ifndef NO_BCACHEFS_FS
#include "bcachefs.h"
#include "thread_with_file.h"
#include <linux/anon_inodes.h>
#include <linux/file.h>
#include <linux/kthread.h>
#include <linux/pagemap.h>
#include <linux/poll.h>
#include <linux/sched/sysctl.h>
void bch2_thread_with_file_exit(struct thread_with_file *thr)
{ … }
int bch2_run_thread_with_file(struct thread_with_file *thr,
const struct file_operations *fops,
int (*fn)(void *))
{ … }
static bool stdio_redirect_has_more_input(struct stdio_redirect *stdio, size_t seen)
{ … }
static bool stdio_redirect_has_input(struct stdio_redirect *stdio)
{ … }
static bool stdio_redirect_has_output(struct stdio_redirect *stdio)
{ … }
#define STDIO_REDIRECT_BUFSIZE …
static bool stdio_redirect_has_input_space(struct stdio_redirect *stdio)
{ … }
static bool stdio_redirect_has_output_space(struct stdio_redirect *stdio)
{ … }
static void stdio_buf_init(struct stdio_buf *buf)
{ … }
static void thread_with_stdio_done(struct thread_with_stdio *thr)
{ … }
static ssize_t thread_with_stdio_read(struct file *file, char __user *ubuf,
size_t len, loff_t *ppos)
{ … }
static int thread_with_stdio_release(struct inode *inode, struct file *file)
{ … }
static ssize_t thread_with_stdio_write(struct file *file, const char __user *ubuf,
size_t len, loff_t *ppos)
{ … }
static __poll_t thread_with_stdio_poll(struct file *file, struct poll_table_struct *wait)
{ … }
static __poll_t thread_with_stdout_poll(struct file *file, struct poll_table_struct *wait)
{ … }
static int thread_with_stdio_flush(struct file *file, fl_owner_t id)
{ … }
static long thread_with_stdio_ioctl(struct file *file, unsigned int cmd, unsigned long p)
{ … }
static const struct file_operations thread_with_stdio_fops = …;
static const struct file_operations thread_with_stdout_fops = …;
static int thread_with_stdio_fn(void *arg)
{ … }
void bch2_thread_with_stdio_init(struct thread_with_stdio *thr,
const struct thread_with_stdio_ops *ops)
{ … }
int __bch2_run_thread_with_stdio(struct thread_with_stdio *thr)
{ … }
int bch2_run_thread_with_stdio(struct thread_with_stdio *thr,
const struct thread_with_stdio_ops *ops)
{ … }
int bch2_run_thread_with_stdout(struct thread_with_stdio *thr,
const struct thread_with_stdio_ops *ops)
{ … }
EXPORT_SYMBOL_GPL(…);
int bch2_stdio_redirect_read(struct stdio_redirect *stdio, char *ubuf, size_t len)
{ … }
int bch2_stdio_redirect_readline_timeout(struct stdio_redirect *stdio,
darray_char *line,
unsigned long timeout)
{ … }
int bch2_stdio_redirect_readline(struct stdio_redirect *stdio, darray_char *line)
{ … }
__printf(3, 0)
static ssize_t bch2_darray_vprintf(darray_char *out, gfp_t gfp, const char *fmt, va_list args)
{ … }
ssize_t bch2_stdio_redirect_vprintf(struct stdio_redirect *stdio, bool nonblocking,
const char *fmt, va_list args)
{ … }
ssize_t bch2_stdio_redirect_printf(struct stdio_redirect *stdio, bool nonblocking,
const char *fmt, ...)
{ … }
#endif