2 * freefs.c --- free an ext2 filesystem
4 * Copyright (C) 1993, 1994 Theodore Ts'o. This file may be redistributed
5 * under the terms of the GNU Public License.
12 #include <linux/ext2_fs.h>
16 void ext2fs_free(ext2_filsys fs)
18 if (!fs || (fs->magic != EXT2_ET_MAGIC_EXT2FS_FILSYS))
21 io_channel_close(fs->io);
24 free(fs->device_name);
30 ext2fs_free_block_bitmap(fs->block_map);
32 ext2fs_free_inode_bitmap(fs->inode_map);
36 void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap)
38 if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_INODE_BITMAP))
42 if (bitmap->description) {
43 free(bitmap->description);
44 bitmap->description = 0;
53 void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap)
55 if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_BLOCK_BITMAP))
59 if (bitmap->description) {
60 free(bitmap->description);
61 bitmap->description = 0;