blob: 99a2fb23c2a1ba8bea2b6c0585abdf4907bf5ecc [file] [log] [blame]
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2018 Oracle. All Rights Reserved.
* Author: Darrick J. Wong <darrick.wong@oracle.com>
*/
#ifndef LIBFROG_BITMAP_H_
#define LIBFROG_BITMAP_H_
struct bitmap {
pthread_mutex_t bt_lock;
struct avl64tree_desc *bt_tree;
};
int bitmap_init(struct bitmap **bmap);
void bitmap_free(struct bitmap **bmap);
int bitmap_set(struct bitmap *bmap, uint64_t start, uint64_t length);
int bitmap_iterate(struct bitmap *bmap, int (*fn)(uint64_t, uint64_t, void *),
void *arg);
bool bitmap_test(struct bitmap *bmap, uint64_t start,
uint64_t len);
bool bitmap_empty(struct bitmap *bmap);
void bitmap_dump(struct bitmap *bmap);
#endif /* LIBFROG_BITMAP_H_ */