Lines Matching refs:outdir
222 static errcode_t alloc_size_dir(ext2_filsys fs, struct out_dir *outdir,
227 if (outdir->max) {
228 new_mem = realloc(outdir->buf, blocks * fs->blocksize);
231 outdir->buf = new_mem;
232 new_mem = realloc(outdir->hashes,
236 outdir->hashes = new_mem;
238 outdir->buf = malloc(blocks * fs->blocksize);
239 outdir->hashes = malloc(blocks * sizeof(ext2_dirhash_t));
240 outdir->num = 0;
242 outdir->max = blocks;
246 static void free_out_dir(struct out_dir *outdir)
248 if (outdir->buf)
249 free(outdir->buf);
250 if (outdir->hashes)
251 free(outdir->hashes);
252 outdir->max = 0;
253 outdir->num =0;
256 static errcode_t get_next_block(ext2_filsys fs, struct out_dir *outdir,
261 if (outdir->num >= outdir->max) {
262 retval = alloc_size_dir(fs, outdir, outdir->max + 50);
266 *ret = outdir->buf + (outdir->num++ * fs->blocksize);
400 struct out_dir *outdir)
410 outdir->max = 0;
411 retval = alloc_size_dir(fs, outdir,
415 outdir->num = fd->compress ? 0 : 1;
417 outdir->hashes[0] = 0;
419 if ((retval = get_next_block(fs, outdir, &block_start)))
431 if ((retval = get_next_block(fs, outdir,
440 outdir->hashes[outdir->num-1] = ent->hash | 1;
442 outdir->hashes[outdir->num-1] = ent->hash;
522 * outdir, and populates the root node and any necessary interior nodes.
525 struct out_dir *outdir,
537 root_info = set_root_node(fs, outdir->buf, ino, parent);
538 root_offset = limit_offset = ((char *) root_info - outdir->buf) +
540 root_limit = (struct ext2_dx_countlimit *) (outdir->buf + limit_offset);
542 nblks = outdir->num;
547 root = (struct ext2_dx_entry *) (outdir->buf + root_offset);
552 ext2fs_cpu_to_le32(outdir->hashes[i]);
568 (outdir->buf + root_offset);
569 root->block = ext2fs_cpu_to_le32(outdir->num);
572 ext2fs_cpu_to_le32(outdir->hashes[i]);
573 if ((retval = get_next_block(fs, outdir,
585 ext2fs_cpu_to_le32(outdir->hashes[i]);
592 root_limit = (struct ext2_dx_countlimit *) (outdir->buf + limit_offset);
600 struct out_dir *outdir;
622 if (blockcnt >= wd->outdir->num) {
634 dir = wd->outdir->buf + (blockcnt * fs->blocksize);
642 struct out_dir *outdir,
649 retval = e2fsck_expand_directory(ctx, ino, -1, outdir->num);
653 wd.outdir = outdir;
670 inode.i_size = outdir->num * fs->blocksize;
684 struct out_dir outdir;
686 outdir.max = outdir.num = 0;
687 outdir.buf = 0;
688 outdir.hashes = 0;
751 retval = copy_dir_entries(fs, &fd, &outdir);
759 retval = calculate_tree(fs, &outdir, ino, fd.parent);
764 retval = write_directory(ctx, fs, &outdir, ino, fd.compress);
774 free_out_dir(&outdir);