Lines Matching defs:edi
35 extern void free_empty_dirblock(empty_dir_info edi);
36 extern void add_empty_dirblock(empty_dir_info edi,
38 extern void process_empty_dirblock(e2fsck_t ctx, empty_dir_info edi);
43 empty_dir_info edi;
46 edi = malloc(sizeof(struct empty_dir_info_struct));
47 if (!edi)
50 memset(edi, 0, sizeof(struct empty_dir_info_struct));
52 retval = ext2fs_init_dblist(ctx->fs, &edi->empty_dblist);
57 &edi->empty_dir_blocks);
62 &edi->dir_map);
66 return (edi);
69 free_empty_dirblock(edi);
73 void free_empty_dirblock(empty_dir_info edi)
75 if (!edi)
77 if (edi->empty_dblist)
78 ext2fs_free_dblist(edi->empty_dblist);
79 if (edi->empty_dir_blocks)
80 ext2fs_free_block_bitmap(edi->empty_dir_blocks);
81 if (edi->dir_map)
82 ext2fs_free_inode_bitmap(edi->dir_map);
84 memset(edi, 0, sizeof(struct empty_dir_info_struct));
85 free(edi);
88 void add_empty_dirblock(empty_dir_info edi,
91 if (!edi || !db)
100 ext2fs_mark_block_bitmap(edi->empty_dir_blocks, db->blk);
101 if (ext2fs_test_inode_bitmap(edi->dir_map, db->ino))
103 ext2fs_mark_inode_bitmap(edi->dir_map, db->ino);
105 ext2fs_add_dir_block(edi->empty_dblist, db->ino,
122 empty_dir_info edi = (empty_dir_info) priv_data;
130 retval = ext2fs_bmap(fs, edi->ino, &edi->inode,
131 edi->block_buf, 0, edi->logblk,
137 edi->logblk++;
138 } while (ext2fs_test_block_bitmap(edi->empty_dir_blocks, new_block));
143 edi->freed_blocks++;
154 empty_dir_info edi = (empty_dir_info) priv_data;
156 edi->logblk = 0;
157 edi->freed_blocks = 0;
158 edi->ino = db->ino;
160 retval = ext2fs_read_inode(fs, db->ino, &edi->inode);
164 retval = ext2fs_block_iterate2(fs, db->ino, 0, edi->block_buf,
165 empty_pass1, edi);
169 if (edi->freed_blocks) {
170 edi->inode.i_size -= edi->freed_blocks * fs->blocksize;
171 ext2fs_iblk_add_blocks(fs, &edi->inode, edi->freed_blocks);
172 retval = ext2fs_write_inode(fs, db->ino, &edi->inode);
179 void process_empty_dirblock(e2fsck_t ctx, empty_dir_info edi)
181 if (!edi)
184 edi->block_buf = malloc(ctx->fs->blocksize * 3);
186 if (edi->block_buf) {
187 (void) ext2fs_dblist_iterate(edi->empty_dblist,
188 fix_directory, &edi);
190 free(edi->block_buf);
191 free_empty_dirblock(edi);