Merge branch 'address-masking'
[linux-2.6-block.git] / include / linux / backing-file.h
CommitLineData
f91a704f
AG
1/* SPDX-License-Identifier: GPL-2.0-only */
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>
a6293b3e
AG
12#include <linux/uio.h>
13#include <linux/fs.h>
14
15struct backing_file_ctx {
16 const struct cred *cred;
17 struct file *user_file;
18 void (*accessed)(struct file *);
19 void (*end_write)(struct file *);
20};
f91a704f
AG
21
22struct file *backing_file_open(const struct path *user_path, int flags,
23 const struct path *real_path,
24 const struct cred *cred);
9a87907d
MS
25struct file *backing_tmpfile_open(const struct path *user_path, int flags,
26 const struct path *real_parentpath,
27 umode_t mode, const struct cred *cred);
a6293b3e
AG
28ssize_t backing_file_read_iter(struct file *file, struct iov_iter *iter,
29 struct kiocb *iocb, int flags,
30 struct backing_file_ctx *ctx);
31ssize_t backing_file_write_iter(struct file *file, struct iov_iter *iter,
32 struct kiocb *iocb, int flags,
33 struct backing_file_ctx *ctx);
9b7e9e2f
AG
34ssize_t backing_file_splice_read(struct file *in, loff_t *ppos,
35 struct pipe_inode_info *pipe, size_t len,
36 unsigned int flags,
37 struct backing_file_ctx *ctx);
38ssize_t backing_file_splice_write(struct pipe_inode_info *pipe,
39 struct file *out, loff_t *ppos, size_t len,
40 unsigned int flags,
41 struct backing_file_ctx *ctx);
f567377e
AG
42int backing_file_mmap(struct file *file, struct vm_area_struct *vma,
43 struct backing_file_ctx *ctx);
f91a704f
AG
44
45#endif /* _LINUX_BACKING_FILE_H */