Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|---|
| 2 | /* |
| 3 | * Copyright (c) 2021-2024 Oracle. All Rights Reserved. |
| 4 | * Author: Darrick J. Wong <djwong@kernel.org> |
| 5 | */ |
| 6 | #ifndef __XFS_SCRUB_XFBLOB_H__ |
| 7 | #define __XFS_SCRUB_XFBLOB_H__ |
| 8 | |
| 9 | struct xfblob { |
| 10 | struct xfile *xfile; |
| 11 | loff_t last_offset; |
| 12 | }; |
| 13 | |
| 14 | typedef loff_t xfblob_cookie; |
| 15 | |
| 16 | int xfblob_create(const char *descr, struct xfblob **blobp); |
| 17 | void xfblob_destroy(struct xfblob *blob); |
| 18 | int xfblob_load(struct xfblob *blob, xfblob_cookie cookie, void *ptr, |
| 19 | uint32_t size); |
| 20 | int xfblob_store(struct xfblob *blob, xfblob_cookie *cookie, const void *ptr, |
| 21 | uint32_t size); |
| 22 | int xfblob_free(struct xfblob *blob, xfblob_cookie cookie); |
| 23 | unsigned long long xfblob_bytes(struct xfblob *blob); |
| 24 | void xfblob_truncate(struct xfblob *blob); |
| 25 | |
| 26 | static inline int |
| 27 | xfblob_storename( |
| 28 | struct xfblob *blob, |
| 29 | xfblob_cookie *cookie, |
| 30 | const struct xfs_name *xname) |
| 31 | { |
| 32 | return xfblob_store(blob, cookie, xname->name, xname->len); |
| 33 | } |
| 34 | |
| 35 | static inline int |
| 36 | xfblob_loadname( |
| 37 | struct xfblob *blob, |
| 38 | xfblob_cookie cookie, |
| 39 | struct xfs_name *xname, |
| 40 | uint32_t size) |
| 41 | { |
| 42 | int ret = xfblob_load(blob, cookie, (void *)xname->name, size); |
| 43 | if (ret) |
| 44 | return ret; |
| 45 | |
| 46 | xname->len = size; |
| 47 | return 0; |
| 48 | } |
| 49 | |
| 50 | #endif /* __XFS_SCRUB_XFBLOB_H__ */ |
| 51 |
Warning: This file is not a C or C++ file. It does not have highlighting.
