From: Darrick J. Wong Date: Wed, 28 Aug 2019 16:08:09 +0000 (-0400) Subject: xfs: create iterator error codes X-Git-Tag: v5.3.0-rc1~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a509d6dd9635281cfd208bb494d3fb2121560b7;p=thirdparty%2Fxfsprogs-dev.git xfs: create iterator error codes Source kernel commit: 5bb46e3e180d28c7ee6715f47c344be366a3fcc8 Currently, xfs doesn't have generic error codes defined for "stop iterating"; we just reuse the XFS_BTREE_QUERY_* return values. This looks a little weird if we're not actually iterating a btree index. Before we start adding more iterators, we should create general XFS_ITER_{CONTINUE,ABORT} return values and define the XFS_BTREE_QUERY_* ones from that. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 183464283..f5200ae88 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -3132,7 +3132,7 @@ xfs_alloc_has_record( /* * Walk all the blocks in the AGFL. The @walk_fn can return any negative - * error code or XFS_BTREE_QUERY_RANGE_ABORT. + * error code or XFS_ITER_*. */ int xfs_agfl_walk( diff --git a/libxfs/xfs_btree.h b/libxfs/xfs_btree.h index fcceb7c2a..80b7f9e97 100644 --- a/libxfs/xfs_btree.h +++ b/libxfs/xfs_btree.h @@ -465,8 +465,8 @@ uint xfs_btree_compute_maxlevels(uint *limits, unsigned long len); unsigned long long xfs_btree_calc_size(uint *limits, unsigned long long len); /* return codes */ -#define XFS_BTREE_QUERY_RANGE_CONTINUE 0 /* keep iterating */ -#define XFS_BTREE_QUERY_RANGE_ABORT 1 /* stop iterating */ +#define XFS_BTREE_QUERY_RANGE_CONTINUE (XFS_ITER_CONTINUE) /* keep iterating */ +#define XFS_BTREE_QUERY_RANGE_ABORT (XFS_ITER_ABORT) /* stop iterating */ typedef int (*xfs_btree_query_range_fn)(struct xfs_btree_cur *cur, union xfs_btree_rec *rec, void *priv); diff --git a/libxfs/xfs_shared.h b/libxfs/xfs_shared.h index c45acbd3a..e0641b733 100644 --- a/libxfs/xfs_shared.h +++ b/libxfs/xfs_shared.h @@ -177,4 +177,10 @@ struct xfs_ino_geometry { unsigned int agino_log; /* #bits for agino in inum */ }; +/* Keep iterating the data structure. */ +#define XFS_ITER_CONTINUE (0) + +/* Stop iterating the data structure. */ +#define XFS_ITER_ABORT (1) + #endif /* __XFS_SHARED_H__ */