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 Public
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)
56 __u32 start, end, real_end;
58 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
60 fs->write_bitmaps = ext2fs_write_bitmaps;
63 end = fs->super->s_inodes_count;
64 real_end = (EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count);
66 return (ext2fs_make_generic_bitmap(EXT2_ET_MAGIC_INODE_BITMAP, fs,
71 errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
73 ext2fs_block_bitmap *ret)
76 __u32 start, end, real_end;
78 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
80 fs->write_bitmaps = ext2fs_write_bitmaps;
82 start = fs->super->s_first_data_block;
83 end = fs->super->s_blocks_count-1;
84 real_end = (EXT2_BLOCKS_PER_GROUP(fs->super)
85 * fs->group_desc_count)-1 + start;
87 return (ext2fs_make_generic_bitmap(EXT2_ET_MAGIC_BLOCK_BITMAP, fs,
92 errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
93 ext2_ino_t end, ext2_ino_t *oend)
96 return (ext2fs_fudge_generic_bitmap_end(bitmap,
97 EXT2_ET_MAGIC_INODE_BITMAP,
98 EXT2_ET_FUDGE_INODE_BITMAP_END,
102 errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
103 blk_t end, blk_t *oend)
105 return (ext2fs_fudge_generic_bitmap_end(bitmap,
106 EXT2_ET_MAGIC_BLOCK_BITMAP,
107 EXT2_ET_FUDGE_BLOCK_BITMAP_END,
111 void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap)
113 ext2fs_clear_generic_bitmap(bitmap);
116 void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap)
118 ext2fs_clear_generic_bitmap(bitmap);