Lines Matching refs:outdir
223 static errcode_t alloc_size_dir(ext2_filsys fs, struct out_dir *outdir,
228 if (outdir->max) {
229 new_mem = realloc(outdir->buf, blocks * fs->blocksize);
232 outdir->buf = new_mem;
233 new_mem = realloc(outdir->hashes,
237 outdir->hashes = new_mem;
239 outdir->buf = malloc(blocks * fs->blocksize);
240 outdir->hashes = malloc(blocks * sizeof(ext2_dirhash_t));
241 outdir->num = 0;
243 outdir->max = blocks;
247 static void free_out_dir(struct out_dir *outdir)
249 free(outdir->buf);
250 free(outdir->hashes);
251 outdir->max = 0;
252 outdir->num =0;
255 static errcode_t get_next_block(ext2_filsys fs, struct out_dir *outdir,
260 if (outdir->num >= outdir->max) {
261 retval = alloc_size_dir(fs, outdir, outdir->max + 50);
265 *ret = outdir->buf + (outdir->num++ * fs->blocksize);
399 struct out_dir *outdir)
419 outdir->max = 0;
420 retval = alloc_size_dir(fs, outdir,
424 outdir->num = fd->compress ? 0 : 1;
426 outdir->hashes[0] = 0;
428 if ((retval = get_next_block(fs, outdir, &block_start)))
450 if ((retval = get_next_block(fs, outdir,
459 outdir->hashes[outdir->num-1] = ent->hash | 1;
461 outdir->hashes[outdir->num-1] = ent->hash;
547 * outdir, and populates the root node and any necessary interior nodes.
550 struct out_dir *outdir,
562 root_info = set_root_node(fs, outdir->buf, ino, parent);
563 root_offset = limit_offset = ((char *) root_info - outdir->buf) +
565 root_limit = (struct ext2_dx_countlimit *) (outdir->buf + limit_offset);
567 nblks = outdir->num;
572 root = (struct ext2_dx_entry *) (outdir->buf + root_offset);
577 ext2fs_cpu_to_le32(outdir->hashes[i]);
593 (outdir->buf + root_offset);
594 root->block = ext2fs_cpu_to_le32(outdir->num);
597 ext2fs_cpu_to_le32(outdir->hashes[i]);
598 if ((retval = get_next_block(fs, outdir,
610 outdir->hashes[i]);
617 root_limit = (struct ext2_dx_countlimit *) (outdir->buf + limit_offset);
625 struct out_dir *outdir;
647 if (blockcnt >= wd->outdir->num) {
667 dir = wd->outdir->buf + (blockcnt * fs->blocksize);
675 struct out_dir *outdir,
682 retval = e2fsck_expand_directory(ctx, ino, -1, outdir->num);
686 wd.outdir = outdir;
703 inode.i_size = outdir->num * fs->blocksize;
717 struct out_dir outdir;
719 outdir.max = outdir.num = 0;
720 outdir.buf = 0;
721 outdir.hashes = 0;
801 retval = copy_dir_entries(ctx, &fd, &outdir);
809 retval = calculate_tree(fs, &outdir, ino, fd.parent);
814 retval = write_directory(ctx, fs, &outdir, ino, fd.compress);
822 free_out_dir(&outdir);