Lines Matching refs:outdir
256 static errcode_t alloc_size_dir(ext2_filsys fs, struct out_dir *outdir, in alloc_size_dir() argument
261 if (outdir->max) { in alloc_size_dir()
262 new_mem = realloc(outdir->buf, blocks * fs->blocksize); in alloc_size_dir()
265 outdir->buf = new_mem; in alloc_size_dir()
266 new_mem = realloc(outdir->hashes, in alloc_size_dir()
270 outdir->hashes = new_mem; in alloc_size_dir()
272 outdir->buf = malloc(blocks * fs->blocksize); in alloc_size_dir()
273 outdir->hashes = malloc(blocks * sizeof(ext2_dirhash_t)); in alloc_size_dir()
274 outdir->num = 0; in alloc_size_dir()
276 outdir->max = blocks; in alloc_size_dir()
280 static void free_out_dir(struct out_dir *outdir) in free_out_dir() argument
282 free(outdir->buf); in free_out_dir()
283 free(outdir->hashes); in free_out_dir()
284 outdir->max = 0; in free_out_dir()
285 outdir->num =0; in free_out_dir()
288 static errcode_t get_next_block(ext2_filsys fs, struct out_dir *outdir, in get_next_block() argument
293 if (outdir->num >= outdir->max) { in get_next_block()
294 retval = alloc_size_dir(fs, outdir, outdir->max + 50); in get_next_block()
298 *ret = outdir->buf + (outdir->num++ * fs->blocksize); in get_next_block()
430 struct out_dir *outdir) in copy_dir_entries() argument
455 outdir->max = 0; in copy_dir_entries()
456 retval = alloc_size_dir(fs, outdir, in copy_dir_entries()
460 outdir->num = fd->compress ? 0 : 1; in copy_dir_entries()
462 outdir->hashes[0] = 0; in copy_dir_entries()
464 if ((retval = get_next_block(fs, outdir, &block_start))) in copy_dir_entries()
491 if ((retval = get_next_block(fs, outdir, in copy_dir_entries()
500 outdir->hashes[outdir->num-1] = ent->hash | 1; in copy_dir_entries()
502 outdir->hashes[outdir->num-1] = ent->hash; in copy_dir_entries()
611 struct out_dir *outdir, int i, in alloc_blocks() argument
620 *prev_ent = (struct ext2_dx_entry *) (outdir->buf + *prev_offset); in alloc_blocks()
621 (*prev_ent)->block = ext2fs_cpu_to_le32(outdir->num); in alloc_blocks()
625 ext2fs_cpu_to_le32(outdir->hashes[i]); in alloc_blocks()
627 retval = get_next_block(fs, outdir, &block_start); in alloc_blocks()
634 *next_offset = ((char *) *next_ent - outdir->buf); in alloc_blocks()
648 struct out_dir *outdir, in calculate_tree() argument
659 root_info = set_root_node(fs, outdir->buf, ino, parent); in calculate_tree()
660 root_offset = limit_offset = ((char *) root_info - outdir->buf) + in calculate_tree()
662 root_limit = (struct ext2_dx_countlimit *) (outdir->buf + limit_offset); in calculate_tree()
664 nblks = outdir->num; in calculate_tree()
669 root = (struct ext2_dx_entry *) (outdir->buf + root_offset); in calculate_tree()
674 ext2fs_cpu_to_le32(outdir->hashes[i]); in calculate_tree()
688 NULL, outdir, i, &c1, in calculate_tree()
696 ext2fs_cpu_to_le32(outdir->hashes[i]); in calculate_tree()
714 &int_offset, outdir, i, in calculate_tree()
722 NULL, outdir, i, &c2, in calculate_tree()
731 ext2fs_cpu_to_le32(outdir->hashes[i]); in calculate_tree()
742 root_limit = (struct ext2_dx_countlimit *) (outdir->buf + limit_offset); in calculate_tree()
750 struct out_dir *outdir; member
779 if (blockcnt < wd->outdir->num) in write_dir_block()
780 dir = wd->outdir->buf + (blockcnt * fs->blocksize); in write_dir_block()
787 wd->outdir->num++; in write_dir_block()
809 struct out_dir *outdir, in write_directory() argument
816 retval = e2fsck_expand_directory(ctx, ino, -1, outdir->num); in write_directory()
820 wd.outdir = outdir; in write_directory()
840 ino, outdir->num, outdir->num * fs->blocksize); in write_directory()
842 retval = ext2fs_inode_size_set(fs, inode, (ext2_off64_t)outdir->num * in write_directory()
848 return ext2fs_punch(fs, ino, inode, NULL, outdir->num, ~0ULL); in write_directory()
860 struct out_dir outdir = { 0, 0, 0, 0 }; in e2fsck_rehash_dir() local
942 retval = copy_dir_entries(ctx, &fd, &outdir); in e2fsck_rehash_dir()
950 retval = calculate_tree(fs, &outdir, ino, fd.parent); in e2fsck_rehash_dir()
955 retval = write_directory(ctx, fs, &outdir, ino, &inode, fd.compress); in e2fsck_rehash_dir()
967 free_out_dir(&outdir); in e2fsck_rehash_dir()