]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - lib/ext2fs/bmap64.h
libext2fs: add a bitmap implementation using rbtree's
[thirdparty/e2fsprogs.git] / lib / ext2fs / bmap64.h
CommitLineData
69365c68
TT
1/*
2 * bmap64.h --- 64-bit bitmap structure
3 *
4 * Copyright (C) 2007, 2008 Theodore Ts'o.
5 *
6 * %Begin-Header%
7 * This file may be redistributed under the terms of the GNU Public
8 * License.
9 * %End-Header%
10 */
11
12struct ext2fs_struct_generic_bitmap {
13 errcode_t magic;
14 ext2_filsys fs;
15 struct ext2_bitmap_ops *bitmap_ops;
16 int flags;
17 __u64 start, end;
18 __u64 real_end;
94968e74 19 int cluster_bits;
69365c68
TT
20 char *description;
21 void *private;
22 errcode_t base_error_code;
23};
24
25#define EXT2FS_IS_32_BITMAP(bmap) \
26 (((bmap)->magic == EXT2_ET_MAGIC_GENERIC_BITMAP) || \
27 ((bmap)->magic == EXT2_ET_MAGIC_BLOCK_BITMAP) || \
28 ((bmap)->magic == EXT2_ET_MAGIC_INODE_BITMAP))
29
30#define EXT2FS_IS_64_BITMAP(bmap) \
31 (((bmap)->magic == EXT2_ET_MAGIC_GENERIC_BITMAP64) || \
32 ((bmap)->magic == EXT2_ET_MAGIC_BLOCK_BITMAP64) || \
33 ((bmap)->magic == EXT2_ET_MAGIC_INODE_BITMAP64))
34
35struct ext2_bitmap_ops {
36 int type;
37 /* Generic bmap operators */
38 errcode_t (*new_bmap)(ext2_filsys fs, ext2fs_generic_bitmap bmap);
39 void (*free_bmap)(ext2fs_generic_bitmap bitmap);
40 errcode_t (*copy_bmap)(ext2fs_generic_bitmap src,
41 ext2fs_generic_bitmap dest);
42 errcode_t (*resize_bmap)(ext2fs_generic_bitmap bitmap,
43 __u64 new_end,
44 __u64 new_real_end);
45 /* bit set/test operators */
46 int (*mark_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
47 int (*unmark_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
48 int (*test_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
49 void (*mark_bmap_extent)(ext2fs_generic_bitmap bitmap, __u64 arg,
50 unsigned int num);
51 void (*unmark_bmap_extent)(ext2fs_generic_bitmap bitmap, __u64 arg,
52 unsigned int num);
53 int (*test_clear_bmap_extent)(ext2fs_generic_bitmap bitmap,
54 __u64 arg, unsigned int num);
55 errcode_t (*set_bmap_range)(ext2fs_generic_bitmap bitmap,
56 __u64 start, size_t num, void *in);
57 errcode_t (*get_bmap_range)(ext2fs_generic_bitmap bitmap,
58 __u64 start, size_t num, void *out);
59 void (*clear_bmap)(ext2fs_generic_bitmap bitmap);
60};
61
62extern struct ext2_bitmap_ops ext2fs_blkmap64_bitarray;
c1359d91 63extern struct ext2_bitmap_ops ext2fs_blkmap64_rbtree;