]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - repair/slab.h
xfs_repair: remove unused fs_has_extflgbit_allowed
[thirdparty/xfsprogs-dev.git] / repair / slab.h
CommitLineData
9c9990ba
DW
1/*
2 * Copyright (C) 2016 Oracle. All Rights Reserved.
3 *
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it would be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20#ifndef SLAB_H_
21#define SLAB_H_
22
23struct xfs_slab;
24struct xfs_slab_cursor;
25
26extern int init_slab(struct xfs_slab **, size_t);
27extern void free_slab(struct xfs_slab **);
28
29extern int slab_add(struct xfs_slab *, void *);
30extern void qsort_slab(struct xfs_slab *, int (*)(const void *, const void *));
31extern size_t slab_count(struct xfs_slab *);
32
33extern int init_slab_cursor(struct xfs_slab *,
34 int (*)(const void *, const void *), struct xfs_slab_cursor **);
35extern void free_slab_cursor(struct xfs_slab_cursor **);
36
37extern void *peek_slab_cursor(struct xfs_slab_cursor *);
38extern void advance_slab_cursor(struct xfs_slab_cursor *);
39extern void *pop_slab_cursor(struct xfs_slab_cursor *);
40
41struct xfs_bag;
42
43extern int init_bag(struct xfs_bag **);
44extern void free_bag(struct xfs_bag **);
45extern int bag_add(struct xfs_bag *, void *);
46extern int bag_remove(struct xfs_bag *, size_t);
47extern size_t bag_count(struct xfs_bag *);
48extern void *bag_item(struct xfs_bag *, size_t);
49
50#define foreach_bag_ptr(bag, idx, ptr) \
51 for ((idx) = 0, (ptr) = bag_item((bag), (idx)); \
52 (idx) < bag_count(bag); \
53 (idx)++, (ptr) = bag_item((bag), (idx)))
54
55#define foreach_bag_ptr_reverse(bag, idx, ptr) \
56 for ((idx) = bag_count(bag) - 1, (ptr) = bag_item((bag), (idx)); \
ff14f594 57 (ptr) != NULL; \
9c9990ba
DW
58 (idx)--, (ptr) = bag_item((bag), (idx)))
59
60#endif /* SLAB_H_ */