2 * bitmaps.c --- routines to read, write, and manipulate the inode and
5 * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
8 * This file may be redistributed under the terms of the GNU Library
9 * General Public License, version 2.
24 #include <sys/types.h>
30 void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap)
32 ext2fs_free_generic_bitmap(bitmap);
35 void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap)
37 ext2fs_free_generic_bitmap(bitmap);
40 errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
41 ext2fs_generic_bitmap *dest)
43 return (ext2fs_copy_generic_bitmap(src, dest));
46 void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map)
48 ext2fs_set_generic_bitmap_padding(map);
51 errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
53 ext2fs_inode_bitmap *ret)
55 __u32 start, end, real_end;
57 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
59 fs->write_bitmaps = ext2fs_write_bitmaps;
62 end = fs->super->s_inodes_count;
63 real_end = (EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count);
65 return (ext2fs_make_generic_bitmap(EXT2_ET_MAGIC_INODE_BITMAP, fs,
70 errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
72 ext2fs_block_bitmap *ret)
74 __u32 start, end, real_end;
76 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
78 fs->write_bitmaps = ext2fs_write_bitmaps;
80 start = fs->super->s_first_data_block;
81 end = fs->super->s_blocks_count-1;
82 real_end = (EXT2_BLOCKS_PER_GROUP(fs->super)
83 * fs->group_desc_count)-1 + start;
85 return (ext2fs_make_generic_bitmap(EXT2_ET_MAGIC_BLOCK_BITMAP, fs,
90 errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
91 ext2_ino_t end, ext2_ino_t *oend)
94 return (ext2fs_fudge_generic_bitmap_end(bitmap,
95 EXT2_ET_MAGIC_INODE_BITMAP,
96 EXT2_ET_FUDGE_INODE_BITMAP_END,
100 errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
101 blk_t end, blk_t *oend)
103 return (ext2fs_fudge_generic_bitmap_end(bitmap,
104 EXT2_ET_MAGIC_BLOCK_BITMAP,
105 EXT2_ET_FUDGE_BLOCK_BITMAP_END,
109 void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap)
111 ext2fs_clear_generic_bitmap(bitmap);
114 void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap)
116 ext2fs_clear_generic_bitmap(bitmap);
119 errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end,
120 ext2fs_inode_bitmap bmap)
122 return (ext2fs_resize_generic_bitmap(EXT2_ET_MAGIC_INODE_BITMAP,
123 new_end, new_real_end, bmap));
126 errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end,
127 ext2fs_block_bitmap bmap)
129 return (ext2fs_resize_generic_bitmap(EXT2_ET_MAGIC_BLOCK_BITMAP,
130 new_end, new_real_end, bmap));
133 errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
134 ext2fs_block_bitmap bm2)
136 return (ext2fs_compare_generic_bitmap(EXT2_ET_MAGIC_BLOCK_BITMAP,
137 EXT2_ET_NEQ_BLOCK_BITMAP,
141 errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
142 ext2fs_inode_bitmap bm2)
144 return (ext2fs_compare_generic_bitmap(EXT2_ET_MAGIC_INODE_BITMAP,
145 EXT2_ET_NEQ_INODE_BITMAP,
149 errcode_t ext2fs_set_inode_bitmap_range(ext2fs_inode_bitmap bmap,
150 ext2_ino_t start, unsigned int num,
153 return (ext2fs_set_generic_bitmap_range(bmap,
154 EXT2_ET_MAGIC_INODE_BITMAP,
158 errcode_t ext2fs_get_inode_bitmap_range(ext2fs_inode_bitmap bmap,
159 ext2_ino_t start, unsigned int num,
162 return (ext2fs_get_generic_bitmap_range(bmap,
163 EXT2_ET_MAGIC_INODE_BITMAP,
167 errcode_t ext2fs_set_block_bitmap_range(ext2fs_block_bitmap bmap,
168 blk_t start, unsigned int num,
171 return (ext2fs_set_generic_bitmap_range(bmap,
172 EXT2_ET_MAGIC_BLOCK_BITMAP,
176 errcode_t ext2fs_get_block_bitmap_range(ext2fs_block_bitmap bmap,
177 blk_t start, unsigned int num,
180 return (ext2fs_get_generic_bitmap_range(bmap,
181 EXT2_ET_MAGIC_BLOCK_BITMAP,