Merge tag 'xfs-6.9-merge-8' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux-block.git] / fs / xfs / scrub / xfile.h
CommitLineData
3934e8eb
DW
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2018-2023 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <djwong@kernel.org>
5 */
6#ifndef __XFS_SCRUB_XFILE_H__
7#define __XFS_SCRUB_XFILE_H__
8
9struct xfile {
10 struct file *file;
11};
12
13int xfile_create(const char *description, loff_t isize, struct xfile **xfilep);
14void xfile_destroy(struct xfile *xf);
15
e47e2e0b
CH
16int xfile_load(struct xfile *xf, void *buf, size_t count, loff_t pos);
17int xfile_store(struct xfile *xf, const void *buf, size_t count,
3934e8eb
DW
18 loff_t pos);
19
3934e8eb
DW
20loff_t xfile_seek_data(struct xfile *xf, loff_t pos);
21
6907e3c0
DW
22#define XFILE_MAX_FOLIO_SIZE (PAGE_SIZE << MAX_PAGECACHE_ORDER)
23
24#define XFILE_ALLOC (1 << 0) /* allocate folio if not present */
25struct folio *xfile_get_folio(struct xfile *xf, loff_t offset, size_t len,
26 unsigned int flags);
27void xfile_put_folio(struct xfile *xf, struct folio *folio);
28
3934e8eb 29#endif /* __XFS_SCRUB_XFILE_H__ */