bmap64.h revision 69365c689b7164014e539b40ef62fc8eb804a05c
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;
19	char			*description;
20	void			*private;
21	errcode_t		base_error_code;
22};
23
24#define EXT2FS_IS_32_BITMAP(bmap) \
25	(((bmap)->magic == EXT2_ET_MAGIC_GENERIC_BITMAP) || \
26	 ((bmap)->magic == EXT2_ET_MAGIC_BLOCK_BITMAP) || \
27	 ((bmap)->magic == EXT2_ET_MAGIC_INODE_BITMAP))
28
29#define EXT2FS_IS_64_BITMAP(bmap) \
30	(((bmap)->magic == EXT2_ET_MAGIC_GENERIC_BITMAP64) || \
31	 ((bmap)->magic == EXT2_ET_MAGIC_BLOCK_BITMAP64) || \
32	 ((bmap)->magic == EXT2_ET_MAGIC_INODE_BITMAP64))
33
34struct ext2_bitmap_ops {
35	int	type;
36	/* Generic bmap operators */
37	errcode_t (*new_bmap)(ext2_filsys fs, ext2fs_generic_bitmap bmap);
38	void	(*free_bmap)(ext2fs_generic_bitmap bitmap);
39	errcode_t (*copy_bmap)(ext2fs_generic_bitmap src,
40			     ext2fs_generic_bitmap dest);
41	errcode_t (*resize_bmap)(ext2fs_generic_bitmap bitmap,
42			       __u64 new_end,
43			       __u64 new_real_end);
44	/* bit set/test operators */
45	int	(*mark_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
46	int	(*unmark_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
47	int	(*test_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
48	void	(*mark_bmap_extent)(ext2fs_generic_bitmap bitmap, __u64 arg,
49				    unsigned int num);
50	void	(*unmark_bmap_extent)(ext2fs_generic_bitmap bitmap, __u64 arg,
51				      unsigned int num);
52	int	(*test_clear_bmap_extent)(ext2fs_generic_bitmap bitmap,
53					  __u64 arg, unsigned int num);
54	errcode_t (*set_bmap_range)(ext2fs_generic_bitmap bitmap,
55				    __u64 start, size_t num, void *in);
56	errcode_t (*get_bmap_range)(ext2fs_generic_bitmap bitmap,
57				    __u64 start, size_t num, void *out);
58	void (*clear_bmap)(ext2fs_generic_bitmap bitmap);
59};
60
61extern struct ext2_bitmap_ops ext2fs_blkmap64_bitarray;
62