]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/slab.h
xfs: remove unnecessary parameter from xfs_iext_inc_seq
[thirdparty/xfsprogs-dev.git] / repair / slab.h
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Copyright (C) 2016 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
5 */
6 #ifndef SLAB_H_
7 #define SLAB_H_
8
9 struct xfs_slab;
10 struct xfs_slab_cursor;
11
12 extern int init_slab(struct xfs_slab **, size_t);
13 extern void free_slab(struct xfs_slab **);
14
15 extern int slab_add(struct xfs_slab *, void *);
16 extern void qsort_slab(struct xfs_slab *, int (*)(const void *, const void *));
17 extern size_t slab_count(struct xfs_slab *);
18
19 extern int init_slab_cursor(struct xfs_slab *,
20 int (*)(const void *, const void *), struct xfs_slab_cursor **);
21 extern void free_slab_cursor(struct xfs_slab_cursor **);
22
23 extern void *peek_slab_cursor(struct xfs_slab_cursor *);
24 extern void advance_slab_cursor(struct xfs_slab_cursor *);
25 extern void *pop_slab_cursor(struct xfs_slab_cursor *);
26
27 struct xfs_bag;
28
29 extern int init_bag(struct xfs_bag **);
30 extern void free_bag(struct xfs_bag **);
31 extern int bag_add(struct xfs_bag *, void *);
32 extern int bag_remove(struct xfs_bag *, size_t);
33 extern size_t bag_count(struct xfs_bag *);
34 extern void *bag_item(struct xfs_bag *, size_t);
35
36 #define foreach_bag_ptr(bag, idx, ptr) \
37 for ((idx) = 0, (ptr) = bag_item((bag), (idx)); \
38 (idx) < bag_count(bag); \
39 (idx)++, (ptr) = bag_item((bag), (idx)))
40
41 #define foreach_bag_ptr_reverse(bag, idx, ptr) \
42 for ((idx) = bag_count(bag) - 1, (ptr) = bag_item((bag), (idx)); \
43 (ptr) != NULL; \
44 (idx)--, (ptr) = bag_item((bag), (idx)))
45
46 #endif /* SLAB_H_ */