diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-31 22:35:49 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-05 13:12:17 -0500 |
commit | d4c8bb69d0208907f98af6a0f4da02778f2d7bdb (patch) | |
tree | f1968da6a7f9afdf20417765bb04c5d0ace7e516 /fs/bcachefs/darray.h | |
parent | 0f0fc312380b93d203be3282b2cbaee7016f2b72 (diff) |
bcachefs: Convert bch2_fs_open() to darray
Open coded dynamic arrays are deprecated.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/darray.h')
-rw-r--r-- | fs/bcachefs/darray.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/darray.h b/fs/bcachefs/darray.h index 114f86b45fd5..87b4b2d1ec76 100644 --- a/fs/bcachefs/darray.h +++ b/fs/bcachefs/darray.h @@ -69,9 +69,15 @@ static inline int __darray_make_room(darray_void *d, size_t t_size, size_t more, _ret; \ }) +#define darray_remove_item(_d, _pos) \ + array_remove_item((_d)->data, (_d)->nr, (_pos) - (_d)->data) + #define darray_for_each(_d, _i) \ for (_i = (_d).data; _i < (_d).data + (_d).nr; _i++) +#define darray_for_each_reverse(_d, _i) \ + for (_i = (_d).data + (_d).nr - 1; _i >= (_d).data; --_i) + #define darray_init(_d) \ do { \ (_d)->data = NULL; \ |