| 1 |
|
| 2 | |
| 3 | * Common helpers for stackable filesystems and backing files.
|
| 4 | *
|
| 5 | * Copyright (C) 2023 CTERA Networks.
|
| 6 |
|
| 7 |
|
| 8 | #ifndef _LINUX_BACKING_FILE_H
|
| 9 | #define _LINUX_BACKING_FILE_H
|
| 10 |
|
| 11 | #include <linux/file.h>
|
| 12 | #include <linux/uio.h>
|
| 13 | #include <linux/fs.h>
|
| 14 |
|
| 15 | struct backing_file_ctx {
|
| 16 | const struct cred *cred;
|
| 17 | void (*accessed)(struct file *file);
|
| 18 | void (*end_write)(struct kiocb *iocb, ssize_t);
|
| 19 | };
|
| 20 |
|
| 21 | struct file *backing_file_open(const struct path *user_path, int flags,
|
| 22 | const struct path *real_path,
|
| 23 | const struct cred *cred);
|
| 24 | struct file *backing_tmpfile_open(const struct path *user_path, int flags,
|
| 25 | const struct path *real_parentpath,
|
| 26 | umode_t mode, const struct cred *cred);
|
| 27 | ssize_t backing_file_read_iter(struct file *file, struct iov_iter *iter,
|
| 28 | struct kiocb *iocb, int flags,
|
| 29 | struct backing_file_ctx *ctx);
|
| 30 | ssize_t backing_file_write_iter(struct file *file, struct iov_iter *iter,
|
| 31 | struct kiocb *iocb, int flags,
|
| 32 | struct backing_file_ctx *ctx);
|
| 33 | ssize_t backing_file_splice_read(struct file *in, struct kiocb *iocb,
|
| 34 | struct pipe_inode_info *pipe, size_t len,
|
| 35 | unsigned int flags,
|
| 36 | struct backing_file_ctx *ctx);
|
| 37 | ssize_t backing_file_splice_write(struct pipe_inode_info *pipe,
|
| 38 | struct file *out, struct kiocb *iocb,
|
| 39 | size_t len, unsigned int flags,
|
| 40 | struct backing_file_ctx *ctx);
|
| 41 | int backing_file_mmap(struct file *file, struct vm_area_struct *vma,
|
| 42 | struct backing_file_ctx *ctx);
|
| 43 |
|
| 44 | #endif
|